@@ -476,7 +476,8 @@ discard block |
||
| 476 | 476 | return s; |
| 477 | 477 | } |
| 478 | 478 | |
| 479 | - <?php if ($content['type'] == 'reference' || $modx->manager->action == '72') { // Web Link specific ?> |
|
| 479 | + <?php if ($content['type'] == 'reference' || $modx->manager->action == '72') { |
|
| 480 | +// Web Link specific ?> |
|
| 480 | 481 | var lastImageCtrl; |
| 481 | 482 | var lastFileCtrl; |
| 482 | 483 | |
@@ -692,7 +693,8 @@ discard block |
||
| 692 | 693 | </td> |
| 693 | 694 | </tr> |
| 694 | 695 | |
| 695 | - <?php if($content['type'] == 'reference' || $modx->manager->action == '72') { // Web Link specific ?> |
|
| 696 | + <?php if($content['type'] == 'reference' || $modx->manager->action == '72') { |
|
| 697 | +// Web Link specific ?> |
|
| 696 | 698 | |
| 697 | 699 | <tr> |
| 698 | 700 | <td><span class="warning"><?= $_lang['weblink'] ?></span> |
@@ -1370,7 +1372,9 @@ discard block |
||
| 1370 | 1372 | if($documentId > 0) { |
| 1371 | 1373 | // Load up, the permissions from the parent (if new document) or existing document |
| 1372 | 1374 | $rs = $modx->db->select('id, document_group', $tbl_document_groups, "document='{$documentId}'"); |
| 1373 | - while($currentgroup = $modx->db->getRow($rs)) $groupsarray[] = $currentgroup['document_group'] . ',' . $currentgroup['id']; |
|
| 1375 | + while($currentgroup = $modx->db->getRow($rs)) { |
|
| 1376 | + $groupsarray[] = $currentgroup['document_group'] . ',' . $currentgroup['id']; |
|
| 1377 | + } |
|
| 1374 | 1378 | |
| 1375 | 1379 | // Load up the current permissions and names |
| 1376 | 1380 | $vs = array( |
@@ -1432,7 +1436,9 @@ discard block |
||
| 1432 | 1436 | |
| 1433 | 1437 | // Create attribute string list |
| 1434 | 1438 | $inputString = array(); |
| 1435 | - foreach($inputAttributes as $k => $v) $inputString[] = $k . '="' . $v . '"'; |
|
| 1439 | + foreach($inputAttributes as $k => $v) { |
|
| 1440 | + $inputString[] = $k . '="' . $v . '"'; |
|
| 1441 | + } |
|
| 1436 | 1442 | |
| 1437 | 1443 | // Make the <input> HTML |
| 1438 | 1444 | $inputHTML = '<input ' . implode(' ', $inputString) . ' />'; |
@@ -1,6 +1,6 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
| 3 | - die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
| 3 | + die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
| 4 | 4 | } |
| 5 | 5 | |
| 6 | 6 | /********************/ |
@@ -12,29 +12,29 @@ discard block |
||
| 12 | 12 | |
| 13 | 13 | // check permissions |
| 14 | 14 | switch($modx->manager->action) { |
| 15 | - case 27: |
|
| 16 | - if(!$modx->hasPermission('edit_document')) { |
|
| 17 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 18 | - } |
|
| 19 | - break; |
|
| 20 | - case 85: |
|
| 21 | - case 72: |
|
| 22 | - case 4: |
|
| 23 | - if(!$modx->hasPermission('new_document')) { |
|
| 24 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 25 | - } elseif(isset($_REQUEST['pid']) && $_REQUEST['pid'] != '0') { |
|
| 26 | - // check user has permissions for parent |
|
| 27 | - $udperms = new EvolutionCMS\Legacy\Permissions(); |
|
| 28 | - $udperms->user = $modx->getLoginUserID(); |
|
| 29 | - $udperms->document = empty($_REQUEST['pid']) ? 0 : $_REQUEST['pid']; |
|
| 30 | - $udperms->role = $_SESSION['mgrRole']; |
|
| 31 | - if(!$udperms->checkPermissions()) { |
|
| 32 | - $modx->webAlertAndQuit($_lang["access_permission_denied"]); |
|
| 33 | - } |
|
| 34 | - } |
|
| 35 | - break; |
|
| 36 | - default: |
|
| 37 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 15 | + case 27: |
|
| 16 | + if(!$modx->hasPermission('edit_document')) { |
|
| 17 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 18 | + } |
|
| 19 | + break; |
|
| 20 | + case 85: |
|
| 21 | + case 72: |
|
| 22 | + case 4: |
|
| 23 | + if(!$modx->hasPermission('new_document')) { |
|
| 24 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 25 | + } elseif(isset($_REQUEST['pid']) && $_REQUEST['pid'] != '0') { |
|
| 26 | + // check user has permissions for parent |
|
| 27 | + $udperms = new EvolutionCMS\Legacy\Permissions(); |
|
| 28 | + $udperms->user = $modx->getLoginUserID(); |
|
| 29 | + $udperms->document = empty($_REQUEST['pid']) ? 0 : $_REQUEST['pid']; |
|
| 30 | + $udperms->role = $_SESSION['mgrRole']; |
|
| 31 | + if(!$udperms->checkPermissions()) { |
|
| 32 | + $modx->webAlertAndQuit($_lang["access_permission_denied"]); |
|
| 33 | + } |
|
| 34 | + } |
|
| 35 | + break; |
|
| 36 | + default: |
|
| 37 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | $id = isset($_REQUEST['id']) ? (int)$_REQUEST['id'] : 0; |
@@ -53,21 +53,21 @@ discard block |
||
| 53 | 53 | $tbl_site_tmplvars = $modx->getFullTableName('site_tmplvars'); |
| 54 | 54 | |
| 55 | 55 | if($modx->manager->action == 27) { |
| 56 | - //editing an existing document |
|
| 57 | - // check permissions on the document |
|
| 58 | - $udperms = new EvolutionCMS\Legacy\Permissions(); |
|
| 59 | - $udperms->user = $modx->getLoginUserID(); |
|
| 60 | - $udperms->document = $id; |
|
| 61 | - $udperms->role = $_SESSION['mgrRole']; |
|
| 62 | - |
|
| 63 | - if(!$udperms->checkPermissions()) { |
|
| 64 | - $modx->webAlertAndQuit($_lang["access_permission_denied"]); |
|
| 65 | - } |
|
| 56 | + //editing an existing document |
|
| 57 | + // check permissions on the document |
|
| 58 | + $udperms = new EvolutionCMS\Legacy\Permissions(); |
|
| 59 | + $udperms->user = $modx->getLoginUserID(); |
|
| 60 | + $udperms->document = $id; |
|
| 61 | + $udperms->role = $_SESSION['mgrRole']; |
|
| 62 | + |
|
| 63 | + if(!$udperms->checkPermissions()) { |
|
| 64 | + $modx->webAlertAndQuit($_lang["access_permission_denied"]); |
|
| 65 | + } |
|
| 66 | 66 | } |
| 67 | 67 | |
| 68 | 68 | // check to see if resource isn't locked |
| 69 | 69 | if($lockedEl = $modx->elementIsLocked(7, $id)) { |
| 70 | - $modx->webAlertAndQuit(sprintf($_lang['lock_msg'], $lockedEl['username'], $_lang['resource'])); |
|
| 70 | + $modx->webAlertAndQuit(sprintf($_lang['lock_msg'], $lockedEl['username'], $_lang['resource'])); |
|
| 71 | 71 | } |
| 72 | 72 | // end check for lock |
| 73 | 73 | |
@@ -76,74 +76,74 @@ discard block |
||
| 76 | 76 | |
| 77 | 77 | // get document groups for current user |
| 78 | 78 | if($_SESSION['mgrDocgroups']) { |
| 79 | - $docgrp = implode(',', $_SESSION['mgrDocgroups']); |
|
| 79 | + $docgrp = implode(',', $_SESSION['mgrDocgroups']); |
|
| 80 | 80 | } |
| 81 | 81 | |
| 82 | 82 | if(!empty ($id)) { |
| 83 | - $access = sprintf("1='%s' OR sc.privatemgr=0", $_SESSION['mgrRole']); |
|
| 84 | - if($docgrp) { |
|
| 85 | - $access .= " OR dg.document_group IN ({$docgrp})"; |
|
| 86 | - } |
|
| 87 | - $rs = $modx->db->select('sc.*', "{$tbl_site_content} AS sc LEFT JOIN {$tbl_document_groups} AS dg ON dg.document=sc.id", "sc.id='{$id}' AND ({$access})"); |
|
| 88 | - $content = array(); |
|
| 89 | - $content = $modx->db->getRow($rs); |
|
| 90 | - $modx->documentObject = &$content; |
|
| 91 | - if(!$content) { |
|
| 92 | - $modx->webAlertAndQuit($_lang["access_permission_denied"]); |
|
| 93 | - } |
|
| 94 | - $_SESSION['itemname'] = $content['pagetitle']; |
|
| 83 | + $access = sprintf("1='%s' OR sc.privatemgr=0", $_SESSION['mgrRole']); |
|
| 84 | + if($docgrp) { |
|
| 85 | + $access .= " OR dg.document_group IN ({$docgrp})"; |
|
| 86 | + } |
|
| 87 | + $rs = $modx->db->select('sc.*', "{$tbl_site_content} AS sc LEFT JOIN {$tbl_document_groups} AS dg ON dg.document=sc.id", "sc.id='{$id}' AND ({$access})"); |
|
| 88 | + $content = array(); |
|
| 89 | + $content = $modx->db->getRow($rs); |
|
| 90 | + $modx->documentObject = &$content; |
|
| 91 | + if(!$content) { |
|
| 92 | + $modx->webAlertAndQuit($_lang["access_permission_denied"]); |
|
| 93 | + } |
|
| 94 | + $_SESSION['itemname'] = $content['pagetitle']; |
|
| 95 | 95 | } else { |
| 96 | - $content = array(); |
|
| 96 | + $content = array(); |
|
| 97 | 97 | |
| 98 | - if(isset($_REQUEST['newtemplate'])) { |
|
| 99 | - $content['template'] = $_REQUEST['newtemplate']; |
|
| 100 | - } else { |
|
| 101 | - $content['template'] = getDefaultTemplate(); |
|
| 102 | - } |
|
| 98 | + if(isset($_REQUEST['newtemplate'])) { |
|
| 99 | + $content['template'] = $_REQUEST['newtemplate']; |
|
| 100 | + } else { |
|
| 101 | + $content['template'] = getDefaultTemplate(); |
|
| 102 | + } |
|
| 103 | 103 | |
| 104 | - $_SESSION['itemname'] = $_lang["new_resource"]; |
|
| 104 | + $_SESSION['itemname'] = $_lang["new_resource"]; |
|
| 105 | 105 | } |
| 106 | 106 | |
| 107 | 107 | // restore saved form |
| 108 | 108 | $formRestored = $modx->manager->loadFormValues(); |
| 109 | 109 | if(isset($_REQUEST['newtemplate'])) { |
| 110 | - $formRestored = true; |
|
| 110 | + $formRestored = true; |
|
| 111 | 111 | } |
| 112 | 112 | |
| 113 | 113 | // retain form values if template was changed |
| 114 | 114 | // edited to convert pub_date and unpub_date |
| 115 | 115 | // sottwell 02-09-2006 |
| 116 | 116 | if($formRestored == true) { |
| 117 | - $content = array_merge($content, $_POST); |
|
| 118 | - $content['content'] = $_POST['ta']; |
|
| 119 | - if(empty ($content['pub_date'])) { |
|
| 120 | - unset ($content['pub_date']); |
|
| 121 | - } else { |
|
| 122 | - $content['pub_date'] = $modx->toTimeStamp($content['pub_date']); |
|
| 123 | - } |
|
| 124 | - if(empty ($content['unpub_date'])) { |
|
| 125 | - unset ($content['unpub_date']); |
|
| 126 | - } else { |
|
| 127 | - $content['unpub_date'] = $modx->toTimeStamp($content['unpub_date']); |
|
| 128 | - } |
|
| 117 | + $content = array_merge($content, $_POST); |
|
| 118 | + $content['content'] = $_POST['ta']; |
|
| 119 | + if(empty ($content['pub_date'])) { |
|
| 120 | + unset ($content['pub_date']); |
|
| 121 | + } else { |
|
| 122 | + $content['pub_date'] = $modx->toTimeStamp($content['pub_date']); |
|
| 123 | + } |
|
| 124 | + if(empty ($content['unpub_date'])) { |
|
| 125 | + unset ($content['unpub_date']); |
|
| 126 | + } else { |
|
| 127 | + $content['unpub_date'] = $modx->toTimeStamp($content['unpub_date']); |
|
| 128 | + } |
|
| 129 | 129 | } |
| 130 | 130 | |
| 131 | 131 | // increase menu index if this is a new document |
| 132 | 132 | if(!isset ($_REQUEST['id'])) { |
| 133 | - if(!isset ($modx->config['auto_menuindex'])) { |
|
| 134 | - $modx->config['auto_menuindex'] = 1; |
|
| 135 | - } |
|
| 136 | - if($modx->config['auto_menuindex']) { |
|
| 137 | - $pid = (int)$_REQUEST['pid']; |
|
| 138 | - $rs = $modx->db->select('count(*)', $tbl_site_content, "parent='{$pid}'"); |
|
| 139 | - $content['menuindex'] = $modx->db->getValue($rs); |
|
| 140 | - } else { |
|
| 141 | - $content['menuindex'] = 0; |
|
| 142 | - } |
|
| 133 | + if(!isset ($modx->config['auto_menuindex'])) { |
|
| 134 | + $modx->config['auto_menuindex'] = 1; |
|
| 135 | + } |
|
| 136 | + if($modx->config['auto_menuindex']) { |
|
| 137 | + $pid = (int)$_REQUEST['pid']; |
|
| 138 | + $rs = $modx->db->select('count(*)', $tbl_site_content, "parent='{$pid}'"); |
|
| 139 | + $content['menuindex'] = $modx->db->getValue($rs); |
|
| 140 | + } else { |
|
| 141 | + $content['menuindex'] = 0; |
|
| 142 | + } |
|
| 143 | 143 | } |
| 144 | 144 | |
| 145 | 145 | if(isset ($_POST['which_editor'])) { |
| 146 | - $modx->config['which_editor'] = $_POST['which_editor']; |
|
| 146 | + $modx->config['which_editor'] = $_POST['which_editor']; |
|
| 147 | 147 | } |
| 148 | 148 | |
| 149 | 149 | // Add lock-element JS-Script |
@@ -543,23 +543,23 @@ discard block |
||
| 543 | 543 | |
| 544 | 544 | <form name="mutate" id="mutate" class="content" method="post" enctype="multipart/form-data" action="index.php" onsubmit="documentDirty=false;"> |
| 545 | 545 | <?php |
| 546 | - // invoke OnDocFormPrerender event |
|
| 547 | - $evtOut = $modx->invokeEvent('OnDocFormPrerender', array( |
|
| 548 | - 'id' => $id, |
|
| 549 | - 'template' => $content['template'] |
|
| 550 | - )); |
|
| 551 | - |
|
| 552 | - if(is_array($evtOut)) { |
|
| 553 | - echo implode('', $evtOut); |
|
| 554 | - } |
|
| 555 | - |
|
| 556 | - /*************************/ |
|
| 557 | - $dir = isset($_REQUEST['dir']) ? $_REQUEST['dir'] : ''; |
|
| 558 | - $sort = isset($_REQUEST['sort']) ? $_REQUEST['sort'] : 'createdon'; |
|
| 559 | - $page = isset($_REQUEST['page']) ? (int) $_REQUEST['page'] : ''; |
|
| 560 | - /*************************/ |
|
| 561 | - |
|
| 562 | - ?> |
|
| 546 | + // invoke OnDocFormPrerender event |
|
| 547 | + $evtOut = $modx->invokeEvent('OnDocFormPrerender', array( |
|
| 548 | + 'id' => $id, |
|
| 549 | + 'template' => $content['template'] |
|
| 550 | + )); |
|
| 551 | + |
|
| 552 | + if(is_array($evtOut)) { |
|
| 553 | + echo implode('', $evtOut); |
|
| 554 | + } |
|
| 555 | + |
|
| 556 | + /*************************/ |
|
| 557 | + $dir = isset($_REQUEST['dir']) ? $_REQUEST['dir'] : ''; |
|
| 558 | + $sort = isset($_REQUEST['sort']) ? $_REQUEST['sort'] : 'createdon'; |
|
| 559 | + $page = isset($_REQUEST['page']) ? (int) $_REQUEST['page'] : ''; |
|
| 560 | + /*************************/ |
|
| 561 | + |
|
| 562 | + ?> |
|
| 563 | 563 | <input type="hidden" name="a" value="5" /> |
| 564 | 564 | <input type="hidden" name="id" value="<?= $content['id'] ?>" /> |
| 565 | 565 | <input type="hidden" name="mode" value="<?= $modx->manager->action ?>" /> |
@@ -574,54 +574,54 @@ discard block |
||
| 574 | 574 | |
| 575 | 575 | <h1> |
| 576 | 576 | <i class="fa fa-pencil-square-o"></i><?php if(isset($_REQUEST['id'])) { |
| 577 | - echo iconv_substr($content['pagetitle'], 0, 50, $modx->config['modx_charset']) . (iconv_strlen($content['pagetitle'], $modx->config['modx_charset']) > 50 ? '...' : '') . '<small>(' . $_REQUEST['id'] . ')</small>'; |
|
| 578 | - } else { |
|
| 579 | - if ($modx->manager->action == '4') { |
|
| 577 | + echo iconv_substr($content['pagetitle'], 0, 50, $modx->config['modx_charset']) . (iconv_strlen($content['pagetitle'], $modx->config['modx_charset']) > 50 ? '...' : '') . '<small>(' . $_REQUEST['id'] . ')</small>'; |
|
| 578 | + } else { |
|
| 579 | + if ($modx->manager->action == '4') { |
|
| 580 | 580 | echo $_lang['add_resource']; |
| 581 | 581 | } else if ($modx->manager->action == '72') { |
| 582 | 582 | echo $_lang['add_weblink']; |
| 583 | 583 | } else { |
| 584 | 584 | echo $_lang['create_resource_title']; |
| 585 | 585 | } |
| 586 | - } ?> |
|
| 586 | + } ?> |
|
| 587 | 587 | </h1> |
| 588 | 588 | |
| 589 | 589 | <?= $_style['actionbuttons']['dynamic']['document'] ?> |
| 590 | 590 | |
| 591 | 591 | <?php |
| 592 | - // breadcrumbs |
|
| 593 | - if($modx->config['use_breadcrumbs']) { |
|
| 594 | - $temp = array(); |
|
| 595 | - $title = isset($content['pagetitle']) ? $content['pagetitle'] : $_lang['create_resource_title']; |
|
| 596 | - |
|
| 597 | - if(isset($_REQUEST['id']) && $content['parent'] != 0) { |
|
| 598 | - $bID = (int) $_REQUEST['id']; |
|
| 599 | - $temp = $modx->getParentIds($bID); |
|
| 600 | - } else if(isset($_REQUEST['pid'])) { |
|
| 601 | - $bID = (int) $_REQUEST['pid']; |
|
| 602 | - $temp = $modx->getParentIds($bID); |
|
| 603 | - array_unshift($temp, $bID); |
|
| 604 | - } |
|
| 605 | - |
|
| 606 | - if($temp) { |
|
| 607 | - $parents = implode(',', $temp); |
|
| 608 | - |
|
| 609 | - if(!empty($parents)) { |
|
| 610 | - $where = "FIND_IN_SET(id,'{$parents}') DESC"; |
|
| 611 | - $rs = $modx->db->select('id, pagetitle', $tbl_site_content, "id IN ({$parents})", $where); |
|
| 612 | - while($row = $modx->db->getRow($rs)) { |
|
| 613 | - $out .= '<li class="breadcrumbs__li"> |
|
| 592 | + // breadcrumbs |
|
| 593 | + if($modx->config['use_breadcrumbs']) { |
|
| 594 | + $temp = array(); |
|
| 595 | + $title = isset($content['pagetitle']) ? $content['pagetitle'] : $_lang['create_resource_title']; |
|
| 596 | + |
|
| 597 | + if(isset($_REQUEST['id']) && $content['parent'] != 0) { |
|
| 598 | + $bID = (int) $_REQUEST['id']; |
|
| 599 | + $temp = $modx->getParentIds($bID); |
|
| 600 | + } else if(isset($_REQUEST['pid'])) { |
|
| 601 | + $bID = (int) $_REQUEST['pid']; |
|
| 602 | + $temp = $modx->getParentIds($bID); |
|
| 603 | + array_unshift($temp, $bID); |
|
| 604 | + } |
|
| 605 | + |
|
| 606 | + if($temp) { |
|
| 607 | + $parents = implode(',', $temp); |
|
| 608 | + |
|
| 609 | + if(!empty($parents)) { |
|
| 610 | + $where = "FIND_IN_SET(id,'{$parents}') DESC"; |
|
| 611 | + $rs = $modx->db->select('id, pagetitle', $tbl_site_content, "id IN ({$parents})", $where); |
|
| 612 | + while($row = $modx->db->getRow($rs)) { |
|
| 613 | + $out .= '<li class="breadcrumbs__li"> |
|
| 614 | 614 | <a href="index.php?a=27&id=' . $row['id'] . '" class="breadcrumbs__a">' . htmlspecialchars($row['pagetitle'], ENT_QUOTES, $modx->config['modx_charset']) . '</a> |
| 615 | 615 | <span class="breadcrumbs__sep">></span> |
| 616 | 616 | </li>'; |
| 617 | - } |
|
| 618 | - } |
|
| 619 | - } |
|
| 617 | + } |
|
| 618 | + } |
|
| 619 | + } |
|
| 620 | 620 | |
| 621 | - $out .= '<li class="breadcrumbs__li breadcrumbs__li_current">' . $title . '</li>'; |
|
| 622 | - echo '<ul class="breadcrumbs">' . $out . '</ul>'; |
|
| 623 | - } |
|
| 624 | - ?> |
|
| 621 | + $out .= '<li class="breadcrumbs__li breadcrumbs__li_current">' . $title . '</li>'; |
|
| 622 | + echo '<ul class="breadcrumbs">' . $out . '</ul>'; |
|
| 623 | + } |
|
| 624 | + ?> |
|
| 625 | 625 | |
| 626 | 626 | <!-- start main wrapper --> |
| 627 | 627 | <div class="sectionBody"> |
@@ -633,13 +633,13 @@ discard block |
||
| 633 | 633 | |
| 634 | 634 | <!-- General --> |
| 635 | 635 | <?php |
| 636 | - $evtOut = $modx->invokeEvent('OnDocFormTemplateRender', array( |
|
| 637 | - 'id' => $id |
|
| 638 | - )); |
|
| 639 | - if(is_array($evtOut)) { |
|
| 640 | - echo implode('', $evtOut); |
|
| 641 | - } else { |
|
| 642 | - ?> |
|
| 636 | + $evtOut = $modx->invokeEvent('OnDocFormTemplateRender', array( |
|
| 637 | + 'id' => $id |
|
| 638 | + )); |
|
| 639 | + if(is_array($evtOut)) { |
|
| 640 | + echo implode('', $evtOut); |
|
| 641 | + } else { |
|
| 642 | + ?> |
|
| 643 | 643 | <div class="tab-page" id="tabGeneral"> |
| 644 | 644 | <h2 class="tab"><?= $_lang['settings_general'] ?></h2> |
| 645 | 645 | <script type="text/javascript">tpSettings.addTabPage(document.getElementById("tabGeneral"));</script> |
@@ -724,36 +724,36 @@ discard block |
||
| 724 | 724 | <select id="template" name="template" class="inputBox" onchange="templateWarning();"> |
| 725 | 725 | <option value="0">(blank)</option> |
| 726 | 726 | <?php |
| 727 | - $field = "t.templatename, t.selectable, t.id, c.category"; |
|
| 728 | - $from = "{$tbl_site_templates} AS t LEFT JOIN {$tbl_categories} AS c ON t.category = c.id"; |
|
| 729 | - $rs = $modx->db->select($field, $from, '', 'c.category, t.templatename ASC'); |
|
| 730 | - $currentCategory = ''; |
|
| 731 | - while($row = $modx->db->getRow($rs)) { |
|
| 732 | - if($row['selectable'] != 1 && $row['id'] != $content['template']) { |
|
| 733 | - continue; |
|
| 734 | - }; |
|
| 735 | - // Skip if not selectable but show if selected! |
|
| 736 | - $thisCategory = $row['category']; |
|
| 737 | - if($thisCategory == null) { |
|
| 738 | - $thisCategory = $_lang["no_category"]; |
|
| 739 | - } |
|
| 740 | - if($thisCategory != $currentCategory) { |
|
| 741 | - if($closeOptGroup) { |
|
| 742 | - echo "\t\t\t\t\t</optgroup>\n"; |
|
| 743 | - } |
|
| 744 | - echo "\t\t\t\t\t<optgroup label=\"$thisCategory\">\n"; |
|
| 745 | - $closeOptGroup = true; |
|
| 746 | - } |
|
| 727 | + $field = "t.templatename, t.selectable, t.id, c.category"; |
|
| 728 | + $from = "{$tbl_site_templates} AS t LEFT JOIN {$tbl_categories} AS c ON t.category = c.id"; |
|
| 729 | + $rs = $modx->db->select($field, $from, '', 'c.category, t.templatename ASC'); |
|
| 730 | + $currentCategory = ''; |
|
| 731 | + while($row = $modx->db->getRow($rs)) { |
|
| 732 | + if($row['selectable'] != 1 && $row['id'] != $content['template']) { |
|
| 733 | + continue; |
|
| 734 | + }; |
|
| 735 | + // Skip if not selectable but show if selected! |
|
| 736 | + $thisCategory = $row['category']; |
|
| 737 | + if($thisCategory == null) { |
|
| 738 | + $thisCategory = $_lang["no_category"]; |
|
| 739 | + } |
|
| 740 | + if($thisCategory != $currentCategory) { |
|
| 741 | + if($closeOptGroup) { |
|
| 742 | + echo "\t\t\t\t\t</optgroup>\n"; |
|
| 743 | + } |
|
| 744 | + echo "\t\t\t\t\t<optgroup label=\"$thisCategory\">\n"; |
|
| 745 | + $closeOptGroup = true; |
|
| 746 | + } |
|
| 747 | 747 | |
| 748 | - $selectedtext = ($row['id'] == $content['template']) ? ' selected="selected"' : ''; |
|
| 748 | + $selectedtext = ($row['id'] == $content['template']) ? ' selected="selected"' : ''; |
|
| 749 | 749 | |
| 750 | - echo "\t\t\t\t\t" . '<option value="' . $row['id'] . '"' . $selectedtext . '>' . $row['templatename'] . "</option>\n"; |
|
| 751 | - $currentCategory = $thisCategory; |
|
| 752 | - } |
|
| 753 | - if($thisCategory != '') { |
|
| 754 | - echo "\t\t\t\t\t</optgroup>\n"; |
|
| 755 | - } |
|
| 756 | - ?> |
|
| 750 | + echo "\t\t\t\t\t" . '<option value="' . $row['id'] . '"' . $selectedtext . '>' . $row['templatename'] . "</option>\n"; |
|
| 751 | + $currentCategory = $thisCategory; |
|
| 752 | + } |
|
| 753 | + if($thisCategory != '') { |
|
| 754 | + echo "\t\t\t\t\t</optgroup>\n"; |
|
| 755 | + } |
|
| 756 | + ?> |
|
| 757 | 757 | </select> |
| 758 | 758 | </td> |
| 759 | 759 | </tr> |
@@ -793,37 +793,37 @@ discard block |
||
| 793 | 793 | </td> |
| 794 | 794 | <td valign="top"> |
| 795 | 795 | <?php |
| 796 | - $parentlookup = false; |
|
| 797 | - if(isset ($_REQUEST['id'])) { |
|
| 798 | - if($content['parent'] == 0) { |
|
| 799 | - $parentname = $site_name; |
|
| 800 | - } else { |
|
| 801 | - $parentlookup = $content['parent']; |
|
| 802 | - } |
|
| 803 | - } elseif(isset ($_REQUEST['pid'])) { |
|
| 804 | - if($_REQUEST['pid'] == 0) { |
|
| 805 | - $parentname = $site_name; |
|
| 806 | - } else { |
|
| 807 | - $parentlookup = $_REQUEST['pid']; |
|
| 808 | - } |
|
| 809 | - } elseif(isset($_POST['parent'])) { |
|
| 810 | - if($_POST['parent'] == 0) { |
|
| 811 | - $parentname = $site_name; |
|
| 812 | - } else { |
|
| 813 | - $parentlookup = $_POST['parent']; |
|
| 814 | - } |
|
| 815 | - } else { |
|
| 816 | - $parentname = $site_name; |
|
| 817 | - $content['parent'] = 0; |
|
| 818 | - } |
|
| 819 | - if($parentlookup !== false && is_numeric($parentlookup)) { |
|
| 820 | - $rs = $modx->db->select('pagetitle', $tbl_site_content, "id='{$parentlookup}'"); |
|
| 821 | - $parentname = $modx->db->getValue($rs); |
|
| 822 | - if(!$parentname) { |
|
| 823 | - $modx->webAlertAndQuit($_lang["error_no_parent"]); |
|
| 824 | - } |
|
| 825 | - } |
|
| 826 | - ?> |
|
| 796 | + $parentlookup = false; |
|
| 797 | + if(isset ($_REQUEST['id'])) { |
|
| 798 | + if($content['parent'] == 0) { |
|
| 799 | + $parentname = $site_name; |
|
| 800 | + } else { |
|
| 801 | + $parentlookup = $content['parent']; |
|
| 802 | + } |
|
| 803 | + } elseif(isset ($_REQUEST['pid'])) { |
|
| 804 | + if($_REQUEST['pid'] == 0) { |
|
| 805 | + $parentname = $site_name; |
|
| 806 | + } else { |
|
| 807 | + $parentlookup = $_REQUEST['pid']; |
|
| 808 | + } |
|
| 809 | + } elseif(isset($_POST['parent'])) { |
|
| 810 | + if($_POST['parent'] == 0) { |
|
| 811 | + $parentname = $site_name; |
|
| 812 | + } else { |
|
| 813 | + $parentlookup = $_POST['parent']; |
|
| 814 | + } |
|
| 815 | + } else { |
|
| 816 | + $parentname = $site_name; |
|
| 817 | + $content['parent'] = 0; |
|
| 818 | + } |
|
| 819 | + if($parentlookup !== false && is_numeric($parentlookup)) { |
|
| 820 | + $rs = $modx->db->select('pagetitle', $tbl_site_content, "id='{$parentlookup}'"); |
|
| 821 | + $parentname = $modx->db->getValue($rs); |
|
| 822 | + if(!$parentname) { |
|
| 823 | + $modx->webAlertAndQuit($_lang["error_no_parent"]); |
|
| 824 | + } |
|
| 825 | + } |
|
| 826 | + ?> |
|
| 827 | 827 | <i id="plock" class="<?= $_style["actions_folder"] ?>" onclick="enableParentSelection(!allowParentSelection);"></i> |
| 828 | 828 | <b><span id="parentName"><?= (isset($_REQUEST['pid']) ? $_REQUEST['pid'] : $content['parent']) ?> (<?= $parentname ?>)</span></b> |
| 829 | 829 | <input type="hidden" name="parent" value="<?= (isset($_REQUEST['pid']) ? $_REQUEST['pid'] : $content['parent']) ?>" onchange="documentDirty=true;" /> |
@@ -831,7 +831,7 @@ discard block |
||
| 831 | 831 | </tr> |
| 832 | 832 | <tr></tr> |
| 833 | 833 | <?php |
| 834 | - /* |
|
| 834 | + /* |
|
| 835 | 835 | if($content['type'] == 'reference' || $modx->manager->action == '72') { |
| 836 | 836 | ?> |
| 837 | 837 | <tr> |
@@ -859,7 +859,7 @@ discard block |
||
| 859 | 859 | </tr> |
| 860 | 860 | <?php |
| 861 | 861 | }*/ |
| 862 | - ?> |
|
| 862 | + ?> |
|
| 863 | 863 | |
| 864 | 864 | <?php if($content['type'] == 'document' || $modx->manager->action == '4') { ?> |
| 865 | 865 | <tr> |
@@ -872,36 +872,36 @@ discard block |
||
| 872 | 872 | <select id="which_editor" class="form-control form-control-sm" size="1" name="which_editor" onchange="changeRTE();"> |
| 873 | 873 | <option value="none"><?= $_lang['none'] ?></option> |
| 874 | 874 | <?php |
| 875 | - // invoke OnRichTextEditorRegister event |
|
| 876 | - $evtOut = $modx->invokeEvent("OnRichTextEditorRegister"); |
|
| 877 | - if(is_array($evtOut)) { |
|
| 878 | - for($i = 0; $i < count($evtOut); $i++) { |
|
| 879 | - $editor = $evtOut[$i]; |
|
| 880 | - echo "\t\t\t", '<option value="', $editor, '"', ($modx->config['which_editor'] == $editor ? ' selected="selected"' : ''), '>', $editor, "</option>\n"; |
|
| 881 | - } |
|
| 882 | - } |
|
| 883 | - ?> |
|
| 875 | + // invoke OnRichTextEditorRegister event |
|
| 876 | + $evtOut = $modx->invokeEvent("OnRichTextEditorRegister"); |
|
| 877 | + if(is_array($evtOut)) { |
|
| 878 | + for($i = 0; $i < count($evtOut); $i++) { |
|
| 879 | + $editor = $evtOut[$i]; |
|
| 880 | + echo "\t\t\t", '<option value="', $editor, '"', ($modx->config['which_editor'] == $editor ? ' selected="selected"' : ''), '>', $editor, "</option>\n"; |
|
| 881 | + } |
|
| 882 | + } |
|
| 883 | + ?> |
|
| 884 | 884 | </select> |
| 885 | 885 | </label> |
| 886 | 886 | </div> |
| 887 | 887 | <div id="content_body"> |
| 888 | 888 | <?php |
| 889 | - if(($content['richtext'] == 1 || $modx->manager->action == '4') && $use_editor == 1) { |
|
| 890 | - $htmlContent = $content['content']; |
|
| 891 | - ?> |
|
| 889 | + if(($content['richtext'] == 1 || $modx->manager->action == '4') && $use_editor == 1) { |
|
| 890 | + $htmlContent = $content['content']; |
|
| 891 | + ?> |
|
| 892 | 892 | <div class="section-editor clearfix"> |
| 893 | 893 | <textarea id="ta" name="ta" onchange="documentDirty=true;"><?= $modx->htmlspecialchars($htmlContent) ?></textarea> |
| 894 | 894 | </div> |
| 895 | 895 | <?php |
| 896 | - // Richtext-[*content*] |
|
| 897 | - $richtexteditorIds = array(); |
|
| 898 | - $richtexteditorOptions = array(); |
|
| 899 | - $richtexteditorIds[$modx->config['which_editor']][] = 'ta'; |
|
| 900 | - $richtexteditorOptions[$modx->config['which_editor']]['ta'] = ''; |
|
| 901 | - } else { |
|
| 902 | - echo "\t" . '<div><textarea class="phptextarea" id="ta" name="ta" rows="20" wrap="soft" onchange="documentDirty=true;">', $modx->htmlspecialchars($content['content']), '</textarea></div>' . "\n"; |
|
| 903 | - } |
|
| 904 | - ?> |
|
| 896 | + // Richtext-[*content*] |
|
| 897 | + $richtexteditorIds = array(); |
|
| 898 | + $richtexteditorOptions = array(); |
|
| 899 | + $richtexteditorIds[$modx->config['which_editor']][] = 'ta'; |
|
| 900 | + $richtexteditorOptions[$modx->config['which_editor']]['ta'] = ''; |
|
| 901 | + } else { |
|
| 902 | + echo "\t" . '<div><textarea class="phptextarea" id="ta" name="ta" rows="20" wrap="soft" onchange="documentDirty=true;">', $modx->htmlspecialchars($content['content']), '</textarea></div>' . "\n"; |
|
| 903 | + } |
|
| 904 | + ?> |
|
| 905 | 905 | </div> |
| 906 | 906 | </td> |
| 907 | 907 | </tr> |
@@ -1207,8 +1207,8 @@ discard block |
||
| 1207 | 1207 | |
| 1208 | 1208 | <?php |
| 1209 | 1209 | |
| 1210 | - if($_SESSION['mgrRole'] == 1 || $modx->manager->action != '27' || $_SESSION['mgrInternalKey'] == $content['createdby'] || $modx->hasPermission('change_resourcetype')) { |
|
| 1211 | - ?> |
|
| 1210 | + if($_SESSION['mgrRole'] == 1 || $modx->manager->action != '27' || $_SESSION['mgrInternalKey'] == $content['createdby'] || $modx->hasPermission('change_resourcetype')) { |
|
| 1211 | + ?> |
|
| 1212 | 1212 | <tr> |
| 1213 | 1213 | <td> |
| 1214 | 1214 | <span class="warning"><?= $_lang['resource_type'] ?></span> |
@@ -1230,15 +1230,15 @@ discard block |
||
| 1230 | 1230 | <td> |
| 1231 | 1231 | <select name="contentType" class="inputBox" onchange="documentDirty=true;"> |
| 1232 | 1232 | <?php |
| 1233 | - if(!$content['contentType']) { |
|
| 1234 | - $content['contentType'] = 'text/html'; |
|
| 1235 | - } |
|
| 1236 | - $custom_contenttype = (isset ($custom_contenttype) ? $custom_contenttype : "text/html,text/plain,text/xml"); |
|
| 1237 | - $ct = explode(",", $custom_contenttype); |
|
| 1238 | - for($i = 0; $i < count($ct); $i++) { |
|
| 1239 | - echo "\t\t\t\t\t" . '<option value="' . $ct[$i] . '"' . ($content['contentType'] == $ct[$i] ? ' selected="selected"' : '') . '>' . $ct[$i] . "</option>\n"; |
|
| 1240 | - } |
|
| 1241 | - ?> |
|
| 1233 | + if(!$content['contentType']) { |
|
| 1234 | + $content['contentType'] = 'text/html'; |
|
| 1235 | + } |
|
| 1236 | + $custom_contenttype = (isset ($custom_contenttype) ? $custom_contenttype : "text/html,text/plain,text/xml"); |
|
| 1237 | + $ct = explode(",", $custom_contenttype); |
|
| 1238 | + for($i = 0; $i < count($ct); $i++) { |
|
| 1239 | + echo "\t\t\t\t\t" . '<option value="' . $ct[$i] . '"' . ($content['contentType'] == $ct[$i] ? ' selected="selected"' : '') . '>' . $ct[$i] . "</option>\n"; |
|
| 1240 | + } |
|
| 1241 | + ?> |
|
| 1242 | 1242 | </select> |
| 1243 | 1243 | </td> |
| 1244 | 1244 | </tr> |
@@ -1261,23 +1261,23 @@ discard block |
||
| 1261 | 1261 | </td> |
| 1262 | 1262 | </tr> |
| 1263 | 1263 | <?php |
| 1264 | - } else { |
|
| 1265 | - if($content['type'] != 'reference' && $modx->manager->action != '72') { |
|
| 1266 | - // non-admin managers creating or editing a document resource |
|
| 1267 | - ?> |
|
| 1264 | + } else { |
|
| 1265 | + if($content['type'] != 'reference' && $modx->manager->action != '72') { |
|
| 1266 | + // non-admin managers creating or editing a document resource |
|
| 1267 | + ?> |
|
| 1268 | 1268 | <input type="hidden" name="contentType" value="<?= (isset($content['contentType']) ? $content['contentType'] : "text/html") ?>" /> |
| 1269 | 1269 | <input type="hidden" name="type" value="document" /> |
| 1270 | 1270 | <input type="hidden" name="content_dispo" value="<?= (isset($content['content_dispo']) ? $content['content_dispo'] : '0') ?>" /> |
| 1271 | 1271 | <?php |
| 1272 | - } else { |
|
| 1273 | - // non-admin managers creating or editing a reference (weblink) resource |
|
| 1274 | - ?> |
|
| 1272 | + } else { |
|
| 1273 | + // non-admin managers creating or editing a reference (weblink) resource |
|
| 1274 | + ?> |
|
| 1275 | 1275 | <input type="hidden" name="type" value="reference" /> |
| 1276 | 1276 | <input type="hidden" name="contentType" value="text/html" /> |
| 1277 | 1277 | <?php |
| 1278 | - } |
|
| 1279 | - }//if mgrRole |
|
| 1280 | - ?> |
|
| 1278 | + } |
|
| 1279 | + }//if mgrRole |
|
| 1280 | + ?> |
|
| 1281 | 1281 | |
| 1282 | 1282 | <tr> |
| 1283 | 1283 | <td> |
@@ -1360,112 +1360,112 @@ discard block |
||
| 1360 | 1360 | ?> |
| 1361 | 1361 | |
| 1362 | 1362 | <?php |
| 1363 | - /******************************* |
|
| 1363 | + /******************************* |
|
| 1364 | 1364 | * Document Access Permissions */ |
| 1365 | - if($use_udperms == 1) { |
|
| 1366 | - $groupsarray = array(); |
|
| 1367 | - $sql = ''; |
|
| 1368 | - |
|
| 1369 | - $documentId = ($modx->manager->action == '27' ? $id : (!empty($_REQUEST['pid']) ? $_REQUEST['pid'] : $content['parent'])); |
|
| 1370 | - if($documentId > 0) { |
|
| 1371 | - // Load up, the permissions from the parent (if new document) or existing document |
|
| 1372 | - $rs = $modx->db->select('id, document_group', $tbl_document_groups, "document='{$documentId}'"); |
|
| 1373 | - while($currentgroup = $modx->db->getRow($rs)) $groupsarray[] = $currentgroup['document_group'] . ',' . $currentgroup['id']; |
|
| 1374 | - |
|
| 1375 | - // Load up the current permissions and names |
|
| 1376 | - $vs = array( |
|
| 1377 | - $tbl_document_group_names, |
|
| 1378 | - $tbl_document_groups, |
|
| 1379 | - $documentId |
|
| 1380 | - ); |
|
| 1381 | - $from = vsprintf("%s AS dgn LEFT JOIN %s AS groups ON groups.document_group=dgn.id AND groups.document='%s'", $vs); |
|
| 1382 | - $rs = $modx->db->select('dgn.*, groups.id AS link_id', $from, '', 'name'); |
|
| 1383 | - } else { |
|
| 1384 | - // Just load up the names, we're starting clean |
|
| 1385 | - $rs = $modx->db->select('*, NULL AS link_id', $tbl_document_group_names, '', 'name'); |
|
| 1386 | - } |
|
| 1387 | - |
|
| 1388 | - // retain selected doc groups between post |
|
| 1389 | - if(isset($_POST['docgroups'])) { |
|
| 1390 | - $groupsarray = array_merge($groupsarray, $_POST['docgroups']); |
|
| 1391 | - } |
|
| 1365 | + if($use_udperms == 1) { |
|
| 1366 | + $groupsarray = array(); |
|
| 1367 | + $sql = ''; |
|
| 1368 | + |
|
| 1369 | + $documentId = ($modx->manager->action == '27' ? $id : (!empty($_REQUEST['pid']) ? $_REQUEST['pid'] : $content['parent'])); |
|
| 1370 | + if($documentId > 0) { |
|
| 1371 | + // Load up, the permissions from the parent (if new document) or existing document |
|
| 1372 | + $rs = $modx->db->select('id, document_group', $tbl_document_groups, "document='{$documentId}'"); |
|
| 1373 | + while($currentgroup = $modx->db->getRow($rs)) $groupsarray[] = $currentgroup['document_group'] . ',' . $currentgroup['id']; |
|
| 1374 | + |
|
| 1375 | + // Load up the current permissions and names |
|
| 1376 | + $vs = array( |
|
| 1377 | + $tbl_document_group_names, |
|
| 1378 | + $tbl_document_groups, |
|
| 1379 | + $documentId |
|
| 1380 | + ); |
|
| 1381 | + $from = vsprintf("%s AS dgn LEFT JOIN %s AS groups ON groups.document_group=dgn.id AND groups.document='%s'", $vs); |
|
| 1382 | + $rs = $modx->db->select('dgn.*, groups.id AS link_id', $from, '', 'name'); |
|
| 1383 | + } else { |
|
| 1384 | + // Just load up the names, we're starting clean |
|
| 1385 | + $rs = $modx->db->select('*, NULL AS link_id', $tbl_document_group_names, '', 'name'); |
|
| 1386 | + } |
|
| 1387 | + |
|
| 1388 | + // retain selected doc groups between post |
|
| 1389 | + if(isset($_POST['docgroups'])) { |
|
| 1390 | + $groupsarray = array_merge($groupsarray, $_POST['docgroups']); |
|
| 1391 | + } |
|
| 1392 | + |
|
| 1393 | + $isManager = $modx->hasPermission('access_permissions'); |
|
| 1394 | + $isWeb = $modx->hasPermission('web_access_permissions'); |
|
| 1395 | + |
|
| 1396 | + // Setup Basic attributes for each Input box |
|
| 1397 | + $inputAttributes = array( |
|
| 1398 | + 'type' => 'checkbox', |
|
| 1399 | + 'class' => 'checkbox', |
|
| 1400 | + 'name' => 'docgroups[]', |
|
| 1401 | + 'onclick' => 'makePublic(false);', |
|
| 1402 | + ); |
|
| 1403 | + $permissions = array(); // New Permissions array list (this contains the HTML) |
|
| 1404 | + $permissions_yes = 0; // count permissions the current mgr user has |
|
| 1405 | + $permissions_no = 0; // count permissions the current mgr user doesn't have |
|
| 1406 | + |
|
| 1407 | + // Loop through the permissions list |
|
| 1408 | + while($row = $modx->db->getRow($rs)) { |
|
| 1409 | + |
|
| 1410 | + // Create an inputValue pair (group ID and group link (if it exists)) |
|
| 1411 | + $inputValue = $row['id'] . ',' . ($row['link_id'] ? $row['link_id'] : 'new'); |
|
| 1412 | + $inputId = 'group-' . $row['id']; |
|
| 1413 | + |
|
| 1414 | + $checked = in_array($inputValue, $groupsarray); |
|
| 1415 | + if($checked) { |
|
| 1416 | + $notPublic = true; |
|
| 1417 | + } // Mark as private access (either web or manager) |
|
| 1418 | + |
|
| 1419 | + // Skip the access permission if the user doesn't have access... |
|
| 1420 | + if((!$isManager && $row['private_memgroup'] == '1') || (!$isWeb && $row['private_webgroup'] == '1')) { |
|
| 1421 | + continue; |
|
| 1422 | + } |
|
| 1392 | 1423 | |
| 1393 | - $isManager = $modx->hasPermission('access_permissions'); |
|
| 1394 | - $isWeb = $modx->hasPermission('web_access_permissions'); |
|
| 1395 | - |
|
| 1396 | - // Setup Basic attributes for each Input box |
|
| 1397 | - $inputAttributes = array( |
|
| 1398 | - 'type' => 'checkbox', |
|
| 1399 | - 'class' => 'checkbox', |
|
| 1400 | - 'name' => 'docgroups[]', |
|
| 1401 | - 'onclick' => 'makePublic(false);', |
|
| 1402 | - ); |
|
| 1403 | - $permissions = array(); // New Permissions array list (this contains the HTML) |
|
| 1404 | - $permissions_yes = 0; // count permissions the current mgr user has |
|
| 1405 | - $permissions_no = 0; // count permissions the current mgr user doesn't have |
|
| 1406 | - |
|
| 1407 | - // Loop through the permissions list |
|
| 1408 | - while($row = $modx->db->getRow($rs)) { |
|
| 1409 | - |
|
| 1410 | - // Create an inputValue pair (group ID and group link (if it exists)) |
|
| 1411 | - $inputValue = $row['id'] . ',' . ($row['link_id'] ? $row['link_id'] : 'new'); |
|
| 1412 | - $inputId = 'group-' . $row['id']; |
|
| 1413 | - |
|
| 1414 | - $checked = in_array($inputValue, $groupsarray); |
|
| 1415 | - if($checked) { |
|
| 1416 | - $notPublic = true; |
|
| 1417 | - } // Mark as private access (either web or manager) |
|
| 1418 | - |
|
| 1419 | - // Skip the access permission if the user doesn't have access... |
|
| 1420 | - if((!$isManager && $row['private_memgroup'] == '1') || (!$isWeb && $row['private_webgroup'] == '1')) { |
|
| 1421 | - continue; |
|
| 1422 | - } |
|
| 1423 | - |
|
| 1424 | - // Setup attributes for this Input box |
|
| 1425 | - $inputAttributes['id'] = $inputId; |
|
| 1426 | - $inputAttributes['value'] = $inputValue; |
|
| 1427 | - if($checked) { |
|
| 1428 | - $inputAttributes['checked'] = 'checked'; |
|
| 1429 | - } else { |
|
| 1430 | - unset($inputAttributes['checked']); |
|
| 1431 | - } |
|
| 1432 | - |
|
| 1433 | - // Create attribute string list |
|
| 1434 | - $inputString = array(); |
|
| 1435 | - foreach($inputAttributes as $k => $v) $inputString[] = $k . '="' . $v . '"'; |
|
| 1436 | - |
|
| 1437 | - // Make the <input> HTML |
|
| 1438 | - $inputHTML = '<input ' . implode(' ', $inputString) . ' />'; |
|
| 1439 | - |
|
| 1440 | - // does user have this permission? |
|
| 1441 | - $from = "{$tbl_membergroup_access} AS mga, {$tbl_member_groups} AS mg"; |
|
| 1442 | - $vs = array( |
|
| 1443 | - $row['id'], |
|
| 1444 | - $_SESSION['mgrInternalKey'] |
|
| 1445 | - ); |
|
| 1446 | - $where = vsprintf("mga.membergroup=mg.user_group AND mga.documentgroup=%s AND mg.member=%s", $vs); |
|
| 1447 | - $rsp = $modx->db->select('COUNT(mg.id)', $from, $where); |
|
| 1448 | - $count = $modx->db->getValue($rsp); |
|
| 1449 | - if($count > 0) { |
|
| 1450 | - ++$permissions_yes; |
|
| 1451 | - } else { |
|
| 1452 | - ++$permissions_no; |
|
| 1453 | - } |
|
| 1454 | - $permissions[] = "\t\t" . '<li>' . $inputHTML . '<label for="' . $inputId . '">' . $row['name'] . '</label></li>'; |
|
| 1455 | - } |
|
| 1456 | - // if mgr user doesn't have access to any of the displayable permissions, forget about them and make doc public |
|
| 1457 | - if($_SESSION['mgrRole'] != 1 && ($permissions_yes == 0 && $permissions_no > 0)) { |
|
| 1458 | - $permissions = array(); |
|
| 1459 | - } |
|
| 1424 | + // Setup attributes for this Input box |
|
| 1425 | + $inputAttributes['id'] = $inputId; |
|
| 1426 | + $inputAttributes['value'] = $inputValue; |
|
| 1427 | + if($checked) { |
|
| 1428 | + $inputAttributes['checked'] = 'checked'; |
|
| 1429 | + } else { |
|
| 1430 | + unset($inputAttributes['checked']); |
|
| 1431 | + } |
|
| 1460 | 1432 | |
| 1461 | - // See if the Access Permissions section is worth displaying... |
|
| 1462 | - if(!empty($permissions)) { |
|
| 1463 | - // Add the "All Document Groups" item if we have rights in both contexts |
|
| 1464 | - if($isManager && $isWeb) { |
|
| 1465 | - array_unshift($permissions, "\t\t" . '<li><input type="checkbox" class="checkbox" name="chkalldocs" id="groupall"' . (!$notPublic ? ' checked="checked"' : '') . ' onclick="makePublic(true);" /><label for="groupall" class="warning">' . $_lang['all_doc_groups'] . '</label></li>'); |
|
| 1466 | - } |
|
| 1467 | - // Output the permissions list... |
|
| 1468 | - ?> |
|
| 1433 | + // Create attribute string list |
|
| 1434 | + $inputString = array(); |
|
| 1435 | + foreach($inputAttributes as $k => $v) $inputString[] = $k . '="' . $v . '"'; |
|
| 1436 | + |
|
| 1437 | + // Make the <input> HTML |
|
| 1438 | + $inputHTML = '<input ' . implode(' ', $inputString) . ' />'; |
|
| 1439 | + |
|
| 1440 | + // does user have this permission? |
|
| 1441 | + $from = "{$tbl_membergroup_access} AS mga, {$tbl_member_groups} AS mg"; |
|
| 1442 | + $vs = array( |
|
| 1443 | + $row['id'], |
|
| 1444 | + $_SESSION['mgrInternalKey'] |
|
| 1445 | + ); |
|
| 1446 | + $where = vsprintf("mga.membergroup=mg.user_group AND mga.documentgroup=%s AND mg.member=%s", $vs); |
|
| 1447 | + $rsp = $modx->db->select('COUNT(mg.id)', $from, $where); |
|
| 1448 | + $count = $modx->db->getValue($rsp); |
|
| 1449 | + if($count > 0) { |
|
| 1450 | + ++$permissions_yes; |
|
| 1451 | + } else { |
|
| 1452 | + ++$permissions_no; |
|
| 1453 | + } |
|
| 1454 | + $permissions[] = "\t\t" . '<li>' . $inputHTML . '<label for="' . $inputId . '">' . $row['name'] . '</label></li>'; |
|
| 1455 | + } |
|
| 1456 | + // if mgr user doesn't have access to any of the displayable permissions, forget about them and make doc public |
|
| 1457 | + if($_SESSION['mgrRole'] != 1 && ($permissions_yes == 0 && $permissions_no > 0)) { |
|
| 1458 | + $permissions = array(); |
|
| 1459 | + } |
|
| 1460 | + |
|
| 1461 | + // See if the Access Permissions section is worth displaying... |
|
| 1462 | + if(!empty($permissions)) { |
|
| 1463 | + // Add the "All Document Groups" item if we have rights in both contexts |
|
| 1464 | + if($isManager && $isWeb) { |
|
| 1465 | + array_unshift($permissions, "\t\t" . '<li><input type="checkbox" class="checkbox" name="chkalldocs" id="groupall"' . (!$notPublic ? ' checked="checked"' : '') . ' onclick="makePublic(true);" /><label for="groupall" class="warning">' . $_lang['all_doc_groups'] . '</label></li>'); |
|
| 1466 | + } |
|
| 1467 | + // Output the permissions list... |
|
| 1468 | + ?> |
|
| 1469 | 1469 | <!-- Access Permissions --> |
| 1470 | 1470 | <div class="tab-page" id="tabAccess"> |
| 1471 | 1471 | <h2 class="tab" id="tab_access_header"><?= $_lang['access_permissions'] ?></h2> |
@@ -1499,31 +1499,31 @@ discard block |
||
| 1499 | 1499 | </ul> |
| 1500 | 1500 | </div><!--div class="tab-page" id="tabAccess"--> |
| 1501 | 1501 | <?php |
| 1502 | - } // !empty($permissions) |
|
| 1503 | - elseif($_SESSION['mgrRole'] != 1 && ($permissions_yes == 0 && $permissions_no > 0) && ($_SESSION['mgrPermissions']['access_permissions'] == 1 || $_SESSION['mgrPermissions']['web_access_permissions'] == 1)) { |
|
| 1504 | - ?> |
|
| 1502 | + } // !empty($permissions) |
|
| 1503 | + elseif($_SESSION['mgrRole'] != 1 && ($permissions_yes == 0 && $permissions_no > 0) && ($_SESSION['mgrPermissions']['access_permissions'] == 1 || $_SESSION['mgrPermissions']['web_access_permissions'] == 1)) { |
|
| 1504 | + ?> |
|
| 1505 | 1505 | <p><?= $_lang["access_permissions_docs_collision"] ?></p> |
| 1506 | 1506 | <?php |
| 1507 | 1507 | |
| 1508 | - } |
|
| 1509 | - } |
|
| 1510 | - /* End Document Access Permissions * |
|
| 1508 | + } |
|
| 1509 | + } |
|
| 1510 | + /* End Document Access Permissions * |
|
| 1511 | 1511 | ***********************************/ |
| 1512 | - ?> |
|
| 1512 | + ?> |
|
| 1513 | 1513 | |
| 1514 | 1514 | <input type="submit" name="save" style="display:none" /> |
| 1515 | 1515 | <?php |
| 1516 | 1516 | |
| 1517 | - // invoke OnDocFormRender event |
|
| 1518 | - $evtOut = $modx->invokeEvent('OnDocFormRender', array( |
|
| 1519 | - 'id' => $id, |
|
| 1520 | - 'template' => $content['template'] |
|
| 1521 | - )); |
|
| 1517 | + // invoke OnDocFormRender event |
|
| 1518 | + $evtOut = $modx->invokeEvent('OnDocFormRender', array( |
|
| 1519 | + 'id' => $id, |
|
| 1520 | + 'template' => $content['template'] |
|
| 1521 | + )); |
|
| 1522 | 1522 | |
| 1523 | - if(is_array($evtOut)) { |
|
| 1524 | - echo implode('', $evtOut); |
|
| 1525 | - } |
|
| 1526 | - ?> |
|
| 1523 | + if(is_array($evtOut)) { |
|
| 1524 | + echo implode('', $evtOut); |
|
| 1525 | + } |
|
| 1526 | + ?> |
|
| 1527 | 1527 | </div><!--div class="tab-pane" id="documentPane"--> |
| 1528 | 1528 | </div><!--div class="sectionBody"--> |
| 1529 | 1529 | </fieldset> |
@@ -1534,17 +1534,17 @@ discard block |
||
| 1534 | 1534 | </script> |
| 1535 | 1535 | <?php |
| 1536 | 1536 | if(($content['richtext'] == 1 || $modx->manager->action == '4' || $modx->manager->action == '72') && $use_editor == 1) { |
| 1537 | - if(is_array($richtexteditorIds)) { |
|
| 1538 | - foreach($richtexteditorIds as $editor => $elements) { |
|
| 1539 | - // invoke OnRichTextEditorInit event |
|
| 1540 | - $evtOut = $modx->invokeEvent('OnRichTextEditorInit', array( |
|
| 1541 | - 'editor' => $editor, |
|
| 1542 | - 'elements' => $elements, |
|
| 1543 | - 'options' => $richtexteditorOptions[$editor] |
|
| 1544 | - )); |
|
| 1545 | - if(is_array($evtOut)) { |
|
| 1546 | - echo implode('', $evtOut); |
|
| 1547 | - } |
|
| 1548 | - } |
|
| 1549 | - } |
|
| 1537 | + if(is_array($richtexteditorIds)) { |
|
| 1538 | + foreach($richtexteditorIds as $editor => $elements) { |
|
| 1539 | + // invoke OnRichTextEditorInit event |
|
| 1540 | + $evtOut = $modx->invokeEvent('OnRichTextEditorInit', array( |
|
| 1541 | + 'editor' => $editor, |
|
| 1542 | + 'elements' => $elements, |
|
| 1543 | + 'options' => $richtexteditorOptions[$editor] |
|
| 1544 | + )); |
|
| 1545 | + if(is_array($evtOut)) { |
|
| 1546 | + echo implode('', $evtOut); |
|
| 1547 | + } |
|
| 1548 | + } |
|
| 1549 | + } |
|
| 1550 | 1550 | } |
@@ -1,34 +1,34 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
| 2 | +if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
| 3 | 3 | die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
| 4 | 4 | } |
| 5 | 5 | |
| 6 | 6 | /********************/ |
| 7 | -$sd = isset($_REQUEST['dir']) ? '&dir=' . $_REQUEST['dir'] : '&dir=DESC'; |
|
| 8 | -$sb = isset($_REQUEST['sort']) ? '&sort=' . $_REQUEST['sort'] : '&sort=createdon'; |
|
| 9 | -$pg = isset($_REQUEST['page']) ? '&page=' . (int) $_REQUEST['page'] : ''; |
|
| 10 | -$add_path = $sd . $sb . $pg; |
|
| 7 | +$sd = isset($_REQUEST['dir']) ? '&dir='.$_REQUEST['dir'] : '&dir=DESC'; |
|
| 8 | +$sb = isset($_REQUEST['sort']) ? '&sort='.$_REQUEST['sort'] : '&sort=createdon'; |
|
| 9 | +$pg = isset($_REQUEST['page']) ? '&page='.(int) $_REQUEST['page'] : ''; |
|
| 10 | +$add_path = $sd.$sb.$pg; |
|
| 11 | 11 | /*******************/ |
| 12 | 12 | |
| 13 | 13 | // check permissions |
| 14 | -switch($modx->manager->action) { |
|
| 14 | +switch ($modx->manager->action) { |
|
| 15 | 15 | case 27: |
| 16 | - if(!$modx->hasPermission('edit_document')) { |
|
| 16 | + if (!$modx->hasPermission('edit_document')) { |
|
| 17 | 17 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
| 18 | 18 | } |
| 19 | 19 | break; |
| 20 | 20 | case 85: |
| 21 | 21 | case 72: |
| 22 | 22 | case 4: |
| 23 | - if(!$modx->hasPermission('new_document')) { |
|
| 23 | + if (!$modx->hasPermission('new_document')) { |
|
| 24 | 24 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
| 25 | - } elseif(isset($_REQUEST['pid']) && $_REQUEST['pid'] != '0') { |
|
| 25 | + } elseif (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '0') { |
|
| 26 | 26 | // check user has permissions for parent |
| 27 | 27 | $udperms = new EvolutionCMS\Legacy\Permissions(); |
| 28 | 28 | $udperms->user = $modx->getLoginUserID(); |
| 29 | 29 | $udperms->document = empty($_REQUEST['pid']) ? 0 : $_REQUEST['pid']; |
| 30 | 30 | $udperms->role = $_SESSION['mgrRole']; |
| 31 | - if(!$udperms->checkPermissions()) { |
|
| 31 | + if (!$udperms->checkPermissions()) { |
|
| 32 | 32 | $modx->webAlertAndQuit($_lang["access_permission_denied"]); |
| 33 | 33 | } |
| 34 | 34 | } |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
| 38 | 38 | } |
| 39 | 39 | |
| 40 | -$id = isset($_REQUEST['id']) ? (int)$_REQUEST['id'] : 0; |
|
| 40 | +$id = isset($_REQUEST['id']) ? (int) $_REQUEST['id'] : 0; |
|
| 41 | 41 | |
| 42 | 42 | // Get table names (alphabetical) |
| 43 | 43 | $tbl_categories = $modx->getFullTableName('categories'); |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | $tbl_site_tmplvar_templates = $modx->getFullTableName('site_tmplvar_templates'); |
| 53 | 53 | $tbl_site_tmplvars = $modx->getFullTableName('site_tmplvars'); |
| 54 | 54 | |
| 55 | -if($modx->manager->action == 27) { |
|
| 55 | +if ($modx->manager->action == 27) { |
|
| 56 | 56 | //editing an existing document |
| 57 | 57 | // check permissions on the document |
| 58 | 58 | $udperms = new EvolutionCMS\Legacy\Permissions(); |
@@ -60,13 +60,13 @@ discard block |
||
| 60 | 60 | $udperms->document = $id; |
| 61 | 61 | $udperms->role = $_SESSION['mgrRole']; |
| 62 | 62 | |
| 63 | - if(!$udperms->checkPermissions()) { |
|
| 63 | + if (!$udperms->checkPermissions()) { |
|
| 64 | 64 | $modx->webAlertAndQuit($_lang["access_permission_denied"]); |
| 65 | 65 | } |
| 66 | 66 | } |
| 67 | 67 | |
| 68 | 68 | // check to see if resource isn't locked |
| 69 | -if($lockedEl = $modx->elementIsLocked(7, $id)) { |
|
| 69 | +if ($lockedEl = $modx->elementIsLocked(7, $id)) { |
|
| 70 | 70 | $modx->webAlertAndQuit(sprintf($_lang['lock_msg'], $lockedEl['username'], $_lang['resource'])); |
| 71 | 71 | } |
| 72 | 72 | // end check for lock |
@@ -75,27 +75,27 @@ discard block |
||
| 75 | 75 | $modx->lockElement(7, $id); |
| 76 | 76 | |
| 77 | 77 | // get document groups for current user |
| 78 | -if($_SESSION['mgrDocgroups']) { |
|
| 78 | +if ($_SESSION['mgrDocgroups']) { |
|
| 79 | 79 | $docgrp = implode(',', $_SESSION['mgrDocgroups']); |
| 80 | 80 | } |
| 81 | 81 | |
| 82 | -if(!empty ($id)) { |
|
| 82 | +if (!empty ($id)) { |
|
| 83 | 83 | $access = sprintf("1='%s' OR sc.privatemgr=0", $_SESSION['mgrRole']); |
| 84 | - if($docgrp) { |
|
| 84 | + if ($docgrp) { |
|
| 85 | 85 | $access .= " OR dg.document_group IN ({$docgrp})"; |
| 86 | 86 | } |
| 87 | 87 | $rs = $modx->db->select('sc.*', "{$tbl_site_content} AS sc LEFT JOIN {$tbl_document_groups} AS dg ON dg.document=sc.id", "sc.id='{$id}' AND ({$access})"); |
| 88 | 88 | $content = array(); |
| 89 | 89 | $content = $modx->db->getRow($rs); |
| 90 | 90 | $modx->documentObject = &$content; |
| 91 | - if(!$content) { |
|
| 91 | + if (!$content) { |
|
| 92 | 92 | $modx->webAlertAndQuit($_lang["access_permission_denied"]); |
| 93 | 93 | } |
| 94 | 94 | $_SESSION['itemname'] = $content['pagetitle']; |
| 95 | 95 | } else { |
| 96 | 96 | $content = array(); |
| 97 | 97 | |
| 98 | - if(isset($_REQUEST['newtemplate'])) { |
|
| 98 | + if (isset($_REQUEST['newtemplate'])) { |
|
| 99 | 99 | $content['template'] = $_REQUEST['newtemplate']; |
| 100 | 100 | } else { |
| 101 | 101 | $content['template'] = getDefaultTemplate(); |
@@ -106,22 +106,22 @@ discard block |
||
| 106 | 106 | |
| 107 | 107 | // restore saved form |
| 108 | 108 | $formRestored = $modx->manager->loadFormValues(); |
| 109 | -if(isset($_REQUEST['newtemplate'])) { |
|
| 109 | +if (isset($_REQUEST['newtemplate'])) { |
|
| 110 | 110 | $formRestored = true; |
| 111 | 111 | } |
| 112 | 112 | |
| 113 | 113 | // retain form values if template was changed |
| 114 | 114 | // edited to convert pub_date and unpub_date |
| 115 | 115 | // sottwell 02-09-2006 |
| 116 | -if($formRestored == true) { |
|
| 116 | +if ($formRestored == true) { |
|
| 117 | 117 | $content = array_merge($content, $_POST); |
| 118 | 118 | $content['content'] = $_POST['ta']; |
| 119 | - if(empty ($content['pub_date'])) { |
|
| 119 | + if (empty ($content['pub_date'])) { |
|
| 120 | 120 | unset ($content['pub_date']); |
| 121 | 121 | } else { |
| 122 | 122 | $content['pub_date'] = $modx->toTimeStamp($content['pub_date']); |
| 123 | 123 | } |
| 124 | - if(empty ($content['unpub_date'])) { |
|
| 124 | + if (empty ($content['unpub_date'])) { |
|
| 125 | 125 | unset ($content['unpub_date']); |
| 126 | 126 | } else { |
| 127 | 127 | $content['unpub_date'] = $modx->toTimeStamp($content['unpub_date']); |
@@ -129,12 +129,12 @@ discard block |
||
| 129 | 129 | } |
| 130 | 130 | |
| 131 | 131 | // increase menu index if this is a new document |
| 132 | -if(!isset ($_REQUEST['id'])) { |
|
| 133 | - if(!isset ($modx->config['auto_menuindex'])) { |
|
| 132 | +if (!isset ($_REQUEST['id'])) { |
|
| 133 | + if (!isset ($modx->config['auto_menuindex'])) { |
|
| 134 | 134 | $modx->config['auto_menuindex'] = 1; |
| 135 | 135 | } |
| 136 | - if($modx->config['auto_menuindex']) { |
|
| 137 | - $pid = (int)$_REQUEST['pid']; |
|
| 136 | + if ($modx->config['auto_menuindex']) { |
|
| 137 | + $pid = (int) $_REQUEST['pid']; |
|
| 138 | 138 | $rs = $modx->db->select('count(*)', $tbl_site_content, "parent='{$pid}'"); |
| 139 | 139 | $content['menuindex'] = $modx->db->getValue($rs); |
| 140 | 140 | } else { |
@@ -142,14 +142,14 @@ discard block |
||
| 142 | 142 | } |
| 143 | 143 | } |
| 144 | 144 | |
| 145 | -if(isset ($_POST['which_editor'])) { |
|
| 145 | +if (isset ($_POST['which_editor'])) { |
|
| 146 | 146 | $modx->config['which_editor'] = $_POST['which_editor']; |
| 147 | 147 | } |
| 148 | 148 | |
| 149 | 149 | // Add lock-element JS-Script |
| 150 | 150 | $lockElementId = $id; |
| 151 | 151 | $lockElementType = 7; |
| 152 | -require_once(MODX_MANAGER_PATH . 'includes/active_user_locks.inc.php'); |
|
| 152 | +require_once(MODX_MANAGER_PATH.'includes/active_user_locks.inc.php'); |
|
| 153 | 153 | ?> |
| 154 | 154 | <script type="text/javascript"> |
| 155 | 155 | /* <![CDATA[ */ |
@@ -179,7 +179,7 @@ discard block |
||
| 179 | 179 | }, |
| 180 | 180 | cancel: function() { |
| 181 | 181 | documentDirty = false; |
| 182 | - document.location.href = 'index.php?<?=($id == 0 ? 'a=2' : 'a=3&r=1&id=' . $id . $add_path) ?>'; |
|
| 182 | + document.location.href = 'index.php?<?=($id == 0 ? 'a=2' : 'a=3&r=1&id='.$id.$add_path) ?>'; |
|
| 183 | 183 | }, |
| 184 | 184 | duplicate: function() { |
| 185 | 185 | if(confirm("<?= $_lang['confirm_resource_duplicate']?>") === true) { |
@@ -187,7 +187,7 @@ discard block |
||
| 187 | 187 | } |
| 188 | 188 | }, |
| 189 | 189 | view: function() { |
| 190 | - window.open('<?= ($modx->config['friendly_urls'] == '1') ? $modx->makeUrl($id) : $modx->config['site_url'] . 'index.php?id=' . $id ?>', 'previeWin'); |
|
| 190 | + window.open('<?= ($modx->config['friendly_urls'] == '1') ? $modx->makeUrl($id) : $modx->config['site_url'].'index.php?id='.$id ?>', 'previeWin'); |
|
| 191 | 191 | } |
| 192 | 192 | }; |
| 193 | 193 | |
@@ -549,7 +549,7 @@ discard block |
||
| 549 | 549 | 'template' => $content['template'] |
| 550 | 550 | )); |
| 551 | 551 | |
| 552 | - if(is_array($evtOut)) { |
|
| 552 | + if (is_array($evtOut)) { |
|
| 553 | 553 | echo implode('', $evtOut); |
| 554 | 554 | } |
| 555 | 555 | |
@@ -573,8 +573,8 @@ discard block |
||
| 573 | 573 | <fieldset id="create_edit"> |
| 574 | 574 | |
| 575 | 575 | <h1> |
| 576 | - <i class="fa fa-pencil-square-o"></i><?php if(isset($_REQUEST['id'])) { |
|
| 577 | - echo iconv_substr($content['pagetitle'], 0, 50, $modx->config['modx_charset']) . (iconv_strlen($content['pagetitle'], $modx->config['modx_charset']) > 50 ? '...' : '') . '<small>(' . $_REQUEST['id'] . ')</small>'; |
|
| 576 | + <i class="fa fa-pencil-square-o"></i><?php if (isset($_REQUEST['id'])) { |
|
| 577 | + echo iconv_substr($content['pagetitle'], 0, 50, $modx->config['modx_charset']).(iconv_strlen($content['pagetitle'], $modx->config['modx_charset']) > 50 ? '...' : '').'<small>('.$_REQUEST['id'].')</small>'; |
|
| 578 | 578 | } else { |
| 579 | 579 | if ($modx->manager->action == '4') { |
| 580 | 580 | echo $_lang['add_resource']; |
@@ -590,36 +590,36 @@ discard block |
||
| 590 | 590 | |
| 591 | 591 | <?php |
| 592 | 592 | // breadcrumbs |
| 593 | - if($modx->config['use_breadcrumbs']) { |
|
| 593 | + if ($modx->config['use_breadcrumbs']) { |
|
| 594 | 594 | $temp = array(); |
| 595 | 595 | $title = isset($content['pagetitle']) ? $content['pagetitle'] : $_lang['create_resource_title']; |
| 596 | 596 | |
| 597 | - if(isset($_REQUEST['id']) && $content['parent'] != 0) { |
|
| 597 | + if (isset($_REQUEST['id']) && $content['parent'] != 0) { |
|
| 598 | 598 | $bID = (int) $_REQUEST['id']; |
| 599 | 599 | $temp = $modx->getParentIds($bID); |
| 600 | - } else if(isset($_REQUEST['pid'])) { |
|
| 600 | + } else if (isset($_REQUEST['pid'])) { |
|
| 601 | 601 | $bID = (int) $_REQUEST['pid']; |
| 602 | 602 | $temp = $modx->getParentIds($bID); |
| 603 | 603 | array_unshift($temp, $bID); |
| 604 | 604 | } |
| 605 | 605 | |
| 606 | - if($temp) { |
|
| 606 | + if ($temp) { |
|
| 607 | 607 | $parents = implode(',', $temp); |
| 608 | 608 | |
| 609 | - if(!empty($parents)) { |
|
| 609 | + if (!empty($parents)) { |
|
| 610 | 610 | $where = "FIND_IN_SET(id,'{$parents}') DESC"; |
| 611 | 611 | $rs = $modx->db->select('id, pagetitle', $tbl_site_content, "id IN ({$parents})", $where); |
| 612 | - while($row = $modx->db->getRow($rs)) { |
|
| 612 | + while ($row = $modx->db->getRow($rs)) { |
|
| 613 | 613 | $out .= '<li class="breadcrumbs__li"> |
| 614 | - <a href="index.php?a=27&id=' . $row['id'] . '" class="breadcrumbs__a">' . htmlspecialchars($row['pagetitle'], ENT_QUOTES, $modx->config['modx_charset']) . '</a> |
|
| 614 | + <a href="index.php?a=27&id=' . $row['id'].'" class="breadcrumbs__a">'.htmlspecialchars($row['pagetitle'], ENT_QUOTES, $modx->config['modx_charset']).'</a> |
|
| 615 | 615 | <span class="breadcrumbs__sep">></span> |
| 616 | 616 | </li>'; |
| 617 | 617 | } |
| 618 | 618 | } |
| 619 | 619 | } |
| 620 | 620 | |
| 621 | - $out .= '<li class="breadcrumbs__li breadcrumbs__li_current">' . $title . '</li>'; |
|
| 622 | - echo '<ul class="breadcrumbs">' . $out . '</ul>'; |
|
| 621 | + $out .= '<li class="breadcrumbs__li breadcrumbs__li_current">'.$title.'</li>'; |
|
| 622 | + echo '<ul class="breadcrumbs">'.$out.'</ul>'; |
|
| 623 | 623 | } |
| 624 | 624 | ?> |
| 625 | 625 | |
@@ -636,7 +636,7 @@ discard block |
||
| 636 | 636 | $evtOut = $modx->invokeEvent('OnDocFormTemplateRender', array( |
| 637 | 637 | 'id' => $id |
| 638 | 638 | )); |
| 639 | - if(is_array($evtOut)) { |
|
| 639 | + if (is_array($evtOut)) { |
|
| 640 | 640 | echo implode('', $evtOut); |
| 641 | 641 | } else { |
| 642 | 642 | ?> |
@@ -692,7 +692,7 @@ discard block |
||
| 692 | 692 | </td> |
| 693 | 693 | </tr> |
| 694 | 694 | |
| 695 | - <?php if($content['type'] == 'reference' || $modx->manager->action == '72') { // Web Link specific ?> |
|
| 695 | + <?php if ($content['type'] == 'reference' || $modx->manager->action == '72') { // Web Link specific ?> |
|
| 696 | 696 | |
| 697 | 697 | <tr> |
| 698 | 698 | <td><span class="warning"><?= $_lang['weblink'] ?></span> |
@@ -728,17 +728,17 @@ discard block |
||
| 728 | 728 | $from = "{$tbl_site_templates} AS t LEFT JOIN {$tbl_categories} AS c ON t.category = c.id"; |
| 729 | 729 | $rs = $modx->db->select($field, $from, '', 'c.category, t.templatename ASC'); |
| 730 | 730 | $currentCategory = ''; |
| 731 | - while($row = $modx->db->getRow($rs)) { |
|
| 732 | - if($row['selectable'] != 1 && $row['id'] != $content['template']) { |
|
| 731 | + while ($row = $modx->db->getRow($rs)) { |
|
| 732 | + if ($row['selectable'] != 1 && $row['id'] != $content['template']) { |
|
| 733 | 733 | continue; |
| 734 | 734 | }; |
| 735 | 735 | // Skip if not selectable but show if selected! |
| 736 | 736 | $thisCategory = $row['category']; |
| 737 | - if($thisCategory == null) { |
|
| 737 | + if ($thisCategory == null) { |
|
| 738 | 738 | $thisCategory = $_lang["no_category"]; |
| 739 | 739 | } |
| 740 | - if($thisCategory != $currentCategory) { |
|
| 741 | - if($closeOptGroup) { |
|
| 740 | + if ($thisCategory != $currentCategory) { |
|
| 741 | + if ($closeOptGroup) { |
|
| 742 | 742 | echo "\t\t\t\t\t</optgroup>\n"; |
| 743 | 743 | } |
| 744 | 744 | echo "\t\t\t\t\t<optgroup label=\"$thisCategory\">\n"; |
@@ -747,10 +747,10 @@ discard block |
||
| 747 | 747 | |
| 748 | 748 | $selectedtext = ($row['id'] == $content['template']) ? ' selected="selected"' : ''; |
| 749 | 749 | |
| 750 | - echo "\t\t\t\t\t" . '<option value="' . $row['id'] . '"' . $selectedtext . '>' . $row['templatename'] . "</option>\n"; |
|
| 750 | + echo "\t\t\t\t\t".'<option value="'.$row['id'].'"'.$selectedtext.'>'.$row['templatename']."</option>\n"; |
|
| 751 | 751 | $currentCategory = $thisCategory; |
| 752 | 752 | } |
| 753 | - if($thisCategory != '') { |
|
| 753 | + if ($thisCategory != '') { |
|
| 754 | 754 | echo "\t\t\t\t\t</optgroup>\n"; |
| 755 | 755 | } |
| 756 | 756 | ?> |
@@ -794,20 +794,20 @@ discard block |
||
| 794 | 794 | <td valign="top"> |
| 795 | 795 | <?php |
| 796 | 796 | $parentlookup = false; |
| 797 | - if(isset ($_REQUEST['id'])) { |
|
| 798 | - if($content['parent'] == 0) { |
|
| 797 | + if (isset ($_REQUEST['id'])) { |
|
| 798 | + if ($content['parent'] == 0) { |
|
| 799 | 799 | $parentname = $site_name; |
| 800 | 800 | } else { |
| 801 | 801 | $parentlookup = $content['parent']; |
| 802 | 802 | } |
| 803 | - } elseif(isset ($_REQUEST['pid'])) { |
|
| 804 | - if($_REQUEST['pid'] == 0) { |
|
| 803 | + } elseif (isset ($_REQUEST['pid'])) { |
|
| 804 | + if ($_REQUEST['pid'] == 0) { |
|
| 805 | 805 | $parentname = $site_name; |
| 806 | 806 | } else { |
| 807 | 807 | $parentlookup = $_REQUEST['pid']; |
| 808 | 808 | } |
| 809 | - } elseif(isset($_POST['parent'])) { |
|
| 810 | - if($_POST['parent'] == 0) { |
|
| 809 | + } elseif (isset($_POST['parent'])) { |
|
| 810 | + if ($_POST['parent'] == 0) { |
|
| 811 | 811 | $parentname = $site_name; |
| 812 | 812 | } else { |
| 813 | 813 | $parentlookup = $_POST['parent']; |
@@ -816,10 +816,10 @@ discard block |
||
| 816 | 816 | $parentname = $site_name; |
| 817 | 817 | $content['parent'] = 0; |
| 818 | 818 | } |
| 819 | - if($parentlookup !== false && is_numeric($parentlookup)) { |
|
| 819 | + if ($parentlookup !== false && is_numeric($parentlookup)) { |
|
| 820 | 820 | $rs = $modx->db->select('pagetitle', $tbl_site_content, "id='{$parentlookup}'"); |
| 821 | 821 | $parentname = $modx->db->getValue($rs); |
| 822 | - if(!$parentname) { |
|
| 822 | + if (!$parentname) { |
|
| 823 | 823 | $modx->webAlertAndQuit($_lang["error_no_parent"]); |
| 824 | 824 | } |
| 825 | 825 | } |
@@ -861,7 +861,7 @@ discard block |
||
| 861 | 861 | }*/ |
| 862 | 862 | ?> |
| 863 | 863 | |
| 864 | - <?php if($content['type'] == 'document' || $modx->manager->action == '4') { ?> |
|
| 864 | + <?php if ($content['type'] == 'document' || $modx->manager->action == '4') { ?> |
|
| 865 | 865 | <tr> |
| 866 | 866 | <td colspan="2"> |
| 867 | 867 | <hr> |
@@ -874,8 +874,8 @@ discard block |
||
| 874 | 874 | <?php |
| 875 | 875 | // invoke OnRichTextEditorRegister event |
| 876 | 876 | $evtOut = $modx->invokeEvent("OnRichTextEditorRegister"); |
| 877 | - if(is_array($evtOut)) { |
|
| 878 | - for($i = 0; $i < count($evtOut); $i++) { |
|
| 877 | + if (is_array($evtOut)) { |
|
| 878 | + for ($i = 0; $i < count($evtOut); $i++) { |
|
| 879 | 879 | $editor = $evtOut[$i]; |
| 880 | 880 | echo "\t\t\t", '<option value="', $editor, '"', ($modx->config['which_editor'] == $editor ? ' selected="selected"' : ''), '>', $editor, "</option>\n"; |
| 881 | 881 | } |
@@ -886,7 +886,7 @@ discard block |
||
| 886 | 886 | </div> |
| 887 | 887 | <div id="content_body"> |
| 888 | 888 | <?php |
| 889 | - if(($content['richtext'] == 1 || $modx->manager->action == '4') && $use_editor == 1) { |
|
| 889 | + if (($content['richtext'] == 1 || $modx->manager->action == '4') && $use_editor == 1) { |
|
| 890 | 890 | $htmlContent = $content['content']; |
| 891 | 891 | ?> |
| 892 | 892 | <div class="section-editor clearfix"> |
@@ -899,7 +899,7 @@ discard block |
||
| 899 | 899 | $richtexteditorIds[$modx->config['which_editor']][] = 'ta'; |
| 900 | 900 | $richtexteditorOptions[$modx->config['which_editor']]['ta'] = ''; |
| 901 | 901 | } else { |
| 902 | - echo "\t" . '<div><textarea class="phptextarea" id="ta" name="ta" rows="20" wrap="soft" onchange="documentDirty=true;">', $modx->htmlspecialchars($content['content']), '</textarea></div>' . "\n"; |
|
| 902 | + echo "\t".'<div><textarea class="phptextarea" id="ta" name="ta" rows="20" wrap="soft" onchange="documentDirty=true;">', $modx->htmlspecialchars($content['content']), '</textarea></div>'."\n"; |
|
| 903 | 903 | } |
| 904 | 904 | ?> |
| 905 | 905 | </div> |
@@ -915,7 +915,7 @@ discard block |
||
| 915 | 915 | |
| 916 | 916 | if (($content['type'] == 'document' || $modx->manager->action == '4') || ($content['type'] == 'reference' || $modx->manager->action == 72)) { |
| 917 | 917 | $template = $default_template; |
| 918 | - $group_tvs = empty($modx->config['group_tvs']) ? 0 : (int)$modx->config['group_tvs']; |
|
| 918 | + $group_tvs = empty($modx->config['group_tvs']) ? 0 : (int) $modx->config['group_tvs']; |
|
| 919 | 919 | if (isset ($_REQUEST['newtemplate'])) { |
| 920 | 920 | $template = $_REQUEST['newtemplate']; |
| 921 | 921 | } else { |
@@ -943,10 +943,10 @@ discard block |
||
| 943 | 943 | ); |
| 944 | 944 | $sort = 'tvtpl.rank,tv.rank, tv.id'; |
| 945 | 945 | if ($group_tvs) { |
| 946 | - $field .= ', IFNULL(tv.category,0) as category_id, IFNULL(cat.category,"' . $_lang['no_category'] . '") AS category, IFNULL(cat.rank,0) AS category_rank'; |
|
| 946 | + $field .= ', IFNULL(tv.category,0) as category_id, IFNULL(cat.category,"'.$_lang['no_category'].'") AS category, IFNULL(cat.rank,0) AS category_rank'; |
|
| 947 | 947 | $from .= ' |
| 948 | - LEFT JOIN ' . $tbl_categories . ' AS cat ON cat.id=tv.category'; |
|
| 949 | - $sort = 'cat.rank,cat.id,' . $sort; |
|
| 948 | + LEFT JOIN ' . $tbl_categories.' AS cat ON cat.id=tv.category'; |
|
| 949 | + $sort = 'cat.rank,cat.id,'.$sort; |
|
| 950 | 950 | } |
| 951 | 951 | $where = vsprintf("tvtpl.templateid='%s' AND (1='%s' OR ISNULL(tva.documentgroup) %s)", $vs); |
| 952 | 952 | $rs = $modx->db->select($field, $from, $where, $sort); |
@@ -964,8 +964,8 @@ discard block |
||
| 964 | 964 | if ($group_tvs == 1 || $group_tvs == 3) { |
| 965 | 965 | if ($i === 0) { |
| 966 | 966 | $templateVariablesOutput .= ' |
| 967 | - <div class="tab-section" id="tabTV_' . $row['category_id'] . '"> |
|
| 968 | - <div class="tab-header">' . $row['category'] . '</div> |
|
| 967 | + <div class="tab-section" id="tabTV_' . $row['category_id'].'"> |
|
| 968 | + <div class="tab-header">' . $row['category'].'</div> |
|
| 969 | 969 | <div class="tab-body tmplvars"> |
| 970 | 970 | <table>' . "\n"; |
| 971 | 971 | } else { |
@@ -974,17 +974,17 @@ discard block |
||
| 974 | 974 | </div> |
| 975 | 975 | </div> |
| 976 | 976 | |
| 977 | - <div class="tab-section" id="tabTV_' . $row['category_id'] . '"> |
|
| 978 | - <div class="tab-header">' . $row['category'] . '</div> |
|
| 977 | + <div class="tab-section" id="tabTV_' . $row['category_id'].'"> |
|
| 978 | + <div class="tab-header">' . $row['category'].'</div> |
|
| 979 | 979 | <div class="tab-body tmplvars"> |
| 980 | 980 | <table>'; |
| 981 | 981 | } |
| 982 | 982 | } else if ($group_tvs == 2 || $group_tvs == 4) { |
| 983 | 983 | if ($i === 0) { |
| 984 | 984 | $templateVariablesOutput .= ' |
| 985 | - <div id="tabTV_' . $row['category_id'] . '" class="tab-page tmplvars"> |
|
| 986 | - <h2 class="tab">' . $row['category'] . '</h2> |
|
| 987 | - <script type="text/javascript">tpTemplateVariables.addTabPage(document.getElementById(\'tabTV_' . $row['category_id'] . '\'));</script> |
|
| 985 | + <div id="tabTV_' . $row['category_id'].'" class="tab-page tmplvars"> |
|
| 986 | + <h2 class="tab">' . $row['category'].'</h2> |
|
| 987 | + <script type="text/javascript">tpTemplateVariables.addTabPage(document.getElementById(\'tabTV_' . $row['category_id'].'\'));</script> |
|
| 988 | 988 | |
| 989 | 989 | <div class="tab-body tmplvars"> |
| 990 | 990 | <table>'; |
@@ -994,9 +994,9 @@ discard block |
||
| 994 | 994 | </div> |
| 995 | 995 | </div> |
| 996 | 996 | |
| 997 | - <div id="tabTV_' . $row['category_id'] . '" class="tab-page tmplvars"> |
|
| 998 | - <h2 class="tab">' . $row['category'] . '</h2> |
|
| 999 | - <script type="text/javascript">tpTemplateVariables.addTabPage(document.getElementById(\'tabTV_' . $row['category_id'] . '\'));</script> |
|
| 997 | + <div id="tabTV_' . $row['category_id'].'" class="tab-page tmplvars"> |
|
| 998 | + <h2 class="tab">' . $row['category'].'</h2> |
|
| 999 | + <script type="text/javascript">tpTemplateVariables.addTabPage(document.getElementById(\'tabTV_' . $row['category_id'].'\'));</script> |
|
| 1000 | 1000 | |
| 1001 | 1001 | <div class="tab-body tmplvars"> |
| 1002 | 1002 | <table>'; |
@@ -1004,18 +1004,18 @@ discard block |
||
| 1004 | 1004 | } else if ($group_tvs == 5) { |
| 1005 | 1005 | if ($i === 0) { |
| 1006 | 1006 | $templateVariablesOutput .= ' |
| 1007 | - <div id="tabTV_' . $row['category_id'] . '" class="tab-page tmplvars"> |
|
| 1008 | - <h2 class="tab">' . $row['category'] . '</h2> |
|
| 1009 | - <script type="text/javascript">tpSettings.addTabPage(document.getElementById(\'tabTV_' . $row['category_id'] . '\'));</script> |
|
| 1007 | + <div id="tabTV_' . $row['category_id'].'" class="tab-page tmplvars"> |
|
| 1008 | + <h2 class="tab">' . $row['category'].'</h2> |
|
| 1009 | + <script type="text/javascript">tpSettings.addTabPage(document.getElementById(\'tabTV_' . $row['category_id'].'\'));</script> |
|
| 1010 | 1010 | <table>'; |
| 1011 | 1011 | } else { |
| 1012 | 1012 | $templateVariablesOutput .= ' |
| 1013 | 1013 | </table> |
| 1014 | 1014 | </div> |
| 1015 | 1015 | |
| 1016 | - <div id="tabTV_' . $row['category_id'] . '" class="tab-page tmplvars"> |
|
| 1017 | - <h2 class="tab">' . $row['category'] . '</h2> |
|
| 1018 | - <script type="text/javascript">tpSettings.addTabPage(document.getElementById(\'tabTV_' . $row['category_id'] . '\'));</script> |
|
| 1016 | + <div id="tabTV_' . $row['category_id'].'" class="tab-page tmplvars"> |
|
| 1017 | + <h2 class="tab">' . $row['category'].'</h2> |
|
| 1018 | + <script type="text/javascript">tpSettings.addTabPage(document.getElementById(\'tabTV_' . $row['category_id'].'\'));</script> |
|
| 1019 | 1019 | |
| 1020 | 1020 | <table>'; |
| 1021 | 1021 | } |
@@ -1035,8 +1035,8 @@ discard block |
||
| 1035 | 1035 | $editor = isset($tvOptions['editor']) ? $tvOptions['editor'] : $modx->config['which_editor']; |
| 1036 | 1036 | }; |
| 1037 | 1037 | // Add richtext editor to the list |
| 1038 | - $richtexteditorIds[$editor][] = "tv" . $row['id']; |
|
| 1039 | - $richtexteditorOptions[$editor]["tv" . $row['id']] = $tvOptions; |
|
| 1038 | + $richtexteditorIds[$editor][] = "tv".$row['id']; |
|
| 1039 | + $richtexteditorOptions[$editor]["tv".$row['id']] = $tvOptions; |
|
| 1040 | 1040 | } |
| 1041 | 1041 | |
| 1042 | 1042 | $templateVariablesTmp = ''; |
@@ -1053,24 +1053,24 @@ discard block |
||
| 1053 | 1053 | } |
| 1054 | 1054 | |
| 1055 | 1055 | // post back value |
| 1056 | - if (array_key_exists('tv' . $row['id'], $_POST)) { |
|
| 1057 | - if (is_array($_POST['tv' . $row['id']])) { |
|
| 1058 | - $tvPBV = implode('||', $_POST['tv' . $row['id']]); |
|
| 1056 | + if (array_key_exists('tv'.$row['id'], $_POST)) { |
|
| 1057 | + if (is_array($_POST['tv'.$row['id']])) { |
|
| 1058 | + $tvPBV = implode('||', $_POST['tv'.$row['id']]); |
|
| 1059 | 1059 | } else { |
| 1060 | - $tvPBV = $_POST['tv' . $row['id']]; |
|
| 1060 | + $tvPBV = $_POST['tv'.$row['id']]; |
|
| 1061 | 1061 | } |
| 1062 | 1062 | } else { |
| 1063 | 1063 | $tvPBV = $row['value']; |
| 1064 | 1064 | } |
| 1065 | 1065 | |
| 1066 | - $tvDescription = (!empty($row['description'])) ? '<br /><span class="comment">' . $row['description'] . '</span>' : ''; |
|
| 1067 | - $tvInherited = (substr($tvPBV, 0, 8) == '@INHERIT') ? '<br /><span class="comment inherited">(' . $_lang['tmplvars_inherited'] . ')</span>' : ''; |
|
| 1068 | - $tvName = $modx->hasPermission('edit_template') ? '<br/><small class="protectedNode">[*' . $row['name'] . '*]</small>' : ''; |
|
| 1066 | + $tvDescription = (!empty($row['description'])) ? '<br /><span class="comment">'.$row['description'].'</span>' : ''; |
|
| 1067 | + $tvInherited = (substr($tvPBV, 0, 8) == '@INHERIT') ? '<br /><span class="comment inherited">('.$_lang['tmplvars_inherited'].')</span>' : ''; |
|
| 1068 | + $tvName = $modx->hasPermission('edit_template') ? '<br/><small class="protectedNode">[*'.$row['name'].'*]</small>' : ''; |
|
| 1069 | 1069 | |
| 1070 | 1070 | $templateVariablesTmp .= ' |
| 1071 | 1071 | <tr> |
| 1072 | - <td><span class="warning">' . $row['caption'] . $tvName . '</span>' . $tvDescription . $tvInherited . '</td> |
|
| 1073 | - <td><div style="position:relative;' . ($row['type'] == 'date' ? '' : '') . '">' . renderFormElement($row['type'], $row['id'], $row['default_text'], $row['elements'], $tvPBV, '', $row, $tvsArray) . '</div></td> |
|
| 1072 | + <td><span class="warning">' . $row['caption'].$tvName.'</span>'.$tvDescription.$tvInherited.'</td> |
|
| 1073 | + <td><div style="position:relative;' . ($row['type'] == 'date' ? '' : '').'">'.renderFormElement($row['type'], $row['id'], $row['default_text'], $row['elements'], $tvPBV, '', $row, $tvsArray).'</div></td> |
|
| 1074 | 1074 | </tr>'; |
| 1075 | 1075 | |
| 1076 | 1076 | if ($group_tvs && $row['category_id'] == 0) { |
@@ -1084,38 +1084,38 @@ discard block |
||
| 1084 | 1084 | } |
| 1085 | 1085 | |
| 1086 | 1086 | if ($templateVariablesGeneral) { |
| 1087 | - echo '<table id="tabTV_0" class="tmplvars"><tbody>' . $templateVariablesGeneral . '</tbody></table>'; |
|
| 1087 | + echo '<table id="tabTV_0" class="tmplvars"><tbody>'.$templateVariablesGeneral.'</tbody></table>'; |
|
| 1088 | 1088 | } |
| 1089 | 1089 | |
| 1090 | 1090 | $templateVariables .= ' |
| 1091 | 1091 | <!-- Template Variables -->' . "\n"; |
| 1092 | 1092 | if (!$group_tvs) { |
| 1093 | 1093 | $templateVariables .= ' |
| 1094 | - <div class="sectionHeader" id="tv_header">' . $_lang['settings_templvars'] . '</div> |
|
| 1094 | + <div class="sectionHeader" id="tv_header">' . $_lang['settings_templvars'].'</div> |
|
| 1095 | 1095 | <div class="sectionBody tmplvars"> |
| 1096 | 1096 | <table>'; |
| 1097 | 1097 | } else if ($group_tvs == 2) { |
| 1098 | 1098 | $templateVariables .= ' |
| 1099 | 1099 | <div class="tab-section"> |
| 1100 | - <div class="tab-header" id="tv_header">' . $_lang['settings_templvars'] . '</div> |
|
| 1100 | + <div class="tab-header" id="tv_header">' . $_lang['settings_templvars'].'</div> |
|
| 1101 | 1101 | <div class="tab-pane" id="paneTemplateVariables"> |
| 1102 | 1102 | <script type="text/javascript"> |
| 1103 | - tpTemplateVariables = new WebFXTabPane(document.getElementById(\'paneTemplateVariables\'), ' . ($modx->config['remember_last_tab'] == 1 ? 'true' : 'false') . '); |
|
| 1103 | + tpTemplateVariables = new WebFXTabPane(document.getElementById(\'paneTemplateVariables\'), ' . ($modx->config['remember_last_tab'] == 1 ? 'true' : 'false').'); |
|
| 1104 | 1104 | </script>'; |
| 1105 | 1105 | } else if ($group_tvs == 3) { |
| 1106 | 1106 | $templateVariables .= ' |
| 1107 | 1107 | <div id="templateVariables" class="tab-page tmplvars"> |
| 1108 | - <h2 class="tab">' . $_lang['settings_templvars'] . '</h2> |
|
| 1108 | + <h2 class="tab">' . $_lang['settings_templvars'].'</h2> |
|
| 1109 | 1109 | <script type="text/javascript">tpSettings.addTabPage(document.getElementById(\'templateVariables\'));</script>'; |
| 1110 | 1110 | } else if ($group_tvs == 4) { |
| 1111 | 1111 | $templateVariables .= ' |
| 1112 | 1112 | <div id="templateVariables" class="tab-page tmplvars"> |
| 1113 | - <h2 class="tab">' . $_lang['settings_templvars'] . '</h2> |
|
| 1113 | + <h2 class="tab">' . $_lang['settings_templvars'].'</h2> |
|
| 1114 | 1114 | <script type="text/javascript">tpSettings.addTabPage(document.getElementById(\'templateVariables\'));</script> |
| 1115 | 1115 | |
| 1116 | 1116 | <div class="tab-pane" id="paneTemplateVariables"> |
| 1117 | 1117 | <script type="text/javascript"> |
| 1118 | - tpTemplateVariables = new WebFXTabPane(document.getElementById(\'paneTemplateVariables\'), ' . ($modx->config['remember_last_tab'] == 1 ? 'true' : 'false') . '); |
|
| 1118 | + tpTemplateVariables = new WebFXTabPane(document.getElementById(\'paneTemplateVariables\'), ' . ($modx->config['remember_last_tab'] == 1 ? 'true' : 'false').'); |
|
| 1119 | 1119 | </script>'; |
| 1120 | 1120 | } |
| 1121 | 1121 | $templateVariables .= $templateVariablesOutput; |
@@ -1207,7 +1207,7 @@ discard block |
||
| 1207 | 1207 | |
| 1208 | 1208 | <?php |
| 1209 | 1209 | |
| 1210 | - if($_SESSION['mgrRole'] == 1 || $modx->manager->action != '27' || $_SESSION['mgrInternalKey'] == $content['createdby'] || $modx->hasPermission('change_resourcetype')) { |
|
| 1210 | + if ($_SESSION['mgrRole'] == 1 || $modx->manager->action != '27' || $_SESSION['mgrInternalKey'] == $content['createdby'] || $modx->hasPermission('change_resourcetype')) { |
|
| 1211 | 1211 | ?> |
| 1212 | 1212 | <tr> |
| 1213 | 1213 | <td> |
@@ -1230,13 +1230,13 @@ discard block |
||
| 1230 | 1230 | <td> |
| 1231 | 1231 | <select name="contentType" class="inputBox" onchange="documentDirty=true;"> |
| 1232 | 1232 | <?php |
| 1233 | - if(!$content['contentType']) { |
|
| 1233 | + if (!$content['contentType']) { |
|
| 1234 | 1234 | $content['contentType'] = 'text/html'; |
| 1235 | 1235 | } |
| 1236 | 1236 | $custom_contenttype = (isset ($custom_contenttype) ? $custom_contenttype : "text/html,text/plain,text/xml"); |
| 1237 | 1237 | $ct = explode(",", $custom_contenttype); |
| 1238 | - for($i = 0; $i < count($ct); $i++) { |
|
| 1239 | - echo "\t\t\t\t\t" . '<option value="' . $ct[$i] . '"' . ($content['contentType'] == $ct[$i] ? ' selected="selected"' : '') . '>' . $ct[$i] . "</option>\n"; |
|
| 1238 | + for ($i = 0; $i < count($ct); $i++) { |
|
| 1239 | + echo "\t\t\t\t\t".'<option value="'.$ct[$i].'"'.($content['contentType'] == $ct[$i] ? ' selected="selected"' : '').'>'.$ct[$i]."</option>\n"; |
|
| 1240 | 1240 | } |
| 1241 | 1241 | ?> |
| 1242 | 1242 | </select> |
@@ -1262,7 +1262,7 @@ discard block |
||
| 1262 | 1262 | </tr> |
| 1263 | 1263 | <?php |
| 1264 | 1264 | } else { |
| 1265 | - if($content['type'] != 'reference' && $modx->manager->action != '72') { |
|
| 1265 | + if ($content['type'] != 'reference' && $modx->manager->action != '72') { |
|
| 1266 | 1266 | // non-admin managers creating or editing a document resource |
| 1267 | 1267 | ?> |
| 1268 | 1268 | <input type="hidden" name="contentType" value="<?= (isset($content['contentType']) ? $content['contentType'] : "text/html") ?>" /> |
@@ -1362,15 +1362,15 @@ discard block |
||
| 1362 | 1362 | <?php |
| 1363 | 1363 | /******************************* |
| 1364 | 1364 | * Document Access Permissions */ |
| 1365 | - if($use_udperms == 1) { |
|
| 1365 | + if ($use_udperms == 1) { |
|
| 1366 | 1366 | $groupsarray = array(); |
| 1367 | 1367 | $sql = ''; |
| 1368 | 1368 | |
| 1369 | 1369 | $documentId = ($modx->manager->action == '27' ? $id : (!empty($_REQUEST['pid']) ? $_REQUEST['pid'] : $content['parent'])); |
| 1370 | - if($documentId > 0) { |
|
| 1370 | + if ($documentId > 0) { |
|
| 1371 | 1371 | // Load up, the permissions from the parent (if new document) or existing document |
| 1372 | 1372 | $rs = $modx->db->select('id, document_group', $tbl_document_groups, "document='{$documentId}'"); |
| 1373 | - while($currentgroup = $modx->db->getRow($rs)) $groupsarray[] = $currentgroup['document_group'] . ',' . $currentgroup['id']; |
|
| 1373 | + while ($currentgroup = $modx->db->getRow($rs)) $groupsarray[] = $currentgroup['document_group'].','.$currentgroup['id']; |
|
| 1374 | 1374 | |
| 1375 | 1375 | // Load up the current permissions and names |
| 1376 | 1376 | $vs = array( |
@@ -1386,7 +1386,7 @@ discard block |
||
| 1386 | 1386 | } |
| 1387 | 1387 | |
| 1388 | 1388 | // retain selected doc groups between post |
| 1389 | - if(isset($_POST['docgroups'])) { |
|
| 1389 | + if (isset($_POST['docgroups'])) { |
|
| 1390 | 1390 | $groupsarray = array_merge($groupsarray, $_POST['docgroups']); |
| 1391 | 1391 | } |
| 1392 | 1392 | |
@@ -1405,26 +1405,26 @@ discard block |
||
| 1405 | 1405 | $permissions_no = 0; // count permissions the current mgr user doesn't have |
| 1406 | 1406 | |
| 1407 | 1407 | // Loop through the permissions list |
| 1408 | - while($row = $modx->db->getRow($rs)) { |
|
| 1408 | + while ($row = $modx->db->getRow($rs)) { |
|
| 1409 | 1409 | |
| 1410 | 1410 | // Create an inputValue pair (group ID and group link (if it exists)) |
| 1411 | - $inputValue = $row['id'] . ',' . ($row['link_id'] ? $row['link_id'] : 'new'); |
|
| 1412 | - $inputId = 'group-' . $row['id']; |
|
| 1411 | + $inputValue = $row['id'].','.($row['link_id'] ? $row['link_id'] : 'new'); |
|
| 1412 | + $inputId = 'group-'.$row['id']; |
|
| 1413 | 1413 | |
| 1414 | 1414 | $checked = in_array($inputValue, $groupsarray); |
| 1415 | - if($checked) { |
|
| 1415 | + if ($checked) { |
|
| 1416 | 1416 | $notPublic = true; |
| 1417 | 1417 | } // Mark as private access (either web or manager) |
| 1418 | 1418 | |
| 1419 | 1419 | // Skip the access permission if the user doesn't have access... |
| 1420 | - if((!$isManager && $row['private_memgroup'] == '1') || (!$isWeb && $row['private_webgroup'] == '1')) { |
|
| 1420 | + if ((!$isManager && $row['private_memgroup'] == '1') || (!$isWeb && $row['private_webgroup'] == '1')) { |
|
| 1421 | 1421 | continue; |
| 1422 | 1422 | } |
| 1423 | 1423 | |
| 1424 | 1424 | // Setup attributes for this Input box |
| 1425 | 1425 | $inputAttributes['id'] = $inputId; |
| 1426 | 1426 | $inputAttributes['value'] = $inputValue; |
| 1427 | - if($checked) { |
|
| 1427 | + if ($checked) { |
|
| 1428 | 1428 | $inputAttributes['checked'] = 'checked'; |
| 1429 | 1429 | } else { |
| 1430 | 1430 | unset($inputAttributes['checked']); |
@@ -1432,10 +1432,10 @@ discard block |
||
| 1432 | 1432 | |
| 1433 | 1433 | // Create attribute string list |
| 1434 | 1434 | $inputString = array(); |
| 1435 | - foreach($inputAttributes as $k => $v) $inputString[] = $k . '="' . $v . '"'; |
|
| 1435 | + foreach ($inputAttributes as $k => $v) $inputString[] = $k.'="'.$v.'"'; |
|
| 1436 | 1436 | |
| 1437 | 1437 | // Make the <input> HTML |
| 1438 | - $inputHTML = '<input ' . implode(' ', $inputString) . ' />'; |
|
| 1438 | + $inputHTML = '<input '.implode(' ', $inputString).' />'; |
|
| 1439 | 1439 | |
| 1440 | 1440 | // does user have this permission? |
| 1441 | 1441 | $from = "{$tbl_membergroup_access} AS mga, {$tbl_member_groups} AS mg"; |
@@ -1446,23 +1446,23 @@ discard block |
||
| 1446 | 1446 | $where = vsprintf("mga.membergroup=mg.user_group AND mga.documentgroup=%s AND mg.member=%s", $vs); |
| 1447 | 1447 | $rsp = $modx->db->select('COUNT(mg.id)', $from, $where); |
| 1448 | 1448 | $count = $modx->db->getValue($rsp); |
| 1449 | - if($count > 0) { |
|
| 1449 | + if ($count > 0) { |
|
| 1450 | 1450 | ++$permissions_yes; |
| 1451 | 1451 | } else { |
| 1452 | 1452 | ++$permissions_no; |
| 1453 | 1453 | } |
| 1454 | - $permissions[] = "\t\t" . '<li>' . $inputHTML . '<label for="' . $inputId . '">' . $row['name'] . '</label></li>'; |
|
| 1454 | + $permissions[] = "\t\t".'<li>'.$inputHTML.'<label for="'.$inputId.'">'.$row['name'].'</label></li>'; |
|
| 1455 | 1455 | } |
| 1456 | 1456 | // if mgr user doesn't have access to any of the displayable permissions, forget about them and make doc public |
| 1457 | - if($_SESSION['mgrRole'] != 1 && ($permissions_yes == 0 && $permissions_no > 0)) { |
|
| 1457 | + if ($_SESSION['mgrRole'] != 1 && ($permissions_yes == 0 && $permissions_no > 0)) { |
|
| 1458 | 1458 | $permissions = array(); |
| 1459 | 1459 | } |
| 1460 | 1460 | |
| 1461 | 1461 | // See if the Access Permissions section is worth displaying... |
| 1462 | - if(!empty($permissions)) { |
|
| 1462 | + if (!empty($permissions)) { |
|
| 1463 | 1463 | // Add the "All Document Groups" item if we have rights in both contexts |
| 1464 | - if($isManager && $isWeb) { |
|
| 1465 | - array_unshift($permissions, "\t\t" . '<li><input type="checkbox" class="checkbox" name="chkalldocs" id="groupall"' . (!$notPublic ? ' checked="checked"' : '') . ' onclick="makePublic(true);" /><label for="groupall" class="warning">' . $_lang['all_doc_groups'] . '</label></li>'); |
|
| 1464 | + if ($isManager && $isWeb) { |
|
| 1465 | + array_unshift($permissions, "\t\t".'<li><input type="checkbox" class="checkbox" name="chkalldocs" id="groupall"'.(!$notPublic ? ' checked="checked"' : '').' onclick="makePublic(true);" /><label for="groupall" class="warning">'.$_lang['all_doc_groups'].'</label></li>'); |
|
| 1466 | 1466 | } |
| 1467 | 1467 | // Output the permissions list... |
| 1468 | 1468 | ?> |
@@ -1495,12 +1495,12 @@ discard block |
||
| 1495 | 1495 | </script> |
| 1496 | 1496 | <p><?= $_lang['access_permissions_docs_message'] ?></p> |
| 1497 | 1497 | <ul> |
| 1498 | - <?= implode("\n", $permissions) . "\n" ?> |
|
| 1498 | + <?= implode("\n", $permissions)."\n" ?> |
|
| 1499 | 1499 | </ul> |
| 1500 | 1500 | </div><!--div class="tab-page" id="tabAccess"--> |
| 1501 | 1501 | <?php |
| 1502 | 1502 | } // !empty($permissions) |
| 1503 | - elseif($_SESSION['mgrRole'] != 1 && ($permissions_yes == 0 && $permissions_no > 0) && ($_SESSION['mgrPermissions']['access_permissions'] == 1 || $_SESSION['mgrPermissions']['web_access_permissions'] == 1)) { |
|
| 1503 | + elseif ($_SESSION['mgrRole'] != 1 && ($permissions_yes == 0 && $permissions_no > 0) && ($_SESSION['mgrPermissions']['access_permissions'] == 1 || $_SESSION['mgrPermissions']['web_access_permissions'] == 1)) { |
|
| 1504 | 1504 | ?> |
| 1505 | 1505 | <p><?= $_lang["access_permissions_docs_collision"] ?></p> |
| 1506 | 1506 | <?php |
@@ -1520,7 +1520,7 @@ discard block |
||
| 1520 | 1520 | 'template' => $content['template'] |
| 1521 | 1521 | )); |
| 1522 | 1522 | |
| 1523 | - if(is_array($evtOut)) { |
|
| 1523 | + if (is_array($evtOut)) { |
|
| 1524 | 1524 | echo implode('', $evtOut); |
| 1525 | 1525 | } |
| 1526 | 1526 | ?> |
@@ -1533,16 +1533,16 @@ discard block |
||
| 1533 | 1533 | storeCurTemplate(); |
| 1534 | 1534 | </script> |
| 1535 | 1535 | <?php |
| 1536 | -if(($content['richtext'] == 1 || $modx->manager->action == '4' || $modx->manager->action == '72') && $use_editor == 1) { |
|
| 1537 | - if(is_array($richtexteditorIds)) { |
|
| 1538 | - foreach($richtexteditorIds as $editor => $elements) { |
|
| 1536 | +if (($content['richtext'] == 1 || $modx->manager->action == '4' || $modx->manager->action == '72') && $use_editor == 1) { |
|
| 1537 | + if (is_array($richtexteditorIds)) { |
|
| 1538 | + foreach ($richtexteditorIds as $editor => $elements) { |
|
| 1539 | 1539 | // invoke OnRichTextEditorInit event |
| 1540 | 1540 | $evtOut = $modx->invokeEvent('OnRichTextEditorInit', array( |
| 1541 | 1541 | 'editor' => $editor, |
| 1542 | 1542 | 'elements' => $elements, |
| 1543 | 1543 | 'options' => $richtexteditorOptions[$editor] |
| 1544 | 1544 | )); |
| 1545 | - if(is_array($evtOut)) { |
|
| 1545 | + if (is_array($evtOut)) { |
|
| 1546 | 1546 | echo implode('', $evtOut); |
| 1547 | 1547 | } |
| 1548 | 1548 | } |
@@ -4,24 +4,24 @@ discard block |
||
| 4 | 4 | } |
| 5 | 5 | |
| 6 | 6 | if(!$modx->hasPermission('category_manager')) { |
| 7 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 7 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 8 | 8 | } |
| 9 | 9 | |
| 10 | 10 | $_module_params = array( |
| 11 | - 'module_version' => '1.0.0', |
|
| 12 | - 'module_params' => '', |
|
| 13 | - 'module_id' => $_GET['id'], |
|
| 14 | - 'package_name' => 'Module_Categories_Manager', |
|
| 15 | - 'native_language' => 'de', |
|
| 16 | - 'name' => 'Categories Manager', |
|
| 17 | - 'dirname' => $site_manager_url, |
|
| 18 | - 'url' => 'index.php?a=120&id=' . $_GET['id'], |
|
| 19 | - 'path' => realpath( dirname(__FILE__) ) . DIRECTORY_SEPARATOR . 'category_mgr' . DIRECTORY_SEPARATOR, |
|
| 20 | - 'inc_dir' => realpath( dirname(__FILE__) ) . DIRECTORY_SEPARATOR . 'category_mgr' . DIRECTORY_SEPARATOR . 'inc' . DIRECTORY_SEPARATOR, |
|
| 21 | - 'languages_dir' => realpath( dirname(__FILE__) ) . DIRECTORY_SEPARATOR . 'category_mgr' . DIRECTORY_SEPARATOR . 'lang' . DIRECTORY_SEPARATOR, |
|
| 22 | - 'views_dir' => realpath( dirname(__FILE__) ) . DIRECTORY_SEPARATOR . 'category_mgr' . DIRECTORY_SEPARATOR . 'skin' . DIRECTORY_SEPARATOR, |
|
| 23 | - 'request_key' => 'module_categories_manager', |
|
| 24 | - 'messages' => array() |
|
| 11 | + 'module_version' => '1.0.0', |
|
| 12 | + 'module_params' => '', |
|
| 13 | + 'module_id' => $_GET['id'], |
|
| 14 | + 'package_name' => 'Module_Categories_Manager', |
|
| 15 | + 'native_language' => 'de', |
|
| 16 | + 'name' => 'Categories Manager', |
|
| 17 | + 'dirname' => $site_manager_url, |
|
| 18 | + 'url' => 'index.php?a=120&id=' . $_GET['id'], |
|
| 19 | + 'path' => realpath( dirname(__FILE__) ) . DIRECTORY_SEPARATOR . 'category_mgr' . DIRECTORY_SEPARATOR, |
|
| 20 | + 'inc_dir' => realpath( dirname(__FILE__) ) . DIRECTORY_SEPARATOR . 'category_mgr' . DIRECTORY_SEPARATOR . 'inc' . DIRECTORY_SEPARATOR, |
|
| 21 | + 'languages_dir' => realpath( dirname(__FILE__) ) . DIRECTORY_SEPARATOR . 'category_mgr' . DIRECTORY_SEPARATOR . 'lang' . DIRECTORY_SEPARATOR, |
|
| 22 | + 'views_dir' => realpath( dirname(__FILE__) ) . DIRECTORY_SEPARATOR . 'category_mgr' . DIRECTORY_SEPARATOR . 'skin' . DIRECTORY_SEPARATOR, |
|
| 23 | + 'request_key' => 'module_categories_manager', |
|
| 24 | + 'messages' => array() |
|
| 25 | 25 | ); |
| 26 | 26 | |
| 27 | 27 | $cm = new EvolutionCMS\Legacy\ModuleCategoriesManager(); |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | // assign module_params to internal params |
| 30 | 30 | foreach( $_module_params as $param => $value ) |
| 31 | 31 | { |
| 32 | - $cm->set( $param, $value ); |
|
| 32 | + $cm->set( $param, $value ); |
|
| 33 | 33 | } |
| 34 | 34 | |
| 35 | 35 | // catch the request actions |
@@ -37,8 +37,8 @@ discard block |
||
| 37 | 37 | |
| 38 | 38 | if( !$categories = $cm->getCategories() ) |
| 39 | 39 | { |
| 40 | - setcookie('webfxtab_manage-categories-pane', 0 ); |
|
| 41 | - $cm->addMessage( $cm->txt('Currently no categories available... JUST ADD A NEW ONE!'), 'global' ); |
|
| 40 | + setcookie('webfxtab_manage-categories-pane', 0 ); |
|
| 41 | + $cm->addMessage( $cm->txt('Currently no categories available... JUST ADD A NEW ONE!'), 'global' ); |
|
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | $cm->renderView('main', $categories ); |
@@ -1,9 +1,9 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
| 2 | +if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
| 3 | 3 | die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
| 4 | 4 | } |
| 5 | 5 | |
| 6 | -if(!$modx->hasPermission('category_manager')) { |
|
| 6 | +if (!$modx->hasPermission('category_manager')) { |
|
| 7 | 7 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
| 8 | 8 | } |
| 9 | 9 | |
@@ -15,11 +15,11 @@ discard block |
||
| 15 | 15 | 'native_language' => 'de', |
| 16 | 16 | 'name' => 'Categories Manager', |
| 17 | 17 | 'dirname' => $site_manager_url, |
| 18 | - 'url' => 'index.php?a=120&id=' . $_GET['id'], |
|
| 19 | - 'path' => realpath( dirname(__FILE__) ) . DIRECTORY_SEPARATOR . 'category_mgr' . DIRECTORY_SEPARATOR, |
|
| 20 | - 'inc_dir' => realpath( dirname(__FILE__) ) . DIRECTORY_SEPARATOR . 'category_mgr' . DIRECTORY_SEPARATOR . 'inc' . DIRECTORY_SEPARATOR, |
|
| 21 | - 'languages_dir' => realpath( dirname(__FILE__) ) . DIRECTORY_SEPARATOR . 'category_mgr' . DIRECTORY_SEPARATOR . 'lang' . DIRECTORY_SEPARATOR, |
|
| 22 | - 'views_dir' => realpath( dirname(__FILE__) ) . DIRECTORY_SEPARATOR . 'category_mgr' . DIRECTORY_SEPARATOR . 'skin' . DIRECTORY_SEPARATOR, |
|
| 18 | + 'url' => 'index.php?a=120&id='.$_GET['id'], |
|
| 19 | + 'path' => realpath(dirname(__FILE__)).DIRECTORY_SEPARATOR.'category_mgr'.DIRECTORY_SEPARATOR, |
|
| 20 | + 'inc_dir' => realpath(dirname(__FILE__)).DIRECTORY_SEPARATOR.'category_mgr'.DIRECTORY_SEPARATOR.'inc'.DIRECTORY_SEPARATOR, |
|
| 21 | + 'languages_dir' => realpath(dirname(__FILE__)).DIRECTORY_SEPARATOR.'category_mgr'.DIRECTORY_SEPARATOR.'lang'.DIRECTORY_SEPARATOR, |
|
| 22 | + 'views_dir' => realpath(dirname(__FILE__)).DIRECTORY_SEPARATOR.'category_mgr'.DIRECTORY_SEPARATOR.'skin'.DIRECTORY_SEPARATOR, |
|
| 23 | 23 | 'request_key' => 'module_categories_manager', |
| 24 | 24 | 'messages' => array() |
| 25 | 25 | ); |
@@ -27,19 +27,19 @@ discard block |
||
| 27 | 27 | $cm = new EvolutionCMS\Legacy\ModuleCategoriesManager(); |
| 28 | 28 | |
| 29 | 29 | // assign module_params to internal params |
| 30 | -foreach( $_module_params as $param => $value ) |
|
| 30 | +foreach ($_module_params as $param => $value) |
|
| 31 | 31 | { |
| 32 | - $cm->set( $param, $value ); |
|
| 32 | + $cm->set($param, $value); |
|
| 33 | 33 | } |
| 34 | 34 | |
| 35 | 35 | // catch the request actions |
| 36 | -include_once $cm->get('inc_dir') . 'request_trigger.inc.php'; |
|
| 36 | +include_once $cm->get('inc_dir').'request_trigger.inc.php'; |
|
| 37 | 37 | |
| 38 | -if( !$categories = $cm->getCategories() ) |
|
| 38 | +if (!$categories = $cm->getCategories()) |
|
| 39 | 39 | { |
| 40 | - setcookie('webfxtab_manage-categories-pane', 0 ); |
|
| 41 | - $cm->addMessage( $cm->txt('Currently no categories available... JUST ADD A NEW ONE!'), 'global' ); |
|
| 40 | + setcookie('webfxtab_manage-categories-pane', 0); |
|
| 41 | + $cm->addMessage($cm->txt('Currently no categories available... JUST ADD A NEW ONE!'), 'global'); |
|
| 42 | 42 | } |
| 43 | 43 | |
| 44 | -$cm->renderView('main', $categories ); |
|
| 44 | +$cm->renderView('main', $categories); |
|
| 45 | 45 | return; |
@@ -27,16 +27,14 @@ |
||
| 27 | 27 | $cm = new EvolutionCMS\Legacy\ModuleCategoriesManager(); |
| 28 | 28 | |
| 29 | 29 | // assign module_params to internal params |
| 30 | -foreach( $_module_params as $param => $value ) |
|
| 31 | -{ |
|
| 30 | +foreach( $_module_params as $param => $value ) { |
|
| 32 | 31 | $cm->set( $param, $value ); |
| 33 | 32 | } |
| 34 | 33 | |
| 35 | 34 | // catch the request actions |
| 36 | 35 | include_once $cm->get('inc_dir') . 'request_trigger.inc.php'; |
| 37 | 36 | |
| 38 | -if( !$categories = $cm->getCategories() ) |
|
| 39 | -{ |
|
| 37 | +if( !$categories = $cm->getCategories() ) { |
|
| 40 | 38 | setcookie('webfxtab_manage-categories-pane', 0 ); |
| 41 | 39 | $cm->addMessage( $cm->txt('Currently no categories available... JUST ADD A NEW ONE!'), 'global' ); |
| 42 | 40 | } |
@@ -1,5 +1,5 @@ |
||
| 1 | 1 | <?php |
| 2 | -if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
| 2 | +if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
| 3 | 3 | die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
| 4 | 4 | } |
| 5 | 5 | |
@@ -6,4 +6,6 @@ |
||
| 6 | 6 | /** |
| 7 | 7 | * Don't delete |
| 8 | 8 | */ |
| 9 | -class mgrResources extends EvolutionCMS\Legacy\mgrResources{} |
|
| 9 | +class mgrResources extends EvolutionCMS\Legacy\mgrResources |
|
| 10 | +{ |
|
| 11 | +} |
|
@@ -4,4 +4,6 @@ |
||
| 4 | 4 | * Class to handle the modx-categories |
| 5 | 5 | * @deprecated use EvolutionCMS\Legacy\Categories |
| 6 | 6 | */ |
| 7 | -class Categories extends EvolutionCMS\Legacy\Categories{} |
|
| 7 | +class Categories extends EvolutionCMS\Legacy\Categories |
|
| 8 | +{ |
|
| 9 | +} |
|
@@ -3,51 +3,51 @@ discard block |
||
| 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('exec_module')) { |
| 6 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 6 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 7 | 7 | } |
| 8 | 8 | |
| 9 | 9 | $id = isset($_GET['id'])? (int)$_GET['id'] : 0; |
| 10 | 10 | if($id==0) { |
| 11 | - $modx->webAlertAndQuit($_lang["error_no_id"]); |
|
| 11 | + $modx->webAlertAndQuit($_lang["error_no_id"]); |
|
| 12 | 12 | } |
| 13 | 13 | |
| 14 | 14 | // check if user has access permission, except admins |
| 15 | 15 | if($_SESSION['mgrRole']!=1){ |
| 16 | - $rs = $modx->db->select( |
|
| 17 | - 'sma.usergroup,mg.member', |
|
| 18 | - $modx->getFullTableName("site_module_access")." sma |
|
| 16 | + $rs = $modx->db->select( |
|
| 17 | + 'sma.usergroup,mg.member', |
|
| 18 | + $modx->getFullTableName("site_module_access")." sma |
|
| 19 | 19 | LEFT JOIN ".$modx->getFullTableName("member_groups")." mg ON mg.user_group = sma.usergroup AND member='".$modx->getLoginUserID()."'", |
| 20 | - "sma.module = '{$id}'" |
|
| 21 | - ); |
|
| 22 | - //initialize permission to -1, if it stays -1 no permissions |
|
| 23 | - //attached so permission granted |
|
| 24 | - $permissionAccessInt = -1; |
|
| 20 | + "sma.module = '{$id}'" |
|
| 21 | + ); |
|
| 22 | + //initialize permission to -1, if it stays -1 no permissions |
|
| 23 | + //attached so permission granted |
|
| 24 | + $permissionAccessInt = -1; |
|
| 25 | 25 | |
| 26 | - while ($row = $modx->db->getRow($rs)) { |
|
| 27 | - if($row["usergroup"] && $row["member"]) { |
|
| 28 | - //if there are permissions and this member has permission, ofcourse |
|
| 29 | - //this is granted |
|
| 30 | - $permissionAccessInt = 1; |
|
| 31 | - } elseif ($permissionAccessInt==-1) { |
|
| 32 | - //if there are permissions but this member has no permission and the |
|
| 33 | - //variable was still in init state we set permission to 0; no permissions |
|
| 34 | - $permissionAccessInt = 0; |
|
| 35 | - } |
|
| 36 | - } |
|
| 26 | + while ($row = $modx->db->getRow($rs)) { |
|
| 27 | + if($row["usergroup"] && $row["member"]) { |
|
| 28 | + //if there are permissions and this member has permission, ofcourse |
|
| 29 | + //this is granted |
|
| 30 | + $permissionAccessInt = 1; |
|
| 31 | + } elseif ($permissionAccessInt==-1) { |
|
| 32 | + //if there are permissions but this member has no permission and the |
|
| 33 | + //variable was still in init state we set permission to 0; no permissions |
|
| 34 | + $permissionAccessInt = 0; |
|
| 35 | + } |
|
| 36 | + } |
|
| 37 | 37 | |
| 38 | - if($permissionAccessInt==0) { |
|
| 39 | - $modx->webAlertAndQuit("You do not sufficient privileges to execute this module.", "index.php?a=106"); |
|
| 40 | - } |
|
| 38 | + if($permissionAccessInt==0) { |
|
| 39 | + $modx->webAlertAndQuit("You do not sufficient privileges to execute this module.", "index.php?a=106"); |
|
| 40 | + } |
|
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | // get module data |
| 44 | 44 | $rs = $modx->db->select('*', $modx->getFullTableName("site_modules"), "id='{$id}'"); |
| 45 | 45 | $content = $modx->db->getRow($rs); |
| 46 | 46 | if(!$content) { |
| 47 | - $modx->webAlertAndQuit("No record found for id {$id}.", "index.php?a=106"); |
|
| 47 | + $modx->webAlertAndQuit("No record found for id {$id}.", "index.php?a=106"); |
|
| 48 | 48 | } |
| 49 | 49 | if($content['disabled']) { |
| 50 | - $modx->webAlertAndQuit("This module is disabled and cannot be executed.", "index.php?a=106"); |
|
| 50 | + $modx->webAlertAndQuit("This module is disabled and cannot be executed.", "index.php?a=106"); |
|
| 51 | 51 | } |
| 52 | 52 | |
| 53 | 53 | // Set the item name for logger |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | |
| 63 | 63 | $output = evalModule($content["modulecode"],$parameter); |
| 64 | 64 | if (strpos(trim($output),'<')===0 && strpos(trim($output),'<?xml')!==0) { |
| 65 | - echo "<style>@supports (-webkit-overflow-scrolling: touch) {body,html {-webkit-overflow-scrolling: touch;overflow:auto!important;height:100%!important}}</style>"; // for iframe scroller |
|
| 65 | + echo "<style>@supports (-webkit-overflow-scrolling: touch) {body,html {-webkit-overflow-scrolling: touch;overflow:auto!important;height:100%!important}}</style>"; // for iframe scroller |
|
| 66 | 66 | } |
| 67 | 67 | echo $output; |
| 68 | 68 | include MODX_MANAGER_PATH."includes/sysalert.display.inc.php"; |
@@ -12,7 +12,7 @@ |
||
| 12 | 12 | } |
| 13 | 13 | |
| 14 | 14 | // check if user has access permission, except admins |
| 15 | -if($_SESSION['mgrRole']!=1){ |
|
| 15 | +if($_SESSION['mgrRole']!=1) { |
|
| 16 | 16 | $rs = $modx->db->select( |
| 17 | 17 | 'sma.usergroup,mg.member', |
| 18 | 18 | $modx->getFullTableName("site_module_access")." sma |
@@ -1,18 +1,18 @@ 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 | -if(!$modx->hasPermission('exec_module')) { |
|
| 5 | +if (!$modx->hasPermission('exec_module')) { |
|
| 6 | 6 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
| 7 | 7 | } |
| 8 | 8 | |
| 9 | -$id = isset($_GET['id'])? (int)$_GET['id'] : 0; |
|
| 10 | -if($id==0) { |
|
| 9 | +$id = isset($_GET['id']) ? (int) $_GET['id'] : 0; |
|
| 10 | +if ($id == 0) { |
|
| 11 | 11 | $modx->webAlertAndQuit($_lang["error_no_id"]); |
| 12 | 12 | } |
| 13 | 13 | |
| 14 | 14 | // check if user has access permission, except admins |
| 15 | -if($_SESSION['mgrRole']!=1){ |
|
| 15 | +if ($_SESSION['mgrRole'] != 1) { |
|
| 16 | 16 | $rs = $modx->db->select( |
| 17 | 17 | 'sma.usergroup,mg.member', |
| 18 | 18 | $modx->getFullTableName("site_module_access")." sma |
@@ -24,18 +24,18 @@ discard block |
||
| 24 | 24 | $permissionAccessInt = -1; |
| 25 | 25 | |
| 26 | 26 | while ($row = $modx->db->getRow($rs)) { |
| 27 | - if($row["usergroup"] && $row["member"]) { |
|
| 27 | + if ($row["usergroup"] && $row["member"]) { |
|
| 28 | 28 | //if there are permissions and this member has permission, ofcourse |
| 29 | 29 | //this is granted |
| 30 | 30 | $permissionAccessInt = 1; |
| 31 | - } elseif ($permissionAccessInt==-1) { |
|
| 31 | + } elseif ($permissionAccessInt == -1) { |
|
| 32 | 32 | //if there are permissions but this member has no permission and the |
| 33 | 33 | //variable was still in init state we set permission to 0; no permissions |
| 34 | 34 | $permissionAccessInt = 0; |
| 35 | 35 | } |
| 36 | 36 | } |
| 37 | 37 | |
| 38 | - if($permissionAccessInt==0) { |
|
| 38 | + if ($permissionAccessInt == 0) { |
|
| 39 | 39 | $modx->webAlertAndQuit("You do not sufficient privileges to execute this module.", "index.php?a=106"); |
| 40 | 40 | } |
| 41 | 41 | } |
@@ -43,10 +43,10 @@ discard block |
||
| 43 | 43 | // get module data |
| 44 | 44 | $rs = $modx->db->select('*', $modx->getFullTableName("site_modules"), "id='{$id}'"); |
| 45 | 45 | $content = $modx->db->getRow($rs); |
| 46 | -if(!$content) { |
|
| 46 | +if (!$content) { |
|
| 47 | 47 | $modx->webAlertAndQuit("No record found for id {$id}.", "index.php?a=106"); |
| 48 | 48 | } |
| 49 | -if($content['disabled']) { |
|
| 49 | +if ($content['disabled']) { |
|
| 50 | 50 | $modx->webAlertAndQuit("This module is disabled and cannot be executed.", "index.php?a=106"); |
| 51 | 51 | } |
| 52 | 52 | |
@@ -60,8 +60,8 @@ discard block |
||
| 60 | 60 | $_SESSION['itemname'] = $content['name']; |
| 61 | 61 | |
| 62 | 62 | |
| 63 | -$output = evalModule($content["modulecode"],$parameter); |
|
| 64 | -if (strpos(trim($output),'<')===0 && strpos(trim($output),'<?xml')!==0) { |
|
| 63 | +$output = evalModule($content["modulecode"], $parameter); |
|
| 64 | +if (strpos(trim($output), '<') === 0 && strpos(trim($output), '<?xml') !== 0) { |
|
| 65 | 65 | echo "<style>@supports (-webkit-overflow-scrolling: touch) {body,html {-webkit-overflow-scrolling: touch;overflow:auto!important;height:100%!important}}</style>"; // for iframe scroller |
| 66 | 66 | } |
| 67 | 67 | echo $output; |
@@ -1,25 +1,25 @@ 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 | -if(!$modx->hasPermission('save_document')||!$modx->hasPermission('publish_document')) { |
|
| 5 | +if (!$modx->hasPermission('save_document') || !$modx->hasPermission('publish_document')) { |
|
| 6 | 6 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
| 7 | 7 | } |
| 8 | 8 | |
| 9 | -$id = isset($_REQUEST['id'])? (int)$_REQUEST['id'] : 0; |
|
| 10 | -if($id==0) { |
|
| 9 | +$id = isset($_REQUEST['id']) ? (int) $_REQUEST['id'] : 0; |
|
| 10 | +if ($id == 0) { |
|
| 11 | 11 | $modx->webAlertAndQuit($_lang["error_no_id"]); |
| 12 | 12 | } |
| 13 | 13 | |
| 14 | 14 | /************webber ********/ |
| 15 | -$content=$modx->db->getRow($modx->db->select('parent, pagetitle', $modx->getFullTableName('site_content'), "id='{$id}'")); |
|
| 16 | -$pid=($content['parent']==0?$id:$content['parent']); |
|
| 15 | +$content = $modx->db->getRow($modx->db->select('parent, pagetitle', $modx->getFullTableName('site_content'), "id='{$id}'")); |
|
| 16 | +$pid = ($content['parent'] == 0 ? $id : $content['parent']); |
|
| 17 | 17 | |
| 18 | 18 | /************** webber *************/ |
| 19 | -$sd=isset($_REQUEST['dir'])?'&dir='.$_REQUEST['dir']:'&dir=DESC'; |
|
| 20 | -$sb=isset($_REQUEST['sort'])?'&sort='.$_REQUEST['sort']:'&sort=createdon'; |
|
| 21 | -$pg=isset($_REQUEST['page'])?'&page='.(int)$_REQUEST['page']:''; |
|
| 22 | -$add_path=$sd.$sb.$pg; |
|
| 19 | +$sd = isset($_REQUEST['dir']) ? '&dir='.$_REQUEST['dir'] : '&dir=DESC'; |
|
| 20 | +$sb = isset($_REQUEST['sort']) ? '&sort='.$_REQUEST['sort'] : '&sort=createdon'; |
|
| 21 | +$pg = isset($_REQUEST['page']) ? '&page='.(int) $_REQUEST['page'] : ''; |
|
| 22 | +$add_path = $sd.$sb.$pg; |
|
| 23 | 23 | |
| 24 | 24 | /***********************************/ |
| 25 | 25 | |
@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | $udperms->document = $id; |
| 32 | 32 | $udperms->role = $_SESSION['mgrRole']; |
| 33 | 33 | |
| 34 | -if(!$udperms->checkPermissions()) { |
|
| 34 | +if (!$udperms->checkPermissions()) { |
|
| 35 | 35 | $modx->webAlertAndQuit($_lang["access_permission_denied"]); |
| 36 | 36 | } |
| 37 | 37 | |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | ), $modx->getFullTableName('site_content'), "id='{$id}'"); |
| 49 | 49 | |
| 50 | 50 | // invoke OnDocPublished event |
| 51 | -$modx->invokeEvent("OnDocPublished",array("docid"=>$id)); |
|
| 51 | +$modx->invokeEvent("OnDocPublished", array("docid"=>$id)); |
|
| 52 | 52 | |
| 53 | 53 | // Set the item name for logger |
| 54 | 54 | $_SESSION['itemname'] = $content['pagetitle']; |
@@ -56,6 +56,6 @@ discard block |
||
| 56 | 56 | // empty cache |
| 57 | 57 | $modx->clearCache('full'); |
| 58 | 58 | |
| 59 | -$header="Location: index.php?a=3&id=$pid&r=1".$add_path; |
|
| 59 | +$header = "Location: index.php?a=3&id=$pid&r=1".$add_path; |
|
| 60 | 60 | |
| 61 | 61 | header($header); |
@@ -1,25 +1,25 @@ 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 | -if(!$modx->hasPermission('save_document')||!$modx->hasPermission('publish_document')) { |
|
| 5 | +if (!$modx->hasPermission('save_document') || !$modx->hasPermission('publish_document')) { |
|
| 6 | 6 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
| 7 | 7 | } |
| 8 | 8 | |
| 9 | -$id = isset($_REQUEST['id'])? (int)$_REQUEST['id'] : 0; |
|
| 10 | -if($id==0) { |
|
| 9 | +$id = isset($_REQUEST['id']) ? (int) $_REQUEST['id'] : 0; |
|
| 10 | +if ($id == 0) { |
|
| 11 | 11 | $modx->webAlertAndQuit($_lang["error_no_id"]); |
| 12 | 12 | } |
| 13 | 13 | |
| 14 | 14 | /************webber ********/ |
| 15 | -$content=$modx->db->getRow($modx->db->select('parent, pagetitle', $modx->getFullTableName('site_content'), "id='{$id}'")); |
|
| 16 | -$pid=($content['parent']==0?$id:$content['parent']); |
|
| 15 | +$content = $modx->db->getRow($modx->db->select('parent, pagetitle', $modx->getFullTableName('site_content'), "id='{$id}'")); |
|
| 16 | +$pid = ($content['parent'] == 0 ? $id : $content['parent']); |
|
| 17 | 17 | |
| 18 | 18 | /************** webber *************/ |
| 19 | -$sd=isset($_REQUEST['dir'])?'&dir='.$_REQUEST['dir']:'&dir=DESC'; |
|
| 20 | -$sb=isset($_REQUEST['sort'])?'&sort='.$_REQUEST['sort']:'&sort=createdon'; |
|
| 21 | -$pg=isset($_REQUEST['page'])?'&page='.(int)$_REQUEST['page']:''; |
|
| 22 | -$add_path=$sd.$sb.$pg; |
|
| 19 | +$sd = isset($_REQUEST['dir']) ? '&dir='.$_REQUEST['dir'] : '&dir=DESC'; |
|
| 20 | +$sb = isset($_REQUEST['sort']) ? '&sort='.$_REQUEST['sort'] : '&sort=createdon'; |
|
| 21 | +$pg = isset($_REQUEST['page']) ? '&page='.(int) $_REQUEST['page'] : ''; |
|
| 22 | +$add_path = $sd.$sb.$pg; |
|
| 23 | 23 | |
| 24 | 24 | /***********************************/ |
| 25 | 25 | |
@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | $udperms->document = $id; |
| 32 | 32 | $udperms->role = $_SESSION['mgrRole']; |
| 33 | 33 | |
| 34 | -if(!$udperms->checkPermissions()) { |
|
| 34 | +if (!$udperms->checkPermissions()) { |
|
| 35 | 35 | $modx->webAlertAndQuit($_lang["access_permission_denied"]); |
| 36 | 36 | } |
| 37 | 37 | |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | ), $modx->getFullTableName('site_content'), "id='{$id}'"); |
| 49 | 49 | |
| 50 | 50 | // invoke OnDocUnPublished event |
| 51 | -$modx->invokeEvent("OnDocUnPublished",array("docid"=>$id)); |
|
| 51 | +$modx->invokeEvent("OnDocUnPublished", array("docid"=>$id)); |
|
| 52 | 52 | |
| 53 | 53 | // Set the item name for logger |
| 54 | 54 | $_SESSION['itemname'] = $content['pagetitle']; |
@@ -56,6 +56,6 @@ discard block |
||
| 56 | 56 | // empty cache |
| 57 | 57 | $modx->clearCache('full'); |
| 58 | 58 | |
| 59 | -$header="Location: index.php?a=3&id=$pid&r=1".$add_path; |
|
| 59 | +$header = "Location: index.php?a=3&id=$pid&r=1".$add_path; |
|
| 60 | 60 | |
| 61 | 61 | header($header); |
@@ -31,8 +31,11 @@ |
||
| 31 | 31 | // count duplicates |
| 32 | 32 | $name = $modx->db->getValue($modx->db->select('name', $modx->getFullTableName('site_modules'), "id='{$id}'")); |
| 33 | 33 | $count = $modx->db->getRecordCount($modx->db->select('name', $modx->getFullTableName('site_modules'), "name LIKE '{$name} {$_lang['duplicated_el_suffix']}%'")); |
| 34 | -if($count>=1) $count = ' '.($count+1); |
|
| 35 | -else $count = ''; |
|
| 34 | +if($count>=1) { |
|
| 35 | + $count = ' '.($count+1); |
|
| 36 | +} else { |
|
| 37 | + $count = ''; |
|
| 38 | +} |
|
| 36 | 39 | |
| 37 | 40 | // duplicate module |
| 38 | 41 | $newid = $modx->db->insert( |
@@ -3,12 +3,12 @@ discard block |
||
| 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('new_module')) { |
| 6 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 6 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 7 | 7 | } |
| 8 | 8 | |
| 9 | 9 | $id = isset($_GET['id'])? (int)$_GET['id'] : 0; |
| 10 | 10 | if($id==0) { |
| 11 | - $modx->webAlertAndQuit($_lang["error_no_id"]); |
|
| 11 | + $modx->webAlertAndQuit($_lang["error_no_id"]); |
|
| 12 | 12 | } |
| 13 | 13 | // count duplicates |
| 14 | 14 | $name = $modx->db->getValue($modx->db->select('name', $modx->getFullTableName('site_modules'), "id='{$id}'")); |
@@ -18,40 +18,40 @@ discard block |
||
| 18 | 18 | |
| 19 | 19 | // duplicate module |
| 20 | 20 | $newid = $modx->db->insert( |
| 21 | - array( |
|
| 22 | - 'name'=>'', |
|
| 23 | - 'description'=>'', |
|
| 24 | - 'disabled'=>'', |
|
| 25 | - 'category'=>'', |
|
| 26 | - 'wrap'=>'', |
|
| 27 | - 'icon'=>'', |
|
| 28 | - 'enable_resource'=>'', |
|
| 29 | - 'resourcefile'=>'', |
|
| 30 | - 'createdon'=>'', |
|
| 31 | - 'editedon'=>'', |
|
| 32 | - 'guid'=>'', |
|
| 33 | - 'enable_sharedparams'=>'', |
|
| 34 | - 'properties'=>'', |
|
| 35 | - 'modulecode'=>'', |
|
| 36 | - ), $modx->getFullTableName('site_modules'), // Insert into |
|
| 37 | - "CONCAT(name, ' {$_lang['duplicated_el_suffix']}{$count}') AS name, description, '1' AS disabled, category, wrap, icon, enable_resource, resourcefile, createdon, editedon, '".createGUID()."' AS guid, enable_sharedparams, properties, modulecode", $modx->getFullTableName('site_modules'), "id='{$id}'"); // Copy from |
|
| 21 | + array( |
|
| 22 | + 'name'=>'', |
|
| 23 | + 'description'=>'', |
|
| 24 | + 'disabled'=>'', |
|
| 25 | + 'category'=>'', |
|
| 26 | + 'wrap'=>'', |
|
| 27 | + 'icon'=>'', |
|
| 28 | + 'enable_resource'=>'', |
|
| 29 | + 'resourcefile'=>'', |
|
| 30 | + 'createdon'=>'', |
|
| 31 | + 'editedon'=>'', |
|
| 32 | + 'guid'=>'', |
|
| 33 | + 'enable_sharedparams'=>'', |
|
| 34 | + 'properties'=>'', |
|
| 35 | + 'modulecode'=>'', |
|
| 36 | + ), $modx->getFullTableName('site_modules'), // Insert into |
|
| 37 | + "CONCAT(name, ' {$_lang['duplicated_el_suffix']}{$count}') AS name, description, '1' AS disabled, category, wrap, icon, enable_resource, resourcefile, createdon, editedon, '".createGUID()."' AS guid, enable_sharedparams, properties, modulecode", $modx->getFullTableName('site_modules'), "id='{$id}'"); // Copy from |
|
| 38 | 38 | |
| 39 | 39 | // duplicate module dependencies |
| 40 | 40 | $modx->db->insert( |
| 41 | - array( |
|
| 42 | - 'module'=>'', |
|
| 43 | - 'resource'=>'', |
|
| 44 | - 'type'=>'', |
|
| 45 | - ), $modx->getFullTableName('site_module_depobj'), // Insert into |
|
| 46 | - "'{$newid}', resource, type", $modx->getFullTableName('site_module_depobj'), "module='{$id}'"); // Copy from |
|
| 41 | + array( |
|
| 42 | + 'module'=>'', |
|
| 43 | + 'resource'=>'', |
|
| 44 | + 'type'=>'', |
|
| 45 | + ), $modx->getFullTableName('site_module_depobj'), // Insert into |
|
| 46 | + "'{$newid}', resource, type", $modx->getFullTableName('site_module_depobj'), "module='{$id}'"); // Copy from |
|
| 47 | 47 | |
| 48 | 48 | // duplicate module user group access |
| 49 | 49 | $modx->db->insert( |
| 50 | - array( |
|
| 51 | - 'module'=>'', |
|
| 52 | - 'usergroup'=>'', |
|
| 53 | - ), $modx->getFullTableName('site_module_access'), // Insert into |
|
| 54 | - "'{$newid}', usergroup", $modx->getFullTableName('site_module_access'), "module='{$id}'"); // Copy from |
|
| 50 | + array( |
|
| 51 | + 'module'=>'', |
|
| 52 | + 'usergroup'=>'', |
|
| 53 | + ), $modx->getFullTableName('site_module_access'), // Insert into |
|
| 54 | + "'{$newid}', usergroup", $modx->getFullTableName('site_module_access'), "module='{$id}'"); // Copy from |
|
| 55 | 55 | |
| 56 | 56 | // Set the item name for logger |
| 57 | 57 | $name = $modx->db->getValue($modx->db->select('name', $modx->getFullTableName('site_modules'), "id='{$newid}'")); |
@@ -1,19 +1,19 @@ 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 | -if(!$modx->hasPermission('new_module')) { |
|
| 5 | +if (!$modx->hasPermission('new_module')) { |
|
| 6 | 6 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
| 7 | 7 | } |
| 8 | 8 | |
| 9 | -$id = isset($_GET['id'])? (int)$_GET['id'] : 0; |
|
| 10 | -if($id==0) { |
|
| 9 | +$id = isset($_GET['id']) ? (int) $_GET['id'] : 0; |
|
| 10 | +if ($id == 0) { |
|
| 11 | 11 | $modx->webAlertAndQuit($_lang["error_no_id"]); |
| 12 | 12 | } |
| 13 | 13 | // count duplicates |
| 14 | 14 | $name = $modx->db->getValue($modx->db->select('name', $modx->getFullTableName('site_modules'), "id='{$id}'")); |
| 15 | 15 | $count = $modx->db->getRecordCount($modx->db->select('name', $modx->getFullTableName('site_modules'), "name LIKE '{$name} {$_lang['duplicated_el_suffix']}%'")); |
| 16 | -if($count>=1) $count = ' '.($count+1); |
|
| 16 | +if ($count >= 1) $count = ' '.($count + 1); |
|
| 17 | 17 | else $count = ''; |
| 18 | 18 | |
| 19 | 19 | // duplicate module |
@@ -58,5 +58,5 @@ discard block |
||
| 58 | 58 | $_SESSION['itemname'] = $name; |
| 59 | 59 | |
| 60 | 60 | // finish duplicating - redirect to new module |
| 61 | -$header="Location: index.php?r=2&a=108&id=$newid"; |
|
| 61 | +$header = "Location: index.php?r=2&a=108&id=$newid"; |
|
| 62 | 62 | header($header); |
@@ -12,12 +12,20 @@ discard block |
||
| 12 | 12 | // ok, two things to check. |
| 13 | 13 | // first, document cannot be moved to itself |
| 14 | 14 | // second, new parent must be a folder. If not, set it to folder. |
| 15 | -if($documentID==$newParentID) $modx->webAlertAndQuit($_lang["error_movedocument1"]); |
|
| 16 | -if($documentID <= 0) $modx->webAlertAndQuit($_lang["error_movedocument2"]); |
|
| 17 | -if($newParentID < 0) $modx->webAlertAndQuit($_lang["error_movedocument2"]); |
|
| 15 | +if($documentID==$newParentID) { |
|
| 16 | + $modx->webAlertAndQuit($_lang["error_movedocument1"]); |
|
| 17 | +} |
|
| 18 | +if($documentID <= 0) { |
|
| 19 | + $modx->webAlertAndQuit($_lang["error_movedocument2"]); |
|
| 20 | +} |
|
| 21 | +if($newParentID < 0) { |
|
| 22 | + $modx->webAlertAndQuit($_lang["error_movedocument2"]); |
|
| 23 | +} |
|
| 18 | 24 | |
| 19 | 25 | $parents = $modx->getParentIds($newParentID); |
| 20 | -if (in_array($documentID, $parents)) $modx->webAlertAndQuit($_lang["error_movedocument2"]); |
|
| 26 | +if (in_array($documentID, $parents)) { |
|
| 27 | + $modx->webAlertAndQuit($_lang["error_movedocument2"]); |
|
| 28 | +} |
|
| 21 | 29 | |
| 22 | 30 | $rs = $modx->db->select('parent', $modx->getFullTableName('site_content'), "id='{$documentID}'"); |
| 23 | 31 | $oldparent = $modx->db->getValue($rs); |
@@ -62,11 +70,11 @@ discard block |
||
| 62 | 70 | "old_parent" => $oldparent, |
| 63 | 71 | "new_parent" => $newParentID |
| 64 | 72 | )); |
| 65 | -if (is_array($evtOut) && count($evtOut) > 0){ |
|
| 73 | +if (is_array($evtOut) && count($evtOut) > 0) { |
|
| 66 | 74 | $newParent = array_pop($evtOut); |
| 67 | 75 | if($newParent == $oldparent) { |
| 68 | 76 | $modx->webAlertAndQuit($_lang["error_movedocument2"]); |
| 69 | - }else{ |
|
| 77 | + } else { |
|
| 70 | 78 | $newParentID = $newParent; |
| 71 | 79 | } |
| 72 | 80 | } |
@@ -3,7 +3,7 @@ discard block |
||
| 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('edit_document')) { |
| 6 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 6 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 7 | 7 | } |
| 8 | 8 | |
| 9 | 9 | $newParentID = isset($_REQUEST['new_parent']) ? (int)$_REQUEST['new_parent'] : 0; |
@@ -25,68 +25,68 @@ discard block |
||
| 25 | 25 | // check user has permission to move document to chosen location |
| 26 | 26 | |
| 27 | 27 | if ($use_udperms == 1) { |
| 28 | - if ($oldparent != $newParentID) { |
|
| 29 | - $udperms = new EvolutionCMS\Legacy\Permissions(); |
|
| 30 | - $udperms->user = $modx->getLoginUserID(); |
|
| 31 | - $udperms->document = $newParentID; |
|
| 32 | - $udperms->role = $_SESSION['mgrRole']; |
|
| 28 | + if ($oldparent != $newParentID) { |
|
| 29 | + $udperms = new EvolutionCMS\Legacy\Permissions(); |
|
| 30 | + $udperms->user = $modx->getLoginUserID(); |
|
| 31 | + $udperms->document = $newParentID; |
|
| 32 | + $udperms->role = $_SESSION['mgrRole']; |
|
| 33 | 33 | |
| 34 | - if (!$udperms->checkPermissions()) { |
|
| 35 | - $modx->webAlertAndQuit($_lang["access_permission_parent_denied"]); |
|
| 36 | - } |
|
| 37 | - } |
|
| 34 | + if (!$udperms->checkPermissions()) { |
|
| 35 | + $modx->webAlertAndQuit($_lang["access_permission_parent_denied"]); |
|
| 36 | + } |
|
| 37 | + } |
|
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | $evtOut = $modx->invokeEvent("onBeforeMoveDocument", array ( |
| 41 | - "id_document" => $documentID, |
|
| 42 | - "old_parent" => $oldparent, |
|
| 43 | - "new_parent" => $newParentID |
|
| 41 | + "id_document" => $documentID, |
|
| 42 | + "old_parent" => $oldparent, |
|
| 43 | + "new_parent" => $newParentID |
|
| 44 | 44 | )); |
| 45 | 45 | if (is_array($evtOut) && count($evtOut) > 0){ |
| 46 | - $newParent = array_pop($evtOut); |
|
| 47 | - if($newParent == $oldparent) { |
|
| 48 | - $modx->webAlertAndQuit($_lang["error_movedocument2"]); |
|
| 49 | - }else{ |
|
| 50 | - $newParentID = $newParent; |
|
| 51 | - } |
|
| 46 | + $newParent = array_pop($evtOut); |
|
| 47 | + if($newParent == $oldparent) { |
|
| 48 | + $modx->webAlertAndQuit($_lang["error_movedocument2"]); |
|
| 49 | + }else{ |
|
| 50 | + $newParentID = $newParent; |
|
| 51 | + } |
|
| 52 | 52 | } |
| 53 | 53 | |
| 54 | 54 | $children = allChildren($documentID); |
| 55 | 55 | if (!array_search($newParentID, $children)) { |
| 56 | - $modx->db->update(array( |
|
| 57 | - 'isfolder' => 1, |
|
| 58 | - ), $modx->getFullTableName('site_content'), "id='{$newParentID}'"); |
|
| 56 | + $modx->db->update(array( |
|
| 57 | + 'isfolder' => 1, |
|
| 58 | + ), $modx->getFullTableName('site_content'), "id='{$newParentID}'"); |
|
| 59 | 59 | |
| 60 | - $modx->db->update(array( |
|
| 61 | - 'parent' => $newParentID, |
|
| 62 | - 'editedby' => $modx->getLoginUserID(), |
|
| 63 | - 'editedon' => time(), |
|
| 64 | - ), $modx->getFullTableName('site_content'), "id='{$documentID}'"); |
|
| 60 | + $modx->db->update(array( |
|
| 61 | + 'parent' => $newParentID, |
|
| 62 | + 'editedby' => $modx->getLoginUserID(), |
|
| 63 | + 'editedon' => time(), |
|
| 64 | + ), $modx->getFullTableName('site_content'), "id='{$documentID}'"); |
|
| 65 | 65 | |
| 66 | - // finished moving the document, now check to see if the old_parent should no longer be a folder. |
|
| 67 | - $rs = $modx->db->select('COUNT(*)', $modx->getFullTableName('site_content'), "parent='{$oldparent}'"); |
|
| 68 | - $limit = $modx->db->getValue($rs); |
|
| 66 | + // finished moving the document, now check to see if the old_parent should no longer be a folder. |
|
| 67 | + $rs = $modx->db->select('COUNT(*)', $modx->getFullTableName('site_content'), "parent='{$oldparent}'"); |
|
| 68 | + $limit = $modx->db->getValue($rs); |
|
| 69 | 69 | |
| 70 | - if(!$limit>0) { |
|
| 71 | - $modx->db->update(array( |
|
| 72 | - 'isfolder' => 0, |
|
| 73 | - ), $modx->getFullTableName('site_content'), "id='{$oldparent}'"); |
|
| 74 | - } |
|
| 75 | - // Set the item name for logger |
|
| 76 | - $pagetitle = $modx->db->getValue($modx->db->select('pagetitle', $modx->getFullTableName('site_content'), "id='{$documentID}'")); |
|
| 77 | - $_SESSION['itemname'] = $pagetitle; |
|
| 70 | + if(!$limit>0) { |
|
| 71 | + $modx->db->update(array( |
|
| 72 | + 'isfolder' => 0, |
|
| 73 | + ), $modx->getFullTableName('site_content'), "id='{$oldparent}'"); |
|
| 74 | + } |
|
| 75 | + // Set the item name for logger |
|
| 76 | + $pagetitle = $modx->db->getValue($modx->db->select('pagetitle', $modx->getFullTableName('site_content'), "id='{$documentID}'")); |
|
| 77 | + $_SESSION['itemname'] = $pagetitle; |
|
| 78 | 78 | |
| 79 | - $modx->invokeEvent("onAfterMoveDocument", array ( |
|
| 80 | - "id_document" => $documentID, |
|
| 81 | - "old_parent" => $oldparent, |
|
| 82 | - "new_parent" => $newParentID |
|
| 83 | - )); |
|
| 79 | + $modx->invokeEvent("onAfterMoveDocument", array ( |
|
| 80 | + "id_document" => $documentID, |
|
| 81 | + "old_parent" => $oldparent, |
|
| 82 | + "new_parent" => $newParentID |
|
| 83 | + )); |
|
| 84 | 84 | |
| 85 | - // empty cache & sync site |
|
| 86 | - $modx->clearCache('full'); |
|
| 85 | + // empty cache & sync site |
|
| 86 | + $modx->clearCache('full'); |
|
| 87 | 87 | |
| 88 | - $header="Location: index.php?a=3&id={$documentID}&r=9"; |
|
| 89 | - header($header); |
|
| 88 | + $header="Location: index.php?a=3&id={$documentID}&r=9"; |
|
| 89 | + header($header); |
|
| 90 | 90 | } else { |
| 91 | - $modx->webAlertAndQuit("You cannot move a document to a child document!"); |
|
| 91 | + $modx->webAlertAndQuit("You cannot move a document to a child document!"); |
|
| 92 | 92 | } |
@@ -1,20 +1,20 @@ 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 | -if(!$modx->hasPermission('edit_document')) { |
|
| 5 | +if (!$modx->hasPermission('edit_document')) { |
|
| 6 | 6 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
| 7 | 7 | } |
| 8 | 8 | |
| 9 | -$newParentID = isset($_REQUEST['new_parent']) ? (int)$_REQUEST['new_parent'] : 0; |
|
| 10 | -$documentID = isset($_REQUEST['id']) ? (int)$_REQUEST['id'] : 0; |
|
| 9 | +$newParentID = isset($_REQUEST['new_parent']) ? (int) $_REQUEST['new_parent'] : 0; |
|
| 10 | +$documentID = isset($_REQUEST['id']) ? (int) $_REQUEST['id'] : 0; |
|
| 11 | 11 | |
| 12 | 12 | // ok, two things to check. |
| 13 | 13 | // first, document cannot be moved to itself |
| 14 | 14 | // second, new parent must be a folder. If not, set it to folder. |
| 15 | -if($documentID==$newParentID) $modx->webAlertAndQuit($_lang["error_movedocument1"]); |
|
| 16 | -if($documentID <= 0) $modx->webAlertAndQuit($_lang["error_movedocument2"]); |
|
| 17 | -if($newParentID < 0) $modx->webAlertAndQuit($_lang["error_movedocument2"]); |
|
| 15 | +if ($documentID == $newParentID) $modx->webAlertAndQuit($_lang["error_movedocument1"]); |
|
| 16 | +if ($documentID <= 0) $modx->webAlertAndQuit($_lang["error_movedocument2"]); |
|
| 17 | +if ($newParentID < 0) $modx->webAlertAndQuit($_lang["error_movedocument2"]); |
|
| 18 | 18 | |
| 19 | 19 | $parents = $modx->getParentIds($newParentID); |
| 20 | 20 | if (in_array($documentID, $parents)) $modx->webAlertAndQuit($_lang["error_movedocument2"]); |
@@ -37,16 +37,16 @@ discard block |
||
| 37 | 37 | } |
| 38 | 38 | } |
| 39 | 39 | |
| 40 | -$evtOut = $modx->invokeEvent("onBeforeMoveDocument", array ( |
|
| 40 | +$evtOut = $modx->invokeEvent("onBeforeMoveDocument", array( |
|
| 41 | 41 | "id_document" => $documentID, |
| 42 | 42 | "old_parent" => $oldparent, |
| 43 | 43 | "new_parent" => $newParentID |
| 44 | 44 | )); |
| 45 | -if (is_array($evtOut) && count($evtOut) > 0){ |
|
| 45 | +if (is_array($evtOut) && count($evtOut) > 0) { |
|
| 46 | 46 | $newParent = array_pop($evtOut); |
| 47 | - if($newParent == $oldparent) { |
|
| 47 | + if ($newParent == $oldparent) { |
|
| 48 | 48 | $modx->webAlertAndQuit($_lang["error_movedocument2"]); |
| 49 | - }else{ |
|
| 49 | + } else { |
|
| 50 | 50 | $newParentID = $newParent; |
| 51 | 51 | } |
| 52 | 52 | } |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | $rs = $modx->db->select('COUNT(*)', $modx->getFullTableName('site_content'), "parent='{$oldparent}'"); |
| 68 | 68 | $limit = $modx->db->getValue($rs); |
| 69 | 69 | |
| 70 | - if(!$limit>0) { |
|
| 70 | + if (!$limit > 0) { |
|
| 71 | 71 | $modx->db->update(array( |
| 72 | 72 | 'isfolder' => 0, |
| 73 | 73 | ), $modx->getFullTableName('site_content'), "id='{$oldparent}'"); |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | $pagetitle = $modx->db->getValue($modx->db->select('pagetitle', $modx->getFullTableName('site_content'), "id='{$documentID}'")); |
| 77 | 77 | $_SESSION['itemname'] = $pagetitle; |
| 78 | 78 | |
| 79 | - $modx->invokeEvent("onAfterMoveDocument", array ( |
|
| 79 | + $modx->invokeEvent("onAfterMoveDocument", array( |
|
| 80 | 80 | "id_document" => $documentID, |
| 81 | 81 | "old_parent" => $oldparent, |
| 82 | 82 | "new_parent" => $newParentID |
@@ -85,7 +85,7 @@ discard block |
||
| 85 | 85 | // empty cache & sync site |
| 86 | 86 | $modx->clearCache('full'); |
| 87 | 87 | |
| 88 | - $header="Location: index.php?a=3&id={$documentID}&r=9"; |
|
| 88 | + $header = "Location: index.php?a=3&id={$documentID}&r=9"; |
|
| 89 | 89 | header($header); |
| 90 | 90 | } else { |
| 91 | 91 | $modx->webAlertAndQuit("You cannot move a document to a child document!"); |