@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if( ! function_exists('install_sessionCheck')) { |
|
2 | +if (!function_exists('install_sessionCheck')) { |
|
3 | 3 | function install_sessionCheck() |
4 | 4 | { |
5 | 5 | global $_lang; |
@@ -21,8 +21,8 @@ discard block |
||
21 | 21 | </head> |
22 | 22 | <body> |
23 | 23 | <div class="install"> |
24 | - <p>' . $_lang["session_problem"] . '</p> |
|
25 | - <p><a href="./">' . $_lang["session_problem_try_again"] . '</a></p> |
|
24 | + <p>' . $_lang["session_problem"].'</p> |
|
25 | + <p><a href="./">' . $_lang["session_problem_try_again"].'</a></p> |
|
26 | 26 | </div> |
27 | 27 | </body> |
28 | 28 | </html>'; |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | } |
33 | 33 | } |
34 | 34 | |
35 | -if( ! function_exists('parse')) { |
|
35 | +if (!function_exists('parse')) { |
|
36 | 36 | /** |
37 | 37 | * @param string $src |
38 | 38 | * @param array $ph |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | function parse($src, $ph, $left = '[+', $right = '+]') |
44 | 44 | { |
45 | 45 | foreach ($ph as $k => $v) { |
46 | - $k = $left . $k . $right; |
|
46 | + $k = $left.$k.$right; |
|
47 | 47 | $src = str_replace($k, $v, $src); |
48 | 48 | } |
49 | 49 | |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | } |
52 | 52 | } |
53 | 53 | |
54 | -if( ! function_exists('ph')) { |
|
54 | +if (!function_exists('ph')) { |
|
55 | 55 | /** |
56 | 56 | * @return array |
57 | 57 | */ |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | $ph['textdir'] = $modx_textdir ? ' id="rtl"' : ''; |
71 | 71 | $ph['help_link'] = $installmode == 0 ? $_lang['help_link_new'] : $_lang['help_link_upd']; |
72 | 72 | $ph['version'] = $moduleVersion; |
73 | - $ph['release_date'] = ($modx_textdir ? '‏' : '') . $modx_release_date; |
|
73 | + $ph['release_date'] = ($modx_textdir ? '‏' : '').$modx_release_date; |
|
74 | 74 | $ph['footer1'] = $_lang['modx_footer1']; |
75 | 75 | $ph['footer2'] = $_lang['modx_footer2']; |
76 | 76 | $ph['current_year'] = date('Y'); |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | } |
80 | 80 | } |
81 | 81 | |
82 | -if( ! function_exists('get_installmode')) { |
|
82 | +if (!function_exists('get_installmode')) { |
|
83 | 83 | /** |
84 | 84 | * @return int |
85 | 85 | */ |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | } |
142 | 142 | } |
143 | 143 | |
144 | -if( ! function_exists('getLangs')) { |
|
144 | +if (!function_exists('getLangs')) { |
|
145 | 145 | /** |
146 | 146 | * @param string $install_language |
147 | 147 | * @return string |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | } |
156 | 156 | |
157 | 157 | $langs = array(); |
158 | - if ($handle = opendir("../" . MGR_DIR . "/includes/lang")) { |
|
158 | + if ($handle = opendir("../".MGR_DIR."/includes/lang")) { |
|
159 | 159 | while (false !== ($file = readdir($handle))) { |
160 | 160 | if (strpos($file, '.inc.') !== false) { |
161 | 161 | $langs[] = $file; |
@@ -1,7 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | -$installMode = isset($_POST['installmode']) ? (int)$_POST['installmode'] : 0; |
|
2 | +$installMode = isset($_POST['installmode']) ? (int) $_POST['installmode'] : 0; |
|
3 | 3 | |
4 | -if( ! function_exists('getTemplates')) { |
|
4 | +if (!function_exists('getTemplates')) { |
|
5 | 5 | /** |
6 | 6 | * @param array $presets |
7 | 7 | * @return string |
@@ -25,11 +25,11 @@ discard block |
||
25 | 25 | $_[] = parse($tpl, $ph); |
26 | 26 | $i++; |
27 | 27 | } |
28 | - return (0 < count($_)) ? '<h3>[%templates%]</h3>' . implode("\n", $_) : ''; |
|
28 | + return (0 < count($_)) ? '<h3>[%templates%]</h3>'.implode("\n", $_) : ''; |
|
29 | 29 | } |
30 | 30 | } |
31 | 31 | |
32 | -if( ! function_exists('getTVs')) { |
|
32 | +if (!function_exists('getTVs')) { |
|
33 | 33 | /** |
34 | 34 | * @param array $presets |
35 | 35 | * @return string |
@@ -54,11 +54,11 @@ discard block |
||
54 | 54 | $_[] = parse($tpl, $ph); |
55 | 55 | $i++; |
56 | 56 | } |
57 | - return (0 < count($_)) ? '<h3>[%tvs%]</h3>' . implode("\n", $_) : ''; |
|
57 | + return (0 < count($_)) ? '<h3>[%tvs%]</h3>'.implode("\n", $_) : ''; |
|
58 | 58 | } |
59 | 59 | } |
60 | 60 | |
61 | -if( ! function_exists('getChunks')) { |
|
61 | +if (!function_exists('getChunks')) { |
|
62 | 62 | /** |
63 | 63 | * display chunks |
64 | 64 | * |
@@ -84,11 +84,11 @@ discard block |
||
84 | 84 | $_[] = parse($tpl, $ph); |
85 | 85 | $i++; |
86 | 86 | } |
87 | - return (0 < count($_)) ? '<h3>[%chunks%]</h3>' . implode("\n", $_) : ''; |
|
87 | + return (0 < count($_)) ? '<h3>[%chunks%]</h3>'.implode("\n", $_) : ''; |
|
88 | 88 | } |
89 | 89 | } |
90 | 90 | |
91 | -if( ! function_exists('getModules')) { |
|
91 | +if (!function_exists('getModules')) { |
|
92 | 92 | /** |
93 | 93 | * display modules |
94 | 94 | * |
@@ -114,11 +114,11 @@ discard block |
||
114 | 114 | $_[] = parse($tpl, $ph); |
115 | 115 | $i++; |
116 | 116 | } |
117 | - return (0 < count($_)) ? '<h3>[%modules%]</h3>' . implode("\n", $_) : ''; |
|
117 | + return (0 < count($_)) ? '<h3>[%modules%]</h3>'.implode("\n", $_) : ''; |
|
118 | 118 | } |
119 | 119 | } |
120 | 120 | |
121 | -if( ! function_exists('getPlugins')) { |
|
121 | +if (!function_exists('getPlugins')) { |
|
122 | 122 | /** |
123 | 123 | * display plugins |
124 | 124 | * |
@@ -148,11 +148,11 @@ discard block |
||
148 | 148 | $_[] = parse($tpl, $ph); |
149 | 149 | $i++; |
150 | 150 | } |
151 | - return (0 < count($_)) ? '<h3>[%plugins%]</h3>' . implode("\n", $_) : ''; |
|
151 | + return (0 < count($_)) ? '<h3>[%plugins%]</h3>'.implode("\n", $_) : ''; |
|
152 | 152 | } |
153 | 153 | } |
154 | 154 | |
155 | -if( ! function_exists('getSnippets')) { |
|
155 | +if (!function_exists('getSnippets')) { |
|
156 | 156 | /** |
157 | 157 | * display snippets |
158 | 158 | * |
@@ -178,23 +178,23 @@ discard block |
||
178 | 178 | $_[] = parse($tpl, $ph); |
179 | 179 | $i++; |
180 | 180 | } |
181 | - return (0 < count($_)) ? '<h3>[%snippets%]</h3>' . implode("\n", $_) : ''; |
|
181 | + return (0 < count($_)) ? '<h3>[%snippets%]</h3>'.implode("\n", $_) : ''; |
|
182 | 182 | } |
183 | 183 | } |
184 | 184 | |
185 | -switch($installMode){ |
|
185 | +switch ($installMode) { |
|
186 | 186 | case 0: |
187 | 187 | case 2: |
188 | 188 | $database_collation = isset($_POST['database_collation']) ? $_POST['database_collation'] : 'utf8_general_ci'; |
189 | 189 | $database_charset = substr($database_collation, 0, strpos($database_collation, '_')); |
190 | 190 | $_POST['database_connection_charset'] = $database_charset; |
191 | - if(empty($_SESSION['databaseloginpassword'])) |
|
191 | + if (empty($_SESSION['databaseloginpassword'])) |
|
192 | 192 | $_SESSION['databaseloginpassword'] = $_POST['databaseloginpassword']; |
193 | - if(empty($_SESSION['databaseloginname'])) |
|
193 | + if (empty($_SESSION['databaseloginname'])) |
|
194 | 194 | $_SESSION['databaseloginname'] = $_POST['databaseloginname']; |
195 | 195 | break; |
196 | 196 | case 1: |
197 | - include $base_path . MGR_DIR . '/includes/config.inc.php'; |
|
197 | + include $base_path.MGR_DIR.'/includes/config.inc.php'; |
|
198 | 198 | if (@ $conn = mysqli_connect($database_server, $database_user, $database_password)) { |
199 | 199 | if (@ mysqli_query($conn, "USE {$dbase}")) { |
200 | 200 | if (!$rs = mysqli_query($conn, "show session variables like 'collation_database'")) { |
@@ -249,7 +249,7 @@ discard block |
||
249 | 249 | $ph['checked'] = isset ($_POST['installdata']) && $_POST['installdata'] == "1" ? 'checked' : ''; |
250 | 250 | |
251 | 251 | # load setup information file |
252 | -include($base_path . 'install/setup.info.php'); |
|
252 | +include($base_path.'install/setup.info.php'); |
|
253 | 253 | $ph['templates'] = getTemplates($moduleTemplates); |
254 | 254 | $ph['tvs'] = getTVs($moduleTVs); |
255 | 255 | $ph['chunks'] = getChunks($moduleChunks); |
@@ -259,6 +259,6 @@ discard block |
||
259 | 259 | |
260 | 260 | $ph['action'] = ($installMode == 1) ? 'mode' : 'connection'; |
261 | 261 | |
262 | -$tpl = file_get_contents($base_path . 'install/actions/tpl_options.html'); |
|
263 | -$content = parse($tpl,$ph); |
|
264 | -echo parse($content,$_lang,'[%','%]'); |
|
262 | +$tpl = file_get_contents($base_path.'install/actions/tpl_options.html'); |
|
263 | +$content = parse($tpl, $ph); |
|
264 | +echo parse($content, $_lang, '[%', '%]'); |
@@ -1,7 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | if (file_exists(dirname(__FILE__)."/../assets/cache/siteManager.php")) { |
3 | 3 | include_once(dirname(__FILE__)."/../assets/cache/siteManager.php"); |
4 | -}else{ |
|
4 | +} else { |
|
5 | 5 | define('MGR_DIR', 'manager'); |
6 | 6 | } |
7 | 7 | |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | |
29 | 29 | echo "<p>{$_lang['setup_database']}</p>\n"; |
30 | 30 | |
31 | -$installMode= (int)$_POST['installmode']; |
|
31 | +$installMode = (int) $_POST['installmode']; |
|
32 | 32 | $installData = $_POST['installdata'] == "1" ? 1 : 0; |
33 | 33 | |
34 | 34 | //if ($installMode == 1) { |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | $database_charset = substr($database_collation, 0, strpos($database_collation, '_')); |
43 | 43 | $database_connection_charset = $_POST['database_connection_charset']; |
44 | 44 | $database_connection_method = $_POST['database_connection_method']; |
45 | -$dbase = "`" . $_POST['database_name'] . "`"; |
|
45 | +$dbase = "`".$_POST['database_name']."`"; |
|
46 | 46 | $table_prefix = $_POST['tableprefix']; |
47 | 47 | $adminname = $_POST['cmsadmin']; |
48 | 48 | $adminemail = $_POST['cmsadminemail']; |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | |
54 | 54 | // set session name variable |
55 | 55 | if (!isset ($site_sessionname)) { |
56 | - $site_sessionname = 'SN' . uniqid(''); |
|
56 | + $site_sessionname = 'SN'.uniqid(''); |
|
57 | 57 | } |
58 | 58 | |
59 | 59 | // get base path and url |
@@ -67,11 +67,11 @@ discard block |
||
67 | 67 | array_pop($a); |
68 | 68 | $pth = implode("install", $a); |
69 | 69 | unset ($a); |
70 | -$base_url = $url . (substr($url, -1) != "/" ? "/" : ""); |
|
71 | -$base_path = $pth . (substr($pth, -1) != "/" ? "/" : ""); |
|
70 | +$base_url = $url.(substr($url, -1) != "/" ? "/" : ""); |
|
71 | +$base_path = $pth.(substr($pth, -1) != "/" ? "/" : ""); |
|
72 | 72 | |
73 | 73 | // connect to the database |
74 | -echo "<p>". $_lang['setup_database_create_connection']; |
|
74 | +echo "<p>".$_lang['setup_database_create_connection']; |
|
75 | 75 | if (!$conn = mysqli_connect($database_server, $database_user, $database_password)) { |
76 | 76 | echo '<span class="notok">'.$_lang["setup_database_create_connection_failed"]."</span></p><p>".$_lang['setup_database_create_connection_failed_note']."</p>"; |
77 | 77 | return; |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | } |
81 | 81 | |
82 | 82 | // select database |
83 | -echo "<p>".$_lang['setup_database_selection']. str_replace("`", "", $dbase) . "`: "; |
|
83 | +echo "<p>".$_lang['setup_database_selection'].str_replace("`", "", $dbase)."`: "; |
|
84 | 84 | if (!mysqli_select_db($conn, str_replace("`", "", $dbase))) { |
85 | 85 | echo "<span class=\"notok\" style='color:#707070'>".$_lang['setup_database_selection_failed']."</span>".$_lang['setup_database_selection_failed_note']."</p>"; |
86 | 86 | $create = true; |
@@ -92,9 +92,9 @@ discard block |
||
92 | 92 | |
93 | 93 | // try to create the database |
94 | 94 | if ($create) { |
95 | - echo "<p>".$_lang['setup_database_creation']. str_replace("`", "", $dbase) . "`: "; |
|
95 | + echo "<p>".$_lang['setup_database_creation'].str_replace("`", "", $dbase)."`: "; |
|
96 | 96 | // if(!@mysqli_create_db(str_replace("`","",$dbase), $conn)) { |
97 | - if (! mysqli_query($conn, "CREATE DATABASE $dbase DEFAULT CHARACTER SET $database_charset COLLATE $database_collation")) { |
|
97 | + if (!mysqli_query($conn, "CREATE DATABASE $dbase DEFAULT CHARACTER SET $database_charset COLLATE $database_collation")) { |
|
98 | 98 | echo '<span class="notok">'.$_lang['setup_database_creation_failed']."</span>".$_lang['setup_database_creation_failed_note']."</p>"; |
99 | 99 | $errors += 1; |
100 | 100 | ?> |
@@ -113,18 +113,18 @@ discard block |
||
113 | 113 | |
114 | 114 | // check table prefix |
115 | 115 | if ($installMode == 0) { |
116 | - echo "<p>" . $_lang['checking_table_prefix'] . $table_prefix . "`: "; |
|
117 | - if (@ $rs = mysqli_query($conn, "SELECT COUNT(*) FROM $dbase.`" . $table_prefix . "site_content`")) { |
|
118 | - echo '<span class="notok">' . $_lang['failed'] . "</span>" . $_lang['table_prefix_already_inuse'] . "</p>"; |
|
116 | + echo "<p>".$_lang['checking_table_prefix'].$table_prefix."`: "; |
|
117 | + if (@ $rs = mysqli_query($conn, "SELECT COUNT(*) FROM $dbase.`".$table_prefix."site_content`")) { |
|
118 | + echo '<span class="notok">'.$_lang['failed']."</span>".$_lang['table_prefix_already_inuse']."</p>"; |
|
119 | 119 | $errors += 1; |
120 | - echo "<p>" . $_lang['table_prefix_already_inuse_note'] . "</p>"; |
|
120 | + echo "<p>".$_lang['table_prefix_already_inuse_note']."</p>"; |
|
121 | 121 | return; |
122 | 122 | } else { |
123 | 123 | echo '<span class="ok">'.$_lang['ok']."</span></p>"; |
124 | 124 | } |
125 | 125 | } |
126 | 126 | |
127 | -if(!function_exists('parseProperties')) { |
|
127 | +if (!function_exists('parseProperties')) { |
|
128 | 128 | /** |
129 | 129 | * parses a resource property string and returns the result as an array |
130 | 130 | * duplicate of method in documentParser class |
@@ -132,20 +132,20 @@ discard block |
||
132 | 132 | * @param string $propertyString |
133 | 133 | * @return array |
134 | 134 | */ |
135 | - function parseProperties($propertyString) { |
|
136 | - $parameter= array (); |
|
135 | + function parseProperties($propertyString){ |
|
136 | + $parameter = array(); |
|
137 | 137 | if (!empty ($propertyString)) { |
138 | - $tmpParams= explode("&", $propertyString); |
|
138 | + $tmpParams = explode("&", $propertyString); |
|
139 | 139 | $countParams = count($tmpParams); |
140 | - for ($x= 0; $x < $countParams; $x++) { |
|
140 | + for ($x = 0; $x < $countParams; $x++) { |
|
141 | 141 | if (strpos($tmpParams[$x], '=', 0)) { |
142 | - $pTmp= explode("=", $tmpParams[$x]); |
|
143 | - $pvTmp= explode(";", trim($pTmp[1])); |
|
142 | + $pTmp = explode("=", $tmpParams[$x]); |
|
143 | + $pvTmp = explode(";", trim($pTmp[1])); |
|
144 | 144 | if ($pvTmp[1] == 'list' && $pvTmp[3] != "") |
145 | - $parameter[trim($pTmp[0])]= $pvTmp[3]; //list default |
|
145 | + $parameter[trim($pTmp[0])] = $pvTmp[3]; //list default |
|
146 | 146 | else |
147 | 147 | if ($pvTmp[1] != 'list' && $pvTmp[2] != "") |
148 | - $parameter[trim($pTmp[0])]= $pvTmp[2]; |
|
148 | + $parameter[trim($pTmp[0])] = $pvTmp[2]; |
|
149 | 149 | } |
150 | 150 | } |
151 | 151 | } |
@@ -156,20 +156,20 @@ discard block |
||
156 | 156 | // check status of Inherit Parent Template plugin |
157 | 157 | $auto_template_logic = 'parent'; |
158 | 158 | if ($installMode != 0) { |
159 | - $rs = mysqli_query($conn, "SELECT properties, disabled FROM $dbase.`" . $table_prefix . "site_plugins` WHERE name='Inherit Parent Template'"); |
|
159 | + $rs = mysqli_query($conn, "SELECT properties, disabled FROM $dbase.`".$table_prefix."site_plugins` WHERE name='Inherit Parent Template'"); |
|
160 | 160 | $row = mysqli_fetch_row($rs); |
161 | - if(!$row) { |
|
161 | + if (!$row) { |
|
162 | 162 | // not installed |
163 | 163 | $auto_template_logic = 'system'; |
164 | 164 | } else { |
165 | - if($row[1] == 1) { |
|
165 | + if ($row[1] == 1) { |
|
166 | 166 | // installed but disabled |
167 | 167 | $auto_template_logic = 'system'; |
168 | 168 | } else { |
169 | 169 | // installed, enabled .. see how it's configured |
170 | 170 | $properties = parseProperties($row[0]); |
171 | - if(isset($properties['inheritTemplate'])) { |
|
172 | - if($properties['inheritTemplate'] == 'From First Sibling') { |
|
171 | + if (isset($properties['inheritTemplate'])) { |
|
172 | + if ($properties['inheritTemplate'] == 'From First Sibling') { |
|
173 | 173 | $auto_template_logic = 'sibling'; |
174 | 174 | } |
175 | 175 | } |
@@ -193,20 +193,20 @@ discard block |
||
193 | 193 | $sqlParser->connect(); |
194 | 194 | |
195 | 195 | // install/update database |
196 | -echo "<p>" . $_lang['setup_database_creating_tables']; |
|
196 | +echo "<p>".$_lang['setup_database_creating_tables']; |
|
197 | 197 | if ($moduleSQLBaseFile) { |
198 | 198 | $sqlParser->process($moduleSQLBaseFile); |
199 | 199 | // display database results |
200 | 200 | if ($sqlParser->installFailed == true) { |
201 | 201 | $errors += 1; |
202 | - echo "<span class=\"notok\"><b>" . $_lang['database_alerts'] . "</span></p>"; |
|
203 | - echo "<p>" . $_lang['setup_couldnt_install'] . "</p>"; |
|
204 | - echo "<p>" . $_lang['installation_error_occured'] . "<br /><br />"; |
|
202 | + echo "<span class=\"notok\"><b>".$_lang['database_alerts']."</span></p>"; |
|
203 | + echo "<p>".$_lang['setup_couldnt_install']."</p>"; |
|
204 | + echo "<p>".$_lang['installation_error_occured']."<br /><br />"; |
|
205 | 205 | for ($i = 0; $i < count($sqlParser->mysqlErrors); $i++) { |
206 | - echo "<em>" . $sqlParser->mysqlErrors[$i]["error"] . "</em>" . $_lang['during_execution_of_sql'] . "<span class='mono'>" . strip_tags($sqlParser->mysqlErrors[$i]["sql"]) . "</span>.<hr />"; |
|
206 | + echo "<em>".$sqlParser->mysqlErrors[$i]["error"]."</em>".$_lang['during_execution_of_sql']."<span class='mono'>".strip_tags($sqlParser->mysqlErrors[$i]["sql"])."</span>.<hr />"; |
|
207 | 207 | } |
208 | 208 | echo "</p>"; |
209 | - echo "<p>" . $_lang['some_tables_not_updated'] . "</p>"; |
|
209 | + echo "<p>".$_lang['some_tables_not_updated']."</p>"; |
|
210 | 210 | return; |
211 | 211 | } else { |
212 | 212 | echo '<span class="ok">'.$_lang['ok']."</span></p>"; |
@@ -216,12 +216,12 @@ discard block |
||
216 | 216 | // custom or not |
217 | 217 | if (file_exists(dirname(__FILE__)."/../../assets/cache/siteManager.php")) { |
218 | 218 | $mgrdir = 'include_once(dirname(__FILE__)."/../../assets/cache/siteManager.php");'; |
219 | -}else{ |
|
219 | +} else { |
|
220 | 220 | $mgrdir = 'define(\'MGR_DIR\', \'manager\');'; |
221 | 221 | } |
222 | 222 | |
223 | 223 | // write the config.inc.php file if new installation |
224 | -echo "<p>" . $_lang['writing_config_file']; |
|
224 | +echo "<p>".$_lang['writing_config_file']; |
|
225 | 225 | |
226 | 226 | $confph = array(); |
227 | 227 | $confph['database_server'] = $database_server; |
@@ -253,7 +253,7 @@ discard block |
||
253 | 253 | $chmodSuccess = @chmod($filename, 0404); |
254 | 254 | |
255 | 255 | if ($configFileFailed == true) { |
256 | - echo '<span class="notok">' . $_lang['failed'] . "</span></p>"; |
|
256 | + echo '<span class="notok">'.$_lang['failed']."</span></p>"; |
|
257 | 257 | $errors += 1; |
258 | 258 | ?> |
259 | 259 | <p><?php echo $_lang['cant_write_config_file']?><span class="mono"><?php echo MGR_DIR; ?>/includes/config.inc.php</span></p> |
@@ -270,35 +270,35 @@ discard block |
||
270 | 270 | // generate new site_id and set manager theme to default |
271 | 271 | if ($installMode == 0) { |
272 | 272 | $siteid = uniqid(''); |
273 | - mysqli_query($sqlParser->conn, "REPLACE INTO $dbase.`" . $table_prefix . "system_settings` (setting_name,setting_value) VALUES('site_id','$siteid'),('manager_theme','default')"); |
|
273 | + mysqli_query($sqlParser->conn, "REPLACE INTO $dbase.`".$table_prefix."system_settings` (setting_name,setting_value) VALUES('site_id','$siteid'),('manager_theme','default')"); |
|
274 | 274 | } else { |
275 | 275 | // update site_id if missing |
276 | - $ds = mysqli_query($sqlParser->conn, "SELECT setting_name,setting_value FROM $dbase.`" . $table_prefix . "system_settings` WHERE setting_name='site_id'"); |
|
276 | + $ds = mysqli_query($sqlParser->conn, "SELECT setting_name,setting_value FROM $dbase.`".$table_prefix."system_settings` WHERE setting_name='site_id'"); |
|
277 | 277 | if ($ds) { |
278 | 278 | $r = mysqli_fetch_assoc($ds); |
279 | 279 | $siteid = $r['setting_value']; |
280 | 280 | if ($siteid == '' || $siteid = 'MzGeQ2faT4Dw06+U49x3') { |
281 | 281 | $siteid = uniqid(''); |
282 | - mysqli_query($sqlParser->conn, "REPLACE INTO $dbase.`" . $table_prefix . "system_settings` (setting_name,setting_value) VALUES('site_id','$siteid')"); |
|
282 | + mysqli_query($sqlParser->conn, "REPLACE INTO $dbase.`".$table_prefix."system_settings` (setting_name,setting_value) VALUES('site_id','$siteid')"); |
|
283 | 283 | } |
284 | 284 | } |
285 | 285 | } |
286 | 286 | |
287 | 287 | // Reset database for installation of demo-site |
288 | 288 | if ($installData && $moduleSQLDataFile && $moduleSQLResetFile) { |
289 | - echo "<p>" . $_lang['resetting_database']; |
|
289 | + echo "<p>".$_lang['resetting_database']; |
|
290 | 290 | $sqlParser->process($moduleSQLResetFile); |
291 | 291 | // display database results |
292 | 292 | if ($sqlParser->installFailed == true) { |
293 | 293 | $errors += 1; |
294 | - echo "<span class=\"notok\"><b>" . $_lang['database_alerts'] . "</span></p>"; |
|
295 | - echo "<p>" . $_lang['setup_couldnt_install'] . "</p>"; |
|
296 | - echo "<p>" . $_lang['installation_error_occured'] . "<br /><br />"; |
|
294 | + echo "<span class=\"notok\"><b>".$_lang['database_alerts']."</span></p>"; |
|
295 | + echo "<p>".$_lang['setup_couldnt_install']."</p>"; |
|
296 | + echo "<p>".$_lang['installation_error_occured']."<br /><br />"; |
|
297 | 297 | for ($i = 0; $i < count($sqlParser->mysqlErrors); $i++) { |
298 | - echo "<em>" . $sqlParser->mysqlErrors[$i]["error"] . "</em>" . $_lang['during_execution_of_sql'] . "<span class='mono'>" . strip_tags($sqlParser->mysqlErrors[$i]["sql"]) . "</span>.<hr />"; |
|
298 | + echo "<em>".$sqlParser->mysqlErrors[$i]["error"]."</em>".$_lang['during_execution_of_sql']."<span class='mono'>".strip_tags($sqlParser->mysqlErrors[$i]["sql"])."</span>.<hr />"; |
|
299 | 299 | } |
300 | 300 | echo "</p>"; |
301 | - echo "<p>" . $_lang['some_tables_not_updated'] . "</p>"; |
|
301 | + echo "<p>".$_lang['some_tables_not_updated']."</p>"; |
|
302 | 302 | return; |
303 | 303 | } else { |
304 | 304 | echo '<span class="ok">'.$_lang['ok']."</span></p>"; |
@@ -307,11 +307,11 @@ discard block |
||
307 | 307 | |
308 | 308 | // Install Templates |
309 | 309 | if (isset ($_POST['template']) || $installData) { |
310 | - echo "<h3>" . $_lang['templates'] . ":</h3> "; |
|
310 | + echo "<h3>".$_lang['templates'].":</h3> "; |
|
311 | 311 | $selTemplates = $_POST['template']; |
312 | 312 | foreach ($moduleTemplates as $k=>$moduleTemplate) { |
313 | 313 | $installSample = in_array('sample', $moduleTemplate[6]) && $installData == 1; |
314 | - if($installSample || in_array($k, $selTemplates)) { |
|
314 | + if ($installSample || in_array($k, $selTemplates)) { |
|
315 | 315 | $name = mysqli_real_escape_string($conn, $moduleTemplate[0]); |
316 | 316 | $desc = mysqli_real_escape_string($conn, $moduleTemplate[1]); |
317 | 317 | $category = mysqli_real_escape_string($conn, $moduleTemplate[4]); |
@@ -319,7 +319,7 @@ discard block |
||
319 | 319 | $filecontent = $moduleTemplate[3]; |
320 | 320 | $save_sql_id_as = $moduleTemplate[7]; // Nessecary for demo-site |
321 | 321 | if (!file_exists($filecontent)) { |
322 | - echo "<p> $name: <span class=\"notok\">" . $_lang['unable_install_template'] . " '$filecontent' " . $_lang['not_found'] . ".</span></p>"; |
|
322 | + echo "<p> $name: <span class=\"notok\">".$_lang['unable_install_template']." '$filecontent' ".$_lang['not_found'].".</span></p>"; |
|
323 | 323 | } else { |
324 | 324 | // Create the category if it does not already exist |
325 | 325 | $category_id = getCreateDbCategory($category, $sqlParser); |
@@ -329,31 +329,31 @@ discard block |
||
329 | 329 | $template = mysqli_real_escape_string($conn, $template); |
330 | 330 | |
331 | 331 | // See if the template already exists |
332 | - $rs = mysqli_query($sqlParser->conn, "SELECT * FROM $dbase.`" . $table_prefix . "site_templates` WHERE templatename='$name'"); |
|
332 | + $rs = mysqli_query($sqlParser->conn, "SELECT * FROM $dbase.`".$table_prefix."site_templates` WHERE templatename='$name'"); |
|
333 | 333 | |
334 | 334 | if (mysqli_num_rows($rs)) { |
335 | - if (!mysqli_query($sqlParser->conn, "UPDATE $dbase.`" . $table_prefix . "site_templates` SET content='$template', description='$desc', category=$category_id, locked='$locked' WHERE templatename='$name' LIMIT 1;")) { |
|
335 | + if (!mysqli_query($sqlParser->conn, "UPDATE $dbase.`".$table_prefix."site_templates` SET content='$template', description='$desc', category=$category_id, locked='$locked' WHERE templatename='$name' LIMIT 1;")) { |
|
336 | 336 | $errors += 1; |
337 | - echo "<p>" . mysqli_error($sqlParser->conn) . "</p>"; |
|
337 | + echo "<p>".mysqli_error($sqlParser->conn)."</p>"; |
|
338 | 338 | return; |
339 | 339 | } |
340 | - if(!is_null($save_sql_id_as)) { |
|
340 | + if (!is_null($save_sql_id_as)) { |
|
341 | 341 | $sql_id = @mysqli_insert_id($sqlParser->conn); |
342 | - if(!$sql_id) { |
|
343 | - $idQuery = mysqli_fetch_assoc(mysqli_query($sqlParser->conn, "SELECT id FROM $dbase.`" . $table_prefix . "site_templates` WHERE templatename='$name' LIMIT 1;")); |
|
342 | + if (!$sql_id) { |
|
343 | + $idQuery = mysqli_fetch_assoc(mysqli_query($sqlParser->conn, "SELECT id FROM $dbase.`".$table_prefix."site_templates` WHERE templatename='$name' LIMIT 1;")); |
|
344 | 344 | $sql_id = $idQuery['id']; |
345 | 345 | } |
346 | 346 | $custom_placeholders[$save_sql_id_as] = $sql_id; |
347 | 347 | } |
348 | - echo "<p> $name: <span class=\"ok\">" . $_lang['upgraded'] . "</span></p>"; |
|
348 | + echo "<p> $name: <span class=\"ok\">".$_lang['upgraded']."</span></p>"; |
|
349 | 349 | } else { |
350 | - if (!@ mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`" . $table_prefix . "site_templates` (templatename,description,content,category,locked) VALUES('$name','$desc','$template',$category_id,'$locked');")) { |
|
350 | + if (!@ mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`".$table_prefix."site_templates` (templatename,description,content,category,locked) VALUES('$name','$desc','$template',$category_id,'$locked');")) { |
|
351 | 351 | $errors += 1; |
352 | - echo "<p>" . mysqli_error($sqlParser->conn) . "</p>"; |
|
352 | + echo "<p>".mysqli_error($sqlParser->conn)."</p>"; |
|
353 | 353 | return; |
354 | 354 | } |
355 | - if(!is_null($save_sql_id_as)) $custom_placeholders[$save_sql_id_as] = @mysqli_insert_id($sqlParser->conn); |
|
356 | - echo "<p> $name: <span class=\"ok\">" . $_lang['installed'] . "</span></p>"; |
|
355 | + if (!is_null($save_sql_id_as)) $custom_placeholders[$save_sql_id_as] = @mysqli_insert_id($sqlParser->conn); |
|
356 | + echo "<p> $name: <span class=\"ok\">".$_lang['installed']."</span></p>"; |
|
357 | 357 | } |
358 | 358 | } |
359 | 359 | } |
@@ -362,11 +362,11 @@ discard block |
||
362 | 362 | |
363 | 363 | // Install Template Variables |
364 | 364 | if (isset ($_POST['tv']) || $installData) { |
365 | - echo "<h3>" . $_lang['tvs'] . ":</h3> "; |
|
365 | + echo "<h3>".$_lang['tvs'].":</h3> "; |
|
366 | 366 | $selTVs = $_POST['tv']; |
367 | 367 | foreach ($moduleTVs as $k=>$moduleTV) { |
368 | 368 | $installSample = in_array('sample', $moduleTV[12]) && $installData == 1; |
369 | - if($installSample || in_array($k, $selTVs)) { |
|
369 | + if ($installSample || in_array($k, $selTVs)) { |
|
370 | 370 | $name = mysqli_real_escape_string($conn, $moduleTV[0]); |
371 | 371 | $caption = mysqli_real_escape_string($conn, $moduleTV[1]); |
372 | 372 | $desc = mysqli_real_escape_string($conn, $moduleTV[2]); |
@@ -384,25 +384,25 @@ discard block |
||
384 | 384 | // Create the category if it does not already exist |
385 | 385 | $category = getCreateDbCategory($category, $sqlParser); |
386 | 386 | |
387 | - $rs = mysqli_query($sqlParser->conn, "SELECT * FROM $dbase.`" . $table_prefix . "site_tmplvars` WHERE name='$name'"); |
|
387 | + $rs = mysqli_query($sqlParser->conn, "SELECT * FROM $dbase.`".$table_prefix."site_tmplvars` WHERE name='$name'"); |
|
388 | 388 | if (mysqli_num_rows($rs)) { |
389 | 389 | $insert = true; |
390 | - while($row = mysqli_fetch_assoc($rs)) { |
|
391 | - if (!mysqli_query($sqlParser->conn, "UPDATE $dbase.`" . $table_prefix . "site_tmplvars` SET type='$input_type', caption='$caption', description='$desc', category=$category, locked=$locked, elements='$input_options', display='$output_widget', display_params='$output_widget_params', default_text='$input_default' WHERE id={$row['id']};")) { |
|
392 | - echo "<p>" . mysqli_error($sqlParser->conn) . "</p>"; |
|
390 | + while ($row = mysqli_fetch_assoc($rs)) { |
|
391 | + if (!mysqli_query($sqlParser->conn, "UPDATE $dbase.`".$table_prefix."site_tmplvars` SET type='$input_type', caption='$caption', description='$desc', category=$category, locked=$locked, elements='$input_options', display='$output_widget', display_params='$output_widget_params', default_text='$input_default' WHERE id={$row['id']};")) { |
|
392 | + echo "<p>".mysqli_error($sqlParser->conn)."</p>"; |
|
393 | 393 | return; |
394 | 394 | } |
395 | 395 | $insert = false; |
396 | 396 | } |
397 | - echo "<p> $name: <span class=\"ok\">" . $_lang['upgraded'] . "</span></p>"; |
|
397 | + echo "<p> $name: <span class=\"ok\">".$_lang['upgraded']."</span></p>"; |
|
398 | 398 | } else { |
399 | 399 | //$q = "INSERT INTO $dbase.`" . $table_prefix . "site_tmplvars` (type,name,caption,description,category,locked,elements,display,display_params,default_text) VALUES('$input_type','$name','$caption','$desc',(SELECT (CASE COUNT(*) WHEN 0 THEN 0 ELSE `id` END) `id` FROM $dbase.`" . $table_prefix . "categories` WHERE `category` = '$category'),$locked,'$input_options','$output_widget','$output_widget_params','$input_default');"; |
400 | - $q = "INSERT INTO $dbase.`" . $table_prefix . "site_tmplvars` (type,name,caption,description,category,locked,elements,display,display_params,default_text) VALUES('$input_type','$name','$caption','$desc',$category,$locked,'$input_options','$output_widget','$output_widget_params','$input_default');"; |
|
400 | + $q = "INSERT INTO $dbase.`".$table_prefix."site_tmplvars` (type,name,caption,description,category,locked,elements,display,display_params,default_text) VALUES('$input_type','$name','$caption','$desc',$category,$locked,'$input_options','$output_widget','$output_widget_params','$input_default');"; |
|
401 | 401 | if (!mysqli_query($sqlParser->conn, $q)) { |
402 | - echo "<p>" . mysqli_error($sqlParser->conn) . "</p>"; |
|
402 | + echo "<p>".mysqli_error($sqlParser->conn)."</p>"; |
|
403 | 403 | return; |
404 | 404 | } |
405 | - echo "<p> $name: <span class=\"ok\">" . $_lang['installed'] . "</span></p>"; |
|
405 | + echo "<p> $name: <span class=\"ok\">".$_lang['installed']."</span></p>"; |
|
406 | 406 | } |
407 | 407 | |
408 | 408 | // add template assignments |
@@ -411,10 +411,10 @@ discard block |
||
411 | 411 | if (count($assignments) > 0) { |
412 | 412 | |
413 | 413 | // remove existing tv -> template assignments |
414 | - $ds=mysqli_query($sqlParser->conn, "SELECT id FROM $dbase.`".$table_prefix."site_tmplvars` WHERE name='$name' AND description='$desc';"); |
|
414 | + $ds = mysqli_query($sqlParser->conn, "SELECT id FROM $dbase.`".$table_prefix."site_tmplvars` WHERE name='$name' AND description='$desc';"); |
|
415 | 415 | $row = mysqli_fetch_assoc($ds); |
416 | 416 | $id = $row["id"]; |
417 | - mysqli_query($sqlParser->conn, 'DELETE FROM ' . $dbase . '.`' . $table_prefix . 'site_tmplvar_templates` WHERE tmplvarid = \'' . $id . '\''); |
|
417 | + mysqli_query($sqlParser->conn, 'DELETE FROM '.$dbase.'.`'.$table_prefix.'site_tmplvar_templates` WHERE tmplvarid = \''.$id.'\''); |
|
418 | 418 | |
419 | 419 | // add tv -> template assignments |
420 | 420 | foreach ($assignments as $assignment) { |
@@ -423,7 +423,7 @@ discard block |
||
423 | 423 | if ($ds && $ts) { |
424 | 424 | $tRow = mysqli_fetch_assoc($ts); |
425 | 425 | $templateId = $tRow['id']; |
426 | - mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`" . $table_prefix . "site_tmplvar_templates` (tmplvarid, templateid) VALUES($id, $templateId)"); |
|
426 | + mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`".$table_prefix."site_tmplvar_templates` (tmplvarid, templateid) VALUES($id, $templateId)"); |
|
427 | 427 | } |
428 | 428 | } |
429 | 429 | } |
@@ -433,12 +433,12 @@ discard block |
||
433 | 433 | |
434 | 434 | // Install Chunks |
435 | 435 | if (isset ($_POST['chunk']) || $installData) { |
436 | - echo "<h3>" . $_lang['chunks'] . ":</h3> "; |
|
436 | + echo "<h3>".$_lang['chunks'].":</h3> "; |
|
437 | 437 | $selChunks = $_POST['chunk']; |
438 | 438 | foreach ($moduleChunks as $k=>$moduleChunk) { |
439 | 439 | $installSample = in_array('sample', $moduleChunk[5]) && $installData == 1; |
440 | 440 | $count_new_name = 0; |
441 | - if($installSample || in_array($k, $selChunks)) { |
|
441 | + if ($installSample || in_array($k, $selChunks)) { |
|
442 | 442 | |
443 | 443 | $name = mysqli_real_escape_string($conn, $moduleChunk[0]); |
444 | 444 | $desc = mysqli_real_escape_string($conn, $moduleChunk[1]); |
@@ -447,7 +447,7 @@ discard block |
||
447 | 447 | $filecontent = $moduleChunk[2]; |
448 | 448 | |
449 | 449 | if (!file_exists($filecontent)) |
450 | - echo "<p> $name: <span class=\"notok\">" . $_lang['unable_install_chunk'] . " '$filecontent' " . $_lang['not_found'] . ".</span></p>"; |
|
450 | + echo "<p> $name: <span class=\"notok\">".$_lang['unable_install_chunk']." '$filecontent' ".$_lang['not_found'].".</span></p>"; |
|
451 | 451 | else { |
452 | 452 | |
453 | 453 | // Create the category if it does not already exist |
@@ -455,31 +455,31 @@ discard block |
||
455 | 455 | |
456 | 456 | $chunk = preg_replace("/^.*?\/\*\*.*?\*\/\s+/s", '', file_get_contents($filecontent), 1); |
457 | 457 | $chunk = mysqli_real_escape_string($conn, $chunk); |
458 | - $rs = mysqli_query($sqlParser->conn, "SELECT * FROM $dbase.`" . $table_prefix . "site_htmlsnippets` WHERE name='$name'"); |
|
458 | + $rs = mysqli_query($sqlParser->conn, "SELECT * FROM $dbase.`".$table_prefix."site_htmlsnippets` WHERE name='$name'"); |
|
459 | 459 | $count_original_name = mysqli_num_rows($rs); |
460 | - if($overwrite == 'false') { |
|
461 | - $newname = $name . '-' . str_replace('.', '_', $modx_version); |
|
462 | - $rs = mysqli_query($sqlParser->conn, "SELECT * FROM $dbase.`" . $table_prefix . "site_htmlsnippets` WHERE name='$newname'"); |
|
460 | + if ($overwrite == 'false') { |
|
461 | + $newname = $name.'-'.str_replace('.', '_', $modx_version); |
|
462 | + $rs = mysqli_query($sqlParser->conn, "SELECT * FROM $dbase.`".$table_prefix."site_htmlsnippets` WHERE name='$newname'"); |
|
463 | 463 | $count_new_name = mysqli_num_rows($rs); |
464 | 464 | } |
465 | 465 | $update = $count_original_name > 0 && $overwrite == 'true'; |
466 | 466 | if ($update) { |
467 | - if (!mysqli_query($sqlParser->conn, "UPDATE $dbase.`" . $table_prefix . "site_htmlsnippets` SET snippet='$chunk', description='$desc', category=$category_id WHERE name='$name';")) { |
|
467 | + if (!mysqli_query($sqlParser->conn, "UPDATE $dbase.`".$table_prefix."site_htmlsnippets` SET snippet='$chunk', description='$desc', category=$category_id WHERE name='$name';")) { |
|
468 | 468 | $errors += 1; |
469 | - echo "<p>" . mysqli_error($sqlParser->conn) . "</p>"; |
|
469 | + echo "<p>".mysqli_error($sqlParser->conn)."</p>"; |
|
470 | 470 | return; |
471 | 471 | } |
472 | - echo "<p> $name: <span class=\"ok\">" . $_lang['upgraded'] . "</span></p>"; |
|
473 | - } elseif($count_new_name == 0) { |
|
474 | - if($count_original_name > 0 && $overwrite == 'false') { |
|
472 | + echo "<p> $name: <span class=\"ok\">".$_lang['upgraded']."</span></p>"; |
|
473 | + } elseif ($count_new_name == 0) { |
|
474 | + if ($count_original_name > 0 && $overwrite == 'false') { |
|
475 | 475 | $name = $newname; |
476 | 476 | } |
477 | - if (!mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`" . $table_prefix . "site_htmlsnippets` (name,description,snippet,category) VALUES('$name','$desc','$chunk',$category_id);")) { |
|
477 | + if (!mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`".$table_prefix."site_htmlsnippets` (name,description,snippet,category) VALUES('$name','$desc','$chunk',$category_id);")) { |
|
478 | 478 | $errors += 1; |
479 | - echo "<p>" . mysqli_error($sqlParser->conn) . "</p>"; |
|
479 | + echo "<p>".mysqli_error($sqlParser->conn)."</p>"; |
|
480 | 480 | return; |
481 | 481 | } |
482 | - echo "<p> $name: <span class=\"ok\">" . $_lang['installed'] . "</span></p>"; |
|
482 | + echo "<p> $name: <span class=\"ok\">".$_lang['installed']."</span></p>"; |
|
483 | 483 | } |
484 | 484 | } |
485 | 485 | } |
@@ -488,11 +488,11 @@ discard block |
||
488 | 488 | |
489 | 489 | // Install Modules |
490 | 490 | if (isset ($_POST['module']) || $installData) { |
491 | - echo "<h3>" . $_lang['modules'] . ":</h3> "; |
|
491 | + echo "<h3>".$_lang['modules'].":</h3> "; |
|
492 | 492 | $selModules = $_POST['module']; |
493 | 493 | foreach ($moduleModules as $k=>$moduleModule) { |
494 | 494 | $installSample = in_array('sample', $moduleModule[7]) && $installData == 1; |
495 | - if($installSample || in_array($k, $selModules)) { |
|
495 | + if ($installSample || in_array($k, $selModules)) { |
|
496 | 496 | $name = mysqli_real_escape_string($conn, $moduleModule[0]); |
497 | 497 | $desc = mysqli_real_escape_string($conn, $moduleModule[1]); |
498 | 498 | $filecontent = $moduleModule[2]; |
@@ -501,7 +501,7 @@ discard block |
||
501 | 501 | $shared = mysqli_real_escape_string($conn, $moduleModule[5]); |
502 | 502 | $category = mysqli_real_escape_string($conn, $moduleModule[6]); |
503 | 503 | if (!file_exists($filecontent)) |
504 | - echo "<p> $name: <span class=\"notok\">" . $_lang['unable_install_module'] . " '$filecontent' " . $_lang['not_found'] . ".</span></p>"; |
|
504 | + echo "<p> $name: <span class=\"notok\">".$_lang['unable_install_module']." '$filecontent' ".$_lang['not_found'].".</span></p>"; |
|
505 | 505 | else { |
506 | 506 | |
507 | 507 | // Create the category if it does not already exist |
@@ -510,22 +510,22 @@ discard block |
||
510 | 510 | $module = end(preg_split("/(\/\/)?\s*\<\?php/", file_get_contents($filecontent), 2)); |
511 | 511 | // $module = removeDocblock($module, 'module'); // Modules have no fileBinding, keep docblock for info-tab |
512 | 512 | $module = mysqli_real_escape_string($conn, $module); |
513 | - $rs = mysqli_query($sqlParser->conn, "SELECT * FROM $dbase.`" . $table_prefix . "site_modules` WHERE name='$name'"); |
|
513 | + $rs = mysqli_query($sqlParser->conn, "SELECT * FROM $dbase.`".$table_prefix."site_modules` WHERE name='$name'"); |
|
514 | 514 | if (mysqli_num_rows($rs)) { |
515 | 515 | $row = mysqli_fetch_assoc($rs); |
516 | - $props = mysqli_real_escape_string($conn, propUpdate($properties,$row['properties'])); |
|
517 | - if (!mysqli_query($sqlParser->conn, "UPDATE $dbase.`" . $table_prefix . "site_modules` SET modulecode='$module', description='$desc', properties='$props', enable_sharedparams='$shared' WHERE name='$name';")) { |
|
518 | - echo "<p>" . mysqli_error($sqlParser->conn) . "</p>"; |
|
516 | + $props = mysqli_real_escape_string($conn, propUpdate($properties, $row['properties'])); |
|
517 | + if (!mysqli_query($sqlParser->conn, "UPDATE $dbase.`".$table_prefix."site_modules` SET modulecode='$module', description='$desc', properties='$props', enable_sharedparams='$shared' WHERE name='$name';")) { |
|
518 | + echo "<p>".mysqli_error($sqlParser->conn)."</p>"; |
|
519 | 519 | return; |
520 | 520 | } |
521 | - echo "<p> $name: <span class=\"ok\">" . $_lang['upgraded'] . "</span></p>"; |
|
521 | + echo "<p> $name: <span class=\"ok\">".$_lang['upgraded']."</span></p>"; |
|
522 | 522 | } else { |
523 | 523 | $properties = mysqli_real_escape_string($conn, parseProperties($properties, true)); |
524 | - if (!mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`" . $table_prefix . "site_modules` (name,description,modulecode,properties,guid,enable_sharedparams,category) VALUES('$name','$desc','$module','$properties','$guid','$shared', $category);")) { |
|
525 | - echo "<p>" . mysqli_error($sqlParser->conn) . "</p>"; |
|
524 | + if (!mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`".$table_prefix."site_modules` (name,description,modulecode,properties,guid,enable_sharedparams,category) VALUES('$name','$desc','$module','$properties','$guid','$shared', $category);")) { |
|
525 | + echo "<p>".mysqli_error($sqlParser->conn)."</p>"; |
|
526 | 526 | return; |
527 | 527 | } |
528 | - echo "<p> $name: <span class=\"ok\">" . $_lang['installed'] . "</span></p>"; |
|
528 | + echo "<p> $name: <span class=\"ok\">".$_lang['installed']."</span></p>"; |
|
529 | 529 | } |
530 | 530 | } |
531 | 531 | } |
@@ -534,11 +534,11 @@ discard block |
||
534 | 534 | |
535 | 535 | // Install Plugins |
536 | 536 | if (isset ($_POST['plugin']) || $installData) { |
537 | - echo "<h3>" . $_lang['plugins'] . ":</h3> "; |
|
537 | + echo "<h3>".$_lang['plugins'].":</h3> "; |
|
538 | 538 | $selPlugs = $_POST['plugin']; |
539 | 539 | foreach ($modulePlugins as $k=>$modulePlugin) { |
540 | 540 | $installSample = in_array('sample', $modulePlugin[8]) && $installData == 1; |
541 | - if($installSample || in_array($k, $selPlugs)) { |
|
541 | + if ($installSample || in_array($k, $selPlugs)) { |
|
542 | 542 | $name = mysqli_real_escape_string($conn, $modulePlugin[0]); |
543 | 543 | $desc = mysqli_real_escape_string($conn, $modulePlugin[1]); |
544 | 544 | $filecontent = $modulePlugin[2]; |
@@ -548,17 +548,17 @@ discard block |
||
548 | 548 | $category = mysqli_real_escape_string($conn, $modulePlugin[6]); |
549 | 549 | $leg_names = ''; |
550 | 550 | $disabled = $modulePlugin[9]; |
551 | - if(array_key_exists(7, $modulePlugin)) { |
|
551 | + if (array_key_exists(7, $modulePlugin)) { |
|
552 | 552 | // parse comma-separated legacy names and prepare them for sql IN clause |
553 | - $leg_names = "'" . implode("','", preg_split('/\s*,\s*/', mysqli_real_escape_string($conn, $modulePlugin[7]))) . "'"; |
|
553 | + $leg_names = "'".implode("','", preg_split('/\s*,\s*/', mysqli_real_escape_string($conn, $modulePlugin[7])))."'"; |
|
554 | 554 | } |
555 | 555 | if (!file_exists($filecontent)) |
556 | - echo "<p> $name: <span class=\"notok\">" . $_lang['unable_install_plugin'] . " '$filecontent' " . $_lang['not_found'] . ".</span></p>"; |
|
556 | + echo "<p> $name: <span class=\"notok\">".$_lang['unable_install_plugin']." '$filecontent' ".$_lang['not_found'].".</span></p>"; |
|
557 | 557 | else { |
558 | 558 | |
559 | 559 | // disable legacy versions based on legacy_names provided |
560 | - if(!empty($leg_names)) { |
|
561 | - $update_query = "UPDATE $dbase.`" . $table_prefix . "site_plugins` SET disabled='1' WHERE name IN ($leg_names);"; |
|
560 | + if (!empty($leg_names)) { |
|
561 | + $update_query = "UPDATE $dbase.`".$table_prefix."site_plugins` SET disabled='1' WHERE name IN ($leg_names);"; |
|
562 | 562 | $rs = mysqli_query($sqlParser->conn, $update_query); |
563 | 563 | } |
564 | 564 | |
@@ -568,50 +568,50 @@ discard block |
||
568 | 568 | $plugin = end(preg_split("/(\/\/)?\s*\<\?php/", file_get_contents($filecontent), 2)); |
569 | 569 | $plugin = removeDocblock($plugin, 'plugin'); |
570 | 570 | $plugin = mysqli_real_escape_string($conn, $plugin); |
571 | - $rs = mysqli_query($sqlParser->conn, "SELECT * FROM $dbase.`" . $table_prefix . "site_plugins` WHERE name='$name'"); |
|
571 | + $rs = mysqli_query($sqlParser->conn, "SELECT * FROM $dbase.`".$table_prefix."site_plugins` WHERE name='$name'"); |
|
572 | 572 | if (mysqli_num_rows($rs)) { |
573 | 573 | $insert = true; |
574 | - while($row = mysqli_fetch_assoc($rs)) { |
|
575 | - $props = mysqli_real_escape_string($conn, propUpdate($properties,$row['properties'])); |
|
576 | - if($row['description'] == $desc){ |
|
577 | - if (! mysqli_query($sqlParser->conn, "UPDATE $dbase.`" . $table_prefix . "site_plugins` SET plugincode='$plugin', description='$desc', properties='$props' WHERE id={$row['id']};")) { |
|
578 | - echo "<p>" . mysqli_error($sqlParser->conn) . "</p>"; |
|
574 | + while ($row = mysqli_fetch_assoc($rs)) { |
|
575 | + $props = mysqli_real_escape_string($conn, propUpdate($properties, $row['properties'])); |
|
576 | + if ($row['description'] == $desc) { |
|
577 | + if (!mysqli_query($sqlParser->conn, "UPDATE $dbase.`".$table_prefix."site_plugins` SET plugincode='$plugin', description='$desc', properties='$props' WHERE id={$row['id']};")) { |
|
578 | + echo "<p>".mysqli_error($sqlParser->conn)."</p>"; |
|
579 | 579 | return; |
580 | 580 | } |
581 | 581 | $insert = false; |
582 | 582 | } else { |
583 | - if (!mysqli_query($sqlParser->conn, "UPDATE $dbase.`" . $table_prefix . "site_plugins` SET disabled='1' WHERE id={$row['id']};")) { |
|
583 | + if (!mysqli_query($sqlParser->conn, "UPDATE $dbase.`".$table_prefix."site_plugins` SET disabled='1' WHERE id={$row['id']};")) { |
|
584 | 584 | echo "<p>".mysqli_error($sqlParser->conn)."</p>"; |
585 | 585 | return; |
586 | 586 | } |
587 | 587 | } |
588 | 588 | } |
589 | - if($insert === true) { |
|
590 | - $properties = mysqli_real_escape_string($conn, propUpdate($properties,$row['properties'])); |
|
591 | - if(!mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`".$table_prefix."site_plugins` (name,description,plugincode,properties,moduleguid,disabled,category) VALUES('$name','$desc','$plugin','$properties','$guid','0',$category);")) { |
|
589 | + if ($insert === true) { |
|
590 | + $properties = mysqli_real_escape_string($conn, propUpdate($properties, $row['properties'])); |
|
591 | + if (!mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`".$table_prefix."site_plugins` (name,description,plugincode,properties,moduleguid,disabled,category) VALUES('$name','$desc','$plugin','$properties','$guid','0',$category);")) { |
|
592 | 592 | echo "<p>".mysqli_error($sqlParser->conn)."</p>"; |
593 | 593 | return; |
594 | 594 | } |
595 | 595 | } |
596 | - echo "<p> $name: <span class=\"ok\">" . $_lang['upgraded'] . "</span></p>"; |
|
596 | + echo "<p> $name: <span class=\"ok\">".$_lang['upgraded']."</span></p>"; |
|
597 | 597 | } else { |
598 | 598 | $properties = mysqli_real_escape_string($conn, parseProperties($properties, true)); |
599 | - if (!mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`" . $table_prefix . "site_plugins` (name,description,plugincode,properties,moduleguid,category,disabled) VALUES('$name','$desc','$plugin','$properties','$guid',$category,$disabled);")) { |
|
600 | - echo "<p>" . mysqli_error($sqlParser->conn) . "</p>"; |
|
599 | + if (!mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`".$table_prefix."site_plugins` (name,description,plugincode,properties,moduleguid,category,disabled) VALUES('$name','$desc','$plugin','$properties','$guid',$category,$disabled);")) { |
|
600 | + echo "<p>".mysqli_error($sqlParser->conn)."</p>"; |
|
601 | 601 | return; |
602 | 602 | } |
603 | - echo "<p> $name: <span class=\"ok\">" . $_lang['installed'] . "</span></p>"; |
|
603 | + echo "<p> $name: <span class=\"ok\">".$_lang['installed']."</span></p>"; |
|
604 | 604 | } |
605 | 605 | // add system events |
606 | 606 | if (count($events) > 0) { |
607 | - $ds=mysqli_query($sqlParser->conn, "SELECT id FROM $dbase.`".$table_prefix."site_plugins` WHERE name='$name' AND description='$desc';"); |
|
607 | + $ds = mysqli_query($sqlParser->conn, "SELECT id FROM $dbase.`".$table_prefix."site_plugins` WHERE name='$name' AND description='$desc';"); |
|
608 | 608 | if ($ds) { |
609 | 609 | $row = mysqli_fetch_assoc($ds); |
610 | 610 | $id = $row["id"]; |
611 | 611 | // remove existing events |
612 | - mysqli_query($sqlParser->conn, 'DELETE FROM ' . $dbase . '.`' . $table_prefix . 'site_plugin_events` WHERE pluginid = \'' . $id . '\''); |
|
612 | + mysqli_query($sqlParser->conn, 'DELETE FROM '.$dbase.'.`'.$table_prefix.'site_plugin_events` WHERE pluginid = \''.$id.'\''); |
|
613 | 613 | // add new events |
614 | - mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`" . $table_prefix . "site_plugin_events` (pluginid, evtid) SELECT '$id' as 'pluginid',se.id as 'evtid' FROM $dbase.`" . $table_prefix . "system_eventnames` se WHERE name IN ('" . implode("','", $events) . "')"); |
|
614 | + mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`".$table_prefix."site_plugin_events` (pluginid, evtid) SELECT '$id' as 'pluginid',se.id as 'evtid' FROM $dbase.`".$table_prefix."system_eventnames` se WHERE name IN ('".implode("','", $events)."')"); |
|
615 | 615 | } |
616 | 616 | } |
617 | 617 | } |
@@ -621,18 +621,18 @@ discard block |
||
621 | 621 | |
622 | 622 | // Install Snippets |
623 | 623 | if (isset ($_POST['snippet']) || $installData) { |
624 | - echo "<h3>" . $_lang['snippets'] . ":</h3> "; |
|
624 | + echo "<h3>".$_lang['snippets'].":</h3> "; |
|
625 | 625 | $selSnips = $_POST['snippet']; |
626 | 626 | foreach ($moduleSnippets as $k=>$moduleSnippet) { |
627 | 627 | $installSample = in_array('sample', $moduleSnippet[5]) && $installData == 1; |
628 | - if($installSample || in_array($k, $selSnips)) { |
|
628 | + if ($installSample || in_array($k, $selSnips)) { |
|
629 | 629 | $name = mysqli_real_escape_string($conn, $moduleSnippet[0]); |
630 | 630 | $desc = mysqli_real_escape_string($conn, $moduleSnippet[1]); |
631 | 631 | $filecontent = $moduleSnippet[2]; |
632 | 632 | $properties = $moduleSnippet[3]; |
633 | 633 | $category = mysqli_real_escape_string($conn, $moduleSnippet[4]); |
634 | 634 | if (!file_exists($filecontent)) |
635 | - echo "<p> $name: <span class=\"notok\">" . $_lang['unable_install_snippet'] . " '$filecontent' " . $_lang['not_found'] . ".</span></p>"; |
|
635 | + echo "<p> $name: <span class=\"notok\">".$_lang['unable_install_snippet']." '$filecontent' ".$_lang['not_found'].".</span></p>"; |
|
636 | 636 | else { |
637 | 637 | |
638 | 638 | // Create the category if it does not already exist |
@@ -641,22 +641,22 @@ discard block |
||
641 | 641 | $snippet = end(preg_split("/(\/\/)?\s*\<\?php/", file_get_contents($filecontent))); |
642 | 642 | $snippet = removeDocblock($snippet, 'snippet'); |
643 | 643 | $snippet = mysqli_real_escape_string($conn, $snippet); |
644 | - $rs = mysqli_query($sqlParser->conn, "SELECT * FROM $dbase.`" . $table_prefix . "site_snippets` WHERE name='$name'"); |
|
644 | + $rs = mysqli_query($sqlParser->conn, "SELECT * FROM $dbase.`".$table_prefix."site_snippets` WHERE name='$name'"); |
|
645 | 645 | if (mysqli_num_rows($rs)) { |
646 | 646 | $row = mysqli_fetch_assoc($rs); |
647 | - $props = mysqli_real_escape_string($conn, propUpdate($properties,$row['properties'])); |
|
648 | - if (!mysqli_query($sqlParser->conn, "UPDATE $dbase.`" . $table_prefix . "site_snippets` SET snippet='$snippet', description='$desc', properties='$props' WHERE name='$name';")) { |
|
649 | - echo "<p>" . mysqli_error($sqlParser->conn) . "</p>"; |
|
647 | + $props = mysqli_real_escape_string($conn, propUpdate($properties, $row['properties'])); |
|
648 | + if (!mysqli_query($sqlParser->conn, "UPDATE $dbase.`".$table_prefix."site_snippets` SET snippet='$snippet', description='$desc', properties='$props' WHERE name='$name';")) { |
|
649 | + echo "<p>".mysqli_error($sqlParser->conn)."</p>"; |
|
650 | 650 | return; |
651 | 651 | } |
652 | - echo "<p> $name: <span class=\"ok\">" . $_lang['upgraded'] . "</span></p>"; |
|
652 | + echo "<p> $name: <span class=\"ok\">".$_lang['upgraded']."</span></p>"; |
|
653 | 653 | } else { |
654 | 654 | $properties = mysqli_real_escape_string($conn, parseProperties($properties, true)); |
655 | - if (!mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`" . $table_prefix . "site_snippets` (name,description,snippet,properties,category) VALUES('$name','$desc','$snippet','$properties',$category);")) { |
|
656 | - echo "<p>" . mysqli_error($sqlParser->conn) . "</p>"; |
|
655 | + if (!mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`".$table_prefix."site_snippets` (name,description,snippet,properties,category) VALUES('$name','$desc','$snippet','$properties',$category);")) { |
|
656 | + echo "<p>".mysqli_error($sqlParser->conn)."</p>"; |
|
657 | 657 | return; |
658 | 658 | } |
659 | - echo "<p> $name: <span class=\"ok\">" . $_lang['installed'] . "</span></p>"; |
|
659 | + echo "<p> $name: <span class=\"ok\">".$_lang['installed']."</span></p>"; |
|
660 | 660 | } |
661 | 661 | } |
662 | 662 | } |
@@ -665,24 +665,24 @@ discard block |
||
665 | 665 | |
666 | 666 | // Install demo-site |
667 | 667 | if ($installData && $moduleSQLDataFile) { |
668 | - echo "<p>" . $_lang['installing_demo_site']; |
|
668 | + echo "<p>".$_lang['installing_demo_site']; |
|
669 | 669 | $sqlParser->process($moduleSQLDataFile); |
670 | 670 | // display database results |
671 | 671 | if ($sqlParser->installFailed == true) { |
672 | 672 | $errors += 1; |
673 | - echo "<span class=\"notok\"><b>" . $_lang['database_alerts'] . "</span></p>"; |
|
674 | - echo "<p>" . $_lang['setup_couldnt_install'] . "</p>"; |
|
675 | - echo "<p>" . $_lang['installation_error_occured'] . "<br /><br />"; |
|
673 | + echo "<span class=\"notok\"><b>".$_lang['database_alerts']."</span></p>"; |
|
674 | + echo "<p>".$_lang['setup_couldnt_install']."</p>"; |
|
675 | + echo "<p>".$_lang['installation_error_occured']."<br /><br />"; |
|
676 | 676 | for ($i = 0; $i < count($sqlParser->mysqlErrors); $i++) { |
677 | - echo "<em>" . $sqlParser->mysqlErrors[$i]["error"] . "</em>" . $_lang['during_execution_of_sql'] . "<span class='mono'>" . strip_tags($sqlParser->mysqlErrors[$i]["sql"]) . "</span>.<hr />"; |
|
677 | + echo "<em>".$sqlParser->mysqlErrors[$i]["error"]."</em>".$_lang['during_execution_of_sql']."<span class='mono'>".strip_tags($sqlParser->mysqlErrors[$i]["sql"])."</span>.<hr />"; |
|
678 | 678 | } |
679 | 679 | echo "</p>"; |
680 | - echo "<p>" . $_lang['some_tables_not_updated'] . "</p>"; |
|
680 | + echo "<p>".$_lang['some_tables_not_updated']."</p>"; |
|
681 | 681 | return; |
682 | 682 | } else { |
683 | 683 | $sql = sprintf("SELECT id FROM `%ssite_templates` WHERE templatename='EVO startup - Bootstrap'", $sqlParser->prefix); |
684 | 684 | $rs = mysqli_query($sqlParser->conn, $sql); |
685 | - if(mysqli_num_rows($rs)) { |
|
685 | + if (mysqli_num_rows($rs)) { |
|
686 | 686 | $row = mysqli_fetch_assoc($rs); |
687 | 687 | $sql = sprintf('UPDATE `%ssite_content` SET template=%s WHERE template=4', $sqlParser->prefix, $row['id']); |
688 | 688 | mysqli_query($sqlParser->conn, $sql); |
@@ -693,9 +693,9 @@ discard block |
||
693 | 693 | |
694 | 694 | // Install Dependencies |
695 | 695 | foreach ($moduleDependencies as $dependency) { |
696 | - $ds = mysqli_query($sqlParser->conn, 'SELECT id, guid FROM ' . $dbase . '`' . $sqlParser->prefix . 'site_modules` WHERE name="' . $dependency['module'] . '"'); |
|
696 | + $ds = mysqli_query($sqlParser->conn, 'SELECT id, guid FROM '.$dbase.'`'.$sqlParser->prefix.'site_modules` WHERE name="'.$dependency['module'].'"'); |
|
697 | 697 | if (!$ds) { |
698 | - echo "<p>" . mysqli_error($sqlParser->conn) . "</p>"; |
|
698 | + echo "<p>".mysqli_error($sqlParser->conn)."</p>"; |
|
699 | 699 | return; |
700 | 700 | } else { |
701 | 701 | $row = mysqli_fetch_assoc($ds); |
@@ -703,37 +703,37 @@ discard block |
||
703 | 703 | $moduleGuid = $row["guid"]; |
704 | 704 | } |
705 | 705 | // get extra id |
706 | - $ds = mysqli_query($sqlParser->conn, 'SELECT id FROM ' . $dbase . '`' . $sqlParser->prefix . 'site_' . $dependency['table'] . '` WHERE ' . $dependency['column'] . '="' . $dependency['name'] . '"'); |
|
706 | + $ds = mysqli_query($sqlParser->conn, 'SELECT id FROM '.$dbase.'`'.$sqlParser->prefix.'site_'.$dependency['table'].'` WHERE '.$dependency['column'].'="'.$dependency['name'].'"'); |
|
707 | 707 | if (!$ds) { |
708 | - echo "<p>" . mysqli_error($sqlParser->conn) . "</p>"; |
|
708 | + echo "<p>".mysqli_error($sqlParser->conn)."</p>"; |
|
709 | 709 | return; |
710 | 710 | } else { |
711 | 711 | $row = mysqli_fetch_assoc($ds); |
712 | 712 | $extraId = $row["id"]; |
713 | 713 | } |
714 | 714 | // setup extra as module dependency |
715 | - $ds = mysqli_query($sqlParser->conn, 'SELECT module FROM ' . $dbase . '`' . $sqlParser->prefix . 'site_module_depobj` WHERE module=' . $moduleId . ' AND resource=' . $extraId . ' AND type=' . $dependency['type'] . ' LIMIT 1'); |
|
715 | + $ds = mysqli_query($sqlParser->conn, 'SELECT module FROM '.$dbase.'`'.$sqlParser->prefix.'site_module_depobj` WHERE module='.$moduleId.' AND resource='.$extraId.' AND type='.$dependency['type'].' LIMIT 1'); |
|
716 | 716 | if (!$ds) { |
717 | - echo "<p>" . mysqli_error($sqlParser->conn) . "</p>"; |
|
717 | + echo "<p>".mysqli_error($sqlParser->conn)."</p>"; |
|
718 | 718 | return; |
719 | 719 | } else { |
720 | 720 | if (mysqli_num_rows($ds) === 0) { |
721 | - mysqli_query($sqlParser->conn, 'INSERT INTO ' . $dbase . '`' . $sqlParser->prefix . 'site_module_depobj` (module, resource, type) VALUES(' . $moduleId . ',' . $extraId . ',' . $dependency['type'] . ')'); |
|
722 | - echo '<p> ' . $dependency['module'] . ' Module: <span class="ok">' . $_lang['depedency_create'] . '</span></p>'; |
|
721 | + mysqli_query($sqlParser->conn, 'INSERT INTO '.$dbase.'`'.$sqlParser->prefix.'site_module_depobj` (module, resource, type) VALUES('.$moduleId.','.$extraId.','.$dependency['type'].')'); |
|
722 | + echo '<p> '.$dependency['module'].' Module: <span class="ok">'.$_lang['depedency_create'].'</span></p>'; |
|
723 | 723 | } else { |
724 | - mysqli_query($sqlParser->conn, 'UPDATE ' . $dbase . '`' . $sqlParser->prefix . 'site_module_depobj` SET module = ' . $moduleId . ', resource = ' . $extraId . ', type = ' . $dependency['type'] . ' WHERE module=' . $moduleId . ' AND resource=' . $extraId . ' AND type=' . $dependency['type']); |
|
725 | - echo '<p> ' . $dependency['module'] . ' Module: <span class="ok">' . $_lang['depedency_update'] . '</span></p>'; |
|
724 | + mysqli_query($sqlParser->conn, 'UPDATE '.$dbase.'`'.$sqlParser->prefix.'site_module_depobj` SET module = '.$moduleId.', resource = '.$extraId.', type = '.$dependency['type'].' WHERE module='.$moduleId.' AND resource='.$extraId.' AND type='.$dependency['type']); |
|
725 | + echo '<p> '.$dependency['module'].' Module: <span class="ok">'.$_lang['depedency_update'].'</span></p>'; |
|
726 | 726 | } |
727 | 727 | if ($dependency['type'] == 30 || $dependency['type'] == 40) { |
728 | 728 | // set extra guid for plugins and snippets |
729 | - $ds = mysqli_query($sqlParser->conn, 'SELECT id FROM ' . $dbase . '`' . $sqlParser->prefix . 'site_' . $dependency['table'] . '` WHERE id=' . $extraId . ' LIMIT 1'); |
|
729 | + $ds = mysqli_query($sqlParser->conn, 'SELECT id FROM '.$dbase.'`'.$sqlParser->prefix.'site_'.$dependency['table'].'` WHERE id='.$extraId.' LIMIT 1'); |
|
730 | 730 | if (!$ds) { |
731 | - echo "<p>" . mysqli_error($sqlParser->conn) . "</p>"; |
|
731 | + echo "<p>".mysqli_error($sqlParser->conn)."</p>"; |
|
732 | 732 | return; |
733 | 733 | } else { |
734 | 734 | if (mysqli_num_rows($ds) != 0) { |
735 | - mysqli_query($sqlParser->conn, 'UPDATE ' . $dbase . '`' . $sqlParser->prefix . 'site_' . $dependency['table'] . '` SET moduleguid = ' . $moduleGuid . ' WHERE id=' . $extraId); |
|
736 | - echo '<p> ' . $dependency['name'] . ': <span class="ok">' . $_lang['guid_set'] . '</span></p>'; |
|
735 | + mysqli_query($sqlParser->conn, 'UPDATE '.$dbase.'`'.$sqlParser->prefix.'site_'.$dependency['table'].'` SET moduleguid = '.$moduleGuid.' WHERE id='.$extraId); |
|
736 | + echo '<p> '.$dependency['name'].': <span class="ok">'.$_lang['guid_set'].'</span></p>'; |
|
737 | 737 | } |
738 | 738 | } |
739 | 739 | } |
@@ -742,7 +742,7 @@ discard block |
||
742 | 742 | |
743 | 743 | // call back function |
744 | 744 | if ($callBackFnc != "") |
745 | - $callBackFnc ($sqlParser); |
|
745 | + $callBackFnc($sqlParser); |
|
746 | 746 | |
747 | 747 | // Setup the MODX API -- needed for the cache processor |
748 | 748 | define('MODX_API_MODE', true); |
@@ -777,12 +777,12 @@ discard block |
||
777 | 777 | } |
778 | 778 | |
779 | 779 | // setup completed! |
780 | -echo "<p><b>" . $_lang['installation_successful'] . "</b></p>"; |
|
781 | -echo "<p>" . $_lang['to_log_into_content_manager'] . "</p>"; |
|
780 | +echo "<p><b>".$_lang['installation_successful']."</b></p>"; |
|
781 | +echo "<p>".$_lang['to_log_into_content_manager']."</p>"; |
|
782 | 782 | if ($installMode == 0) { |
783 | - echo "<p><img src=\"img/ico_info.png\" width=\"40\" height=\"42\" align=\"left\" style=\"margin-right:10px;\" />" . $_lang['installation_note'] . "</p>"; |
|
783 | + echo "<p><img src=\"img/ico_info.png\" width=\"40\" height=\"42\" align=\"left\" style=\"margin-right:10px;\" />".$_lang['installation_note']."</p>"; |
|
784 | 784 | } else { |
785 | - echo "<p><img src=\"img/ico_info.png\" width=\"40\" height=\"42\" align=\"left\" style=\"margin-right:10px;\" />" . $_lang['upgrade_note'] . "</p>"; |
|
785 | + echo "<p><img src=\"img/ico_info.png\" width=\"40\" height=\"42\" align=\"left\" style=\"margin-right:10px;\" />".$_lang['upgrade_note']."</p>"; |
|
786 | 786 | } |
787 | 787 | |
788 | 788 | /** |
@@ -792,11 +792,11 @@ discard block |
||
792 | 792 | * @param string $old |
793 | 793 | * @return string |
794 | 794 | */ |
795 | -function propUpdate($new,$old){ |
|
795 | +function propUpdate($new, $old){ |
|
796 | 796 | $newArr = parseProperties($new); |
797 | 797 | $oldArr = parseProperties($old); |
798 | - foreach ($oldArr as $k => $v){ |
|
799 | - if (isset($v['0']['options'])){ |
|
798 | + foreach ($oldArr as $k => $v) { |
|
799 | + if (isset($v['0']['options'])) { |
|
800 | 800 | $oldArr[$k]['0']['options'] = $newArr[$k]['0']['options']; |
801 | 801 | } |
802 | 802 | } |
@@ -811,30 +811,30 @@ discard block |
||
811 | 811 | * @param bool|mixed $json |
812 | 812 | * @return string |
813 | 813 | */ |
814 | -function parseProperties($propertyString, $json=false) { |
|
815 | - $propertyString = str_replace('{}', '', $propertyString ); |
|
816 | - $propertyString = str_replace('} {', ',', $propertyString ); |
|
814 | +function parseProperties($propertyString, $json = false){ |
|
815 | + $propertyString = str_replace('{}', '', $propertyString); |
|
816 | + $propertyString = str_replace('} {', ',', $propertyString); |
|
817 | 817 | |
818 | - if(empty($propertyString)) return array(); |
|
819 | - if($propertyString=='{}' || $propertyString=='[]') return array(); |
|
818 | + if (empty($propertyString)) return array(); |
|
819 | + if ($propertyString == '{}' || $propertyString == '[]') return array(); |
|
820 | 820 | |
821 | 821 | $jsonFormat = isJson($propertyString, true); |
822 | 822 | $property = array(); |
823 | 823 | // old format |
824 | - if ( $jsonFormat === false) { |
|
825 | - $props= explode('&', $propertyString); |
|
824 | + if ($jsonFormat === false) { |
|
825 | + $props = explode('&', $propertyString); |
|
826 | 826 | foreach ($props as $prop) { |
827 | 827 | $prop = trim($prop); |
828 | - if($prop === '') { |
|
828 | + if ($prop === '') { |
|
829 | 829 | continue; |
830 | 830 | } |
831 | 831 | |
832 | 832 | $arr = explode(';', $prop); |
833 | - if( ! is_array($arr)) { |
|
833 | + if (!is_array($arr)) { |
|
834 | 834 | $arr = array(); |
835 | 835 | } |
836 | 836 | $key = explode('=', isset($arr[0]) ? $arr[0] : ''); |
837 | - if( ! is_array($key) || empty($key[0])) { |
|
837 | + if (!is_array($key) || empty($key[0])) { |
|
838 | 838 | continue; |
839 | 839 | } |
840 | 840 | |
@@ -858,7 +858,7 @@ discard block |
||
858 | 858 | |
859 | 859 | } |
860 | 860 | // new json-format |
861 | - } else if(!empty($jsonFormat)){ |
|
861 | + } else if (!empty($jsonFormat)) { |
|
862 | 862 | $property = $jsonFormat; |
863 | 863 | } |
864 | 864 | if ($json) { |
@@ -873,7 +873,7 @@ discard block |
||
873 | 873 | * @param bool $returnData |
874 | 874 | * @return bool|mixed |
875 | 875 | */ |
876 | -function isJson($string, $returnData=false) { |
|
876 | +function isJson($string, $returnData = false){ |
|
877 | 877 | $data = json_decode($string, true); |
878 | 878 | return (json_last_error() == JSON_ERROR_NONE) ? ($returnData ? $data : true) : false; |
879 | 879 | } |
@@ -883,20 +883,20 @@ discard block |
||
883 | 883 | * @param SqlParser $sqlParser |
884 | 884 | * @return int |
885 | 885 | */ |
886 | -function getCreateDbCategory($category, $sqlParser) { |
|
886 | +function getCreateDbCategory($category, $sqlParser){ |
|
887 | 887 | $dbase = $sqlParser->dbname; |
888 | - $dbase = '`' . trim($dbase,'`') . '`'; |
|
888 | + $dbase = '`'.trim($dbase, '`').'`'; |
|
889 | 889 | $table_prefix = $sqlParser->prefix; |
890 | 890 | $category_id = 0; |
891 | - if(!empty($category)) { |
|
891 | + if (!empty($category)) { |
|
892 | 892 | $category = mysqli_real_escape_string($sqlParser->conn, $category); |
893 | 893 | $rs = mysqli_query($sqlParser->conn, "SELECT id FROM $dbase.`".$table_prefix."categories` WHERE category = '".$category."'"); |
894 | - if(mysqli_num_rows($rs) && ($row = mysqli_fetch_assoc($rs))) { |
|
894 | + if (mysqli_num_rows($rs) && ($row = mysqli_fetch_assoc($rs))) { |
|
895 | 895 | $category_id = $row['id']; |
896 | 896 | } else { |
897 | 897 | $q = "INSERT INTO $dbase.`".$table_prefix."categories` (`category`) VALUES ('{$category}');"; |
898 | 898 | $rs = mysqli_query($sqlParser->conn, $q); |
899 | - if($rs) { |
|
899 | + if ($rs) { |
|
900 | 900 | $category_id = mysqli_insert_id($sqlParser->conn); |
901 | 901 | } |
902 | 902 | } |
@@ -911,12 +911,12 @@ discard block |
||
911 | 911 | * @param string $type |
912 | 912 | * @return string |
913 | 913 | */ |
914 | -function removeDocblock($code, $type) { |
|
914 | +function removeDocblock($code, $type){ |
|
915 | 915 | |
916 | 916 | $cleaned = preg_replace("/^.*?\/\*\*.*?\*\/\s+/s", '', $code, 1); |
917 | 917 | |
918 | 918 | // Procedure taken from plugin.filesource.php |
919 | - switch($type) { |
|
919 | + switch ($type) { |
|
920 | 920 | case 'snippet': |
921 | 921 | $elm_name = 'snippets'; |
922 | 922 | $include = 'return require'; |
@@ -932,7 +932,7 @@ discard block |
||
932 | 932 | default: |
933 | 933 | return $cleaned; |
934 | 934 | }; |
935 | - if(substr(trim($cleaned),0,$count) == $include.' MODX_BASE_PATH.\'assets/'.$elm_name.'/') |
|
935 | + if (substr(trim($cleaned), 0, $count) == $include.' MODX_BASE_PATH.\'assets/'.$elm_name.'/') |
|
936 | 936 | return $cleaned; |
937 | 937 | |
938 | 938 | // fileBinding not found - return code incl docblock |
@@ -1,5 +1,5 @@ discard block |
||
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 | header("X-XSS-Protection: 0"); |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | } |
47 | 47 | |
48 | 48 | if (isset($_COOKIE['MODX_themeColor'])) { |
49 | - $body_class .= ' ' . $_COOKIE['MODX_themeColor']; |
|
49 | + $body_class .= ' '.$_COOKIE['MODX_themeColor']; |
|
50 | 50 | } |
51 | 51 | |
52 | 52 | if (isset($modx->pluginCache['ElementsInTree'])) { |
@@ -74,36 +74,36 @@ discard block |
||
74 | 74 | $user['which_browser'] = $modx->config['which_browser']; |
75 | 75 | } |
76 | 76 | |
77 | -$css = 'media/style/' . $modx->config['manager_theme'] . '/css/page.css?v=' . $lastInstallTime; |
|
77 | +$css = 'media/style/'.$modx->config['manager_theme'].'/css/page.css?v='.$lastInstallTime; |
|
78 | 78 | |
79 | 79 | if ($modx->config['manager_theme'] == 'default') { |
80 | - if (!file_exists(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/styles.min.css') && is_writable(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css')) { |
|
81 | - require_once MODX_BASE_PATH . 'assets/lib/Formatter/CSSMinify.php'; |
|
80 | + if (!file_exists(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/css/styles.min.css') && is_writable(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/css')) { |
|
81 | + require_once MODX_BASE_PATH.'assets/lib/Formatter/CSSMinify.php'; |
|
82 | 82 | $minifier = new Formatter\CSSMinify(); |
83 | - $minifier->addFile(MODX_MANAGER_PATH . 'media/style/common/bootstrap/css/bootstrap.min.css'); |
|
84 | - $minifier->addFile(MODX_MANAGER_PATH . 'media/style/common/font-awesome/css/font-awesome.min.css'); |
|
85 | - $minifier->addFile(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/fonts.css'); |
|
86 | - $minifier->addFile(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/forms.css'); |
|
87 | - $minifier->addFile(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/mainmenu.css'); |
|
88 | - $minifier->addFile(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/tree.css'); |
|
89 | - $minifier->addFile(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/custom.css'); |
|
90 | - $minifier->addFile(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/tabpane.css'); |
|
91 | - $minifier->addFile(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/contextmenu.css'); |
|
92 | - $minifier->addFile(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/index.css'); |
|
93 | - $minifier->addFile(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/main.css'); |
|
83 | + $minifier->addFile(MODX_MANAGER_PATH.'media/style/common/bootstrap/css/bootstrap.min.css'); |
|
84 | + $minifier->addFile(MODX_MANAGER_PATH.'media/style/common/font-awesome/css/font-awesome.min.css'); |
|
85 | + $minifier->addFile(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/css/fonts.css'); |
|
86 | + $minifier->addFile(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/css/forms.css'); |
|
87 | + $minifier->addFile(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/css/mainmenu.css'); |
|
88 | + $minifier->addFile(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/css/tree.css'); |
|
89 | + $minifier->addFile(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/css/custom.css'); |
|
90 | + $minifier->addFile(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/css/tabpane.css'); |
|
91 | + $minifier->addFile(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/css/contextmenu.css'); |
|
92 | + $minifier->addFile(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/css/index.css'); |
|
93 | + $minifier->addFile(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/css/main.css'); |
|
94 | 94 | $css = $minifier->minify(); |
95 | - file_put_contents(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/styles.min.css', $css); |
|
95 | + file_put_contents(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/css/styles.min.css', $css); |
|
96 | 96 | } |
97 | - if (file_exists(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/styles.min.css')) { |
|
98 | - $css = 'media/style/' . $modx->config['manager_theme'] . '/css/styles.min.css?v=' . $lastInstallTime; |
|
97 | + if (file_exists(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/css/styles.min.css')) { |
|
98 | + $css = 'media/style/'.$modx->config['manager_theme'].'/css/styles.min.css?v='.$lastInstallTime; |
|
99 | 99 | } |
100 | 100 | } |
101 | 101 | |
102 | -$modx->config['global_tabs'] = (int)($modx->config['global_tabs'] && ($user['role'] == 1 || $modx->hasPermission('edit_template') || $modx->hasPermission('edit_chunk') || $modx->hasPermission('edit_snippet') || $modx->hasPermission('edit_plugin'))); |
|
102 | +$modx->config['global_tabs'] = (int) ($modx->config['global_tabs'] && ($user['role'] == 1 || $modx->hasPermission('edit_template') || $modx->hasPermission('edit_chunk') || $modx->hasPermission('edit_snippet') || $modx->hasPermission('edit_plugin'))); |
|
103 | 103 | |
104 | 104 | ?> |
105 | 105 | <!DOCTYPE html> |
106 | -<html <?= (isset($modx_textdir) && $modx_textdir ? 'dir="rtl" lang="' : 'lang="') . $mxla . '" xml:lang="' . $mxla . '"' ?>> |
|
106 | +<html <?= (isset($modx_textdir) && $modx_textdir ? 'dir="rtl" lang="' : 'lang="').$mxla.'" xml:lang="'.$mxla.'"' ?>> |
|
107 | 107 | <head> |
108 | 108 | <title><?= $site_name ?>- (EVO CMS Manager)</title> |
109 | 109 | <meta http-equiv="Content-Type" content="text/html; charset=<?= $modx_manager_charset ?>" /> |
@@ -134,20 +134,20 @@ discard block |
||
134 | 134 | MODX_SITE_URL: '<?= MODX_SITE_URL ?>', |
135 | 135 | MODX_MANAGER_URL: '<?= MODX_MANAGER_URL ?>', |
136 | 136 | user: { |
137 | - role: <?= (int)$user['role'] ?>, |
|
137 | + role: <?= (int) $user['role'] ?>, |
|
138 | 138 | username: '<?= $user['username'] ?>' |
139 | 139 | }, |
140 | 140 | config: { |
141 | 141 | mail_check_timeperiod: <?= $modx->config['mail_check_timeperiod'] ?>, |
142 | - menu_height: <?= (int)$menu_height ?>, |
|
143 | - tree_width: <?= (int)$tree_width ?>, |
|
144 | - tree_min_width: <?= (int)$tree_min_width ?>, |
|
145 | - session_timeout: <?= (int)$modx->config['session_timeout'] ?>, |
|
146 | - site_start: <?= (int)$modx->config['site_start'] ?>, |
|
147 | - tree_page_click: <?=(!empty($modx->config['tree_page_click']) ? (int)$modx->config['tree_page_click'] : 27) ?>, |
|
142 | + menu_height: <?= (int) $menu_height ?>, |
|
143 | + tree_width: <?= (int) $tree_width ?>, |
|
144 | + tree_min_width: <?= (int) $tree_min_width ?>, |
|
145 | + session_timeout: <?= (int) $modx->config['session_timeout'] ?>, |
|
146 | + site_start: <?= (int) $modx->config['site_start'] ?>, |
|
147 | + tree_page_click: <?=(!empty($modx->config['tree_page_click']) ? (int) $modx->config['tree_page_click'] : 27) ?>, |
|
148 | 148 | theme: '<?= $modx->config['manager_theme'] ?>', |
149 | 149 | which_browser: '<?= $user['which_browser'] ?>', |
150 | - layout: <?= (int)$manager_layout ?>, |
|
150 | + layout: <?= (int) $manager_layout ?>, |
|
151 | 151 | textdir: '<?= $modx_textdir ?>', |
152 | 152 | global_tabs: <?= $modx->config['global_tabs'] ?> |
153 | 153 | |
@@ -232,11 +232,11 @@ discard block |
||
232 | 232 | delete a[b]; |
233 | 233 | }, |
234 | 234 | openedArray: [], |
235 | - lockedElementsTranslation: <?= json_encode($unlockTranslations, JSON_FORCE_OBJECT | JSON_UNESCAPED_UNICODE) . "\n" ?> |
|
235 | + lockedElementsTranslation: <?= json_encode($unlockTranslations, JSON_FORCE_OBJECT | JSON_UNESCAPED_UNICODE)."\n" ?> |
|
236 | 236 | }; |
237 | 237 | <?php |
238 | 238 | $opened = array_filter(array_map('intval', explode('|', $_SESSION['openedArray']))); |
239 | - echo (empty($opened) ? '' : 'modx.openedArray[' . implode("] = 1;\n modx.openedArray[", $opened) . '] = 1;') . "\n"; |
|
239 | + echo (empty($opened) ? '' : 'modx.openedArray['.implode("] = 1;\n modx.openedArray[", $opened).'] = 1;')."\n"; |
|
240 | 240 | ?> |
241 | 241 | </script> |
242 | 242 | <script src="media/style/<?= $modx->config['manager_theme'] ?>/js/modx.min.js?v=<?= $lastInstallTime ?>"></script> |
@@ -365,7 +365,7 @@ discard block |
||
365 | 365 | <a href="javascript:;" class="dropdown-toggle" onclick="return false;"> |
366 | 366 | <span class="username"><?= $user['username'] ?></span> |
367 | 367 | <?php if ($user['photo']) { ?> |
368 | - <span class="icon photo" style="background-image: url(<?= MODX_SITE_URL . $user['photo'] ?>);"></span> |
|
368 | + <span class="icon photo" style="background-image: url(<?= MODX_SITE_URL.$user['photo'] ?>);"></span> |
|
369 | 369 | <?php } else { ?> |
370 | 370 | <span class="icon"><?= $_style['menu_user'] ?></span> |
371 | 371 | <?php } ?> |
@@ -392,7 +392,7 @@ discard block |
||
392 | 392 | $version = 'Evolution'; |
393 | 393 | ?> |
394 | 394 | <?php |
395 | - echo sprintf('<li><span class="dropdown-item" title="%s – %s" %s>' . $version . ' %s</span></li>', $site_name, $modx->getVersionData('full_appname'), $style, $modx->config['settings_version']); |
|
395 | + echo sprintf('<li><span class="dropdown-item" title="%s – %s" %s>'.$version.' %s</span></li>', $site_name, $modx->getVersionData('full_appname'), $style, $modx->config['settings_version']); |
|
396 | 396 | ?> |
397 | 397 | </ul> |
398 | 398 | </li> |
@@ -526,7 +526,7 @@ discard block |
||
526 | 526 | */ |
527 | 527 | function constructLink($action, $img, $text, $allowed) |
528 | 528 | { |
529 | - if ((bool)$allowed) { |
|
529 | + if ((bool) $allowed) { |
|
530 | 530 | echo sprintf('<div class="menuLink" id="item%s" onclick="modx.tree.menuHandler(%s);">', $action, $action); |
531 | 531 | echo sprintf('<i class="%s"></i> %s</div>', $img, $text); |
532 | 532 | } |
@@ -537,7 +537,7 @@ discard block |
||
537 | 537 | <script type="text/javascript"> |
538 | 538 | |
539 | 539 | if (document.getElementById('treeMenu')) { |
540 | - <?php if($modx->hasPermission('edit_template') || $modx->hasPermission('edit_snippet') || $modx->hasPermission('edit_chunk') || $modx->hasPermission('edit_plugin')) { ?> |
|
540 | + <?php if ($modx->hasPermission('edit_template') || $modx->hasPermission('edit_snippet') || $modx->hasPermission('edit_chunk') || $modx->hasPermission('edit_plugin')) { ?> |
|
541 | 541 | |
542 | 542 | document.getElementById('treeMenu_openelements').onclick = function(e) { |
543 | 543 | e.preventDefault(); |
@@ -555,12 +555,12 @@ discard block |
||
555 | 555 | } |
556 | 556 | }; |
557 | 557 | <?php } ?> |
558 | - <?php if($use_browser && $modx->hasPermission('assets_images')) { ?> |
|
558 | + <?php if ($use_browser && $modx->hasPermission('assets_images')) { ?> |
|
559 | 559 | |
560 | 560 | document.getElementById('treeMenu_openimages').onclick = function(e) { |
561 | 561 | e.preventDefault(); |
562 | 562 | if (modx.config.global_tabs && !e.shiftKey) { |
563 | - modx.tabs({url: '<?= MODX_MANAGER_URL . 'media/browser/' . $which_browser . '/browse.php?filemanager=media/browser/' . $which_browser . '/browse.php&type=images' ?>', title: '<?= $_lang["images_management"] ?>'}); |
|
563 | + modx.tabs({url: '<?= MODX_MANAGER_URL.'media/browser/'.$which_browser.'/browse.php?filemanager=media/browser/'.$which_browser.'/browse.php&type=images' ?>', title: '<?= $_lang["images_management"] ?>'}); |
|
564 | 564 | } else { |
565 | 565 | var randomNum = '<?= $_lang["files_files"] ?>'; |
566 | 566 | if (e.shiftKey) { |
@@ -573,12 +573,12 @@ discard block |
||
573 | 573 | } |
574 | 574 | }; |
575 | 575 | <?php } ?> |
576 | - <?php if($use_browser && $modx->hasPermission('assets_files')) { ?> |
|
576 | + <?php if ($use_browser && $modx->hasPermission('assets_files')) { ?> |
|
577 | 577 | |
578 | 578 | document.getElementById('treeMenu_openfiles').onclick = function(e) { |
579 | 579 | e.preventDefault(); |
580 | 580 | if (modx.config.global_tabs && !e.shiftKey) { |
581 | - modx.tabs({url: '<?= MODX_MANAGER_URL . 'media/browser/' . $which_browser . '/browse.php?filemanager=media/browser/' . $which_browser . '/browse.php&type=files' ?>', title: '<?= $_lang["files_files"] ?>'}); |
|
581 | + modx.tabs({url: '<?= MODX_MANAGER_URL.'media/browser/'.$which_browser.'/browse.php?filemanager=media/browser/'.$which_browser.'/browse.php&type=files' ?>', title: '<?= $_lang["files_files"] ?>'}); |
|
582 | 582 | } else { |
583 | 583 | var randomNum = '<?= $_lang["files_files"] ?>'; |
584 | 584 | if (e.shiftKey) { |
@@ -632,7 +632,7 @@ discard block |
||
632 | 632 | |
633 | 633 | </div> |
634 | 634 | <?php if ($modx->config['show_picker'] != "0") { |
635 | - include('media/style/' . $modx->config['manager_theme'] . '/color.switcher.php'); |
|
635 | + include('media/style/'.$modx->config['manager_theme'].'/color.switcher.php'); |
|
636 | 636 | } ?> |
637 | 637 | </body> |
638 | 638 | </html> |
@@ -1,5 +1,5 @@ discard block |
||
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 | |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | * @param string $hereid |
12 | 12 | * @return string |
13 | 13 | */ |
14 | -function makeHTML($indent, $parent, $expandAll, $theme, $hereid = '') { |
|
14 | +function makeHTML($indent, $parent, $expandAll, $theme, $hereid = ''){ |
|
15 | 15 | global $modx; |
16 | 16 | global $icons, $iconsPrivate, $_style; |
17 | 17 | global $_lang, $opened, $opened2, $closed2; //added global vars |
@@ -22,35 +22,35 @@ discard block |
||
22 | 22 | // setup spacer |
23 | 23 | $level = 0; |
24 | 24 | $spacer = '<span class="indent">'; |
25 | - for($i = 2; $i <= $indent; $i++) { |
|
25 | + for ($i = 2; $i <= $indent; $i++) { |
|
26 | 26 | $spacer .= '<i></i>'; |
27 | 27 | $level++; |
28 | 28 | } |
29 | 29 | $spacer .= '</span>'; |
30 | 30 | |
31 | 31 | // manage order-by |
32 | - if(!isset($_SESSION['tree_sortby']) && !isset($_SESSION['tree_sortdir'])) { |
|
32 | + if (!isset($_SESSION['tree_sortby']) && !isset($_SESSION['tree_sortdir'])) { |
|
33 | 33 | // This is the first startup, set default sort order |
34 | 34 | $_SESSION['tree_sortby'] = 'menuindex'; |
35 | 35 | $_SESSION['tree_sortdir'] = 'ASC'; |
36 | 36 | } |
37 | 37 | |
38 | - switch($_SESSION['tree_sortby']) { |
|
38 | + switch ($_SESSION['tree_sortby']) { |
|
39 | 39 | case 'createdon': |
40 | 40 | case 'editedon': |
41 | 41 | case 'publishedon': |
42 | 42 | case 'pub_date': |
43 | 43 | case 'unpub_date': |
44 | - $sortby = sprintf('CASE WHEN %s IS NULL THEN 1 ELSE 0 END, %s', 'sc.' . $_SESSION['tree_sortby'], 'sc.' . $_SESSION['tree_sortby']); |
|
44 | + $sortby = sprintf('CASE WHEN %s IS NULL THEN 1 ELSE 0 END, %s', 'sc.'.$_SESSION['tree_sortby'], 'sc.'.$_SESSION['tree_sortby']); |
|
45 | 45 | break; |
46 | 46 | default: |
47 | - $sortby = 'sc.' . $_SESSION['tree_sortby']; |
|
47 | + $sortby = 'sc.'.$_SESSION['tree_sortby']; |
|
48 | 48 | }; |
49 | 49 | |
50 | - $orderby = $modx->db->escape($sortby . ' ' . $_SESSION['tree_sortdir']); |
|
50 | + $orderby = $modx->db->escape($sortby.' '.$_SESSION['tree_sortdir']); |
|
51 | 51 | |
52 | 52 | // Folder sorting gets special setup ;) Add menuindex and pagetitle |
53 | - if($_SESSION['tree_sortby'] == 'isfolder') { |
|
53 | + if ($_SESSION['tree_sortby'] == 'isfolder') { |
|
54 | 54 | $orderby .= ', menuindex ASC, pagetitle'; |
55 | 55 | } |
56 | 56 | |
@@ -60,12 +60,12 @@ discard block |
||
60 | 60 | // get document groups for current user |
61 | 61 | $docgrp = (isset($_SESSION['mgrDocgroups']) && is_array($_SESSION['mgrDocgroups'])) ? implode(',', $_SESSION['mgrDocgroups']) : ''; |
62 | 62 | $showProtected = false; |
63 | - if(isset ($modx->config['tree_show_protected'])) { |
|
63 | + if (isset ($modx->config['tree_show_protected'])) { |
|
64 | 64 | $showProtected = (boolean) $modx->config['tree_show_protected']; |
65 | 65 | } |
66 | 66 | $mgrRole = (isset ($_SESSION['mgrRole']) && (string) $_SESSION['mgrRole'] === '1') ? '1' : '0'; |
67 | - if($showProtected == false) { |
|
68 | - $access = "AND (1={$mgrRole} OR sc.privatemgr=0" . (!$docgrp ? ')' : " OR dg.document_group IN ({$docgrp}))"); |
|
67 | + if ($showProtected == false) { |
|
68 | + $access = "AND (1={$mgrRole} OR sc.privatemgr=0".(!$docgrp ? ')' : " OR dg.document_group IN ({$docgrp}))"); |
|
69 | 69 | } else { |
70 | 70 | $access = ''; |
71 | 71 | } |
@@ -75,13 +75,13 @@ discard block |
||
75 | 75 | $from = "{$tblsc} AS sc LEFT JOIN {$tbldg} dg on dg.document = sc.id LEFT JOIN {$tblst} st on st.id = sc.template"; |
76 | 76 | $where = "(parent={$parent}) {$access} GROUP BY sc.id"; |
77 | 77 | $result = $modx->db->select($field, $from, $where, $orderby); |
78 | - if($modx->db->getRecordCount($result) == 0) { |
|
78 | + if ($modx->db->getRecordCount($result) == 0) { |
|
79 | 79 | $output .= sprintf('<div><a class="empty">%s%s <span class="empty">%s</span></a></div>', $spacer, $_style['tree_deletedpage'], $_lang['empty_folder']); |
80 | 80 | } |
81 | 81 | |
82 | 82 | $nodeNameSource = $_SESSION['tree_nodename'] == 'default' ? $modx->config['resource_tree_node_name'] : $_SESSION['tree_nodename']; |
83 | 83 | |
84 | - while($row = $modx->db->getRow($result)) { |
|
84 | + while ($row = $modx->db->getRow($result)) { |
|
85 | 85 | $node = ''; |
86 | 86 | |
87 | 87 | $nodetitle = getNodeTitle($nodeNameSource, $row); |
@@ -90,46 +90,46 @@ discard block |
||
90 | 90 | $treeNodeClass = 'node'; |
91 | 91 | $treeNodeClass .= $row['hasAccess'] == 0 ? ' protected' : ''; |
92 | 92 | |
93 | - if($row['deleted'] == 1) { |
|
93 | + if ($row['deleted'] == 1) { |
|
94 | 94 | $treeNodeClass .= ' deleted'; |
95 | 95 | //$nodetitleDisplay = sprintf('<span class="deletedNode">%s</span>', $nodetitle); |
96 | - } elseif($row['published'] == 0) { |
|
96 | + } elseif ($row['published'] == 0) { |
|
97 | 97 | $treeNodeClass .= ' unpublished'; |
98 | 98 | //$nodetitleDisplay = sprintf('<span class="unpublishedNode">%s</span>', $nodetitle); |
99 | - } elseif($row['hidemenu'] == 1) { |
|
99 | + } elseif ($row['hidemenu'] == 1) { |
|
100 | 100 | $treeNodeClass .= ' hidemenu'; |
101 | 101 | //$nodetitleDisplay = sprintf('<span class="notInMenuNode%s">%s</span>', $protectedClass, $nodetitle); |
102 | 102 | } else { |
103 | 103 | //$nodetitleDisplay = sprintf('<span class="publishedNode%s">%s</span>', $protectedClass, $nodetitle); |
104 | 104 | } |
105 | 105 | |
106 | - if($row['id'] == $hereid) { |
|
106 | + if ($row['id'] == $hereid) { |
|
107 | 107 | $treeNodeClass .= ' current'; |
108 | 108 | } |
109 | 109 | |
110 | 110 | $weblinkDisplay = $row['type'] == 'reference' ? sprintf(' %s', $_style['tree_linkgo']) : ''; |
111 | - $pageIdDisplay = '<small>(' . ($modx_textdir ? '‏' : '') . $row['id'] . ')</small>'; |
|
111 | + $pageIdDisplay = '<small>('.($modx_textdir ? '‏' : '').$row['id'].')</small>'; |
|
112 | 112 | |
113 | 113 | // Prepare displaying user-locks |
114 | 114 | $lockedByUser = ''; |
115 | 115 | $rowLock = $modx->elementIsLocked(7, $row['id'], true); |
116 | - if($rowLock && $modx->hasPermission('display_locks')) { |
|
117 | - if($rowLock['sid'] == $modx->sid) { |
|
116 | + if ($rowLock && $modx->hasPermission('display_locks')) { |
|
117 | + if ($rowLock['sid'] == $modx->sid) { |
|
118 | 118 | $title = $modx->parseText($_lang["lock_element_editing"], array( |
119 | 119 | 'element_type' => $_lang["lock_element_type_7"], |
120 | 120 | 'lasthit_df' => $rowLock['lasthit_df'] |
121 | 121 | )); |
122 | - $lockedByUser = '<span title="' . $title . '" class="editResource">' . $_style['tree_preview_resource'] . '</span>'; |
|
122 | + $lockedByUser = '<span title="'.$title.'" class="editResource">'.$_style['tree_preview_resource'].'</span>'; |
|
123 | 123 | } else { |
124 | 124 | $title = $modx->parseText($_lang["lock_element_locked_by"], array( |
125 | 125 | 'element_type' => $_lang["lock_element_type_7"], |
126 | 126 | 'username' => $rowLock['username'], |
127 | 127 | 'lasthit_df' => $rowLock['lasthit_df'] |
128 | 128 | )); |
129 | - if($modx->hasPermission('remove_locks')) { |
|
130 | - $lockedByUser = '<span onclick="modx.tree.unlockElement(7, ' . $row['id'] . ', this);return false;" title="' . $title . '" class="lockedResource">' . $_style['icons_secured'] . '</span>'; |
|
129 | + if ($modx->hasPermission('remove_locks')) { |
|
130 | + $lockedByUser = '<span onclick="modx.tree.unlockElement(7, '.$row['id'].', this);return false;" title="'.$title.'" class="lockedResource">'.$_style['icons_secured'].'</span>'; |
|
131 | 131 | } else { |
132 | - $lockedByUser = '<span title="' . $title . '" class="lockedResource">' . $_style['icons_secured'] . '</span>'; |
|
132 | + $lockedByUser = '<span title="'.$title.'" class="lockedResource">'.$_style['icons_secured'].'</span>'; |
|
133 | 133 | } |
134 | 134 | } |
135 | 135 | } |
@@ -137,23 +137,23 @@ discard block |
||
137 | 137 | $url = $modx->makeUrl($row['id']); |
138 | 138 | |
139 | 139 | $title = ''; |
140 | - if(isDateNode($nodeNameSource)) { |
|
141 | - $title = $_lang['pagetitle'] . ': ' . $row['pagetitle'] . '[+lf+]'; |
|
140 | + if (isDateNode($nodeNameSource)) { |
|
141 | + $title = $_lang['pagetitle'].': '.$row['pagetitle'].'[+lf+]'; |
|
142 | 142 | } |
143 | - $title .= $_lang['id'] . ': ' . $row['id']; |
|
144 | - $title .= '[+lf+]' . $_lang['resource_opt_menu_title'] . ': ' . $row['menutitle']; |
|
145 | - $title .= '[+lf+]' . $_lang['resource_opt_menu_index'] . ': ' . $row['menuindex']; |
|
146 | - $title .= '[+lf+]' . $_lang['alias'] . ': ' . (!empty($row['alias']) ? $row['alias'] : '-'); |
|
147 | - $title .= '[+lf+]' . $_lang['template'] . ': ' . $row['templatename']; |
|
148 | - $title .= '[+lf+]' . $_lang['publish_date'] . ': ' . $modx->toDateFormat($row['pub_date']); |
|
149 | - $title .= '[+lf+]' . $_lang['unpublish_date'] . ': ' . $modx->toDateFormat($row['unpub_date']); |
|
150 | - $title .= '[+lf+]' . $_lang['page_data_web_access'] . ': ' . ($row['privateweb'] ? $_lang['private'] : $_lang['public']); |
|
151 | - $title .= '[+lf+]' . $_lang['page_data_mgr_access'] . ': ' . ($row['privatemgr'] ? $_lang['private'] : $_lang['public']); |
|
152 | - $title .= '[+lf+]' . $_lang['resource_opt_richtext'] . ': ' . ($row['richtext'] == 0 ? $_lang['no'] : $_lang['yes']); |
|
153 | - $title .= '[+lf+]' . $_lang['page_data_searchable'] . ': ' . ($row['searchable'] == 0 ? $_lang['no'] : $_lang['yes']); |
|
154 | - $title .= '[+lf+]' . $_lang['page_data_cacheable'] . ': ' . ($row['cacheable'] == 0 ? $_lang['no'] : $_lang['yes']); |
|
143 | + $title .= $_lang['id'].': '.$row['id']; |
|
144 | + $title .= '[+lf+]'.$_lang['resource_opt_menu_title'].': '.$row['menutitle']; |
|
145 | + $title .= '[+lf+]'.$_lang['resource_opt_menu_index'].': '.$row['menuindex']; |
|
146 | + $title .= '[+lf+]'.$_lang['alias'].': '.(!empty($row['alias']) ? $row['alias'] : '-'); |
|
147 | + $title .= '[+lf+]'.$_lang['template'].': '.$row['templatename']; |
|
148 | + $title .= '[+lf+]'.$_lang['publish_date'].': '.$modx->toDateFormat($row['pub_date']); |
|
149 | + $title .= '[+lf+]'.$_lang['unpublish_date'].': '.$modx->toDateFormat($row['unpub_date']); |
|
150 | + $title .= '[+lf+]'.$_lang['page_data_web_access'].': '.($row['privateweb'] ? $_lang['private'] : $_lang['public']); |
|
151 | + $title .= '[+lf+]'.$_lang['page_data_mgr_access'].': '.($row['privatemgr'] ? $_lang['private'] : $_lang['public']); |
|
152 | + $title .= '[+lf+]'.$_lang['resource_opt_richtext'].': '.($row['richtext'] == 0 ? $_lang['no'] : $_lang['yes']); |
|
153 | + $title .= '[+lf+]'.$_lang['page_data_searchable'].': '.($row['searchable'] == 0 ? $_lang['no'] : $_lang['yes']); |
|
154 | + $title .= '[+lf+]'.$_lang['page_data_cacheable'].': '.($row['cacheable'] == 0 ? $_lang['no'] : $_lang['yes']); |
|
155 | 155 | $title = $modx->htmlspecialchars($title); |
156 | - $title = str_replace('[+lf+]', ' ', $title); // replace line-breaks with empty space as fall-back |
|
156 | + $title = str_replace('[+lf+]', ' ', $title); // replace line-breaks with empty space as fall-back |
|
157 | 157 | |
158 | 158 | $data = array( |
159 | 159 | 'id' => $row['id'], |
@@ -202,9 +202,9 @@ discard block |
||
202 | 202 | $ph['expandAll'] = $expandAll; |
203 | 203 | $ph['isPrivate'] = ($row['privateweb'] || $row['privatemgr']) ? 1 : 0; |
204 | 204 | |
205 | - if(!$row['isfolder']) { |
|
205 | + if (!$row['isfolder']) { |
|
206 | 206 | $tpl = getTplSingleNode(); |
207 | - switch($row['id']) { |
|
207 | + switch ($row['id']) { |
|
208 | 208 | case $modx->config['site_start'] : |
209 | 209 | $icon = $_style['tree_page_home']; |
210 | 210 | break; |
@@ -218,7 +218,7 @@ discard block |
||
218 | 218 | $icon = $_style['tree_page_info']; |
219 | 219 | break; |
220 | 220 | default: |
221 | - if(isset($icons[$row['contentType']])) { |
|
221 | + if (isset($icons[$row['contentType']])) { |
|
222 | 222 | $icon = $icons[$row['contentType']]; |
223 | 223 | } else { |
224 | 224 | $icon = $_style['tree_page']; |
@@ -228,20 +228,20 @@ discard block |
||
228 | 228 | |
229 | 229 | // invoke OnManagerNodePrerender event |
230 | 230 | $prenode = $modx->invokeEvent("OnManagerNodePrerender", array('ph' => $ph)); |
231 | - if(is_array($prenode)) { |
|
231 | + if (is_array($prenode)) { |
|
232 | 232 | $phnew = array(); |
233 | - foreach($prenode as $pnode) { |
|
233 | + foreach ($prenode as $pnode) { |
|
234 | 234 | $phnew = array_merge($phnew, unserialize($pnode)); |
235 | 235 | } |
236 | 236 | $ph = (count($phnew) > 0) ? $phnew : $ph; |
237 | 237 | } |
238 | 238 | |
239 | - if($ph['contextmenu']) { |
|
240 | - $ph['contextmenu'] = ' data-contextmenu="' . _htmlentities($ph['contextmenu']) . '"'; |
|
239 | + if ($ph['contextmenu']) { |
|
240 | + $ph['contextmenu'] = ' data-contextmenu="'._htmlentities($ph['contextmenu']).'"'; |
|
241 | 241 | } |
242 | 242 | |
243 | - if($_SESSION['tree_show_only_folders']) { |
|
244 | - if($row['parent'] == 0) { |
|
243 | + if ($_SESSION['tree_show_only_folders']) { |
|
244 | + if ($row['parent'] == 0) { |
|
245 | 245 | $node .= $modx->parseText($tpl, $ph); |
246 | 246 | } else { |
247 | 247 | $node .= ''; |
@@ -254,15 +254,15 @@ discard block |
||
254 | 254 | $ph['icon_folder_open'] = $_style['tree_folderopen_new']; |
255 | 255 | $ph['icon_folder_close'] = $_style['tree_folder_new']; |
256 | 256 | |
257 | - if($_SESSION['tree_show_only_folders']) { |
|
257 | + if ($_SESSION['tree_show_only_folders']) { |
|
258 | 258 | $tpl = getTplFolderNodeNotChildren(); |
259 | 259 | $checkFolders = checkIsFolder($row['id'], 1) ? 1 : 0; // folders |
260 | 260 | $checkDocs = checkIsFolder($row['id'], 0) ? 1 : 0; // no folders |
261 | 261 | $ph['tree_page_click'] = 3; |
262 | 262 | |
263 | 263 | // expandAll: two type for partial expansion |
264 | - if($expandAll == 1 || ($expandAll == 2 && in_array($row['id'], $opened))) { |
|
265 | - if($expandAll == 1) { |
|
264 | + if ($expandAll == 1 || ($expandAll == 2 && in_array($row['id'], $opened))) { |
|
265 | + if ($expandAll == 1) { |
|
266 | 266 | $opened2[] = $row['id']; |
267 | 267 | } |
268 | 268 | $ph['icon'] = $ph['icon_folder_open']; |
@@ -270,11 +270,11 @@ discard block |
||
270 | 270 | $ph['node_toggle'] = 1; |
271 | 271 | $ph['subMenuState'] = ' open'; |
272 | 272 | |
273 | - if(($checkDocs && !$checkFolders) || (!$checkDocs && !$checkFolders)) { |
|
273 | + if (($checkDocs && !$checkFolders) || (!$checkDocs && !$checkFolders)) { |
|
274 | 274 | $ph['showChildren'] = 1; |
275 | 275 | $ph['icon_node_toggle'] = ''; |
276 | 276 | $ph['icon'] = $ph['icon_folder_close']; |
277 | - } elseif(!$checkDocs && $checkFolders) { |
|
277 | + } elseif (!$checkDocs && $checkFolders) { |
|
278 | 278 | $ph['showChildren'] = 0; |
279 | 279 | $ph['openFolder'] = 2; |
280 | 280 | } else { |
@@ -286,20 +286,20 @@ discard block |
||
286 | 286 | 'ph' => $ph, |
287 | 287 | 'opened' => '1' |
288 | 288 | )); |
289 | - if(is_array($prenode)) { |
|
289 | + if (is_array($prenode)) { |
|
290 | 290 | $phnew = array(); |
291 | - foreach($prenode as $pnode) { |
|
291 | + foreach ($prenode as $pnode) { |
|
292 | 292 | $phnew = array_merge($phnew, unserialize($pnode)); |
293 | 293 | } |
294 | 294 | $ph = (count($phnew) > 0) ? $phnew : $ph; |
295 | 295 | } |
296 | 296 | |
297 | - if($ph['contextmenu']) { |
|
298 | - $ph['contextmenu'] = ' data-contextmenu="' . _htmlentities($ph['contextmenu']) . '"'; |
|
297 | + if ($ph['contextmenu']) { |
|
298 | + $ph['contextmenu'] = ' data-contextmenu="'._htmlentities($ph['contextmenu']).'"'; |
|
299 | 299 | } |
300 | 300 | |
301 | 301 | $node .= $modx->parseText($tpl, $ph); |
302 | - if($checkFolders) { |
|
302 | + if ($checkFolders) { |
|
303 | 303 | $node .= makeHTML($indent + 1, $row['id'], $expandAll, $theme, $hereid); |
304 | 304 | } |
305 | 305 | $node .= '</div></div>'; |
@@ -309,10 +309,10 @@ discard block |
||
309 | 309 | $ph['icon_node_toggle'] = $ph['tree_plusnode']; |
310 | 310 | $ph['node_toggle'] = 0; |
311 | 311 | |
312 | - if(($checkDocs && !$checkFolders) || (!$checkDocs && !$checkFolders)) { |
|
312 | + if (($checkDocs && !$checkFolders) || (!$checkDocs && !$checkFolders)) { |
|
313 | 313 | $ph['showChildren'] = 1; |
314 | 314 | $ph['icon_node_toggle'] = ''; |
315 | - } elseif(!$checkDocs && $checkFolders) { |
|
315 | + } elseif (!$checkDocs && $checkFolders) { |
|
316 | 316 | $ph['showChildren'] = 0; |
317 | 317 | $ph['openFolder'] = 2; |
318 | 318 | } else { |
@@ -324,16 +324,16 @@ discard block |
||
324 | 324 | 'ph' => $ph, |
325 | 325 | 'opened' => '0' |
326 | 326 | )); |
327 | - if(is_array($prenode)) { |
|
327 | + if (is_array($prenode)) { |
|
328 | 328 | $phnew = array(); |
329 | - foreach($prenode as $pnode) { |
|
329 | + foreach ($prenode as $pnode) { |
|
330 | 330 | $phnew = array_merge($phnew, unserialize($pnode)); |
331 | 331 | } |
332 | 332 | $ph = (count($phnew) > 0) ? $phnew : $ph; |
333 | 333 | } |
334 | 334 | |
335 | - if($ph['contextmenu']) { |
|
336 | - $ph['contextmenu'] = ' data-contextmenu="' . _htmlentities($ph['contextmenu']) . '"'; |
|
335 | + if ($ph['contextmenu']) { |
|
336 | + $ph['contextmenu'] = ' data-contextmenu="'._htmlentities($ph['contextmenu']).'"'; |
|
337 | 337 | } |
338 | 338 | |
339 | 339 | $node .= $modx->parseText($tpl, $ph); |
@@ -342,8 +342,8 @@ discard block |
||
342 | 342 | } else { |
343 | 343 | $tpl = getTplFolderNode(); |
344 | 344 | // expandAll: two type for partial expansion |
345 | - if($expandAll == 1 || ($expandAll == 2 && in_array($row['id'], $opened))) { |
|
346 | - if($expandAll == 1) { |
|
345 | + if ($expandAll == 1 || ($expandAll == 2 && in_array($row['id'], $opened))) { |
|
346 | + if ($expandAll == 1) { |
|
347 | 347 | $opened2[] = $row['id']; |
348 | 348 | } |
349 | 349 | $ph['icon'] = $ph['icon_folder_open']; |
@@ -351,7 +351,7 @@ discard block |
||
351 | 351 | $ph['node_toggle'] = 1; |
352 | 352 | $ph['subMenuState'] = ' open'; |
353 | 353 | |
354 | - if($ph['donthit'] == 1) { |
|
354 | + if ($ph['donthit'] == 1) { |
|
355 | 355 | $ph['tree_page_click'] = 3; |
356 | 356 | $ph['icon_node_toggle'] = ''; |
357 | 357 | $ph['icon'] = $ph['icon_folder_close']; |
@@ -363,32 +363,32 @@ discard block |
||
363 | 363 | 'ph' => $ph, |
364 | 364 | 'opened' => '1' |
365 | 365 | )); |
366 | - if(is_array($prenode)) { |
|
366 | + if (is_array($prenode)) { |
|
367 | 367 | $phnew = array(); |
368 | - foreach($prenode as $pnode) { |
|
368 | + foreach ($prenode as $pnode) { |
|
369 | 369 | $phnew = array_merge($phnew, unserialize($pnode)); |
370 | 370 | } |
371 | 371 | $ph = (count($phnew) > 0) ? $phnew : $ph; |
372 | - if($ph['showChildren'] == 0) { |
|
372 | + if ($ph['showChildren'] == 0) { |
|
373 | 373 | unset($opened2[$row['id']]); |
374 | 374 | $ph['node_toggle'] = 0; |
375 | 375 | $ph['subMenuState'] = ''; |
376 | 376 | } |
377 | 377 | } |
378 | 378 | |
379 | - if($ph['showChildren'] == 0) { |
|
379 | + if ($ph['showChildren'] == 0) { |
|
380 | 380 | $ph['icon_node_toggle'] = ''; |
381 | 381 | $ph['donthit'] = 1; |
382 | 382 | $ph['icon'] = $ph['icon_folder_close']; |
383 | 383 | $tpl = getTplFolderNodeNotChildren(); |
384 | 384 | } |
385 | 385 | |
386 | - if($ph['contextmenu']) { |
|
387 | - $ph['contextmenu'] = ' data-contextmenu="' . _htmlentities($ph['contextmenu']) . '"'; |
|
386 | + if ($ph['contextmenu']) { |
|
387 | + $ph['contextmenu'] = ' data-contextmenu="'._htmlentities($ph['contextmenu']).'"'; |
|
388 | 388 | } |
389 | 389 | |
390 | 390 | $node .= $modx->parseText($tpl, $ph); |
391 | - if($ph['donthit'] == 0) { |
|
391 | + if ($ph['donthit'] == 0) { |
|
392 | 392 | $node .= makeHTML($indent + 1, $row['id'], $expandAll, $theme, $hereid); |
393 | 393 | } |
394 | 394 | $node .= '</div></div>'; |
@@ -398,7 +398,7 @@ discard block |
||
398 | 398 | $ph['icon_node_toggle'] = $ph['tree_plusnode']; |
399 | 399 | $ph['node_toggle'] = 0; |
400 | 400 | |
401 | - if($ph['donthit'] == 1) { |
|
401 | + if ($ph['donthit'] == 1) { |
|
402 | 402 | $ph['tree_page_click'] = 3; |
403 | 403 | $ph['icon_node_toggle'] = ''; |
404 | 404 | $ph['icon'] = $ph['icon_folder_close']; |
@@ -410,23 +410,23 @@ discard block |
||
410 | 410 | 'ph' => $ph, |
411 | 411 | 'opened' => '0' |
412 | 412 | )); |
413 | - if(is_array($prenode)) { |
|
413 | + if (is_array($prenode)) { |
|
414 | 414 | $phnew = array(); |
415 | - foreach($prenode as $pnode) { |
|
415 | + foreach ($prenode as $pnode) { |
|
416 | 416 | $phnew = array_merge($phnew, unserialize($pnode)); |
417 | 417 | } |
418 | 418 | $ph = (count($phnew) > 0) ? $phnew : $ph; |
419 | 419 | } |
420 | 420 | |
421 | - if($ph['showChildren'] == 0) { |
|
421 | + if ($ph['showChildren'] == 0) { |
|
422 | 422 | $ph['icon_node_toggle'] = ''; |
423 | 423 | $ph['donthit'] = 1; |
424 | 424 | $ph['icon'] = $ph['icon_folder_close']; |
425 | 425 | $tpl = getTplFolderNodeNotChildren(); |
426 | 426 | } |
427 | 427 | |
428 | - if($ph['contextmenu']) { |
|
429 | - $ph['contextmenu'] = ' data-contextmenu="' . _htmlentities($ph['contextmenu']) . '"'; |
|
428 | + if ($ph['contextmenu']) { |
|
429 | + $ph['contextmenu'] = ' data-contextmenu="'._htmlentities($ph['contextmenu']).'"'; |
|
430 | 430 | } |
431 | 431 | |
432 | 432 | $node .= $modx->parseText($tpl, $ph); |
@@ -438,10 +438,10 @@ discard block |
||
438 | 438 | // invoke OnManagerNodeRender event |
439 | 439 | $data['node'] = $node; |
440 | 440 | $evtOut = $modx->invokeEvent('OnManagerNodeRender', $data); |
441 | - if(is_array($evtOut)) { |
|
441 | + if (is_array($evtOut)) { |
|
442 | 442 | $evtOut = implode("\n", $evtOut); |
443 | 443 | } |
444 | - if($evtOut != '') { |
|
444 | + if ($evtOut != '') { |
|
445 | 445 | $node = trim($evtOut); |
446 | 446 | } |
447 | 447 | |
@@ -455,14 +455,14 @@ discard block |
||
455 | 455 | * @param array $_style |
456 | 456 | * @return array |
457 | 457 | */ |
458 | -function getIconInfo($_style) { |
|
459 | - if(!isset($_style['tree_page_gif'])) { |
|
458 | +function getIconInfo($_style){ |
|
459 | + if (!isset($_style['tree_page_gif'])) { |
|
460 | 460 | $_style['tree_page_gif'] = $_style['tree_page']; |
461 | 461 | } |
462 | - if(!isset($_style['tree_page_jpg'])) { |
|
462 | + if (!isset($_style['tree_page_jpg'])) { |
|
463 | 463 | $_style['tree_page_jpg'] = $_style['tree_page']; |
464 | 464 | } |
465 | - if(!isset($_style['tree_page_png'])) { |
|
465 | + if (!isset($_style['tree_page_png'])) { |
|
466 | 466 | $_style['tree_page_png'] = $_style['tree_page']; |
467 | 467 | } |
468 | 468 | $icons = array( |
@@ -486,14 +486,14 @@ discard block |
||
486 | 486 | * @param array $_style |
487 | 487 | * @return array |
488 | 488 | */ |
489 | -function getPrivateIconInfo($_style) { |
|
490 | - if(!isset($_style['tree_page_gif_secure'])) { |
|
489 | +function getPrivateIconInfo($_style){ |
|
490 | + if (!isset($_style['tree_page_gif_secure'])) { |
|
491 | 491 | $_style['tree_page_gif_secure'] = $_style['tree_page_secure']; |
492 | 492 | } |
493 | - if(!isset($_style['tree_page_jpg_secure'])) { |
|
493 | + if (!isset($_style['tree_page_jpg_secure'])) { |
|
494 | 494 | $_style['tree_page_jpg_secure'] = $_style['tree_page_secure']; |
495 | 495 | } |
496 | - if(!isset($_style['tree_page_png_secure'])) { |
|
496 | + if (!isset($_style['tree_page_png_secure'])) { |
|
497 | 497 | $_style['tree_page_png_secure'] = $_style['tree_page_secure']; |
498 | 498 | } |
499 | 499 | $iconsPrivate = array( |
@@ -518,21 +518,21 @@ discard block |
||
518 | 518 | * @param array $row |
519 | 519 | * @return string |
520 | 520 | */ |
521 | -function getNodeTitle($nodeNameSource, $row) { |
|
521 | +function getNodeTitle($nodeNameSource, $row){ |
|
522 | 522 | global $modx; |
523 | 523 | |
524 | - switch($nodeNameSource) { |
|
524 | + switch ($nodeNameSource) { |
|
525 | 525 | case 'menutitle': |
526 | 526 | $nodetitle = $row['menutitle'] ? $row['menutitle'] : $row['pagetitle']; |
527 | 527 | break; |
528 | 528 | case 'alias': |
529 | 529 | $nodetitle = $row['alias'] ? $row['alias'] : $row['id']; |
530 | - if(strpos($row['alias'], '.') === false) { |
|
531 | - if($row['isfolder'] != 1 || $modx->config['make_folders'] != 1) { |
|
530 | + if (strpos($row['alias'], '.') === false) { |
|
531 | + if ($row['isfolder'] != 1 || $modx->config['make_folders'] != 1) { |
|
532 | 532 | $nodetitle .= $modx->config['friendly_url_suffix']; |
533 | 533 | } |
534 | 534 | } |
535 | - $nodetitle = $modx->config['friendly_url_prefix'] . $nodetitle; |
|
535 | + $nodetitle = $modx->config['friendly_url_prefix'].$nodetitle; |
|
536 | 536 | break; |
537 | 537 | case 'pagetitle': |
538 | 538 | $nodetitle = $row['pagetitle']; |
@@ -547,7 +547,7 @@ discard block |
||
547 | 547 | case 'unpub_date': |
548 | 548 | $doc = $modx->getDocumentObject('id', $row['id']); |
549 | 549 | $date = $doc[$nodeNameSource]; |
550 | - if(!empty($date)) { |
|
550 | + if (!empty($date)) { |
|
551 | 551 | $nodetitle = $modx->toDateFormat($date); |
552 | 552 | } else { |
553 | 553 | $nodetitle = '- - -'; |
@@ -568,8 +568,8 @@ discard block |
||
568 | 568 | * @param string $nodeNameSource |
569 | 569 | * @return bool |
570 | 570 | */ |
571 | -function isDateNode($nodeNameSource) { |
|
572 | - switch($nodeNameSource) { |
|
571 | +function isDateNode($nodeNameSource){ |
|
572 | + switch ($nodeNameSource) { |
|
573 | 573 | case 'createdon': |
574 | 574 | case 'editedon': |
575 | 575 | case 'publishedon': |
@@ -586,17 +586,17 @@ discard block |
||
586 | 586 | * @param int $isfolder |
587 | 587 | * @return int |
588 | 588 | */ |
589 | -function checkIsFolder($parent = 0, $isfolder = 1) { |
|
589 | +function checkIsFolder($parent = 0, $isfolder = 1){ |
|
590 | 590 | global $modx; |
591 | 591 | |
592 | - return (int) $modx->db->getValue($modx->db->query('SELECT count(*) FROM ' . $modx->getFullTableName('site_content') . ' WHERE parent=' . $parent . ' AND isfolder=' . $isfolder . ' ')); |
|
592 | + return (int) $modx->db->getValue($modx->db->query('SELECT count(*) FROM '.$modx->getFullTableName('site_content').' WHERE parent='.$parent.' AND isfolder='.$isfolder.' ')); |
|
593 | 593 | } |
594 | 594 | |
595 | 595 | /** |
596 | 596 | * @param mixed $array |
597 | 597 | * @return string |
598 | 598 | */ |
599 | -function _htmlentities($array) { |
|
599 | +function _htmlentities($array){ |
|
600 | 600 | global $modx; |
601 | 601 | |
602 | 602 | $array = json_encode($array, JSON_UNESCAPED_UNICODE); |
@@ -608,7 +608,7 @@ discard block |
||
608 | 608 | /** |
609 | 609 | * @return string |
610 | 610 | */ |
611 | -function getTplSingleNode() { |
|
611 | +function getTplSingleNode(){ |
|
612 | 612 | return '<div id="node[+id+]"><a class="[+treeNodeClass+]" |
613 | 613 | onclick="modx.tree.treeAction(event,[+id+]);" |
614 | 614 | oncontextmenu="modx.tree.showPopup(event,[+id+],\'[+nodetitle_esc+]\');" |
@@ -635,7 +635,7 @@ discard block |
||
635 | 635 | /** |
636 | 636 | * @return string |
637 | 637 | */ |
638 | -function getTplFolderNode() { |
|
638 | +function getTplFolderNode(){ |
|
639 | 639 | return '<div id="node[+id+]"><a class="[+treeNodeClass+]" |
640 | 640 | onclick="modx.tree.treeAction(event,[+id+]);" |
641 | 641 | oncontextmenu="modx.tree.showPopup(event,[+id+],\'[+nodetitle_esc+]\');" |
@@ -674,7 +674,7 @@ discard block |
||
674 | 674 | /** |
675 | 675 | * @return string |
676 | 676 | */ |
677 | -function getTplFolderNodeNotChildren() { |
|
677 | +function getTplFolderNodeNotChildren(){ |
|
678 | 678 | return '<div id="node[+id+]"><a class="[+treeNodeClass+]" |
679 | 679 | onclick="modx.tree.treeAction(event,[+id+]);" |
680 | 680 | oncontextmenu="modx.tree.showPopup(event,[+id+],\'[+nodetitle_esc+]\');" |
@@ -710,11 +710,11 @@ discard block |
||
710 | 710 | * @param int|string|array $str |
711 | 711 | * @param bool $flag |
712 | 712 | */ |
713 | -function dbug($str, $flag = false) { |
|
713 | +function dbug($str, $flag = false){ |
|
714 | 714 | print('<pre>'); |
715 | 715 | print_r($str); |
716 | 716 | print('</pre>'); |
717 | - if($flag) { |
|
717 | + if ($flag) { |
|
718 | 718 | exit; |
719 | 719 | } |
720 | 720 | } |
@@ -1,14 +1,14 @@ discard block |
||
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 | 6 | $tpl = array( |
7 | - 'viewForm' => file_get_contents(MODX_MANAGER_PATH . 'actions/resources/tpl_viewForm.tpl'), |
|
8 | - 'panelGroup' => file_get_contents(MODX_MANAGER_PATH . 'actions/resources/tpl_panelGroup.tpl'), |
|
9 | - 'panelHeading' => file_get_contents(MODX_MANAGER_PATH . 'actions/resources/tpl_panelHeading.tpl'), |
|
10 | - 'panelCollapse' => file_get_contents(MODX_MANAGER_PATH . 'actions/resources/tpl_panelCollapse.tpl'), |
|
11 | - 'elementsRow' => file_get_contents(MODX_MANAGER_PATH . 'actions/resources/tpl_elementsRow.tpl') |
|
7 | + 'viewForm' => file_get_contents(MODX_MANAGER_PATH.'actions/resources/tpl_viewForm.tpl'), |
|
8 | + 'panelGroup' => file_get_contents(MODX_MANAGER_PATH.'actions/resources/tpl_panelGroup.tpl'), |
|
9 | + 'panelHeading' => file_get_contents(MODX_MANAGER_PATH.'actions/resources/tpl_panelHeading.tpl'), |
|
10 | + 'panelCollapse' => file_get_contents(MODX_MANAGER_PATH.'actions/resources/tpl_panelCollapse.tpl'), |
|
11 | + 'elementsRow' => file_get_contents(MODX_MANAGER_PATH.'actions/resources/tpl_elementsRow.tpl') |
|
12 | 12 | ); |
13 | 13 | |
14 | 14 | /** |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | * @param array $ph |
17 | 17 | * @return string |
18 | 18 | */ |
19 | -function parsePh($tpl, $ph) { |
|
19 | +function parsePh($tpl, $ph){ |
|
20 | 20 | global $modx, $_lang; |
21 | 21 | $tpl = $modx->parseText($tpl, $_lang, '[%', '%]'); |
22 | 22 | return $modx->parseText($tpl, $ph); |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | * @param string|int $cssId |
27 | 27 | * @return string |
28 | 28 | */ |
29 | -function renderViewSwitchButtons($cssId) { |
|
29 | +function renderViewSwitchButtons($cssId){ |
|
30 | 30 | global $modx, $_lang, $tpl; |
31 | 31 | |
32 | 32 | return parsePh($tpl['viewForm'], array( |
@@ -39,19 +39,19 @@ discard block |
||
39 | 39 | * @param mgrResources $resources |
40 | 40 | * @return string |
41 | 41 | */ |
42 | -function createResourceList($resourceTable, $resources) { |
|
42 | +function createResourceList($resourceTable, $resources){ |
|
43 | 43 | global $modx, $_lang, $_style, $modx_textdir, $tpl; |
44 | 44 | |
45 | 45 | $items = isset($resources->items[$resourceTable]) ? $resources->items[$resourceTable] : false; |
46 | 46 | |
47 | - if( ! is_array($items) || empty($items)) { |
|
47 | + if (!is_array($items) || empty($items)) { |
|
48 | 48 | return $_lang['no_results']; |
49 | 49 | } |
50 | 50 | |
51 | 51 | // Prepare elements- and categories-list |
52 | 52 | $elements = array(); |
53 | 53 | $categories = array(); |
54 | - foreach($items as $row) { |
|
54 | + foreach ($items as $row) { |
|
55 | 55 | $catid = $row['catid'] ? $row['catid'] : 0; |
56 | 56 | $categories[$catid] = array('name' => stripslashes($row['category'])); |
57 | 57 | $elements[$catid][] = prepareElementRowPh($row, $resourceTable, $resources); |
@@ -59,18 +59,18 @@ discard block |
||
59 | 59 | |
60 | 60 | // Now render categories / panel-collapse |
61 | 61 | $panelGroup = ''; |
62 | - foreach($elements as $catid => $elList) { |
|
62 | + foreach ($elements as $catid => $elList) { |
|
63 | 63 | // Add panel-heading / category-collapse to output |
64 | 64 | $panelGroup .= parsePh($tpl['panelHeading'], array( |
65 | 65 | 'tab' => $resourceTable, |
66 | 66 | 'category' => $categories[$catid]['name'], |
67 | - 'categoryid' => $catid != '' ? ' <small>(' . $catid . ')</small>' : '', |
|
67 | + 'categoryid' => $catid != '' ? ' <small>('.$catid.')</small>' : '', |
|
68 | 68 | 'catid' => $catid, |
69 | 69 | )); |
70 | 70 | |
71 | 71 | // Prepare content for panel-collapse |
72 | 72 | $panelCollapse = ''; |
73 | - foreach($elList as $el) { |
|
73 | + foreach ($elList as $el) { |
|
74 | 74 | $panelCollapse .= parsePh($tpl['elementsRow'], $el); |
75 | 75 | } |
76 | 76 | |
@@ -92,30 +92,30 @@ discard block |
||
92 | 92 | * @param mgrResources $resources |
93 | 93 | * @return string |
94 | 94 | */ |
95 | -function createCombinedView($resources) { |
|
95 | +function createCombinedView($resources){ |
|
96 | 96 | global $modx, $_lang, $_style, $modx_textdir; |
97 | 97 | |
98 | 98 | $itemsPerCategory = isset($resources->itemsPerCategory) ? $resources->itemsPerCategory : false; |
99 | 99 | $types = isset($resources->types) ? $resources->types : false; |
100 | 100 | $categories = isset($resources->categories) ? $resources->categories : false; |
101 | 101 | |
102 | - if(!$itemsPerCategory) { |
|
102 | + if (!$itemsPerCategory) { |
|
103 | 103 | return $_lang['no_results']; |
104 | 104 | } |
105 | 105 | |
106 | 106 | $tpl = array( |
107 | - 'panelGroup' => file_get_contents(MODX_MANAGER_PATH . 'actions/resources/tpl_panelGroup.tpl'), |
|
108 | - 'panelHeading' => file_get_contents(MODX_MANAGER_PATH . 'actions/resources/tpl_panelHeading.tpl'), |
|
109 | - 'panelCollapse' => file_get_contents(MODX_MANAGER_PATH . 'actions/resources/tpl_panelCollapse.tpl'), |
|
110 | - 'elementsRow' => file_get_contents(MODX_MANAGER_PATH . 'actions/resources/tpl_elementsRow.tpl'), |
|
107 | + 'panelGroup' => file_get_contents(MODX_MANAGER_PATH.'actions/resources/tpl_panelGroup.tpl'), |
|
108 | + 'panelHeading' => file_get_contents(MODX_MANAGER_PATH.'actions/resources/tpl_panelHeading.tpl'), |
|
109 | + 'panelCollapse' => file_get_contents(MODX_MANAGER_PATH.'actions/resources/tpl_panelCollapse.tpl'), |
|
110 | + 'elementsRow' => file_get_contents(MODX_MANAGER_PATH.'actions/resources/tpl_elementsRow.tpl'), |
|
111 | 111 | ); |
112 | 112 | |
113 | 113 | // Easily loop through $itemsPerCategory-Array |
114 | 114 | $panelGroup = ''; |
115 | - foreach($categories as $catid => $category) { |
|
115 | + foreach ($categories as $catid => $category) { |
|
116 | 116 | // Prepare collapse content / elements-list |
117 | 117 | $panelCollapse = ''; |
118 | - foreach($itemsPerCategory[$catid] as $el) { |
|
118 | + foreach ($itemsPerCategory[$catid] as $el) { |
|
119 | 119 | $resourceTable = $el['type']; |
120 | 120 | $ph = prepareElementRowPh($el, $resourceTable, $resources); |
121 | 121 | $panelCollapse .= parsePh($tpl['elementsRow'], $ph); |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | $panelGroup .= parsePh($tpl['panelHeading'], array( |
126 | 126 | 'tab' => 'categories_list', |
127 | 127 | 'category' => $categories[$catid], |
128 | - 'categoryid' => $catid != '' ? ' <small>(' . $catid . ')</small>' : '', |
|
128 | + 'categoryid' => $catid != '' ? ' <small>('.$catid.')</small>' : '', |
|
129 | 129 | 'catid' => $catid, |
130 | 130 | )); |
131 | 131 | |
@@ -149,14 +149,14 @@ discard block |
||
149 | 149 | * @param mgrResources $resources |
150 | 150 | * @return array |
151 | 151 | */ |
152 | -function prepareElementRowPh($row, $resourceTable, $resources) { |
|
152 | +function prepareElementRowPh($row, $resourceTable, $resources){ |
|
153 | 153 | global $modx, $modx_textdir, $_style, $_lang; |
154 | 154 | |
155 | 155 | $types = isset($resources->types[$resourceTable]) ? $resources->types[$resourceTable] : false; |
156 | 156 | |
157 | 157 | $_lang["confirm_delete"] = $_lang["delete"]; |
158 | 158 | |
159 | - switch($resourceTable){ |
|
159 | + switch ($resourceTable) { |
|
160 | 160 | case 'site_templates': |
161 | 161 | $class = $row['selectable'] ? '' : 'disabledPlugin'; |
162 | 162 | $lockElementType = 1; |
@@ -193,65 +193,65 @@ discard block |
||
193 | 193 | // Prepare displaying user-locks |
194 | 194 | $lockedByUser = ''; |
195 | 195 | $rowLock = $modx->elementIsLocked($lockElementType, $row['id'], true); |
196 | - if($rowLock && $modx->hasPermission('display_locks')) { |
|
197 | - if($rowLock['sid'] == $modx->sid) { |
|
196 | + if ($rowLock && $modx->hasPermission('display_locks')) { |
|
197 | + if ($rowLock['sid'] == $modx->sid) { |
|
198 | 198 | $title = $modx->parseText($_lang["lock_element_editing"], array( |
199 | - 'element_type' => $_lang["lock_element_type_" . $lockElementType], |
|
199 | + 'element_type' => $_lang["lock_element_type_".$lockElementType], |
|
200 | 200 | 'lasthit_df' => $rowLock['lasthit_df'] |
201 | 201 | )); |
202 | - $lockedByUser = '<span title="' . $title . '" class="editResource" style="cursor:context-menu;">' . $_style['tree_preview_resource'] . '</span> '; |
|
202 | + $lockedByUser = '<span title="'.$title.'" class="editResource" style="cursor:context-menu;">'.$_style['tree_preview_resource'].'</span> '; |
|
203 | 203 | } else { |
204 | 204 | $title = $modx->parseText($_lang["lock_element_locked_by"], array( |
205 | - 'element_type' => $_lang["lock_element_type_" . $lockElementType], |
|
205 | + 'element_type' => $_lang["lock_element_type_".$lockElementType], |
|
206 | 206 | 'username' => $rowLock['username'], |
207 | 207 | 'lasthit_df' => $rowLock['lasthit_df'] |
208 | 208 | )); |
209 | - if($modx->hasPermission('remove_locks')) { |
|
210 | - $lockedByUser = '<a href="javascript:;" onclick="unlockElement(' . $lockElementType . ', ' . $row['id'] . ', this);return false;" title="' . $title . '" class="lockedResource"><i class="' . $_style['icons_secured'] . '"></i></a>'; |
|
209 | + if ($modx->hasPermission('remove_locks')) { |
|
210 | + $lockedByUser = '<a href="javascript:;" onclick="unlockElement('.$lockElementType.', '.$row['id'].', this);return false;" title="'.$title.'" class="lockedResource"><i class="'.$_style['icons_secured'].'"></i></a>'; |
|
211 | 211 | } else { |
212 | - $lockedByUser = '<span title="' . $title . '" class="lockedResource" style="cursor:context-menu;"><i class="' . $_style['icons_secured'] . '"></i></span>'; |
|
212 | + $lockedByUser = '<span title="'.$title.'" class="lockedResource" style="cursor:context-menu;"><i class="'.$_style['icons_secured'].'"></i></span>'; |
|
213 | 213 | } |
214 | 214 | } |
215 | 215 | } |
216 | - if($lockedByUser) { |
|
217 | - $lockedByUser = '<div class="lockCell">' . $lockedByUser . '</div>'; |
|
216 | + if ($lockedByUser) { |
|
217 | + $lockedByUser = '<div class="lockCell">'.$lockedByUser.'</div>'; |
|
218 | 218 | } |
219 | 219 | |
220 | 220 | // Caption |
221 | - if($resourceTable == 'site_tmplvars') { |
|
222 | - $caption = !empty($row['description']) ? ' ' . $row['caption'] . ' <small>(' . $row['description'] . ')</small>' : ' ' . $row['caption']; |
|
221 | + if ($resourceTable == 'site_tmplvars') { |
|
222 | + $caption = !empty($row['description']) ? ' '.$row['caption'].' <small>('.$row['description'].')</small>' : ' '.$row['caption']; |
|
223 | 223 | } else { |
224 | - $caption = !empty($row['description']) ? ' ' . $row['description'] : ''; |
|
224 | + $caption = !empty($row['description']) ? ' '.$row['description'] : ''; |
|
225 | 225 | } |
226 | 226 | |
227 | 227 | // Special marks |
228 | 228 | $tplInfo = array(); |
229 | - if($row['locked']) { |
|
229 | + if ($row['locked']) { |
|
230 | 230 | $tplInfo[] = $_lang['locked']; |
231 | 231 | } |
232 | - if($row['id'] == $modx->config['default_template'] && $resourceTable == 'site_templates') { |
|
232 | + if ($row['id'] == $modx->config['default_template'] && $resourceTable == 'site_templates') { |
|
233 | 233 | $tplInfo[] = $_lang['defaulttemplate_title']; |
234 | 234 | } |
235 | - $marks = !empty($tplInfo) ? ' <em>(' . implode(', ', $tplInfo) . ')</em>' : ''; |
|
235 | + $marks = !empty($tplInfo) ? ' <em>('.implode(', ', $tplInfo).')</em>' : ''; |
|
236 | 236 | |
237 | 237 | /* row buttons */ |
238 | 238 | $buttons = ''; |
239 | - if($modx->hasPermission($types['actions']['edit'][1])) { |
|
240 | - $buttons .= '<li><a title="' . $_lang["edit_resource"] . '" href="index.php?a=' . $types['actions']['edit'][0] . '&id=' . $row['id'] . '"><i class="fa fa-edit fa-fw"></i></a></li>'; |
|
239 | + if ($modx->hasPermission($types['actions']['edit'][1])) { |
|
240 | + $buttons .= '<li><a title="'.$_lang["edit_resource"].'" href="index.php?a='.$types['actions']['edit'][0].'&id='.$row['id'].'"><i class="fa fa-edit fa-fw"></i></a></li>'; |
|
241 | 241 | } |
242 | - if($modx->hasPermission($types['actions']['duplicate'][1])) { |
|
243 | - $buttons .= '<li><a onclick="return confirm(\'' . $_lang["confirm_duplicate_record"] . '\')" title="' . $_lang["resource_duplicate"] . '" href="index.php?a=' . $types['actions']['duplicate'][0] . '&id=' . $row['id'] . '"><i class="fa fa-clone fa-fw"></i></a></li>'; |
|
242 | + if ($modx->hasPermission($types['actions']['duplicate'][1])) { |
|
243 | + $buttons .= '<li><a onclick="return confirm(\''.$_lang["confirm_duplicate_record"].'\')" title="'.$_lang["resource_duplicate"].'" href="index.php?a='.$types['actions']['duplicate'][0].'&id='.$row['id'].'"><i class="fa fa-clone fa-fw"></i></a></li>'; |
|
244 | 244 | } |
245 | - if($modx->hasPermission($types['actions']['remove'][1])) { |
|
246 | - $buttons .= '<li><a onclick="return confirm(\'' . $_lang["confirm_delete"] . '\')" title="' . $_lang["delete"] . '" href="index.php?a=' . $types['actions']['remove'][0] . '&id=' . $row['id'] . '"><i class="fa fa-trash fa-fw"></i></a></li>'; |
|
245 | + if ($modx->hasPermission($types['actions']['remove'][1])) { |
|
246 | + $buttons .= '<li><a onclick="return confirm(\''.$_lang["confirm_delete"].'\')" title="'.$_lang["delete"].'" href="index.php?a='.$types['actions']['remove'][0].'&id='.$row['id'].'"><i class="fa fa-trash fa-fw"></i></a></li>'; |
|
247 | 247 | } |
248 | - $buttons = $buttons ? '<div class="btnCell"><ul class="elements_buttonbar">' . $buttons . '</ul></div>' : ''; |
|
248 | + $buttons = $buttons ? '<div class="btnCell"><ul class="elements_buttonbar">'.$buttons.'</ul></div>' : ''; |
|
249 | 249 | |
250 | 250 | $catid = $row['catid'] ? $row['catid'] : 0; |
251 | 251 | |
252 | 252 | // Placeholders for elements-row |
253 | 253 | return array( |
254 | - 'class' => $class ? ' class="' . $class . '"' : '', |
|
254 | + 'class' => $class ? ' class="'.$class.'"' : '', |
|
255 | 255 | 'lockedByUser' => $lockedByUser, |
256 | 256 | 'name' => $row['name'], |
257 | 257 | 'caption' => $caption, |
@@ -1,9 +1,9 @@ discard block |
||
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 | -class mgrResources { |
|
6 | +class mgrResources{ |
|
7 | 7 | /** |
8 | 8 | * @var array |
9 | 9 | */ |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | /** |
25 | 25 | * mgrResources constructor. |
26 | 26 | */ |
27 | - public function __construct() { |
|
27 | + public function __construct(){ |
|
28 | 28 | $this->setTypes(); |
29 | 29 | $this->queryItemsFromDB(); |
30 | 30 | $this->prepareCategoryArrays(); |
@@ -33,47 +33,47 @@ discard block |
||
33 | 33 | /** |
34 | 34 | * @return void |
35 | 35 | */ |
36 | - public function setTypes() { |
|
36 | + public function setTypes(){ |
|
37 | 37 | global $_lang; |
38 | - $this->types['site_templates'] = array( |
|
38 | + $this->types['site_templates'] = array( |
|
39 | 39 | 'title'=>$_lang["manage_templates"], |
40 | - 'actions'=>array( 'edit'=>array(16,'edit_template'), 'duplicate'=>array(96,'new_template'), 'remove'=>array(21,'delete_template') ), |
|
41 | - 'permissions'=>array('new_template','edit_template'), |
|
40 | + 'actions'=>array('edit'=>array(16, 'edit_template'), 'duplicate'=>array(96, 'new_template'), 'remove'=>array(21, 'delete_template')), |
|
41 | + 'permissions'=>array('new_template', 'edit_template'), |
|
42 | 42 | 'name'=>'templatename' |
43 | 43 | ); |
44 | - $this->types['site_tmplvars'] = array( |
|
44 | + $this->types['site_tmplvars'] = array( |
|
45 | 45 | 'title'=>$_lang["tmplvars"], |
46 | - 'actions'=>array('edit'=>array(301,'edit_template'), 'duplicate'=>array(304,'edit_template'), 'remove'=>array(303,'edit_template')), |
|
47 | - 'permissions'=>array('new_template','edit_template'), |
|
46 | + 'actions'=>array('edit'=>array(301, 'edit_template'), 'duplicate'=>array(304, 'edit_template'), 'remove'=>array(303, 'edit_template')), |
|
47 | + 'permissions'=>array('new_template', 'edit_template'), |
|
48 | 48 | ); |
49 | 49 | $this->types['site_htmlsnippets'] = array( |
50 | 50 | 'title'=>$_lang["manage_htmlsnippets"], |
51 | - 'actions'=>array('edit'=>array(78,'edit_chunk'), 'duplicate'=>array(97,'new_chunk'), 'remove'=>array(80,'delete_chunk')), |
|
52 | - 'permissions'=>array('new_chunk','edit_chunk'), |
|
51 | + 'actions'=>array('edit'=>array(78, 'edit_chunk'), 'duplicate'=>array(97, 'new_chunk'), 'remove'=>array(80, 'delete_chunk')), |
|
52 | + 'permissions'=>array('new_chunk', 'edit_chunk'), |
|
53 | 53 | ); |
54 | - $this->types['site_snippets'] = array( |
|
54 | + $this->types['site_snippets'] = array( |
|
55 | 55 | 'title'=>$_lang["manage_snippets"], |
56 | - 'actions'=>array('edit'=>array(22,'edit_snippet'), 'duplicate'=>array(98,'new_snippet'), 'remove'=>array(25,'delete_snippet')), |
|
57 | - 'permissions'=>array('new_snippet','edit_snippet'), |
|
56 | + 'actions'=>array('edit'=>array(22, 'edit_snippet'), 'duplicate'=>array(98, 'new_snippet'), 'remove'=>array(25, 'delete_snippet')), |
|
57 | + 'permissions'=>array('new_snippet', 'edit_snippet'), |
|
58 | 58 | ); |
59 | - $this->types['site_plugins'] = array( |
|
59 | + $this->types['site_plugins'] = array( |
|
60 | 60 | 'title'=>$_lang["manage_plugins"], |
61 | - 'actions'=>array('edit'=>array(102,'edit_plugin'), 'duplicate'=>array(105,'new_plugin'), 'remove'=>array(104,'delete_plugin')), |
|
62 | - 'permissions'=>array('new_plugin','edit_plugin'), |
|
61 | + 'actions'=>array('edit'=>array(102, 'edit_plugin'), 'duplicate'=>array(105, 'new_plugin'), 'remove'=>array(104, 'delete_plugin')), |
|
62 | + 'permissions'=>array('new_plugin', 'edit_plugin'), |
|
63 | 63 | ); |
64 | - $this->types['site_modules'] = array( |
|
64 | + $this->types['site_modules'] = array( |
|
65 | 65 | 'title'=>$_lang["manage_modules"], |
66 | - 'actions'=>array('edit'=>array(108,'edit_module'), 'duplicate'=>array(111,'new_module'), 'remove'=>array(110,'delete_module')), |
|
67 | - 'permissions'=>array('new_module','edit_module'), |
|
66 | + 'actions'=>array('edit'=>array(108, 'edit_module'), 'duplicate'=>array(111, 'new_module'), 'remove'=>array(110, 'delete_module')), |
|
67 | + 'permissions'=>array('new_module', 'edit_module'), |
|
68 | 68 | ); |
69 | 69 | } |
70 | 70 | |
71 | 71 | /** |
72 | 72 | * @return void |
73 | 73 | */ |
74 | - public function queryItemsFromDB() { |
|
75 | - foreach($this->types as $resourceTable=>$type) { |
|
76 | - if($this->hasAnyPermissions($type['permissions'])) { |
|
74 | + public function queryItemsFromDB(){ |
|
75 | + foreach ($this->types as $resourceTable=>$type) { |
|
76 | + if ($this->hasAnyPermissions($type['permissions'])) { |
|
77 | 77 | $nameField = isset($type['name']) ? $type['name'] : 'name'; |
78 | 78 | $this->items[$resourceTable] = $this->queryResources($resourceTable, $nameField); |
79 | 79 | } |
@@ -84,11 +84,11 @@ discard block |
||
84 | 84 | * @param array $permissions |
85 | 85 | * @return bool |
86 | 86 | */ |
87 | - public function hasAnyPermissions($permissions) { |
|
87 | + public function hasAnyPermissions($permissions){ |
|
88 | 88 | global $modx; |
89 | 89 | |
90 | - foreach($permissions as $p) |
|
91 | - if($modx->hasPermission($p)) return true; |
|
90 | + foreach ($permissions as $p) |
|
91 | + if ($modx->hasPermission($p)) return true; |
|
92 | 92 | |
93 | 93 | return false; |
94 | 94 | } |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | * @param string $nameField |
99 | 99 | * @return array|bool |
100 | 100 | */ |
101 | - public function queryResources($resourceTable, $nameField = 'name') { |
|
101 | + public function queryResources($resourceTable, $nameField = 'name'){ |
|
102 | 102 | global $modx, $_lang; |
103 | 103 | |
104 | 104 | $allowed = array( |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | 'site_plugins', |
108 | 108 | 'site_modules' |
109 | 109 | ); |
110 | - $pluginsql = !empty($resourceTable) && in_array($resourceTable, $allowed) ? $resourceTable . '.disabled, ' : ''; |
|
110 | + $pluginsql = !empty($resourceTable) && in_array($resourceTable, $allowed) ? $resourceTable.'.disabled, ' : ''; |
|
111 | 111 | |
112 | 112 | $tvsql = ''; |
113 | 113 | $tvjoin = ''; |
@@ -122,14 +122,14 @@ discard block |
||
122 | 122 | |
123 | 123 | $rs = $modx->db->select( |
124 | 124 | "{$sttfield} {$pluginsql} {$tvsql} {$resourceTable}.{$nameField} as name, {$resourceTable}.id, {$resourceTable}.description, {$resourceTable}.locked, {$selectableTemplates}IF(isnull(categories.category),'{$_lang['no_category']}',categories.category) as category, categories.id as catid", |
125 | - $modx->getFullTableName($resourceTable) . " AS {$resourceTable} |
|
126 | - LEFT JOIN " . $modx->getFullTableName('categories') . " AS categories ON {$resourceTable}.category = categories.id {$tvjoin}", |
|
125 | + $modx->getFullTableName($resourceTable)." AS {$resourceTable} |
|
126 | + LEFT JOIN ".$modx->getFullTableName('categories')." AS categories ON {$resourceTable}.category = categories.id {$tvjoin}", |
|
127 | 127 | "", |
128 | 128 | "category,name" |
129 | 129 | ); |
130 | 130 | $limit = $modx->db->getRecordCount($rs); |
131 | 131 | |
132 | - if($limit < 1) return false; |
|
132 | + if ($limit < 1) return false; |
|
133 | 133 | |
134 | 134 | $result = array(); |
135 | 135 | while ($row = $modx->db->getRow($rs)) { |
@@ -141,9 +141,9 @@ discard block |
||
141 | 141 | /** |
142 | 142 | * @return void |
143 | 143 | */ |
144 | - public function prepareCategoryArrays() { |
|
145 | - foreach($this->items as $type=>$items) { |
|
146 | - foreach((array)$items as $item) { |
|
144 | + public function prepareCategoryArrays(){ |
|
145 | + foreach ($this->items as $type=>$items) { |
|
146 | + foreach ((array) $items as $item) { |
|
147 | 147 | $catid = $item['catid'] ? $item['catid'] : 0; |
148 | 148 | $this->categories[$catid] = $item['category']; |
149 | 149 | |
@@ -156,8 +156,8 @@ discard block |
||
156 | 156 | natcasesort($this->categories); |
157 | 157 | |
158 | 158 | // Now sort by name |
159 | - foreach($this->itemsPerCategory as $catid=>$items) { |
|
160 | - usort($this->itemsPerCategory[$catid], function ($a, $b) { |
|
159 | + foreach ($this->itemsPerCategory as $catid=>$items) { |
|
160 | + usort($this->itemsPerCategory[$catid], function($a, $b){ |
|
161 | 161 | return strcasecmp($a['name'], $b['name']); |
162 | 162 | }); |
163 | 163 | } |
@@ -1,5 +1,5 @@ discard block |
||
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 | if (!$modx->hasPermission('file_manager')) { |
@@ -9,15 +9,15 @@ discard block |
||
9 | 9 | $newToken = makeToken(); |
10 | 10 | |
11 | 11 | // settings |
12 | -$theme_image_path = $modx->config['site_manager_url'] . 'media/style/' . $modx->config['manager_theme'] . '/images/'; |
|
12 | +$theme_image_path = $modx->config['site_manager_url'].'media/style/'.$modx->config['manager_theme'].'/images/'; |
|
13 | 13 | $excludes = array( |
14 | 14 | '.', |
15 | 15 | '..', |
16 | 16 | '.svn' |
17 | 17 | ); |
18 | -$alias_suffix = (!empty($friendly_url_suffix)) ? ',' . ltrim($friendly_url_suffix, '.') : ''; |
|
19 | -$editablefiles = explode(',', 'txt,php,tpl,less,sass,shtml,html,htm,xml,js,css,pageCache,htaccess,json' . $alias_suffix); |
|
20 | -$inlineviewablefiles = explode(',', 'txt,php,tpl,less,sass,html,htm,xml,js,css,pageCache,htaccess,json' . $alias_suffix); |
|
18 | +$alias_suffix = (!empty($friendly_url_suffix)) ? ','.ltrim($friendly_url_suffix, '.') : ''; |
|
19 | +$editablefiles = explode(',', 'txt,php,tpl,less,sass,shtml,html,htm,xml,js,css,pageCache,htaccess,json'.$alias_suffix); |
|
20 | +$inlineviewablefiles = explode(',', 'txt,php,tpl,less,sass,html,htm,xml,js,css,pageCache,htaccess,json'.$alias_suffix); |
|
21 | 21 | $viewablefiles = explode(',', 'jpg,gif,png,ico'); |
22 | 22 | |
23 | 23 | $editablefiles = add_dot($editablefiles); |
@@ -30,31 +30,31 @@ discard block |
||
30 | 30 | { |
31 | 31 | */ |
32 | 32 | $protected_path[] = $modx->config['site_manager_path']; |
33 | -$protected_path[] = $modx->config['base_path'] . 'temp/backup'; |
|
34 | -$protected_path[] = $modx->config['base_path'] . 'assets/backup'; |
|
33 | +$protected_path[] = $modx->config['base_path'].'temp/backup'; |
|
34 | +$protected_path[] = $modx->config['base_path'].'assets/backup'; |
|
35 | 35 | |
36 | 36 | if (!$modx->hasPermission('save_plugin')) { |
37 | - $protected_path[] = $modx->config['base_path'] . 'assets/plugins'; |
|
37 | + $protected_path[] = $modx->config['base_path'].'assets/plugins'; |
|
38 | 38 | } |
39 | 39 | if (!$modx->hasPermission('save_snippet')) { |
40 | - $protected_path[] = $modx->config['base_path'] . 'assets/snippets'; |
|
40 | + $protected_path[] = $modx->config['base_path'].'assets/snippets'; |
|
41 | 41 | } |
42 | 42 | if (!$modx->hasPermission('save_template')) { |
43 | - $protected_path[] = $modx->config['base_path'] . 'assets/templates'; |
|
43 | + $protected_path[] = $modx->config['base_path'].'assets/templates'; |
|
44 | 44 | } |
45 | 45 | if (!$modx->hasPermission('save_module')) { |
46 | - $protected_path[] = $modx->config['base_path'] . 'assets/modules'; |
|
46 | + $protected_path[] = $modx->config['base_path'].'assets/modules'; |
|
47 | 47 | } |
48 | 48 | if (!$modx->hasPermission('empty_cache')) { |
49 | - $protected_path[] = $modx->config['base_path'] . 'assets/cache'; |
|
49 | + $protected_path[] = $modx->config['base_path'].'assets/cache'; |
|
50 | 50 | } |
51 | 51 | if (!$modx->hasPermission('import_static')) { |
52 | - $protected_path[] = $modx->config['base_path'] . 'temp/import'; |
|
53 | - $protected_path[] = $modx->config['base_path'] . 'assets/import'; |
|
52 | + $protected_path[] = $modx->config['base_path'].'temp/import'; |
|
53 | + $protected_path[] = $modx->config['base_path'].'assets/import'; |
|
54 | 54 | } |
55 | 55 | if (!$modx->hasPermission('export_static')) { |
56 | - $protected_path[] = $modx->config['base_path'] . 'temp/export'; |
|
57 | - $protected_path[] = $modx->config['base_path'] . 'assets/export'; |
|
56 | + $protected_path[] = $modx->config['base_path'].'temp/export'; |
|
57 | + $protected_path[] = $modx->config['base_path'].'assets/export'; |
|
58 | 58 | } |
59 | 59 | /* |
60 | 60 | } |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | { |
84 | 84 | $count = count($array); |
85 | 85 | for ($i = 0; $i < $count; $i++) { |
86 | - $array[$i] = '.' . strtolower(trim($array[$i])); // add a dot :) |
|
86 | + $array[$i] = '.'.strtolower(trim($array[$i])); // add a dot :) |
|
87 | 87 | } |
88 | 88 | return $array; |
89 | 89 | } |
@@ -108,15 +108,15 @@ discard block |
||
108 | 108 | $rw = realpath('../'); |
109 | 109 | $webstart_path = str_replace('\\', '/', str_replace($rw, '', $rf)); |
110 | 110 | if (substr($webstart_path, 0, 1) == '/') { |
111 | - $webstart_path = '..' . $webstart_path; |
|
111 | + $webstart_path = '..'.$webstart_path; |
|
112 | 112 | } else { |
113 | - $webstart_path = '../' . $webstart_path; |
|
113 | + $webstart_path = '../'.$webstart_path; |
|
114 | 114 | } |
115 | 115 | |
116 | 116 | ?> |
117 | 117 | <script type="text/javascript"> |
118 | 118 | |
119 | - var current_path = '<?= $startpath;?>'; |
|
119 | + var current_path = '<?= $startpath; ?>'; |
|
120 | 120 | |
121 | 121 | function viewfile (url) |
122 | 122 | { |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | function unzipFile (file) |
153 | 153 | { |
154 | 154 | if (confirmUnzip()) { |
155 | - window.location.href = "index.php?a=31&mode=unzip&path=" + current_path + '/&file=' + file + "&token=<?= $newToken;?>"; |
|
155 | + window.location.href = "index.php?a=31&mode=unzip&path=" + current_path + '/&file=' + file + "&token=<?= $newToken; ?>"; |
|
156 | 156 | return false; |
157 | 157 | } |
158 | 158 | } |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | function deleteFolder (folder, status) |
175 | 175 | { |
176 | 176 | if (confirmDeleteFolder(status)) { |
177 | - window.location.href = "index.php?a=31&mode=deletefolder&path=" + current_path + "&folderpath=" + current_path + '/' + folder + "&token=<?= $newToken;?>"; |
|
177 | + window.location.href = "index.php?a=31&mode=deletefolder&path=" + current_path + "&folderpath=" + current_path + '/' + folder + "&token=<?= $newToken; ?>"; |
|
178 | 178 | return false; |
179 | 179 | } |
180 | 180 | } |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | function deleteFile (file) |
183 | 183 | { |
184 | 184 | if (confirmDelete()) { |
185 | - window.location.href = "index.php?a=31&mode=delete&path=" + current_path + '/' + file + "&token=<?= $newToken;?>"; |
|
185 | + window.location.href = "index.php?a=31&mode=delete&path=" + current_path + '/' + file + "&token=<?= $newToken; ?>"; |
|
186 | 186 | return false; |
187 | 187 | } |
188 | 188 | } |
@@ -191,7 +191,7 @@ discard block |
||
191 | 191 | { |
192 | 192 | var newFilename = prompt("<?= $_lang["files_dynamic_new_file_name"] ?>", file); |
193 | 193 | if (newFilename !== null && newFilename !== file) { |
194 | - window.location.href = "index.php?a=31&mode=duplicate&path=" + current_path + '/' + file + "&newFilename=" + newFilename + "&token=<?= $newToken;?>"; |
|
194 | + window.location.href = "index.php?a=31&mode=duplicate&path=" + current_path + '/' + file + "&newFilename=" + newFilename + "&token=<?= $newToken; ?>"; |
|
195 | 195 | } |
196 | 196 | } |
197 | 197 | |
@@ -199,7 +199,7 @@ discard block |
||
199 | 199 | { |
200 | 200 | var newDirname = prompt("<?= $_lang["files_dynamic_new_folder_name"] ?>", dir); |
201 | 201 | if (newDirname !== null && newDirname !== dir) { |
202 | - window.location.href = "index.php?a=31&mode=renameFolder&path=" + current_path + '&dirname=' + dir + "&newDirname=" + newDirname + "&token=<?= $newToken;?>"; |
|
202 | + window.location.href = "index.php?a=31&mode=renameFolder&path=" + current_path + '&dirname=' + dir + "&newDirname=" + newDirname + "&token=<?= $newToken; ?>"; |
|
203 | 203 | } |
204 | 204 | } |
205 | 205 | |
@@ -207,7 +207,7 @@ discard block |
||
207 | 207 | { |
208 | 208 | var newFilename = prompt("<?= $_lang["files_dynamic_new_file_name"] ?>", file); |
209 | 209 | if (newFilename !== null && newFilename !== file) { |
210 | - window.location.href = "index.php?a=31&mode=renameFile&path=" + current_path + '/' + file + "&newFilename=" + newFilename + "&token=<?= $newToken;?>"; |
|
210 | + window.location.href = "index.php?a=31&mode=renameFile&path=" + current_path + '/' + file + "&newFilename=" + newFilename + "&token=<?= $newToken; ?>"; |
|
211 | 211 | } |
212 | 212 | } |
213 | 213 | |
@@ -226,7 +226,7 @@ discard block |
||
226 | 226 | <?php endif ?> |
227 | 227 | <?php |
228 | 228 | if (isset($_GET['mode']) && $_GET['mode'] !== 'drill') { |
229 | - $href = 'a=31&path=' . urlencode($_REQUEST['path']); |
|
229 | + $href = 'a=31&path='.urlencode($_REQUEST['path']); |
|
230 | 230 | } else { |
231 | 231 | $href = 'a=2'; |
232 | 232 | } |
@@ -236,12 +236,12 @@ discard block |
||
236 | 236 | $tpl = '<a class="btn btn-secondary" href="[+href+]" onclick="return getFolderName(this);"><i class="[+image+]"></i><span>[+subject+]</span></a>'; |
237 | 237 | $ph['image'] = $_style['files_folder-open']; |
238 | 238 | $ph['subject'] = $_lang['add_folder']; |
239 | - $ph['href'] = 'index.php?a=31&mode=newfolder&path=' . urlencode($startpath) . '&name='; |
|
239 | + $ph['href'] = 'index.php?a=31&mode=newfolder&path='.urlencode($startpath).'&name='; |
|
240 | 240 | $_ = parsePlaceholder($tpl, $ph); |
241 | 241 | |
242 | - $tpl = '<a class="btn btn-secondary" href="[+href+]" onclick="return getFileName(this);"><i class="[+image+]"></i><span>' . $_lang['files.dynamic.php1'] . '</span></a>'; |
|
242 | + $tpl = '<a class="btn btn-secondary" href="[+href+]" onclick="return getFileName(this);"><i class="[+image+]"></i><span>'.$_lang['files.dynamic.php1'].'</span></a>'; |
|
243 | 243 | $ph['image'] = $_style['files_page_html']; |
244 | - $ph['href'] = 'index.php?a=31&mode=newfile&path=' . urlencode($startpath) . '&name='; |
|
244 | + $ph['href'] = 'index.php?a=31&mode=newfile&path='.urlencode($startpath).'&name='; |
|
245 | 245 | $_ .= parsePlaceholder($tpl, $ph); |
246 | 246 | echo $_; |
247 | 247 | } |
@@ -271,12 +271,12 @@ discard block |
||
271 | 271 | $ph = array(); |
272 | 272 | $ph['style_path'] = $theme_image_path; |
273 | 273 | // To Top Level with folder icon to the left |
274 | - if ($startpath == $filemanager_path || $startpath . '/' == $filemanager_path) { |
|
275 | - $ph['image'] = '' . $_style['files_top'] . ''; |
|
274 | + if ($startpath == $filemanager_path || $startpath.'/' == $filemanager_path) { |
|
275 | + $ph['image'] = ''.$_style['files_top'].''; |
|
276 | 276 | $ph['subject'] = '<span>Top</span>'; |
277 | 277 | } else { |
278 | - $ph['image'] = '' . $_style['files_top'] . ''; |
|
279 | - $ph['subject'] = '<a href="index.php?a=31&mode=drill&path=' . $filemanager_path . '">Top</a>/'; |
|
278 | + $ph['image'] = ''.$_style['files_top'].''; |
|
279 | + $ph['subject'] = '<a href="index.php?a=31&mode=drill&path='.$filemanager_path.'">Top</a>/'; |
|
280 | 280 | } |
281 | 281 | |
282 | 282 | echo parsePlaceholder($tpl, $ph); |
@@ -293,12 +293,12 @@ discard block |
||
293 | 293 | if (empty($v)) { |
294 | 294 | continue; |
295 | 295 | } |
296 | - $path .= rtrim($v, '/') . '/'; |
|
296 | + $path .= rtrim($v, '/').'/'; |
|
297 | 297 | if (1 < $count) { |
298 | - $href = 'index.php?a=31&mode=drill&path=' . urlencode($filemanager_path . $path); |
|
299 | - $pieces[$i] = '<a href="' . $href . '">' . trim($v, '/') . '</a>'; |
|
298 | + $href = 'index.php?a=31&mode=drill&path='.urlencode($filemanager_path.$path); |
|
299 | + $pieces[$i] = '<a href="'.$href.'">'.trim($v, '/').'</a>'; |
|
300 | 300 | } else { |
301 | - $pieces[$i] = '<span>' . trim($v, '/') . '</span>'; |
|
301 | + $pieces[$i] = '<span>'.trim($v, '/').'</span>'; |
|
302 | 302 | } |
303 | 303 | $count--; |
304 | 304 | } |
@@ -311,16 +311,16 @@ discard block |
||
311 | 311 | </div> |
312 | 312 | <?php |
313 | 313 | // check to see user isn't trying to move below the document_root |
314 | - if (substr(strtolower(str_replace('//', '/', $startpath . "/")), 0, $len) != strtolower(str_replace('//', '/', $filemanager_path . '/'))) { |
|
314 | + if (substr(strtolower(str_replace('//', '/', $startpath."/")), 0, $len) != strtolower(str_replace('//', '/', $filemanager_path.'/'))) { |
|
315 | 315 | $modx->webAlertAndQuit($_lang["files_access_denied"]); |
316 | 316 | } |
317 | 317 | |
318 | 318 | // Unzip .zip files - by Raymond |
319 | 319 | if ($enablefileunzip && $_REQUEST['mode'] == 'unzip' && is_writable($startpath)) { |
320 | - if (!$err = unzip(realpath("{$startpath}/" . $_REQUEST['file']), realpath($startpath))) { |
|
321 | - echo '<span class="warning"><b>' . $_lang['file_unzip_fail'] . ($err === 0 ? 'Missing zip library (php_zip.dll / zip.so)' : '') . '</b></span><br /><br />'; |
|
320 | + if (!$err = unzip(realpath("{$startpath}/".$_REQUEST['file']), realpath($startpath))) { |
|
321 | + echo '<span class="warning"><b>'.$_lang['file_unzip_fail'].($err === 0 ? 'Missing zip library (php_zip.dll / zip.so)' : '').'</b></span><br /><br />'; |
|
322 | 322 | } else { |
323 | - echo '<span class="success"><b>' . $_lang['file_unzip'] . '</b></span><br /><br />'; |
|
323 | + echo '<span class="success"><b>'.$_lang['file_unzip'].'</b></span><br /><br />'; |
|
324 | 324 | } |
325 | 325 | } |
326 | 326 | // End Unzip - Raymond |
@@ -332,9 +332,9 @@ discard block |
||
332 | 332 | if ($_REQUEST['mode'] == 'deletefolder') { |
333 | 333 | $folder = $_REQUEST['folderpath']; |
334 | 334 | if (!$token_check || !@rrmdir($folder)) { |
335 | - echo '<span class="warning"><b>' . $_lang['file_folder_not_deleted'] . '</b></span><br /><br />'; |
|
335 | + echo '<span class="warning"><b>'.$_lang['file_folder_not_deleted'].'</b></span><br /><br />'; |
|
336 | 336 | } else { |
337 | - echo '<span class="success"><b>' . $_lang['file_folder_deleted'] . '</b></span><br /><br />'; |
|
337 | + echo '<span class="success"><b>'.$_lang['file_folder_deleted'].'</b></span><br /><br />'; |
|
338 | 338 | } |
339 | 339 | } |
340 | 340 | |
@@ -345,10 +345,10 @@ discard block |
||
345 | 345 | if (!mkdirs("{$startpath}/{$foldername}", 0777)) { |
346 | 346 | echo '<span class="warning"><b>', $_lang['file_folder_not_created'], '</b></span><br /><br />'; |
347 | 347 | } else { |
348 | - if (!@chmod($startpath . '/' . $foldername, $newfolderaccessmode)) { |
|
349 | - echo '<span class="warning"><b>' . $_lang['file_folder_chmod_error'] . '</b></span><br /><br />'; |
|
348 | + if (!@chmod($startpath.'/'.$foldername, $newfolderaccessmode)) { |
|
349 | + echo '<span class="warning"><b>'.$_lang['file_folder_chmod_error'].'</b></span><br /><br />'; |
|
350 | 350 | } else { |
351 | - echo '<span class="success"><b>' . $_lang['file_folder_created'] . '</b></span><br /><br />'; |
|
351 | + echo '<span class="success"><b>'.$_lang['file_folder_created'].'</b></span><br /><br />'; |
|
352 | 352 | } |
353 | 353 | } |
354 | 354 | umask($old_umask); |
@@ -360,7 +360,7 @@ discard block |
||
360 | 360 | $filename = $modx->db->escape($filename); |
361 | 361 | |
362 | 362 | if (!checkExtension($filename)) { |
363 | - echo '<span class="warning"><b>' . $_lang['files_filetype_notok'] . '</b></span><br /><br />'; |
|
363 | + echo '<span class="warning"><b>'.$_lang['files_filetype_notok'].'</b></span><br /><br />'; |
|
364 | 364 | } elseif (preg_match('@(\\\\|\/|\:|\;|\,|\*|\?|\"|\<|\>|\||\?)@', $filename) !== 0) { |
365 | 365 | echo $_lang['files.dynamic.php3']; |
366 | 366 | } else { |
@@ -382,11 +382,11 @@ discard block |
||
382 | 382 | $newFilename = $modx->db->escape($newFilename); |
383 | 383 | |
384 | 384 | if (!checkExtension($newFilename)) { |
385 | - echo '<span class="warning"><b>' . $_lang['files_filetype_notok'] . '</b></span><br /><br />'; |
|
385 | + echo '<span class="warning"><b>'.$_lang['files_filetype_notok'].'</b></span><br /><br />'; |
|
386 | 386 | } elseif (preg_match('@(\\\\|\/|\:|\;|\,|\*|\?|\"|\<|\>|\||\?)@', $newFilename) !== 0) { |
387 | 387 | echo $_lang['files.dynamic.php3']; |
388 | 388 | } else { |
389 | - if (!copy($filename, MODX_BASE_PATH . $newFilename)) { |
|
389 | + if (!copy($filename, MODX_BASE_PATH.$newFilename)) { |
|
390 | 390 | echo $_lang['files.dynamic.php5']; |
391 | 391 | } |
392 | 392 | umask($old_umask); |
@@ -395,7 +395,7 @@ discard block |
||
395 | 395 | // Rename folder here |
396 | 396 | if ($_REQUEST['mode'] == 'renameFolder') { |
397 | 397 | $old_umask = umask(0); |
398 | - $dirname = $_REQUEST['path'] . '/' . $_REQUEST['dirname']; |
|
398 | + $dirname = $_REQUEST['path'].'/'.$_REQUEST['dirname']; |
|
399 | 399 | $dirname = $modx->db->escape($dirname); |
400 | 400 | $newDirname = str_replace(array( |
401 | 401 | '..\\', |
@@ -407,7 +407,7 @@ discard block |
||
407 | 407 | |
408 | 408 | if (preg_match('@(\\\\|\/|\:|\;|\,|\*|\?|\"|\<|\>|\||\?)@', $newDirname) !== 0) { |
409 | 409 | echo $_lang['files.dynamic.php3']; |
410 | - } else if (!rename($dirname, $_REQUEST['path'] . '/' . $newDirname)) { |
|
410 | + } else if (!rename($dirname, $_REQUEST['path'].'/'.$newDirname)) { |
|
411 | 411 | echo '<span class="warning"><b>', $_lang['file_folder_not_created'], '</b></span><br /><br />'; |
412 | 412 | } |
413 | 413 | umask($old_umask); |
@@ -427,11 +427,11 @@ discard block |
||
427 | 427 | $newFilename = $modx->db->escape($newFilename); |
428 | 428 | |
429 | 429 | if (!checkExtension($newFilename)) { |
430 | - echo '<span class="warning"><b>' . $_lang['files_filetype_notok'] . '</b></span><br /><br />'; |
|
430 | + echo '<span class="warning"><b>'.$_lang['files_filetype_notok'].'</b></span><br /><br />'; |
|
431 | 431 | } elseif (preg_match('@(\\\\|\/|\:|\;|\,|\*|\?|\"|\<|\>|\||\?)@', $newFilename) !== 0) { |
432 | 432 | echo $_lang['files.dynamic.php3']; |
433 | 433 | } else { |
434 | - if (!rename($filename, $path . '/' . $newFilename)) { |
|
434 | + if (!rename($filename, $path.'/'.$newFilename)) { |
|
435 | 435 | echo $_lang['files.dynamic.php5']; |
436 | 436 | } |
437 | 437 | umask($old_umask); |
@@ -464,7 +464,7 @@ discard block |
||
464 | 464 | ls($startpath); |
465 | 465 | echo "\n\n\n"; |
466 | 466 | if ($folders == 0 && $files == 0) { |
467 | - echo '<tr><td colspan="4"><i class="' . $_style['files_deleted_folder'] . ' FilesDeletedFolder"></i> <span style="color:#888;cursor:default;"> ' . $_lang['files_directory_is_empty'] . ' </span></td></tr>'; |
|
467 | + echo '<tr><td colspan="4"><i class="'.$_style['files_deleted_folder'].' FilesDeletedFolder"></i> <span style="color:#888;cursor:default;"> '.$_lang['files_directory_is_empty'].' </span></td></tr>'; |
|
468 | 468 | } |
469 | 469 | ?> |
470 | 470 | </table> |
@@ -473,10 +473,10 @@ discard block |
||
473 | 473 | <div class="container"> |
474 | 474 | <p> |
475 | 475 | <?php |
476 | - echo $_lang['files_directories'] . ': <b>' . $folders . '</b> '; |
|
477 | - echo $_lang['files_files'] . ': <b>' . $files . '</b> '; |
|
478 | - echo $_lang['files_data'] . ': <b><span dir="ltr">' . $modx->nicesize($filesizes) . '</span></b> '; |
|
479 | - echo $_lang['files_dirwritable'] . ' <b>' . (is_writable($startpath) == 1 ? $_lang['yes'] . '.' : $_lang['no']) . '.</b>' |
|
476 | + echo $_lang['files_directories'].': <b>'.$folders.'</b> '; |
|
477 | + echo $_lang['files_files'].': <b>'.$files.'</b> '; |
|
478 | + echo $_lang['files_data'].': <b><span dir="ltr">'.$modx->nicesize($filesizes).'</span></b> '; |
|
479 | + echo $_lang['files_dirwritable'].' <b>'.(is_writable($startpath) == 1 ? $_lang['yes'].'.' : $_lang['no']).'.</b>' |
|
480 | 480 | ?> |
481 | 481 | </p> |
482 | 482 | |
@@ -501,7 +501,7 @@ discard block |
||
501 | 501 | </form> |
502 | 502 | <?php |
503 | 503 | } else { |
504 | - echo "<p>" . $_lang['files_upload_inhibited_msg'] . "</p>"; |
|
504 | + echo "<p>".$_lang['files_upload_inhibited_msg']."</p>"; |
|
505 | 505 | } |
506 | 506 | ?> |
507 | 507 | <div id="imageviewer"></div> |
@@ -586,7 +586,7 @@ discard block |
||
586 | 586 | if ($file == $selFile) { |
587 | 587 | $icon = isset($icons[$mode]) ? $icons[$mode] : $icons['default']; |
588 | 588 | } |
589 | - return '<i class="' . $icon . ' FilesPage"></i>'; |
|
589 | + return '<i class="'.$icon.' FilesPage"></i>'; |
|
590 | 590 | } |
591 | 591 | |
592 | 592 | /** |
@@ -604,7 +604,7 @@ discard block |
||
604 | 604 | ); |
605 | 605 | if ($file == $selFile) { |
606 | 606 | $class = isset($classNames[$mode]) ? $classNames[$mode] : $classNames['default']; |
607 | - return ' class="' . $class . '"'; |
|
607 | + return ' class="'.$class.'"'; |
|
608 | 608 | } |
609 | 609 | return ''; |
610 | 610 | } |
@@ -618,7 +618,7 @@ discard block |
||
618 | 618 | global $excludes, $protected_path, $editablefiles, $inlineviewablefiles, $viewablefiles, $enablefileunzip, $enablefiledownload, $uploadablefiles, $folders, $files, $filesizes, $len, $dirs_array, $files_array, $webstart_path, $modx; |
619 | 619 | $dircounter = 0; |
620 | 620 | $filecounter = 0; |
621 | - $curpath = str_replace('//', '/', $curpath . '/'); |
|
621 | + $curpath = str_replace('//', '/', $curpath.'/'); |
|
622 | 622 | |
623 | 623 | if (!is_dir($curpath)) { |
624 | 624 | echo 'Invalid path "', $curpath, '"<br />'; |
@@ -628,7 +628,7 @@ discard block |
||
628 | 628 | |
629 | 629 | // first, get info |
630 | 630 | foreach ($dir as $file) { |
631 | - $newpath = $curpath . $file; |
|
631 | + $newpath = $curpath.$file; |
|
632 | 632 | if ($file === '..' || $file === '.') { |
633 | 633 | continue; |
634 | 634 | } |
@@ -638,7 +638,7 @@ discard block |
||
638 | 638 | if ($file === '..' || $file === '.') { |
639 | 639 | continue; |
640 | 640 | } elseif (!in_array($file, $excludes) && !in_array($newpath, $protected_path)) { |
641 | - $dirs_array[$dircounter]['text'] = '<i class="' . $_style['files_folder'] . ' FilesFolder"></i> <a href="index.php?a=31&mode=drill&path=' . urlencode($newpath) . '"><b>' . $file . '</b></a>'; |
|
641 | + $dirs_array[$dircounter]['text'] = '<i class="'.$_style['files_folder'].' FilesFolder"></i> <a href="index.php?a=31&mode=drill&path='.urlencode($newpath).'"><b>'.$file.'</b></a>'; |
|
642 | 642 | |
643 | 643 | $dfiles = scandir($newpath); |
644 | 644 | foreach ($dfiles as $i => $infile) { |
@@ -651,13 +651,13 @@ discard block |
||
651 | 651 | } |
652 | 652 | $file_exists = (0 < count($dfiles)) ? 'file_exists' : ''; |
653 | 653 | |
654 | - $dirs_array[$dircounter]['delete'] = is_writable($curpath) ? '<a href="javascript: deleteFolder(\'' . urlencode($file) . '\',\'' . $file_exists . '\');"><i class="' . $_style['files_delete'] . '" title="' . $_lang['file_delete_folder'] . '"></i></a>' : ''; |
|
654 | + $dirs_array[$dircounter]['delete'] = is_writable($curpath) ? '<a href="javascript: deleteFolder(\''.urlencode($file).'\',\''.$file_exists.'\');"><i class="'.$_style['files_delete'].'" title="'.$_lang['file_delete_folder'].'"></i></a>' : ''; |
|
655 | 655 | } else { |
656 | - $dirs_array[$dircounter]['text'] = '<span><i class="' . $_style['files_deleted_folder'] . ' FilesDeletedFolder"></i> ' . $file . '</span>'; |
|
657 | - $dirs_array[$dircounter]['delete'] = is_writable($curpath) ? '<span class="disabled"><i class="' . $_style['files_delete'] . '" title="' . $_lang['file_delete_folder'] . '"></i></span>' : ''; |
|
656 | + $dirs_array[$dircounter]['text'] = '<span><i class="'.$_style['files_deleted_folder'].' FilesDeletedFolder"></i> '.$file.'</span>'; |
|
657 | + $dirs_array[$dircounter]['delete'] = is_writable($curpath) ? '<span class="disabled"><i class="'.$_style['files_delete'].'" title="'.$_lang['file_delete_folder'].'"></i></span>' : ''; |
|
658 | 658 | } |
659 | 659 | |
660 | - $dirs_array[$dircounter]['rename'] = is_writable($curpath) ? '<a href="javascript:renameFolder(\'' . urlencode($file) . '\');"><i class="' . $_style['files_rename'] . '" title="' . $_lang['rename'] . '"></i></a> ' : ''; |
|
660 | + $dirs_array[$dircounter]['rename'] = is_writable($curpath) ? '<a href="javascript:renameFolder(\''.urlencode($file).'\');"><i class="'.$_style['files_rename'].'" title="'.$_lang['rename'].'"></i></a> ' : ''; |
|
661 | 661 | |
662 | 662 | // increment the counter |
663 | 663 | $dircounter++; |
@@ -665,14 +665,14 @@ discard block |
||
665 | 665 | $type = getExtension($newpath); |
666 | 666 | $files_array[$filecounter]['file'] = $newpath; |
667 | 667 | $files_array[$filecounter]['stats'] = lstat($newpath); |
668 | - $files_array[$filecounter]['text'] = determineIcon($newpath, $_REQUEST['path'], $_REQUEST['mode']) . ' ' . $file; |
|
669 | - $files_array[$filecounter]['view'] = (in_array($type, $viewablefiles)) ? '<a href="javascript:;" onclick="viewfile(\'' . $webstart_path . substr($newpath, $len, strlen($newpath)) . '\');"><i class="' . $_style['files_view'] . '" title="' . $_lang['files_viewfile'] . '"></i></a>' : (($enablefiledownload && in_array($type, $uploadablefiles)) ? '<a href="' . $webstart_path . implode('/', array_map('rawurlencode', explode('/', substr($newpath, $len, strlen($newpath))))) . '" style="cursor:pointer;"><i class="' . $_style['files_download'] . '" title="' . $_lang['file_download_file'] . '"></i></a>' : '<span class="disabled"><i class="' . $_style['files_view'] . '" title="' . $_lang['files_viewfile'] . '"></i></span>'); |
|
670 | - $files_array[$filecounter]['view'] = (in_array($type, $inlineviewablefiles)) ? '<a href="index.php?a=31&mode=view&path=' . urlencode($newpath) . '"><i class="' . $_style['files_view'] . '" title="' . $_lang['files_viewfile'] . '"></i></a>' : $files_array[$filecounter]['view']; |
|
671 | - $files_array[$filecounter]['unzip'] = ($enablefileunzip && $type == '.zip') ? '<a href="javascript:unzipFile(\'' . urlencode($file) . '\');"><i class="' . $_style['files_unzip'] . '" title="' . $_lang['file_download_unzip'] . '"></i></a>' : ''; |
|
672 | - $files_array[$filecounter]['edit'] = (in_array($type, $editablefiles) && is_writable($curpath) && is_writable($newpath)) ? '<a href="index.php?a=31&mode=edit&path=' . urlencode($newpath) . '#file_editfile"><i class="' . $_style['files_edit'] . '" title="' . $_lang['files_editfile'] . '"></i></a>' : '<span class="disabled"><i class="' . $_style['files_edit'] . '" title="' . $_lang['files_editfile'] . '"></i></span>'; |
|
673 | - $files_array[$filecounter]['duplicate'] = (in_array($type, $editablefiles) && is_writable($curpath) && is_writable($newpath)) ? '<a href="javascript:duplicateFile(\'' . urlencode($file) . '\');"><i class="' . $_style['files_duplicate'] . '" title="' . $_lang['duplicate'] . '"></i></a>' : '<span class="disabled"><i class="' . $_style['files_duplicate'] . '" align="absmiddle" title="' . $_lang['duplicate'] . '"></i></span>'; |
|
674 | - $files_array[$filecounter]['rename'] = (in_array($type, $editablefiles) && is_writable($curpath) && is_writable($newpath)) ? '<a href="javascript:renameFile(\'' . urlencode($file) . '\');"><i class="' . $_style['files_rename'] . '" align="absmiddle" title="' . $_lang['rename'] . '"></i></a>' : '<span class="disabled"><i class="' . $_style['files_rename'] . '" align="absmiddle" title="' . $_lang['rename'] . '"></i></span>'; |
|
675 | - $files_array[$filecounter]['delete'] = is_writable($curpath) && is_writable($newpath) ? '<a href="javascript:deleteFile(\'' . urlencode($file) . '\');"><i class="' . $_style['files_delete'] . '" title="' . $_lang['file_delete_file'] . '"></i></a>' : '<span class="disabled"><i class="' . $_style['files_delete'] . '" title="' . $_lang['file_delete_file'] . '"></i></span>'; |
|
668 | + $files_array[$filecounter]['text'] = determineIcon($newpath, $_REQUEST['path'], $_REQUEST['mode']).' '.$file; |
|
669 | + $files_array[$filecounter]['view'] = (in_array($type, $viewablefiles)) ? '<a href="javascript:;" onclick="viewfile(\''.$webstart_path.substr($newpath, $len, strlen($newpath)).'\');"><i class="'.$_style['files_view'].'" title="'.$_lang['files_viewfile'].'"></i></a>' : (($enablefiledownload && in_array($type, $uploadablefiles)) ? '<a href="'.$webstart_path.implode('/', array_map('rawurlencode', explode('/', substr($newpath, $len, strlen($newpath))))).'" style="cursor:pointer;"><i class="'.$_style['files_download'].'" title="'.$_lang['file_download_file'].'"></i></a>' : '<span class="disabled"><i class="'.$_style['files_view'].'" title="'.$_lang['files_viewfile'].'"></i></span>'); |
|
670 | + $files_array[$filecounter]['view'] = (in_array($type, $inlineviewablefiles)) ? '<a href="index.php?a=31&mode=view&path='.urlencode($newpath).'"><i class="'.$_style['files_view'].'" title="'.$_lang['files_viewfile'].'"></i></a>' : $files_array[$filecounter]['view']; |
|
671 | + $files_array[$filecounter]['unzip'] = ($enablefileunzip && $type == '.zip') ? '<a href="javascript:unzipFile(\''.urlencode($file).'\');"><i class="'.$_style['files_unzip'].'" title="'.$_lang['file_download_unzip'].'"></i></a>' : ''; |
|
672 | + $files_array[$filecounter]['edit'] = (in_array($type, $editablefiles) && is_writable($curpath) && is_writable($newpath)) ? '<a href="index.php?a=31&mode=edit&path='.urlencode($newpath).'#file_editfile"><i class="'.$_style['files_edit'].'" title="'.$_lang['files_editfile'].'"></i></a>' : '<span class="disabled"><i class="'.$_style['files_edit'].'" title="'.$_lang['files_editfile'].'"></i></span>'; |
|
673 | + $files_array[$filecounter]['duplicate'] = (in_array($type, $editablefiles) && is_writable($curpath) && is_writable($newpath)) ? '<a href="javascript:duplicateFile(\''.urlencode($file).'\');"><i class="'.$_style['files_duplicate'].'" title="'.$_lang['duplicate'].'"></i></a>' : '<span class="disabled"><i class="'.$_style['files_duplicate'].'" align="absmiddle" title="'.$_lang['duplicate'].'"></i></span>'; |
|
674 | + $files_array[$filecounter]['rename'] = (in_array($type, $editablefiles) && is_writable($curpath) && is_writable($newpath)) ? '<a href="javascript:renameFile(\''.urlencode($file).'\');"><i class="'.$_style['files_rename'].'" align="absmiddle" title="'.$_lang['rename'].'"></i></a>' : '<span class="disabled"><i class="'.$_style['files_rename'].'" align="absmiddle" title="'.$_lang['rename'].'"></i></span>'; |
|
675 | + $files_array[$filecounter]['delete'] = is_writable($curpath) && is_writable($newpath) ? '<a href="javascript:deleteFile(\''.urlencode($file).'\');"><i class="'.$_style['files_delete'].'" title="'.$_lang['file_delete_file'].'"></i></a>' : '<span class="disabled"><i class="'.$_style['files_delete'].'" title="'.$_lang['file_delete_file'].'"></i></span>'; |
|
676 | 676 | |
677 | 677 | // increment the counter |
678 | 678 | $filecounter++; |
@@ -685,9 +685,9 @@ discard block |
||
685 | 685 | for ($i = 0; $i < $folders; $i++) { |
686 | 686 | $filesizes += $dirs_array[$i]['stats']['7']; |
687 | 687 | echo '<tr>'; |
688 | - echo '<td>' . $dirs_array[$i]['text'] . '</td>'; |
|
689 | - echo '<td class="text-nowrap">' . $modx->toDateFormat($dirs_array[$i]['stats']['9']) . '</td>'; |
|
690 | - echo '<td class="text-right">' . $modx->nicesize($dirs_array[$i]['stats']['7']) . '</td>'; |
|
688 | + echo '<td>'.$dirs_array[$i]['text'].'</td>'; |
|
689 | + echo '<td class="text-nowrap">'.$modx->toDateFormat($dirs_array[$i]['stats']['9']).'</td>'; |
|
690 | + echo '<td class="text-right">'.$modx->nicesize($dirs_array[$i]['stats']['7']).'</td>'; |
|
691 | 691 | echo '<td class="actions text-right">'; |
692 | 692 | echo $dirs_array[$i]['rename']; |
693 | 693 | echo $dirs_array[$i]['delete']; |
@@ -700,10 +700,10 @@ discard block |
||
700 | 700 | sort($files_array); // sorting the array alphabetically (Thanks pxl8r!) |
701 | 701 | for ($i = 0; $i < $files; $i++) { |
702 | 702 | $filesizes += $files_array[$i]['stats']['7']; |
703 | - echo '<tr ' . markRow($files_array[$i]['file'], $_REQUEST['path'], $_REQUEST['mode']) . '>'; |
|
704 | - echo '<td>' . $files_array[$i]['text'] . '</td>'; |
|
705 | - echo '<td class="text-nowrap">' . $modx->toDateFormat($files_array[$i]['stats']['9']) . '</td>'; |
|
706 | - echo '<td class="text-right">' . $modx->nicesize($files_array[$i]['stats']['7']) . '</td>'; |
|
703 | + echo '<tr '.markRow($files_array[$i]['file'], $_REQUEST['path'], $_REQUEST['mode']).'>'; |
|
704 | + echo '<td>'.$files_array[$i]['text'].'</td>'; |
|
705 | + echo '<td class="text-nowrap">'.$modx->toDateFormat($files_array[$i]['stats']['9']).'</td>'; |
|
706 | + echo '<td class="text-right">'.$modx->nicesize($files_array[$i]['stats']['7']).'</td>'; |
|
707 | 707 | echo '<td class="actions text-right">'; |
708 | 708 | echo $files_array[$i]['unzip']; |
709 | 709 | echo $files_array[$i]['view']; |
@@ -840,17 +840,17 @@ discard block |
||
840 | 840 | $zip = zip_open($file); |
841 | 841 | if ($zip) { |
842 | 842 | $old_umask = umask(0); |
843 | - $path = rtrim($path, '/') . '/'; |
|
843 | + $path = rtrim($path, '/').'/'; |
|
844 | 844 | while ($zip_entry = zip_read($zip)) { |
845 | 845 | if (zip_entry_filesize($zip_entry) > 0) { |
846 | 846 | // str_replace must be used under windows to convert "/" into "\" |
847 | 847 | $zip_entry_name = zip_entry_name($zip_entry); |
848 | - $complete_path = $path . str_replace('\\', '/', dirname($zip_entry_name)); |
|
849 | - $complete_name = $path . str_replace('\\', '/', $zip_entry_name); |
|
848 | + $complete_path = $path.str_replace('\\', '/', dirname($zip_entry_name)); |
|
849 | + $complete_name = $path.str_replace('\\', '/', $zip_entry_name); |
|
850 | 850 | if (!file_exists($complete_path)) { |
851 | 851 | $tmp = ''; |
852 | 852 | foreach (explode('/', $complete_path) AS $k) { |
853 | - $tmp .= $k . '/'; |
|
853 | + $tmp .= $k.'/'; |
|
854 | 854 | if (!is_dir($tmp)) { |
855 | 855 | mkdir($tmp, 0777); |
856 | 856 | } |
@@ -875,7 +875,7 @@ discard block |
||
875 | 875 | */ |
876 | 876 | function rrmdir($dir) |
877 | 877 | { |
878 | - foreach (glob($dir . '/*') as $file) { |
|
878 | + foreach (glob($dir.'/*') as $file) { |
|
879 | 879 | if (is_dir($file)) { |
880 | 880 | rrmdir($file); |
881 | 881 | } else { |
@@ -894,7 +894,7 @@ discard block |
||
894 | 894 | $msg = ''; |
895 | 895 | foreach ($_FILES['userfile']['name'] as $i => $name) { |
896 | 896 | if (empty($_FILES['userfile']['tmp_name'][$i])) continue; |
897 | - $userfile= array(); |
|
897 | + $userfile = array(); |
|
898 | 898 | |
899 | 899 | $userfile['tmp_name'] = $_FILES['userfile']['tmp_name'][$i]; |
900 | 900 | $userfile['error'] = $_FILES['userfile']['error'][$i]; |
@@ -911,12 +911,12 @@ discard block |
||
911 | 911 | $userfile['type'] = $_FILES['userfile']['type'][$i]; |
912 | 912 | |
913 | 913 | // this seems to be an upload action. |
914 | - $path = $modx->config['site_url'] . substr($startpath, strlen($filemanager_path), strlen($startpath)); |
|
915 | - $path = rtrim($path, '/') . '/' . $userfile['name']; |
|
914 | + $path = $modx->config['site_url'].substr($startpath, strlen($filemanager_path), strlen($startpath)); |
|
915 | + $path = rtrim($path, '/').'/'.$userfile['name']; |
|
916 | 916 | $msg .= $path; |
917 | 917 | if ($userfile['error'] == 0) { |
918 | - $img = (strpos($userfile['type'], 'image') !== false) ? '<br /><img src="' . $path . '" height="75" />' : ''; |
|
919 | - $msg .= "<p>" . $_lang['files_file_type'] . $userfile['type'] . ", " . $modx->nicesize(filesize($userfile['tmp_name'])) . $img . '</p>'; |
|
918 | + $img = (strpos($userfile['type'], 'image') !== false) ? '<br /><img src="'.$path.'" height="75" />' : ''; |
|
919 | + $msg .= "<p>".$_lang['files_file_type'].$userfile['type'].", ".$modx->nicesize(filesize($userfile['tmp_name'])).$img.'</p>'; |
|
920 | 920 | } |
921 | 921 | |
922 | 922 | $userfilename = $userfile['tmp_name']; |
@@ -924,15 +924,15 @@ discard block |
||
924 | 924 | if (is_uploaded_file($userfilename)) { |
925 | 925 | // file is uploaded file, process it! |
926 | 926 | if (!checkExtension($userfile['name'])) { |
927 | - $msg .= '<p><span class="warning">' . $_lang['files_filetype_notok'] . '</span></p>'; |
|
927 | + $msg .= '<p><span class="warning">'.$_lang['files_filetype_notok'].'</span></p>'; |
|
928 | 928 | } else { |
929 | - if (@move_uploaded_file($userfile['tmp_name'], $_POST['path'] . '/' . $userfile['name'])) { |
|
929 | + if (@move_uploaded_file($userfile['tmp_name'], $_POST['path'].'/'.$userfile['name'])) { |
|
930 | 930 | // Ryan: Repair broken permissions issue with file manager |
931 | 931 | if (strtoupper(substr(PHP_OS, 0, 3)) != 'WIN') { |
932 | - @chmod($_POST['path'] . "/" . $userfile['name'], $new_file_permissions); |
|
932 | + @chmod($_POST['path']."/".$userfile['name'], $new_file_permissions); |
|
933 | 933 | } |
934 | 934 | // Ryan: End |
935 | - $msg .= '<p><span class="success">' . $_lang['files_upload_ok'] . '</span></p><hr/>'; |
|
935 | + $msg .= '<p><span class="success">'.$_lang['files_upload_ok'].'</span></p><hr/>'; |
|
936 | 936 | |
937 | 937 | // invoke OnFileManagerUpload event |
938 | 938 | $modx->invokeEvent('OnFileManagerUpload', array( |
@@ -940,13 +940,13 @@ discard block |
||
940 | 940 | 'filename' => $userfile['name'] |
941 | 941 | )); |
942 | 942 | // Log the change |
943 | - logFileChange('upload', $_POST['path'] . '/' . $userfile['name']); |
|
943 | + logFileChange('upload', $_POST['path'].'/'.$userfile['name']); |
|
944 | 944 | } else { |
945 | - $msg .= '<p><span class="warning">' . $_lang['files_upload_copyfailed'] . '</span> ' . $_lang["files_upload_permissions_error"] . '</p>'; |
|
945 | + $msg .= '<p><span class="warning">'.$_lang['files_upload_copyfailed'].'</span> '.$_lang["files_upload_permissions_error"].'</p>'; |
|
946 | 946 | } |
947 | 947 | } |
948 | 948 | } else { |
949 | - $msg .= '<br /><span class="warning"><b>' . $_lang['files_upload_error'] . ':</b>'; |
|
949 | + $msg .= '<br /><span class="warning"><b>'.$_lang['files_upload_error'].':</b>'; |
|
950 | 950 | switch ($userfile['error']) { |
951 | 951 | case 0: //no error; possible file attack! |
952 | 952 | $msg .= $_lang['files_upload_error0']; |
@@ -970,7 +970,7 @@ discard block |
||
970 | 970 | $msg .= '</span><br />'; |
971 | 971 | } |
972 | 972 | } |
973 | - return $msg . '<br/>'; |
|
973 | + return $msg.'<br/>'; |
|
974 | 974 | } |
975 | 975 | |
976 | 976 | /** |
@@ -986,9 +986,9 @@ discard block |
||
986 | 986 | |
987 | 987 | // Write $content to our opened file. |
988 | 988 | if (file_put_contents($filename, $content) === false) { |
989 | - $msg .= '<span class="warning"><b>' . $_lang['file_not_saved'] . '</b></span><br /><br />'; |
|
989 | + $msg .= '<span class="warning"><b>'.$_lang['file_not_saved'].'</b></span><br /><br />'; |
|
990 | 990 | } else { |
991 | - $msg .= '<span class="success"><b>' . $_lang['file_saved'] . '</b></span><br /><br />'; |
|
991 | + $msg .= '<span class="success"><b>'.$_lang['file_saved'].'</b></span><br /><br />'; |
|
992 | 992 | $_REQUEST['mode'] = 'edit'; |
993 | 993 | } |
994 | 994 | // Log the change |
@@ -1007,9 +1007,9 @@ discard block |
||
1007 | 1007 | |
1008 | 1008 | $file = $_REQUEST['path']; |
1009 | 1009 | if (!$token_check || !@unlink($file)) { |
1010 | - $msg .= '<span class="warning"><b>' . $_lang['file_not_deleted'] . '</b></span><br /><br />'; |
|
1010 | + $msg .= '<span class="warning"><b>'.$_lang['file_not_deleted'].'</b></span><br /><br />'; |
|
1011 | 1011 | } else { |
1012 | - $msg .= '<span class="success"><b>' . $_lang['file_deleted'] . '</b></span><br /><br />'; |
|
1012 | + $msg .= '<span class="success"><b>'.$_lang['file_deleted'].'</b></span><br /><br />'; |
|
1013 | 1013 | } |
1014 | 1014 | |
1015 | 1015 | // Log the change |
@@ -7,7 +7,7 @@ discard block |
||
7 | 7 | */ |
8 | 8 | function get_lang_keys($filename) |
9 | 9 | { |
10 | - $file = MODX_MANAGER_PATH . 'includes/lang' . DIRECTORY_SEPARATOR . $filename; |
|
10 | + $file = MODX_MANAGER_PATH.'includes/lang'.DIRECTORY_SEPARATOR.$filename; |
|
11 | 11 | if (is_file($file) && is_readable($file)) { |
12 | 12 | include($file); |
13 | 13 | $out = isset($_lang) ? array_keys($_lang) : array(); |
@@ -53,11 +53,11 @@ discard block |
||
53 | 53 | if (!empty($key)) { |
54 | 54 | $languages = get_langs_by_key($key); |
55 | 55 | sort($languages); |
56 | - $lang_options .= '<option value="">' . $_lang['language_title'] . '</option>'; |
|
56 | + $lang_options .= '<option value="">'.$_lang['language_title'].'</option>'; |
|
57 | 57 | |
58 | 58 | foreach ($languages as $language_name) { |
59 | 59 | $uclanguage_name = ucwords(str_replace("_", " ", $language_name)); |
60 | - $lang_options .= '<option value="' . $language_name . '">' . $uclanguage_name . '</option>'; |
|
60 | + $lang_options .= '<option value="'.$language_name.'">'.$uclanguage_name.'</option>'; |
|
61 | 61 | } |
62 | 62 | |
63 | 63 | return $lang_options; |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | foreach ($languages as $language_name) { |
68 | 68 | $uclanguage_name = ucwords(str_replace("_", " ", $language_name)); |
69 | 69 | $sel = $language_name === $selected_lang ? ' selected="selected"' : ''; |
70 | - $lang_options .= '<option value="' . $language_name . '" ' . $sel . '>' . $uclanguage_name . '</option>'; |
|
70 | + $lang_options .= '<option value="'.$language_name.'" '.$sel.'>'.$uclanguage_name.'</option>'; |
|
71 | 71 | } |
72 | 72 | |
73 | 73 | return $lang_options; |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | $disabled = ''; |
93 | 93 | } |
94 | 94 | if ($add) { |
95 | - $add = ' ' . $add; |
|
95 | + $add = ' '.$add; |
|
96 | 96 | } |
97 | 97 | |
98 | 98 | return sprintf('<input onchange="documentDirty=true;" type="radio" name="%s" value="%s" %s %s %s />', $name, $value, |