@@ -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; |
@@ -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!"); |
@@ -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_document') || !$modx->hasPermission('save_document')) { |
| 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 | $children = array(); |
@@ -21,7 +21,7 @@ discard block |
||
| 21 | 21 | $udperms->duplicateDoc = true; |
| 22 | 22 | |
| 23 | 23 | if(!$udperms->checkPermissions()) { |
| 24 | - $modx->webAlertAndQuit($_lang["access_permission_denied"]); |
|
| 24 | + $modx->webAlertAndQuit($_lang["access_permission_denied"]); |
|
| 25 | 25 | } |
| 26 | 26 | |
| 27 | 27 | // Run the duplicator |
@@ -1,13 +1,13 @@ 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_document') || !$modx->hasPermission('save_document')) { |
|
| 5 | +if (!$modx->hasPermission('new_document') || !$modx->hasPermission('save_document')) { |
|
| 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 | |
@@ -20,7 +20,7 @@ discard block |
||
| 20 | 20 | $udperms->role = $_SESSION['mgrRole']; |
| 21 | 21 | $udperms->duplicateDoc = true; |
| 22 | 22 | |
| 23 | -if(!$udperms->checkPermissions()) { |
|
| 23 | +if (!$udperms->checkPermissions()) { |
|
| 24 | 24 | $modx->webAlertAndQuit($_lang["access_permission_denied"]); |
| 25 | 25 | } |
| 26 | 26 | |
@@ -32,5 +32,5 @@ discard block |
||
| 32 | 32 | $_SESSION['itemname'] = $name; |
| 33 | 33 | |
| 34 | 34 | // finish cloning - redirect |
| 35 | -$header="Location: index.php?r=1&a=3&id=$id"; |
|
| 35 | +$header = "Location: index.php?r=1&a=3&id=$id"; |
|
| 36 | 36 | header($header); |
@@ -7,7 +7,7 @@ |
||
| 7 | 7 | $modx->getSettings(); |
| 8 | 8 | |
| 9 | 9 | $modx->documentMethod = 'id'; |
| 10 | -$modx->documentIdentifier = isset($_REQUEST['id']) ? (int)$_REQUEST['id'] : 1; |
|
| 10 | +$modx->documentIdentifier = isset($_REQUEST['id']) ? (int) $_REQUEST['id'] : 1; |
|
| 11 | 11 | $modx->documentObject = $modx->getDocumentObject('id', $modx->documentIdentifier); |
| 12 | 12 | |
| 13 | 13 | $modx->invokeEvent('OnWebPageInit'); |
@@ -10,7 +10,7 @@ |
||
| 10 | 10 | * @param int $flags |
| 11 | 11 | * @param string $encode |
| 12 | 12 | * @param int $safecount |
| 13 | - * @return string|array |
|
| 13 | + * @return null|string |
|
| 14 | 14 | */ |
| 15 | 15 | public function htmlspecialchars($str = '', $flags = ENT_COMPAT, $encode = '', $safecount = 0) |
| 16 | 16 | { |
@@ -357,7 +357,7 @@ |
||
| 357 | 357 | if(!function_exists('getFileContent')) { |
| 358 | 358 | /** |
| 359 | 359 | * @param string $filepath |
| 360 | - * @return bool|string |
|
| 360 | + * @return null|string |
|
| 361 | 361 | */ |
| 362 | 362 | function getFileContent($filepath) |
| 363 | 363 | { |
@@ -114,9 +114,9 @@ |
||
| 114 | 114 | $field['menuindex'] = 1; |
| 115 | 115 | $find = false; |
| 116 | 116 | foreach (array( |
| 117 | - 'index.html', |
|
| 118 | - 'index.htm' |
|
| 119 | - ) as $filename) { |
|
| 117 | + 'index.html', |
|
| 118 | + 'index.htm' |
|
| 119 | + ) as $filename) { |
|
| 120 | 120 | $filepath = $filedir . $alias . '/' . $filename; |
| 121 | 121 | if ($find === false && file_exists($filepath)) { |
| 122 | 122 | $file = getFileContent($filepath); |
@@ -1,5 +1,5 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -if(!function_exists('run')) { |
|
| 2 | +if (!function_exists('run')) { |
|
| 3 | 3 | /** |
| 4 | 4 | * @return string |
| 5 | 5 | */ |
@@ -28,12 +28,12 @@ discard block |
||
| 28 | 28 | $modx->db->query("ALTER TABLE {$tbl_site_content} AUTO_INCREMENT = 1"); |
| 29 | 29 | } |
| 30 | 30 | |
| 31 | - $parent = (int)$_POST['parent']; |
|
| 31 | + $parent = (int) $_POST['parent']; |
|
| 32 | 32 | |
| 33 | - if (is_dir(MODX_BASE_PATH . 'temp/import')) { |
|
| 34 | - $filedir = MODX_BASE_PATH . 'temp/import/'; |
|
| 35 | - } elseif (is_dir(MODX_BASE_PATH . 'assets/import')) { |
|
| 36 | - $filedir = MODX_BASE_PATH . 'assets/import/'; |
|
| 33 | + if (is_dir(MODX_BASE_PATH.'temp/import')) { |
|
| 34 | + $filedir = MODX_BASE_PATH.'temp/import/'; |
|
| 35 | + } elseif (is_dir(MODX_BASE_PATH.'assets/import')) { |
|
| 36 | + $filedir = MODX_BASE_PATH.'assets/import/'; |
|
| 37 | 37 | } else { |
| 38 | 38 | $filedir = ''; |
| 39 | 39 | } |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | $files = pop_index($files); |
| 45 | 45 | |
| 46 | 46 | // no. of files to import |
| 47 | - $output .= sprintf('<p>' . $_lang['import_files_found'] . '</p>', $filesfound); |
|
| 47 | + $output .= sprintf('<p>'.$_lang['import_files_found'].'</p>', $filesfound); |
|
| 48 | 48 | |
| 49 | 49 | // import files |
| 50 | 50 | if (0 < count($files)) { |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | $mtime = $mtime[1] + $mtime[0]; |
| 58 | 58 | $importend = $mtime; |
| 59 | 59 | $totaltime = ($importend - $importstart); |
| 60 | - $output .= sprintf('<p>' . $_lang['import_site_time'] . '</p>', round($totaltime, 3)); |
|
| 60 | + $output .= sprintf('<p>'.$_lang['import_site_time'].'</p>', round($totaltime, 3)); |
|
| 61 | 61 | |
| 62 | 62 | if ($_POST['convert_link'] == 'on') { |
| 63 | 63 | convertLink(); |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | } |
| 68 | 68 | } |
| 69 | 69 | |
| 70 | -if(!function_exists('importFiles')) { |
|
| 70 | +if (!function_exists('importFiles')) { |
|
| 71 | 71 | /** |
| 72 | 72 | * @param int $parent |
| 73 | 73 | * @param string $filedir |
@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | if (is_array($value)) { |
| 99 | 99 | // create folder |
| 100 | 100 | $alias = $id; |
| 101 | - printf('<span>' . $_lang['import_site_importing_document'] . '</span>', $alias); |
|
| 101 | + printf('<span>'.$_lang['import_site_importing_document'].'</span>', $alias); |
|
| 102 | 102 | $field = array(); |
| 103 | 103 | $field['type'] = 'document'; |
| 104 | 104 | $field['contentType'] = 'text/html'; |
@@ -117,7 +117,7 @@ discard block |
||
| 117 | 117 | 'index.html', |
| 118 | 118 | 'index.htm' |
| 119 | 119 | ) as $filename) { |
| 120 | - $filepath = $filedir . $alias . '/' . $filename; |
|
| 120 | + $filepath = $filedir.$alias.'/'.$filename; |
|
| 121 | 121 | if ($find === false && file_exists($filepath)) { |
| 122 | 122 | $file = getFileContent($filepath); |
| 123 | 123 | list($pagetitle, $content, $description) = treatContent($file, $filename, $alias); |
@@ -132,10 +132,10 @@ discard block |
||
| 132 | 132 | $newid = $modx->db->insert($field, $tbl_site_content); |
| 133 | 133 | if ($newid) { |
| 134 | 134 | $find = true; |
| 135 | - echo ' - <span class="success">' . $_lang['import_site_success'] . '</span><br />' . "\n"; |
|
| 136 | - importFiles($newid, $filedir . $alias . '/', $value, 'sub'); |
|
| 135 | + echo ' - <span class="success">'.$_lang['import_site_success'].'</span><br />'."\n"; |
|
| 136 | + importFiles($newid, $filedir.$alias.'/', $value, 'sub'); |
|
| 137 | 137 | } else { |
| 138 | - echo '<span class="fail">' . $_lang["import_site_failed"] . "</span> " . $_lang["import_site_failed_db_error"] . $modx->db->getLastError(); |
|
| 138 | + echo '<span class="fail">'.$_lang["import_site_failed"]."</span> ".$_lang["import_site_failed_db_error"].$modx->db->getLastError(); |
|
| 139 | 139 | exit; |
| 140 | 140 | } |
| 141 | 141 | } |
@@ -150,10 +150,10 @@ discard block |
||
| 150 | 150 | $newid = $modx->db->insert($field, $tbl_site_content); |
| 151 | 151 | if ($newid) { |
| 152 | 152 | $find = true; |
| 153 | - echo ' - <span class="success">' . $_lang['import_site_success'] . '</span><br />' . "\n"; |
|
| 154 | - importFiles($newid, $filedir . $alias . '/', $value, 'sub'); |
|
| 153 | + echo ' - <span class="success">'.$_lang['import_site_success'].'</span><br />'."\n"; |
|
| 154 | + importFiles($newid, $filedir.$alias.'/', $value, 'sub'); |
|
| 155 | 155 | } else { |
| 156 | - echo '<span class="fail">' . $_lang["import_site_failed"] . "</span> " . $_lang["import_site_failed_db_error"] . $modx->db->getLastError(); |
|
| 156 | + echo '<span class="fail">'.$_lang["import_site_failed"]."</span> ".$_lang["import_site_failed_db_error"].$modx->db->getLastError(); |
|
| 157 | 157 | exit; |
| 158 | 158 | } |
| 159 | 159 | } |
@@ -166,12 +166,12 @@ discard block |
||
| 166 | 166 | $fparts = explode('.', $value); |
| 167 | 167 | $alias = $fparts[0]; |
| 168 | 168 | $ext = (count($fparts) > 1) ? $fparts[count($fparts) - 1] : ""; |
| 169 | - printf("<span>" . $_lang['import_site_importing_document'] . "</span>", $filename); |
|
| 169 | + printf("<span>".$_lang['import_site_importing_document']."</span>", $filename); |
|
| 170 | 170 | |
| 171 | 171 | if (!in_array($ext, $allowedfiles)) { |
| 172 | - echo ' - <span class="fail">' . $_lang["import_site_skip"] . '</span><br />' . "\n"; |
|
| 172 | + echo ' - <span class="fail">'.$_lang["import_site_skip"].'</span><br />'."\n"; |
|
| 173 | 173 | } else { |
| 174 | - $filepath = $filedir . $filename; |
|
| 174 | + $filepath = $filedir.$filename; |
|
| 175 | 175 | $file = getFileContent($filepath); |
| 176 | 176 | list($pagetitle, $content, $description) = treatContent($file, $filename, $alias); |
| 177 | 177 | |
@@ -197,9 +197,9 @@ discard block |
||
| 197 | 197 | $field['menuindex'] = ($alias == 'index') ? 0 : 2; |
| 198 | 198 | $newid = $modx->db->insert($field, $tbl_site_content); |
| 199 | 199 | if ($newid) { |
| 200 | - echo ' - <span class="success">' . $_lang['import_site_success'] . '</span><br />' . "\n"; |
|
| 200 | + echo ' - <span class="success">'.$_lang['import_site_success'].'</span><br />'."\n"; |
|
| 201 | 201 | } else { |
| 202 | - echo '<span class="fail">' . $_lang["import_site_failed"] . "</span> " . $_lang["import_site_failed_db_error"] . $modx->db->getLastError(); |
|
| 202 | + echo '<span class="fail">'.$_lang["import_site_failed"]."</span> ".$_lang["import_site_failed_db_error"].$modx->db->getLastError(); |
|
| 203 | 203 | exit; |
| 204 | 204 | } |
| 205 | 205 | |
@@ -218,7 +218,7 @@ discard block |
||
| 218 | 218 | } |
| 219 | 219 | } |
| 220 | 220 | |
| 221 | -if(!function_exists('getFiles')) { |
|
| 221 | +if (!function_exists('getFiles')) { |
|
| 222 | 222 | /** |
| 223 | 223 | * @param string $directory |
| 224 | 224 | * @param array $listing |
@@ -234,10 +234,10 @@ discard block |
||
| 234 | 234 | foreach ($files as $file) { |
| 235 | 235 | if ($file == '.' || $file == '..') { |
| 236 | 236 | continue; |
| 237 | - } elseif ($h = @opendir($directory . $file . "/")) { |
|
| 237 | + } elseif ($h = @opendir($directory.$file."/")) { |
|
| 238 | 238 | closedir($h); |
| 239 | 239 | $count = -1; |
| 240 | - $listing[$file] = getFiles($directory . $file . "/", array(), $count + 1); |
|
| 240 | + $listing[$file] = getFiles($directory.$file."/", array(), $count + 1); |
|
| 241 | 241 | } elseif (strpos($file, '.htm') !== false) { |
| 242 | 242 | $listing[$dummy] = $file; |
| 243 | 243 | $dummy = $dummy + 1; |
@@ -245,14 +245,14 @@ discard block |
||
| 245 | 245 | } |
| 246 | 246 | } |
| 247 | 247 | } else { |
| 248 | - echo '<p><span class="fail">' . $_lang["import_site_failed"] . "</span> " . $_lang["import_site_failed_no_open_dir"] . $directory . ".</p>"; |
|
| 248 | + echo '<p><span class="fail">'.$_lang["import_site_failed"]."</span> ".$_lang["import_site_failed_no_open_dir"].$directory.".</p>"; |
|
| 249 | 249 | } |
| 250 | 250 | |
| 251 | 251 | return ($listing); |
| 252 | 252 | } |
| 253 | 253 | } |
| 254 | 254 | |
| 255 | -if(!function_exists('getFileContent')) { |
|
| 255 | +if (!function_exists('getFileContent')) { |
|
| 256 | 256 | /** |
| 257 | 257 | * @param string $filepath |
| 258 | 258 | * @return bool|string |
@@ -262,14 +262,14 @@ discard block |
||
| 262 | 262 | global $_lang; |
| 263 | 263 | // get the file |
| 264 | 264 | if (!$buffer = file_get_contents($filepath)) { |
| 265 | - echo '<p><span class="fail">' . $_lang['import_site_failed'] . "</span> " . $_lang["import_site_failed_no_retrieve_file"] . $filepath . ".</p>"; |
|
| 265 | + echo '<p><span class="fail">'.$_lang['import_site_failed']."</span> ".$_lang["import_site_failed_no_retrieve_file"].$filepath.".</p>"; |
|
| 266 | 266 | } else { |
| 267 | 267 | return $buffer; |
| 268 | 268 | } |
| 269 | 269 | } |
| 270 | 270 | } |
| 271 | 271 | |
| 272 | -if(!function_exists('pop_index')) { |
|
| 272 | +if (!function_exists('pop_index')) { |
|
| 273 | 273 | /** |
| 274 | 274 | * @param array $array |
| 275 | 275 | * @return array |
@@ -294,7 +294,7 @@ discard block |
||
| 294 | 294 | } |
| 295 | 295 | } |
| 296 | 296 | |
| 297 | -if(!function_exists('treatContent')) { |
|
| 297 | +if (!function_exists('treatContent')) { |
|
| 298 | 298 | /** |
| 299 | 299 | * @param string $src |
| 300 | 300 | * @param string $filename |
@@ -329,7 +329,7 @@ discard block |
||
| 329 | 329 | } else { |
| 330 | 330 | $content = $src; |
| 331 | 331 | $s = '/(<meta[^>]+charset\s*=)[^>"\'=]+(.+>)/i'; |
| 332 | - $r = '$1' . $modx->config['modx_charset'] . '$2'; |
|
| 332 | + $r = '$1'.$modx->config['modx_charset'].'$2'; |
|
| 333 | 333 | $content = preg_replace($s, $r, $content); |
| 334 | 334 | $content = preg_replace('@<title>.*</title>@i', "<title>[*pagetitle*]</title>", $content); |
| 335 | 335 | } |
@@ -345,7 +345,7 @@ discard block |
||
| 345 | 345 | } |
| 346 | 346 | } |
| 347 | 347 | |
| 348 | -if(!function_exists('convertLink')) { |
|
| 348 | +if (!function_exists('convertLink')) { |
|
| 349 | 349 | /** |
| 350 | 350 | * @return void |
| 351 | 351 | */ |
@@ -368,7 +368,7 @@ discard block |
||
| 368 | 368 | list($href, $v) = explode('"', $v, 2); |
| 369 | 369 | $_ = $href; |
| 370 | 370 | if (strpos($_, $modx->config['site_url']) !== false) { |
| 371 | - $_ = $modx->config['base_url'] . str_replace($modx->config['site_url'], '', $_); |
|
| 371 | + $_ = $modx->config['base_url'].str_replace($modx->config['site_url'], '', $_); |
|
| 372 | 372 | } |
| 373 | 373 | if ($_[0] === '/') { |
| 374 | 374 | $_ = substr($_, 1); |
@@ -395,15 +395,15 @@ discard block |
||
| 395 | 395 | if (strpos($_, '/') !== false) { |
| 396 | 396 | $_ = substr($_, strrpos($_, '/')); |
| 397 | 397 | } |
| 398 | - $_ = $dir . str_replace('.html', '', $_); |
|
| 398 | + $_ = $dir.str_replace('.html', '', $_); |
|
| 399 | 399 | if (!isset($target[$_])) { |
| 400 | 400 | $target[$_] = $modx->getIdFromAlias($_); |
| 401 | 401 | } |
| 402 | 402 | $target[$_] = trim($target[$_]); |
| 403 | 403 | if (!empty($target[$_])) { |
| 404 | - $href = '[~' . $target[$_] . '~]'; |
|
| 404 | + $href = '[~'.$target[$_].'~]'; |
|
| 405 | 405 | } |
| 406 | - $array[$c] = '<a href="' . $href . '"' . $v; |
|
| 406 | + $array[$c] = '<a href="'.$href.'"'.$v; |
|
| 407 | 407 | } |
| 408 | 408 | $c++; |
| 409 | 409 | } |
@@ -1,12 +1,12 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
| 2 | +if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
| 3 | 3 | die('<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly.'); |
| 4 | 4 | } |
| 5 | 5 | if (!$modx->hasPermission('save_plugin')) { |
| 6 | 6 | $modx->webAlertAndQuit($_lang['error_no_privileges']); |
| 7 | 7 | } |
| 8 | 8 | |
| 9 | -$id = (int)$_POST['id']; |
|
| 9 | +$id = (int) $_POST['id']; |
|
| 10 | 10 | $name = $modx->db->escape(trim($_POST['name'])); |
| 11 | 11 | $description = $modx->db->escape($_POST['description']); |
| 12 | 12 | $locked = $_POST['locked'] == 'on' ? '1' : '0'; |
@@ -20,11 +20,11 @@ discard block |
||
| 20 | 20 | |
| 21 | 21 | //Kyle Jaebker - added category support |
| 22 | 22 | if (empty($_POST['newcategory']) && $_POST['categoryid'] > 0) { |
| 23 | - $categoryid = (int)$_POST['categoryid']; |
|
| 23 | + $categoryid = (int) $_POST['categoryid']; |
|
| 24 | 24 | } elseif (empty($_POST['newcategory']) && $_POST['categoryid'] <= 0) { |
| 25 | 25 | $categoryid = 0; |
| 26 | 26 | } else { |
| 27 | - include_once(MODX_MANAGER_PATH . 'includes/categories.inc.php'); |
|
| 27 | + include_once(MODX_MANAGER_PATH.'includes/categories.inc.php'); |
|
| 28 | 28 | $categoryid = getCategory($_POST['newcategory']); |
| 29 | 29 | } |
| 30 | 30 | |
@@ -40,12 +40,12 @@ discard block |
||
| 40 | 40 | $moduleguid = isset($parsed['guid']) ? $parsed['guid'] : $moduleguid; |
| 41 | 41 | |
| 42 | 42 | $description = isset($parsed['description']) ? $parsed['description'] : $description; |
| 43 | - $version = isset($parsed['version']) ? '<b>' . $parsed['version'] . '</b> ' : ''; |
|
| 43 | + $version = isset($parsed['version']) ? '<b>'.$parsed['version'].'</b> ' : ''; |
|
| 44 | 44 | if ($version) { |
| 45 | - $description = $version . trim(preg_replace('/(<b>.+?)+(<\/b>)/i', '', $description)); |
|
| 45 | + $description = $version.trim(preg_replace('/(<b>.+?)+(<\/b>)/i', '', $description)); |
|
| 46 | 46 | } |
| 47 | 47 | if (isset($parsed['modx_category'])) { |
| 48 | - include_once(MODX_MANAGER_PATH . 'includes/categories.inc.php'); |
|
| 48 | + include_once(MODX_MANAGER_PATH.'includes/categories.inc.php'); |
|
| 49 | 49 | $categoryid = getCategory($parsed['modx_category']); |
| 50 | 50 | } |
| 51 | 51 | } |
@@ -103,7 +103,7 @@ discard block |
||
| 103 | 103 | // finished emptying cache - redirect |
| 104 | 104 | if ($_POST['stay'] != '') { |
| 105 | 105 | $a = ($_POST['stay'] == '2') ? "102&id=$newid" : '101'; |
| 106 | - $header = 'Location: index.php?a=' . $a . '&r=2&stay=' . $_POST['stay']; |
|
| 106 | + $header = 'Location: index.php?a='.$a.'&r=2&stay='.$_POST['stay']; |
|
| 107 | 107 | header($header); |
| 108 | 108 | } else { |
| 109 | 109 | $header = 'Location: index.php?a=76&r=2'; |
@@ -158,7 +158,7 @@ discard block |
||
| 158 | 158 | // finished emptying cache - redirect |
| 159 | 159 | if ($_POST['stay'] != '') { |
| 160 | 160 | $a = ($_POST['stay'] == '2') ? "102&id=$id" : '101'; |
| 161 | - $header = 'Location: index.php?a=' . $a . '&r=2&stay=' . $_POST['stay']; |
|
| 161 | + $header = 'Location: index.php?a='.$a.'&r=2&stay='.$_POST['stay']; |
|
| 162 | 162 | header($header); |
| 163 | 163 | } else { |
| 164 | 164 | $modx->unlockElement(5, $id); |
@@ -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('delete_document')) { |
| 6 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 6 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
| 7 | 7 | } |
| 8 | 8 | |
| 9 | 9 | $id = isset($_REQUEST['id'])? (int)$_REQUEST['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 | /************ webber ********/ |
@@ -31,14 +31,14 @@ discard block |
||
| 31 | 31 | $udperms->role = $_SESSION['mgrRole']; |
| 32 | 32 | |
| 33 | 33 | if(!$udperms->checkPermissions()) { |
| 34 | - $modx->webAlertAndQuit($_lang["access_permission_denied"]); |
|
| 34 | + $modx->webAlertAndQuit($_lang["access_permission_denied"]); |
|
| 35 | 35 | } |
| 36 | 36 | |
| 37 | 37 | // get the timestamp on which the document was deleted. |
| 38 | 38 | $rs = $modx->db->select('deletedon', $modx->getFullTableName('site_content'), "id='{$id}' AND deleted=1"); |
| 39 | 39 | $deltime = $modx->db->getValue($rs); |
| 40 | 40 | if(!$deltime) { |
| 41 | - $modx->webAlertAndQuit("Couldn't find document to determine it's date of deletion!"); |
|
| 41 | + $modx->webAlertAndQuit("Couldn't find document to determine it's date of deletion!"); |
|
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | $children = array(); |
@@ -46,20 +46,20 @@ discard block |
||
| 46 | 46 | getChildrenForUnDelete($id); |
| 47 | 47 | |
| 48 | 48 | if(count($children)>0) { |
| 49 | - $modx->db->update( |
|
| 50 | - array( |
|
| 51 | - 'deleted' => 0, |
|
| 52 | - 'deletedby' => 0, |
|
| 53 | - 'deletedon' => 0, |
|
| 54 | - ), $modx->getFullTableName('site_content'), "id IN(".implode(", ", $children).")"); |
|
| 49 | + $modx->db->update( |
|
| 50 | + array( |
|
| 51 | + 'deleted' => 0, |
|
| 52 | + 'deletedby' => 0, |
|
| 53 | + 'deletedon' => 0, |
|
| 54 | + ), $modx->getFullTableName('site_content'), "id IN(".implode(", ", $children).")"); |
|
| 55 | 55 | } |
| 56 | 56 | //'undelete' the document. |
| 57 | 57 | $modx->db->update( |
| 58 | - array( |
|
| 59 | - 'deleted' => 0, |
|
| 60 | - 'deletedby' => 0, |
|
| 61 | - 'deletedon' => 0, |
|
| 62 | - ), $modx->getFullTableName('site_content'), "id='{$id}'"); |
|
| 58 | + array( |
|
| 59 | + 'deleted' => 0, |
|
| 60 | + 'deletedby' => 0, |
|
| 61 | + 'deletedon' => 0, |
|
| 62 | + ), $modx->getFullTableName('site_content'), "id='{$id}'"); |
|
| 63 | 63 | |
| 64 | 64 | $modx->invokeEvent("OnDocFormUnDelete", |
| 65 | 65 | array( |
@@ -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('delete_document')) { |
|
| 5 | +if (!$modx->hasPermission('delete_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 | |
@@ -30,14 +30,14 @@ discard block |
||
| 30 | 30 | $udperms->document = $id; |
| 31 | 31 | $udperms->role = $_SESSION['mgrRole']; |
| 32 | 32 | |
| 33 | -if(!$udperms->checkPermissions()) { |
|
| 33 | +if (!$udperms->checkPermissions()) { |
|
| 34 | 34 | $modx->webAlertAndQuit($_lang["access_permission_denied"]); |
| 35 | 35 | } |
| 36 | 36 | |
| 37 | 37 | // get the timestamp on which the document was deleted. |
| 38 | 38 | $rs = $modx->db->select('deletedon', $modx->getFullTableName('site_content'), "id='{$id}' AND deleted=1"); |
| 39 | 39 | $deltime = $modx->db->getValue($rs); |
| 40 | -if(!$deltime) { |
|
| 40 | +if (!$deltime) { |
|
| 41 | 41 | $modx->webAlertAndQuit("Couldn't find document to determine it's date of deletion!"); |
| 42 | 42 | } |
| 43 | 43 | |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | |
| 46 | 46 | getChildrenForUnDelete($id); |
| 47 | 47 | |
| 48 | -if(count($children)>0) { |
|
| 48 | +if (count($children) > 0) { |
|
| 49 | 49 | $modx->db->update( |
| 50 | 50 | array( |
| 51 | 51 | 'deleted' => 0, |
@@ -74,5 +74,5 @@ discard block |
||
| 74 | 74 | $modx->clearCache('full'); |
| 75 | 75 | |
| 76 | 76 | // finished emptying cache - redirect |
| 77 | -$header="Location: index.php?a=3&id=$pid&r=1".$add_path; |
|
| 77 | +$header = "Location: index.php?a=3&id=$pid&r=1".$add_path; |
|
| 78 | 78 | header($header); |