@@ -12,7 +12,7 @@ discard block |
||
| 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 |
@@ -70,7 +70,8 @@ discard block |
||
| 70 | 70 | * @param array $params |
| 71 | 71 | * @return string |
| 72 | 72 | */ |
| 73 | -function evalModule($moduleCode,$params){ |
|
| 73 | +function evalModule($moduleCode,$params) |
|
| 74 | +{ |
|
| 74 | 75 | global $modx; |
| 75 | 76 | $modx->event->params = &$params; // store params inside event object |
| 76 | 77 | if(is_array($params)) { |
@@ -80,11 +81,9 @@ discard block |
||
| 80 | 81 | $mod = eval($moduleCode); |
| 81 | 82 | $msg = ob_get_contents(); |
| 82 | 83 | ob_end_clean(); |
| 83 | - if (isset($php_errormsg)) |
|
| 84 | - { |
|
| 84 | + if (isset($php_errormsg)) { |
|
| 85 | 85 | $error_info = error_get_last(); |
| 86 | - switch($error_info['type']) |
|
| 87 | - { |
|
| 86 | + switch($error_info['type']) { |
|
| 88 | 87 | case E_NOTICE : |
| 89 | 88 | $error_level = 1; |
| 90 | 89 | case E_USER_NOTICE : |
@@ -97,8 +96,7 @@ discard block |
||
| 97 | 96 | default: |
| 98 | 97 | $error_level = 99; |
| 99 | 98 | } |
| 100 | - if($modx->config['error_reporting']==='99' || 2<$error_level) |
|
| 101 | - { |
|
| 99 | + if($modx->config['error_reporting']==='99' || 2<$error_level) { |
|
| 102 | 100 | $modx->messageQuit('PHP Parse Error', '', true, $error_info['type'], $error_info['file'], $_SESSION['itemname'] . ' - Module', $error_info['message'], $error_info['line'], $msg); |
| 103 | 101 | $modx->event->alert("An error occurred while loading. Please see the event log for more information<p>{$msg}</p>"); |
| 104 | 102 | } |
@@ -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) { |
| 65 | - echo "<style>body,html {overflow:auto!important;height:100%!important}</style>"; // for iframe scroller |
|
| 65 | + echo "<style>body,html {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"; |
@@ -75,38 +75,38 @@ discard block |
||
| 75 | 75 | * @return string |
| 76 | 76 | */ |
| 77 | 77 | function evalModule($moduleCode,$params){ |
| 78 | - global $modx; |
|
| 79 | - $modx->event->params = &$params; // store params inside event object |
|
| 80 | - if(is_array($params)) { |
|
| 81 | - extract($params, EXTR_SKIP); |
|
| 82 | - } |
|
| 83 | - ob_start(); |
|
| 84 | - $mod = eval($moduleCode); |
|
| 85 | - $msg = ob_get_contents(); |
|
| 86 | - ob_end_clean(); |
|
| 87 | - if (isset($php_errormsg)) |
|
| 88 | - { |
|
| 89 | - $error_info = error_get_last(); |
|
| 78 | + global $modx; |
|
| 79 | + $modx->event->params = &$params; // store params inside event object |
|
| 80 | + if(is_array($params)) { |
|
| 81 | + extract($params, EXTR_SKIP); |
|
| 82 | + } |
|
| 83 | + ob_start(); |
|
| 84 | + $mod = eval($moduleCode); |
|
| 85 | + $msg = ob_get_contents(); |
|
| 86 | + ob_end_clean(); |
|
| 87 | + if (isset($php_errormsg)) |
|
| 88 | + { |
|
| 89 | + $error_info = error_get_last(); |
|
| 90 | 90 | switch($error_info['type']) |
| 91 | 91 | { |
| 92 | - case E_NOTICE : |
|
| 93 | - $error_level = 1; |
|
| 94 | - case E_USER_NOTICE : |
|
| 95 | - break; |
|
| 96 | - case E_DEPRECATED : |
|
| 97 | - case E_USER_DEPRECATED : |
|
| 98 | - case E_STRICT : |
|
| 99 | - $error_level = 2; |
|
| 100 | - break; |
|
| 101 | - default: |
|
| 102 | - $error_level = 99; |
|
| 92 | + case E_NOTICE : |
|
| 93 | + $error_level = 1; |
|
| 94 | + case E_USER_NOTICE : |
|
| 95 | + break; |
|
| 96 | + case E_DEPRECATED : |
|
| 97 | + case E_USER_DEPRECATED : |
|
| 98 | + case E_STRICT : |
|
| 99 | + $error_level = 2; |
|
| 100 | + break; |
|
| 101 | + default: |
|
| 102 | + $error_level = 99; |
|
| 103 | + } |
|
| 104 | + if($modx->config['error_reporting']==='99' || 2<$error_level) |
|
| 105 | + { |
|
| 106 | + $modx->messageQuit('PHP Parse Error', '', true, $error_info['type'], $error_info['file'], $_SESSION['itemname'] . ' - Module', $error_info['message'], $error_info['line'], $msg); |
|
| 107 | + $modx->event->alert("An error occurred while loading. Please see the event log for more information<p>{$msg}</p>"); |
|
| 103 | 108 | } |
| 104 | - if($modx->config['error_reporting']==='99' || 2<$error_level) |
|
| 105 | - { |
|
| 106 | - $modx->messageQuit('PHP Parse Error', '', true, $error_info['type'], $error_info['file'], $_SESSION['itemname'] . ' - Module', $error_info['message'], $error_info['line'], $msg); |
|
| 107 | - $modx->event->alert("An error occurred while loading. Please see the event log for more information<p>{$msg}</p>"); |
|
| 108 | - } |
|
| 109 | - } |
|
| 110 | - unset($modx->event->params); |
|
| 111 | - return $mod.$msg; |
|
| 109 | + } |
|
| 110 | + unset($modx->event->params); |
|
| 111 | + return $mod.$msg; |
|
| 112 | 112 | } |