@@ -4,18 +4,18 @@ |
||
4 | 4 | } |
5 | 5 | |
6 | 6 | switch ($modx->manager->action) { |
7 | - case 102: |
|
8 | - if (!$modx->hasPermission('edit_plugin')) { |
|
9 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
10 | - } |
|
11 | - break; |
|
12 | - case 101: |
|
13 | - if (!$modx->hasPermission('new_plugin')) { |
|
7 | + case 102: |
|
8 | + if (!$modx->hasPermission('edit_plugin')) { |
|
9 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
10 | + } |
|
11 | + break; |
|
12 | + case 101: |
|
13 | + if (!$modx->hasPermission('new_plugin')) { |
|
14 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
15 | + } |
|
16 | + break; |
|
17 | + default: |
|
14 | 18 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
15 | - } |
|
16 | - break; |
|
17 | - default: |
|
18 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
19 | 19 | } |
20 | 20 | |
21 | 21 | $id = isset($_REQUEST['id']) ? (int)$_REQUEST['id'] : 0; |
@@ -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 | |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
19 | 19 | } |
20 | 20 | |
21 | -$id = isset($_REQUEST['id']) ? (int)$_REQUEST['id'] : 0; |
|
21 | +$id = isset($_REQUEST['id']) ? (int) $_REQUEST['id'] : 0; |
|
22 | 22 | |
23 | 23 | $tbl_site_plugins = $modx->getFullTableName('site_plugins'); |
24 | 24 | $tbl_site_plugin_events = $modx->getFullTableName('site_plugin_events'); |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | $content['properties'] = str_replace("&", "&", $content['properties']); |
47 | 47 | } else { |
48 | 48 | $_SESSION['itemname'] = $_lang["new_plugin"]; |
49 | - $content['category'] = (int)$_REQUEST['catid']; |
|
49 | + $content['category'] = (int) $_REQUEST['catid']; |
|
50 | 50 | } |
51 | 51 | |
52 | 52 | if ($modx->manager->hasFormValues()) { |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | // Add lock-element JS-Script |
57 | 57 | $lockElementId = $id; |
58 | 58 | $lockElementType = 5; |
59 | -require_once(MODX_MANAGER_PATH . 'includes/active_user_locks.inc.php'); |
|
59 | +require_once(MODX_MANAGER_PATH.'includes/active_user_locks.inc.php'); |
|
60 | 60 | |
61 | 61 | /** |
62 | 62 | * @param bool $cond |
@@ -480,7 +480,7 @@ discard block |
||
480 | 480 | <input type="hidden" name="mode" value="<?= $modx->manager->action ?>"> |
481 | 481 | |
482 | 482 | <h1> |
483 | - <i class="fa fa-plug"></i><?= ($content['name'] ? $content['name'] . '<small>(' . $content['id'] . ')</small>' : $_lang['new_plugin']) ?><i class="fa fa-question-circle help"></i> |
|
483 | + <i class="fa fa-plug"></i><?= ($content['name'] ? $content['name'].'<small>('.$content['id'].')</small>' : $_lang['new_plugin']) ?><i class="fa fa-question-circle help"></i> |
|
484 | 484 | </h1> |
485 | 485 | |
486 | 486 | <?= $_style['actionbuttons']['dynamic']['element'] ?> |
@@ -506,7 +506,7 @@ discard block |
||
506 | 506 | <div class="form-control-name clearfix"> |
507 | 507 | <input name="name" type="text" maxlength="100" value="<?= $modx->htmlspecialchars($content['name']) ?>" class="form-control form-control-lg" onchange="documentDirty=true;" /> |
508 | 508 | <?php if ($modx->hasPermission('save_role')): ?> |
509 | - <label class="custom-control" title="<?= $_lang['lock_plugin'] . "\n" . $_lang['lock_plugin_msg'] ?>" tooltip> |
|
509 | + <label class="custom-control" title="<?= $_lang['lock_plugin']."\n".$_lang['lock_plugin_msg'] ?>" tooltip> |
|
510 | 510 | <input name="locked" type="checkbox" value="on"<?= ($content['locked'] == 1 ? ' checked="checked"' : '') ?> /> |
511 | 511 | <i class="fa fa-lock"></i> |
512 | 512 | </label> |
@@ -530,9 +530,9 @@ discard block |
||
530 | 530 | <select name="categoryid" class="form-control" onchange="documentDirty=true;"> |
531 | 531 | <option> </option> |
532 | 532 | <?php |
533 | - include_once(MODX_MANAGER_PATH . 'includes/categories.inc.php'); |
|
533 | + include_once(MODX_MANAGER_PATH.'includes/categories.inc.php'); |
|
534 | 534 | foreach (getCategories() as $n => $v) { |
535 | - echo '<option value="' . $v['id'] . '"' . ($content["category"] == $v["id"] ? ' selected="selected"' : '') . '>' . $modx->htmlspecialchars($v["category"]) . "</option>"; |
|
535 | + echo '<option value="'.$v['id'].'"'.($content["category"] == $v["id"] ? ' selected="selected"' : '').'>'.$modx->htmlspecialchars($v["category"])."</option>"; |
|
536 | 536 | } |
537 | 537 | ?> |
538 | 538 | </select> |
@@ -548,7 +548,7 @@ discard block |
||
548 | 548 | <?php if ($modx->hasPermission('save_role')): ?> |
549 | 549 | <div class="form-group"> |
550 | 550 | <div class="form-row"> |
551 | - <label><input name="disabled" type="checkbox" value="on"<?= ($content['disabled'] == 1 ? ' checked="checked"' : '') ?> /> <?= ($content['disabled'] == 1 ? "<span class='text-danger'>" . $_lang['plugin_disabled'] . "</span>" : $_lang['plugin_disabled']) ?></label> |
|
551 | + <label><input name="disabled" type="checkbox" value="on"<?= ($content['disabled'] == 1 ? ' checked="checked"' : '') ?> /> <?= ($content['disabled'] == 1 ? "<span class='text-danger'>".$_lang['plugin_disabled']."</span>" : $_lang['plugin_disabled']) ?></label> |
|
552 | 552 | </div> |
553 | 553 | <div class="form-row"> |
554 | 554 | <label> |
@@ -595,11 +595,11 @@ discard block |
||
595 | 595 | <select name="moduleguid" class="form-control" onchange="documentDirty=true;"> |
596 | 596 | <option> </option> |
597 | 597 | <?php |
598 | - $ds = $modx->db->select('sm.id,sm.name,sm.guid', $modx->getFullTableName("site_modules") . " sm |
|
599 | - INNER JOIN " . $modx->getFullTableName("site_module_depobj") . " smd ON smd.module=sm.id AND smd.type=30 |
|
600 | - INNER JOIN " . $modx->getFullTableName("site_plugins") . " sp ON sp.id=smd.resource", "smd.resource='{$id}' AND sm.enable_sharedparams='1'", 'sm.name'); |
|
598 | + $ds = $modx->db->select('sm.id,sm.name,sm.guid', $modx->getFullTableName("site_modules")." sm |
|
599 | + INNER JOIN " . $modx->getFullTableName("site_module_depobj")." smd ON smd.module=sm.id AND smd.type=30 |
|
600 | + INNER JOIN " . $modx->getFullTableName("site_plugins")." sp ON sp.id=smd.resource", "smd.resource='{$id}' AND sm.enable_sharedparams='1'", 'sm.name'); |
|
601 | 601 | while ($row = $modx->db->getRow($ds)) { |
602 | - echo "<option value='" . $row['guid'] . "'" . ($content["moduleguid"] == $row["guid"] ? " selected='selected'" : "") . ">" . $modx->htmlspecialchars($row["name"]) . "</option>"; |
|
602 | + echo "<option value='".$row['guid']."'".($content["moduleguid"] == $row["guid"] ? " selected='selected'" : "").">".$modx->htmlspecialchars($row["name"])."</option>"; |
|
603 | 603 | } |
604 | 604 | ?> |
605 | 605 | </select> |
@@ -661,7 +661,7 @@ discard block |
||
661 | 661 | echoEventRows($evtnames); |
662 | 662 | } |
663 | 663 | echo '<hr class="clear">'; |
664 | - echo '<div class="form-group"><b>' . $services[$srv - 1] . '</b></div>'; |
|
664 | + echo '<div class="form-group"><b>'.$services[$srv - 1].'</b></div>'; |
|
665 | 665 | } |
666 | 666 | // display group name |
667 | 667 | if ($grp != $row['groupname']) { |
@@ -670,9 +670,9 @@ discard block |
||
670 | 670 | echoEventRows($evtnames); |
671 | 671 | } |
672 | 672 | echo '<hr class="clear">'; |
673 | - echo '<div class="form-group"><b>' . $row['groupname'] . '</b></div>'; |
|
673 | + echo '<div class="form-group"><b>'.$row['groupname'].'</b></div>'; |
|
674 | 674 | } |
675 | - $evtnames[] = '<input name="sysevents[]" id="' . $row['name'] . '" type="checkbox" ' . (in_array($row['id'], $evts) ? ' checked="checked" ' : '') . 'class="inputBox" value="' . $row['id'] . '" /> <label for="' . $row['name'] . '" ' . bold(in_array($row['id'], $evts)) . '> ' . $row['name'] . '</label>' . "\n"; |
|
675 | + $evtnames[] = '<input name="sysevents[]" id="'.$row['name'].'" type="checkbox" '.(in_array($row['id'], $evts) ? ' checked="checked" ' : '').'class="inputBox" value="'.$row['id'].'" /> <label for="'.$row['name'].'" '.bold(in_array($row['id'], $evts)).'> '.$row['name'].'</label>'."\n"; |
|
676 | 676 | if (count($evtnames) == 2) { |
677 | 677 | echoEventRows($evtnames); |
678 | 678 | } |
@@ -684,7 +684,7 @@ discard block |
||
684 | 684 | |
685 | 685 | function echoEventRows(&$evtnames) |
686 | 686 | { |
687 | - echo '<div class="row form-row"><div class="col-sm-6 col-md-4 col-lg-3">' . implode('</div><div class="col-sm-6 col-md-4 col-lg-3">', $evtnames) . '</div></div>'; |
|
687 | + echo '<div class="row form-row"><div class="col-sm-6 col-md-4 col-lg-3">'.implode('</div><div class="col-sm-6 col-md-4 col-lg-3">', $evtnames).'</div></div>'; |
|
688 | 688 | $evtnames = array(); |
689 | 689 | } |
690 | 690 |
@@ -4,18 +4,18 @@ |
||
4 | 4 | } |
5 | 5 | |
6 | 6 | switch ($modx->manager->action) { |
7 | - case 22: |
|
8 | - if (!$modx->hasPermission('edit_snippet')) { |
|
9 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
10 | - } |
|
11 | - break; |
|
12 | - case 23: |
|
13 | - if (!$modx->hasPermission('new_snippet')) { |
|
7 | + case 22: |
|
8 | + if (!$modx->hasPermission('edit_snippet')) { |
|
9 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
10 | + } |
|
11 | + break; |
|
12 | + case 23: |
|
13 | + if (!$modx->hasPermission('new_snippet')) { |
|
14 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
15 | + } |
|
16 | + break; |
|
17 | + default: |
|
14 | 18 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
15 | - } |
|
16 | - break; |
|
17 | - default: |
|
18 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
19 | 19 | } |
20 | 20 | |
21 | 21 | $id = isset($_REQUEST['id']) ? (int)$_REQUEST['id'] : 0; |
@@ -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 | |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
19 | 19 | } |
20 | 20 | |
21 | -$id = isset($_REQUEST['id']) ? (int)$_REQUEST['id'] : 0; |
|
21 | +$id = isset($_REQUEST['id']) ? (int) $_REQUEST['id'] : 0; |
|
22 | 22 | |
23 | 23 | // Get table Names (alphabetical) |
24 | 24 | $tbl_site_module_depobj = $modx->getFullTableName('site_module_depobj'); |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | $rs = $modx->db->select('*', $tbl_site_snippets, "id='{$id}'"); |
40 | 40 | $content = $modx->db->getRow($rs); |
41 | 41 | if (!$content) { |
42 | - header("Location: " . MODX_SITE_URL . "index.php?id=" . $site_start); |
|
42 | + header("Location: ".MODX_SITE_URL."index.php?id=".$site_start); |
|
43 | 43 | } |
44 | 44 | $_SESSION['itemname'] = $content['name']; |
45 | 45 | if ($content['locked'] == 1 && $_SESSION['mgrRole'] != 1) { |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | $content['name'] = $_REQUEST['itemname']; |
51 | 51 | } else { |
52 | 52 | $_SESSION['itemname'] = $_lang["new_snippet"]; |
53 | - $content['category'] = (int)$_REQUEST['catid']; |
|
53 | + $content['category'] = (int) $_REQUEST['catid']; |
|
54 | 54 | } |
55 | 55 | |
56 | 56 | if ($modx->manager->hasFormValues()) { |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | // Add lock-element JS-Script |
63 | 63 | $lockElementId = $id; |
64 | 64 | $lockElementType = 4; |
65 | -require_once(MODX_MANAGER_PATH . 'includes/active_user_locks.inc.php'); |
|
65 | +require_once(MODX_MANAGER_PATH.'includes/active_user_locks.inc.php'); |
|
66 | 66 | ?> |
67 | 67 | <script type="text/javascript"> |
68 | 68 | |
@@ -431,7 +431,7 @@ discard block |
||
431 | 431 | <input type="hidden" name="mode" value="<?= $modx->manager->action ?>"> |
432 | 432 | |
433 | 433 | <h1 class="pagetitle"> |
434 | - <i class="fa fa-code"></i><?= ($content['name'] ? $content['name'] . '<small>(' . $content['id'] . ')</small>' : $_lang['new_snippet']) ?><i class="fa fa-question-circle help"></i> |
|
434 | + <i class="fa fa-code"></i><?= ($content['name'] ? $content['name'].'<small>('.$content['id'].')</small>' : $_lang['new_snippet']) ?><i class="fa fa-question-circle help"></i> |
|
435 | 435 | </h1> |
436 | 436 | |
437 | 437 | <?= $_style['actionbuttons']['dynamic']['element'] ?> |
@@ -457,7 +457,7 @@ discard block |
||
457 | 457 | <div class="form-control-name clearfix"> |
458 | 458 | <input name="name" type="text" maxlength="100" value="<?= $modx->htmlspecialchars($content['name']) ?>" class="form-control form-control-lg" onchange="documentDirty=true;" /> |
459 | 459 | <?php if ($modx->hasPermission('save_role')): ?> |
460 | - <label class="custom-control" title="<?= $_lang['lock_snippet'] . "\n" . $_lang['lock_snippet_msg'] ?>" tooltip> |
|
460 | + <label class="custom-control" title="<?= $_lang['lock_snippet']."\n".$_lang['lock_snippet_msg'] ?>" tooltip> |
|
461 | 461 | <input name="locked" type="checkbox"<?= ($content['locked'] == 1 ? ' checked="checked"' : '') ?> /> |
462 | 462 | <i class="fa fa-lock"></i> |
463 | 463 | </label> |
@@ -481,9 +481,9 @@ discard block |
||
481 | 481 | <select name="categoryid" class="form-control" onchange="documentDirty=true;"> |
482 | 482 | <option> </option> |
483 | 483 | <?php |
484 | - include_once(MODX_MANAGER_PATH . 'includes/categories.inc.php'); |
|
484 | + include_once(MODX_MANAGER_PATH.'includes/categories.inc.php'); |
|
485 | 485 | foreach (getCategories() as $n => $v) { |
486 | - echo '<option value="' . $v['id'] . '"' . ($content['category'] == $v['id'] ? ' selected="selected"' : '') . '>' . $modx->htmlspecialchars($v['category']) . '</option>'; |
|
486 | + echo '<option value="'.$v['id'].'"'.($content['category'] == $v['id'] ? ' selected="selected"' : '').'>'.$modx->htmlspecialchars($v['category']).'</option>'; |
|
487 | 487 | } |
488 | 488 | ?> |
489 | 489 | </select> |
@@ -500,7 +500,7 @@ discard block |
||
500 | 500 | <div class="form-group"> |
501 | 501 | <?php if ($_SESSION['mgrRole'] == 1): ?> |
502 | 502 | <div class="form-row"> |
503 | - <label><input name="disabled" type="checkbox" value="on"<?= ($content['disabled'] == 1 ? ' checked="checked"' : '') ?> /> <?= ($content['disabled'] == 1 ? "<span class='text-danger'>" . $_lang['disabled'] . "</span>" : $_lang['disabled']) ?></label> |
|
503 | + <label><input name="disabled" type="checkbox" value="on"<?= ($content['disabled'] == 1 ? ' checked="checked"' : '') ?> /> <?= ($content['disabled'] == 1 ? "<span class='text-danger'>".$_lang['disabled']."</span>" : $_lang['disabled']) ?></label> |
|
504 | 504 | </div> |
505 | 505 | <?php endif; ?> |
506 | 506 | <div class="form-row"> |
@@ -517,7 +517,7 @@ discard block |
||
517 | 517 | <span><?= $_lang['snippet_code'] ?></span> |
518 | 518 | </div> |
519 | 519 | <div class="section-editor clearfix"> |
520 | - <textarea dir="ltr" name="post" class="phptextarea" rows="20" wrap="soft" onchange="documentDirty=true;"><?= (isset($content['post']) ? trim($modx->htmlspecialchars($content['post'])) : "<?php" . "\n" . trim($modx->htmlspecialchars($content['snippet'])) . "\n") ?></textarea> |
|
520 | + <textarea dir="ltr" name="post" class="phptextarea" rows="20" wrap="soft" onchange="documentDirty=true;"><?= (isset($content['post']) ? trim($modx->htmlspecialchars($content['post'])) : "<?php"."\n".trim($modx->htmlspecialchars($content['snippet']))."\n") ?></textarea> |
|
521 | 521 | </div> |
522 | 522 | <!-- PHP text editor end --> |
523 | 523 | </div> |
@@ -552,7 +552,7 @@ discard block |
||
552 | 552 | INNER JOIN {$tbl_site_module_depobj} AS smd ON smd.module=sm.id AND smd.type=40 |
553 | 553 | INNER JOIN {$tbl_site_snippets} AS ss ON ss.id=smd.resource", "smd.resource='{$id}' AND sm.enable_sharedparams=1", 'sm.name'); |
554 | 554 | while ($row = $modx->db->getRow($ds)) { |
555 | - echo "<option value='" . $row['guid'] . "'" . ($content['moduleguid'] == $row['guid'] ? " selected='selected'" : "") . ">" . $modx->htmlspecialchars($row['name']) . "</option>"; |
|
555 | + echo "<option value='".$row['guid']."'".($content['moduleguid'] == $row['guid'] ? " selected='selected'" : "").">".$modx->htmlspecialchars($row['name'])."</option>"; |
|
556 | 556 | } |
557 | 557 | ?> |
558 | 558 | </select> |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | $pre = null, |
31 | 31 | $charset = '', |
32 | 32 | $connection_method = 'SET CHARACTER SET' |
33 | - ) { |
|
33 | + ){ |
|
34 | 34 | $this->config['host'] = $host ? $host : $GLOBALS['database_server']; |
35 | 35 | $this->config['dbase'] = $dbase ? $dbase : $GLOBALS['dbase']; |
36 | 36 | $this->config['user'] = $uid ? $uid : $GLOBALS['database_user']; |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | $referer = $modx->htmlspecialchars($_SERVER['HTTP_REFERER']); |
121 | 121 | |
122 | 122 | $modx->sendmail(array( |
123 | - 'subject' => 'Missing to create the database connection! from ' . $modx->config['site_name'], |
|
123 | + 'subject' => 'Missing to create the database connection! from '.$modx->config['site_name'], |
|
124 | 124 | 'body' => "{$logtitle}\n{$request_uri}\n{$ua}\n{$referer}", |
125 | 125 | 'type' => 'text' |
126 | 126 | ) |
@@ -137,15 +137,15 @@ discard block |
||
137 | 137 | } else { |
138 | 138 | $dbase = trim($dbase, '`'); // remove the `` chars |
139 | 139 | if (!@ mysql_select_db($dbase, $this->conn)) { |
140 | - $modx->messageQuit("Failed to select the database '" . $dbase . "'!"); |
|
140 | + $modx->messageQuit("Failed to select the database '".$dbase."'!"); |
|
141 | 141 | exit; |
142 | 142 | } |
143 | 143 | @mysql_query("{$connection_method} {$charset}", $this->conn); |
144 | 144 | $tend = $modx->getMicroTime(); |
145 | 145 | $totaltime = $tend - $tstart; |
146 | 146 | if ($modx->dumpSQL) { |
147 | - $modx->queryCode .= "<fieldset style='text-align:left'><legend>Database connection</legend>" . sprintf("Database connection was created in %2.4f s", |
|
148 | - $totaltime) . "</fieldset><br />"; |
|
147 | + $modx->queryCode .= "<fieldset style='text-align:left'><legend>Database connection</legend>".sprintf("Database connection was created in %2.4f s", |
|
148 | + $totaltime)."</fieldset><br />"; |
|
149 | 149 | } |
150 | 150 | if (function_exists('mysql_set_charset')) { |
151 | 151 | mysql_set_charset($this->config['charset']); |
@@ -225,7 +225,7 @@ discard block |
||
225 | 225 | case 1091: |
226 | 226 | break; |
227 | 227 | default: |
228 | - $modx->messageQuit('Execution of a query to the database failed - ' . $this->getLastError(), $sql); |
|
228 | + $modx->messageQuit('Execution of a query to the database failed - '.$this->getLastError(), $sql); |
|
229 | 229 | } |
230 | 230 | } else { |
231 | 231 | $tend = $modx->getMicroTime(); |
@@ -239,24 +239,24 @@ discard block |
||
239 | 239 | $debug_path[] = $line['function']; |
240 | 240 | } |
241 | 241 | $debug_path = implode(' > ', array_reverse($debug_path)); |
242 | - $modx->queryCode .= "<fieldset style='text-align:left'><legend>Query " . ($modx->executedQueries + 1) . " - " . sprintf("%2.2f ms", |
|
243 | - $totaltime * 1000) . "</legend>"; |
|
244 | - $modx->queryCode .= $sql . '<br><br>'; |
|
242 | + $modx->queryCode .= "<fieldset style='text-align:left'><legend>Query ".($modx->executedQueries + 1)." - ".sprintf("%2.2f ms", |
|
243 | + $totaltime * 1000)."</legend>"; |
|
244 | + $modx->queryCode .= $sql.'<br><br>'; |
|
245 | 245 | if ($modx->event->name) { |
246 | - $modx->queryCode .= 'Current Event => ' . $modx->event->name . '<br>'; |
|
246 | + $modx->queryCode .= 'Current Event => '.$modx->event->name.'<br>'; |
|
247 | 247 | } |
248 | 248 | if ($modx->event->activePlugin) { |
249 | - $modx->queryCode .= 'Current Plugin => ' . $modx->event->activePlugin . '<br>'; |
|
249 | + $modx->queryCode .= 'Current Plugin => '.$modx->event->activePlugin.'<br>'; |
|
250 | 250 | } |
251 | 251 | if ($modx->currentSnippet) { |
252 | - $modx->queryCode .= 'Current Snippet => ' . $modx->currentSnippet . '<br>'; |
|
252 | + $modx->queryCode .= 'Current Snippet => '.$modx->currentSnippet.'<br>'; |
|
253 | 253 | } |
254 | 254 | if (stripos($sql, 'select') === 0) { |
255 | - $modx->queryCode .= 'Record Count => ' . $this->getRecordCount($result) . '<br>'; |
|
255 | + $modx->queryCode .= 'Record Count => '.$this->getRecordCount($result).'<br>'; |
|
256 | 256 | } else { |
257 | - $modx->queryCode .= 'Affected Rows => ' . $this->getAffectedRows() . '<br>'; |
|
257 | + $modx->queryCode .= 'Affected Rows => '.$this->getAffectedRows().'<br>'; |
|
258 | 258 | } |
259 | - $modx->queryCode .= 'Functions Path => ' . $debug_path . '<br>'; |
|
259 | + $modx->queryCode .= 'Functions Path => '.$debug_path.'<br>'; |
|
260 | 260 | $modx->queryCode .= "</fieldset><br />"; |
261 | 261 | } |
262 | 262 | $modx->executedQueries = $modx->executedQueries + 1; |
@@ -350,9 +350,9 @@ discard block |
||
350 | 350 | if (is_null($value) || strtolower($value) === 'null') { |
351 | 351 | $flds = 'NULL'; |
352 | 352 | } else { |
353 | - $flds = "'" . $value . "'"; |
|
353 | + $flds = "'".$value."'"; |
|
354 | 354 | } |
355 | - $fields[$key] = "`{$key}` = " . $flds; |
|
355 | + $fields[$key] = "`{$key}` = ".$flds; |
|
356 | 356 | } |
357 | 357 | $fields = implode(",", $fields); |
358 | 358 | } |
@@ -380,13 +380,13 @@ discard block |
||
380 | 380 | $this->query("INSERT INTO {$intotable} {$fields}"); |
381 | 381 | } else { |
382 | 382 | if (empty($fromtable)) { |
383 | - $fields = "(`" . implode("`, `", array_keys($fields)) . "`) VALUES('" . implode("', '", |
|
384 | - array_values($fields)) . "')"; |
|
383 | + $fields = "(`".implode("`, `", array_keys($fields))."`) VALUES('".implode("', '", |
|
384 | + array_values($fields))."')"; |
|
385 | 385 | $rt = $this->query("INSERT INTO {$intotable} {$fields}"); |
386 | 386 | } else { |
387 | 387 | if (version_compare($this->getVersion(), "4.0.14") >= 0) { |
388 | 388 | $fromtable = $this->replaceFullTableName($fromtable); |
389 | - $fields = "(" . implode(",", array_keys($fields)) . ")"; |
|
389 | + $fields = "(".implode(",", array_keys($fields)).")"; |
|
390 | 390 | $where = trim($where); |
391 | 391 | $limit = trim($limit); |
392 | 392 | if ($where !== '' && stripos($where, 'WHERE') !== 0) { |
@@ -399,8 +399,8 @@ discard block |
||
399 | 399 | } else { |
400 | 400 | $ds = $this->select($fromfields, $fromtable, $where, '', $limit); |
401 | 401 | while ($row = $this->getRow($ds)) { |
402 | - $fields = "(" . implode(",", array_keys($fields)) . ") VALUES('" . implode("', '", |
|
403 | - $row) . "')"; |
|
402 | + $fields = "(".implode(",", array_keys($fields)).") VALUES('".implode("', '", |
|
403 | + $row)."')"; |
|
404 | 404 | $rt = $this->query("INSERT INTO {$intotable} {$fields}"); |
405 | 405 | } |
406 | 406 | } |
@@ -485,7 +485,7 @@ discard block |
||
485 | 485 | public function getInsertId($conn = null) |
486 | 486 | { |
487 | 487 | if (!is_resource($conn)) { |
488 | - $conn =& $this->conn; |
|
488 | + $conn = & $this->conn; |
|
489 | 489 | } |
490 | 490 | |
491 | 491 | return mysql_insert_id($conn); |
@@ -498,7 +498,7 @@ discard block |
||
498 | 498 | public function getAffectedRows($conn = null) |
499 | 499 | { |
500 | 500 | if (!is_resource($conn)) { |
501 | - $conn =& $this->conn; |
|
501 | + $conn = & $this->conn; |
|
502 | 502 | } |
503 | 503 | |
504 | 504 | return mysql_affected_rows($conn); |
@@ -511,7 +511,7 @@ discard block |
||
511 | 511 | public function getLastError($conn = null) |
512 | 512 | { |
513 | 513 | if (!is_resource($conn)) { |
514 | - $conn =& $this->conn; |
|
514 | + $conn = & $this->conn; |
|
515 | 515 | } |
516 | 516 | |
517 | 517 | return mysql_error($conn); |
@@ -280,13 +280,13 @@ discard block |
||
280 | 280 | $orderby = trim($orderby); |
281 | 281 | $limit = trim($limit); |
282 | 282 | if ($where !== '' && stripos($where, 'WHERE') !== 0) { |
283 | - $where = "WHERE {$where}"; |
|
283 | + $where = "where {$where}"; |
|
284 | 284 | } |
285 | 285 | if ($orderby !== '' && stripos($orderby, 'ORDER BY') !== 0) { |
286 | 286 | $orderby = "ORDER BY {$orderby}"; |
287 | 287 | } |
288 | 288 | if ($limit !== '' && stripos($limit, 'LIMIT') !== 0) { |
289 | - $limit = "LIMIT {$limit}"; |
|
289 | + $limit = "limit {$limit}"; |
|
290 | 290 | } |
291 | 291 | |
292 | 292 | return $this->query("DELETE FROM {$from} {$where} {$orderby} {$limit}"); |
@@ -322,16 +322,16 @@ discard block |
||
322 | 322 | $orderby = trim($orderby); |
323 | 323 | $limit = trim($limit); |
324 | 324 | if ($where !== '' && stripos($where, 'WHERE') !== 0) { |
325 | - $where = "WHERE {$where}"; |
|
325 | + $where = "where {$where}"; |
|
326 | 326 | } |
327 | 327 | if ($orderby !== '' && stripos($orderby, 'ORDER') !== 0) { |
328 | 328 | $orderby = "ORDER BY {$orderby}"; |
329 | 329 | } |
330 | 330 | if ($limit !== '' && stripos($limit, 'LIMIT') !== 0) { |
331 | - $limit = "LIMIT {$limit}"; |
|
331 | + $limit = "limit {$limit}"; |
|
332 | 332 | } |
333 | 333 | |
334 | - return $this->query("SELECT {$fields} FROM {$from} {$where} {$orderby} {$limit}"); |
|
334 | + return $this->query("select {$fields} FROM {$from} {$where} {$orderby} {$limit}"); |
|
335 | 335 | } |
336 | 336 | |
337 | 337 | /** |
@@ -358,10 +358,10 @@ discard block |
||
358 | 358 | } |
359 | 359 | $where = trim($where); |
360 | 360 | if ($where !== '' && stripos($where, 'WHERE') !== 0) { |
361 | - $where = "WHERE {$where}"; |
|
361 | + $where = "where {$where}"; |
|
362 | 362 | } |
363 | 363 | |
364 | - return $this->query("UPDATE {$table} SET {$fields} {$where}"); |
|
364 | + return $this->query("update {$table} SET {$fields} {$where}"); |
|
365 | 365 | } |
366 | 366 | } |
367 | 367 | |
@@ -390,10 +390,10 @@ discard block |
||
390 | 390 | $where = trim($where); |
391 | 391 | $limit = trim($limit); |
392 | 392 | if ($where !== '' && stripos($where, 'WHERE') !== 0) { |
393 | - $where = "WHERE {$where}"; |
|
393 | + $where = "where {$where}"; |
|
394 | 394 | } |
395 | 395 | if ($limit !== '' && stripos($limit, 'LIMIT') !== 0) { |
396 | - $limit = "LIMIT {$limit}"; |
|
396 | + $limit = "limit {$limit}"; |
|
397 | 397 | } |
398 | 398 | $rt = $this->query("INSERT INTO {$intotable} {$fields} SELECT {$fromfields} FROM {$fromtable} {$where} {$limit}"); |
399 | 399 | } else { |
@@ -732,7 +732,7 @@ discard block |
||
732 | 732 | |
733 | 733 | public function truncate($table_name) |
734 | 734 | { |
735 | - $rs = $this->query("TRUNCATE {$table_name}"); |
|
735 | + $rs = $this->query("truncate {$table_name}"); |
|
736 | 736 | |
737 | 737 | return $rs; |
738 | 738 | } |
@@ -412,6 +412,9 @@ discard block |
||
412 | 412 | } |
413 | 413 | } |
414 | 414 | |
415 | + /** |
|
416 | + * @param string $table |
|
417 | + */ |
|
415 | 418 | public function save($fields, $table, $where = '') |
416 | 419 | { |
417 | 420 | if ($where === '') { |
@@ -441,6 +444,7 @@ discard block |
||
441 | 444 | /** |
442 | 445 | * @name: freeResult |
443 | 446 | * |
447 | + * @param mysqli_result $rs |
|
444 | 448 | */ |
445 | 449 | public function freeResult($rs) |
446 | 450 | { |
@@ -551,6 +555,7 @@ discard block |
||
551 | 555 | * @name: getColumn |
552 | 556 | * @desc: returns an array of the values found on colun $name |
553 | 557 | * @param: $dsq - dataset or query string |
558 | + * @param string $name |
|
554 | 559 | */ |
555 | 560 | public function getColumn($name, $dsq) |
556 | 561 | { |
@@ -716,6 +721,9 @@ discard block |
||
716 | 721 | return $result; |
717 | 722 | } |
718 | 723 | |
724 | + /** |
|
725 | + * @param string $table_name |
|
726 | + */ |
|
719 | 727 | public function optimize($table_name) |
720 | 728 | { |
721 | 729 | $rs = $this->query("OPTIMIZE TABLE {$table_name}"); |
@@ -726,6 +734,9 @@ discard block |
||
726 | 734 | return $rs; |
727 | 735 | } |
728 | 736 | |
737 | + /** |
|
738 | + * @param string $table_name |
|
739 | + */ |
|
729 | 740 | public function truncate($table_name) |
730 | 741 | { |
731 | 742 | $rs = $this->query("TRUNCATE {$table_name}"); |
@@ -67,14 +67,14 @@ discard block |
||
67 | 67 | $countChild++; |
68 | 68 | $id = $value[0]; |
69 | 69 | $ph['id'] = $id; |
70 | - $ph['li_class'] = $this->get_li_class($id) . $value[10]; |
|
70 | + $ph['li_class'] = $this->get_li_class($id).$value[10]; |
|
71 | 71 | $ph['href'] = $value[3]; |
72 | 72 | $ph['alt'] = $value[4]; |
73 | 73 | $ph['target'] = $value[7]; |
74 | 74 | $ph['onclick'] = $value[5]; |
75 | 75 | $ph['a_class'] = $this->get_a_class($id); |
76 | 76 | $ph['LinkAttr'] = $this->getLinkAttr($id); |
77 | - $ph['itemName'] = $value[2] . $this->getItemName($id); |
|
77 | + $ph['itemName'] = $value[2].$this->getItemName($id); |
|
78 | 78 | |
79 | 79 | $ph['DrawSub'] = ''; |
80 | 80 | |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | public function get_li_class($id) |
114 | 114 | { |
115 | 115 | if (isset($this->menu[$id])) { |
116 | - return $this->defaults['parentClass'] . ' '; |
|
116 | + return $this->defaults['parentClass'].' '; |
|
117 | 117 | } else { |
118 | 118 | return ''; |
119 | 119 | } |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | public function get_a_class($id) |
123 | 123 | { |
124 | 124 | if (isset($this->menu[$id])) { |
125 | - return ' class="' . $this->defaults['parentLinkClass'] . '"'; |
|
125 | + return ' class="'.$this->defaults['parentLinkClass'].'"'; |
|
126 | 126 | } else { |
127 | 127 | return ''; |
128 | 128 | } |
@@ -719,7 +719,7 @@ discard block |
||
719 | 719 | |
720 | 720 | /** |
721 | 721 | * @param string $string |
722 | - * @return bool|string |
|
722 | + * @return string|false |
|
723 | 723 | */ |
724 | 724 | function removeLastPath($string) |
725 | 725 | { |
@@ -734,7 +734,7 @@ discard block |
||
734 | 734 | |
735 | 735 | /** |
736 | 736 | * @param string $string |
737 | - * @return bool|string |
|
737 | + * @return string|false |
|
738 | 738 | */ |
739 | 739 | function getExtension($string) |
740 | 740 | { |
@@ -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,ini' . $alias_suffix); |
|
20 | -$inlineviewablefiles = explode(',', 'txt,php,tpl,less,sass,html,htm,xml,js,css,pageCache,htaccess,json,ini' . $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,ini'.$alias_suffix); |
|
20 | +$inlineviewablefiles = explode(',', 'txt,php,tpl,less,sass,html,htm,xml,js,css,pageCache,htaccess,json,ini'.$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 | - } elseif (!rename($dirname, $_REQUEST['path'] . '/' . $newDirname)) { |
|
410 | + } elseif (!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 | |
@@ -500,7 +500,7 @@ discard block |
||
500 | 500 | </form> |
501 | 501 | <?php |
502 | 502 | } else { |
503 | - echo "<p>" . $_lang['files_upload_inhibited_msg'] . "</p>"; |
|
503 | + echo "<p>".$_lang['files_upload_inhibited_msg']."</p>"; |
|
504 | 504 | } |
505 | 505 | ?> |
506 | 506 | <div id="imageviewer"></div> |
@@ -583,7 +583,7 @@ discard block |
||
583 | 583 | if ($file == $selFile) { |
584 | 584 | $icon = isset($icons[$mode]) ? $icons[$mode] : $icons['default']; |
585 | 585 | } |
586 | - return '<i class="' . $icon . ' FilesPage"></i>'; |
|
586 | + return '<i class="'.$icon.' FilesPage"></i>'; |
|
587 | 587 | } |
588 | 588 | |
589 | 589 | /** |
@@ -601,7 +601,7 @@ discard block |
||
601 | 601 | ); |
602 | 602 | if ($file == $selFile) { |
603 | 603 | $class = isset($classNames[$mode]) ? $classNames[$mode] : $classNames['default']; |
604 | - return ' class="' . $class . '"'; |
|
604 | + return ' class="'.$class.'"'; |
|
605 | 605 | } |
606 | 606 | return ''; |
607 | 607 | } |
@@ -615,7 +615,7 @@ discard block |
||
615 | 615 | global $excludes, $protected_path, $editablefiles, $inlineviewablefiles, $viewablefiles, $enablefileunzip, $enablefiledownload, $uploadablefiles, $folders, $files, $filesizes, $len, $dirs_array, $files_array, $webstart_path, $modx; |
616 | 616 | $dircounter = 0; |
617 | 617 | $filecounter = 0; |
618 | - $curpath = str_replace('//', '/', $curpath . '/'); |
|
618 | + $curpath = str_replace('//', '/', $curpath.'/'); |
|
619 | 619 | |
620 | 620 | if (!is_dir($curpath)) { |
621 | 621 | echo 'Invalid path "', $curpath, '"<br />'; |
@@ -625,7 +625,7 @@ discard block |
||
625 | 625 | |
626 | 626 | // first, get info |
627 | 627 | foreach ($dir as $file) { |
628 | - $newpath = $curpath . $file; |
|
628 | + $newpath = $curpath.$file; |
|
629 | 629 | if ($file === '..' || $file === '.') { |
630 | 630 | continue; |
631 | 631 | } |
@@ -635,7 +635,7 @@ discard block |
||
635 | 635 | if ($file === '..' || $file === '.') { |
636 | 636 | continue; |
637 | 637 | } elseif (!in_array($file, $excludes) && !in_array($newpath, $protected_path)) { |
638 | - $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>'; |
|
638 | + $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>'; |
|
639 | 639 | |
640 | 640 | $dfiles = scandir($newpath); |
641 | 641 | foreach ($dfiles as $i => $infile) { |
@@ -648,13 +648,13 @@ discard block |
||
648 | 648 | } |
649 | 649 | $file_exists = (0 < count($dfiles)) ? 'file_exists' : ''; |
650 | 650 | |
651 | - $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>' : ''; |
|
651 | + $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>' : ''; |
|
652 | 652 | } else { |
653 | - $dirs_array[$dircounter]['text'] = '<span><i class="' . $_style['files_deleted_folder'] . ' FilesDeletedFolder"></i> ' . $file . '</span>'; |
|
654 | - $dirs_array[$dircounter]['delete'] = is_writable($curpath) ? '<span class="disabled"><i class="' . $_style['files_delete'] . '" title="' . $_lang['file_delete_folder'] . '"></i></span>' : ''; |
|
653 | + $dirs_array[$dircounter]['text'] = '<span><i class="'.$_style['files_deleted_folder'].' FilesDeletedFolder"></i> '.$file.'</span>'; |
|
654 | + $dirs_array[$dircounter]['delete'] = is_writable($curpath) ? '<span class="disabled"><i class="'.$_style['files_delete'].'" title="'.$_lang['file_delete_folder'].'"></i></span>' : ''; |
|
655 | 655 | } |
656 | 656 | |
657 | - $dirs_array[$dircounter]['rename'] = is_writable($curpath) ? '<a href="javascript:renameFolder(\'' . urlencode($file) . '\');"><i class="' . $_style['files_rename'] . '" title="' . $_lang['rename'] . '"></i></a> ' : ''; |
|
657 | + $dirs_array[$dircounter]['rename'] = is_writable($curpath) ? '<a href="javascript:renameFolder(\''.urlencode($file).'\');"><i class="'.$_style['files_rename'].'" title="'.$_lang['rename'].'"></i></a> ' : ''; |
|
658 | 658 | |
659 | 659 | // increment the counter |
660 | 660 | $dircounter++; |
@@ -662,14 +662,14 @@ discard block |
||
662 | 662 | $type = getExtension($newpath); |
663 | 663 | $files_array[$filecounter]['file'] = $newpath; |
664 | 664 | $files_array[$filecounter]['stats'] = lstat($newpath); |
665 | - $files_array[$filecounter]['text'] = determineIcon($newpath, $_REQUEST['path'], $_REQUEST['mode']) . ' ' . $file; |
|
666 | - $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>'); |
|
667 | - $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']; |
|
668 | - $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>' : ''; |
|
669 | - $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>'; |
|
670 | - $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>'; |
|
671 | - $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>'; |
|
672 | - $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>'; |
|
665 | + $files_array[$filecounter]['text'] = determineIcon($newpath, $_REQUEST['path'], $_REQUEST['mode']).' '.$file; |
|
666 | + $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>'); |
|
667 | + $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']; |
|
668 | + $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>' : ''; |
|
669 | + $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>'; |
|
670 | + $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>'; |
|
671 | + $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>'; |
|
672 | + $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>'; |
|
673 | 673 | |
674 | 674 | // increment the counter |
675 | 675 | $filecounter++; |
@@ -682,9 +682,9 @@ discard block |
||
682 | 682 | for ($i = 0; $i < $folders; $i++) { |
683 | 683 | $filesizes += $dirs_array[$i]['stats']['7']; |
684 | 684 | echo '<tr>'; |
685 | - echo '<td>' . $dirs_array[$i]['text'] . '</td>'; |
|
686 | - echo '<td class="text-nowrap">' . $modx->toDateFormat($dirs_array[$i]['stats']['9']) . '</td>'; |
|
687 | - echo '<td class="text-right">' . $modx->nicesize($dirs_array[$i]['stats']['7']) . '</td>'; |
|
685 | + echo '<td>'.$dirs_array[$i]['text'].'</td>'; |
|
686 | + echo '<td class="text-nowrap">'.$modx->toDateFormat($dirs_array[$i]['stats']['9']).'</td>'; |
|
687 | + echo '<td class="text-right">'.$modx->nicesize($dirs_array[$i]['stats']['7']).'</td>'; |
|
688 | 688 | echo '<td class="actions text-right">'; |
689 | 689 | echo $dirs_array[$i]['rename']; |
690 | 690 | echo $dirs_array[$i]['delete']; |
@@ -697,10 +697,10 @@ discard block |
||
697 | 697 | sort($files_array); // sorting the array alphabetically (Thanks pxl8r!) |
698 | 698 | for ($i = 0; $i < $files; $i++) { |
699 | 699 | $filesizes += $files_array[$i]['stats']['7']; |
700 | - echo '<tr ' . markRow($files_array[$i]['file'], $_REQUEST['path'], $_REQUEST['mode']) . '>'; |
|
701 | - echo '<td>' . $files_array[$i]['text'] . '</td>'; |
|
702 | - echo '<td class="text-nowrap">' . $modx->toDateFormat($files_array[$i]['stats']['9']) . '</td>'; |
|
703 | - echo '<td class="text-right">' . $modx->nicesize($files_array[$i]['stats']['7']) . '</td>'; |
|
700 | + echo '<tr '.markRow($files_array[$i]['file'], $_REQUEST['path'], $_REQUEST['mode']).'>'; |
|
701 | + echo '<td>'.$files_array[$i]['text'].'</td>'; |
|
702 | + echo '<td class="text-nowrap">'.$modx->toDateFormat($files_array[$i]['stats']['9']).'</td>'; |
|
703 | + echo '<td class="text-right">'.$modx->nicesize($files_array[$i]['stats']['7']).'</td>'; |
|
704 | 704 | echo '<td class="actions text-right">'; |
705 | 705 | echo $files_array[$i]['unzip']; |
706 | 706 | echo $files_array[$i]['view']; |
@@ -837,17 +837,17 @@ discard block |
||
837 | 837 | $zip = zip_open($file); |
838 | 838 | if ($zip) { |
839 | 839 | $old_umask = umask(0); |
840 | - $path = rtrim($path, '/') . '/'; |
|
840 | + $path = rtrim($path, '/').'/'; |
|
841 | 841 | while ($zip_entry = zip_read($zip)) { |
842 | 842 | if (zip_entry_filesize($zip_entry) > 0) { |
843 | 843 | // str_replace must be used under windows to convert "/" into "\" |
844 | 844 | $zip_entry_name = zip_entry_name($zip_entry); |
845 | - $complete_path = $path . str_replace('\\', '/', dirname($zip_entry_name)); |
|
846 | - $complete_name = $path . str_replace('\\', '/', $zip_entry_name); |
|
845 | + $complete_path = $path.str_replace('\\', '/', dirname($zip_entry_name)); |
|
846 | + $complete_name = $path.str_replace('\\', '/', $zip_entry_name); |
|
847 | 847 | if (!file_exists($complete_path)) { |
848 | 848 | $tmp = ''; |
849 | 849 | foreach (explode('/', $complete_path) as $k) { |
850 | - $tmp .= $k . '/'; |
|
850 | + $tmp .= $k.'/'; |
|
851 | 851 | if (!is_dir($tmp)) { |
852 | 852 | mkdir($tmp, 0777); |
853 | 853 | } |
@@ -872,7 +872,7 @@ discard block |
||
872 | 872 | */ |
873 | 873 | function rrmdir($dir) |
874 | 874 | { |
875 | - foreach (glob($dir . '/*') as $file) { |
|
875 | + foreach (glob($dir.'/*') as $file) { |
|
876 | 876 | if (is_dir($file)) { |
877 | 877 | rrmdir($file); |
878 | 878 | } else { |
@@ -894,7 +894,7 @@ discard block |
||
894 | 894 | if (empty($_FILES['userfile']['tmp_name'][$i])) { |
895 | 895 | continue; |
896 | 896 | } |
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 |
@@ -278,8 +278,7 @@ discard block |
||
278 | 278 | /** |
279 | 279 | * Sets the width attribute of each column in the array. |
280 | 280 | * |
281 | - * @param array $value An Array of column widths in the order of the keys in the |
|
282 | - * source table array. |
|
281 | + * @param string[] $widthArray |
|
283 | 282 | */ |
284 | 283 | public function setColumnWidths($widthArray) |
285 | 284 | { |
@@ -289,7 +288,6 @@ discard block |
||
289 | 288 | /** |
290 | 289 | * An optional array of values that can be preselected when using |
291 | 290 | * |
292 | - * @param array $value Indicates the INPUT form element type attribute. |
|
293 | 291 | */ |
294 | 292 | public function setSelectedValues($valueArray) |
295 | 293 | { |
@@ -326,7 +324,7 @@ discard block |
||
326 | 324 | /** |
327 | 325 | * Determines what class the current row should have applied. |
328 | 326 | * |
329 | - * @param int $value The position of the current row being rendered. |
|
327 | + * @param integer $position |
|
330 | 328 | * @return string |
331 | 329 | */ |
332 | 330 | public function determineRowClass($position) |
@@ -353,7 +351,6 @@ discard block |
||
353 | 351 | * Generates an onclick action applied to the current cell, to execute |
354 | 352 | * any specified cell actions. |
355 | 353 | * |
356 | - * @param string $value Indicates the INPUT form element type attribute. |
|
357 | 354 | * @return string |
358 | 355 | */ |
359 | 356 | public function getCellAction($currentActionFieldValue) |
@@ -395,7 +392,7 @@ discard block |
||
395 | 392 | /** |
396 | 393 | * Function to prepare a link generated in the table cell/link actions. |
397 | 394 | * |
398 | - * @param string $value Indicates the INPUT form element type attribute. |
|
395 | + * @param string $link |
|
399 | 396 | * @return string |
400 | 397 | */ |
401 | 398 | public function prepareLink($link) |
@@ -414,7 +411,7 @@ discard block |
||
414 | 411 | * |
415 | 412 | * @param array $fieldsArray The associative array representing the table rows |
416 | 413 | * and columns. |
417 | - * @param array $fieldHeadersArray An optional array of values for providing |
|
414 | + * @param string[] $fieldHeadersArray An optional array of values for providing |
|
418 | 415 | * alternative field headers; this is an associative arrays of keys from |
419 | 416 | * the $fieldsArray where the values represent the alt heading content |
420 | 417 | * for each column. |
@@ -457,7 +457,8 @@ |
||
457 | 457 | if ($this->formElementType) { |
458 | 458 | $table = "\n" . '<form id="' . $this->formName . '" name="' . $this->formName . '" action="' . $this->formAction . '" method="POST">' . $table; |
459 | 459 | } |
460 | - if (strlen($this->pageNav) > 1) {//changed to display the pagination if exists. |
|
460 | + if (strlen($this->pageNav) > 1) { |
|
461 | +//changed to display the pagination if exists. |
|
461 | 462 | /* commented this part because of cookie |
462 | 463 | $table .= '<div id="max-display-records" ><select style="display:inline" onchange="javascript:updatePageSize(this[this.selectedIndex].value);">'; |
463 | 464 | $pageSizes= array (10, 25, 50, 100, 250); |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | */ |
131 | 131 | public function setTableWidth($value) |
132 | 132 | { |
133 | - $this->tableWidth = (int)$value; |
|
133 | + $this->tableWidth = (int) $value; |
|
134 | 134 | } |
135 | 135 | |
136 | 136 | /** |
@@ -317,7 +317,7 @@ discard block |
||
317 | 317 | { |
318 | 318 | $currentWidth = ''; |
319 | 319 | if (is_array($this->columnWidths)) { |
320 | - $currentWidth = $this->columnWidths[$columnPosition] ? ' width="' . $this->columnWidths[$columnPosition] . '" ' : ''; |
|
320 | + $currentWidth = $this->columnWidths[$columnPosition] ? ' width="'.$this->columnWidths[$columnPosition].'" ' : ''; |
|
321 | 321 | } |
322 | 322 | |
323 | 323 | return $currentWidth; |
@@ -346,7 +346,7 @@ discard block |
||
346 | 346 | $currentClass = $this->rowAlternateClass; |
347 | 347 | } |
348 | 348 | |
349 | - return ' class="' . $currentClass . '"'; |
|
349 | + return ' class="'.$currentClass.'"'; |
|
350 | 350 | } |
351 | 351 | |
352 | 352 | /** |
@@ -360,7 +360,7 @@ discard block |
||
360 | 360 | { |
361 | 361 | $cellAction = ''; |
362 | 362 | if ($this->cellAction) { |
363 | - $cellAction = ' onClick="javascript:window.location=\'' . $this->cellAction . $this->actionField . '=' . urlencode($currentActionFieldValue) . '\'" '; |
|
363 | + $cellAction = ' onClick="javascript:window.location=\''.$this->cellAction.$this->actionField.'='.urlencode($currentActionFieldValue).'\'" '; |
|
364 | 364 | } |
365 | 365 | |
366 | 366 | return $cellAction; |
@@ -377,7 +377,7 @@ discard block |
||
377 | 377 | { |
378 | 378 | $cell = $value; |
379 | 379 | if ($this->linkAction) { |
380 | - $cell = '<a href="' . $this->linkAction . $this->actionField . '=' . urlencode($currentActionFieldValue) . '">' . $cell . '</a>'; |
|
380 | + $cell = '<a href="'.$this->linkAction.$this->actionField.'='.urlencode($currentActionFieldValue).'">'.$cell.'</a>'; |
|
381 | 381 | } |
382 | 382 | |
383 | 383 | return $cell; |
@@ -406,7 +406,7 @@ discard block |
||
406 | 406 | $end = '?'; |
407 | 407 | } |
408 | 408 | |
409 | - return $link . $end; |
|
409 | + return $link.$end; |
|
410 | 410 | } |
411 | 411 | |
412 | 412 | /** |
@@ -426,7 +426,7 @@ discard block |
||
426 | 426 | if (is_array($fieldsArray)) { |
427 | 427 | $i = 0; |
428 | 428 | foreach ($fieldsArray as $fieldName => $fieldValue) { |
429 | - $table .= "\t<tr" . $this->determineRowClass($i) . ">\n"; |
|
429 | + $table .= "\t<tr".$this->determineRowClass($i).">\n"; |
|
430 | 430 | $currentActionFieldValue = $fieldValue[$this->actionField]; |
431 | 431 | if (is_array($this->selectedValues)) { |
432 | 432 | $isChecked = array_search($currentActionFieldValue, $this->selectedValues) === false ? 0 : 1; |
@@ -437,15 +437,15 @@ discard block |
||
437 | 437 | $colPosition = 0; |
438 | 438 | foreach ($fieldValue as $key => $value) { |
439 | 439 | if (!in_array($key, $this->excludeFields)) { |
440 | - $table .= "\t\t<td" . $this->getCellAction($currentActionFieldValue) . ">"; |
|
440 | + $table .= "\t\t<td".$this->getCellAction($currentActionFieldValue).">"; |
|
441 | 441 | $table .= $this->createCellText($currentActionFieldValue, $value); |
442 | 442 | $table .= "</td>\n"; |
443 | 443 | if ($i == 0) { |
444 | 444 | if (empty($header) && $this->formElementType) { |
445 | - $header .= "\t\t<th style=\"width:32px\" " . ($this->thClass ? 'class="' . $this->thClass . '"' : '') . ">" . ($this->allOption ? '<a href="javascript:clickAll()">all</a>' : '') . "</th>\n"; |
|
445 | + $header .= "\t\t<th style=\"width:32px\" ".($this->thClass ? 'class="'.$this->thClass.'"' : '').">".($this->allOption ? '<a href="javascript:clickAll()">all</a>' : '')."</th>\n"; |
|
446 | 446 | } |
447 | 447 | $headerText = array_key_exists($key, $fieldHeadersArray) ? $fieldHeadersArray[$key] : $key; |
448 | - $header .= "\t\t<th" . $this->getColumnWidth($colPosition) . ($this->thClass ? ' class="' . $this->thClass . '" ' : '') . ">" . $headerText . "</th>\n"; |
|
448 | + $header .= "\t\t<th".$this->getColumnWidth($colPosition).($this->thClass ? ' class="'.$this->thClass.'" ' : '').">".$headerText."</th>\n"; |
|
449 | 449 | } |
450 | 450 | $colPosition++; |
451 | 451 | } |
@@ -453,9 +453,9 @@ discard block |
||
453 | 453 | $i++; |
454 | 454 | $table .= "\t</tr>\n"; |
455 | 455 | } |
456 | - $table = "\n" . '<table' . ($this->tableWidth > 0 ? ' width="' . $this->tableWidth . '"' : '') . ($this->tableClass ? ' class="' . $this->tableClass . '"' : '') . ($this->tableID ? ' id="' . $this->tableID . '"' : '') . ">\n" . ($header ? "\t<thead>\n\t<tr class=\"" . $this->rowHeaderClass . "\">\n" . $header . "\t</tr>\n\t</thead>\n" : '') . $table . "</table>\n"; |
|
456 | + $table = "\n".'<table'.($this->tableWidth > 0 ? ' width="'.$this->tableWidth.'"' : '').($this->tableClass ? ' class="'.$this->tableClass.'"' : '').($this->tableID ? ' id="'.$this->tableID.'"' : '').">\n".($header ? "\t<thead>\n\t<tr class=\"".$this->rowHeaderClass."\">\n".$header."\t</tr>\n\t</thead>\n" : '').$table."</table>\n"; |
|
457 | 457 | if ($this->formElementType) { |
458 | - $table = "\n" . '<form id="' . $this->formName . '" name="' . $this->formName . '" action="' . $this->formAction . '" method="POST">' . $table; |
|
458 | + $table = "\n".'<form id="'.$this->formName.'" name="'.$this->formName.'" action="'.$this->formAction.'" method="POST">'.$table; |
|
459 | 459 | } |
460 | 460 | if (strlen($this->pageNav) > 1) {//changed to display the pagination if exists. |
461 | 461 | /* commented this part because of cookie |
@@ -469,7 +469,7 @@ discard block |
||
469 | 469 | |
470 | 470 | $table .= '</select>'.$_lang["pagination_table_perpage"].'</div>'; |
471 | 471 | */ |
472 | - $table .= '<div id="pagination" class="paginate">' . $_lang["pagination_table_gotopage"] . '<ul>' . $this->pageNav . '</ul></div>'; |
|
472 | + $table .= '<div id="pagination" class="paginate">'.$_lang["pagination_table_gotopage"].'<ul>'.$this->pageNav.'</ul></div>'; |
|
473 | 473 | //$table .= '<script language="javascript">function updatePageSize(size){window.location = \''.$this->prepareLink($linkpage).'pageSize=\'+size;}</script>'; |
474 | 474 | } |
475 | 475 | if ($this->allOption) { |
@@ -477,7 +477,7 @@ discard block |
||
477 | 477 | <script language="javascript"> |
478 | 478 | toggled = 0; |
479 | 479 | function clickAll() { |
480 | - myform = document.getElementById("' . $this->formName . '"); |
|
480 | + myform = document.getElementById("' . $this->formName.'"); |
|
481 | 481 | for(i=0;i<myform.length;i++) { |
482 | 482 | if(myform.elements[i].type==\'checkbox\') { |
483 | 483 | myform.elements[i].checked=(toggled?false:true); |
@@ -489,9 +489,9 @@ discard block |
||
489 | 489 | } |
490 | 490 | if ($this->formElementType) { |
491 | 491 | if ($this->extra) { |
492 | - $table .= "\n" . $this->extra . "\n"; |
|
492 | + $table .= "\n".$this->extra."\n"; |
|
493 | 493 | } |
494 | - $table .= "\n" . '</form>' . "\n"; |
|
494 | + $table .= "\n".'</form>'."\n"; |
|
495 | 495 | } |
496 | 496 | |
497 | 497 | return $table; |
@@ -514,7 +514,7 @@ discard block |
||
514 | 514 | $numPages = ceil($numRecords / MAX_DISPLAY_RECORDS_NUM); |
515 | 515 | $nav = ''; |
516 | 516 | if ($numPages > 1) { |
517 | - $currentURL = empty($qs) ? '' : '?' . $qs; |
|
517 | + $currentURL = empty($qs) ? '' : '?'.$qs; |
|
518 | 518 | if ($currentPage > 6) { |
519 | 519 | $nav .= $this->createPageLink($currentURL, 1, $_lang["pagination_table_first"]); |
520 | 520 | } |
@@ -539,7 +539,7 @@ discard block |
||
539 | 539 | $nav .= $this->createPageLink($currentURL, $numPages, $_lang["pagination_table_last"]); |
540 | 540 | } |
541 | 541 | } |
542 | - $this->pageNav = ' ' . $nav; |
|
542 | + $this->pageNav = ' '.$nav; |
|
543 | 543 | } |
544 | 544 | |
545 | 545 | /** |
@@ -555,14 +555,14 @@ discard block |
||
555 | 555 | public function createPageLink($link = '', $pageNum, $displayText, $currentPage = false, $qs = '') |
556 | 556 | { |
557 | 557 | $modx = evolutionCMS(); |
558 | - $orderBy = !empty($_GET['orderby']) ? '&orderby=' . $_GET['orderby'] : ''; |
|
559 | - $orderDir = !empty($_GET['orderdir']) ? '&orderdir=' . $_GET['orderdir'] : ''; |
|
558 | + $orderBy = !empty($_GET['orderby']) ? '&orderby='.$_GET['orderby'] : ''; |
|
559 | + $orderDir = !empty($_GET['orderdir']) ? '&orderdir='.$_GET['orderdir'] : ''; |
|
560 | 560 | if (!empty($qs)) { |
561 | 561 | $qs = "?$qs"; |
562 | 562 | } |
563 | 563 | $link = empty($link) ? $modx->makeUrl($modx->documentIdentifier, $modx->documentObject['alias'], |
564 | - $qs . "page=$pageNum$orderBy$orderDir") : $this->prepareLink($link) . "page=$pageNum"; |
|
565 | - $nav = '<li' . ($currentPage ? ' class="currentPage"' : '') . '><a' . ($currentPage ? ' class="currentPage"' : '') . ' href="' . $link . '">' . $displayText . '</a></li>' . "\n"; |
|
564 | + $qs."page=$pageNum$orderBy$orderDir") : $this->prepareLink($link)."page=$pageNum"; |
|
565 | + $nav = '<li'.($currentPage ? ' class="currentPage"' : '').'><a'.($currentPage ? ' class="currentPage"' : '').' href="'.$link.'">'.$displayText.'</a></li>'."\n"; |
|
566 | 566 | |
567 | 567 | return $nav; |
568 | 568 | } |
@@ -580,7 +580,7 @@ discard block |
||
580 | 580 | $field = ''; |
581 | 581 | if ($this->formElementType) { |
582 | 582 | $checked = $isChecked ? "checked " : ""; |
583 | - $field = "\t\t" . '<td><input type="' . $this->formElementType . '" name="' . ($this->formElementName ? $this->formElementName : $value) . '" value="' . $value . '" ' . $checked . '/></td>' . "\n"; |
|
583 | + $field = "\t\t".'<td><input type="'.$this->formElementType.'" name="'.($this->formElementName ? $this->formElementName : $value).'" value="'.$value.'" '.$checked.'/></td>'."\n"; |
|
584 | 584 | } |
585 | 585 | |
586 | 586 | return $field; |
@@ -594,7 +594,7 @@ discard block |
||
594 | 594 | public function handlePaging() |
595 | 595 | { |
596 | 596 | $offset = (is_numeric($_GET['page']) && $_GET['page'] > 0) ? $_GET['page'] - 1 : 0; |
597 | - $limitClause = ' LIMIT ' . ($offset * MAX_DISPLAY_RECORDS_NUM) . ', ' . MAX_DISPLAY_RECORDS_NUM; |
|
597 | + $limitClause = ' LIMIT '.($offset * MAX_DISPLAY_RECORDS_NUM).', '.MAX_DISPLAY_RECORDS_NUM; |
|
598 | 598 | |
599 | 599 | return $limitClause; |
600 | 600 | } |
@@ -609,10 +609,10 @@ discard block |
||
609 | 609 | public function handleSorting($natural_order = false) |
610 | 610 | { |
611 | 611 | $orderByClause = ''; |
612 | - if ((bool)$natural_order === false) { |
|
612 | + if ((bool) $natural_order === false) { |
|
613 | 613 | $orderby = !empty($_GET['orderby']) ? $_GET['orderby'] : "id"; |
614 | 614 | $orderdir = !empty($_GET['orderdir']) ? $_GET['orderdir'] : "DESC"; |
615 | - $orderByClause = !empty($orderby) ? ' ORDER BY ' . $orderby . ' ' . $orderdir . ' ' : ""; |
|
615 | + $orderByClause = !empty($orderby) ? ' ORDER BY '.$orderby.' '.$orderdir.' ' : ""; |
|
616 | 616 | } |
617 | 617 | |
618 | 618 | return $orderByClause; |
@@ -641,6 +641,6 @@ discard block |
||
641 | 641 | } |
642 | 642 | } |
643 | 643 | |
644 | - return '<a href="[~' . $modx->documentIdentifier . '~]?' . $qs . 'orderby=' . $key . $orderDir . '">' . $text . '</a>'; |
|
644 | + return '<a href="[~'.$modx->documentIdentifier.'~]?'.$qs.'orderby='.$key.$orderDir.'">'.$text.'</a>'; |
|
645 | 645 | } |
646 | 646 | } |
@@ -149,7 +149,7 @@ |
||
149 | 149 | /** |
150 | 150 | * This function returns the current page number. |
151 | 151 | * |
152 | - * @return int |
|
152 | + * @return string |
|
153 | 153 | */ |
154 | 154 | public function getCurrentPage() |
155 | 155 | { |
@@ -101,14 +101,14 @@ discard block |
||
101 | 101 | $array_paging['total'] = $this->int_nbr_row; |
102 | 102 | |
103 | 103 | if ($this->int_cur_position != 0) { |
104 | - $array_paging['first_link'] = "<a href=\"$PHP_SELF?int_cur_position=0" . $this->str_ext_argv . "\">"; |
|
105 | - $array_paging['previous_link'] = "<a href=\"$PHP_SELF?int_cur_position=" . ($this->int_cur_position - $this->int_num_result) . $this->str_ext_argv . "\">"; |
|
104 | + $array_paging['first_link'] = "<a href=\"$PHP_SELF?int_cur_position=0".$this->str_ext_argv."\">"; |
|
105 | + $array_paging['previous_link'] = "<a href=\"$PHP_SELF?int_cur_position=".($this->int_cur_position - $this->int_num_result).$this->str_ext_argv."\">"; |
|
106 | 106 | } |
107 | 107 | |
108 | 108 | if (($this->int_nbr_row - $this->int_cur_position) > $this->int_num_result) { |
109 | 109 | $int_new_position = $this->int_cur_position + $this->int_num_result; |
110 | - $array_paging['last_link'] = "<a href=\"$PHP_SELF?int_cur_position=" . $this->int_nbr_row . $this->str_ext_argv . "\">"; |
|
111 | - $array_paging['next_link'] = "<a href=\"$PHP_SELF?int_cur_position=$int_new_position" . $this->str_ext_argv . "\">"; |
|
110 | + $array_paging['last_link'] = "<a href=\"$PHP_SELF?int_cur_position=".$this->int_nbr_row.$this->str_ext_argv."\">"; |
|
111 | + $array_paging['next_link'] = "<a href=\"$PHP_SELF?int_cur_position=$int_new_position".$this->str_ext_argv."\">"; |
|
112 | 112 | } |
113 | 113 | |
114 | 114 | return $array_paging; |
@@ -126,10 +126,10 @@ discard block |
||
126 | 126 | for ($i = 0; $i < $this->getNumberOfPage(); $i++) { |
127 | 127 | // if current page, do not make a link |
128 | 128 | if ($i == $this->getCurrentPage()) { |
129 | - $array_all_page[$i] = "<b>" . ($i + 1) . "</b> "; |
|
129 | + $array_all_page[$i] = "<b>".($i + 1)."</b> "; |
|
130 | 130 | } else { |
131 | 131 | $int_new_position = ($i * $this->int_num_result); |
132 | - $array_all_page[$i] = "<a href=\"" . $PHP_SELF . "?int_cur_position=$int_new_position$this->str_ext_argv\">" . ($i + 1) . "</a> "; |
|
132 | + $array_all_page[$i] = "<a href=\"".$PHP_SELF."?int_cur_position=$int_new_position$this->str_ext_argv\">".($i + 1)."</a> "; |
|
133 | 133 | } |
134 | 134 | } |
135 | 135 |
@@ -16,7 +16,7 @@ |
||
16 | 16 | // sanitize array |
17 | 17 | if (!function_exists('modx_sanitize_gpc')) { |
18 | 18 | /** |
19 | - * @param array|string $values |
|
19 | + * @param string $values |
|
20 | 20 | * @param int $depth |
21 | 21 | * @return array|string |
22 | 22 | */ |
@@ -11,7 +11,7 @@ |
||
11 | 11 | } |
12 | 12 | |
13 | 13 | global $sanitize_seed; |
14 | -$sanitize_seed = 'sanitize_seed_' . base_convert(md5(__FILE__), 16, 36); |
|
14 | +$sanitize_seed = 'sanitize_seed_'.base_convert(md5(__FILE__), 16, 36); |
|
15 | 15 | |
16 | 16 | // sanitize array |
17 | 17 | if (!function_exists('modx_sanitize_gpc')) { |
@@ -349,7 +349,7 @@ |
||
349 | 349 | /** |
350 | 350 | * returns an array if a delimiter is present. returns array is a recordset is present |
351 | 351 | * |
352 | - * @param $src |
|
352 | + * @param string $src |
|
353 | 353 | * @param string $delim |
354 | 354 | * @param string $type |
355 | 355 | * @param bool $columns |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | $o = ''; |
22 | 22 | |
23 | 23 | // process any TV commands in value |
24 | - $docid = (int)$docid > 0 ? (int)$docid : $modx->documentIdentifier; |
|
24 | + $docid = (int) $docid > 0 ? (int) $docid : $modx->documentIdentifier; |
|
25 | 25 | $value = ProcessTVCommand($value, $name, $docid); |
26 | 26 | |
27 | 27 | $params = array(); |
@@ -60,12 +60,12 @@ discard block |
||
60 | 60 | $attr['align'] = $params['align']; |
61 | 61 | } |
62 | 62 | foreach ($attr as $k => $v) { |
63 | - $attributes .= ($v ? ' ' . $k . '="' . $v . '"' : ''); |
|
63 | + $attributes .= ($v ? ' '.$k.'="'.$v.'"' : ''); |
|
64 | 64 | } |
65 | - $attributes .= ' ' . $params['attrib']; |
|
65 | + $attributes .= ' '.$params['attrib']; |
|
66 | 66 | |
67 | 67 | // Output the image with attributes |
68 | - $o .= '<img' . rtrim($attributes) . ' />'; |
|
68 | + $o .= '<img'.rtrim($attributes).' />'; |
|
69 | 69 | } |
70 | 70 | } |
71 | 71 | break; |
@@ -131,12 +131,12 @@ discard block |
||
131 | 131 | 'target' => $params['target'], |
132 | 132 | ); |
133 | 133 | foreach ($attr as $k => $v) { |
134 | - $attributes .= ($v ? ' ' . $k . '="' . $v . '"' : ''); |
|
134 | + $attributes .= ($v ? ' '.$k.'="'.$v.'"' : ''); |
|
135 | 135 | } |
136 | - $attributes .= ' ' . $params['attrib']; // add extra |
|
136 | + $attributes .= ' '.$params['attrib']; // add extra |
|
137 | 137 | |
138 | 138 | // Output the link |
139 | - $o .= '<a' . rtrim($attributes) . '>' . ($params['text'] ? $modx->htmlspecialchars($params['text']) : $name) . '</a>'; |
|
139 | + $o .= '<a'.rtrim($attributes).'>'.($params['text'] ? $modx->htmlspecialchars($params['text']) : $name).'</a>'; |
|
140 | 140 | } |
141 | 141 | } |
142 | 142 | break; |
@@ -162,12 +162,12 @@ discard block |
||
162 | 162 | 'style' => $params['style'], |
163 | 163 | ); |
164 | 164 | foreach ($attr as $k => $v) { |
165 | - $attributes .= ($v ? ' ' . $k . '="' . $v . '"' : ''); |
|
165 | + $attributes .= ($v ? ' '.$k.'="'.$v.'"' : ''); |
|
166 | 166 | } |
167 | - $attributes .= ' ' . $params['attrib']; // add extra |
|
167 | + $attributes .= ' '.$params['attrib']; // add extra |
|
168 | 168 | |
169 | 169 | // Output the HTML Tag |
170 | - $o .= '<' . $tagname . rtrim($attributes) . '>' . $tagvalue . '</' . $tagname . '>'; |
|
170 | + $o .= '<'.$tagname.rtrim($attributes).'>'.$tagvalue.'</'.$tagname.'>'; |
|
171 | 171 | } |
172 | 172 | break; |
173 | 173 | |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | $w = $params['w'] ? $params['w'] : '100%'; |
177 | 177 | $h = $params['h'] ? $params['h'] : '400px'; |
178 | 178 | $richtexteditor = $params['edt'] ? $params['edt'] : ""; |
179 | - $o = '<div class="MODX_RichTextWidget"><textarea id="' . $id . '" name="' . $id . '" style="width:' . $w . '; height:' . $h . ';">'; |
|
179 | + $o = '<div class="MODX_RichTextWidget"><textarea id="'.$id.'" name="'.$id.'" style="width:'.$w.'; height:'.$h.';">'; |
|
180 | 180 | $o .= $modx->htmlspecialchars($value); |
181 | 181 | $o .= '</textarea></div>'; |
182 | 182 | $replace_richtext = array($id); |
@@ -203,7 +203,7 @@ discard block |
||
203 | 203 | |
204 | 204 | case "viewport": |
205 | 205 | $value = parseInput($value); |
206 | - $id = '_' . time(); |
|
206 | + $id = '_'.time(); |
|
207 | 207 | if (!$params['vpid']) { |
208 | 208 | $params['vpid'] = $id; |
209 | 209 | } |
@@ -217,37 +217,37 @@ discard block |
||
217 | 217 | $h = "100%"; |
218 | 218 | } |
219 | 219 | if ($params['asize'] == 'Yes' || ($params['awidth'] == 'Yes' && $params['aheight'] == 'Yes')) { |
220 | - $autoMode = "3"; //both |
|
220 | + $autoMode = "3"; //both |
|
221 | 221 | } elseif ($params['awidth'] == 'Yes') { |
222 | 222 | $autoMode = "1"; //width only |
223 | 223 | } elseif ($params['aheight'] == 'Yes') { |
224 | - $autoMode = "2"; //height only |
|
224 | + $autoMode = "2"; //height only |
|
225 | 225 | } |
226 | 226 | |
227 | - $modx->regClientStartupScript(MODX_MANAGER_URL . "media/script/bin/viewport.js", array( |
|
227 | + $modx->regClientStartupScript(MODX_MANAGER_URL."media/script/bin/viewport.js", array( |
|
228 | 228 | 'name' => 'viewport', |
229 | 229 | 'version' => '0', |
230 | 230 | 'plaintext' => false |
231 | 231 | )); |
232 | - $o = $sTag . " id='" . $params['vpid'] . "' name='" . $params['vpid'] . "' "; |
|
232 | + $o = $sTag." id='".$params['vpid']."' name='".$params['vpid']."' "; |
|
233 | 233 | if ($params['class']) { |
234 | - $o .= " class='" . $params['class'] . "' "; |
|
234 | + $o .= " class='".$params['class']."' "; |
|
235 | 235 | } |
236 | 236 | if ($params['style']) { |
237 | - $o .= " style='" . $params['style'] . "' "; |
|
237 | + $o .= " style='".$params['style']."' "; |
|
238 | 238 | } |
239 | 239 | if ($params['attrib']) { |
240 | - $o .= $params['attrib'] . " "; |
|
240 | + $o .= $params['attrib']." "; |
|
241 | 241 | } |
242 | - $o .= "scrolling='" . ($params['sbar'] == 'No' ? "no" : ($params['sbar'] == 'Yes' ? "yes" : "auto")) . "' "; |
|
243 | - $o .= "src='" . $value . "' frameborder='" . $params['borsize'] . "' "; |
|
244 | - $o .= "onload=\"window.setTimeout('ResizeViewPort(\\'" . $params['vpid'] . "\\'," . $autoMode . ")',100);\" width='" . $w . "' height='" . $h . "' "; |
|
242 | + $o .= "scrolling='".($params['sbar'] == 'No' ? "no" : ($params['sbar'] == 'Yes' ? "yes" : "auto"))."' "; |
|
243 | + $o .= "src='".$value."' frameborder='".$params['borsize']."' "; |
|
244 | + $o .= "onload=\"window.setTimeout('ResizeViewPort(\\'".$params['vpid']."\\',".$autoMode.")',100);\" width='".$w."' height='".$h."' "; |
|
245 | 245 | $o .= ">"; |
246 | 246 | $o .= $eTag; |
247 | 247 | break; |
248 | 248 | |
249 | 249 | case "datagrid": |
250 | - include_once MODX_MANAGER_PATH . "includes/controls/datagrid.class.php"; |
|
250 | + include_once MODX_MANAGER_PATH."includes/controls/datagrid.class.php"; |
|
251 | 251 | $grd = new DataGrid('', $value); |
252 | 252 | |
253 | 253 | $grd->noRecordMsg = $params['egmsg']; |
@@ -294,16 +294,16 @@ discard block |
||
294 | 294 | $o = ''; |
295 | 295 | /* If we are loading a file */ |
296 | 296 | if (substr($params['output'], 0, 5) == "@FILE") { |
297 | - $file_name = MODX_BASE_PATH . trim(substr($params['output'], 6)); |
|
297 | + $file_name = MODX_BASE_PATH.trim(substr($params['output'], 6)); |
|
298 | 298 | if (!file_exists($file_name)) { |
299 | - $widget_output = $file_name . ' does not exist'; |
|
299 | + $widget_output = $file_name.' does not exist'; |
|
300 | 300 | } else { |
301 | 301 | $widget_output = file_get_contents($file_name); |
302 | 302 | } |
303 | 303 | } elseif (substr($params['output'], 0, 8) == '@INCLUDE') { |
304 | - $file_name = MODX_BASE_PATH . trim(substr($params['output'], 9)); |
|
304 | + $file_name = MODX_BASE_PATH.trim(substr($params['output'], 9)); |
|
305 | 305 | if (!file_exists($file_name)) { |
306 | - $widget_output = $file_name . ' does not exist'; |
|
306 | + $widget_output = $file_name.' does not exist'; |
|
307 | 307 | } else { |
308 | 308 | /* The included file needs to set $widget_output. Can be string, array, object */ |
309 | 309 | include $file_name; |
@@ -363,7 +363,8 @@ |
||
363 | 363 | * @return array|string |
364 | 364 | */ |
365 | 365 | function parseInput($src, $delim = "||", $type = "string", $columns = true) |
366 | -{ // type can be: string, array |
|
366 | +{ |
|
367 | +// type can be: string, array |
|
367 | 368 | $modx = evolutionCMS(); |
368 | 369 | if ($modx->db->isResult($src)) { |
369 | 370 | // must be a recordset |