Completed
Pull Request — develop (#534)
by Agel_Nash
05:08
created
manager/actions/mutate_module_resources.dynamic.php 1 patch
Spacing   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -1,13 +1,13 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
2
+if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
3 3
 	die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly.");
4 4
 }
5 5
 
6
-if(!$modx->hasPermission('edit_module')) {
6
+if (!$modx->hasPermission('edit_module')) {
7 7
 	$modx->webAlertAndQuit($_lang["error_no_privileges"]);
8 8
 }
9 9
 
10
-$id = isset($_REQUEST['id']) ? (int)$_REQUEST['id'] : 0;
10
+$id = isset($_REQUEST['id']) ? (int) $_REQUEST['id'] : 0;
11 11
 
12 12
 // Get table names (alphabetical)
13 13
 $tbl_active_users = $modx->getFullTableName('active_users');
@@ -24,41 +24,41 @@  discard block
 block discarded – undo
24 24
 $modx->manager->initPageViewState();
25 25
 
26 26
 // check to see the  editor isn't locked
27
-$rs = $modx->db->select('username', $tbl_active_users, "action=108 AND id='{$id}' AND internalKey!='" . $modx->getLoginUserID() . "'");
28
-if($username = $modx->db->getValue($rs)) {
27
+$rs = $modx->db->select('username', $tbl_active_users, "action=108 AND id='{$id}' AND internalKey!='".$modx->getLoginUserID()."'");
28
+if ($username = $modx->db->getValue($rs)) {
29 29
 	$modx->webAlertAndQuit(sprintf($_lang['lock_msg'], $username, 'module'));
30 30
 }
31 31
 // end check for lock
32 32
 
33 33
 // take action
34
-switch($_REQUEST['op']) {
34
+switch ($_REQUEST['op']) {
35 35
 	case 'add':
36 36
 		// convert ids to numbers
37 37
 		$opids = array_filter(array_map('intval', explode(',', $_REQUEST['newids'])));
38 38
 
39
-		if(count($opids) > 0) {
39
+		if (count($opids) > 0) {
40 40
 			// 1-snips, 2-tpls, 3-tvs, 4-chunks, 5-plugins, 6-docs
41 41
 			$rt = strtolower($_REQUEST["rt"]);
42
-			if($rt == 'chunk') {
42
+			if ($rt == 'chunk') {
43 43
 				$type = 10;
44 44
 			}
45
-			if($rt == 'doc') {
45
+			if ($rt == 'doc') {
46 46
 				$type = 20;
47 47
 			}
48
-			if($rt == 'plug') {
48
+			if ($rt == 'plug') {
49 49
 				$type = 30;
50 50
 			}
51
-			if($rt == 'snip') {
51
+			if ($rt == 'snip') {
52 52
 				$type = 40;
53 53
 			}
54
-			if($rt == 'tpl') {
54
+			if ($rt == 'tpl') {
55 55
 				$type = 50;
56 56
 			}
57
-			if($rt == 'tv') {
57
+			if ($rt == 'tv') {
58 58
 				$type = 60;
59 59
 			}
60
-			$modx->db->delete($tbl_site_module_depobj, "module='{$id}' AND resource IN (" . implode(',', $opids) . ") AND type='{$type}'");
61
-			foreach($opids as $opid) {
60
+			$modx->db->delete($tbl_site_module_depobj, "module='{$id}' AND resource IN (".implode(',', $opids).") AND type='{$type}'");
61
+			foreach ($opids as $opid) {
62 62
 				$modx->db->insert(array(
63 63
 					'module' => $id,
64 64
 					'resource' => $opid,
@@ -72,15 +72,15 @@  discard block
 block discarded – undo
72 72
 		$opids = array_filter(array_map('intval', $_REQUEST['depid']));
73 73
 
74 74
 		// get resources that needs to be removed
75
-		$ds = $modx->db->select('*', $tbl_site_module_depobj, "id IN (" . implode(",", $opids) . ")");
75
+		$ds = $modx->db->select('*', $tbl_site_module_depobj, "id IN (".implode(",", $opids).")");
76 76
 		// loop through resources and look for plugins and snippets
77 77
 		$plids = array();
78 78
 		$snid = array();
79
-		while($row = $modx->db->getRow($ds)) {
80
-			if($row['type'] == '30') {
79
+		while ($row = $modx->db->getRow($ds)) {
80
+			if ($row['type'] == '30') {
81 81
 				$plids[$i] = $row['resource'];
82 82
 			}
83
-			if($row['type'] == '40') {
83
+			if ($row['type'] == '40') {
84 84
 				$snids[$i] = $row['resource'];
85 85
 			}
86 86
 		}
@@ -88,28 +88,28 @@  discard block
 block discarded – undo
88 88
 		$ds = $modx->db->select('guid', $tbl_site_modules, "id='{$id}'");
89 89
 		$guid = $modx->db->getValue($ds);
90 90
 		// reset moduleguid for deleted resources
91
-		if(($cp = count($plids)) || ($cs = count($snids))) {
92
-			if($cp) {
93
-				$modx->db->update(array('moduleguid' => ''), $tbl_site_plugins, "id IN (" . implode(',', $plids) . ") AND moduleguid='{$guid}'");
91
+		if (($cp = count($plids)) || ($cs = count($snids))) {
92
+			if ($cp) {
93
+				$modx->db->update(array('moduleguid' => ''), $tbl_site_plugins, "id IN (".implode(',', $plids).") AND moduleguid='{$guid}'");
94 94
 			}
95
-			if($cs) {
96
-				$modx->db->update(array('moduleguid' => ''), $tbl_site_plugins, "id IN (" . implode(',', $snids) . ") AND moduleguid='{$guid}'");
95
+			if ($cs) {
96
+				$modx->db->update(array('moduleguid' => ''), $tbl_site_plugins, "id IN (".implode(',', $snids).") AND moduleguid='{$guid}'");
97 97
 			}
98 98
 			// reset cache
99 99
 			$modx->clearCache('full');
100 100
 		}
101
-		$modx->db->delete($tbl_site_module_depobj, "id IN (" . implode(',', $opids) . ")");
101
+		$modx->db->delete($tbl_site_module_depobj, "id IN (".implode(',', $opids).")");
102 102
 		break;
103 103
 }
104 104
 
105 105
 // load record
106 106
 $rs = $modx->db->select('*', $tbl_site_modules, "id = '{$id}'");
107 107
 $content = $modx->db->getRow($rs);
108
-if(!$content) {
108
+if (!$content) {
109 109
 	$modx->webAlertAndQuit("Module not found for id '{$id}'.");
110 110
 }
111 111
 $_SESSION['itemname'] = $content['name'];
112
-if($content['locked'] == 1 && $_SESSION['mgrRole'] != 1) {
112
+if ($content['locked'] == 1 && $_SESSION['mgrRole'] != 1) {
113 113
 	$modx->webAlertAndQuit($_lang["error_no_privileges"]);
114 114
 }
115 115
 
@@ -188,13 +188,13 @@  discard block
 block discarded – undo
188 188
 	<input type="hidden" name="id" value="<?php echo $content['id']; ?>" />
189 189
 
190 190
 	<h1>
191
-		<i class="fa fa-cogs"></i><?= ($content['name'] ? $content['name'] . '<small>(' . $content['id'] . ')</small>' : $_lang['module_resource_title']) ?>
191
+		<i class="fa fa-cogs"></i><?= ($content['name'] ? $content['name'].'<small>('.$content['id'].')</small>' : $_lang['module_resource_title']) ?>
192 192
 	</h1>
193 193
 
194 194
 	<?php echo $_style['actionbuttons']['dynamic']['close'] ?>
195 195
 
196 196
 	<div class="section">
197
-		<div class="sectionHeader"><?php echo $content["name"] . " - " . $_lang['module_resource_title']; ?></div>
197
+		<div class="sectionHeader"><?php echo $content["name"]." - ".$_lang['module_resource_title']; ?></div>
198 198
 		<div class="sectionBody">
199 199
 			<p><?php echo $_lang['module_resource_msg']; ?></p>
200 200
 			<br />
@@ -218,14 +218,14 @@  discard block
 block discarded – undo
218 218
 					LEFT JOIN {$tbl_site_snippets} AS ss ON ss.id = smd.resource AND smd.type = '40'
219 219
 					LEFT JOIN {$tbl_site_templates} AS st ON st.id = smd.resource AND smd.type = '50'
220 220
 					LEFT JOIN {$tbl_site_tmplvars} AS sv ON sv.id = smd.resource AND smd.type = '60'", "smd.module={$id}", "smd.type,name");
221
-						include_once MODX_MANAGER_PATH . "includes/controls/datagrid.class.php";
221
+						include_once MODX_MANAGER_PATH."includes/controls/datagrid.class.php";
222 222
 						$grd = new DataGrid('', $ds, 0); // set page size to 0 t show all items
223 223
 						$grd->noRecordMsg = $_lang["no_records_found"];
224 224
 						$grd->cssClass = "grid";
225 225
 						$grd->columnHeaderClass = "gridHeader";
226 226
 						$grd->itemClass = "gridItem";
227 227
 						$grd->altItemClass = "gridAltItem";
228
-						$grd->columns = $_lang["element_name"] . " ," . $_lang["type"];
228
+						$grd->columns = $_lang["element_name"]." ,".$_lang["type"];
229 229
 						$grd->colTypes = "template:<input type='checkbox' name='depid[]' value='[+id+]'> [+value+]";
230 230
 						$grd->fields = "name,type";
231 231
 						echo $grd->render();
Please login to merge, or discard this patch.
manager/actions/category_mgr/inc/Categories.php 1 patch
Spacing   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
      */
10 10
     public $db;
11 11
     public $db_tbl   = array();
12
-    public $elements = array( 'templates', 'tmplvars', 'htmlsnippets', 'snippets', 'plugins', 'modules' );
12
+    public $elements = array('templates', 'tmplvars', 'htmlsnippets', 'snippets', 'plugins', 'modules');
13 13
 
14 14
     public function __construct()
15 15
     {
@@ -18,9 +18,9 @@  discard block
 block discarded – undo
18 18
         $this->db                   = & $modx->db;
19 19
         $this->db_tbl['categories'] = $modx->getFullTableName('categories');
20 20
 
21
-        foreach( $this->elements as $element )
21
+        foreach ($this->elements as $element)
22 22
         {
23
-            $this->db_tbl[$element] = $modx->getFullTableName('site_' . $element );
23
+            $this->db_tbl[$element] = $modx->getFullTableName('site_'.$element);
24 24
         }
25 25
     }
26 26
 
@@ -40,50 +40,50 @@  discard block
 block discarded – undo
40 40
             )
41 41
         );
42 42
 
43
-        return empty( $categories ) ? array() : $categories;
43
+        return empty($categories) ? array() : $categories;
44 44
     }
45 45
 
46
-    public function getCategory( $search, $where = 'category' )
46
+    public function getCategory($search, $where = 'category')
47 47
     {
48 48
         $category = $this->db->getRow(
49 49
             $this->db->select(
50 50
                 '*',
51 51
                 $this->db_tbl['categories'],
52
-                "`" . $where . "` = '" . $search . "'"
52
+                "`".$where."` = '".$search."'"
53 53
             )
54 54
         );
55 55
         return $category;
56 56
     }
57 57
 
58
-    public function getCategoryValue( $value, $search, $where = 'category' )
58
+    public function getCategoryValue($value, $search, $where = 'category')
59 59
     {
60 60
         $_value = $this->db->getValue(
61 61
             $this->db->select(
62
-                '`' . $value . '`',
62
+                '`'.$value.'`',
63 63
                 $this->db_tbl['categories'],
64
-                "`" . $where . "` = '" . $search . "'"
64
+                "`".$where."` = '".$search."'"
65 65
             )
66 66
         );
67 67
         return $_value;
68 68
     }
69 69
 
70
-    public function getAssignedElements( $category_id, $element )
70
+    public function getAssignedElements($category_id, $element)
71 71
     {
72
-        if( in_array( $element, $this->elements, true ) )
72
+        if (in_array($element, $this->elements, true))
73 73
         {
74 74
             $elements = $this->db->makeArray(
75 75
                 $this->db->select(
76 76
                     '*',
77 77
                     $this->db_tbl[$element],
78
-                    "`category` = '" . $category_id . "'"
78
+                    "`category` = '".$category_id."'"
79 79
                 )
80 80
             );
81 81
 
82 82
             // correct the name of templates
83
-            if( $element === 'templates' )
83
+            if ($element === 'templates')
84 84
             {
85 85
                 $_elements_count = count($elements);
86
-                for( $i=0; $i < $_elements_count; $i++ )
86
+                for ($i = 0; $i < $_elements_count; $i++)
87 87
                 {
88 88
                     $elements[$i]['name'] = $elements[$i]['templatename'];
89 89
                 }
@@ -93,56 +93,56 @@  discard block
 block discarded – undo
93 93
         return false;
94 94
     }
95 95
 
96
-    public function getAllAssignedElements( $category_id )
96
+    public function getAllAssignedElements($category_id)
97 97
     {
98 98
         $elements = array();
99
-        foreach( $this->elements as $element )
99
+        foreach ($this->elements as $element)
100 100
         {
101
-            $elements[$element] = $this->getAssignedElements( $category_id, $element );
101
+            $elements[$element] = $this->getAssignedElements($category_id, $element);
102 102
         }
103 103
         return $elements;
104 104
     }
105 105
 
106
-    public function deleteCategory( $category_id )
106
+    public function deleteCategory($category_id)
107 107
     {
108 108
         $_update = array('category' => 0);
109
-        foreach( $this->elements as $element )
109
+        foreach ($this->elements as $element)
110 110
         {
111 111
             $this->db->update(
112 112
                 $_update,
113 113
                 $this->db_tbl[$element],
114
-                "`category` = '" . $category_id . "'"
114
+                "`category` = '".$category_id."'"
115 115
             );
116 116
         }
117 117
 
118 118
         $this->db->delete(
119 119
             $this->db_tbl['categories'],
120
-            "`id` = '" . $category_id . "'"
120
+            "`id` = '".$category_id."'"
121 121
         );
122 122
 
123 123
         return $this->db->getAffectedRows() === 1;
124 124
     }
125 125
 
126
-    public function updateCategory( $category_id, $data = array() )
126
+    public function updateCategory($category_id, $data = array())
127 127
     {
128
-        if( empty( $data )
129
-            || empty( $category_id ) )
128
+        if (empty($data)
129
+            || empty($category_id))
130 130
         {
131 131
             return false;
132 132
         }
133 133
 
134 134
         $_update = array(
135
-            'category' => $this->db->escape( $data['category'] ),
136
-            'rank'     => (int)$data['rank']
135
+            'category' => $this->db->escape($data['category']),
136
+            'rank'     => (int) $data['rank']
137 137
         );
138 138
 
139 139
         $this->db->update(
140 140
             $_update,
141 141
             $this->db_tbl['categories'],
142
-            "`id` = '" . (int)$category_id . "'"
142
+            "`id` = '".(int) $category_id."'"
143 143
         );
144 144
 
145
-        if( $this->db->getAffectedRows() === 1 )
145
+        if ($this->db->getAffectedRows() === 1)
146 146
         {
147 147
             return true;
148 148
         }
@@ -150,16 +150,16 @@  discard block
 block discarded – undo
150 150
         return false;
151 151
     }
152 152
 
153
-    public function addCategory( $category_name, $category_rank )
153
+    public function addCategory($category_name, $category_rank)
154 154
     {
155
-        if( $this->isCategoryExists( $category_name ) )
155
+        if ($this->isCategoryExists($category_name))
156 156
         {
157 157
             return false;
158 158
         }
159 159
 
160 160
         $_insert = array(
161
-            'category' => $this->db->escape( $category_name ),
162
-            'rank'     => (int)$category_rank
161
+            'category' => $this->db->escape($category_name),
162
+            'rank'     => (int) $category_rank
163 163
         );
164 164
 
165 165
         $this->db->insert(
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
             $this->db_tbl['categories']
168 168
         );
169 169
 
170
-        if( $this->db->getAffectedRows() === 1 )
170
+        if ($this->db->getAffectedRows() === 1)
171 171
         {
172 172
             return $this->db->getInsertId();
173 173
         }
@@ -175,19 +175,19 @@  discard block
 block discarded – undo
175 175
         return false;
176 176
     }
177 177
 
178
-    public function isCategoryExists( $category_name )
178
+    public function isCategoryExists($category_name)
179 179
     {
180
-        $category = $this->db->escape( $category_name );
180
+        $category = $this->db->escape($category_name);
181 181
 
182 182
         $category_id = $this->db->getValue(
183 183
             $this->db->select(
184 184
                 '`id`',
185 185
                 $this->db_tbl['categories'],
186
-                "`category` = '" . $category . "'"
186
+                "`category` = '".$category."'"
187 187
             )
188 188
         );
189 189
 
190
-        if( $this->db->getAffectedRows() === 1 )
190
+        if ($this->db->getAffectedRows() === 1)
191 191
         {
192 192
             return $category_id;
193 193
         }
Please login to merge, or discard this patch.
manager/actions/mutate_plugin.dynamic.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
2
+if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
3 3
     die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly.");
4 4
 }
5 5
 
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
         $modx->webAlertAndQuit($_lang["error_no_privileges"]);
19 19
 }
20 20
 
21
-$id = isset($_REQUEST['id']) ? (int)$_REQUEST['id'] : 0;
21
+$id = isset($_REQUEST['id']) ? (int) $_REQUEST['id'] : 0;
22 22
 
23 23
 $tbl_site_plugins = $modx->getFullTableName('site_plugins');
24 24
 $tbl_site_plugin_events = $modx->getFullTableName('site_plugin_events');
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
     $content['properties'] = str_replace("&", "&amp;", $content['properties']);
47 47
 } else {
48 48
     $_SESSION['itemname'] = $_lang["new_plugin"];
49
-    $content['category'] = (int)$_REQUEST['catid'];
49
+    $content['category'] = (int) $_REQUEST['catid'];
50 50
 }
51 51
 
52 52
 if ($modx->manager->hasFormValues()) {
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
 // Add lock-element JS-Script
57 57
 $lockElementId = $id;
58 58
 $lockElementType = 5;
59
-require_once(MODX_MANAGER_PATH . 'includes/active_user_locks.inc.php');
59
+require_once(MODX_MANAGER_PATH.'includes/active_user_locks.inc.php');
60 60
 
61 61
 function bold($cond = false)
62 62
 {
@@ -478,7 +478,7 @@  discard block
 block discarded – undo
478 478
     <input type="hidden" name="mode" value="<?= $modx->manager->action ?>">
479 479
 
480 480
     <h1>
481
-        <i class="fa fa-plug"></i><?= ($content['name'] ? $content['name'] . '<small>(' . $content['id'] . ')</small>' : $_lang['new_plugin']) ?><i class="fa fa-question-circle help"></i>
481
+        <i class="fa fa-plug"></i><?= ($content['name'] ? $content['name'].'<small>('.$content['id'].')</small>' : $_lang['new_plugin']) ?><i class="fa fa-question-circle help"></i>
482 482
     </h1>
483 483
 
484 484
     <?= $_style['actionbuttons']['dynamic']['element'] ?>
@@ -504,7 +504,7 @@  discard block
 block discarded – undo
504 504
                             <div class="form-control-name clearfix">
505 505
                                 <input name="name" type="text" maxlength="100" value="<?= $modx->htmlspecialchars($content['name']) ?>" class="form-control form-control-lg" onchange="documentDirty=true;" />
506 506
                                 <?php if ($modx->hasPermission('save_role')): ?>
507
-                                <label class="custom-control" title="<?= $_lang['lock_plugin'] . "\n" . $_lang['lock_plugin_msg'] ?>" tooltip>
507
+                                <label class="custom-control" title="<?= $_lang['lock_plugin']."\n".$_lang['lock_plugin_msg'] ?>" tooltip>
508 508
                                     <input name="locked" type="checkbox" value="on"<?= ($content['locked'] == 1 ? ' checked="checked"' : '') ?> />
509 509
                                     <i class="fa fa-lock"></i>
510 510
                                 </label>
@@ -528,9 +528,9 @@  discard block
 block discarded – undo
528 528
                             <select name="categoryid" class="form-control" onchange="documentDirty=true;">
529 529
                                 <option>&nbsp;</option>
530 530
                                 <?php
531
-                                include_once(MODX_MANAGER_PATH . 'includes/categories.inc.php');
531
+                                include_once(MODX_MANAGER_PATH.'includes/categories.inc.php');
532 532
                                 foreach (getCategories() as $n => $v) {
533
-                                    echo '<option value="' . $v['id'] . '"' . ($content["category"] == $v["id"] ? ' selected="selected"' : '') . '>' . $modx->htmlspecialchars($v["category"]) . "</option>";
533
+                                    echo '<option value="'.$v['id'].'"'.($content["category"] == $v["id"] ? ' selected="selected"' : '').'>'.$modx->htmlspecialchars($v["category"])."</option>";
534 534
                                 }
535 535
                                 ?>
536 536
                             </select>
@@ -546,7 +546,7 @@  discard block
 block discarded – undo
546 546
                 <?php if ($modx->hasPermission('save_role')): ?>
547 547
                 <div class="form-group">
548 548
                     <div class="form-row">
549
-                        <label><input name="disabled" type="checkbox" value="on"<?= ($content['disabled'] == 1 ? ' checked="checked"' : '') ?> /> <?= ($content['disabled'] == 1 ? "<span class='text-danger'>" . $_lang['plugin_disabled'] . "</span>" : $_lang['plugin_disabled']) ?></label>
549
+                        <label><input name="disabled" type="checkbox" value="on"<?= ($content['disabled'] == 1 ? ' checked="checked"' : '') ?> /> <?= ($content['disabled'] == 1 ? "<span class='text-danger'>".$_lang['plugin_disabled']."</span>" : $_lang['plugin_disabled']) ?></label>
550 550
                     </div>
551 551
                     <div class="form-row">
552 552
                         <label>
@@ -593,11 +593,11 @@  discard block
 block discarded – undo
593 593
                             <select name="moduleguid" class="form-control" onchange="documentDirty=true;">
594 594
                                 <option>&nbsp;</option>
595 595
                                 <?php
596
-                                $ds = $modx->db->select('sm.id,sm.name,sm.guid', $modx->getFullTableName("site_modules") . " sm 
597
-								INNER JOIN " . $modx->getFullTableName("site_module_depobj") . " smd ON smd.module=sm.id AND smd.type=30
598
-								INNER JOIN " . $modx->getFullTableName("site_plugins") . " sp ON sp.id=smd.resource", "smd.resource='{$id}' AND sm.enable_sharedparams='1'", 'sm.name');
596
+                                $ds = $modx->db->select('sm.id,sm.name,sm.guid', $modx->getFullTableName("site_modules")." sm 
597
+								INNER JOIN " . $modx->getFullTableName("site_module_depobj")." smd ON smd.module=sm.id AND smd.type=30
598
+								INNER JOIN " . $modx->getFullTableName("site_plugins")." sp ON sp.id=smd.resource", "smd.resource='{$id}' AND sm.enable_sharedparams='1'", 'sm.name');
599 599
                                 while ($row = $modx->db->getRow($ds)) {
600
-                                    echo "<option value='" . $row['guid'] . "'" . ($content["moduleguid"] == $row["guid"] ? " selected='selected'" : "") . ">" . $modx->htmlspecialchars($row["name"]) . "</option>";
600
+                                    echo "<option value='".$row['guid']."'".($content["moduleguid"] == $row["guid"] ? " selected='selected'" : "").">".$modx->htmlspecialchars($row["name"])."</option>";
601 601
                                 }
602 602
                                 ?>
603 603
                             </select>
@@ -658,7 +658,7 @@  discard block
 block discarded – undo
658 658
                                 echoEventRows($evtnames);
659 659
                             }
660 660
                             echo '<hr class="clear">';
661
-                            echo '<div class="form-group"><b>' . $services[$srv - 1] . '</b></div>';
661
+                            echo '<div class="form-group"><b>'.$services[$srv - 1].'</b></div>';
662 662
                         }
663 663
                         // display group name
664 664
                         if ($grp != $row['groupname']) {
@@ -667,9 +667,9 @@  discard block
 block discarded – undo
667 667
                                 echoEventRows($evtnames);
668 668
                             }
669 669
                             echo '<hr class="clear">';
670
-                            echo '<div class="form-group"><b>' . $row['groupname'] . '</b></div>';
670
+                            echo '<div class="form-group"><b>'.$row['groupname'].'</b></div>';
671 671
                         }
672
-                        $evtnames[] = '<input name="sysevents[]" id="' . $row['name'] . '" type="checkbox" ' . (in_array($row['id'], $evts) ? ' checked="checked" ' : '') . 'class="inputBox" value="' . $row['id'] . '" /> <label for="' . $row['name'] . '" ' . bold(in_array($row['id'], $evts)) . '> ' . $row['name'] . '</label>' . "\n";
672
+                        $evtnames[] = '<input name="sysevents[]" id="'.$row['name'].'" type="checkbox" '.(in_array($row['id'], $evts) ? ' checked="checked" ' : '').'class="inputBox" value="'.$row['id'].'" /> <label for="'.$row['name'].'" '.bold(in_array($row['id'], $evts)).'> '.$row['name'].'</label>'."\n";
673 673
                         if (count($evtnames) == 2) {
674 674
                             echoEventRows($evtnames);
675 675
                         }
@@ -681,7 +681,7 @@  discard block
 block discarded – undo
681 681
 
682 682
                 function echoEventRows(&$evtnames)
683 683
                 {
684
-                    echo '<div class="row form-row"><div class="col-sm-6 col-md-4 col-lg-3">' . implode('</div><div class="col-sm-6 col-md-4 col-lg-3">', $evtnames) . '</div></div>';
684
+                    echo '<div class="row form-row"><div class="col-sm-6 col-md-4 col-lg-3">'.implode('</div><div class="col-sm-6 col-md-4 col-lg-3">', $evtnames).'</div></div>';
685 685
                     $evtnames = array();
686 686
                 }
687 687
 
Please login to merge, or discard this patch.
manager/actions/mutate_snippet.dynamic.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
2
+if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
3 3
     die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly.");
4 4
 }
5 5
 
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
         $modx->webAlertAndQuit($_lang["error_no_privileges"]);
19 19
 }
20 20
 
21
-$id = isset($_REQUEST['id']) ? (int)$_REQUEST['id'] : 0;
21
+$id = isset($_REQUEST['id']) ? (int) $_REQUEST['id'] : 0;
22 22
 
23 23
 // Get table Names (alphabetical)
24 24
 $tbl_site_module_depobj = $modx->getFullTableName('site_module_depobj');
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
     $rs = $modx->db->select('*', $tbl_site_snippets, "id='{$id}'");
40 40
     $content = $modx->db->getRow($rs);
41 41
     if (!$content) {
42
-        header("Location: " . MODX_SITE_URL . "index.php?id=" . $site_start);
42
+        header("Location: ".MODX_SITE_URL."index.php?id=".$site_start);
43 43
     }
44 44
     $_SESSION['itemname'] = $content['name'];
45 45
     if ($content['locked'] == 1 && $_SESSION['mgrRole'] != 1) {
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
     $content['name'] = $_REQUEST['itemname'];
51 51
 } else {
52 52
     $_SESSION['itemname'] = $_lang["new_snippet"];
53
-    $content['category'] = (int)$_REQUEST['catid'];
53
+    $content['category'] = (int) $_REQUEST['catid'];
54 54
 }
55 55
 
56 56
 if ($modx->manager->hasFormValues()) {
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
 // Add lock-element JS-Script
63 63
 $lockElementId = $id;
64 64
 $lockElementType = 4;
65
-require_once(MODX_MANAGER_PATH . 'includes/active_user_locks.inc.php');
65
+require_once(MODX_MANAGER_PATH.'includes/active_user_locks.inc.php');
66 66
 ?>
67 67
 <script type="text/javascript">
68 68
 
@@ -431,7 +431,7 @@  discard block
 block discarded – undo
431 431
     <input type="hidden" name="mode" value="<?= $modx->manager->action ?>">
432 432
 
433 433
     <h1 class="pagetitle">
434
-        <i class="fa fa-code"></i><?= ($content['name'] ? $content['name'] . '<small>(' . $content['id'] . ')</small>' : $_lang['new_snippet']) ?><i class="fa fa-question-circle help"></i>
434
+        <i class="fa fa-code"></i><?= ($content['name'] ? $content['name'].'<small>('.$content['id'].')</small>' : $_lang['new_snippet']) ?><i class="fa fa-question-circle help"></i>
435 435
     </h1>
436 436
 
437 437
     <?= $_style['actionbuttons']['dynamic']['element'] ?>
@@ -457,7 +457,7 @@  discard block
 block discarded – undo
457 457
                             <div class="form-control-name clearfix">
458 458
                                 <input name="name" type="text" maxlength="100" value="<?= $modx->htmlspecialchars($content['name']) ?>" class="form-control form-control-lg" onchange="documentDirty=true;" />
459 459
                                 <?php if ($modx->hasPermission('save_role')): ?>
460
-                                    <label class="custom-control" title="<?= $_lang['lock_snippet'] . "\n" . $_lang['lock_snippet_msg'] ?>" tooltip>
460
+                                    <label class="custom-control" title="<?= $_lang['lock_snippet']."\n".$_lang['lock_snippet_msg'] ?>" tooltip>
461 461
                                         <input name="locked" type="checkbox"<?= ($content['locked'] == 1 ? ' checked="checked"' : '') ?> />
462 462
                                         <i class="fa fa-lock"></i>
463 463
                                     </label>
@@ -481,9 +481,9 @@  discard block
 block discarded – undo
481 481
                             <select name="categoryid" class="form-control" onchange="documentDirty=true;">
482 482
                                 <option>&nbsp;</option>
483 483
                                 <?php
484
-                                include_once(MODX_MANAGER_PATH . 'includes/categories.inc.php');
484
+                                include_once(MODX_MANAGER_PATH.'includes/categories.inc.php');
485 485
                                 foreach (getCategories() as $n => $v) {
486
-                                    echo '<option value="' . $v['id'] . '"' . ($content['category'] == $v['id'] ? ' selected="selected"' : '') . '>' . $modx->htmlspecialchars($v['category']) . '</option>';
486
+                                    echo '<option value="'.$v['id'].'"'.($content['category'] == $v['id'] ? ' selected="selected"' : '').'>'.$modx->htmlspecialchars($v['category']).'</option>';
487 487
                                 }
488 488
                                 ?>
489 489
                             </select>
@@ -500,7 +500,7 @@  discard block
 block discarded – undo
500 500
                     <div class="form-group">
501 501
                         <?php if ($_SESSION['mgrRole'] == 1): ?>
502 502
                             <div class="form-row">
503
-                                <label><input name="disabled" type="checkbox" value="on"<?= ($content['disabled'] == 1 ? ' checked="checked"' : '') ?> /> <?= ($content['disabled'] == 1 ? "<span class='text-danger'>" . $_lang['disabled'] . "</span>" : $_lang['disabled']) ?></label>
503
+                                <label><input name="disabled" type="checkbox" value="on"<?= ($content['disabled'] == 1 ? ' checked="checked"' : '') ?> /> <?= ($content['disabled'] == 1 ? "<span class='text-danger'>".$_lang['disabled']."</span>" : $_lang['disabled']) ?></label>
504 504
                             </div>
505 505
                         <?php endif; ?>
506 506
                         <div class="form-row">
@@ -517,7 +517,7 @@  discard block
 block discarded – undo
517 517
                 <span><?= $_lang['snippet_code'] ?></span>
518 518
             </div>
519 519
             <div class="section-editor clearfix">
520
-                <textarea dir="ltr" name="post" class="phptextarea" rows="20" wrap="soft" onchange="documentDirty=true;"><?= (isset($content['post']) ? trim($modx->htmlspecialchars($content['post'])) : "<?php" . "\n" . trim($modx->htmlspecialchars($content['snippet'])) . "\n") ?></textarea>
520
+                <textarea dir="ltr" name="post" class="phptextarea" rows="20" wrap="soft" onchange="documentDirty=true;"><?= (isset($content['post']) ? trim($modx->htmlspecialchars($content['post'])) : "<?php"."\n".trim($modx->htmlspecialchars($content['snippet']))."\n") ?></textarea>
521 521
             </div>
522 522
             <!-- PHP text editor end -->
523 523
         </div>
@@ -552,7 +552,7 @@  discard block
 block discarded – undo
552 552
 								INNER JOIN {$tbl_site_module_depobj} AS smd ON smd.module=sm.id AND smd.type=40 
553 553
 								INNER JOIN {$tbl_site_snippets} AS ss ON ss.id=smd.resource", "smd.resource='{$id}' AND sm.enable_sharedparams=1", 'sm.name');
554 554
                                 while ($row = $modx->db->getRow($ds)) {
555
-                                    echo "<option value='" . $row['guid'] . "'" . ($content['moduleguid'] == $row['guid'] ? " selected='selected'" : "") . ">" . $modx->htmlspecialchars($row['name']) . "</option>";
555
+                                    echo "<option value='".$row['guid']."'".($content['moduleguid'] == $row['guid'] ? " selected='selected'" : "").">".$modx->htmlspecialchars($row['name'])."</option>";
556 556
                                 }
557 557
                                 ?>
558 558
                             </select>
Please login to merge, or discard this patch.
manager/includes/accesscontrol.inc.php 1 patch
Spacing   +51 added lines, -51 removed lines patch added patch discarded remove patch
@@ -1,14 +1,14 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
2
+if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
3 3
 	die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly.");
4 4
 }
5 5
 
6
-if(!isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
6
+if (!isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
7 7
 	header('HTTP/1.0 404 Not Found');
8 8
 	exit;
9 9
 }
10 10
 
11
-if(isset($_SESSION['mgrValidated']) && $_SESSION['usertype'] != 'manager') {
11
+if (isset($_SESSION['mgrValidated']) && $_SESSION['usertype'] != 'manager') {
12 12
 	//		if (isset($_COOKIE[session_name()])) {
13 13
 	//			setcookie(session_name(), '', 0, MODX_BASE_URL);
14 14
 	//		}
@@ -18,16 +18,16 @@  discard block
 block discarded – undo
18 18
 }
19 19
 
20 20
 // andrazk 20070416 - if installer is running, destroy active sessions
21
-if(file_exists(MODX_BASE_PATH . 'assets/cache/installProc.inc.php')) {
22
-	include_once(MODX_BASE_PATH . 'assets/cache/installProc.inc.php');
23
-	if(isset($installStartTime)) {
24
-		if((time() - $installStartTime) > 5 * 60) { // if install flag older than 5 minutes, discard
21
+if (file_exists(MODX_BASE_PATH.'assets/cache/installProc.inc.php')) {
22
+	include_once(MODX_BASE_PATH.'assets/cache/installProc.inc.php');
23
+	if (isset($installStartTime)) {
24
+		if ((time() - $installStartTime) > 5 * 60) { // if install flag older than 5 minutes, discard
25 25
 			unset($installStartTime);
26
-			@ chmod(MODX_BASE_PATH . 'assets/cache/installProc.inc.php', 0755);
27
-			unlink(MODX_BASE_PATH . 'assets/cache/installProc.inc.php');
26
+			@ chmod(MODX_BASE_PATH.'assets/cache/installProc.inc.php', 0755);
27
+			unlink(MODX_BASE_PATH.'assets/cache/installProc.inc.php');
28 28
 		} else {
29
-			if($_SERVER['REQUEST_METHOD'] != 'POST') {
30
-				if(isset($_COOKIE[session_name()])) {
29
+			if ($_SERVER['REQUEST_METHOD'] != 'POST') {
30
+				if (isset($_COOKIE[session_name()])) {
31 31
 					session_unset();
32 32
 					@session_destroy();
33 33
 					//					setcookie(session_name(), '', 0, MODX_BASE_URL);
@@ -39,37 +39,37 @@  discard block
 block discarded – undo
39 39
 }
40 40
 
41 41
 // andrazk 20070416 - if session started before install and was not destroyed yet
42
-if(isset($lastInstallTime)) {
43
-	if(isset($_SESSION['mgrValidated'])) {
44
-		if(isset($_SESSION['modx.session.created.time'])) {
45
-			if($_SESSION['modx.session.created.time'] < $lastInstallTime) {
46
-				if($_SERVER['REQUEST_METHOD'] != 'POST') {
47
-					if(isset($_COOKIE[session_name()])) {
42
+if (isset($lastInstallTime)) {
43
+	if (isset($_SESSION['mgrValidated'])) {
44
+		if (isset($_SESSION['modx.session.created.time'])) {
45
+			if ($_SESSION['modx.session.created.time'] < $lastInstallTime) {
46
+				if ($_SERVER['REQUEST_METHOD'] != 'POST') {
47
+					if (isset($_COOKIE[session_name()])) {
48 48
 						session_unset();
49 49
 						@session_destroy();
50 50
 						//						setcookie(session_name(), '', 0, MODX_BASE_URL);
51 51
 					}
52 52
 					header('HTTP/1.0 307 Redirect');
53
-					header('Location: ' . MODX_MANAGER_URL . 'index.php?installGoingOn=2');
53
+					header('Location: '.MODX_MANAGER_URL.'index.php?installGoingOn=2');
54 54
 				}
55 55
 			}
56 56
 		}
57 57
 	}
58 58
 }
59 59
 
60
-if(!isset($_SESSION['mgrValidated'])) {
61
-	if(isset($manager_language)) {
60
+if (!isset($_SESSION['mgrValidated'])) {
61
+	if (isset($manager_language)) {
62 62
 		// establish fallback to English default
63 63
 		include_once "lang/english.inc.php";
64 64
 		// include localized overrides
65
-		include_once "lang/" . $manager_language . ".inc.php";
65
+		include_once "lang/".$manager_language.".inc.php";
66 66
 	} else {
67 67
 		include_once "lang/english.inc.php";
68 68
 	}
69 69
 
70 70
 	$modx->setPlaceholder('modx_charset', $modx_manager_charset);
71 71
 	$modx->setPlaceholder('theme', $manager_theme);
72
-    $modx->setPlaceholder('favicon', (file_exists(MODX_BASE_PATH . 'favicon.ico') ? MODX_SITE_URL . 'favicon.ico' : 'media/style/' . $modx->config['manager_theme'] . '/images/favicon.ico'));
72
+    $modx->setPlaceholder('favicon', (file_exists(MODX_BASE_PATH.'favicon.ico') ? MODX_SITE_URL . 'favicon.ico' : 'media/style/'.$modx->config['manager_theme'].'/images/favicon.ico'));
73 73
 
74 74
 	// invoke OnManagerLoginFormPrerender event
75 75
 	$evtOut = $modx->invokeEvent('OnManagerLoginFormPrerender');
@@ -80,29 +80,29 @@  discard block
 block discarded – undo
80 80
 	$modx->setPlaceholder('manager_path', MGR_DIR);
81 81
 	$modx->setPlaceholder('logo_slogan', $_lang["logo_slogan"]);
82 82
 	$modx->setPlaceholder('login_message', $_lang["login_message"]);
83
-	$modx->setPlaceholder('manager_theme_url', MODX_MANAGER_URL . 'media/style/' . $modx->config['manager_theme'] . '/');
83
+	$modx->setPlaceholder('manager_theme_url', MODX_MANAGER_URL.'media/style/'.$modx->config['manager_theme'].'/');
84 84
 	$modx->setPlaceholder('year', date('Y'));
85 85
 	$modx->setPlaceholder('manager_theme_style', (isset($_COOKIE['MODX_themeColor']) ? $_COOKIE['MODX_themeColor'] : ''));
86 86
 
87 87
 	// andrazk 20070416 - notify user of install/update
88
-	if(isset($_GET['installGoingOn'])) {
88
+	if (isset($_GET['installGoingOn'])) {
89 89
 		$installGoingOn = $_GET['installGoingOn'];
90 90
 	}
91
-	if(isset($installGoingOn)) {
92
-		switch($installGoingOn) {
91
+	if (isset($installGoingOn)) {
92
+		switch ($installGoingOn) {
93 93
 			case 1 :
94
-				$modx->setPlaceholder('login_message', "<p><span class=\"fail\">" . $_lang["login_cancelled_install_in_progress"] . "</p><p>" . $_lang["login_message"] . "</p>");
94
+				$modx->setPlaceholder('login_message', "<p><span class=\"fail\">".$_lang["login_cancelled_install_in_progress"]."</p><p>".$_lang["login_message"]."</p>");
95 95
 				break;
96 96
 			case 2 :
97
-				$modx->setPlaceholder('login_message', "<p><span class=\"fail\">" . $_lang["login_cancelled_site_was_updated"] . "</p><p>" . $_lang["login_message"] . "</p>");
97
+				$modx->setPlaceholder('login_message', "<p><span class=\"fail\">".$_lang["login_cancelled_site_was_updated"]."</p><p>".$_lang["login_message"]."</p>");
98 98
 				break;
99 99
 		}
100 100
 	}
101 101
 
102
-	if($modx->config['use_captcha'] == 1) {
102
+	if ($modx->config['use_captcha'] == 1) {
103 103
 		$modx->setPlaceholder('login_captcha_message', $_lang["login_captcha_message"]);
104
-		$modx->setPlaceholder('captcha_image', '<a href="' . MODX_MANAGER_URL . '" class="loginCaptcha"><img id="captcha_image" src="' . MODX_MANAGER_URL . 'includes/veriword.php?rand=' . rand() . '" alt="' . $_lang["login_captcha_message"] . '" /></a>');
105
-		$modx->setPlaceholder('captcha_input', '<label>' . $_lang["captcha_code"] . '</label> <input type="text" name="captcha_code" tabindex="3" value="" />');
104
+		$modx->setPlaceholder('captcha_image', '<a href="'.MODX_MANAGER_URL.'" class="loginCaptcha"><img id="captcha_image" src="'.MODX_MANAGER_URL.'includes/veriword.php?rand='.rand().'" alt="'.$_lang["login_captcha_message"].'" /></a>');
105
+		$modx->setPlaceholder('captcha_input', '<label>'.$_lang["captcha_code"].'</label> <input type="text" name="captcha_code" tabindex="3" value="" />');
106 106
 	}
107 107
 
108 108
 	// login info
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
 
120 120
 	// invoke OnManagerLoginFormRender event
121 121
 	$evtOut = $modx->invokeEvent('OnManagerLoginFormRender');
122
-	$html = is_array($evtOut) ? '<div id="onManagerLoginFormRender">' . implode('', $evtOut) . '</div>' : '';
122
+	$html = is_array($evtOut) ? '<div id="onManagerLoginFormRender">'.implode('', $evtOut).'</div>' : '';
123 123
 	$modx->setPlaceholder('OnManagerLoginFormRender', $html);
124 124
 
125 125
 	// load template
@@ -128,38 +128,38 @@  discard block
 block discarded – undo
128 128
 	$target = $modx->mergeSettingsContent($target);
129 129
 
130 130
 	$login_tpl = null;
131
-	if(substr($target, 0, 1) === '@') {
132
-		if(substr($target, 0, 6) === '@CHUNK') {
131
+	if (substr($target, 0, 1) === '@') {
132
+		if (substr($target, 0, 6) === '@CHUNK') {
133 133
 			$target = trim(substr($target, 7));
134 134
 			$login_tpl = $modx->getChunk($target);
135
-		} elseif(substr($target, 0, 5) === '@FILE') {
135
+		} elseif (substr($target, 0, 5) === '@FILE') {
136 136
 			$target = trim(substr($target, 6));
137 137
 			$login_tpl = file_get_contents($target);
138 138
 		}
139 139
 	} else {
140
-		$theme_path = MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/';
141
-		if(is_file($theme_path . 'style.php')) {
142
-			include($theme_path . 'style.php');
140
+		$theme_path = MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/';
141
+		if (is_file($theme_path.'style.php')) {
142
+			include($theme_path.'style.php');
143 143
 		}
144 144
 		$chunk = $modx->getChunk($target);
145
-		if($chunk !== false && !empty($chunk)) {
145
+		if ($chunk !== false && !empty($chunk)) {
146 146
 			$login_tpl = $chunk;
147
-		} elseif(is_file(MODX_BASE_PATH . $target)) {
148
-			$target = MODX_BASE_PATH . $target;
147
+		} elseif (is_file(MODX_BASE_PATH.$target)) {
148
+			$target = MODX_BASE_PATH.$target;
149 149
 			$login_tpl = file_get_contents($target);
150
-		} elseif(is_file($target)) {
150
+		} elseif (is_file($target)) {
151 151
 			$login_tpl = file_get_contents($target);
152
-		} elseif(is_file($theme_path . 'login.tpl')) {
153
-			$target = $theme_path . 'login.tpl';
152
+		} elseif (is_file($theme_path.'login.tpl')) {
153
+			$target = $theme_path.'login.tpl';
154 154
 			$login_tpl = file_get_contents($target);
155
-		} elseif(is_file($theme_path . 'templates/actions/login.tpl')) {
156
-			$target = $theme_path . 'templates/actions/login.tpl';
155
+		} elseif (is_file($theme_path.'templates/actions/login.tpl')) {
156
+			$target = $theme_path.'templates/actions/login.tpl';
157 157
 			$login_tpl = file_get_contents($target);
158
-		} elseif(is_file($theme_path . 'html/login.html')) { // ClipperCMS compatible
159
-			$target = $theme_path . 'html/login.html';
158
+		} elseif (is_file($theme_path.'html/login.html')) { // ClipperCMS compatible
159
+			$target = $theme_path.'html/login.html';
160 160
 			$login_tpl = file_get_contents($target);
161 161
 		} else {
162
-			$target = MODX_MANAGER_PATH . 'media/style/common/login.tpl';
162
+			$target = MODX_MANAGER_PATH.'media/style/common/login.tpl';
163 163
 			$login_tpl = file_get_contents($target);
164 164
 		}
165 165
 	}
@@ -182,8 +182,8 @@  discard block
 block discarded – undo
182 182
 	$lasthittime = time();
183 183
 	$action = isset($_REQUEST['a']) ? (int) $_REQUEST['a'] : 1;
184 184
 
185
-	if($action !== 1) {
186
-		if((int)$itemid <= 0) {
185
+	if ($action !== 1) {
186
+		if ((int) $itemid <= 0) {
187 187
 			$itemid = null;
188 188
 		}
189 189
 		$sql = sprintf("REPLACE INTO %s (sid, internalKey, username, lasthit, action, id) VALUES ('%s', %d, '%s', %d, '%s', %s)", $modx->getFullTableName('active_users') // Table
Please login to merge, or discard this patch.
manager/includes/veriword.php 1 patch
Spacing   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@  discard block
 block discarded – undo
7 7
 $modx->db->connect();
8 8
 $modx->getSettings();
9 9
 
10
-$vword = new VeriWord(148,60);
10
+$vword = new VeriWord(148, 60);
11 11
 $vword->output_image();
12 12
 $vword->destroy_image();
13 13
 
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
 ## see sample.php for test and usage
44 44
 ## sample URL: http://www.program-ruti.org/veriword/
45 45
 ####
46
-class VeriWord {
46
+class VeriWord{
47 47
 
48 48
     /* path to font directory*/
49 49
     public $dir_font   = "ttf/";
@@ -54,45 +54,45 @@  discard block
 block discarded – undo
54 54
     public $im_height  = 0;
55 55
     public $im;
56 56
 
57
-    public function __construct($w=200, $h=80) {
57
+    public function __construct($w = 200, $h = 80){
58 58
         /* create session to set word for verification */
59 59
         startCMSSession();
60 60
         $this->set_veriword();
61
-        $this->dir_font = dirname(__FILE__) . '/' . $this->dir_font;
61
+        $this->dir_font = dirname(__FILE__).'/'.$this->dir_font;
62 62
         $this->im_width         = $w;
63 63
         $this->im_height        = $h;
64 64
     }
65 65
 
66
-    public function set_veriword() {
66
+    public function set_veriword(){
67 67
         /* create session variable for verification,
68 68
            you may change the session variable name */
69 69
         $this->word             = $this->pick_word();
70 70
         $_SESSION['veriword']   = $this->word;
71 71
     }
72 72
 
73
-    public function output_image() {
73
+    public function output_image(){
74 74
         /* output the image as jpeg */
75 75
         $this->draw_image();
76 76
         header("Content-type: image/jpeg");
77 77
         imagejpeg($this->im);
78 78
     }
79 79
 
80
-    public function pick_word() {
80
+    public function pick_word(){
81 81
         global $modx;
82 82
         // set default words
83
-        $words="MODX,Access,Better,BitCode,Chunk,Cache,Desc,Design,Excell,Enjoy,URLs,TechView,Gerald,Griff,Humphrey,Holiday,Intel,Integration,Joystick,Join(),Oscope,Genetic,Light,Likeness,Marit,Maaike,Niche,Netherlands,Ordinance,Oscillo,Parser,Phusion,Query,Question,Regalia,Righteous,Snippet,Sentinel,Template,Thespian,Unity,Enterprise,Verily,Veri,Website,WideWeb,Yap,Yellow,Zebra,Zygote";
83
+        $words = "MODX,Access,Better,BitCode,Chunk,Cache,Desc,Design,Excell,Enjoy,URLs,TechView,Gerald,Griff,Humphrey,Holiday,Intel,Integration,Joystick,Join(),Oscope,Genetic,Light,Likeness,Marit,Maaike,Niche,Netherlands,Ordinance,Oscillo,Parser,Phusion,Query,Question,Regalia,Righteous,Snippet,Sentinel,Template,Thespian,Unity,Enterprise,Verily,Veri,Website,WideWeb,Yap,Yellow,Zebra,Zygote";
84 84
         $words = $modx->config['captcha_words'] ? $modx->config['captcha_words'] : $words;
85 85
         $arr_words = array_filter(array_map('trim', explode(',', $words)));
86 86
 
87 87
         /* pick one randomly for text verification */
88
-        return (string) $arr_words[array_rand($arr_words)].rand(10,999);
88
+        return (string) $arr_words[array_rand($arr_words)].rand(10, 999);
89 89
     }
90 90
 
91
-    public function draw_text() {
91
+    public function draw_text(){
92 92
         $dir = dir($this->dir_font);
93 93
         $fontstmp = array();
94 94
         while (false !== ($file = $dir->read())) {
95
-            if(substr($file, -4) == '.ttf') {
95
+            if (substr($file, -4) == '.ttf') {
96 96
                 $fontstmp[] = $this->dir_font.$file;
97 97
             }
98 98
         }
@@ -100,35 +100,35 @@  discard block
 block discarded – undo
100 100
         $text_font = (string) $fontstmp[array_rand($fontstmp)];
101 101
 
102 102
         /* angle for text inclination */
103
-        $text_angle = rand(-9,9);
103
+        $text_angle = rand(-9, 9);
104 104
         /* initial text size */
105 105
         $text_size  = 30;
106 106
         /* calculate text width and height */
107
-        $box        = imagettfbbox ( $text_size, $text_angle, $text_font, $this->word);
108
-        $text_width = $box[2]-$box[0]; //text width
109
-        $text_height= $box[5]-$box[3]; //text height
107
+        $box        = imagettfbbox($text_size, $text_angle, $text_font, $this->word);
108
+        $text_width = $box[2] - $box[0]; //text width
109
+        $text_height = $box[5] - $box[3]; //text height
110 110
 
111 111
         /* adjust text size */
112
-        $text_size  = round((20 * $this->im_width)/$text_width);
112
+        $text_size  = round((20 * $this->im_width) / $text_width);
113 113
 
114 114
         /* recalculate text width and height */
115
-        $box        = imagettfbbox ( $text_size, $text_angle, $text_font, $this->word);
116
-        $text_width = $box[2]-$box[0]; //text width
117
-        $text_height= $box[5]-$box[3]; //text height
115
+        $box        = imagettfbbox($text_size, $text_angle, $text_font, $this->word);
116
+        $text_width = $box[2] - $box[0]; //text width
117
+        $text_height = $box[5] - $box[3]; //text height
118 118
 
119 119
         /* calculate center position of text */
120
-        $text_x         = ($this->im_width - $text_width)/2;
121
-        $text_y         = ($this->im_height - $text_height)/2;
120
+        $text_x         = ($this->im_width - $text_width) / 2;
121
+        $text_y         = ($this->im_height - $text_height) / 2;
122 122
 
123 123
         /* create canvas for text drawing */
124
-        $im_text        = imagecreate ($this->im_width, $this->im_height);
125
-        $bg_color       = imagecolorallocate ($im_text, 255, 255, 255);
124
+        $im_text        = imagecreate($this->im_width, $this->im_height);
125
+        $bg_color       = imagecolorallocate($im_text, 255, 255, 255);
126 126
 
127 127
         /* pick color for text */
128
-        $text_color     = imagecolorallocate ($im_text, 0, 51, 153);
128
+        $text_color     = imagecolorallocate($im_text, 0, 51, 153);
129 129
 
130 130
         /* draw text into canvas */
131
-        imagettftext    (   $im_text,
131
+        imagettftext($im_text,
132 132
                             $text_size,
133 133
                             $text_angle,
134 134
                             $text_x,
@@ -143,19 +143,19 @@  discard block
 block discarded – undo
143 143
     }
144 144
 
145 145
 
146
-    public function draw_image() {
146
+    public function draw_image(){
147 147
 
148 148
         /* pick one background image randomly from image directory */
149
-        $img_file       = $this->dir_noise."noise".rand(1,4).".jpg";
149
+        $img_file       = $this->dir_noise."noise".rand(1, 4).".jpg";
150 150
 
151 151
         /* create "noise" background image from your image stock*/
152
-        $noise_img      = @imagecreatefromjpeg ($img_file);
152
+        $noise_img      = @imagecreatefromjpeg($img_file);
153 153
         $noise_width    = imagesx($noise_img);
154 154
         $noise_height   = imagesy($noise_img);
155 155
 
156 156
         /* resize the background image to fit the size of image output */
157
-        $this->im       = imagecreatetruecolor($this->im_width,$this->im_height);
158
-        imagecopyresampled ($this->im,
157
+        $this->im       = imagecreatetruecolor($this->im_width, $this->im_height);
158
+        imagecopyresampled($this->im,
159 159
                             $noise_img,
160 160
                             0, 0, 0, 0,
161 161
                             $this->im_width,
@@ -164,17 +164,17 @@  discard block
 block discarded – undo
164 164
                             $noise_height);
165 165
 
166 166
         /* put text image into background image */
167
-        imagecopymerge (    $this->im,
167
+        imagecopymerge($this->im,
168 168
                             $this->draw_text(),
169 169
                             0, 0, 0, 0,
170 170
                             $this->im_width,
171 171
                             $this->im_height,
172
-                            70 );
172
+                            70);
173 173
 
174 174
         return $this->im;
175 175
     }
176 176
 
177
-    public function destroy_image() {
177
+    public function destroy_image(){
178 178
 
179 179
         imagedestroy($this->im);
180 180
 
Please login to merge, or discard this patch.
manager/includes/extenders/dbapi.mysqli.class.inc.php 1 patch
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
         $pre = null,
20 20
         $charset = '',
21 21
         $connection_method = 'SET CHARACTER SET'
22
-    ) {
22
+    ){
23 23
         $this->config['host'] = $host ? $host : $GLOBALS['database_server'];
24 24
         $this->config['dbase'] = $dbase ? $dbase : $GLOBALS['dbase'];
25 25
         $this->config['user'] = $uid ? $uid : $GLOBALS['database_user'];
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
                         $ua = $modx->htmlspecialchars($_SERVER['HTTP_USER_AGENT']);
53 53
                         $referer = $modx->htmlspecialchars($_SERVER['HTTP_REFERER']);
54 54
                         $modx->sendmail(array(
55
-                            'subject' => 'Missing to create the database connection! from ' . $modx->config['site_name'],
55
+                            'subject' => 'Missing to create the database connection! from '.$modx->config['site_name'],
56 56
                             'body'    => "{$logtitle}\n{$request_uri}\n{$ua}\n{$referer}",
57 57
                             'type'    => 'text'
58 58
                         ));
@@ -70,8 +70,8 @@  discard block
 block discarded – undo
70 70
             $tend = $modx->getMicroTime();
71 71
             $totaltime = $tend - $tstart;
72 72
             if ($modx->dumpSQL) {
73
-                $modx->queryCode .= "<fieldset style='text-align:left'><legend>Database connection</legend>" . sprintf("Database connection was created in %2.4f s",
74
-                        $totaltime) . "</fieldset><br />";
73
+                $modx->queryCode .= "<fieldset style='text-align:left'><legend>Database connection</legend>".sprintf("Database connection was created in %2.4f s",
74
+                        $totaltime)."</fieldset><br />";
75 75
             }
76 76
             $this->conn->set_charset($this->config['charset']);
77 77
             $this->isConnected = true;
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
                 case 1091:
139 139
                     break;
140 140
                 default:
141
-                    $modx->messageQuit('Execution of a query to the database failed - ' . $this->getLastError(), $sql);
141
+                    $modx->messageQuit('Execution of a query to the database failed - '.$this->getLastError(), $sql);
142 142
             }
143 143
         } else {
144 144
             $tend = $modx->getMicroTime();
@@ -152,24 +152,24 @@  discard block
 block discarded – undo
152 152
                     $debug_path[] = $line['function'];
153 153
                 }
154 154
                 $debug_path = implode(' > ', array_reverse($debug_path));
155
-                $modx->queryCode .= "<fieldset style='text-align:left'><legend>Query " . ($modx->executedQueries + 1) . " - " . sprintf("%2.2f ms",
156
-                        $totaltime * 1000) . "</legend>";
157
-                $modx->queryCode .= $sql . '<br><br>';
155
+                $modx->queryCode .= "<fieldset style='text-align:left'><legend>Query ".($modx->executedQueries + 1)." - ".sprintf("%2.2f ms",
156
+                        $totaltime * 1000)."</legend>";
157
+                $modx->queryCode .= $sql.'<br><br>';
158 158
                 if ($modx->event->name) {
159
-                    $modx->queryCode .= 'Current Event  => ' . $modx->event->name . '<br>';
159
+                    $modx->queryCode .= 'Current Event  => '.$modx->event->name.'<br>';
160 160
                 }
161 161
                 if ($modx->event->activePlugin) {
162
-                    $modx->queryCode .= 'Current Plugin => ' . $modx->event->activePlugin . '<br>';
162
+                    $modx->queryCode .= 'Current Plugin => '.$modx->event->activePlugin.'<br>';
163 163
                 }
164 164
                 if ($modx->currentSnippet) {
165
-                    $modx->queryCode .= 'Current Snippet => ' . $modx->currentSnippet . '<br>';
165
+                    $modx->queryCode .= 'Current Snippet => '.$modx->currentSnippet.'<br>';
166 166
                 }
167 167
                 if (stripos($sql, 'select') === 0) {
168
-                    $modx->queryCode .= 'Record Count => ' . $this->getRecordCount($result) . '<br>';
168
+                    $modx->queryCode .= 'Record Count => '.$this->getRecordCount($result).'<br>';
169 169
                 } else {
170
-                    $modx->queryCode .= 'Affected Rows => ' . $this->getAffectedRows() . '<br>';
170
+                    $modx->queryCode .= 'Affected Rows => '.$this->getAffectedRows().'<br>';
171 171
                 }
172
-                $modx->queryCode .= 'Functions Path => ' . $debug_path . '<br>';
172
+                $modx->queryCode .= 'Functions Path => '.$debug_path.'<br>';
173 173
                 $modx->queryCode .= "</fieldset><br />";
174 174
             }
175 175
             $modx->executedQueries = $modx->executedQueries + 1;
@@ -252,9 +252,9 @@  discard block
 block discarded – undo
252 252
                     if (is_null($value) || strtolower($value) === 'null') {
253 253
                         $flds = 'NULL';
254 254
                     } else {
255
-                        $flds = "'" . $value . "'";
255
+                        $flds = "'".$value."'";
256 256
                     }
257
-                    $fields[$key] = "`{$key}` = " . $flds;
257
+                    $fields[$key] = "`{$key}` = ".$flds;
258 258
                 }
259 259
                 $fields = implode(",", $fields);
260 260
             }
@@ -278,12 +278,12 @@  discard block
 block discarded – undo
278 278
                 $this->query("INSERT INTO {$intotable} {$fields}");
279 279
             } else {
280 280
                 if (empty($fromtable)) {
281
-                    $fields = "(`" . implode("`, `", array_keys($fields)) . "`) VALUES('" . implode("', '",
282
-                            array_values($fields)) . "')";
281
+                    $fields = "(`".implode("`, `", array_keys($fields))."`) VALUES('".implode("', '",
282
+                            array_values($fields))."')";
283 283
                     $rt = $this->query("INSERT INTO {$intotable} {$fields}");
284 284
                 } else {
285 285
                     $fromtable = $this->replaceFullTableName($fromtable);
286
-                    $fields = "(" . implode(",", array_keys($fields)) . ")";
286
+                    $fields = "(".implode(",", array_keys($fields)).")";
287 287
                     $where = trim($where);
288 288
                     $limit = trim($limit);
289 289
                     if ($where !== '' && stripos($where, 'WHERE') !== 0) {
@@ -348,7 +348,7 @@  discard block
 block discarded – undo
348 348
     public function getInsertId($conn = null)
349 349
     {
350 350
         if (!is_object($conn)) {
351
-            $conn =& $this->conn;
351
+            $conn = & $this->conn;
352 352
         }
353 353
 
354 354
         return $conn->insert_id;
@@ -357,7 +357,7 @@  discard block
 block discarded – undo
357 357
     public function getAffectedRows($conn = null)
358 358
     {
359 359
         if (!is_object($conn)) {
360
-            $conn =& $this->conn;
360
+            $conn = & $this->conn;
361 361
         }
362 362
 
363 363
         return $conn->affected_rows;
@@ -366,7 +366,7 @@  discard block
 block discarded – undo
366 366
     public function getLastError($conn = null)
367 367
     {
368 368
         if (!is_object($conn)) {
369
-            $conn =& $this->conn;
369
+            $conn = & $this->conn;
370 370
         }
371 371
 
372 372
         return $conn->error;
@@ -386,7 +386,7 @@  discard block
 block discarded – undo
386 386
     {
387 387
         $out = false;
388 388
         if (is_object($ds)) {
389
-            switch($mode){
389
+            switch ($mode) {
390 390
                 case 'assoc':
391 391
                     $out = $ds->fetch_assoc();
392 392
                     break;
Please login to merge, or discard this patch.
manager/includes/extenders/maketable.class.php 1 patch
Spacing   +124 added lines, -124 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
  *
9 9
  * @author Jason Coward <[email protected]> (MODX)
10 10
  */
11
-class MakeTable {
11
+class MakeTable{
12 12
 	public $actionField;
13 13
     public $cellAction;
14 14
     public $linkAction;
@@ -33,26 +33,26 @@  discard block
 block discarded – undo
33 33
     public $fieldHeaders;
34 34
     public $extra;
35 35
 
36
-    public function __construct() {
37
-		$this->fieldHeaders= array();
38
-		$this->excludeFields= array();
39
-		$this->actionField= '';
40
-		$this->cellAction= '';
41
-		$this->linkAction= '';
42
-		$this->tableWidth= '';
43
-		$this->tableClass= '';
44
-		$this->rowHeaderClass= '';
45
-		$this->columnHeaderClass= '';
46
-		$this->rowRegularClass= '';
47
-		$this->rowAlternateClass= 'alt';
48
-		$this->formName= 'tableForm';
49
-		$this->formAction= '[~[*id*]~]';
50
-		$this->formElementName= '';
51
-		$this->formElementType= '';
52
-		$this->rowAlternatingScheme= 'EVEN';
53
-		$this->allOption= 0;
54
-		$this->selectedValues= array();
55
-		$this->extra= '';
36
+    public function __construct(){
37
+		$this->fieldHeaders = array();
38
+		$this->excludeFields = array();
39
+		$this->actionField = '';
40
+		$this->cellAction = '';
41
+		$this->linkAction = '';
42
+		$this->tableWidth = '';
43
+		$this->tableClass = '';
44
+		$this->rowHeaderClass = '';
45
+		$this->columnHeaderClass = '';
46
+		$this->rowRegularClass = '';
47
+		$this->rowAlternateClass = 'alt';
48
+		$this->formName = 'tableForm';
49
+		$this->formAction = '[~[*id*]~]';
50
+		$this->formElementName = '';
51
+		$this->formElementType = '';
52
+		$this->rowAlternatingScheme = 'EVEN';
53
+		$this->allOption = 0;
54
+		$this->selectedValues = array();
55
+		$this->extra = '';
56 56
 	}
57 57
 
58 58
 	/**
@@ -60,8 +60,8 @@  discard block
 block discarded – undo
60 60
 	 *
61 61
 	 * @param $value A URL to execute when table cells are clicked.
62 62
 	 */
63
-    public function setCellAction($value) {
64
-		$this->cellAction= $this->prepareLink($value);
63
+    public function setCellAction($value){
64
+		$this->cellAction = $this->prepareLink($value);
65 65
 	}
66 66
 
67 67
 	/**
@@ -69,8 +69,8 @@  discard block
 block discarded – undo
69 69
 	 *
70 70
 	 * @param $value A URL to execute when text within table cells are clicked.
71 71
 	 */
72
-    public function setLinkAction($value) {
73
-		$this->linkAction= $this->prepareLink($value);
72
+    public function setLinkAction($value){
73
+		$this->linkAction = $this->prepareLink($value);
74 74
 	}
75 75
 
76 76
 	/**
@@ -78,8 +78,8 @@  discard block
 block discarded – undo
78 78
 	 *
79 79
 	 * @param $value A valid width attribute for the HTML TABLE tag
80 80
 	 */
81
-    public function setTableWidth($value) {
82
-		$this->tableWidth= $value;
81
+    public function setTableWidth($value){
82
+		$this->tableWidth = $value;
83 83
 	}
84 84
 
85 85
 	/**
@@ -87,8 +87,8 @@  discard block
 block discarded – undo
87 87
 	 *
88 88
 	 * @param $value A class for the main HTML TABLE.
89 89
 	 */
90
-    public function setTableClass($value) {
91
-		$this->tableClass= $value;
90
+    public function setTableClass($value){
91
+		$this->tableClass = $value;
92 92
 	}
93 93
 
94 94
 	/**
@@ -96,8 +96,8 @@  discard block
 block discarded – undo
96 96
 	 *
97 97
 	 * @param $value A class for the main HTML TABLE.
98 98
 	 */
99
-    public function setTableID($value) {
100
-		$this->tableID= $value;
99
+    public function setTableID($value){
100
+		$this->tableID = $value;
101 101
 	}
102 102
 
103 103
 	/**
@@ -105,8 +105,8 @@  discard block
 block discarded – undo
105 105
 	 *
106 106
 	 * @param $value A class for the table header row.
107 107
 	 */
108
-    public function setRowHeaderClass($value) {
109
-		$this->rowHeaderClass= $value;
108
+    public function setRowHeaderClass($value){
109
+		$this->rowHeaderClass = $value;
110 110
 	}
111 111
 
112 112
 		/**
@@ -114,8 +114,8 @@  discard block
 block discarded – undo
114 114
 	 *
115 115
 	 * @param $value A class for the table header row.
116 116
 	 */
117
-    public function setThHeaderClass($value) {
118
-		$this->thClass= $value;
117
+    public function setThHeaderClass($value){
118
+		$this->thClass = $value;
119 119
 	}
120 120
 
121 121
 	/**
@@ -123,8 +123,8 @@  discard block
 block discarded – undo
123 123
 	 *
124 124
 	 * @param $value A class for the column header row.
125 125
 	 */
126
-    public function setColumnHeaderClass($value) {
127
-		$this->columnHeaderClass= $value;
126
+    public function setColumnHeaderClass($value){
127
+		$this->columnHeaderClass = $value;
128 128
 	}
129 129
 
130 130
 	/**
@@ -132,8 +132,8 @@  discard block
 block discarded – undo
132 132
 	 *
133 133
 	 * @param $value A class for regular table rows.
134 134
 	 */
135
-    public function setRowRegularClass($value) {
136
-		$this->rowRegularClass= $value;
135
+    public function setRowRegularClass($value){
136
+		$this->rowRegularClass = $value;
137 137
 	}
138 138
 
139 139
 	/**
@@ -141,8 +141,8 @@  discard block
 block discarded – undo
141 141
 	 *
142 142
 	 * @param $value A class for alternate table rows.
143 143
 	 */
144
-    public function setRowAlternateClass($value) {
145
-		$this->rowAlternateClass= $value;
144
+    public function setRowAlternateClass($value){
145
+		$this->rowAlternateClass = $value;
146 146
 	}
147 147
 
148 148
 	/**
@@ -150,8 +150,8 @@  discard block
 block discarded – undo
150 150
 	 *
151 151
 	 * @param $value Indicates the INPUT form element type attribute.
152 152
 	 */
153
-    public function setFormElementType($value) {
154
-		$this->formElementType= $value;
153
+    public function setFormElementType($value){
154
+		$this->formElementType = $value;
155 155
 	}
156 156
 
157 157
 	/**
@@ -159,8 +159,8 @@  discard block
 block discarded – undo
159 159
 	 *
160 160
 	 * @param $value Indicates the INPUT form element name attribute.
161 161
 	 */
162
-    public function setFormElementName($value) {
163
-		$this->formElementName= $value;
162
+    public function setFormElementName($value){
163
+		$this->formElementName = $value;
164 164
 	}
165 165
 
166 166
 	/**
@@ -169,8 +169,8 @@  discard block
 block discarded – undo
169 169
 	 *
170 170
 	 * @param $value Indicates the FORM name attribute.
171 171
 	 */
172
-    public function setFormName($value) {
173
-		$this->formName= $value;
172
+    public function setFormName($value){
173
+		$this->formName = $value;
174 174
 	}
175 175
 
176 176
 	/**
@@ -178,8 +178,8 @@  discard block
 block discarded – undo
178 178
 	 *
179 179
 	 * @param $value Indicates the FORM action attribute.
180 180
 	 */
181
-    public function setFormAction($value) {
182
-		$this->formAction= $value;
181
+    public function setFormAction($value){
182
+		$this->formAction = $value;
183 183
 	}
184 184
 
185 185
 	/**
@@ -187,8 +187,8 @@  discard block
 block discarded – undo
187 187
 	 *
188 188
 	 * @param $value An Array of field keys to exclude from the table.
189 189
 	 */
190
-    public function setExcludeFields($value) {
191
-		$this->excludeFields= $value;
190
+    public function setExcludeFields($value){
191
+		$this->excludeFields = $value;
192 192
 	}
193 193
 
194 194
 	/**
@@ -196,8 +196,8 @@  discard block
 block discarded – undo
196 196
 	 *
197 197
 	 * @param $value 'ODD' or 'EVEN' to indicate the alternate row scheme.
198 198
 	 */
199
-    public function setRowAlternatingScheme($value) {
200
-		$this->rowAlternatingScheme= $value;
199
+    public function setRowAlternatingScheme($value){
200
+		$this->rowAlternatingScheme = $value;
201 201
 	}
202 202
 
203 203
 	/**
@@ -206,8 +206,8 @@  discard block
 block discarded – undo
206 206
 	 *
207 207
 	 * @param $value The key of the field to add as a query string parameter.
208 208
 	 */
209
-    public function setActionFieldName($value) {
210
-		$this->actionField= $value;
209
+    public function setActionFieldName($value){
210
+		$this->actionField = $value;
211 211
 	}
212 212
 
213 213
 	/**
@@ -216,8 +216,8 @@  discard block
 block discarded – undo
216 216
 	 * @param $value An Array of column widths in the order of the keys in the
217 217
 	 * 			source table array.
218 218
 	 */
219
-    public function setColumnWidths($widthArray) {
220
-		$this->columnWidths= $widthArray;
219
+    public function setColumnWidths($widthArray){
220
+		$this->columnWidths = $widthArray;
221 221
 	}
222 222
 
223 223
 	/**
@@ -225,8 +225,8 @@  discard block
 block discarded – undo
225 225
 	 *
226 226
 	 * @param $value Indicates the INPUT form element type attribute.
227 227
 	 */
228
-    public function setSelectedValues($valueArray) {
229
-		$this->selectedValues= $valueArray;
228
+    public function setSelectedValues($valueArray){
229
+		$this->selectedValues = $valueArray;
230 230
 	}
231 231
 
232 232
 	/**
@@ -235,8 +235,8 @@  discard block
 block discarded – undo
235 235
 	 *
236 236
 	 * @param $value A string of additional content.
237 237
 	 */
238
-    public function setExtra($value) {
239
-		$this->extra= $value;
238
+    public function setExtra($value){
239
+		$this->extra = $value;
240 240
 	}
241 241
 
242 242
 	/**
@@ -244,10 +244,10 @@  discard block
 block discarded – undo
244 244
 	 *
245 245
 	 * @param $columnPosition The index of the column to get the width for.
246 246
 	 */
247
-    public function getColumnWidth($columnPosition) {
248
-		$currentWidth= '';
247
+    public function getColumnWidth($columnPosition){
248
+		$currentWidth = '';
249 249
 		if (is_array($this->columnWidths)) {
250
-			$currentWidth= $this->columnWidths[$columnPosition] ? ' width="'.$this->columnWidths[$columnPosition].'" ' : '';
250
+			$currentWidth = $this->columnWidths[$columnPosition] ? ' width="'.$this->columnWidths[$columnPosition].'" ' : '';
251 251
 		}
252 252
 		return $currentWidth;
253 253
 	}
@@ -257,19 +257,19 @@  discard block
 block discarded – undo
257 257
 	 *
258 258
 	 * @param $value The position of the current row being rendered.
259 259
 	 */
260
-    public function determineRowClass($position) {
260
+    public function determineRowClass($position){
261 261
 		switch ($this->rowAlternatingScheme) {
262 262
 			case 'ODD' :
263
-				$modRemainder= 1;
263
+				$modRemainder = 1;
264 264
 				break;
265 265
 			case 'EVEN' :
266
-				$modRemainder= 0;
266
+				$modRemainder = 0;
267 267
 				break;
268 268
 		}
269 269
 		if ($position % 2 == $modRemainder) {
270
-			$currentClass= $this->rowRegularClass;
270
+			$currentClass = $this->rowRegularClass;
271 271
 		} else {
272
-			$currentClass= $this->rowAlternateClass;
272
+			$currentClass = $this->rowAlternateClass;
273 273
 		}
274 274
 		return ' class="'.$currentClass.'"';
275 275
 	}
@@ -280,9 +280,9 @@  discard block
 block discarded – undo
280 280
 	 *
281 281
 	 * @param $value Indicates the INPUT form element type attribute.
282 282
 	 */
283
-    public function getCellAction($currentActionFieldValue) {
283
+    public function getCellAction($currentActionFieldValue){
284 284
 		if ($this->cellAction) {
285
-			$cellAction= ' onClick="javascript:window.location=\''.$this->cellAction.$this->actionField.'='.urlencode($currentActionFieldValue).'\'" ';
285
+			$cellAction = ' onClick="javascript:window.location=\''.$this->cellAction.$this->actionField.'='.urlencode($currentActionFieldValue).'\'" ';
286 286
 		}
287 287
 		return $cellAction;
288 288
 	}
@@ -293,10 +293,10 @@  discard block
 block discarded – undo
293 293
 	 * @param $currentActionFieldValue The value to be applied to the link action.
294 294
 	 * @param $value The value of the cell.
295 295
 	 */
296
-    public function createCellText($currentActionFieldValue, $value) {
296
+    public function createCellText($currentActionFieldValue, $value){
297 297
 		$cell .= $value;
298 298
 		if ($this->linkAction) {
299
-			$cell= '<a href="'.$this->linkAction.$this->actionField.'='.urlencode($currentActionFieldValue).'">'.$cell.'</a>';
299
+			$cell = '<a href="'.$this->linkAction.$this->actionField.'='.urlencode($currentActionFieldValue).'">'.$cell.'</a>';
300 300
 		}
301 301
 		return $cell;
302 302
 	}
@@ -305,8 +305,8 @@  discard block
 block discarded – undo
305 305
 	 * Sets an option to generate a check all link when checkbox is indicated
306 306
 	 * as the table formElementType.
307 307
 	 */
308
-    public function setAllOption() {
309
-		$this->allOption= 1;
308
+    public function setAllOption(){
309
+		$this->allOption = 1;
310 310
 	}
311 311
 
312 312
 	/**
@@ -314,11 +314,11 @@  discard block
 block discarded – undo
314 314
 	 *
315 315
 	 * @param $value Indicates the INPUT form element type attribute.
316 316
 	 */
317
-    public function prepareLink($link) {
317
+    public function prepareLink($link){
318 318
 		if (strstr($link, '?')) {
319
-			$end= '&';
319
+			$end = '&';
320 320
 		} else {
321
-			$end= '?';
321
+			$end = '?';
322 322
 		}
323 323
 		return $link.$end;
324 324
 	}
@@ -333,20 +333,20 @@  discard block
 block discarded – undo
333 333
 	 * the $fieldsArray where the values represent the alt heading content
334 334
 	 * for each column.
335 335
 	 */
336
-    public function create($fieldsArray, $fieldHeadersArray=array(),$linkpage="") {
336
+    public function create($fieldsArray, $fieldHeadersArray = array(), $linkpage = ""){
337 337
 	    global $_lang;
338 338
 		if (is_array($fieldsArray)) {
339
-			$i= 0;
339
+			$i = 0;
340 340
 			foreach ($fieldsArray as $fieldName => $fieldValue) {
341 341
 				$table .= "\t<tr".$this->determineRowClass($i).">\n";
342
-				$currentActionFieldValue= $fieldValue[$this->actionField];
342
+				$currentActionFieldValue = $fieldValue[$this->actionField];
343 343
 				if (is_array($this->selectedValues)) {
344
-					$isChecked= array_search($currentActionFieldValue, $this->selectedValues)===false? 0 : 1;
344
+					$isChecked = array_search($currentActionFieldValue, $this->selectedValues) === false ? 0 : 1;
345 345
 				} else {
346
-					$isChecked= false;
346
+					$isChecked = false;
347 347
 				}
348 348
 				$table .= $this->addFormField($currentActionFieldValue, $isChecked);
349
-				$colPosition= 0;
349
+				$colPosition = 0;
350 350
 				foreach ($fieldValue as $key => $value) {
351 351
 					if (!in_array($key, $this->excludeFields)) {
352 352
 						$table .= "\t\t<td".$this->getCellAction($currentActionFieldValue).">";
@@ -354,20 +354,20 @@  discard block
 block discarded – undo
354 354
 						$table .= "</td>\n";
355 355
 						if ($i == 0) {
356 356
 							if (empty ($header) && $this->formElementType) {
357
-								$header .= "\t\t<th style=\"width:32px\" ".($this->thClass ? 'class="'.$this->thClass.'"' : '').">". ($this->allOption ? '<a href="javascript:clickAll()">all</a>' : '')."</th>\n";
357
+								$header .= "\t\t<th style=\"width:32px\" ".($this->thClass ? 'class="'.$this->thClass.'"' : '').">".($this->allOption ? '<a href="javascript:clickAll()">all</a>' : '')."</th>\n";
358 358
 							}
359
-							$headerText= array_key_exists($key, $fieldHeadersArray)? $fieldHeadersArray[$key]: $key;
359
+							$headerText = array_key_exists($key, $fieldHeadersArray) ? $fieldHeadersArray[$key] : $key;
360 360
 							$header .= "\t\t<th".$this->getColumnWidth($colPosition).($this->thClass ? ' class="'.$this->thClass.'" ' : '').">".$headerText."</th>\n";
361 361
 						}
362
-						$colPosition ++;
362
+						$colPosition++;
363 363
 					}
364 364
 				}
365
-				$i ++;
365
+				$i++;
366 366
 				$table .= "\t</tr>\n";
367 367
 			}
368
-			$table= "\n".'<table'. ($this->tableWidth ? ' width="'.$this->tableWidth.'"' : ''). ($this->tableClass ? ' class="'.$this->tableClass.'"' : ''). ($this->tableID ? ' id="'.$this->tableID.'"' : '').">\n". ($header ? "\t<thead>\n\t<tr class=\"".$this->rowHeaderClass."\">\n".$header."\t</tr>\n\t</thead>\n" : '').$table."</table>\n";
368
+			$table = "\n".'<table'.($this->tableWidth ? ' width="'.$this->tableWidth.'"' : '').($this->tableClass ? ' class="'.$this->tableClass.'"' : '').($this->tableID ? ' id="'.$this->tableID.'"' : '').">\n".($header ? "\t<thead>\n\t<tr class=\"".$this->rowHeaderClass."\">\n".$header."\t</tr>\n\t</thead>\n" : '').$table."</table>\n";
369 369
 			if ($this->formElementType) {
370
-				$table= "\n".'<form id="'.$this->formName.'" name="'.$this->formName.'" action="'.$this->formAction.'" method="POST">'.$table;
370
+				$table = "\n".'<form id="'.$this->formName.'" name="'.$this->formName.'" action="'.$this->formAction.'" method="POST">'.$table;
371 371
 			}
372 372
 			if (strlen($this->pageNav) > 1) {//changed to display the pagination if exists.
373 373
 				/* commented this part because of cookie
@@ -402,9 +402,9 @@  discard block
 block discarded – undo
402 402
 			}
403 403
 			if ($this->formElementType) {
404 404
 				if ($this->extra) {
405
-					$table.= "\n".$this->extra."\n";
405
+					$table .= "\n".$this->extra."\n";
406 406
 				}
407
-				$table.= "\n".'</form>'."\n";
407
+				$table .= "\n".'</form>'."\n";
408 408
 			}
409 409
 			return $table;
410 410
 		}
@@ -416,36 +416,36 @@  discard block
 block discarded – undo
416 416
 	 * @param $numRecords The number of records to show per page.
417 417
 	 * @param $qs An optional query string to be appended to the paging links
418 418
 	 */
419
-    public function createPagingNavigation($numRecords, $qs='') {
419
+    public function createPagingNavigation($numRecords, $qs = ''){
420 420
 		global $_lang;
421
-		$currentPage= (is_numeric($_GET['page']) ? $_GET['page'] : 1);
422
-		$numPages= ceil($numRecords / MAX_DISPLAY_RECORDS_NUM);
421
+		$currentPage = (is_numeric($_GET['page']) ? $_GET['page'] : 1);
422
+		$numPages = ceil($numRecords / MAX_DISPLAY_RECORDS_NUM);
423 423
 		if ($numPages > 1) {
424
-			$currentURL= empty($qs)? '': '?'.$qs;
424
+			$currentURL = empty($qs) ? '' : '?'.$qs;
425 425
 			if ($currentPage > 6) {
426 426
 				$nav .= $this->createPageLink($currentURL, 1, $_lang["pagination_table_first"]);
427 427
 			}
428 428
 			if ($currentPage != 1) {
429
-				$nav .= $this->createPageLink($currentURL, $currentPage -1, '&lt;&lt;');
429
+				$nav .= $this->createPageLink($currentURL, $currentPage - 1, '&lt;&lt;');
430 430
 			}
431
-			$offset= -4 + ($currentPage < 5 ? (5 - $currentPage) : 0);
432
-			$i= 1;
431
+			$offset = -4 + ($currentPage < 5 ? (5 - $currentPage) : 0);
432
+			$i = 1;
433 433
 			while ($i < 10 && ($currentPage + $offset <= $numPages)) {
434 434
 				if ($currentPage == $currentPage + $offset)
435 435
 					$nav .= $this->createPageLink($currentURL, $currentPage + $offset, $currentPage + $offset, true);
436 436
 				else
437 437
 					$nav .= $this->createPageLink($currentURL, $currentPage + $offset, $currentPage + $offset);
438
-				$i ++;
439
-				$offset ++;
438
+				$i++;
439
+				$offset++;
440 440
 			}
441 441
 			if ($currentPage < $numPages) {
442
-				$nav .= $this->createPageLink($currentURL, $currentPage +1, '&gt;&gt;');
442
+				$nav .= $this->createPageLink($currentURL, $currentPage + 1, '&gt;&gt;');
443 443
 			}
444 444
 			if ($currentPage != $numPages) {
445 445
 				$nav .= $this->createPageLink($currentURL, $numPages, $_lang["pagination_table_last"]);
446 446
 			}
447 447
 		}
448
-		$this->pageNav= ' '.$nav;
448
+		$this->pageNav = ' '.$nav;
449 449
 	}
450 450
 
451 451
 	/**
@@ -457,13 +457,13 @@  discard block
 block discarded – undo
457 457
 	 * @param $currentPage Indicates if the link is to the current page.
458 458
 	 * @param $qs And optional query string to be appended to the link.
459 459
 	 */
460
-    public function createPageLink($link='', $pageNum, $displayText, $currentPage=false, $qs='') {
460
+    public function createPageLink($link = '', $pageNum, $displayText, $currentPage = false, $qs = ''){
461 461
 		global $modx;
462
-		$orderBy= !empty($_GET['orderby'])? '&orderby=' . $_GET['orderby']: '';
463
-		$orderDir= !empty($_GET['orderdir'])? '&orderdir=' . $_GET['orderdir']: '';
464
-		if (!empty($qs)) $qs= "?$qs";
465
-		$link= empty($link)? $modx->makeUrl($modx->documentIdentifier, $modx->documentObject['alias'], $qs . "page=$pageNum$orderBy$orderDir"): $this->prepareLink($link) . "page=$pageNum";
466
-		$nav .= '<li'.($currentPage? ' class="currentPage"': '').'><a'.($currentPage? ' class="currentPage"': '').' href="'.$link.'">'.$displayText.'</a></li>'."\n";
462
+		$orderBy = !empty($_GET['orderby']) ? '&orderby='.$_GET['orderby'] : '';
463
+		$orderDir = !empty($_GET['orderdir']) ? '&orderdir='.$_GET['orderdir'] : '';
464
+		if (!empty($qs)) $qs = "?$qs";
465
+		$link = empty($link) ? $modx->makeUrl($modx->documentIdentifier, $modx->documentObject['alias'], $qs."page=$pageNum$orderBy$orderDir") : $this->prepareLink($link)."page=$pageNum";
466
+		$nav .= '<li'.($currentPage ? ' class="currentPage"' : '').'><a'.($currentPage ? ' class="currentPage"' : '').' href="'.$link.'">'.$displayText.'</a></li>'."\n";
467 467
 		return $nav;
468 468
 	}
469 469
 
@@ -474,10 +474,10 @@  discard block
 block discarded – undo
474 474
 	 * @param $isChecked Indicates if the checked attribute should apply to the
475 475
 	 * element.
476 476
 	 */
477
-    public function addFormField($value, $isChecked) {
477
+    public function addFormField($value, $isChecked){
478 478
 		if ($this->formElementType) {
479
-			$checked= $isChecked? "checked ": "";
480
-			$field= "\t\t".'<td><input type="'.$this->formElementType.'" name="'. ($this->formElementName ? $this->formElementName : $value).'"  value="'.$value.'" '.$checked.'/></td>'."\n";
479
+			$checked = $isChecked ? "checked " : "";
480
+			$field = "\t\t".'<td><input type="'.$this->formElementType.'" name="'.($this->formElementName ? $this->formElementName : $value).'"  value="'.$value.'" '.$checked.'/></td>'."\n";
481 481
 		}
482 482
 		return $field;
483 483
 	}
@@ -486,9 +486,9 @@  discard block
 block discarded – undo
486 486
 	 * Generates the proper LIMIT clause for queries to retrieve paged results in
487 487
 	 * a MakeTable $fieldsArray.
488 488
 	 */
489
-    public function handlePaging() {
490
-		$offset= (is_numeric($_GET['page']) && $_GET['page'] > 0) ? $_GET['page'] - 1 : 0;
491
-		$limitClause= ' LIMIT '. ($offset * MAX_DISPLAY_RECORDS_NUM).', '.MAX_DISPLAY_RECORDS_NUM;
489
+    public function handlePaging(){
490
+		$offset = (is_numeric($_GET['page']) && $_GET['page'] > 0) ? $_GET['page'] - 1 : 0;
491
+		$limitClause = ' LIMIT '.($offset * MAX_DISPLAY_RECORDS_NUM).', '.MAX_DISPLAY_RECORDS_NUM;
492 492
 		return $limitClause;
493 493
 	}
494 494
 
@@ -498,12 +498,12 @@  discard block
 block discarded – undo
498 498
 	 *
499 499
 	 * @param $natural_order If true, the results are returned in natural order.
500 500
 	 */
501
-    public function handleSorting($natural_order=false) {
502
-		$orderByClause= '';
501
+    public function handleSorting($natural_order = false){
502
+		$orderByClause = '';
503 503
 		if (!$natural_order) {
504
-			$orderby= !empty($_GET['orderby'])? $_GET['orderby']: "id";
505
-			$orderdir= !empty($_GET['orderdir'])? $_GET['orderdir']: "DESC";
506
-			$orderbyClause= !empty($orderby)? ' ORDER BY ' . $orderby . ' ' . $orderdir . ' ': "";
504
+			$orderby = !empty($_GET['orderby']) ? $_GET['orderby'] : "id";
505
+			$orderdir = !empty($_GET['orderdir']) ? $_GET['orderdir'] : "DESC";
506
+			$orderbyClause = !empty($orderby) ? ' ORDER BY '.$orderby.' '.$orderdir.' ' : "";
507 507
 		}
508 508
 		return $orderbyClause;
509 509
 	}
@@ -516,15 +516,15 @@  discard block
 block discarded – undo
516 516
 	 * @param $text The text for the link (e.g. table column header).
517 517
 	 * @param $qs An optional query string to append to the order by link.
518 518
 	 */
519
-    public function prepareOrderByLink($key, $text, $qs='') {
519
+    public function prepareOrderByLink($key, $text, $qs = ''){
520 520
 		global $modx;
521 521
 		if (!empty($_GET['orderdir'])) {
522
-			$orderDir= strtolower($_GET['orderdir'])=='desc'? '&orderdir=asc': '&orderdir=desc';
522
+			$orderDir = strtolower($_GET['orderdir']) == 'desc' ? '&orderdir=asc' : '&orderdir=desc';
523 523
 		} else {
524
-			$orderDir= '&orderdir=asc';
524
+			$orderDir = '&orderdir=asc';
525 525
 		}
526 526
 		if (!empty($qs)) {
527
-			if (!strrpos($qs, '&')==strlen($qs)-1) $qs.= '&';
527
+			if (!strrpos($qs, '&') == strlen($qs) - 1) $qs .= '&';
528 528
 		}
529 529
 		return '<a href="[~'.$modx->documentIdentifier.'~]?'.$qs.'orderby='.$key.$orderDir.'">'.$text.'</a>';
530 530
 	}
Please login to merge, or discard this patch.
manager/includes/extenders/modifiers/mdf_moduser.inc.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@
 block discarded – undo
1 1
 <?php
2
-$userid = (int)$value;
2
+$userid = (int) $value;
3 3
 if (!isset($modx->filter->cache['ui'][$userid])) {
4 4
     if ($userid < 0) $user = $modx->getWebUserInfo(abs($userid));
5 5
     else             $user = $modx->getUserInfo($userid);
Please login to merge, or discard this patch.