@@ -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; |
@@ -74,10 +74,10 @@ discard block |
||
| 74 | 74 | * @param array $params |
| 75 | 75 | * @return string |
| 76 | 76 | */ |
| 77 | -function evalModule($moduleCode,$params){ |
|
| 77 | +function evalModule($moduleCode, $params){ |
|
| 78 | 78 | global $modx; |
| 79 | 79 | $modx->event->params = &$params; // store params inside event object |
| 80 | - if(is_array($params)) { |
|
| 80 | + if (is_array($params)) { |
|
| 81 | 81 | extract($params, EXTR_SKIP); |
| 82 | 82 | } |
| 83 | 83 | ob_start(); |
@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | if (isset($php_errormsg)) |
| 88 | 88 | { |
| 89 | 89 | $error_info = error_get_last(); |
| 90 | - switch($error_info['type']) |
|
| 90 | + switch ($error_info['type']) |
|
| 91 | 91 | { |
| 92 | 92 | case E_NOTICE : |
| 93 | 93 | $error_level = 1; |
@@ -101,9 +101,9 @@ discard block |
||
| 101 | 101 | default: |
| 102 | 102 | $error_level = 99; |
| 103 | 103 | } |
| 104 | - if($modx->config['error_reporting']==='99' || 2<$error_level) |
|
| 104 | + if ($modx->config['error_reporting'] === '99' || 2 < $error_level) |
|
| 105 | 105 | { |
| 106 | - $modx->messageQuit('PHP Parse Error', '', true, $error_info['type'], $error_info['file'], $_SESSION['itemname'] . ' - Module', $error_info['message'], $error_info['line'], $msg); |
|
| 106 | + $modx->messageQuit('PHP Parse Error', '', true, $error_info['type'], $error_info['file'], $_SESSION['itemname'].' - Module', $error_info['message'], $error_info['line'], $msg); |
|
| 107 | 107 | $modx->event->alert("An error occurred while loading. Please see the event log for more information<p>{$msg}</p>"); |
| 108 | 108 | } |
| 109 | 109 | } |