Completed
Push — master ( 113d57...b40ea8 )
by Jonathan
02:59
created
src/Webtrees/Module/AdminTasksModule.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
     public function getConfigLink() {
68 68
         Database::updateSchema(self::SCHEMA_MIGRATION_PREFIX, self::SCHEMA_SETTING_NAME, self::SCHEMA_TARGET_VERSION);
69 69
         
70
-        return 'module.php?mod=' . $this->getName() . '&mod_action=AdminConfig';
70
+        return 'module.php?mod='.$this->getName().'&mod_action=AdminConfig';
71 71
     }
72 72
     
73 73
     /**
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
 	 * @return \MyArtJaub\Webtrees\Module\AdminTasks\Model\TaskProviderInterface
130 130
 	 */
131 131
     public function getProvider() {        
132
-        if(!$this->provider) {
132
+        if (!$this->provider) {
133 133
             $this->provider = new TaskProvider(WT_ROOT.WT_MODULES_DIR.$this->getName().'/tasks/');
134 134
         }
135 135
         return $this->provider;
Please login to merge, or discard this patch.
Indentation   +86 added lines, -86 removed lines patch added patch discarded remove patch
@@ -23,64 +23,64 @@  discard block
 block discarded – undo
23 23
 class AdminTasksModule extends AbstractModule 
24 24
 implements ModuleConfigInterface, ModuleBlockInterface
25 25
 {
26
-    // How to update the database schema for this module
27
-    const SCHEMA_TARGET_VERSION   = 1;
28
-    const SCHEMA_SETTING_NAME     = 'MAJ_ADMTASKS_SCHEMA_VERSION';
29
-    const SCHEMA_MIGRATION_PREFIX = '\MyArtJaub\Webtrees\Module\AdminTasks\Schema';
26
+	// How to update the database schema for this module
27
+	const SCHEMA_TARGET_VERSION   = 1;
28
+	const SCHEMA_SETTING_NAME     = 'MAJ_ADMTASKS_SCHEMA_VERSION';
29
+	const SCHEMA_MIGRATION_PREFIX = '\MyArtJaub\Webtrees\Module\AdminTasks\Schema';
30 30
     
31
-    /** @var string For custom modules - link for support, upgrades, etc. */
32
-    const CUSTOM_WEBSITE = 'https://github.com/jon48/webtrees-lib';
31
+	/** @var string For custom modules - link for support, upgrades, etc. */
32
+	const CUSTOM_WEBSITE = 'https://github.com/jon48/webtrees-lib';
33 33
     
34
-    /**
35
-     * Admin Task provider
36
-     * @var \MyArtJaub\Webtrees\Module\AdminTasks\Model\TaskProviderInterface $provider
37
-     */
38
-    protected $provider;
34
+	/**
35
+	 * Admin Task provider
36
+	 * @var \MyArtJaub\Webtrees\Module\AdminTasks\Model\TaskProviderInterface $provider
37
+	 */
38
+	protected $provider;
39 39
     
40
-    /**
41
-     * {@inheritDoc}
42
-     * @see \Fisharebest\Webtrees\Module\AbstractModule::getTitle()
43
-     */
44
-    public function getTitle() {
45
-        return I18N::translate('Administration Tasks');
46
-    }
40
+	/**
41
+	 * {@inheritDoc}
42
+	 * @see \Fisharebest\Webtrees\Module\AbstractModule::getTitle()
43
+	 */
44
+	public function getTitle() {
45
+		return I18N::translate('Administration Tasks');
46
+	}
47 47
     
48 48
    /**
49 49
     * {@inheritDoc}
50 50
     * @see \Fisharebest\Webtrees\Module\AbstractModule::getDescription()
51 51
     */
52
-    public function getDescription() {
53
-        return I18N::translate('Manage and run nearly-scheduled administration tasks.');
54
-    }
52
+	public function getDescription() {
53
+		return I18N::translate('Manage and run nearly-scheduled administration tasks.');
54
+	}
55 55
     
56
-    /**
57
-     * {@inheritDoc}
58
-     * @see \Fisharebest\Webtrees\Module\AbstractModule::modAction()
59
-     */
60
-    public function modAction($mod_action) {
61
-        Database::updateSchema(self::SCHEMA_MIGRATION_PREFIX, self::SCHEMA_SETTING_NAME, self::SCHEMA_TARGET_VERSION);
56
+	/**
57
+	 * {@inheritDoc}
58
+	 * @see \Fisharebest\Webtrees\Module\AbstractModule::modAction()
59
+	 */
60
+	public function modAction($mod_action) {
61
+		Database::updateSchema(self::SCHEMA_MIGRATION_PREFIX, self::SCHEMA_SETTING_NAME, self::SCHEMA_TARGET_VERSION);
62 62
                 
63
-        \MyArtJaub\Webtrees\Mvc\Dispatcher::getInstance()->handle($this, $mod_action);
64
-    }
63
+		\MyArtJaub\Webtrees\Mvc\Dispatcher::getInstance()->handle($this, $mod_action);
64
+	}
65 65
     
66
-    /**
67
-     * {@inheritDoc}
68
-     * @see \Fisharebest\Webtrees\Module\ModuleConfigInterface::getConfigLink()
69
-     */
70
-    public function getConfigLink() {
71
-        Database::updateSchema(self::SCHEMA_MIGRATION_PREFIX, self::SCHEMA_SETTING_NAME, self::SCHEMA_TARGET_VERSION);
66
+	/**
67
+	 * {@inheritDoc}
68
+	 * @see \Fisharebest\Webtrees\Module\ModuleConfigInterface::getConfigLink()
69
+	 */
70
+	public function getConfigLink() {
71
+		Database::updateSchema(self::SCHEMA_MIGRATION_PREFIX, self::SCHEMA_SETTING_NAME, self::SCHEMA_TARGET_VERSION);
72 72
         
73
-        return 'module.php?mod=' . $this->getName() . '&mod_action=AdminConfig';
74
-    }
73
+		return 'module.php?mod=' . $this->getName() . '&mod_action=AdminConfig';
74
+	}
75 75
     
76
-    /**
77
-     * {@inheritDoc}
78
-     * @see \Fisharebest\Webtrees\Module\ModuleBlockInterface::getBlock()
79
-     */
80
-    public function getBlock($block_id, $template = true, $cfg = array()) {
81
-        global $controller;
76
+	/**
77
+	 * {@inheritDoc}
78
+	 * @see \Fisharebest\Webtrees\Module\ModuleBlockInterface::getBlock()
79
+	 */
80
+	public function getBlock($block_id, $template = true, $cfg = array()) {
81
+		global $controller;
82 82
         
83
-        $controller->addInlineJavascript('
83
+		$controller->addInlineJavascript('
84 84
 			$(document).ready(function(){
85 85
 				$.ajax({
86 86
 					url: "module.php",
@@ -91,60 +91,60 @@  discard block
 block discarded – undo
91 91
 				});
92 92
 			});
93 93
 		');
94
-        return '';
95
-    }
94
+		return '';
95
+	}
96 96
     
97
-    /**
98
-     * {@inheritDoc}
99
-     * @see \Fisharebest\Webtrees\Module\ModuleBlockInterface::loadAjax()
100
-     */
101
-    public function loadAjax() {
102
-        return false;
103
-    }
97
+	/**
98
+	 * {@inheritDoc}
99
+	 * @see \Fisharebest\Webtrees\Module\ModuleBlockInterface::loadAjax()
100
+	 */
101
+	public function loadAjax() {
102
+		return false;
103
+	}
104 104
     
105
-    /**
106
-     * {@inheritDoc}
107
-     * @see \Fisharebest\Webtrees\Module\ModuleBlockInterface::isGedcomBlock()
108
-     */
109
-    public function isGedcomBlock() {
110
-        return true;
111
-    }
105
+	/**
106
+	 * {@inheritDoc}
107
+	 * @see \Fisharebest\Webtrees\Module\ModuleBlockInterface::isGedcomBlock()
108
+	 */
109
+	public function isGedcomBlock() {
110
+		return true;
111
+	}
112 112
     
113
-    /**
114
-     * {@inheritDoc}
115
-     * @see \Fisharebest\Webtrees\Module\ModuleBlockInterface::isUserBlock()
116
-     */
117
-    public function isUserBlock() {
118
-        return false;
119
-    }
113
+	/**
114
+	 * {@inheritDoc}
115
+	 * @see \Fisharebest\Webtrees\Module\ModuleBlockInterface::isUserBlock()
116
+	 */
117
+	public function isUserBlock() {
118
+		return false;
119
+	}
120 120
     
121
-    /**
122
-     * {@inheritDoc}
123
-     * @see \Fisharebest\Webtrees\Module\ModuleBlockInterface::configureBlock()
124
-     */
125
-    public function configureBlock($block_id) {
121
+	/**
122
+	 * {@inheritDoc}
123
+	 * @see \Fisharebest\Webtrees\Module\ModuleBlockInterface::configureBlock()
124
+	 */
125
+	public function configureBlock($block_id) {
126 126
         
127
-    }
127
+	}
128 128
    
129 129
 /**
130
-	 * Get the Admin Tasks Provider (initialise it if not done yet).
131
-	 *
132
-	 * @return \MyArtJaub\Webtrees\Module\AdminTasks\Model\TaskProviderInterface
133
-	 */
134
-    public function getProvider() {        
135
-        if(!$this->provider) {
136
-            $this->provider = new TaskProvider(WT_ROOT.WT_MODULES_DIR.$this->getName().'/tasks/');
137
-        }
138
-        return $this->provider;
139
-    }
130
+ * Get the Admin Tasks Provider (initialise it if not done yet).
131
+ *
132
+ * @return \MyArtJaub\Webtrees\Module\AdminTasks\Model\TaskProviderInterface
133
+ */
134
+	public function getProvider() {        
135
+		if(!$this->provider) {
136
+			$this->provider = new TaskProvider(WT_ROOT.WT_MODULES_DIR.$this->getName().'/tasks/');
137
+		}
138
+		return $this->provider;
139
+	}
140 140
 	
141 141
 	/**
142 142
 	 * Set the Admin Tasks Provider.
143 143
 	 *
144 144
 	 * @return \MyArtJaub\Webtrees\Module\GeoDispersion\Model\TaskProviderInterface
145 145
 	 */
146
-    public function setProvider(TaskProviderInterface $provider) {
147
-        $this->provider = $provider;
148
-    }
146
+	public function setProvider(TaskProviderInterface $provider) {
147
+		$this->provider = $provider;
148
+	}
149 149
 }
150 150
  
151 151
\ No newline at end of file
Please login to merge, or discard this patch.
src/Webtrees/Module/ModuleMenuItemInterface.php 1 patch
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -15,11 +15,11 @@
 block discarded – undo
15 15
  */
16 16
 interface ModuleMenuItemInterface
17 17
 {
18
-    /**
19
-     * Returns a menu item for the module.
20
-     * 
21
-     * @param \Fisharebest\Webtrees\Tree|null $tree
22
-     * @param mixed $reference
23
-     */
24
-    public function getMenu(\Fisharebest\Webtrees\Tree $tree, $reference);
18
+	/**
19
+	 * Returns a menu item for the module.
20
+	 * 
21
+	 * @param \Fisharebest\Webtrees\Tree|null $tree
22
+	 * @param mixed $reference
23
+	 */
24
+	public function getMenu(\Fisharebest\Webtrees\Tree $tree, $reference);
25 25
 }
26 26
\ No newline at end of file
Please login to merge, or discard this patch.
src/Webtrees/Module/AdminTasks/Model/ConfigurableTaskInterface.php 1 patch
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -15,11 +15,11 @@
 block discarded – undo
15 15
  */
16 16
 interface ConfigurableTaskInterface {
17 17
     
18
-    /**
19
-     * Returns the HTML code to display the specific task configuration.
20
-     * 
21
-     * @return string HTML code
22
-     */
18
+	/**
19
+	 * Returns the HTML code to display the specific task configuration.
20
+	 * 
21
+	 * @return string HTML code
22
+	 */
23 23
 	function htmlConfigForm();
24 24
 	
25 25
 	/**
Please login to merge, or discard this patch.
src/Webtrees/Module/AdminTasks/Model/TaskProvider.php 3 patches
Indentation   +147 added lines, -147 removed lines patch added patch discarded remove patch
@@ -20,32 +20,32 @@  discard block
 block discarded – undo
20 20
  */
21 21
 class TaskProvider implements TaskProviderInterface {
22 22
     
23
-    /**
24
-     * Root path of thr folder containing the tasks
25
-     * @var string $root_path
26
-     */
27
-    protected $root_path;
23
+	/**
24
+	 * Root path of thr folder containing the tasks
25
+	 * @var string $root_path
26
+	 */
27
+	protected $root_path;
28 28
 	    
29
-    /**
30
-     * Constructor for the Task provider
31
-     * @param string $root_path
32
-     */
33
-    public function __construct($root_path) {
34
-        $this->root_path = $root_path;
29
+	/**
30
+	 * Constructor for the Task provider
31
+	 * @param string $root_path
32
+	 */
33
+	public function __construct($root_path) {
34
+		$this->root_path = $root_path;
35 35
 		$this->all_tasks = null;
36
-    }
36
+	}
37 37
 	
38
-    /**
39
-     * Load a task object from a file.
40
-     * 
41
-     * @param string $task_name Name of the task to load.
42
-     */
38
+	/**
39
+	 * Load a task object from a file.
40
+	 * 
41
+	 * @param string $task_name Name of the task to load.
42
+	 */
43 43
 	protected function loadTask($task_name) {
44 44
 		try {
45 45
 			if (file_exists($this->root_path . $task_name .'.php')) {
46 46
 				$task = include $this->root_path . $task_name .'.php';
47 47
 				if($task instanceof AbstractTask) {
48
-				    $task->setProvider($this);
48
+					$task->setProvider($this);
49 49
 					return $task;
50 50
 				}
51 51
 			}
@@ -55,22 +55,22 @@  discard block
 block discarded – undo
55 55
 		return null;
56 56
 	}
57 57
 	
58
-    /**
59
-     * Creates and returns a Task object from a data row.
60
-     * The row data is expected to be an array with the indexes:
61
-     *  - majat_name: task name
62
-     *  - majat_status: task status
63
-     *  - majat_last_run: last run time
64
-     *  - majat_last_result: last run result
65
-     *  - majat_frequency: run frequency
66
-     *  - majat_nb_occur: remaining running occurrences
67
-     *  - majat_running: is task running
68
-     *
69
-     * @param array $row
70
-     * @return AbstractTask|null
71
-     */
72
-    protected function loadTaskFromRow($row) {
73
-        $task = $this->loadTask($row['majat_name']);
58
+	/**
59
+	 * Creates and returns a Task object from a data row.
60
+	 * The row data is expected to be an array with the indexes:
61
+	 *  - majat_name: task name
62
+	 *  - majat_status: task status
63
+	 *  - majat_last_run: last run time
64
+	 *  - majat_last_result: last run result
65
+	 *  - majat_frequency: run frequency
66
+	 *  - majat_nb_occur: remaining running occurrences
67
+	 *  - majat_running: is task running
68
+	 *
69
+	 * @param array $row
70
+	 * @return AbstractTask|null
71
+	 */
72
+	protected function loadTaskFromRow($row) {
73
+		$task = $this->loadTask($row['majat_name']);
74 74
         
75 75
 		if($task) {
76 76
 			$task->setParameters(
@@ -85,99 +85,99 @@  discard block
 block discarded – undo
85 85
 			return $task;
86 86
 		}
87 87
 		else {
88
-		    $this->deleteTask($row['majat_name']);
88
+			$this->deleteTask($row['majat_name']);
89 89
 		}
90 90
 		return null;
91
-    }
91
+	}
92 92
     
93
-    /**
94
-     * {@inheritDoc}
95
-     * @see \MyArtJaub\Webtrees\Module\AdminTasks\Model\TaskProviderInterface::getTask()
96
-     */
97
-    public function getTask($task_name, $only_enabled = true) {
98
-        $args = array (
99
-            'task_name' => $task_name
100
-        );
93
+	/**
94
+	 * {@inheritDoc}
95
+	 * @see \MyArtJaub\Webtrees\Module\AdminTasks\Model\TaskProviderInterface::getTask()
96
+	 */
97
+	public function getTask($task_name, $only_enabled = true) {
98
+		$args = array (
99
+			'task_name' => $task_name
100
+		);
101 101
     
102
-        $sql = 'SELECT majat_name, majat_status, majat_last_run, majat_last_result, majat_frequency, majat_nb_occur, majat_running' .
103
-            ' FROM `##maj_admintasks`' .
104
-            ' WHERE majat_name = :task_name';
105
-        if($only_enabled) {
106
-            $sql .= ' AND majat_status = :status';
107
-            $args['status'] = 'enabled';
108
-        }
102
+		$sql = 'SELECT majat_name, majat_status, majat_last_run, majat_last_result, majat_frequency, majat_nb_occur, majat_running' .
103
+			' FROM `##maj_admintasks`' .
104
+			' WHERE majat_name = :task_name';
105
+		if($only_enabled) {
106
+			$sql .= ' AND majat_status = :status';
107
+			$args['status'] = 'enabled';
108
+		}
109 109
     
110
-        $task_array = Database::prepare($sql)->execute($args)->fetchOneRow(\PDO::FETCH_ASSOC);
110
+		$task_array = Database::prepare($sql)->execute($args)->fetchOneRow(\PDO::FETCH_ASSOC);
111 111
     
112
-        if($task_array) {
113
-            return $this->loadTaskFromRow($task_array);
114
-        }
112
+		if($task_array) {
113
+			return $this->loadTaskFromRow($task_array);
114
+		}
115 115
     
116
-        return null;
117
-    }
116
+		return null;
117
+	}
118 118
     
119 119
 	/**
120 120
 	 * {@inheritDoc}
121 121
 	 * @see \MyArtJaub\Webtrees\Module\AdminTasks\Model\TaskProviderInterface::setTaskStatus()
122 122
 	 */
123
-    public function setTaskStatus(AbstractTask $task, $status) {
124
-        Database::prepare(
125
-            'UPDATE `##maj_admintasks`'.
126
-            ' SET majat_status = :status'.
127
-            ' WHERE majat_name = :name'
128
-        )->execute(array(
129
-                'name' => $task->getName(),
123
+	public function setTaskStatus(AbstractTask $task, $status) {
124
+		Database::prepare(
125
+			'UPDATE `##maj_admintasks`'.
126
+			' SET majat_status = :status'.
127
+			' WHERE majat_name = :name'
128
+		)->execute(array(
129
+				'name' => $task->getName(),
130 130
 				'status' => $status ? 'enabled' : 'disabled'
131
-        ));
132
-    }
131
+		));
132
+	}
133 133
 	
134 134
    /**
135 135
     * {@inheritDoc}
136 136
     * @see \MyArtJaub\Webtrees\Module\AdminTasks\Model\TaskProviderInterface::updateTask()
137 137
     */
138
-    public function updateTask(AbstractTask $task) {        
139
-        try{
140
-            Database::prepare(
141
-                'UPDATE `##maj_admintasks`'.
142
-                ' SET majat_status = :status,'.
143
-                ' majat_last_run = :last_run,'.
144
-                ' majat_last_result = :last_result,'.
145
-                ' majat_frequency = :frequency,'.
146
-                ' majat_nb_occur = :nb_occurrences,'.
147
-                ' majat_running = :is_running'.
148
-                ' WHERE majat_name = :name'
149
-                )->execute(array(
150
-                    'name' => $task->getName(),
151
-                    'status' => $task->isEnabled() ? 'enabled' : 'disabled',
152
-                    'last_run' => $task->getLastUpdated()->format('Y-m-d H:i:s'),
153
-                    'last_result' =>  $task->isLastRunSuccess() ? 1 : 0,
154
-                    'frequency' => $task->getFrequency(),
155
-                    'nb_occurrences' => $task->getRemainingOccurrences(),
156
-                    'is_running' => $task->isRunning() ? 1 : 0
157
-                ));
158
-            return true;
159
-        }
160
-        catch (\Exception $ex) {
161
-            Log::addErrorLog(sprintf('Error while updating the Admin Task %s. Exception: %s', $task->getName(), $ex->getMessage()));
162
-            return false;
163
-        }        
164
-    }
138
+	public function updateTask(AbstractTask $task) {        
139
+		try{
140
+			Database::prepare(
141
+				'UPDATE `##maj_admintasks`'.
142
+				' SET majat_status = :status,'.
143
+				' majat_last_run = :last_run,'.
144
+				' majat_last_result = :last_result,'.
145
+				' majat_frequency = :frequency,'.
146
+				' majat_nb_occur = :nb_occurrences,'.
147
+				' majat_running = :is_running'.
148
+				' WHERE majat_name = :name'
149
+				)->execute(array(
150
+					'name' => $task->getName(),
151
+					'status' => $task->isEnabled() ? 'enabled' : 'disabled',
152
+					'last_run' => $task->getLastUpdated()->format('Y-m-d H:i:s'),
153
+					'last_result' =>  $task->isLastRunSuccess() ? 1 : 0,
154
+					'frequency' => $task->getFrequency(),
155
+					'nb_occurrences' => $task->getRemainingOccurrences(),
156
+					'is_running' => $task->isRunning() ? 1 : 0
157
+				));
158
+			return true;
159
+		}
160
+		catch (\Exception $ex) {
161
+			Log::addErrorLog(sprintf('Error while updating the Admin Task %s. Exception: %s', $task->getName(), $ex->getMessage()));
162
+			return false;
163
+		}        
164
+	}
165 165
 	
166 166
 	/**
167 167
 	 * {@inheritDoc}
168 168
 	 * @see \MyArtJaub\Webtrees\Module\AdminTasks\Model\TaskProviderInterface::getTasksCount()
169 169
 	 */
170
-    public function getTasksCount() {
171
-        return Database::prepare(
172
-            'SELECT COUNT(majat_name)' .
173
-            ' FROM `##maj_admintasks`'
174
-            )->execute()->fetchOne();
175
-    }
170
+	public function getTasksCount() {
171
+		return Database::prepare(
172
+			'SELECT COUNT(majat_name)' .
173
+			' FROM `##maj_admintasks`'
174
+			)->execute()->fetchOne();
175
+	}
176 176
 	
177
-    /**
178
-     * {@inheritDoc}
179
-     * @see \MyArtJaub\Webtrees\Module\AdminTasks\Model\TaskProviderInterface::getTasksToRun()
180
-     */
177
+	/**
178
+	 * {@inheritDoc}
179
+	 * @see \MyArtJaub\Webtrees\Module\AdminTasks\Model\TaskProviderInterface::getTasksToRun()
180
+	 */
181 181
 	public function getTasksToRun($force = false, $task_name = null) 
182 182
 	{
183 183
 		$res = array();
@@ -206,12 +206,12 @@  discard block
 block discarded – undo
206 206
 		$data = Database::prepare($sql)->execute($args)->fetchAll(\PDO::FETCH_ASSOC);
207 207
 		
208 208
 		foreach($data as $task_row) {
209
-            $task = $this->loadTaskFromRow($task_row);
209
+			$task = $this->loadTaskFromRow($task_row);
210 210
 			if($task)
211 211
 			{
212 212
 				$res[] = $task;
213 213
 			} 
214
-        }
214
+		}
215 215
 		
216 216
 		return $res;	
217 217
 	}
@@ -220,69 +220,69 @@  discard block
 block discarded – undo
220 220
 	 * {@inheritDoc}
221 221
 	 * @see \MyArtJaub\Webtrees\Module\AdminTasks\Model\TaskProviderInterface::getFilteredTasksList()
222 222
 	 */
223
-    public function getFilteredTasksList($search = null, $order_by = null, $start = 0, $limit = null){
224
-        $res = array();
223
+	public function getFilteredTasksList($search = null, $order_by = null, $start = 0, $limit = null){
224
+		$res = array();
225 225
             
226
-        $sql = 'SELECT majat_name, majat_status, majat_last_run, majat_last_result, majat_frequency, majat_nb_occur, majat_running' .
227
-            ' FROM `##maj_admintasks`';
226
+		$sql = 'SELECT majat_name, majat_status, majat_last_run, majat_last_result, majat_frequency, majat_nb_occur, majat_running' .
227
+			' FROM `##maj_admintasks`';
228 228
         
229
-        $args = array();
229
+		$args = array();
230 230
                 
231
-        if ($order_by) {
232
-            $sql .= ' ORDER BY ';
233
-            $i = 0;
234
-            foreach ($order_by as $key => $value) {
235
-                if ($i > 0) {
236
-                    $sql .= ',';
237
-                }
231
+		if ($order_by) {
232
+			$sql .= ' ORDER BY ';
233
+			$i = 0;
234
+			foreach ($order_by as $key => $value) {
235
+				if ($i > 0) {
236
+					$sql .= ',';
237
+				}
238 238
                 
239
-                switch ($value['dir']) {
240
-                    case 'asc':
241
-                        $sql .= $value['column'] . ' ASC ';
242
-                        break;
243
-                    case 'desc':
244
-                        $sql .= $value['column'] . ' DESC ';
245
-                        break;
246
-                }
247
-                $i++;
248
-            }
249
-        } else {
250
-            $sql .= ' ORDER BY majat_name ASC';
251
-        }
239
+				switch ($value['dir']) {
240
+					case 'asc':
241
+						$sql .= $value['column'] . ' ASC ';
242
+						break;
243
+					case 'desc':
244
+						$sql .= $value['column'] . ' DESC ';
245
+						break;
246
+				}
247
+				$i++;
248
+			}
249
+		} else {
250
+			$sql .= ' ORDER BY majat_name ASC';
251
+		}
252 252
         
253
-        if ($limit) {
254
-            $sql .= ' LIMIT :limit OFFSET :offset';
255
-            $args['limit']  = $limit;
256
-            $args['offset'] = $start;
257
-        }
253
+		if ($limit) {
254
+			$sql .= ' LIMIT :limit OFFSET :offset';
255
+			$args['limit']  = $limit;
256
+			$args['offset'] = $start;
257
+		}
258 258
             
259
-        $data = Database::prepare($sql)->execute($args)->fetchAll(\PDO::FETCH_ASSOC);
259
+		$data = Database::prepare($sql)->execute($args)->fetchAll(\PDO::FETCH_ASSOC);
260 260
 
261
-        foreach($data as $ga) {
262
-            $task = $this->loadTaskFromRow($ga);
261
+		foreach($data as $ga) {
262
+			$task = $this->loadTaskFromRow($ga);
263 263
 			if($task && (empty($search) || ($search && strpos($task->getTitle(), $search) !== false)))
264 264
 			{
265 265
 				$res[] = $task;
266 266
 			}
267
-        }
267
+		}
268 268
 		
269
-        return $res;
270
-    }
269
+		return $res;
270
+	}
271 271
 	
272 272
 	
273
-    /**
274
-     * {inhericDoc}
275
-     * @see \MyArtJaub\Webtrees\Module\AdminTasks\Model\TaskProviderInterface::getInstalledTasks()
276
-     */
273
+	/**
274
+	 * {inhericDoc}
275
+	 * @see \MyArtJaub\Webtrees\Module\AdminTasks\Model\TaskProviderInterface::getInstalledTasks()
276
+	 */
277 277
 	public function getInstalledTasks() {
278 278
 		$tasks=array();
279 279
 		$dir=opendir($this->root_path);
280 280
 		while (($file=readdir($dir))!==false){ 
281 281
 			try {
282
-			    if($file == '.' || $file == '..') continue;
282
+				if($file == '.' || $file == '..') continue;
283 283
 				$task = include $this->root_path . $file;
284 284
 				if($task ) {
285
-				    $task->setProvider($this);
285
+					$task->setProvider($this);
286 286
 					Database::prepare(
287 287
 						'INSERT IGNORE INTO `##maj_admintasks`'.
288 288
 						' (majat_name, majat_status, majat_frequency)'.
Please login to merge, or discard this patch.
Spacing   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -42,15 +42,15 @@  discard block
 block discarded – undo
42 42
      */
43 43
 	protected function loadTask($task_name) {
44 44
 		try {
45
-			if (file_exists($this->root_path . $task_name .'.php')) {
46
-				$task = include $this->root_path . $task_name .'.php';
47
-				if($task instanceof AbstractTask) {
45
+			if (file_exists($this->root_path.$task_name.'.php')) {
46
+				$task = include $this->root_path.$task_name.'.php';
47
+				if ($task instanceof AbstractTask) {
48 48
 				    $task->setProvider($this);
49 49
 					return $task;
50 50
 				}
51 51
 			}
52 52
 		}
53
-		catch(\Exception $ex) { }
53
+		catch (\Exception $ex) { }
54 54
 		
55 55
 		return null;
56 56
 	}
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
     protected function loadTaskFromRow($row) {
73 73
         $task = $this->loadTask($row['majat_name']);
74 74
         
75
-		if($task) {
75
+		if ($task) {
76 76
 			$task->setParameters(
77 77
 				$row['majat_status'] == 'enabled',
78 78
 				new \DateTime($row['majat_last_run']), 
@@ -95,21 +95,21 @@  discard block
 block discarded – undo
95 95
      * @see \MyArtJaub\Webtrees\Module\AdminTasks\Model\TaskProviderInterface::getTask()
96 96
      */
97 97
     public function getTask($task_name, $only_enabled = true) {
98
-        $args = array (
98
+        $args = array(
99 99
             'task_name' => $task_name
100 100
         );
101 101
     
102
-        $sql = 'SELECT majat_name, majat_status, majat_last_run, majat_last_result, majat_frequency, majat_nb_occur, majat_running' .
103
-            ' FROM `##maj_admintasks`' .
102
+        $sql = 'SELECT majat_name, majat_status, majat_last_run, majat_last_result, majat_frequency, majat_nb_occur, majat_running'.
103
+            ' FROM `##maj_admintasks`'.
104 104
             ' WHERE majat_name = :task_name';
105
-        if($only_enabled) {
105
+        if ($only_enabled) {
106 106
             $sql .= ' AND majat_status = :status';
107 107
             $args['status'] = 'enabled';
108 108
         }
109 109
     
110 110
         $task_array = Database::prepare($sql)->execute($args)->fetchOneRow(\PDO::FETCH_ASSOC);
111 111
     
112
-        if($task_array) {
112
+        if ($task_array) {
113 113
             return $this->loadTaskFromRow($task_array);
114 114
         }
115 115
     
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
     * @see \MyArtJaub\Webtrees\Module\AdminTasks\Model\TaskProviderInterface::updateTask()
137 137
     */
138 138
     public function updateTask(AbstractTask $task) {        
139
-        try{
139
+        try {
140 140
             Database::prepare(
141 141
                 'UPDATE `##maj_admintasks`'.
142 142
                 ' SET majat_status = :status,'.
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
 	 */
170 170
     public function getTasksCount() {
171 171
         return Database::prepare(
172
-            'SELECT COUNT(majat_name)' .
172
+            'SELECT COUNT(majat_name)'.
173 173
             ' FROM `##maj_admintasks`'
174 174
             )->execute()->fetchOne();
175 175
     }
@@ -194,20 +194,20 @@  discard block
 block discarded – undo
194 194
 			'time_out' => AbstractTask::TASK_TIME_OUT		
195 195
 		);
196 196
 		
197
-		if(!$force) {
197
+		if (!$force) {
198 198
 			$sql .= ' AND (DATE_ADD(majat_last_run, INTERVAL majat_frequency MINUTE) <= NOW() OR majat_last_result = 0)';
199 199
 		}
200 200
 		
201
-		if($task_name) {
201
+		if ($task_name) {
202 202
 			$sql .= ' AND majat_name = :task_name';
203 203
 			$args['task_name'] = $task_name;
204 204
 		}
205 205
 		
206 206
 		$data = Database::prepare($sql)->execute($args)->fetchAll(\PDO::FETCH_ASSOC);
207 207
 		
208
-		foreach($data as $task_row) {
208
+		foreach ($data as $task_row) {
209 209
             $task = $this->loadTaskFromRow($task_row);
210
-			if($task)
210
+			if ($task)
211 211
 			{
212 212
 				$res[] = $task;
213 213
 			} 
@@ -220,10 +220,10 @@  discard block
 block discarded – undo
220 220
 	 * {@inheritDoc}
221 221
 	 * @see \MyArtJaub\Webtrees\Module\AdminTasks\Model\TaskProviderInterface::getFilteredTasksList()
222 222
 	 */
223
-    public function getFilteredTasksList($search = null, $order_by = null, $start = 0, $limit = null){
223
+    public function getFilteredTasksList($search = null, $order_by = null, $start = 0, $limit = null) {
224 224
         $res = array();
225 225
             
226
-        $sql = 'SELECT majat_name, majat_status, majat_last_run, majat_last_result, majat_frequency, majat_nb_occur, majat_running' .
226
+        $sql = 'SELECT majat_name, majat_status, majat_last_run, majat_last_result, majat_frequency, majat_nb_occur, majat_running'.
227 227
             ' FROM `##maj_admintasks`';
228 228
         
229 229
         $args = array();
@@ -238,10 +238,10 @@  discard block
 block discarded – undo
238 238
                 
239 239
                 switch ($value['dir']) {
240 240
                     case 'asc':
241
-                        $sql .= $value['column'] . ' ASC ';
241
+                        $sql .= $value['column'].' ASC ';
242 242
                         break;
243 243
                     case 'desc':
244
-                        $sql .= $value['column'] . ' DESC ';
244
+                        $sql .= $value['column'].' DESC ';
245 245
                         break;
246 246
                 }
247 247
                 $i++;
@@ -258,9 +258,9 @@  discard block
 block discarded – undo
258 258
             
259 259
         $data = Database::prepare($sql)->execute($args)->fetchAll(\PDO::FETCH_ASSOC);
260 260
 
261
-        foreach($data as $ga) {
261
+        foreach ($data as $ga) {
262 262
             $task = $this->loadTaskFromRow($ga);
263
-			if($task && (empty($search) || ($search && strpos($task->getTitle(), $search) !== false)))
263
+			if ($task && (empty($search) || ($search && strpos($task->getTitle(), $search) !== false)))
264 264
 			{
265 265
 				$res[] = $task;
266 266
 			}
@@ -275,13 +275,13 @@  discard block
 block discarded – undo
275 275
      * @see \MyArtJaub\Webtrees\Module\AdminTasks\Model\TaskProviderInterface::getInstalledTasks()
276 276
      */
277 277
 	public function getInstalledTasks() {
278
-		$tasks=array();
279
-		$dir=opendir($this->root_path);
280
-		while (($file=readdir($dir))!==false){ 
278
+		$tasks = array();
279
+		$dir = opendir($this->root_path);
280
+		while (($file = readdir($dir)) !== false) { 
281 281
 			try {
282
-			    if($file == '.' || $file == '..') continue;
283
-				$task = include $this->root_path . $file;
284
-				if($task ) {
282
+			    if ($file == '.' || $file == '..') continue;
283
+				$task = include $this->root_path.$file;
284
+				if ($task) {
285 285
 				    $task->setProvider($this);
286 286
 					Database::prepare(
287 287
 						'INSERT IGNORE INTO `##maj_admintasks`'.
@@ -300,7 +300,7 @@  discard block
 block discarded – undo
300 300
 				}
301 301
 			}
302 302
 			catch (\Exception $ex) {
303
-				Log::addErrorLog('An error occured while trying to load the task in file ' . $file . '. Exception: ' . $ex->getMessage());
303
+				Log::addErrorLog('An error occured while trying to load the task in file '.$file.'. Exception: '.$ex->getMessage());
304 304
 			}
305 305
 		}
306 306
 		return $tasks;
@@ -311,14 +311,14 @@  discard block
 block discarded – undo
311 311
 	 * {inhericDoc}
312 312
 	 * @see \MyArtJaub\Webtrees\Module\AdminTasks\Model\TaskProviderInterface::deleteTask()
313 313
 	 */
314
-	public function deleteTask($task_name){
315
-		try{
314
+	public function deleteTask($task_name) {
315
+		try {
316 316
 			Database::beginTransaction();
317 317
 			
318 318
 			Database::prepare('DELETE FROM  `##maj_admintasks` WHERE majat_name= :task_name')
319 319
 				->execute(array('task_name' => $task_name));
320 320
 			Database::prepare('DELETE FROM  `##gedcom_setting` WHERE setting_name LIKE :setting_name')
321
-				->execute(array('setting_name' => 'MAJ_AT_' . $task_name .'%'));
321
+				->execute(array('setting_name' => 'MAJ_AT_'.$task_name.'%'));
322 322
 				
323 323
 			Database::commit();
324 324
 			
@@ -326,10 +326,10 @@  discard block
 block discarded – undo
326 326
 			
327 327
 			return true;
328 328
 		}
329
-		catch(\Exception $ex) {
329
+		catch (\Exception $ex) {
330 330
 			Database::rollback();
331 331
 		
332
-			Log::addErrorLog('An error occurred while deleting Admin Task '.$task_name.'. Exception: '. $ex->getMessage());
332
+			Log::addErrorLog('An error occurred while deleting Admin Task '.$task_name.'. Exception: '.$ex->getMessage());
333 333
 			return false;
334 334
 		}
335 335
 	}
Please login to merge, or discard this patch.
Braces   +9 added lines, -13 removed lines patch added patch discarded remove patch
@@ -49,8 +49,7 @@  discard block
 block discarded – undo
49 49
 					return $task;
50 50
 				}
51 51
 			}
52
-		}
53
-		catch(\Exception $ex) { }
52
+		} catch(\Exception $ex) { }
54 53
 		
55 54
 		return null;
56 55
 	}
@@ -83,8 +82,7 @@  discard block
 block discarded – undo
83 82
 				);
84 83
         
85 84
 			return $task;
86
-		}
87
-		else {
85
+		} else {
88 86
 		    $this->deleteTask($row['majat_name']);
89 87
 		}
90 88
 		return null;
@@ -156,8 +154,7 @@  discard block
 block discarded – undo
156 154
                     'is_running' => $task->isRunning() ? 1 : 0
157 155
                 ));
158 156
             return true;
159
-        }
160
-        catch (\Exception $ex) {
157
+        } catch (\Exception $ex) {
161 158
             Log::addErrorLog(sprintf('Error while updating the Admin Task %s. Exception: %s', $task->getName(), $ex->getMessage()));
162 159
             return false;
163 160
         }        
@@ -279,7 +276,9 @@  discard block
 block discarded – undo
279 276
 		$dir=opendir($this->root_path);
280 277
 		while (($file=readdir($dir))!==false){ 
281 278
 			try {
282
-			    if($file == '.' || $file == '..') continue;
279
+			    if($file == '.' || $file == '..') {
280
+			    	continue;
281
+			    }
283 282
 				$task = include $this->root_path . $file;
284 283
 				if($task ) {
285 284
 				    $task->setProvider($this);
@@ -294,12 +293,10 @@  discard block
 block discarded – undo
294 293
 					));
295 294
 					
296 295
 					$tasks[] = $task;
297
-				}
298
-				else {
296
+				} else {
299 297
 					throw new \Exception;
300 298
 				}
301
-			}
302
-			catch (\Exception $ex) {
299
+			} catch (\Exception $ex) {
303 300
 				Log::addErrorLog('An error occured while trying to load the task in file ' . $file . '. Exception: ' . $ex->getMessage());
304 301
 			}
305 302
 		}
@@ -325,8 +322,7 @@  discard block
 block discarded – undo
325 322
 			Log::addConfigurationLog('Admin Task '.$task_name.' has been deleted from disk - deleting it from DB');
326 323
 			
327 324
 			return true;
328
-		}
329
-		catch(\Exception $ex) {
325
+		} catch(\Exception $ex) {
330 326
 			Database::rollback();
331 327
 		
332 328
 			Log::addErrorLog('An error occurred while deleting Admin Task '.$task_name.'. Exception: '. $ex->getMessage());
Please login to merge, or discard this patch.
src/Webtrees/Module/AdminTasks/Tasks/HealthCheckEmailTask.php 3 patches
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -185,8 +185,7 @@  discard block
 block discarded – undo
185 185
 						I18N::translate('Error').Mail::EOL.
186 186
 						str_repeat('-', $nb_char_count_title)."\t".str_repeat('-', $nb_char_type)."\t".str_repeat('-', 20)."\t".str_repeat('-', strlen(I18N::translate('Error'))).Mail::EOL.
187 187
 						$tmp_message.Mail::EOL;
188
-				}
189
-				else{
188
+				} else{
190 189
 					$message .= I18N::translate('No errors', $nb_errors).Mail::EOL.Mail::EOL;
191 190
 				}
192 191
 				
@@ -251,8 +250,7 @@  discard block
 block discarded – undo
251 250
 				}
252 251
 			}
253 252
 			return true;
254
-		}
255
-		catch (\Exception $ex) {
253
+		} catch (\Exception $ex) {
256 254
 			Log::addErrorLog(sprintf('Error while updating the Admin Task "%s". Exception: %s', $this->getName(), $ex->getMessage()));
257 255
 			return false;
258 256
 		}
Please login to merge, or discard this patch.
Indentation   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -29,11 +29,11 @@  discard block
 block discarded – undo
29 29
  */
30 30
 class HealthCheckEmailTask extends AbstractTask implements ConfigurableTaskInterface {
31 31
     
32
-    /**
33
-     * {@inheritDoc}
34
-     * @see \MyArtJaub\Webtrees\Module\AdminTasks\Model\AbstractTask::getTitle()
35
-     */
36
-    public function getTitle() {
32
+	/**
33
+	 * {@inheritDoc}
34
+	 * @see \MyArtJaub\Webtrees\Module\AdminTasks\Model\AbstractTask::getTitle()
35
+	 */
36
+	public function getTitle() {
37 37
 		return I18N::translate('Healthcheck Email');
38 38
 	}
39 39
 	
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
 	 * {@inheritDoc}
42 42
 	 * @see \MyArtJaub\Webtrees\Module\AdminTasks\Model\AbstractTask::getDefaultFrequency()
43 43
 	 */
44
-    public function getDefaultFrequency() {
44
+	public function getDefaultFrequency() {
45 45
 		return 10080;  // = 1 week = 7 * 24 * 60 min
46 46
 	}
47 47
     
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
 	 * {@inheritDoc}
50 50
 	 * @see \MyArtJaub\Webtrees\Module\AdminTasks\Model\AbstractTask::executeSteps()
51 51
 	 */
52
-    protected function executeSteps() {
52
+	protected function executeSteps() {
53 53
 	
54 54
 		$res = false;		
55 55
 		
@@ -63,14 +63,14 @@  discard block
 block discarded – undo
63 63
 		$interval = max($this->frequency, $interval_sincelast);
64 64
 		$nbdays = ceil($interval / (24 * 60));
65 65
 				
66
-        // Check for updates
67
-        $latest_version_txt = Functions::fetchLatestVersion();
68
-        if (preg_match('/^[0-9.]+\|[0-9.]+\|/', $latest_version_txt)) {
69
-        	list($latest_version, , $download_url) = explode('|', $latest_version_txt);
70
-        } else {
71
-        	// Cannot determine the latest version
72
-        	list($latest_version, , $download_url) = explode('|', '||');
73
-        }
66
+		// Check for updates
67
+		$latest_version_txt = Functions::fetchLatestVersion();
68
+		if (preg_match('/^[0-9.]+\|[0-9.]+\|/', $latest_version_txt)) {
69
+			list($latest_version, , $download_url) = explode('|', $latest_version_txt);
70
+		} else {
71
+			// Cannot determine the latest version
72
+			list($latest_version, , $download_url) = explode('|', '||');
73
+		}
74 74
 		
75 75
 		// Users statistics
76 76
 		$warnusers = 0;
@@ -213,15 +213,15 @@  discard block
 block discarded – undo
213 213
 		$html = '
214 214
 			<div class="form-group">
215 215
     			<label class="control-label col-sm-3"> '.
216
-    				I18N::translate('Enable healthcheck emails for') .
217
-    			'</label>
216
+					I18N::translate('Enable healthcheck emails for') .
217
+				'</label>
218 218
     			<div class="col-sm-9">';
219 219
 
220 220
 		foreach(Tree::getAll() as $tree){
221 221
 			if(Auth::isManager($tree)){	
222
-			    $html .= '<div class="form-group row">
222
+				$html .= '<div class="form-group row">
223 223
 			        <span class="col-sm-3 control-label">' .
224
-			             $tree->getTitle() .
224
+						 $tree->getTitle() .
225 225
 					'</span>
226 226
 					 <div class="col-sm-2">';
227 227
 				$html .= FunctionsEdit::editFieldYesNo('HEALTHCHECK_ENABLED_' . $tree->getTreeId(), $tree->getPreference('MAJ_AT_'.$this->getName().'_ENABLED', 1), 'class="radio-inline"');
@@ -230,8 +230,8 @@  discard block
 block discarded – undo
230 230
 		}
231 231
 		
232 232
 		$html .= '	<p class="small text-muted">'.
233
-    					I18N::translate('Enable the health check emails for each of the selected trees.') .
234
-    				'</p>
233
+						I18N::translate('Enable the health check emails for each of the selected trees.') .
234
+					'</p>
235 235
     			</div>
236 236
     		</div>';
237 237
 			
Please login to merge, or discard this patch.
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
 	 * @see \MyArtJaub\Webtrees\Module\AdminTasks\Model\AbstractTask::getDefaultFrequency()
43 43
 	 */
44 44
     public function getDefaultFrequency() {
45
-		return 10080;  // = 1 week = 7 * 24 * 60 min
45
+		return 10080; // = 1 week = 7 * 24 * 60 min
46 46
 	}
47 47
     
48 48
 	/**
@@ -55,9 +55,9 @@  discard block
 block discarded – undo
55 55
 		
56 56
 		// Get the number of days to take into account, either last 7 days or since last check
57 57
 		$interval_sincelast = 0;
58
-		if($this->last_updated){
58
+		if ($this->last_updated) {
59 59
 			$tmpInt = $this->last_updated->diff(new \DateTime('now'), true);
60
-			$interval_sincelast = ( $tmpInt->days * 24  + $tmpInt->h ) * 60 + $tmpInt->i;
60
+			$interval_sincelast = ($tmpInt->days * 24 + $tmpInt->h) * 60 + $tmpInt->i;
61 61
 		}
62 62
 		
63 63
 		$interval = max($this->frequency, $interval_sincelast);
@@ -66,17 +66,17 @@  discard block
 block discarded – undo
66 66
         // Check for updates
67 67
         $latest_version_txt = Functions::fetchLatestVersion();
68 68
         if (preg_match('/^[0-9.]+\|[0-9.]+\|/', $latest_version_txt)) {
69
-        	list($latest_version, , $download_url) = explode('|', $latest_version_txt);
69
+        	list($latest_version,, $download_url) = explode('|', $latest_version_txt);
70 70
         } else {
71 71
         	// Cannot determine the latest version
72
-        	list($latest_version, , $download_url) = explode('|', '||');
72
+        	list($latest_version,, $download_url) = explode('|', '||');
73 73
         }
74 74
 		
75 75
 		// Users statistics
76 76
 		$warnusers = 0;
77 77
 		$nverusers = 0;
78 78
 		$applusers = 0;
79
-		foreach(User::all() as $user) {
79
+		foreach (User::all() as $user) {
80 80
 			if (((date("U") - (int)$user->getPreference('reg_timestamp')) > 604800) && !$user->getPreference('verified')) {
81 81
 				$warnusers++;
82 82
 			}
@@ -90,20 +90,20 @@  discard block
 block discarded – undo
90 90
 		
91 91
 		// Tree specifics checks
92 92
 		$one_tree_done = false;
93
-		foreach(Tree::getAll() as $tree){
93
+		foreach (Tree::getAll() as $tree) {
94 94
 			$isTreeEnabled = $tree->getPreference('MAJ_AT_'.$this->getName().'_ENABLED');
95
-			if((is_null($isTreeEnabled) || $isTreeEnabled) && $webmaster = User::find($tree->getPreference('WEBMASTER_USER_ID'))){
95
+			if ((is_null($isTreeEnabled) || $isTreeEnabled) && $webmaster = User::find($tree->getPreference('WEBMASTER_USER_ID'))) {
96 96
 				I18N::init($webmaster->getPreference('language'));
97 97
 				
98 98
 				$subject = I18N::translate('Health Check Report').' - '.I18N::translate('Tree %s', $tree->getTitle());
99 99
 				$message = 
100
-					I18N::translate('Health Check Report for the last %d days', $nbdays). Mail::EOL. Mail::EOL.
100
+					I18N::translate('Health Check Report for the last %d days', $nbdays).Mail::EOL.Mail::EOL.
101 101
 					I18N::translate('Tree %s', $tree->getTitle()).Mail::EOL.
102 102
 					'=========================================='.Mail::EOL.Mail::EOL;
103 103
 				
104 104
 				// News
105 105
 				$message_version = '';
106
-				if($latest_version && version_compare(WT_VERSION, $latest_version)<0){
106
+				if ($latest_version && version_compare(WT_VERSION, $latest_version) < 0) {
107 107
 					$message_version = I18N::translate('News').Mail::EOL.
108 108
 							'-------------'.Mail::EOL.
109 109
 							I18N::translate('A new version of *webtrees* is available: %s. Upgrade as soon as possible.', $latest_version).Mail::EOL.
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
 						I18N::translate('Not verified by the user')."\t\t".$applusers.Mail::EOL.
120 120
 						I18N::translate('Not approved by an administrator')."\t".$nverusers.Mail::EOL.
121 121
 						Mail::EOL;
122
-				$message  .= $message_users;
122
+				$message .= $message_users;
123 123
 								
124 124
 				// Statistics tree:				
125 125
 				$stats = new Stats($tree);
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
 							' AND log_time >= DATE_ADD( NOW(), INTERVAL - :nb_days DAY)'.
160 160
 							' GROUP BY log_message, gedcom_id'.
161 161
 							' ORDER BY lastoccurred DESC';
162
-				$errors=Database::prepare($sql)->execute(array(
162
+				$errors = Database::prepare($sql)->execute(array(
163 163
 					'log_type' => Log::TYPE_ERROR, 
164 164
 					'gedcom_id' => $tree->getTreeId(), 
165 165
 					'nb_days' => $nbdays
@@ -175,7 +175,7 @@  discard block
 block discarded – undo
175 175
 					$tmp_message .= str_replace("\n", "\n\t\t\t\t\t\t", $error->log_message).Mail::EOL;
176 176
 					$nb_errors += $error->nblogs;
177 177
 				}
178
-				if($nb_errors > 0){
178
+				if ($nb_errors > 0) {
179 179
 					$message .= I18N::translate('Errors [%d]', $nb_errors).Mail::EOL.
180 180
 						'-------------'.Mail::EOL.
181 181
 						WT_BASE_URL.'admin_site_logs.php'.Mail::EOL.
@@ -186,12 +186,12 @@  discard block
 block discarded – undo
186 186
 						str_repeat('-', $nb_char_count_title)."\t".str_repeat('-', $nb_char_type)."\t".str_repeat('-', 20)."\t".str_repeat('-', strlen(I18N::translate('Error'))).Mail::EOL.
187 187
 						$tmp_message.Mail::EOL;
188 188
 				}
189
-				else{
189
+				else {
190 190
 					$message .= I18N::translate('No errors', $nb_errors).Mail::EOL.Mail::EOL;
191 191
 				}
192 192
 				
193 193
 				$tmpres = true;
194
-				if($webmaster->getPreference('contactmethod') !== 'messaging' 
194
+				if ($webmaster->getPreference('contactmethod') !== 'messaging' 
195 195
 						&& $webmaster->getPreference('contactmethod') !== 'none') {
196 196
 					$tmpres = Mail::systemMessage($tree, $webmaster, $subject, $message);
197 197
 				}		
@@ -213,24 +213,24 @@  discard block
 block discarded – undo
213 213
 		$html = '
214 214
 			<div class="form-group">
215 215
     			<label class="control-label col-sm-3"> '.
216
-    				I18N::translate('Enable healthcheck emails for') .
216
+    				I18N::translate('Enable healthcheck emails for').
217 217
     			'</label>
218 218
     			<div class="col-sm-9">';
219 219
 
220
-		foreach(Tree::getAll() as $tree){
221
-			if(Auth::isManager($tree)){	
220
+		foreach (Tree::getAll() as $tree) {
221
+			if (Auth::isManager($tree)) {	
222 222
 			    $html .= '<div class="form-group row">
223 223
 			        <span class="col-sm-3 control-label">' .
224
-			             $tree->getTitle() .
224
+			             $tree->getTitle().
225 225
 					'</span>
226 226
 					 <div class="col-sm-2">';
227
-				$html .= FunctionsEdit::editFieldYesNo('HEALTHCHECK_ENABLED_' . $tree->getTreeId(), $tree->getPreference('MAJ_AT_'.$this->getName().'_ENABLED', 1), 'class="radio-inline"');
227
+				$html .= FunctionsEdit::editFieldYesNo('HEALTHCHECK_ENABLED_'.$tree->getTreeId(), $tree->getPreference('MAJ_AT_'.$this->getName().'_ENABLED', 1), 'class="radio-inline"');
228 228
 				$html .= '</div></div>';
229 229
 			}
230 230
 		}
231 231
 		
232 232
 		$html .= '	<p class="small text-muted">'.
233
-    					I18N::translate('Enable the health check emails for each of the selected trees.') .
233
+    					I18N::translate('Enable the health check emails for each of the selected trees.').
234 234
     				'</p>
235 235
     			</div>
236 236
     		</div>';
@@ -244,9 +244,9 @@  discard block
 block discarded – undo
244 244
 	 */
245 245
 	public function saveConfig() {
246 246
 		try {
247
-			foreach(Tree::getAll() as $tree){		
248
-				if(Auth::isManager($tree)){
249
-					$tree_enabled = Filter::postInteger('HEALTHCHECK_ENABLED_' . $tree->getTreeId(), 0, 1);
247
+			foreach (Tree::getAll() as $tree) {		
248
+				if (Auth::isManager($tree)) {
249
+					$tree_enabled = Filter::postInteger('HEALTHCHECK_ENABLED_'.$tree->getTreeId(), 0, 1);
250 250
 					$tree->setPreference('MAJ_AT_'.$this->getName().'_ENABLED', $tree_enabled);
251 251
 				}
252 252
 			}
Please login to merge, or discard this patch.
src/Webtrees/Module/AdminTasks/AdminConfigController.php 3 patches
Spacing   +22 added lines, -25 removed lines patch added patch discarded remove patch
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
             ->setPageTitle($this->module->getTitle());
69 69
 			
70 70
 		$token = $this->module->getSetting('MAJ_AT_FORCE_EXEC_TOKEN');
71
-		if(is_null($token)) {
71
+		if (is_null($token)) {
72 72
 			$token = Functions::generateRandomToken();
73 73
 			$this->module->setSetting('PAT_FORCE_EXEC_TOKEN', $token);
74 74
 		}
@@ -76,12 +76,12 @@  discard block
 block discarded – undo
76 76
         $data = new ViewBag();
77 77
         $data->set('title', $controller->getPageTitle());
78 78
         
79
-        $table_id = 'table-admintasks-' . Uuid::uuid4();
79
+        $table_id = 'table-admintasks-'.Uuid::uuid4();
80 80
         $data->set('table_id', $table_id);
81 81
 		
82 82
 		$data->set('trigger_url_root', WT_BASE_URL.'module.php?mod='.$this->module->getName().'&mod_action=Task@trigger');
83 83
 		$token = $this->module->getSetting('MAJ_AT_FORCE_EXEC_TOKEN');
84
-		if(is_null($token)) {
84
+		if (is_null($token)) {
85 85
 			$token = Functions::generateRandomToken();
86 86
 			$this->module->setSetting('MAJ_AT_FORCE_EXEC_TOKEN', $token);
87 87
 		}
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
                     processing: true,
107 107
                     serverSide : true,
108 108
 					ajax : {
109
-						url : "module.php?mod='.$this->module->getName().'&mod_action=AdminConfig@jsonTasksList&ged='. $WT_TREE->getNameUrl().'",
109
+						url : "module.php?mod='.$this->module->getName().'&mod_action=AdminConfig@jsonTasksList&ged='.$WT_TREE->getNameUrl().'",
110 110
                         type : "POST"
111 111
 					},
112 112
                     columns: [
@@ -143,14 +143,14 @@  discard block
 block discarded – undo
143 143
                             url: "module.php", 
144 144
                             type: "GET",
145 145
                             data: {
146
-                			    mod: "' . $this->module->getName() .'",
146
+                			    mod: "' . $this->module->getName().'",
147 147
                                 mod_action:  "Task@setStatus",
148 148
                 			    task: task,
149 149
                                 status: status
150 150
                             },
151 151
                             error: function(result, stat, error) {
152 152
                                 var err = typeof result.responseJSON === "undefined" ? error : result.responseJSON.error;
153
-                                alert("' . I18N::translate('An error occured while editing this task:') . '" + err);
153
+                                alert("' . I18N::translate('An error occured while editing this task:').'" + err);
154 154
                             },
155 155
                             complete: function(result, stat) {
156 156
                                 adminTasksTable.ajax.reload(null, false);
@@ -187,14 +187,14 @@  discard block
 block discarded – undo
187 187
     
188 188
         // Generate an AJAX/JSON response for datatables to load a block of rows
189 189
         $search = Filter::postArray('search');
190
-        if($search) $search = $search['value'];
190
+        if ($search) $search = $search['value'];
191 191
         $start  = Filter::postInteger('start');
192 192
         $length = Filter::postInteger('length');
193 193
         $order  = Filter::postArray('order');
194 194
     
195 195
 		$order_by_name = false;
196
-        foreach($order as $key => &$value) {
197
-            switch($value['column']) {
196
+        foreach ($order as $key => &$value) {
197
+            switch ($value['column']) {
198 198
                 case 3:
199 199
 					$order_by_name = true;
200 200
                     unset($order[$key]);
@@ -211,14 +211,14 @@  discard block
 block discarded – undo
211 211
         }
212 212
     
213 213
         $list = $this->provider->getFilteredTasksList($search, $order, $start, $length);
214
-		if($order_by_name) {
214
+		if ($order_by_name) {
215 215
 			usort($list, function(AbstractTask $a, AbstractTask $b) { return I18N::strcasecmp($a->getTitle(), $b->getTitle()); });
216 216
 		}
217 217
         $recordsFiltered = count($list);
218 218
         $recordsTotal = $this->provider->getTasksCount();
219 219
     
220 220
         $data = array();
221
-        foreach($list as $task) {    
221
+        foreach ($list as $task) {    
222 222
             $datum = array();
223 223
 			
224 224
             $datum[0] = '
@@ -229,37 +229,34 @@  discard block
 block discarded – undo
229 229
                     <ul class="dropdown-menu" role="menu">
230 230
                        <li>
231 231
                             <a href="#" onclick="return set_admintask_status(\''. $task->getName().'\', '.($task->isEnabled() ? 'false' : 'true').');">
232
-                                <i class="fa fa-fw '.($task->isEnabled() ? 'fa-times' : 'fa-check').'"></i> ' . ($task->isEnabled() ? I18N::translate('Disable') : I18N::translate('Enable')) . '
232
+                                <i class="fa fa-fw '.($task->isEnabled() ? 'fa-times' : 'fa-check').'"></i> '.($task->isEnabled() ? I18N::translate('Disable') : I18N::translate('Enable')).'
233 233
                             </a>
234 234
                        </li>
235 235
                         <li>
236
-                            <a href="module.php?mod='.$this->module->getName().'&mod_action=Task@edit&task='. $task->getName().'">
237
-                                <i class="fa fa-fw fa-pencil"></i> ' . I18N::translate('Edit') . '
236
+                            <a href="module.php?mod='.$this->module->getName().'&mod_action=Task@edit&task='.$task->getName().'">
237
+                                <i class="fa fa-fw fa-pencil"></i> ' . I18N::translate('Edit').'
238 238
                             </a>
239 239
                        </li>
240 240
                     </ul>
241 241
                 </div>';
242 242
             $datum[1] = $task->getName();
243 243
             $datum[2] = $task->isEnabled() ? 
244
-				'<i class="fa fa-check"></i><span class="sr-only">'.I18N::translate('Enabled').'</span>' : 
245
-				'<i class="fa fa-times"></i><span class="sr-only">'.I18N::translate('Disabled').'</span>';
244
+				'<i class="fa fa-check"></i><span class="sr-only">'.I18N::translate('Enabled').'</span>' : '<i class="fa fa-times"></i><span class="sr-only">'.I18N::translate('Disabled').'</span>';
246 245
             $datum[3] = $task->getTitle();
247
-            $date_format = str_replace('%', '', I18N::dateFormat()) . ' H:i:s';
246
+            $date_format = str_replace('%', '', I18N::dateFormat()).' H:i:s';
248 247
 			$datum[4] = $task->getLastUpdated()->format($date_format);
249 248
             $datum[5] = $task->isLastRunSuccess() ? 
250
-				'<i class="fa fa-check"></i><span class="sr-only">'.I18N::translate('Yes').'</span>' : 
251
-				'<i class="fa fa-times"></i><span class="sr-only">'.I18N::translate('No').'</span>';
249
+				'<i class="fa fa-check"></i><span class="sr-only">'.I18N::translate('Yes').'</span>' : '<i class="fa fa-times"></i><span class="sr-only">'.I18N::translate('No').'</span>';
252 250
             $dtF = new \DateTime('@0');
253
-            $dtT = new \DateTime('@' . ($task->getFrequency() * 60));            
251
+            $dtT = new \DateTime('@'.($task->getFrequency() * 60));            
254 252
             $datum[6] = $dtF->diff($dtT)->format(I18N::translate('%a d %h h %i m'));
255 253
 			$datum[7] = $task->getRemainingOccurrences() > 0 ? I18N::number($task->getRemainingOccurrences()) : I18N::translate('Unlimited');
256 254
 			$datum[8] = $task->isRunning() ? 
257
-				'<i class="fa fa-cog fa-spin fa-fw"></i><span class="sr-only">'.I18N::translate('Running').'</span>' : 
258
-				'<i class="fa fa-times"></i><span class="sr-only">'.I18N::translate('Not running').'</span>';
259
-			if($task->isEnabled() && !$task->isRunning()) {
255
+				'<i class="fa fa-cog fa-spin fa-fw"></i><span class="sr-only">'.I18N::translate('Running').'</span>' : '<i class="fa fa-times"></i><span class="sr-only">'.I18N::translate('Not running').'</span>';
256
+			if ($task->isEnabled() && !$task->isRunning()) {
260 257
 			    $datum[9] = '
261
-    			    <button id="bt_runtask_'. $task->getName() .'" class="btn btn-primary" href="#" onclick="return run_admintask(\''. $task->getName() .'\')">
262
-    			         <div id="bt_runtasktext_'. $task->getName() .'"><i class="fa fa-cog fa-fw" ></i>' . I18N::translate('Run') . '</div>
258
+    			    <button id="bt_runtask_'. $task->getName().'" class="btn btn-primary" href="#" onclick="return run_admintask(\''.$task->getName().'\')">
259
+    			         <div id="bt_runtasktext_'. $task->getName().'"><i class="fa fa-cog fa-fw" ></i>'.I18N::translate('Run').'</div>
263 260
     			    </button>';
264 261
 			}
265 262
 			else {
Please login to merge, or discard this patch.
Braces   +4 added lines, -3 removed lines patch added patch discarded remove patch
@@ -187,7 +187,9 @@  discard block
 block discarded – undo
187 187
     
188 188
         // Generate an AJAX/JSON response for datatables to load a block of rows
189 189
         $search = Filter::postArray('search');
190
-        if($search) $search = $search['value'];
190
+        if($search) {
191
+        	$search = $search['value'];
192
+        }
191 193
         $start  = Filter::postInteger('start');
192 194
         $length = Filter::postInteger('length');
193 195
         $order  = Filter::postArray('order');
@@ -261,8 +263,7 @@  discard block
 block discarded – undo
261 263
     			    <button id="bt_runtask_'. $task->getName() .'" class="btn btn-primary" href="#" onclick="return run_admintask(\''. $task->getName() .'\')">
262 264
     			         <div id="bt_runtasktext_'. $task->getName() .'"><i class="fa fa-cog fa-fw" ></i>' . I18N::translate('Run') . '</div>
263 265
     			    </button>';
264
-			}
265
-			else {
266
+			} else {
266 267
 			    $datum[9] = '';
267 268
 			}			    
268 269
 						
Please login to merge, or discard this patch.
Indentation   +88 added lines, -88 removed lines patch added patch discarded remove patch
@@ -34,37 +34,37 @@  discard block
 block discarded – undo
34 34
  */
35 35
 class AdminConfigController extends MvcController
36 36
 {    
37
-    /**
38
-     * Tasks Provider
39
-     * @var TaskProviderInterface $provider
40
-     */
41
-    protected $provider;    
37
+	/**
38
+	 * Tasks Provider
39
+	 * @var TaskProviderInterface $provider
40
+	 */
41
+	protected $provider;    
42 42
     
43
-    /**
44
-     * Constructor for Admin Config controller
45
-     * @param \Fisharebest\Webtrees\Module\AbstractModule $module
46
-     */
47
-    public function __construct(AbstractModule $module) {
48
-        parent::__construct($module);
43
+	/**
44
+	 * Constructor for Admin Config controller
45
+	 * @param \Fisharebest\Webtrees\Module\AbstractModule $module
46
+	 */
47
+	public function __construct(AbstractModule $module) {
48
+		parent::__construct($module);
49 49
         
50
-        $this->provider = $this->module->getProvider();
51
-    }    
50
+		$this->provider = $this->module->getProvider();
51
+	}    
52 52
     
53
-    /**
54
-     * Pages
55
-     */
53
+	/**
54
+	 * Pages
55
+	 */
56 56
         
57
-    /**
58
-     * AdminConfig@index
59
-     */
60
-    public function index() {
61
-        global $WT_TREE;
57
+	/**
58
+	 * AdminConfig@index
59
+	 */
60
+	public function index() {
61
+		global $WT_TREE;
62 62
         
63
-        Theme::theme(new AdministrationTheme)->init($WT_TREE);
64
-        $controller = new PageController();
65
-        $controller
66
-            ->restrictAccess(Auth::isAdmin())
67
-            ->setPageTitle($this->module->getTitle());
63
+		Theme::theme(new AdministrationTheme)->init($WT_TREE);
64
+		$controller = new PageController();
65
+		$controller
66
+			->restrictAccess(Auth::isAdmin())
67
+			->setPageTitle($this->module->getTitle());
68 68
 			
69 69
 		$token = $this->module->getSetting('MAJ_AT_FORCE_EXEC_TOKEN');
70 70
 		if(is_null($token)) {
@@ -72,11 +72,11 @@  discard block
 block discarded – undo
72 72
 			$this->module->setSetting('PAT_FORCE_EXEC_TOKEN', $token);
73 73
 		}
74 74
         
75
-        $data = new ViewBag();
76
-        $data->set('title', $controller->getPageTitle());
75
+		$data = new ViewBag();
76
+		$data->set('title', $controller->getPageTitle());
77 77
         
78
-        $table_id = 'table-admintasks-' . Uuid::uuid4();
79
-        $data->set('table_id', $table_id);
78
+		$table_id = 'table-admintasks-' . Uuid::uuid4();
79
+		$data->set('table_id', $table_id);
80 80
 		
81 81
 		$data->set('trigger_url_root', WT_BASE_URL.'module.php?mod='.$this->module->getName().'&mod_action=Task@trigger');
82 82
 		$token = $this->module->getSetting('MAJ_AT_FORCE_EXEC_TOKEN');
@@ -89,9 +89,9 @@  discard block
 block discarded – undo
89 89
 		$this->provider->getInstalledTasks();
90 90
 		
91 91
 		$controller
92
-            ->addExternalJavascript(WT_JQUERY_DATATABLES_JS_URL)
93
-            ->addExternalJavascript(WT_DATATABLES_BOOTSTRAP_JS_URL)
94
-            ->addInlineJavascript('
92
+			->addExternalJavascript(WT_JQUERY_DATATABLES_JS_URL)
93
+			->addExternalJavascript(WT_DATATABLES_BOOTSTRAP_JS_URL)
94
+			->addInlineJavascript('
95 95
                 //Datatable initialisation
96 96
 				jQuery.fn.dataTableExt.oSort["unicode-asc"  ]=function(a,b) {return a.replace(/<[^<]*>/, "").localeCompare(b.replace(/<[^<]*>/, ""))};
97 97
 				jQuery.fn.dataTableExt.oSort["unicode-desc" ]=function(a,b) {return b.replace(/<[^<]*>/, "").localeCompare(a.replace(/<[^<]*>/, ""))};
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
 				});
124 124
                 
125 125
                 ')
126
-                ->addInlineJavascript('					
126
+				->addInlineJavascript('					
127 127
 					function generate_force_token() {
128 128
 						jQuery("#bt_genforcetoken").attr("disabled", "disabled");
129 129
 						jQuery("#bt_tokentext").empty().html("<i class=\"fa fa-spinner fa-pulse fa-fw\"></i>");
@@ -171,56 +171,56 @@  discard block
 block discarded – undo
171 171
                     } 
172 172
                 ');
173 173
         
174
-        ViewFactory::make('AdminConfig', $this, $controller, $data)->render();
175
-    }
174
+		ViewFactory::make('AdminConfig', $this, $controller, $data)->render();
175
+	}
176 176
     
177
-    /**
178
-     * AdminConfig@jsonTasksList
179
-     */
180
-    public function jsonTasksList() {
181
-        global $WT_TREE;
177
+	/**
178
+	 * AdminConfig@jsonTasksList
179
+	 */
180
+	public function jsonTasksList() {
181
+		global $WT_TREE;
182 182
     
183
-        $controller = new JsonController();
184
-        $controller
185
-            ->restrictAccess(Auth::isAdmin());
183
+		$controller = new JsonController();
184
+		$controller
185
+			->restrictAccess(Auth::isAdmin());
186 186
     
187
-        // Generate an AJAX/JSON response for datatables to load a block of rows
188
-        $search = Filter::postArray('search');
189
-        if($search) $search = $search['value'];
190
-        $start  = Filter::postInteger('start');
191
-        $length = Filter::postInteger('length');
192
-        $order  = Filter::postArray('order');
187
+		// Generate an AJAX/JSON response for datatables to load a block of rows
188
+		$search = Filter::postArray('search');
189
+		if($search) $search = $search['value'];
190
+		$start  = Filter::postInteger('start');
191
+		$length = Filter::postInteger('length');
192
+		$order  = Filter::postArray('order');
193 193
     
194 194
 		$order_by_name = false;
195
-        foreach($order as $key => &$value) {
196
-            switch($value['column']) {
197
-                case 3:
195
+		foreach($order as $key => &$value) {
196
+			switch($value['column']) {
197
+				case 3:
198 198
 					$order_by_name = true;
199
-                    unset($order[$key]);
200
-                    break;
201
-                case 4;
199
+					unset($order[$key]);
200
+					break;
201
+				case 4;
202 202
 					$value['column'] = 'majat_last_run';
203 203
 					break;
204 204
 				case 4;
205 205
 					$value['column'] = 'majat_last_result';
206 206
 					break;
207
-                default:
208
-                    unset($order[$key]);
209
-            }
210
-        }
207
+				default:
208
+					unset($order[$key]);
209
+			}
210
+		}
211 211
     
212
-        $list = $this->provider->getFilteredTasksList($search, $order, $start, $length);
212
+		$list = $this->provider->getFilteredTasksList($search, $order, $start, $length);
213 213
 		if($order_by_name) {
214 214
 			usort($list, function(AbstractTask $a, AbstractTask $b) { return I18N::strcasecmp($a->getTitle(), $b->getTitle()); });
215 215
 		}
216
-        $recordsFiltered = count($list);
217
-        $recordsTotal = $this->provider->getTasksCount();
216
+		$recordsFiltered = count($list);
217
+		$recordsTotal = $this->provider->getTasksCount();
218 218
     
219
-        $data = array();
220
-        foreach($list as $task) {    
221
-            $datum = array();
219
+		$data = array();
220
+		foreach($list as $task) {    
221
+			$datum = array();
222 222
 			
223
-            $datum[0] = '
223
+			$datum[0] = '
224 224
                 <div class="btn-group">
225 225
                     <button type="button" class="btn btn-primary dropdown-toggle" data-toggle="dropdown" aria-expanded="false">
226 226
                         <i class="fa fa-pencil"></i><span class="caret"></span>
@@ -238,50 +238,50 @@  discard block
 block discarded – undo
238 238
                        </li>
239 239
                     </ul>
240 240
                 </div>';
241
-            $datum[1] = $task->getName();
242
-            $datum[2] = $task->isEnabled() ? 
241
+			$datum[1] = $task->getName();
242
+			$datum[2] = $task->isEnabled() ? 
243 243
 				'<i class="fa fa-check"></i><span class="sr-only">'.I18N::translate('Enabled').'</span>' : 
244 244
 				'<i class="fa fa-times"></i><span class="sr-only">'.I18N::translate('Disabled').'</span>';
245
-            $datum[3] = $task->getTitle();
246
-            $date_format = str_replace('%', '', I18N::dateFormat()) . ' H:i:s';
245
+			$datum[3] = $task->getTitle();
246
+			$date_format = str_replace('%', '', I18N::dateFormat()) . ' H:i:s';
247 247
 			$datum[4] = $task->getLastUpdated()->format($date_format);
248
-            $datum[5] = $task->isLastRunSuccess() ? 
248
+			$datum[5] = $task->isLastRunSuccess() ? 
249 249
 				'<i class="fa fa-check"></i><span class="sr-only">'.I18N::translate('Yes').'</span>' : 
250 250
 				'<i class="fa fa-times"></i><span class="sr-only">'.I18N::translate('No').'</span>';
251
-            $dtF = new \DateTime('@0');
252
-            $dtT = new \DateTime('@' . ($task->getFrequency() * 60));            
253
-            $datum[6] = $dtF->diff($dtT)->format(I18N::translate('%a d %h h %i m'));
251
+			$dtF = new \DateTime('@0');
252
+			$dtT = new \DateTime('@' . ($task->getFrequency() * 60));            
253
+			$datum[6] = $dtF->diff($dtT)->format(I18N::translate('%a d %h h %i m'));
254 254
 			$datum[7] = $task->getRemainingOccurrences() > 0 ? I18N::number($task->getRemainingOccurrences()) : I18N::translate('Unlimited');
255 255
 			$datum[8] = $task->isRunning() ? 
256 256
 				'<i class="fa fa-cog fa-spin fa-fw"></i><span class="sr-only">'.I18N::translate('Running').'</span>' : 
257 257
 				'<i class="fa fa-times"></i><span class="sr-only">'.I18N::translate('Not running').'</span>';
258 258
 			if($task->isEnabled() && !$task->isRunning()) {
259
-			    $datum[9] = '
259
+				$datum[9] = '
260 260
     			    <button id="bt_runtask_'. $task->getName() .'" class="btn btn-primary" href="#" onclick="return run_admintask(\''. $task->getName() .'\')">
261 261
     			         <div id="bt_runtasktext_'. $task->getName() .'"><i class="fa fa-cog fa-fw" ></i>' . I18N::translate('Run') . '</div>
262 262
     			    </button>';
263 263
 			}
264 264
 			else {
265
-			    $datum[9] = '';
265
+				$datum[9] = '';
266 266
 			}			    
267 267
 						
268
-            $data[] = $datum;
269
-        }
268
+			$data[] = $datum;
269
+		}
270 270
     
271
-        $controller->pageHeader();
271
+		$controller->pageHeader();
272 272
     
273
-        $controller->encode(array(
274
-            'draw'            => Filter::getInteger('draw'),
275
-            'recordsTotal'    => $recordsTotal,
276
-            'recordsFiltered' => $recordsFiltered,
277
-            'data'            => $data
278
-        ));
273
+		$controller->encode(array(
274
+			'draw'            => Filter::getInteger('draw'),
275
+			'recordsTotal'    => $recordsTotal,
276
+			'recordsFiltered' => $recordsFiltered,
277
+			'data'            => $data
278
+		));
279 279
     
280
-    }
280
+	}
281 281
 		
282 282
 	/**
283 283
 	 * AdminConfig@generateToken
284
-     *
284
+	 *
285 285
 	 * Ajax call to generate a new token. Display the token, if generated.
286 286
 	 * Tokens call only be generated by a site administrator.
287 287
 	 *
Please login to merge, or discard this patch.
src/Webtrees/Module/AdminTasks/Views/TaskEditView.php 2 patches
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -26,11 +26,11 @@  discard block
 block discarded – undo
26 26
 	 * {@inhericDoc}
27 27
 	 * @see \MyArtJaub\Webtrees\Mvc\View\AbstractView::renderContent()
28 28
 	 */
29
-    protected function renderContent() {
29
+	protected function renderContent() {
30 30
         
31
-        /** @var AbstractTask $task */
32
-        $task = $this->data->get('task');
33
-        ?>        
31
+		/** @var AbstractTask $task */
32
+		$task = $this->data->get('task');
33
+		?>        
34 34
         <ol class="breadcrumb small">
35 35
         	<li><a href="admin.php"><?php echo I18N::translate('Control panel'); ?></a></li>
36 36
 			<li><a href="admin_modules.php"><?php echo I18N::translate('Module administration'); ?></a></li>
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
     	</form>
123 123
 		
124 124
 		<?php        
125
-    }
125
+	}
126 126
     
127 127
 }
128 128
  
129 129
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -104,7 +104,7 @@
 block discarded – undo
104 104
     			</div>
105 105
     		</div>
106 106
 			
107
-			<?php if($task instanceof ConfigurableTaskInterface) { ?>
107
+			<?php if ($task instanceof ConfigurableTaskInterface) { ?>
108 108
 			
109 109
 			<h3><?php echo I18N::translate('Options for “%s”', $task->getTitle()); ?></h3>
110 110
 			
Please login to merge, or discard this patch.
src/Webtrees/Module/AdminTasks/Views/AdminConfigView.php 2 patches
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -22,10 +22,10 @@  discard block
 block discarded – undo
22 22
 	 * {@inhericDoc}
23 23
 	 * @see \MyArtJaub\Webtrees\Mvc\View\AbstractView::renderContent()
24 24
 	 */
25
-    protected function renderContent() {
25
+	protected function renderContent() {
26 26
         
27
-        $table_id = $this->data->get('table_id');
28
-        ?>        
27
+		$table_id = $this->data->get('table_id');
28
+		?>        
29 29
         <ol class="breadcrumb small">
30 30
         	<li><a href="admin.php"><?php echo I18N::translate('Control panel'); ?></a></li>
31 31
 			<li><a href="admin_modules.php"><?php echo I18N::translate('Module administration'); ?></a></li>
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
     	</table>
69 69
 		
70 70
 		<?php        
71
-    }
71
+	}
72 72
     
73 73
 }
74 74
  
75 75
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@
 block discarded – undo
40 40
 			<?php echo I18N::translate('In order to do so, use the following URL, with the optional parameter <em>%s</em> if you only want to force the execution of one task: ', 'task'); ?>
41 41
 		</p>
42 42
 		<p>
43
-			<code><?php echo $this->data->get('trigger_url_root') .'&force=<span id="token_url">'. $this->data->get('trigger_token') .'</span>[&task='. I18N::translate('task_name').']'; ?></code>
43
+			<code><?php echo $this->data->get('trigger_url_root').'&force=<span id="token_url">'.$this->data->get('trigger_token').'</span>[&task='.I18N::translate('task_name').']'; ?></code>
44 44
 		</p>
45 45
 		<p>
46 46
 			<button id="bt_genforcetoken" class="bt bt-primary" onClick="generate_force_token();">
Please login to merge, or discard this patch.
src/Webtrees/Module/Sosa/SosaConfigController.php 3 patches
Indentation   +110 added lines, -110 removed lines patch added patch discarded remove patch
@@ -29,66 +29,66 @@  discard block
 block discarded – undo
29 29
  */
30 30
 class SosaConfigController extends MvcController
31 31
 {      
32
-    /**
33
-     * Check if the user can update the sosa ancestors list
34
-     * 
35
-     * @return bool
36
-     */
37
-    protected function canUpdate() {
38
-        global $WT_TREE;
32
+	/**
33
+	 * Check if the user can update the sosa ancestors list
34
+	 * 
35
+	 * @return bool
36
+	 */
37
+	protected function canUpdate() {
38
+		global $WT_TREE;
39 39
         
40
-        $user_id = Filter::postInteger('userid', -1) ?: Filter::getInteger('userid', -1);
41
-        return Auth::check() && 
42
-            ( 
43
-                $user_id == Auth::user()->getUserId() ||        // Allow update for yourself
44
-                ($user_id == -1 && Auth::isManager($WT_TREE))   // Allow a manager to update the default user
45
-             );
46
-    }
40
+		$user_id = Filter::postInteger('userid', -1) ?: Filter::getInteger('userid', -1);
41
+		return Auth::check() && 
42
+			( 
43
+				$user_id == Auth::user()->getUserId() ||        // Allow update for yourself
44
+				($user_id == -1 && Auth::isManager($WT_TREE))   // Allow a manager to update the default user
45
+			 );
46
+	}
47 47
     
48
-    /**
49
-     * Saves Sosa's user preferences (root individual for the user).
50
-     * 
51
-     * @param BaseController $controller
52
-     * @return bool True is saving successfull
53
-     */
54
-    protected function update(BaseController $controller) {
55
-        global $WT_TREE;          
56
-        if($this->canUpdate() && Filter::checkCsrf()) 
57
-        {            
58
-            $indi = Individual::getInstance(Filter::post('rootid'), $WT_TREE);
59
-            $user = User::find(Filter::postInteger('userid', -1));
48
+	/**
49
+	 * Saves Sosa's user preferences (root individual for the user).
50
+	 * 
51
+	 * @param BaseController $controller
52
+	 * @return bool True is saving successfull
53
+	 */
54
+	protected function update(BaseController $controller) {
55
+		global $WT_TREE;          
56
+		if($this->canUpdate() && Filter::checkCsrf()) 
57
+		{            
58
+			$indi = Individual::getInstance(Filter::post('rootid'), $WT_TREE);
59
+			$user = User::find(Filter::postInteger('userid', -1));
60 60
             
61
-            if($user  && $indi) {
62
-                $WT_TREE->setUserPreference($user, 'MAJ_SOSA_ROOT_ID', $indi->getXref());
63
-                $controller->addInlineJavascript('
61
+			if($user  && $indi) {
62
+				$WT_TREE->setUserPreference($user, 'MAJ_SOSA_ROOT_ID', $indi->getXref());
63
+				$controller->addInlineJavascript('
64 64
                     $( document ).ready(function() {
65 65
                         majComputeSosa('.$user->getUserId().');
66 66
                     });');
67
-                FlashMessages::addMessage(I18N::translate('The preferences have been updated.'));
68
-                return true;
69
-            }
70
-        }
71
-        FlashMessages::addMessage(I18N::translate('An error occurred while saving data...'), 'danger');
72
-        return false;
73
-    }
67
+				FlashMessages::addMessage(I18N::translate('The preferences have been updated.'));
68
+				return true;
69
+			}
70
+		}
71
+		FlashMessages::addMessage(I18N::translate('An error occurred while saving data...'), 'danger');
72
+		return false;
73
+	}
74 74
     
75
-    /**
76
-     * Pages
77
-     */
75
+	/**
76
+	 * Pages
77
+	 */
78 78
     
79
-    /**
80
-     * SosaConfig@index
81
-     */
82
-    public function index() {
83
-        global $WT_TREE;
79
+	/**
80
+	 * SosaConfig@index
81
+	 */
82
+	public function index() {
83
+		global $WT_TREE;
84 84
         
85
-        $controller = new PageController();
86
-        $controller
87
-        ->setPageTitle(I18N::translate('Sosa Configuration'))
88
-        ->restrictAccess(Auth::check())
89
-        ->addExternalJavascript(WT_AUTOCOMPLETE_JS_URL)
90
-        ->addInlineJavascript('autocomplete();')
91
-        ->addInlineJavascript('
85
+		$controller = new PageController();
86
+		$controller
87
+		->setPageTitle(I18N::translate('Sosa Configuration'))
88
+		->restrictAccess(Auth::check())
89
+		->addExternalJavascript(WT_AUTOCOMPLETE_JS_URL)
90
+		->addInlineJavascript('autocomplete();')
91
+		->addInlineJavascript('
92 92
             $( document ).ready(function() {
93 93
                 $("#bt_sosa_compute").click(function() {
94 94
                     majComputeSosa($("#maj_sosa_input_userid, #maj-sosa-config-select option:selected").val());
@@ -105,83 +105,83 @@  discard block
 block discarded – undo
105 105
                   });
106 106
             }');
107 107
         
108
-        $action = Filter::post('action');
109
-        if($action === 'update') $this->update($controller);
108
+		$action = Filter::post('action');
109
+		if($action === 'update') $this->update($controller);
110 110
         
111
-        $view_bag = new ViewBag();
112
-        $view_bag->set('title', $controller->getPageTitle());
113
-        $view_bag->set('tree', $WT_TREE);
114
-        $view_bag->set('form_url', 'module.php?mod='.$this->module->getName().'&mod_action=SosaConfig&ged='.$WT_TREE->getNameUrl());
111
+		$view_bag = new ViewBag();
112
+		$view_bag->set('title', $controller->getPageTitle());
113
+		$view_bag->set('tree', $WT_TREE);
114
+		$view_bag->set('form_url', 'module.php?mod='.$this->module->getName().'&mod_action=SosaConfig&ged='.$WT_TREE->getNameUrl());
115 115
         
116
-        $users_root = array();
117
-        $users_js_array = 'var users_array = [];';
118
-        if(Auth::check()) {
119
-            $root_id = $WT_TREE->getUserPreference(Auth::user(), 'MAJ_SOSA_ROOT_ID');
120
-            $users_root[] = array( 'user' => Auth::user(), 'rootid' => $root_id);
121
-            $users_js_array .=  'users_array["'.Auth::user()->getUserId().'"] = "' . $root_id . '";';
116
+		$users_root = array();
117
+		$users_js_array = 'var users_array = [];';
118
+		if(Auth::check()) {
119
+			$root_id = $WT_TREE->getUserPreference(Auth::user(), 'MAJ_SOSA_ROOT_ID');
120
+			$users_root[] = array( 'user' => Auth::user(), 'rootid' => $root_id);
121
+			$users_js_array .=  'users_array["'.Auth::user()->getUserId().'"] = "' . $root_id . '";';
122 122
             
123
-            if(Auth::isManager($WT_TREE)) {
124
-                $default_user = User::find(-1);
125
-                $default_root_id = $WT_TREE->getUserPreference($default_user, 'MAJ_SOSA_ROOT_ID');
126
-                $users_root[] = array( 'user' => $default_user, 'rootid' => $default_root_id);
127
-                $users_js_array .=  'users_array["'.$default_user->getUserId().'"] = "' . $default_root_id . '";';
128
-            }
129
-        }
130
-        $view_bag->set('users_settings', $users_root);       
123
+			if(Auth::isManager($WT_TREE)) {
124
+				$default_user = User::find(-1);
125
+				$default_root_id = $WT_TREE->getUserPreference($default_user, 'MAJ_SOSA_ROOT_ID');
126
+				$users_root[] = array( 'user' => $default_user, 'rootid' => $default_root_id);
127
+				$users_js_array .=  'users_array["'.$default_user->getUserId().'"] = "' . $default_root_id . '";';
128
+			}
129
+		}
130
+		$view_bag->set('users_settings', $users_root);       
131 131
         
132
-        $controller->addInlineJavascript($users_js_array . '            
132
+		$controller->addInlineJavascript($users_js_array . '            
133 133
                 $("#maj-sosa-config-select").change(function() {
134 134
                     $("#rootid").val(users_array[this.value]);
135 135
                 });
136 136
              ');
137 137
         
138
-        ViewFactory::make('SosaConfig', $this, $controller, $view_bag)->render();   
139
-    }
138
+		ViewFactory::make('SosaConfig', $this, $controller, $view_bag)->render();   
139
+	}
140 140
     
141
-    /**
142
-     * SosaConfig@computeAll
143
-     */
144
-    public function computeAll() {
145
-        global $WT_TREE;
141
+	/**
142
+	 * SosaConfig@computeAll
143
+	 */
144
+	public function computeAll() {
145
+		global $WT_TREE;
146 146
         
147
-        $controller = new AjaxController();
148
-        $controller->restrictAccess($this->canUpdate());
147
+		$controller = new AjaxController();
148
+		$controller->restrictAccess($this->canUpdate());
149 149
         
150
-        $view_bag = new ViewBag();
151
-        $view_bag->set('is_success', false);
150
+		$view_bag = new ViewBag();
151
+		$view_bag->set('is_success', false);
152 152
         
153
-        $user = User::find(Filter::getInteger('userid', -1));
154
-        if($user) {
155
-            $calculator = new SosaCalculator($WT_TREE, $user);
156
-            if($calculator->computeAll()) $view_bag->set('is_success', true);
157
-        }
158
-        ViewFactory::make('SosaComputeResult', $this, $controller, $view_bag)->render();
159
-    }
153
+		$user = User::find(Filter::getInteger('userid', -1));
154
+		if($user) {
155
+			$calculator = new SosaCalculator($WT_TREE, $user);
156
+			if($calculator->computeAll()) $view_bag->set('is_success', true);
157
+		}
158
+		ViewFactory::make('SosaComputeResult', $this, $controller, $view_bag)->render();
159
+	}
160 160
     
161
-    /**
162
-     * SosaConfig@computePartial
163
-     */
164
-    public function computePartial() {
165
-        global $WT_TREE;
161
+	/**
162
+	 * SosaConfig@computePartial
163
+	 */
164
+	public function computePartial() {
165
+		global $WT_TREE;
166 166
     
167
-        $controller = new AjaxController();
168
-        $controller->restrictAccess($this->canUpdate());
167
+		$controller = new AjaxController();
168
+		$controller->restrictAccess($this->canUpdate());
169 169
     
170
-        $view_bag = new ViewBag();
171
-        $view_bag->set('is_success', false);
170
+		$view_bag = new ViewBag();
171
+		$view_bag->set('is_success', false);
172 172
     
173
-        $user = User::find(Filter::getInteger('userid', -1));
174
-        $indi = Individual::getInstance(Filter::get('pid', WT_REGEX_XREF), $WT_TREE);
173
+		$user = User::find(Filter::getInteger('userid', -1));
174
+		$indi = Individual::getInstance(Filter::get('pid', WT_REGEX_XREF), $WT_TREE);
175 175
         
176
-        if($user && $indi) {
177
-            $calculator = new SosaCalculator($WT_TREE, $user);
178
-            if($calculator->computeFromIndividual($indi)) $view_bag->set('is_success', true);
179
-        }
180
-        else {
181
-            $view_bag->set('error', I18N::translate('Non existing individual'));
182
-        }
176
+		if($user && $indi) {
177
+			$calculator = new SosaCalculator($WT_TREE, $user);
178
+			if($calculator->computeFromIndividual($indi)) $view_bag->set('is_success', true);
179
+		}
180
+		else {
181
+			$view_bag->set('error', I18N::translate('Non existing individual'));
182
+		}
183 183
             
184
-        ViewFactory::make('SosaComputeResult', $this, $controller, $view_bag)->render();
185
-    }
184
+		ViewFactory::make('SosaComputeResult', $this, $controller, $view_bag)->render();
185
+	}
186 186
     
187 187
 }
188 188
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
         $user_id = Filter::postInteger('userid', -1) ?: Filter::getInteger('userid', -1);
41 41
         return Auth::check() && 
42 42
             ( 
43
-                $user_id == Auth::user()->getUserId() ||        // Allow update for yourself
43
+                $user_id == Auth::user()->getUserId() || // Allow update for yourself
44 44
                 ($user_id == -1 && Auth::isManager($WT_TREE))   // Allow a manager to update the default user
45 45
              );
46 46
     }
@@ -53,12 +53,12 @@  discard block
 block discarded – undo
53 53
      */
54 54
     protected function update(BaseController $controller) {
55 55
         global $WT_TREE;          
56
-        if($this->canUpdate() && Filter::checkCsrf()) 
56
+        if ($this->canUpdate() && Filter::checkCsrf()) 
57 57
         {            
58 58
             $indi = Individual::getInstance(Filter::post('rootid'), $WT_TREE);
59 59
             $user = User::find(Filter::postInteger('userid', -1));
60 60
             
61
-            if($user  && $indi) {
61
+            if ($user && $indi) {
62 62
                 $WT_TREE->setUserPreference($user, 'MAJ_SOSA_ROOT_ID', $indi->getXref());
63 63
                 $controller->addInlineJavascript('
64 64
                     $( document ).ready(function() {
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
             
98 98
             function majComputeSosa(user_id) {
99 99
                 jQuery("#bt_sosa_compute").prop( "disabled", true );
100
-                jQuery("#bt_sosa_computing").empty().html("<i class=\"icon-loading-small\"></i>&nbsp;'. I18N::translate('Computing...') .'");
100
+                jQuery("#bt_sosa_computing").empty().html("<i class=\"icon-loading-small\"></i>&nbsp;'. I18N::translate('Computing...').'");
101 101
                 jQuery("#bt_sosa_computing").load(
102 102
 		          "module.php?mod='.$this->module->getName().'&mod_action=SosaConfig@computeAll&ged='.$WT_TREE->getNameUrl().'&userid=" + user_id,
103 103
 		          function() {
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
             }');
107 107
         
108 108
         $action = Filter::post('action');
109
-        if($action === 'update') $this->update($controller);
109
+        if ($action === 'update') $this->update($controller);
110 110
         
111 111
         $view_bag = new ViewBag();
112 112
         $view_bag->set('title', $controller->getPageTitle());
@@ -115,21 +115,21 @@  discard block
 block discarded – undo
115 115
         
116 116
         $users_root = array();
117 117
         $users_js_array = 'var users_array = [];';
118
-        if(Auth::check()) {
118
+        if (Auth::check()) {
119 119
             $root_id = $WT_TREE->getUserPreference(Auth::user(), 'MAJ_SOSA_ROOT_ID');
120
-            $users_root[] = array( 'user' => Auth::user(), 'rootid' => $root_id);
121
-            $users_js_array .=  'users_array["'.Auth::user()->getUserId().'"] = "' . $root_id . '";';
120
+            $users_root[] = array('user' => Auth::user(), 'rootid' => $root_id);
121
+            $users_js_array .= 'users_array["'.Auth::user()->getUserId().'"] = "'.$root_id.'";';
122 122
             
123
-            if(Auth::isManager($WT_TREE)) {
123
+            if (Auth::isManager($WT_TREE)) {
124 124
                 $default_user = User::find(-1);
125 125
                 $default_root_id = $WT_TREE->getUserPreference($default_user, 'MAJ_SOSA_ROOT_ID');
126
-                $users_root[] = array( 'user' => $default_user, 'rootid' => $default_root_id);
127
-                $users_js_array .=  'users_array["'.$default_user->getUserId().'"] = "' . $default_root_id . '";';
126
+                $users_root[] = array('user' => $default_user, 'rootid' => $default_root_id);
127
+                $users_js_array .= 'users_array["'.$default_user->getUserId().'"] = "'.$default_root_id.'";';
128 128
             }
129 129
         }
130 130
         $view_bag->set('users_settings', $users_root);       
131 131
         
132
-        $controller->addInlineJavascript($users_js_array . '            
132
+        $controller->addInlineJavascript($users_js_array.'            
133 133
                 $("#maj-sosa-config-select").change(function() {
134 134
                     $("#rootid").val(users_array[this.value]);
135 135
                 });
@@ -151,9 +151,9 @@  discard block
 block discarded – undo
151 151
         $view_bag->set('is_success', false);
152 152
         
153 153
         $user = User::find(Filter::getInteger('userid', -1));
154
-        if($user) {
154
+        if ($user) {
155 155
             $calculator = new SosaCalculator($WT_TREE, $user);
156
-            if($calculator->computeAll()) $view_bag->set('is_success', true);
156
+            if ($calculator->computeAll()) $view_bag->set('is_success', true);
157 157
         }
158 158
         ViewFactory::make('SosaComputeResult', $this, $controller, $view_bag)->render();
159 159
     }
@@ -173,9 +173,9 @@  discard block
 block discarded – undo
173 173
         $user = User::find(Filter::getInteger('userid', -1));
174 174
         $indi = Individual::getInstance(Filter::get('pid', WT_REGEX_XREF), $WT_TREE);
175 175
         
176
-        if($user && $indi) {
176
+        if ($user && $indi) {
177 177
             $calculator = new SosaCalculator($WT_TREE, $user);
178
-            if($calculator->computeFromIndividual($indi)) $view_bag->set('is_success', true);
178
+            if ($calculator->computeFromIndividual($indi)) $view_bag->set('is_success', true);
179 179
         }
180 180
         else {
181 181
             $view_bag->set('error', I18N::translate('Non existing individual'));
Please login to merge, or discard this patch.
Braces   +10 added lines, -5 removed lines patch added patch discarded remove patch
@@ -106,7 +106,9 @@  discard block
 block discarded – undo
106 106
             }');
107 107
         
108 108
         $action = Filter::post('action');
109
-        if($action === 'update') $this->update($controller);
109
+        if($action === 'update') {
110
+        	$this->update($controller);
111
+        }
110 112
         
111 113
         $view_bag = new ViewBag();
112 114
         $view_bag->set('title', $controller->getPageTitle());
@@ -153,7 +155,9 @@  discard block
 block discarded – undo
153 155
         $user = User::find(Filter::getInteger('userid', -1));
154 156
         if($user) {
155 157
             $calculator = new SosaCalculator($WT_TREE, $user);
156
-            if($calculator->computeAll()) $view_bag->set('is_success', true);
158
+            if($calculator->computeAll()) {
159
+            	$view_bag->set('is_success', true);
160
+            }
157 161
         }
158 162
         ViewFactory::make('SosaComputeResult', $this, $controller, $view_bag)->render();
159 163
     }
@@ -175,9 +179,10 @@  discard block
 block discarded – undo
175 179
         
176 180
         if($user && $indi) {
177 181
             $calculator = new SosaCalculator($WT_TREE, $user);
178
-            if($calculator->computeFromIndividual($indi)) $view_bag->set('is_success', true);
179
-        }
180
-        else {
182
+            if($calculator->computeFromIndividual($indi)) {
183
+            	$view_bag->set('is_success', true);
184
+            }
185
+        } else {
181 186
             $view_bag->set('error', I18N::translate('Non existing individual'));
182 187
         }
183 188
             
Please login to merge, or discard this patch.