Completed
Push — develop ( 6c715c...e575c7 )
by Dmytro
13s
created
manager/processors/execute_module.processor.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -1,18 +1,18 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
 
62 62
 echo "<style>body,html {overflow:auto!important;height:100%!important}</style>"; // for iframe scroller
63 63
 
64
-$output = evalModule($content["modulecode"],$parameter);
64
+$output = evalModule($content["modulecode"], $parameter);
65 65
 echo $output;
66 66
 include MODX_MANAGER_PATH."includes/sysalert.display.inc.php";
67 67
 
@@ -72,10 +72,10 @@  discard block
 block discarded – undo
72 72
  * @param array $params
73 73
  * @return string
74 74
  */
75
-function evalModule($moduleCode,$params){
75
+function evalModule($moduleCode, $params){
76 76
 	global $modx;
77 77
 	$modx->event->params = &$params; // store params inside event object
78
-	if(is_array($params)) {
78
+	if (is_array($params)) {
79 79
 		extract($params, EXTR_SKIP);
80 80
 	}
81 81
 	ob_start();
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
 	if (isset($php_errormsg))
86 86
 	{
87 87
 		$error_info = error_get_last();
88
-        switch($error_info['type'])
88
+        switch ($error_info['type'])
89 89
         {
90 90
         	case E_NOTICE :
91 91
         		$error_level = 1;
@@ -99,9 +99,9 @@  discard block
 block discarded – undo
99 99
         	default:
100 100
         		$error_level = 99;
101 101
         }
102
-		if($modx->config['error_reporting']==='99' || 2<$error_level)
102
+		if ($modx->config['error_reporting'] === '99' || 2 < $error_level)
103 103
 		{
104
-			$modx->messageQuit('PHP Parse Error', '', true, $error_info['type'], $error_info['file'], $_SESSION['itemname'] . ' - Module', $error_info['message'], $error_info['line'], $msg);
104
+			$modx->messageQuit('PHP Parse Error', '', true, $error_info['type'], $error_info['file'], $_SESSION['itemname'].' - Module', $error_info['message'], $error_info['line'], $msg);
105 105
 			$modx->event->alert("An error occurred while loading. Please see the event log for more information<p>{$msg}</p>");
106 106
 		}
107 107
 	}
Please login to merge, or discard this patch.