@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | public function getUserData() { |
41 | 41 | $client['ip'] = $_SERVER['REMOTE_ADDR']; |
42 | 42 | $client['ua'] = $_SERVER['HTTP_USER_AGENT']; |
43 | - return $client; |
|
43 | + return $client; |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | # Returns true, install or interact when inside manager |
@@ -60,12 +60,12 @@ discard block |
||
60 | 60 | |
61 | 61 | // deprecated |
62 | 62 | public function putChunk($chunkName) { // alias name >.< |
63 | - global $modx; |
|
63 | + global $modx; |
|
64 | 64 | return $modx->getChunk($chunkName); |
65 | 65 | } |
66 | 66 | |
67 | 67 | public function getDocGroups() { |
68 | - global $modx; |
|
68 | + global $modx; |
|
69 | 69 | return $modx->getUserDocGroups(); |
70 | 70 | } // deprecated |
71 | 71 | |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | } // deprecated |
75 | 75 | |
76 | 76 | public function userLoggedIn() { |
77 | - global $modx; |
|
77 | + global $modx; |
|
78 | 78 | $userdetails= array (); |
79 | 79 | if ($modx->isFrontend() && isset ($_SESSION['webValidated'])) { |
80 | 80 | // web user |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | |
99 | 99 | public function getFormVars($method= "", $prefix= "", $trim= "", $REQUEST_METHOD) { |
100 | 100 | // function to retrieve form results into an associative array |
101 | - global $modx; |
|
101 | + global $modx; |
|
102 | 102 | $results= array (); |
103 | 103 | $method= strtoupper($method); |
104 | 104 | if ($method == "") |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | * @param string $url URL to redirect to |
131 | 131 | */ |
132 | 132 | public function webAlert($msg, $url= "") { |
133 | - global $modx; |
|
133 | + global $modx; |
|
134 | 134 | $msg= addslashes($modx->db->escape($msg)); |
135 | 135 | if (substr(strtolower($url), 0, 11) == "javascript:") { |
136 | 136 | $act= "__WebAlert();"; |
@@ -1,43 +1,43 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | $this->old = new OldFunctions(); |
3 | -class OldFunctions { |
|
3 | +class OldFunctions{ |
|
4 | 4 | |
5 | - public function dbConnect() {global $modx; $modx->db->connect();$modx->rs = $modx->db->conn;} |
|
6 | - public function dbQuery($sql) {global $modx;return $modx->db->query($sql);} |
|
7 | - public function recordCount($rs) {global $modx;return $modx->db->getRecordCount($rs);} |
|
8 | - public function fetchRow($rs,$mode='assoc') {global $modx;return $modx->db->getRow($rs, $mode);} |
|
9 | - public function affectedRows($rs) {global $modx;return $modx->db->getAffectedRows($rs);} |
|
10 | - public function insertId($rs) {global $modx;return $modx->db->getInsertId($rs);} |
|
11 | - public function dbClose() {global $modx; $modx->db->disconnect();} |
|
5 | + public function dbConnect(){global $modx; $modx->db->connect(); $modx->rs = $modx->db->conn; } |
|
6 | + public function dbQuery($sql){global $modx; return $modx->db->query($sql); } |
|
7 | + public function recordCount($rs){global $modx; return $modx->db->getRecordCount($rs); } |
|
8 | + public function fetchRow($rs, $mode = 'assoc'){global $modx; return $modx->db->getRow($rs, $mode); } |
|
9 | + public function affectedRows($rs){global $modx; return $modx->db->getAffectedRows($rs); } |
|
10 | + public function insertId($rs){global $modx; return $modx->db->getInsertId($rs); } |
|
11 | + public function dbClose(){global $modx; $modx->db->disconnect(); } |
|
12 | 12 | |
13 | - public function makeList($array, $ulroot= 'root', $ulprefix= 'sub_', $type= '', $ordered= false, $tablevel= 0) { |
|
13 | + public function makeList($array, $ulroot = 'root', $ulprefix = 'sub_', $type = '', $ordered = false, $tablevel = 0){ |
|
14 | 14 | // first find out whether the value passed is an array |
15 | 15 | if (!is_array($array)) { |
16 | 16 | return "<ul><li>Bad list</li></ul>"; |
17 | 17 | } |
18 | 18 | if (!empty ($type)) { |
19 | - $typestr= " style='list-style-type: $type'"; |
|
19 | + $typestr = " style='list-style-type: $type'"; |
|
20 | 20 | } else { |
21 | - $typestr= ""; |
|
21 | + $typestr = ""; |
|
22 | 22 | } |
23 | - $tabs= ""; |
|
24 | - for ($i= 0; $i < $tablevel; $i++) { |
|
23 | + $tabs = ""; |
|
24 | + for ($i = 0; $i < $tablevel; $i++) { |
|
25 | 25 | $tabs .= "\t"; |
26 | 26 | } |
27 | - $listhtml= $ordered == true ? $tabs . "<ol class='$ulroot'$typestr>\n" : $tabs . "<ul class='$ulroot'$typestr>\n"; |
|
27 | + $listhtml = $ordered == true ? $tabs."<ol class='$ulroot'$typestr>\n" : $tabs."<ul class='$ulroot'$typestr>\n"; |
|
28 | 28 | foreach ($array as $key => $value) { |
29 | 29 | if (is_array($value)) { |
30 | - $listhtml .= $tabs . "\t<li>" . $key . "\n" . $this->makeList($value, $ulprefix . $ulroot, $ulprefix, $type, $ordered, $tablevel +2) . $tabs . "\t</li>\n"; |
|
30 | + $listhtml .= $tabs."\t<li>".$key."\n".$this->makeList($value, $ulprefix.$ulroot, $ulprefix, $type, $ordered, $tablevel + 2).$tabs."\t</li>\n"; |
|
31 | 31 | } else { |
32 | - $listhtml .= $tabs . "\t<li>" . $value . "</li>\n"; |
|
32 | + $listhtml .= $tabs."\t<li>".$value."</li>\n"; |
|
33 | 33 | } |
34 | 34 | } |
35 | - $listhtml .= $ordered == true ? $tabs . "</ol>\n" : $tabs . "</ul>\n"; |
|
35 | + $listhtml .= $ordered == true ? $tabs."</ol>\n" : $tabs."</ul>\n"; |
|
36 | 36 | return $listhtml; |
37 | 37 | } |
38 | 38 | |
39 | 39 | |
40 | - public function getUserData() { |
|
40 | + public function getUserData(){ |
|
41 | 41 | $client['ip'] = $_SERVER['REMOTE_ADDR']; |
42 | 42 | $client['ua'] = $_SERVER['HTTP_USER_AGENT']; |
43 | 43 | return $client; |
@@ -45,80 +45,80 @@ discard block |
||
45 | 45 | |
46 | 46 | # Returns true, install or interact when inside manager |
47 | 47 | // deprecated |
48 | - public function insideManager() { |
|
49 | - $m= false; |
|
50 | - if( defined('IN_MANAGER_MODE') && IN_MANAGER_MODE === true) { |
|
51 | - $m= true; |
|
48 | + public function insideManager(){ |
|
49 | + $m = false; |
|
50 | + if (defined('IN_MANAGER_MODE') && IN_MANAGER_MODE === true) { |
|
51 | + $m = true; |
|
52 | 52 | if (defined('SNIPPET_INTERACTIVE_MODE') && SNIPPET_INTERACTIVE_MODE == 'true') |
53 | - $m= "interact"; |
|
53 | + $m = "interact"; |
|
54 | 54 | else |
55 | 55 | if (defined('SNIPPET_INSTALL_MODE') && SNIPPET_INSTALL_MODE == 'true') |
56 | - $m= "install"; |
|
56 | + $m = "install"; |
|
57 | 57 | } |
58 | 58 | return $m; |
59 | 59 | } |
60 | 60 | |
61 | 61 | // deprecated |
62 | - public function putChunk($chunkName) { // alias name >.< |
|
62 | + public function putChunk($chunkName){ // alias name >.< |
|
63 | 63 | global $modx; |
64 | 64 | return $modx->getChunk($chunkName); |
65 | 65 | } |
66 | 66 | |
67 | - public function getDocGroups() { |
|
67 | + public function getDocGroups(){ |
|
68 | 68 | global $modx; |
69 | 69 | return $modx->getUserDocGroups(); |
70 | 70 | } // deprecated |
71 | 71 | |
72 | - public function changePassword($o, $n) { |
|
72 | + public function changePassword($o, $n){ |
|
73 | 73 | return changeWebUserPassword($o, $n); |
74 | 74 | } // deprecated |
75 | 75 | |
76 | - public function userLoggedIn() { |
|
76 | + public function userLoggedIn(){ |
|
77 | 77 | global $modx; |
78 | - $userdetails= array (); |
|
78 | + $userdetails = array(); |
|
79 | 79 | if ($modx->isFrontend() && isset ($_SESSION['webValidated'])) { |
80 | 80 | // web user |
81 | - $userdetails['loggedIn']= true; |
|
82 | - $userdetails['id']= $_SESSION['webInternalKey']; |
|
83 | - $userdetails['username']= $_SESSION['webShortname']; |
|
84 | - $userdetails['usertype']= 'web'; // added by Raymond |
|
81 | + $userdetails['loggedIn'] = true; |
|
82 | + $userdetails['id'] = $_SESSION['webInternalKey']; |
|
83 | + $userdetails['username'] = $_SESSION['webShortname']; |
|
84 | + $userdetails['usertype'] = 'web'; // added by Raymond |
|
85 | 85 | return $userdetails; |
86 | 86 | } else |
87 | 87 | if ($modx->isBackend() && isset ($_SESSION['mgrValidated'])) { |
88 | 88 | // manager user |
89 | - $userdetails['loggedIn']= true; |
|
90 | - $userdetails['id']= $_SESSION['mgrInternalKey']; |
|
91 | - $userdetails['username']= $_SESSION['mgrShortname']; |
|
92 | - $userdetails['usertype']= 'manager'; // added by Raymond |
|
89 | + $userdetails['loggedIn'] = true; |
|
90 | + $userdetails['id'] = $_SESSION['mgrInternalKey']; |
|
91 | + $userdetails['username'] = $_SESSION['mgrShortname']; |
|
92 | + $userdetails['usertype'] = 'manager'; // added by Raymond |
|
93 | 93 | return $userdetails; |
94 | 94 | } else { |
95 | 95 | return false; |
96 | 96 | } |
97 | 97 | } |
98 | 98 | |
99 | - public function getFormVars($method= "", $prefix= "", $trim= "", $REQUEST_METHOD) { |
|
99 | + public function getFormVars($method = "", $prefix = "", $trim = "", $REQUEST_METHOD){ |
|
100 | 100 | // function to retrieve form results into an associative array |
101 | 101 | global $modx; |
102 | - $results= array (); |
|
103 | - $method= strtoupper($method); |
|
102 | + $results = array(); |
|
103 | + $method = strtoupper($method); |
|
104 | 104 | if ($method == "") |
105 | - $method= $REQUEST_METHOD; |
|
105 | + $method = $REQUEST_METHOD; |
|
106 | 106 | if ($method == "POST") |
107 | - $method= & $_POST; |
|
108 | - elseif ($method == "GET") $method= & $_GET; |
|
107 | + $method = & $_POST; |
|
108 | + elseif ($method == "GET") $method = & $_GET; |
|
109 | 109 | else |
110 | 110 | return false; |
111 | 111 | reset($method); |
112 | 112 | foreach ($method as $key => $value) { |
113 | 113 | if (($prefix != "") && (substr($key, 0, strlen($prefix)) == $prefix)) { |
114 | 114 | if ($trim) { |
115 | - $pieces= explode($prefix, $key, 2); |
|
116 | - $key= $pieces[1]; |
|
117 | - $results[$key]= $value; |
|
115 | + $pieces = explode($prefix, $key, 2); |
|
116 | + $key = $pieces[1]; |
|
117 | + $results[$key] = $value; |
|
118 | 118 | } else |
119 | - $results[$key]= $value; |
|
119 | + $results[$key] = $value; |
|
120 | 120 | } |
121 | - elseif ($prefix == "") $results[$key]= $value; |
|
121 | + elseif ($prefix == "") $results[$key] = $value; |
|
122 | 122 | } |
123 | 123 | return $results; |
124 | 124 | } |
@@ -129,16 +129,16 @@ discard block |
||
129 | 129 | * @param string $msg Message to show |
130 | 130 | * @param string $url URL to redirect to |
131 | 131 | */ |
132 | - public function webAlert($msg, $url= "") { |
|
132 | + public function webAlert($msg, $url = ""){ |
|
133 | 133 | global $modx; |
134 | - $msg= addslashes($modx->db->escape($msg)); |
|
134 | + $msg = addslashes($modx->db->escape($msg)); |
|
135 | 135 | if (substr(strtolower($url), 0, 11) == "javascript:") { |
136 | - $act= "__WebAlert();"; |
|
137 | - $fnc= "function __WebAlert(){" . substr($url, 11) . "};"; |
|
136 | + $act = "__WebAlert();"; |
|
137 | + $fnc = "function __WebAlert(){".substr($url, 11)."};"; |
|
138 | 138 | } else { |
139 | - $act= ($url ? "window.location.href='" . addslashes($url) . "';" : ""); |
|
139 | + $act = ($url ? "window.location.href='".addslashes($url)."';" : ""); |
|
140 | 140 | } |
141 | - $html= "<script>$fnc window.setTimeout(\"alert('$msg');$act\",100);</script>"; |
|
141 | + $html = "<script>$fnc window.setTimeout(\"alert('$msg');$act\",100);</script>"; |
|
142 | 142 | if ($modx->isFrontend()) |
143 | 143 | $modx->regClientScript($html); |
144 | 144 | else { |
@@ -1,16 +1,32 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | $this->old = new OldFunctions(); |
3 | -class OldFunctions { |
|
3 | +class OldFunctions |
|
4 | +{ |
|
4 | 5 | |
5 | - public function dbConnect() {global $modx; $modx->db->connect();$modx->rs = $modx->db->conn;} |
|
6 | - public function dbQuery($sql) {global $modx;return $modx->db->query($sql);} |
|
7 | - public function recordCount($rs) {global $modx;return $modx->db->getRecordCount($rs);} |
|
8 | - public function fetchRow($rs,$mode='assoc') {global $modx;return $modx->db->getRow($rs, $mode);} |
|
9 | - public function affectedRows($rs) {global $modx;return $modx->db->getAffectedRows($rs);} |
|
10 | - public function insertId($rs) {global $modx;return $modx->db->getInsertId($rs);} |
|
11 | - public function dbClose() {global $modx; $modx->db->disconnect();} |
|
6 | + public function dbConnect() |
|
7 | + { |
|
8 | +global $modx; $modx->db->connect();$modx->rs = $modx->db->conn;} |
|
9 | + public function dbQuery($sql) |
|
10 | + { |
|
11 | +global $modx;return $modx->db->query($sql);} |
|
12 | + public function recordCount($rs) |
|
13 | + { |
|
14 | +global $modx;return $modx->db->getRecordCount($rs);} |
|
15 | + public function fetchRow($rs,$mode='assoc') |
|
16 | + { |
|
17 | +global $modx;return $modx->db->getRow($rs, $mode);} |
|
18 | + public function affectedRows($rs) |
|
19 | + { |
|
20 | +global $modx;return $modx->db->getAffectedRows($rs);} |
|
21 | + public function insertId($rs) |
|
22 | + { |
|
23 | +global $modx;return $modx->db->getInsertId($rs);} |
|
24 | + public function dbClose() |
|
25 | + { |
|
26 | +global $modx; $modx->db->disconnect();} |
|
12 | 27 | |
13 | - public function makeList($array, $ulroot= 'root', $ulprefix= 'sub_', $type= '', $ordered= false, $tablevel= 0) { |
|
28 | + public function makeList($array, $ulroot= 'root', $ulprefix= 'sub_', $type= '', $ordered= false, $tablevel= 0) |
|
29 | + { |
|
14 | 30 | // first find out whether the value passed is an array |
15 | 31 | if (!is_array($array)) { |
16 | 32 | return "<ul><li>Bad list</li></ul>"; |
@@ -37,7 +53,8 @@ discard block |
||
37 | 53 | } |
38 | 54 | |
39 | 55 | |
40 | - public function getUserData() { |
|
56 | + public function getUserData() |
|
57 | + { |
|
41 | 58 | $client['ip'] = $_SERVER['REMOTE_ADDR']; |
42 | 59 | $client['ua'] = $_SERVER['HTTP_USER_AGENT']; |
43 | 60 | return $client; |
@@ -45,35 +62,42 @@ discard block |
||
45 | 62 | |
46 | 63 | # Returns true, install or interact when inside manager |
47 | 64 | // deprecated |
48 | - public function insideManager() { |
|
65 | + public function insideManager() |
|
66 | + { |
|
49 | 67 | $m= false; |
50 | 68 | if( defined('IN_MANAGER_MODE') && IN_MANAGER_MODE === true) { |
51 | 69 | $m= true; |
52 | - if (defined('SNIPPET_INTERACTIVE_MODE') && SNIPPET_INTERACTIVE_MODE == 'true') |
|
53 | - $m= "interact"; |
|
54 | - else |
|
55 | - if (defined('SNIPPET_INSTALL_MODE') && SNIPPET_INSTALL_MODE == 'true') |
|
56 | - $m= "install"; |
|
70 | + if (defined('SNIPPET_INTERACTIVE_MODE') && SNIPPET_INTERACTIVE_MODE == 'true') { |
|
71 | + $m= "interact"; |
|
72 | + } else |
|
73 | + if (defined('SNIPPET_INSTALL_MODE') && SNIPPET_INSTALL_MODE == 'true') { |
|
74 | + $m= "install"; |
|
75 | + } |
|
57 | 76 | } |
58 | 77 | return $m; |
59 | 78 | } |
60 | 79 | |
61 | 80 | // deprecated |
62 | - public function putChunk($chunkName) { // alias name >.< |
|
81 | + public function putChunk($chunkName) |
|
82 | + { |
|
83 | +// alias name >.< |
|
63 | 84 | global $modx; |
64 | 85 | return $modx->getChunk($chunkName); |
65 | 86 | } |
66 | 87 | |
67 | - public function getDocGroups() { |
|
88 | + public function getDocGroups() |
|
89 | + { |
|
68 | 90 | global $modx; |
69 | 91 | return $modx->getUserDocGroups(); |
70 | 92 | } // deprecated |
71 | 93 | |
72 | - public function changePassword($o, $n) { |
|
94 | + public function changePassword($o, $n) |
|
95 | + { |
|
73 | 96 | return changeWebUserPassword($o, $n); |
74 | 97 | } // deprecated |
75 | 98 | |
76 | - public function userLoggedIn() { |
|
99 | + public function userLoggedIn() |
|
100 | + { |
|
77 | 101 | global $modx; |
78 | 102 | $userdetails= array (); |
79 | 103 | if ($modx->isFrontend() && isset ($_SESSION['webValidated'])) { |
@@ -96,18 +120,22 @@ discard block |
||
96 | 120 | } |
97 | 121 | } |
98 | 122 | |
99 | - public function getFormVars($method= "", $prefix= "", $trim= "", $REQUEST_METHOD) { |
|
123 | + public function getFormVars($method= "", $prefix= "", $trim= "", $REQUEST_METHOD) |
|
124 | + { |
|
100 | 125 | // function to retrieve form results into an associative array |
101 | 126 | global $modx; |
102 | 127 | $results= array (); |
103 | 128 | $method= strtoupper($method); |
104 | - if ($method == "") |
|
105 | - $method= $REQUEST_METHOD; |
|
106 | - if ($method == "POST") |
|
107 | - $method= & $_POST; |
|
108 | - elseif ($method == "GET") $method= & $_GET; |
|
109 | - else |
|
110 | - return false; |
|
129 | + if ($method == "") { |
|
130 | + $method= $REQUEST_METHOD; |
|
131 | + } |
|
132 | + if ($method == "POST") { |
|
133 | + $method= & $_POST; |
|
134 | + } elseif ($method == "GET") { |
|
135 | + $method= & $_GET; |
|
136 | + } else { |
|
137 | + return false; |
|
138 | + } |
|
111 | 139 | reset($method); |
112 | 140 | foreach ($method as $key => $value) { |
113 | 141 | if (($prefix != "") && (substr($key, 0, strlen($prefix)) == $prefix)) { |
@@ -115,10 +143,12 @@ discard block |
||
115 | 143 | $pieces= explode($prefix, $key, 2); |
116 | 144 | $key= $pieces[1]; |
117 | 145 | $results[$key]= $value; |
118 | - } else |
|
119 | - $results[$key]= $value; |
|
146 | + } else { |
|
147 | + $results[$key]= $value; |
|
148 | + } |
|
149 | + } elseif ($prefix == "") { |
|
150 | + $results[$key]= $value; |
|
120 | 151 | } |
121 | - elseif ($prefix == "") $results[$key]= $value; |
|
122 | 152 | } |
123 | 153 | return $results; |
124 | 154 | } |
@@ -129,7 +159,8 @@ discard block |
||
129 | 159 | * @param string $msg Message to show |
130 | 160 | * @param string $url URL to redirect to |
131 | 161 | */ |
132 | - public function webAlert($msg, $url= "") { |
|
162 | + public function webAlert($msg, $url= "") |
|
163 | + { |
|
133 | 164 | global $modx; |
134 | 165 | $msg= addslashes($modx->db->escape($msg)); |
135 | 166 | if (substr(strtolower($url), 0, 11) == "javascript:") { |
@@ -139,9 +170,9 @@ discard block |
||
139 | 170 | $act= ($url ? "window.location.href='" . addslashes($url) . "';" : ""); |
140 | 171 | } |
141 | 172 | $html= "<script>$fnc window.setTimeout(\"alert('$msg');$act\",100);</script>"; |
142 | - if ($modx->isFrontend()) |
|
143 | - $modx->regClientScript($html); |
|
144 | - else { |
|
173 | + if ($modx->isFrontend()) { |
|
174 | + $modx->regClientScript($html); |
|
175 | + } else { |
|
145 | 176 | echo $html; |
146 | 177 | } |
147 | 178 | } |
@@ -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 | -$lockElementId = (int)$lockElementId; |
|
6 | +$lockElementId = (int) $lockElementId; |
|
7 | 7 | |
8 | 8 | if ($lockElementId > 0) { |
9 | 9 | ?> |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | var stay = document.getElementById('stay'); |
19 | 19 | // Trigger unlock |
20 | 20 | if ((stay && stay.value !== '2') || !form_save) { |
21 | - var url = '<?php echo MODX_MANAGER_URL; ?>?a=67&type=<?php echo $lockElementType;?>&id=<?php echo $lockElementId;?>&o=' + Math.random(); |
|
21 | + var url = '<?php echo MODX_MANAGER_URL; ?>?a=67&type=<?php echo $lockElementType; ?>&id=<?php echo $lockElementId; ?>&o=' + Math.random(); |
|
22 | 22 | if (navigator.sendBeacon) { |
23 | 23 | navigator.sendBeacon(url) |
24 | 24 | } else { |
@@ -17,70 +17,70 @@ discard block |
||
17 | 17 | |
18 | 18 | public function __construct() { |
19 | 19 | |
20 | - $_lang = $this->include_lang('errormsg'); |
|
20 | + $_lang = $this->include_lang('errormsg'); |
|
21 | 21 | |
22 | - $this->errors = array( |
|
23 | - 0 => $_lang["No errors occured."], |
|
24 | - 1 => $_lang["An error occured!"], |
|
25 | - 2 => $_lang["Document's ID not passed in request!"], |
|
26 | - 3 => $_lang["You don't have enough privileges for this action!"], |
|
27 | - 4 => $_lang["ID passed in request is NaN!"], |
|
28 | - 5 => $_lang["The document is locked!"], |
|
29 | - 6 => $_lang["Too many results returned from database!"], |
|
30 | - 7 => $_lang["Not enough/ no results returned from database!"], |
|
31 | - 8 => $_lang["Couldn't find parent document's name!"], |
|
32 | - 9 => $_lang["Logging error!"], |
|
33 | - 10 => $_lang["Table to optimise not found in request!"], |
|
34 | - 11 => $_lang["No settings found in request!"], |
|
35 | - 12 => $_lang["The document must have a title!"], |
|
36 | - 13 => $_lang["No user selected as recipient of this message!"], |
|
37 | - 14 => $_lang["No group selected as recipient of this message!"], |
|
38 | - 15 => $_lang["The document was not found!"], |
|
22 | + $this->errors = array( |
|
23 | + 0 => $_lang["No errors occured."], |
|
24 | + 1 => $_lang["An error occured!"], |
|
25 | + 2 => $_lang["Document's ID not passed in request!"], |
|
26 | + 3 => $_lang["You don't have enough privileges for this action!"], |
|
27 | + 4 => $_lang["ID passed in request is NaN!"], |
|
28 | + 5 => $_lang["The document is locked!"], |
|
29 | + 6 => $_lang["Too many results returned from database!"], |
|
30 | + 7 => $_lang["Not enough/ no results returned from database!"], |
|
31 | + 8 => $_lang["Couldn't find parent document's name!"], |
|
32 | + 9 => $_lang["Logging error!"], |
|
33 | + 10 => $_lang["Table to optimise not found in request!"], |
|
34 | + 11 => $_lang["No settings found in request!"], |
|
35 | + 12 => $_lang["The document must have a title!"], |
|
36 | + 13 => $_lang["No user selected as recipient of this message!"], |
|
37 | + 14 => $_lang["No group selected as recipient of this message!"], |
|
38 | + 15 => $_lang["The document was not found!"], |
|
39 | 39 | |
40 | - 100 => $_lang["Double action (GET & POST) posted!"], |
|
41 | - 600 => $_lang["Document cannot be it's own parent!"], |
|
42 | - 601 => $_lang["Document's ID not passed in request!"], |
|
43 | - 602 => $_lang["New parent not set in request!"], |
|
44 | - 900 => $_lang["don't know the user!"], // don't know the user! |
|
45 | - 901 => $_lang["wrong password!"], // wrong password! |
|
46 | - 902 => $_lang["Due to too many failed logins, you have been blocked!"], |
|
47 | - 903 => $_lang["You are blocked and cannot log in!"], |
|
48 | - 904 => $_lang["You are blocked and cannot log in! Please try again later."], |
|
49 | - 905 => $_lang["The security code you entered didn't validate! Please try to login again!"] |
|
50 | - ); |
|
51 | - } |
|
40 | + 100 => $_lang["Double action (GET & POST) posted!"], |
|
41 | + 600 => $_lang["Document cannot be it's own parent!"], |
|
42 | + 601 => $_lang["Document's ID not passed in request!"], |
|
43 | + 602 => $_lang["New parent not set in request!"], |
|
44 | + 900 => $_lang["don't know the user!"], // don't know the user! |
|
45 | + 901 => $_lang["wrong password!"], // wrong password! |
|
46 | + 902 => $_lang["Due to too many failed logins, you have been blocked!"], |
|
47 | + 903 => $_lang["You are blocked and cannot log in!"], |
|
48 | + 904 => $_lang["You are blocked and cannot log in! Please try again later."], |
|
49 | + 905 => $_lang["The security code you entered didn't validate! Please try to login again!"] |
|
50 | + ); |
|
51 | + } |
|
52 | 52 | |
53 | - function include_lang($context='common') { |
|
54 | - global $modx; |
|
55 | - $_lang = array(); |
|
53 | + function include_lang($context='common') { |
|
54 | + global $modx; |
|
55 | + $_lang = array(); |
|
56 | 56 | |
57 | - $context = trim($context,'/'); |
|
58 | - if(strpos($context,'..')!==false) return; |
|
57 | + $context = trim($context,'/'); |
|
58 | + if(strpos($context,'..')!==false) return; |
|
59 | 59 | |
60 | - if($context === 'common') |
|
61 | - $lang_path = MODX_MANAGER_PATH . 'includes/lang/'; |
|
62 | - else |
|
63 | - $lang_path = MODX_MANAGER_PATH . "includes/lang/{$context}/"; |
|
64 | - include_once($lang_path . 'english.inc.php'); |
|
65 | - $manager_language = $modx->config['manager_language']; |
|
66 | - if(is_file("{$lang_path}{$manager_language}.inc.php")) |
|
67 | - include_once("{$lang_path}{$manager_language}.inc.php"); |
|
68 | - return $_lang; |
|
69 | - } |
|
60 | + if($context === 'common') |
|
61 | + $lang_path = MODX_MANAGER_PATH . 'includes/lang/'; |
|
62 | + else |
|
63 | + $lang_path = MODX_MANAGER_PATH . "includes/lang/{$context}/"; |
|
64 | + include_once($lang_path . 'english.inc.php'); |
|
65 | + $manager_language = $modx->config['manager_language']; |
|
66 | + if(is_file("{$lang_path}{$manager_language}.inc.php")) |
|
67 | + include_once("{$lang_path}{$manager_language}.inc.php"); |
|
68 | + return $_lang; |
|
69 | + } |
|
70 | 70 | |
71 | - function setError($errorcode, $custommessage=""){ |
|
72 | - $this->errorcode=$errorcode; |
|
73 | - $this->errormessage=$this->errors[$errorcode]; |
|
74 | - if($custommessage!="") { |
|
75 | - $this->errormessage=$custommessage; |
|
76 | - } |
|
77 | - } |
|
71 | + function setError($errorcode, $custommessage=""){ |
|
72 | + $this->errorcode=$errorcode; |
|
73 | + $this->errormessage=$this->errors[$errorcode]; |
|
74 | + if($custommessage!="") { |
|
75 | + $this->errormessage=$custommessage; |
|
76 | + } |
|
77 | + } |
|
78 | 78 | |
79 | - function getError() { |
|
80 | - return $this->errorcode; |
|
81 | - } |
|
79 | + function getError() { |
|
80 | + return $this->errorcode; |
|
81 | + } |
|
82 | 82 | |
83 | - function dumpError(){ |
|
83 | + function dumpError(){ |
|
84 | 84 | ?> |
85 | 85 | <html> |
86 | 86 | <head> |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | </body> |
99 | 99 | </html> |
100 | 100 | <?php |
101 | - exit; |
|
102 | - } |
|
101 | + exit; |
|
102 | + } |
|
103 | 103 | } |
104 | 104 | ?> |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | */ |
16 | 16 | public $errormessage; |
17 | 17 | |
18 | - public function __construct() { |
|
18 | + public function __construct(){ |
|
19 | 19 | |
20 | 20 | $_lang = $this->include_lang('errormsg'); |
21 | 21 | |
@@ -50,33 +50,33 @@ discard block |
||
50 | 50 | ); |
51 | 51 | } |
52 | 52 | |
53 | - function include_lang($context='common') { |
|
53 | + function include_lang($context = 'common'){ |
|
54 | 54 | global $modx; |
55 | 55 | $_lang = array(); |
56 | 56 | |
57 | - $context = trim($context,'/'); |
|
58 | - if(strpos($context,'..')!==false) return; |
|
57 | + $context = trim($context, '/'); |
|
58 | + if (strpos($context, '..') !== false) return; |
|
59 | 59 | |
60 | - if($context === 'common') |
|
61 | - $lang_path = MODX_MANAGER_PATH . 'includes/lang/'; |
|
60 | + if ($context === 'common') |
|
61 | + $lang_path = MODX_MANAGER_PATH.'includes/lang/'; |
|
62 | 62 | else |
63 | - $lang_path = MODX_MANAGER_PATH . "includes/lang/{$context}/"; |
|
64 | - include_once($lang_path . 'english.inc.php'); |
|
63 | + $lang_path = MODX_MANAGER_PATH."includes/lang/{$context}/"; |
|
64 | + include_once($lang_path.'english.inc.php'); |
|
65 | 65 | $manager_language = $modx->config['manager_language']; |
66 | - if(is_file("{$lang_path}{$manager_language}.inc.php")) |
|
66 | + if (is_file("{$lang_path}{$manager_language}.inc.php")) |
|
67 | 67 | include_once("{$lang_path}{$manager_language}.inc.php"); |
68 | 68 | return $_lang; |
69 | 69 | } |
70 | 70 | |
71 | - function setError($errorcode, $custommessage=""){ |
|
72 | - $this->errorcode=$errorcode; |
|
73 | - $this->errormessage=$this->errors[$errorcode]; |
|
74 | - if($custommessage!="") { |
|
75 | - $this->errormessage=$custommessage; |
|
71 | + function setError($errorcode, $custommessage = ""){ |
|
72 | + $this->errorcode = $errorcode; |
|
73 | + $this->errormessage = $this->errors[$errorcode]; |
|
74 | + if ($custommessage != "") { |
|
75 | + $this->errormessage = $custommessage; |
|
76 | 76 | } |
77 | 77 | } |
78 | 78 | |
79 | - function getError() { |
|
79 | + function getError(){ |
|
80 | 80 | return $this->errorcode; |
81 | 81 | } |
82 | 82 |
@@ -1,6 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | // this is the old error handler. Here for legacy, until i replace all the old errors. |
3 | -class errorHandler{ |
|
3 | +class errorHandler |
|
4 | +{ |
|
4 | 5 | |
5 | 6 | /** |
6 | 7 | * @var int |
@@ -15,7 +16,8 @@ discard block |
||
15 | 16 | */ |
16 | 17 | public $errormessage; |
17 | 18 | |
18 | - public function __construct() { |
|
19 | + public function __construct() |
|
20 | + { |
|
19 | 21 | |
20 | 22 | $_lang = $this->include_lang('errormsg'); |
21 | 23 | |
@@ -50,25 +52,31 @@ discard block |
||
50 | 52 | ); |
51 | 53 | } |
52 | 54 | |
53 | - function include_lang($context='common') { |
|
55 | + function include_lang($context='common') |
|
56 | + { |
|
54 | 57 | global $modx; |
55 | 58 | $_lang = array(); |
56 | 59 | |
57 | 60 | $context = trim($context,'/'); |
58 | - if(strpos($context,'..')!==false) return; |
|
61 | + if(strpos($context,'..')!==false) { |
|
62 | + return; |
|
63 | + } |
|
59 | 64 | |
60 | - if($context === 'common') |
|
61 | - $lang_path = MODX_MANAGER_PATH . 'includes/lang/'; |
|
62 | - else |
|
63 | - $lang_path = MODX_MANAGER_PATH . "includes/lang/{$context}/"; |
|
65 | + if($context === 'common') { |
|
66 | + $lang_path = MODX_MANAGER_PATH . 'includes/lang/'; |
|
67 | + } else { |
|
68 | + $lang_path = MODX_MANAGER_PATH . "includes/lang/{$context}/"; |
|
69 | + } |
|
64 | 70 | include_once($lang_path . 'english.inc.php'); |
65 | 71 | $manager_language = $modx->config['manager_language']; |
66 | - if(is_file("{$lang_path}{$manager_language}.inc.php")) |
|
67 | - include_once("{$lang_path}{$manager_language}.inc.php"); |
|
72 | + if(is_file("{$lang_path}{$manager_language}.inc.php")) { |
|
73 | + include_once("{$lang_path}{$manager_language}.inc.php"); |
|
74 | + } |
|
68 | 75 | return $_lang; |
69 | 76 | } |
70 | 77 | |
71 | - function setError($errorcode, $custommessage=""){ |
|
78 | + function setError($errorcode, $custommessage="") |
|
79 | + { |
|
72 | 80 | $this->errorcode=$errorcode; |
73 | 81 | $this->errormessage=$this->errors[$errorcode]; |
74 | 82 | if($custommessage!="") { |
@@ -76,11 +84,13 @@ discard block |
||
76 | 84 | } |
77 | 85 | } |
78 | 86 | |
79 | - function getError() { |
|
87 | + function getError() |
|
88 | + { |
|
80 | 89 | return $this->errorcode; |
81 | 90 | } |
82 | 91 | |
83 | - function dumpError(){ |
|
92 | + function dumpError() |
|
93 | + { |
|
84 | 94 | ?> |
85 | 95 | <html> |
86 | 96 | <head> |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | - /* |
|
2 | + /* |
|
3 | 3 | * MODX Manager Home Page Implmentation by pixelchutes (www.pixelchutes.com) |
4 | 4 | * Based on kudo's kRSS Module v1.0.72 |
5 | 5 | * |
@@ -30,44 +30,44 @@ discard block |
||
30 | 30 | require_once(MODX_MANAGER_PATH.'media/rss/rss_fetch.inc'); |
31 | 31 | // Convert relative path into absolute url |
32 | 32 | function rel2abs( $rel, $base ) { |
33 | - // parse base URL and convert to local variables: $scheme, $host, $path |
|
33 | + // parse base URL and convert to local variables: $scheme, $host, $path |
|
34 | 34 | $tmp = parse_url( $base ); |
35 | 35 | extract( $tmp ); |
36 | - if ( strpos( $rel,"//" ) === 0 ) { |
|
37 | - return $scheme . ':' . $rel; |
|
38 | - } |
|
39 | - // return if already absolute URL |
|
40 | - if ( parse_url( $rel, PHP_URL_SCHEME ) != '' ) { |
|
41 | - return $rel; |
|
42 | - } |
|
43 | - // queries and anchors |
|
44 | - if ( $rel[0] == '#' || $rel[0] == '?' ) { |
|
45 | - return $base . $rel; |
|
46 | - } |
|
47 | - // remove non-directory element from path |
|
48 | - $path = preg_replace( '#/[^/]*$#', '', $path ); |
|
49 | - // destroy path if relative url points to root |
|
50 | - if ( $rel[0] == '/' ) { |
|
51 | - $path = ''; |
|
52 | - } |
|
53 | - // dirty absolute URL |
|
54 | - $abs = $host . $path . "/" . $rel; |
|
55 | - // replace '//' or '/./' or '/foo/../' with '/' |
|
56 | - $abs = preg_replace( "/(\/\.?\/)/", "/", $abs ); |
|
57 | - $abs = preg_replace( "/\/(?!\.\.)[^\/]+\/\.\.\//", "/", $abs ); |
|
58 | - // absolute URL is ready! |
|
59 | - return $scheme . '://' . $abs; |
|
36 | + if ( strpos( $rel,"//" ) === 0 ) { |
|
37 | + return $scheme . ':' . $rel; |
|
38 | + } |
|
39 | + // return if already absolute URL |
|
40 | + if ( parse_url( $rel, PHP_URL_SCHEME ) != '' ) { |
|
41 | + return $rel; |
|
42 | + } |
|
43 | + // queries and anchors |
|
44 | + if ( $rel[0] == '#' || $rel[0] == '?' ) { |
|
45 | + return $base . $rel; |
|
46 | + } |
|
47 | + // remove non-directory element from path |
|
48 | + $path = preg_replace( '#/[^/]*$#', '', $path ); |
|
49 | + // destroy path if relative url points to root |
|
50 | + if ( $rel[0] == '/' ) { |
|
51 | + $path = ''; |
|
52 | + } |
|
53 | + // dirty absolute URL |
|
54 | + $abs = $host . $path . "/" . $rel; |
|
55 | + // replace '//' or '/./' or '/foo/../' with '/' |
|
56 | + $abs = preg_replace( "/(\/\.?\/)/", "/", $abs ); |
|
57 | + $abs = preg_replace( "/\/(?!\.\.)[^\/]+\/\.\.\//", "/", $abs ); |
|
58 | + // absolute URL is ready! |
|
59 | + return $scheme . '://' . $abs; |
|
60 | 60 | } |
61 | 61 | $feedData = array(); |
62 | 62 | |
63 | 63 | // create Feed |
64 | 64 | foreach ($urls as $section=>$url) { |
65 | - $output = ''; |
|
65 | + $output = ''; |
|
66 | 66 | $rss = @fetch_rss($url); |
67 | 67 | if( !$rss ){ |
68 | - $feedData[$section] = 'Failed to retrieve ' . $url; |
|
69 | - continue; |
|
70 | - } |
|
68 | + $feedData[$section] = 'Failed to retrieve ' . $url; |
|
69 | + continue; |
|
70 | + } |
|
71 | 71 | $output .= '<ul>'; |
72 | 72 | |
73 | 73 | $items = array_slice($rss->items, 0, $itemsNumber); |
@@ -85,5 +85,5 @@ discard block |
||
85 | 85 | } |
86 | 86 | |
87 | 87 | $output .= '</ul>'; |
88 | - $feedData[$section] = $output; |
|
88 | + $feedData[$section] = $output; |
|
89 | 89 | } |
@@ -29,34 +29,34 @@ discard block |
||
29 | 29 | // include MagPieRSS |
30 | 30 | require_once(MODX_MANAGER_PATH.'media/rss/rss_fetch.inc'); |
31 | 31 | // Convert relative path into absolute url |
32 | -function rel2abs( $rel, $base ) { |
|
32 | +function rel2abs($rel, $base){ |
|
33 | 33 | // parse base URL and convert to local variables: $scheme, $host, $path |
34 | - $tmp = parse_url( $base ); |
|
35 | - extract( $tmp ); |
|
36 | - if ( strpos( $rel,"//" ) === 0 ) { |
|
37 | - return $scheme . ':' . $rel; |
|
34 | + $tmp = parse_url($base); |
|
35 | + extract($tmp); |
|
36 | + if (strpos($rel, "//") === 0) { |
|
37 | + return $scheme.':'.$rel; |
|
38 | 38 | } |
39 | 39 | // return if already absolute URL |
40 | - if ( parse_url( $rel, PHP_URL_SCHEME ) != '' ) { |
|
40 | + if (parse_url($rel, PHP_URL_SCHEME) != '') { |
|
41 | 41 | return $rel; |
42 | 42 | } |
43 | 43 | // queries and anchors |
44 | - if ( $rel[0] == '#' || $rel[0] == '?' ) { |
|
45 | - return $base . $rel; |
|
44 | + if ($rel[0] == '#' || $rel[0] == '?') { |
|
45 | + return $base.$rel; |
|
46 | 46 | } |
47 | 47 | // remove non-directory element from path |
48 | - $path = preg_replace( '#/[^/]*$#', '', $path ); |
|
48 | + $path = preg_replace('#/[^/]*$#', '', $path); |
|
49 | 49 | // destroy path if relative url points to root |
50 | - if ( $rel[0] == '/' ) { |
|
50 | + if ($rel[0] == '/') { |
|
51 | 51 | $path = ''; |
52 | 52 | } |
53 | 53 | // dirty absolute URL |
54 | - $abs = $host . $path . "/" . $rel; |
|
54 | + $abs = $host.$path."/".$rel; |
|
55 | 55 | // replace '//' or '/./' or '/foo/../' with '/' |
56 | - $abs = preg_replace( "/(\/\.?\/)/", "/", $abs ); |
|
57 | - $abs = preg_replace( "/\/(?!\.\.)[^\/]+\/\.\.\//", "/", $abs ); |
|
56 | + $abs = preg_replace("/(\/\.?\/)/", "/", $abs); |
|
57 | + $abs = preg_replace("/\/(?!\.\.)[^\/]+\/\.\.\//", "/", $abs); |
|
58 | 58 | // absolute URL is ready! |
59 | - return $scheme . '://' . $abs; |
|
59 | + return $scheme.'://'.$abs; |
|
60 | 60 | } |
61 | 61 | $feedData = array(); |
62 | 62 | |
@@ -64,15 +64,15 @@ discard block |
||
64 | 64 | foreach ($urls as $section=>$url) { |
65 | 65 | $output = ''; |
66 | 66 | $rss = @fetch_rss($url); |
67 | - if( !$rss ){ |
|
68 | - $feedData[$section] = 'Failed to retrieve ' . $url; |
|
67 | + if (!$rss) { |
|
68 | + $feedData[$section] = 'Failed to retrieve '.$url; |
|
69 | 69 | continue; |
70 | 70 | } |
71 | 71 | $output .= '<ul>'; |
72 | 72 | |
73 | 73 | $items = array_slice($rss->items, 0, $itemsNumber); |
74 | 74 | foreach ($items as $item) { |
75 | - $href = rel2abs($item['link'],'https://github.com'); |
|
75 | + $href = rel2abs($item['link'], 'https://github.com'); |
|
76 | 76 | $title = $item['title']; |
77 | 77 | $pubdate = $item['pubdate']; |
78 | 78 | $pubdate = $modx->toDateFormat(strtotime($pubdate)); |
@@ -29,7 +29,8 @@ discard block |
||
29 | 29 | // include MagPieRSS |
30 | 30 | require_once(MODX_MANAGER_PATH.'media/rss/rss_fetch.inc'); |
31 | 31 | // Convert relative path into absolute url |
32 | -function rel2abs( $rel, $base ) { |
|
32 | +function rel2abs( $rel, $base ) |
|
33 | +{ |
|
33 | 34 | // parse base URL and convert to local variables: $scheme, $host, $path |
34 | 35 | $tmp = parse_url( $base ); |
35 | 36 | extract( $tmp ); |
@@ -64,7 +65,7 @@ discard block |
||
64 | 65 | foreach ($urls as $section=>$url) { |
65 | 66 | $output = ''; |
66 | 67 | $rss = @fetch_rss($url); |
67 | - if( !$rss ){ |
|
68 | + if( !$rss ) { |
|
68 | 69 | $feedData[$section] = 'Failed to retrieve ' . $url; |
69 | 70 | continue; |
70 | 71 | } |
@@ -7,366 +7,366 @@ |
||
7 | 7 | // Added by Raymond 20-Jan-2005 |
8 | 8 | function getTVDisplayFormat($name, $value, $format, $paramstring = "", $tvtype = "", $docid = "", $sep = '') { |
9 | 9 | |
10 | - global $modx; |
|
10 | + global $modx; |
|
11 | 11 | $o = ''; |
12 | 12 | |
13 | 13 | // process any TV commands in value |
14 | - $docid = (int)$docid > 0 ? (int)$docid : $modx->documentIdentifier; |
|
15 | - $value = ProcessTVCommand($value, $name, $docid); |
|
14 | + $docid = (int)$docid > 0 ? (int)$docid : $modx->documentIdentifier; |
|
15 | + $value = ProcessTVCommand($value, $name, $docid); |
|
16 | 16 | |
17 | - $params = array(); |
|
18 | - if($paramstring) { |
|
19 | - $cp = explode("&", $paramstring); |
|
20 | - foreach($cp as $p => $v) { |
|
21 | - $v = trim($v); // trim |
|
22 | - $ar = explode("=", $v); |
|
23 | - if(is_array($ar) && count($ar) == 2) { |
|
24 | - $params[$ar[0]] = decodeParamValue($ar[1]); |
|
25 | - } |
|
26 | - } |
|
27 | - } |
|
17 | + $params = array(); |
|
18 | + if($paramstring) { |
|
19 | + $cp = explode("&", $paramstring); |
|
20 | + foreach($cp as $p => $v) { |
|
21 | + $v = trim($v); // trim |
|
22 | + $ar = explode("=", $v); |
|
23 | + if(is_array($ar) && count($ar) == 2) { |
|
24 | + $params[$ar[0]] = decodeParamValue($ar[1]); |
|
25 | + } |
|
26 | + } |
|
27 | + } |
|
28 | 28 | |
29 | - $id = "tv$name"; |
|
30 | - switch($format) { |
|
31 | - case 'image': |
|
32 | - $images = parseInput($value, '||', 'array'); |
|
33 | - foreach($images as $image) { |
|
34 | - if(!is_array($image)) { |
|
35 | - $image = explode('==', $image); |
|
36 | - } |
|
37 | - $src = $image[0]; |
|
29 | + $id = "tv$name"; |
|
30 | + switch($format) { |
|
31 | + case 'image': |
|
32 | + $images = parseInput($value, '||', 'array'); |
|
33 | + foreach($images as $image) { |
|
34 | + if(!is_array($image)) { |
|
35 | + $image = explode('==', $image); |
|
36 | + } |
|
37 | + $src = $image[0]; |
|
38 | 38 | |
39 | - if($src) { |
|
40 | - // We have a valid source |
|
41 | - $attributes = ''; |
|
42 | - $attr = array( |
|
43 | - 'class' => $params['class'], |
|
44 | - 'src' => $src, |
|
45 | - 'id' => ($params['id'] ? $params['id'] : ''), |
|
46 | - 'alt' => $modx->htmlspecialchars($params['alttext']), |
|
47 | - 'style' => $params['style'] |
|
48 | - ); |
|
49 | - if(isset($params['align']) && $params['align'] != 'none') { |
|
50 | - $attr['align'] = $params['align']; |
|
51 | - } |
|
52 | - foreach($attr as $k => $v) $attributes .= ($v ? ' ' . $k . '="' . $v . '"' : ''); |
|
53 | - $attributes .= ' ' . $params['attrib']; |
|
39 | + if($src) { |
|
40 | + // We have a valid source |
|
41 | + $attributes = ''; |
|
42 | + $attr = array( |
|
43 | + 'class' => $params['class'], |
|
44 | + 'src' => $src, |
|
45 | + 'id' => ($params['id'] ? $params['id'] : ''), |
|
46 | + 'alt' => $modx->htmlspecialchars($params['alttext']), |
|
47 | + 'style' => $params['style'] |
|
48 | + ); |
|
49 | + if(isset($params['align']) && $params['align'] != 'none') { |
|
50 | + $attr['align'] = $params['align']; |
|
51 | + } |
|
52 | + foreach($attr as $k => $v) $attributes .= ($v ? ' ' . $k . '="' . $v . '"' : ''); |
|
53 | + $attributes .= ' ' . $params['attrib']; |
|
54 | 54 | |
55 | - // Output the image with attributes |
|
56 | - $o .= '<img' . rtrim($attributes) . ' />'; |
|
57 | - } |
|
58 | - } |
|
59 | - break; |
|
55 | + // Output the image with attributes |
|
56 | + $o .= '<img' . rtrim($attributes) . ' />'; |
|
57 | + } |
|
58 | + } |
|
59 | + break; |
|
60 | 60 | |
61 | - case "delim": // display as delimitted list |
|
62 | - $value = parseInput($value, "||"); |
|
63 | - $p = $params['format'] ? $params['format'] : " "; |
|
64 | - if($p == "\\n") { |
|
65 | - $p = "\n"; |
|
66 | - } |
|
67 | - $o = str_replace("||", $p, $value); |
|
68 | - break; |
|
61 | + case "delim": // display as delimitted list |
|
62 | + $value = parseInput($value, "||"); |
|
63 | + $p = $params['format'] ? $params['format'] : " "; |
|
64 | + if($p == "\\n") { |
|
65 | + $p = "\n"; |
|
66 | + } |
|
67 | + $o = str_replace("||", $p, $value); |
|
68 | + break; |
|
69 | 69 | |
70 | - case "string": |
|
71 | - $value = parseInput($value); |
|
72 | - $format = strtolower($params['format']); |
|
73 | - if($format == 'upper case') { |
|
74 | - $o = strtoupper($value); |
|
75 | - } else if($format == 'lower case') { |
|
76 | - $o = strtolower($value); |
|
77 | - } else if($format == 'sentence case') { |
|
78 | - $o = ucfirst($value); |
|
79 | - } else if($format == 'capitalize') { |
|
80 | - $o = ucwords($value); |
|
81 | - } else { |
|
82 | - $o = $value; |
|
83 | - } |
|
84 | - break; |
|
70 | + case "string": |
|
71 | + $value = parseInput($value); |
|
72 | + $format = strtolower($params['format']); |
|
73 | + if($format == 'upper case') { |
|
74 | + $o = strtoupper($value); |
|
75 | + } else if($format == 'lower case') { |
|
76 | + $o = strtolower($value); |
|
77 | + } else if($format == 'sentence case') { |
|
78 | + $o = ucfirst($value); |
|
79 | + } else if($format == 'capitalize') { |
|
80 | + $o = ucwords($value); |
|
81 | + } else { |
|
82 | + $o = $value; |
|
83 | + } |
|
84 | + break; |
|
85 | 85 | |
86 | - case "date": |
|
87 | - if($value != '' || $params['default'] == 'Yes') { |
|
88 | - if(empty($value)) { |
|
89 | - $value = 'now'; |
|
90 | - } |
|
91 | - $timestamp = getUnixtimeFromDateString($value); |
|
92 | - $p = $params['format'] ? $params['format'] : "%A %d, %B %Y"; |
|
93 | - $o = strftime($p, $timestamp); |
|
94 | - } else { |
|
95 | - $value = ''; |
|
96 | - } |
|
97 | - break; |
|
86 | + case "date": |
|
87 | + if($value != '' || $params['default'] == 'Yes') { |
|
88 | + if(empty($value)) { |
|
89 | + $value = 'now'; |
|
90 | + } |
|
91 | + $timestamp = getUnixtimeFromDateString($value); |
|
92 | + $p = $params['format'] ? $params['format'] : "%A %d, %B %Y"; |
|
93 | + $o = strftime($p, $timestamp); |
|
94 | + } else { |
|
95 | + $value = ''; |
|
96 | + } |
|
97 | + break; |
|
98 | 98 | |
99 | - case "hyperlink": |
|
100 | - $value = parseInput($value, "||", "array"); |
|
101 | - $o = ''; |
|
102 | - $countValue = count($value); |
|
103 | - for($i = 0; $i < $countValue; $i++) { |
|
104 | - list($name, $url) = is_array($value[$i]) ? $value[$i] : explode("==", $value[$i]); |
|
105 | - if(!$url) { |
|
106 | - $url = $name; |
|
107 | - } |
|
108 | - if($url) { |
|
109 | - if($o) { |
|
110 | - $o .= '<br />'; |
|
111 | - } |
|
112 | - $attributes = ''; |
|
113 | - // setup the link attributes |
|
114 | - $attr = array( |
|
115 | - 'href' => $url, |
|
116 | - 'title' => $params['title'] ? $modx->htmlspecialchars($params['title']) : $name, |
|
117 | - 'class' => $params['class'], |
|
118 | - 'style' => $params['style'], |
|
119 | - 'target' => $params['target'], |
|
120 | - ); |
|
121 | - foreach($attr as $k => $v) $attributes .= ($v ? ' ' . $k . '="' . $v . '"' : ''); |
|
122 | - $attributes .= ' ' . $params['attrib']; // add extra |
|
99 | + case "hyperlink": |
|
100 | + $value = parseInput($value, "||", "array"); |
|
101 | + $o = ''; |
|
102 | + $countValue = count($value); |
|
103 | + for($i = 0; $i < $countValue; $i++) { |
|
104 | + list($name, $url) = is_array($value[$i]) ? $value[$i] : explode("==", $value[$i]); |
|
105 | + if(!$url) { |
|
106 | + $url = $name; |
|
107 | + } |
|
108 | + if($url) { |
|
109 | + if($o) { |
|
110 | + $o .= '<br />'; |
|
111 | + } |
|
112 | + $attributes = ''; |
|
113 | + // setup the link attributes |
|
114 | + $attr = array( |
|
115 | + 'href' => $url, |
|
116 | + 'title' => $params['title'] ? $modx->htmlspecialchars($params['title']) : $name, |
|
117 | + 'class' => $params['class'], |
|
118 | + 'style' => $params['style'], |
|
119 | + 'target' => $params['target'], |
|
120 | + ); |
|
121 | + foreach($attr as $k => $v) $attributes .= ($v ? ' ' . $k . '="' . $v . '"' : ''); |
|
122 | + $attributes .= ' ' . $params['attrib']; // add extra |
|
123 | 123 | |
124 | - // Output the link |
|
125 | - $o .= '<a' . rtrim($attributes) . '>' . ($params['text'] ? $modx->htmlspecialchars($params['text']) : $name) . '</a>'; |
|
126 | - } |
|
127 | - } |
|
128 | - break; |
|
124 | + // Output the link |
|
125 | + $o .= '<a' . rtrim($attributes) . '>' . ($params['text'] ? $modx->htmlspecialchars($params['text']) : $name) . '</a>'; |
|
126 | + } |
|
127 | + } |
|
128 | + break; |
|
129 | 129 | |
130 | - case "htmltag": |
|
131 | - $value = parseInput($value, "||", "array"); |
|
132 | - $tagid = $params['tagid']; |
|
133 | - $tagname = ($params['tagname']) ? $params['tagname'] : 'div'; |
|
134 | - $o = ''; |
|
135 | - // Loop through a list of tags |
|
130 | + case "htmltag": |
|
131 | + $value = parseInput($value, "||", "array"); |
|
132 | + $tagid = $params['tagid']; |
|
133 | + $tagname = ($params['tagname']) ? $params['tagname'] : 'div'; |
|
134 | + $o = ''; |
|
135 | + // Loop through a list of tags |
|
136 | 136 | $countValue = count($value); |
137 | - for($i = 0; $i < $countValue; $i++) { |
|
138 | - $tagvalue = is_array($value[$i]) ? implode(' ', $value[$i]) : $value[$i]; |
|
139 | - if(!$tagvalue) { |
|
140 | - continue; |
|
141 | - } |
|
137 | + for($i = 0; $i < $countValue; $i++) { |
|
138 | + $tagvalue = is_array($value[$i]) ? implode(' ', $value[$i]) : $value[$i]; |
|
139 | + if(!$tagvalue) { |
|
140 | + continue; |
|
141 | + } |
|
142 | 142 | |
143 | - $attributes = ''; |
|
144 | - $attr = array( |
|
145 | - 'id' => ($tagid ? $tagid : $id), |
|
146 | - // 'tv' already added to id |
|
147 | - 'class' => $params['class'], |
|
148 | - 'style' => $params['style'], |
|
149 | - ); |
|
150 | - foreach($attr as $k => $v) $attributes .= ($v ? ' ' . $k . '="' . $v . '"' : ''); |
|
151 | - $attributes .= ' ' . $params['attrib']; // add extra |
|
143 | + $attributes = ''; |
|
144 | + $attr = array( |
|
145 | + 'id' => ($tagid ? $tagid : $id), |
|
146 | + // 'tv' already added to id |
|
147 | + 'class' => $params['class'], |
|
148 | + 'style' => $params['style'], |
|
149 | + ); |
|
150 | + foreach($attr as $k => $v) $attributes .= ($v ? ' ' . $k . '="' . $v . '"' : ''); |
|
151 | + $attributes .= ' ' . $params['attrib']; // add extra |
|
152 | 152 | |
153 | - // Output the HTML Tag |
|
154 | - $o .= '<' . $tagname . rtrim($attributes) . '>' . $tagvalue . '</' . $tagname . '>'; |
|
155 | - } |
|
156 | - break; |
|
153 | + // Output the HTML Tag |
|
154 | + $o .= '<' . $tagname . rtrim($attributes) . '>' . $tagvalue . '</' . $tagname . '>'; |
|
155 | + } |
|
156 | + break; |
|
157 | 157 | |
158 | - case "richtext": |
|
159 | - $value = parseInput($value); |
|
160 | - $w = $params['w'] ? $params['w'] : '100%'; |
|
161 | - $h = $params['h'] ? $params['h'] : '400px'; |
|
162 | - $richtexteditor = $params['edt'] ? $params['edt'] : ""; |
|
163 | - $o = '<div class="MODX_RichTextWidget"><textarea id="' . $id . '" name="' . $id . '" style="width:' . $w . '; height:' . $h . ';">'; |
|
164 | - $o .= $modx->htmlspecialchars($value); |
|
165 | - $o .= '</textarea></div>'; |
|
166 | - $replace_richtext = array($id); |
|
167 | - // setup editors |
|
168 | - if(!empty($replace_richtext) && !empty($richtexteditor)) { |
|
169 | - // invoke OnRichTextEditorInit event |
|
170 | - $evtOut = $modx->invokeEvent("OnRichTextEditorInit", array( |
|
171 | - 'editor' => $richtexteditor, |
|
172 | - 'elements' => $replace_richtext, |
|
173 | - 'forfrontend' => 1, |
|
174 | - 'width' => $w, |
|
175 | - 'height' => $h |
|
176 | - )); |
|
177 | - if(is_array($evtOut)) { |
|
178 | - $o .= implode("", $evtOut); |
|
179 | - } |
|
180 | - } |
|
181 | - break; |
|
158 | + case "richtext": |
|
159 | + $value = parseInput($value); |
|
160 | + $w = $params['w'] ? $params['w'] : '100%'; |
|
161 | + $h = $params['h'] ? $params['h'] : '400px'; |
|
162 | + $richtexteditor = $params['edt'] ? $params['edt'] : ""; |
|
163 | + $o = '<div class="MODX_RichTextWidget"><textarea id="' . $id . '" name="' . $id . '" style="width:' . $w . '; height:' . $h . ';">'; |
|
164 | + $o .= $modx->htmlspecialchars($value); |
|
165 | + $o .= '</textarea></div>'; |
|
166 | + $replace_richtext = array($id); |
|
167 | + // setup editors |
|
168 | + if(!empty($replace_richtext) && !empty($richtexteditor)) { |
|
169 | + // invoke OnRichTextEditorInit event |
|
170 | + $evtOut = $modx->invokeEvent("OnRichTextEditorInit", array( |
|
171 | + 'editor' => $richtexteditor, |
|
172 | + 'elements' => $replace_richtext, |
|
173 | + 'forfrontend' => 1, |
|
174 | + 'width' => $w, |
|
175 | + 'height' => $h |
|
176 | + )); |
|
177 | + if(is_array($evtOut)) { |
|
178 | + $o .= implode("", $evtOut); |
|
179 | + } |
|
180 | + } |
|
181 | + break; |
|
182 | 182 | |
183 | - case "unixtime": |
|
184 | - $value = parseInput($value); |
|
185 | - $o = getUnixtimeFromDateString($value); |
|
186 | - break; |
|
183 | + case "unixtime": |
|
184 | + $value = parseInput($value); |
|
185 | + $o = getUnixtimeFromDateString($value); |
|
186 | + break; |
|
187 | 187 | |
188 | - case "viewport": |
|
189 | - $value = parseInput($value); |
|
190 | - $id = '_' . time(); |
|
191 | - if(!$params['vpid']) { |
|
192 | - $params['vpid'] = $id; |
|
193 | - } |
|
194 | - $sTag = "<iframe"; |
|
195 | - $eTag = "</iframe>"; |
|
196 | - $autoMode = "0"; |
|
197 | - $w = $params['width']; |
|
198 | - $h = $params['height']; |
|
199 | - if($params['stretch'] == 'Yes') { |
|
200 | - $w = "100%"; |
|
201 | - $h = "100%"; |
|
202 | - } |
|
203 | - if($params['asize'] == 'Yes' || ($params['awidth'] == 'Yes' && $params['aheight'] == 'Yes')) { |
|
204 | - $autoMode = "3"; //both |
|
205 | - } else if($params['awidth'] == 'Yes') { |
|
206 | - $autoMode = "1"; //width only |
|
207 | - } else if($params['aheight'] == 'Yes') { |
|
208 | - $autoMode = "2"; //height only |
|
209 | - } |
|
188 | + case "viewport": |
|
189 | + $value = parseInput($value); |
|
190 | + $id = '_' . time(); |
|
191 | + if(!$params['vpid']) { |
|
192 | + $params['vpid'] = $id; |
|
193 | + } |
|
194 | + $sTag = "<iframe"; |
|
195 | + $eTag = "</iframe>"; |
|
196 | + $autoMode = "0"; |
|
197 | + $w = $params['width']; |
|
198 | + $h = $params['height']; |
|
199 | + if($params['stretch'] == 'Yes') { |
|
200 | + $w = "100%"; |
|
201 | + $h = "100%"; |
|
202 | + } |
|
203 | + if($params['asize'] == 'Yes' || ($params['awidth'] == 'Yes' && $params['aheight'] == 'Yes')) { |
|
204 | + $autoMode = "3"; //both |
|
205 | + } else if($params['awidth'] == 'Yes') { |
|
206 | + $autoMode = "1"; //width only |
|
207 | + } else if($params['aheight'] == 'Yes') { |
|
208 | + $autoMode = "2"; //height only |
|
209 | + } |
|
210 | 210 | |
211 | - $modx->regClientStartupScript(MODX_MANAGER_URL . "media/script/bin/viewport.js", array( |
|
212 | - 'name' => 'viewport', |
|
213 | - 'version' => '0', |
|
214 | - 'plaintext' => false |
|
215 | - )); |
|
216 | - $o = $sTag . " id='" . $params['vpid'] . "' name='" . $params['vpid'] . "' "; |
|
217 | - if($params['class']) { |
|
218 | - $o .= " class='" . $params['class'] . "' "; |
|
219 | - } |
|
220 | - if($params['style']) { |
|
221 | - $o .= " style='" . $params['style'] . "' "; |
|
222 | - } |
|
223 | - if($params['attrib']) { |
|
224 | - $o .= $params['attrib'] . " "; |
|
225 | - } |
|
226 | - $o .= "scrolling='" . ($params['sbar'] == 'No' ? "no" : ($params['sbar'] == 'Yes' ? "yes" : "auto")) . "' "; |
|
227 | - $o .= "src='" . $value . "' frameborder='" . $params['borsize'] . "' "; |
|
228 | - $o .= "onload=\"window.setTimeout('ResizeViewPort(\\'" . $params['vpid'] . "\\'," . $autoMode . ")',100);\" width='" . $w . "' height='" . $h . "' "; |
|
229 | - $o .= ">"; |
|
230 | - $o .= $eTag; |
|
231 | - break; |
|
211 | + $modx->regClientStartupScript(MODX_MANAGER_URL . "media/script/bin/viewport.js", array( |
|
212 | + 'name' => 'viewport', |
|
213 | + 'version' => '0', |
|
214 | + 'plaintext' => false |
|
215 | + )); |
|
216 | + $o = $sTag . " id='" . $params['vpid'] . "' name='" . $params['vpid'] . "' "; |
|
217 | + if($params['class']) { |
|
218 | + $o .= " class='" . $params['class'] . "' "; |
|
219 | + } |
|
220 | + if($params['style']) { |
|
221 | + $o .= " style='" . $params['style'] . "' "; |
|
222 | + } |
|
223 | + if($params['attrib']) { |
|
224 | + $o .= $params['attrib'] . " "; |
|
225 | + } |
|
226 | + $o .= "scrolling='" . ($params['sbar'] == 'No' ? "no" : ($params['sbar'] == 'Yes' ? "yes" : "auto")) . "' "; |
|
227 | + $o .= "src='" . $value . "' frameborder='" . $params['borsize'] . "' "; |
|
228 | + $o .= "onload=\"window.setTimeout('ResizeViewPort(\\'" . $params['vpid'] . "\\'," . $autoMode . ")',100);\" width='" . $w . "' height='" . $h . "' "; |
|
229 | + $o .= ">"; |
|
230 | + $o .= $eTag; |
|
231 | + break; |
|
232 | 232 | |
233 | - case "datagrid": |
|
234 | - include_once MODX_MANAGER_PATH . "includes/controls/datagrid.class.php"; |
|
235 | - $grd = new DataGrid('', $value); |
|
233 | + case "datagrid": |
|
234 | + include_once MODX_MANAGER_PATH . "includes/controls/datagrid.class.php"; |
|
235 | + $grd = new DataGrid('', $value); |
|
236 | 236 | |
237 | - $grd->noRecordMsg = $params['egmsg']; |
|
237 | + $grd->noRecordMsg = $params['egmsg']; |
|
238 | 238 | |
239 | - $grd->columnHeaderClass = $params['chdrc']; |
|
240 | - $grd->cssClass = $params['tblc']; |
|
241 | - $grd->itemClass = $params['itmc']; |
|
242 | - $grd->altItemClass = $params['aitmc']; |
|
239 | + $grd->columnHeaderClass = $params['chdrc']; |
|
240 | + $grd->cssClass = $params['tblc']; |
|
241 | + $grd->itemClass = $params['itmc']; |
|
242 | + $grd->altItemClass = $params['aitmc']; |
|
243 | 243 | |
244 | - $grd->columnHeaderStyle = $params['chdrs']; |
|
245 | - $grd->cssStyle = $params['tbls']; |
|
246 | - $grd->itemStyle = $params['itms']; |
|
247 | - $grd->altItemStyle = $params['aitms']; |
|
244 | + $grd->columnHeaderStyle = $params['chdrs']; |
|
245 | + $grd->cssStyle = $params['tbls']; |
|
246 | + $grd->itemStyle = $params['itms']; |
|
247 | + $grd->altItemStyle = $params['aitms']; |
|
248 | 248 | |
249 | - $grd->columns = $params['cols']; |
|
250 | - $grd->fields = $params['flds']; |
|
251 | - $grd->colWidths = $params['cwidth']; |
|
252 | - $grd->colAligns = $params['calign']; |
|
253 | - $grd->colColors = $params['ccolor']; |
|
254 | - $grd->colTypes = $params['ctype']; |
|
249 | + $grd->columns = $params['cols']; |
|
250 | + $grd->fields = $params['flds']; |
|
251 | + $grd->colWidths = $params['cwidth']; |
|
252 | + $grd->colAligns = $params['calign']; |
|
253 | + $grd->colColors = $params['ccolor']; |
|
254 | + $grd->colTypes = $params['ctype']; |
|
255 | 255 | |
256 | - $grd->cellPadding = $params['cpad']; |
|
257 | - $grd->cellSpacing = $params['cspace']; |
|
258 | - $grd->header = $params['head']; |
|
259 | - $grd->footer = $params['foot']; |
|
260 | - $grd->pageSize = $params['psize']; |
|
261 | - $grd->pagerLocation = $params['ploc']; |
|
262 | - $grd->pagerClass = $params['pclass']; |
|
263 | - $grd->pagerStyle = $params['pstyle']; |
|
264 | - $o = $grd->render(); |
|
265 | - break; |
|
256 | + $grd->cellPadding = $params['cpad']; |
|
257 | + $grd->cellSpacing = $params['cspace']; |
|
258 | + $grd->header = $params['head']; |
|
259 | + $grd->footer = $params['foot']; |
|
260 | + $grd->pageSize = $params['psize']; |
|
261 | + $grd->pagerLocation = $params['ploc']; |
|
262 | + $grd->pagerClass = $params['pclass']; |
|
263 | + $grd->pagerStyle = $params['pstyle']; |
|
264 | + $o = $grd->render(); |
|
265 | + break; |
|
266 | 266 | |
267 | - case 'htmlentities': |
|
268 | - $value = parseInput($value); |
|
269 | - if($tvtype == 'checkbox' || $tvtype == 'listbox-multiple') { |
|
270 | - // remove delimiter from checkbox and listbox-multiple TVs |
|
271 | - $value = str_replace('||', '', $value); |
|
272 | - } |
|
273 | - $o = htmlentities($value, ENT_NOQUOTES, $modx->config['modx_charset']); |
|
274 | - break; |
|
267 | + case 'htmlentities': |
|
268 | + $value = parseInput($value); |
|
269 | + if($tvtype == 'checkbox' || $tvtype == 'listbox-multiple') { |
|
270 | + // remove delimiter from checkbox and listbox-multiple TVs |
|
271 | + $value = str_replace('||', '', $value); |
|
272 | + } |
|
273 | + $o = htmlentities($value, ENT_NOQUOTES, $modx->config['modx_charset']); |
|
274 | + break; |
|
275 | 275 | |
276 | - case 'custom_widget': |
|
277 | - $widget_output = ''; |
|
278 | - $o = ''; |
|
279 | - /* If we are loading a file */ |
|
280 | - if(substr($params['output'], 0, 5) == "@FILE") { |
|
281 | - $file_name = MODX_BASE_PATH . trim(substr($params['output'], 6)); |
|
282 | - if(!file_exists($file_name)) { |
|
283 | - $widget_output = $file_name . ' does not exist'; |
|
284 | - } else { |
|
285 | - $widget_output = file_get_contents($file_name); |
|
286 | - } |
|
287 | - } elseif(substr($params['output'], 0, 8) == '@INCLUDE') { |
|
288 | - $file_name = MODX_BASE_PATH . trim(substr($params['output'], 9)); |
|
289 | - if(!file_exists($file_name)) { |
|
290 | - $widget_output = $file_name . ' does not exist'; |
|
291 | - } else { |
|
292 | - /* The included file needs to set $widget_output. Can be string, array, object */ |
|
293 | - include $file_name; |
|
294 | - } |
|
295 | - } elseif(substr($params['output'], 0, 6) == '@CHUNK' && $value !== '') { |
|
296 | - $chunk_name = trim(substr($params['output'], 7)); |
|
297 | - $widget_output = $modx->getChunk($chunk_name); |
|
298 | - } elseif(substr($params['output'], 0, 5) == '@EVAL' && $value !== '') { |
|
299 | - $eval_str = trim(substr($params['output'], 6)); |
|
300 | - $widget_output = eval($eval_str); |
|
301 | - } elseif($value !== '') { |
|
302 | - $widget_output = $params['output']; |
|
303 | - } else { |
|
304 | - $widget_output = ''; |
|
305 | - } |
|
306 | - if(is_string($widget_output)) { |
|
307 | - $_ = $modx->config['enable_filter']; |
|
308 | - $modx->config['enable_filter'] = 1; |
|
309 | - $widget_output = $modx->parseText($widget_output, array('value' => $value)); |
|
310 | - $modx->config['enable_filter'] = $_; |
|
311 | - $o = $modx->parseDocumentSource($widget_output); |
|
312 | - } else { |
|
313 | - $o = $widget_output; |
|
314 | - } |
|
315 | - break; |
|
276 | + case 'custom_widget': |
|
277 | + $widget_output = ''; |
|
278 | + $o = ''; |
|
279 | + /* If we are loading a file */ |
|
280 | + if(substr($params['output'], 0, 5) == "@FILE") { |
|
281 | + $file_name = MODX_BASE_PATH . trim(substr($params['output'], 6)); |
|
282 | + if(!file_exists($file_name)) { |
|
283 | + $widget_output = $file_name . ' does not exist'; |
|
284 | + } else { |
|
285 | + $widget_output = file_get_contents($file_name); |
|
286 | + } |
|
287 | + } elseif(substr($params['output'], 0, 8) == '@INCLUDE') { |
|
288 | + $file_name = MODX_BASE_PATH . trim(substr($params['output'], 9)); |
|
289 | + if(!file_exists($file_name)) { |
|
290 | + $widget_output = $file_name . ' does not exist'; |
|
291 | + } else { |
|
292 | + /* The included file needs to set $widget_output. Can be string, array, object */ |
|
293 | + include $file_name; |
|
294 | + } |
|
295 | + } elseif(substr($params['output'], 0, 6) == '@CHUNK' && $value !== '') { |
|
296 | + $chunk_name = trim(substr($params['output'], 7)); |
|
297 | + $widget_output = $modx->getChunk($chunk_name); |
|
298 | + } elseif(substr($params['output'], 0, 5) == '@EVAL' && $value !== '') { |
|
299 | + $eval_str = trim(substr($params['output'], 6)); |
|
300 | + $widget_output = eval($eval_str); |
|
301 | + } elseif($value !== '') { |
|
302 | + $widget_output = $params['output']; |
|
303 | + } else { |
|
304 | + $widget_output = ''; |
|
305 | + } |
|
306 | + if(is_string($widget_output)) { |
|
307 | + $_ = $modx->config['enable_filter']; |
|
308 | + $modx->config['enable_filter'] = 1; |
|
309 | + $widget_output = $modx->parseText($widget_output, array('value' => $value)); |
|
310 | + $modx->config['enable_filter'] = $_; |
|
311 | + $o = $modx->parseDocumentSource($widget_output); |
|
312 | + } else { |
|
313 | + $o = $widget_output; |
|
314 | + } |
|
315 | + break; |
|
316 | 316 | |
317 | - default: |
|
318 | - $value = parseInput($value); |
|
319 | - if($tvtype == 'checkbox' || $tvtype == 'listbox-multiple') { |
|
320 | - // add separator |
|
321 | - $value = explode('||', $value); |
|
322 | - $value = implode($sep, $value); |
|
323 | - } |
|
324 | - $o = $value; |
|
325 | - break; |
|
326 | - } |
|
327 | - return $o; |
|
317 | + default: |
|
318 | + $value = parseInput($value); |
|
319 | + if($tvtype == 'checkbox' || $tvtype == 'listbox-multiple') { |
|
320 | + // add separator |
|
321 | + $value = explode('||', $value); |
|
322 | + $value = implode($sep, $value); |
|
323 | + } |
|
324 | + $o = $value; |
|
325 | + break; |
|
326 | + } |
|
327 | + return $o; |
|
328 | 328 | } |
329 | 329 | |
330 | 330 | function decodeParamValue($s) { |
331 | - $s = str_replace("%3D", '=', $s); // = |
|
332 | - $s = str_replace("%26", '&', $s); // & |
|
333 | - return $s; |
|
331 | + $s = str_replace("%3D", '=', $s); // = |
|
332 | + $s = str_replace("%26", '&', $s); // & |
|
333 | + return $s; |
|
334 | 334 | } |
335 | 335 | |
336 | 336 | // returns an array if a delimiter is present. returns array is a recordset is present |
337 | 337 | function parseInput($src, $delim = "||", $type = "string", $columns = true) { // type can be: string, array |
338 | - global $modx; |
|
339 | - if($modx->db->isResult($src)) { |
|
340 | - // must be a recordset |
|
341 | - $rows = array(); |
|
342 | - while($cols = $modx->db->getRow($src, 'num')) $rows[] = ($columns) ? $cols : implode(" ", $cols); |
|
343 | - return ($type == "array") ? $rows : implode($delim, $rows); |
|
344 | - } else { |
|
345 | - // must be a text |
|
346 | - if($type == "array") { |
|
347 | - return explode($delim, $src); |
|
348 | - } else { |
|
349 | - return $src; |
|
350 | - } |
|
351 | - } |
|
338 | + global $modx; |
|
339 | + if($modx->db->isResult($src)) { |
|
340 | + // must be a recordset |
|
341 | + $rows = array(); |
|
342 | + while($cols = $modx->db->getRow($src, 'num')) $rows[] = ($columns) ? $cols : implode(" ", $cols); |
|
343 | + return ($type == "array") ? $rows : implode($delim, $rows); |
|
344 | + } else { |
|
345 | + // must be a text |
|
346 | + if($type == "array") { |
|
347 | + return explode($delim, $src); |
|
348 | + } else { |
|
349 | + return $src; |
|
350 | + } |
|
351 | + } |
|
352 | 352 | } |
353 | 353 | |
354 | 354 | function getUnixtimeFromDateString($value) { |
355 | - $timestamp = false; |
|
356 | - // Check for MySQL or legacy style date |
|
357 | - $date_match_1 = '/^([0-9]{2})-([0-9]{2})-([0-9]{4})\ ([0-9]{2}):([0-9]{2}):([0-9]{2})$/'; |
|
358 | - $date_match_2 = '/^([0-9]{4})-([0-9]{2})-([0-9]{2})\ ([0-9]{2}):([0-9]{2}):([0-9]{2})$/'; |
|
359 | - $matches = array(); |
|
360 | - if(strpos($value, '-') !== false) { |
|
361 | - if(preg_match($date_match_1, $value, $matches)) { |
|
362 | - $timestamp = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[1], $matches[3]); |
|
363 | - } elseif(preg_match($date_match_2, $value, $matches)) { |
|
364 | - $timestamp = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]); |
|
365 | - } |
|
366 | - } |
|
367 | - // If those didn't work, use strtotime to figure out the date |
|
368 | - if($timestamp === false || $timestamp === -1) { |
|
369 | - $timestamp = strtotime($value); |
|
370 | - } |
|
371 | - return $timestamp; |
|
355 | + $timestamp = false; |
|
356 | + // Check for MySQL or legacy style date |
|
357 | + $date_match_1 = '/^([0-9]{2})-([0-9]{2})-([0-9]{4})\ ([0-9]{2}):([0-9]{2}):([0-9]{2})$/'; |
|
358 | + $date_match_2 = '/^([0-9]{4})-([0-9]{2})-([0-9]{2})\ ([0-9]{2}):([0-9]{2}):([0-9]{2})$/'; |
|
359 | + $matches = array(); |
|
360 | + if(strpos($value, '-') !== false) { |
|
361 | + if(preg_match($date_match_1, $value, $matches)) { |
|
362 | + $timestamp = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[1], $matches[3]); |
|
363 | + } elseif(preg_match($date_match_2, $value, $matches)) { |
|
364 | + $timestamp = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]); |
|
365 | + } |
|
366 | + } |
|
367 | + // If those didn't work, use strtotime to figure out the date |
|
368 | + if($timestamp === false || $timestamp === -1) { |
|
369 | + $timestamp = strtotime($value); |
|
370 | + } |
|
371 | + return $timestamp; |
|
372 | 372 | } |
@@ -5,38 +5,38 @@ discard block |
||
5 | 5 | */ |
6 | 6 | |
7 | 7 | // Added by Raymond 20-Jan-2005 |
8 | -function getTVDisplayFormat($name, $value, $format, $paramstring = "", $tvtype = "", $docid = "", $sep = '') { |
|
8 | +function getTVDisplayFormat($name, $value, $format, $paramstring = "", $tvtype = "", $docid = "", $sep = ''){ |
|
9 | 9 | |
10 | 10 | global $modx; |
11 | 11 | $o = ''; |
12 | 12 | |
13 | 13 | // process any TV commands in value |
14 | - $docid = (int)$docid > 0 ? (int)$docid : $modx->documentIdentifier; |
|
14 | + $docid = (int) $docid > 0 ? (int) $docid : $modx->documentIdentifier; |
|
15 | 15 | $value = ProcessTVCommand($value, $name, $docid); |
16 | 16 | |
17 | 17 | $params = array(); |
18 | - if($paramstring) { |
|
18 | + if ($paramstring) { |
|
19 | 19 | $cp = explode("&", $paramstring); |
20 | - foreach($cp as $p => $v) { |
|
20 | + foreach ($cp as $p => $v) { |
|
21 | 21 | $v = trim($v); // trim |
22 | 22 | $ar = explode("=", $v); |
23 | - if(is_array($ar) && count($ar) == 2) { |
|
23 | + if (is_array($ar) && count($ar) == 2) { |
|
24 | 24 | $params[$ar[0]] = decodeParamValue($ar[1]); |
25 | 25 | } |
26 | 26 | } |
27 | 27 | } |
28 | 28 | |
29 | 29 | $id = "tv$name"; |
30 | - switch($format) { |
|
30 | + switch ($format) { |
|
31 | 31 | case 'image': |
32 | 32 | $images = parseInput($value, '||', 'array'); |
33 | - foreach($images as $image) { |
|
34 | - if(!is_array($image)) { |
|
33 | + foreach ($images as $image) { |
|
34 | + if (!is_array($image)) { |
|
35 | 35 | $image = explode('==', $image); |
36 | 36 | } |
37 | 37 | $src = $image[0]; |
38 | 38 | |
39 | - if($src) { |
|
39 | + if ($src) { |
|
40 | 40 | // We have a valid source |
41 | 41 | $attributes = ''; |
42 | 42 | $attr = array( |
@@ -46,14 +46,14 @@ discard block |
||
46 | 46 | 'alt' => $modx->htmlspecialchars($params['alttext']), |
47 | 47 | 'style' => $params['style'] |
48 | 48 | ); |
49 | - if(isset($params['align']) && $params['align'] != 'none') { |
|
49 | + if (isset($params['align']) && $params['align'] != 'none') { |
|
50 | 50 | $attr['align'] = $params['align']; |
51 | 51 | } |
52 | - foreach($attr as $k => $v) $attributes .= ($v ? ' ' . $k . '="' . $v . '"' : ''); |
|
53 | - $attributes .= ' ' . $params['attrib']; |
|
52 | + foreach ($attr as $k => $v) $attributes .= ($v ? ' '.$k.'="'.$v.'"' : ''); |
|
53 | + $attributes .= ' '.$params['attrib']; |
|
54 | 54 | |
55 | 55 | // Output the image with attributes |
56 | - $o .= '<img' . rtrim($attributes) . ' />'; |
|
56 | + $o .= '<img'.rtrim($attributes).' />'; |
|
57 | 57 | } |
58 | 58 | } |
59 | 59 | break; |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | case "delim": // display as delimitted list |
62 | 62 | $value = parseInput($value, "||"); |
63 | 63 | $p = $params['format'] ? $params['format'] : " "; |
64 | - if($p == "\\n") { |
|
64 | + if ($p == "\\n") { |
|
65 | 65 | $p = "\n"; |
66 | 66 | } |
67 | 67 | $o = str_replace("||", $p, $value); |
@@ -70,13 +70,13 @@ discard block |
||
70 | 70 | case "string": |
71 | 71 | $value = parseInput($value); |
72 | 72 | $format = strtolower($params['format']); |
73 | - if($format == 'upper case') { |
|
73 | + if ($format == 'upper case') { |
|
74 | 74 | $o = strtoupper($value); |
75 | - } else if($format == 'lower case') { |
|
75 | + } else if ($format == 'lower case') { |
|
76 | 76 | $o = strtolower($value); |
77 | - } else if($format == 'sentence case') { |
|
77 | + } else if ($format == 'sentence case') { |
|
78 | 78 | $o = ucfirst($value); |
79 | - } else if($format == 'capitalize') { |
|
79 | + } else if ($format == 'capitalize') { |
|
80 | 80 | $o = ucwords($value); |
81 | 81 | } else { |
82 | 82 | $o = $value; |
@@ -84,8 +84,8 @@ discard block |
||
84 | 84 | break; |
85 | 85 | |
86 | 86 | case "date": |
87 | - if($value != '' || $params['default'] == 'Yes') { |
|
88 | - if(empty($value)) { |
|
87 | + if ($value != '' || $params['default'] == 'Yes') { |
|
88 | + if (empty($value)) { |
|
89 | 89 | $value = 'now'; |
90 | 90 | } |
91 | 91 | $timestamp = getUnixtimeFromDateString($value); |
@@ -100,13 +100,13 @@ discard block |
||
100 | 100 | $value = parseInput($value, "||", "array"); |
101 | 101 | $o = ''; |
102 | 102 | $countValue = count($value); |
103 | - for($i = 0; $i < $countValue; $i++) { |
|
103 | + for ($i = 0; $i < $countValue; $i++) { |
|
104 | 104 | list($name, $url) = is_array($value[$i]) ? $value[$i] : explode("==", $value[$i]); |
105 | - if(!$url) { |
|
105 | + if (!$url) { |
|
106 | 106 | $url = $name; |
107 | 107 | } |
108 | - if($url) { |
|
109 | - if($o) { |
|
108 | + if ($url) { |
|
109 | + if ($o) { |
|
110 | 110 | $o .= '<br />'; |
111 | 111 | } |
112 | 112 | $attributes = ''; |
@@ -118,11 +118,11 @@ discard block |
||
118 | 118 | 'style' => $params['style'], |
119 | 119 | 'target' => $params['target'], |
120 | 120 | ); |
121 | - foreach($attr as $k => $v) $attributes .= ($v ? ' ' . $k . '="' . $v . '"' : ''); |
|
122 | - $attributes .= ' ' . $params['attrib']; // add extra |
|
121 | + foreach ($attr as $k => $v) $attributes .= ($v ? ' '.$k.'="'.$v.'"' : ''); |
|
122 | + $attributes .= ' '.$params['attrib']; // add extra |
|
123 | 123 | |
124 | 124 | // Output the link |
125 | - $o .= '<a' . rtrim($attributes) . '>' . ($params['text'] ? $modx->htmlspecialchars($params['text']) : $name) . '</a>'; |
|
125 | + $o .= '<a'.rtrim($attributes).'>'.($params['text'] ? $modx->htmlspecialchars($params['text']) : $name).'</a>'; |
|
126 | 126 | } |
127 | 127 | } |
128 | 128 | break; |
@@ -134,9 +134,9 @@ discard block |
||
134 | 134 | $o = ''; |
135 | 135 | // Loop through a list of tags |
136 | 136 | $countValue = count($value); |
137 | - for($i = 0; $i < $countValue; $i++) { |
|
137 | + for ($i = 0; $i < $countValue; $i++) { |
|
138 | 138 | $tagvalue = is_array($value[$i]) ? implode(' ', $value[$i]) : $value[$i]; |
139 | - if(!$tagvalue) { |
|
139 | + if (!$tagvalue) { |
|
140 | 140 | continue; |
141 | 141 | } |
142 | 142 | |
@@ -147,11 +147,11 @@ discard block |
||
147 | 147 | 'class' => $params['class'], |
148 | 148 | 'style' => $params['style'], |
149 | 149 | ); |
150 | - foreach($attr as $k => $v) $attributes .= ($v ? ' ' . $k . '="' . $v . '"' : ''); |
|
151 | - $attributes .= ' ' . $params['attrib']; // add extra |
|
150 | + foreach ($attr as $k => $v) $attributes .= ($v ? ' '.$k.'="'.$v.'"' : ''); |
|
151 | + $attributes .= ' '.$params['attrib']; // add extra |
|
152 | 152 | |
153 | 153 | // Output the HTML Tag |
154 | - $o .= '<' . $tagname . rtrim($attributes) . '>' . $tagvalue . '</' . $tagname . '>'; |
|
154 | + $o .= '<'.$tagname.rtrim($attributes).'>'.$tagvalue.'</'.$tagname.'>'; |
|
155 | 155 | } |
156 | 156 | break; |
157 | 157 | |
@@ -160,12 +160,12 @@ discard block |
||
160 | 160 | $w = $params['w'] ? $params['w'] : '100%'; |
161 | 161 | $h = $params['h'] ? $params['h'] : '400px'; |
162 | 162 | $richtexteditor = $params['edt'] ? $params['edt'] : ""; |
163 | - $o = '<div class="MODX_RichTextWidget"><textarea id="' . $id . '" name="' . $id . '" style="width:' . $w . '; height:' . $h . ';">'; |
|
163 | + $o = '<div class="MODX_RichTextWidget"><textarea id="'.$id.'" name="'.$id.'" style="width:'.$w.'; height:'.$h.';">'; |
|
164 | 164 | $o .= $modx->htmlspecialchars($value); |
165 | 165 | $o .= '</textarea></div>'; |
166 | 166 | $replace_richtext = array($id); |
167 | 167 | // setup editors |
168 | - if(!empty($replace_richtext) && !empty($richtexteditor)) { |
|
168 | + if (!empty($replace_richtext) && !empty($richtexteditor)) { |
|
169 | 169 | // invoke OnRichTextEditorInit event |
170 | 170 | $evtOut = $modx->invokeEvent("OnRichTextEditorInit", array( |
171 | 171 | 'editor' => $richtexteditor, |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | 'width' => $w, |
175 | 175 | 'height' => $h |
176 | 176 | )); |
177 | - if(is_array($evtOut)) { |
|
177 | + if (is_array($evtOut)) { |
|
178 | 178 | $o .= implode("", $evtOut); |
179 | 179 | } |
180 | 180 | } |
@@ -187,8 +187,8 @@ discard block |
||
187 | 187 | |
188 | 188 | case "viewport": |
189 | 189 | $value = parseInput($value); |
190 | - $id = '_' . time(); |
|
191 | - if(!$params['vpid']) { |
|
190 | + $id = '_'.time(); |
|
191 | + if (!$params['vpid']) { |
|
192 | 192 | $params['vpid'] = $id; |
193 | 193 | } |
194 | 194 | $sTag = "<iframe"; |
@@ -196,42 +196,42 @@ discard block |
||
196 | 196 | $autoMode = "0"; |
197 | 197 | $w = $params['width']; |
198 | 198 | $h = $params['height']; |
199 | - if($params['stretch'] == 'Yes') { |
|
199 | + if ($params['stretch'] == 'Yes') { |
|
200 | 200 | $w = "100%"; |
201 | 201 | $h = "100%"; |
202 | 202 | } |
203 | - if($params['asize'] == 'Yes' || ($params['awidth'] == 'Yes' && $params['aheight'] == 'Yes')) { |
|
204 | - $autoMode = "3"; //both |
|
205 | - } else if($params['awidth'] == 'Yes') { |
|
203 | + if ($params['asize'] == 'Yes' || ($params['awidth'] == 'Yes' && $params['aheight'] == 'Yes')) { |
|
204 | + $autoMode = "3"; //both |
|
205 | + } else if ($params['awidth'] == 'Yes') { |
|
206 | 206 | $autoMode = "1"; //width only |
207 | - } else if($params['aheight'] == 'Yes') { |
|
208 | - $autoMode = "2"; //height only |
|
207 | + } else if ($params['aheight'] == 'Yes') { |
|
208 | + $autoMode = "2"; //height only |
|
209 | 209 | } |
210 | 210 | |
211 | - $modx->regClientStartupScript(MODX_MANAGER_URL . "media/script/bin/viewport.js", array( |
|
211 | + $modx->regClientStartupScript(MODX_MANAGER_URL."media/script/bin/viewport.js", array( |
|
212 | 212 | 'name' => 'viewport', |
213 | 213 | 'version' => '0', |
214 | 214 | 'plaintext' => false |
215 | 215 | )); |
216 | - $o = $sTag . " id='" . $params['vpid'] . "' name='" . $params['vpid'] . "' "; |
|
217 | - if($params['class']) { |
|
218 | - $o .= " class='" . $params['class'] . "' "; |
|
216 | + $o = $sTag." id='".$params['vpid']."' name='".$params['vpid']."' "; |
|
217 | + if ($params['class']) { |
|
218 | + $o .= " class='".$params['class']."' "; |
|
219 | 219 | } |
220 | - if($params['style']) { |
|
221 | - $o .= " style='" . $params['style'] . "' "; |
|
220 | + if ($params['style']) { |
|
221 | + $o .= " style='".$params['style']."' "; |
|
222 | 222 | } |
223 | - if($params['attrib']) { |
|
224 | - $o .= $params['attrib'] . " "; |
|
223 | + if ($params['attrib']) { |
|
224 | + $o .= $params['attrib']." "; |
|
225 | 225 | } |
226 | - $o .= "scrolling='" . ($params['sbar'] == 'No' ? "no" : ($params['sbar'] == 'Yes' ? "yes" : "auto")) . "' "; |
|
227 | - $o .= "src='" . $value . "' frameborder='" . $params['borsize'] . "' "; |
|
228 | - $o .= "onload=\"window.setTimeout('ResizeViewPort(\\'" . $params['vpid'] . "\\'," . $autoMode . ")',100);\" width='" . $w . "' height='" . $h . "' "; |
|
226 | + $o .= "scrolling='".($params['sbar'] == 'No' ? "no" : ($params['sbar'] == 'Yes' ? "yes" : "auto"))."' "; |
|
227 | + $o .= "src='".$value."' frameborder='".$params['borsize']."' "; |
|
228 | + $o .= "onload=\"window.setTimeout('ResizeViewPort(\\'".$params['vpid']."\\',".$autoMode.")',100);\" width='".$w."' height='".$h."' "; |
|
229 | 229 | $o .= ">"; |
230 | 230 | $o .= $eTag; |
231 | 231 | break; |
232 | 232 | |
233 | 233 | case "datagrid": |
234 | - include_once MODX_MANAGER_PATH . "includes/controls/datagrid.class.php"; |
|
234 | + include_once MODX_MANAGER_PATH."includes/controls/datagrid.class.php"; |
|
235 | 235 | $grd = new DataGrid('', $value); |
236 | 236 | |
237 | 237 | $grd->noRecordMsg = $params['egmsg']; |
@@ -266,7 +266,7 @@ discard block |
||
266 | 266 | |
267 | 267 | case 'htmlentities': |
268 | 268 | $value = parseInput($value); |
269 | - if($tvtype == 'checkbox' || $tvtype == 'listbox-multiple') { |
|
269 | + if ($tvtype == 'checkbox' || $tvtype == 'listbox-multiple') { |
|
270 | 270 | // remove delimiter from checkbox and listbox-multiple TVs |
271 | 271 | $value = str_replace('||', '', $value); |
272 | 272 | } |
@@ -277,33 +277,33 @@ discard block |
||
277 | 277 | $widget_output = ''; |
278 | 278 | $o = ''; |
279 | 279 | /* If we are loading a file */ |
280 | - if(substr($params['output'], 0, 5) == "@FILE") { |
|
281 | - $file_name = MODX_BASE_PATH . trim(substr($params['output'], 6)); |
|
282 | - if(!file_exists($file_name)) { |
|
283 | - $widget_output = $file_name . ' does not exist'; |
|
280 | + if (substr($params['output'], 0, 5) == "@FILE") { |
|
281 | + $file_name = MODX_BASE_PATH.trim(substr($params['output'], 6)); |
|
282 | + if (!file_exists($file_name)) { |
|
283 | + $widget_output = $file_name.' does not exist'; |
|
284 | 284 | } else { |
285 | 285 | $widget_output = file_get_contents($file_name); |
286 | 286 | } |
287 | - } elseif(substr($params['output'], 0, 8) == '@INCLUDE') { |
|
288 | - $file_name = MODX_BASE_PATH . trim(substr($params['output'], 9)); |
|
289 | - if(!file_exists($file_name)) { |
|
290 | - $widget_output = $file_name . ' does not exist'; |
|
287 | + } elseif (substr($params['output'], 0, 8) == '@INCLUDE') { |
|
288 | + $file_name = MODX_BASE_PATH.trim(substr($params['output'], 9)); |
|
289 | + if (!file_exists($file_name)) { |
|
290 | + $widget_output = $file_name.' does not exist'; |
|
291 | 291 | } else { |
292 | 292 | /* The included file needs to set $widget_output. Can be string, array, object */ |
293 | 293 | include $file_name; |
294 | 294 | } |
295 | - } elseif(substr($params['output'], 0, 6) == '@CHUNK' && $value !== '') { |
|
295 | + } elseif (substr($params['output'], 0, 6) == '@CHUNK' && $value !== '') { |
|
296 | 296 | $chunk_name = trim(substr($params['output'], 7)); |
297 | 297 | $widget_output = $modx->getChunk($chunk_name); |
298 | - } elseif(substr($params['output'], 0, 5) == '@EVAL' && $value !== '') { |
|
298 | + } elseif (substr($params['output'], 0, 5) == '@EVAL' && $value !== '') { |
|
299 | 299 | $eval_str = trim(substr($params['output'], 6)); |
300 | 300 | $widget_output = eval($eval_str); |
301 | - } elseif($value !== '') { |
|
301 | + } elseif ($value !== '') { |
|
302 | 302 | $widget_output = $params['output']; |
303 | 303 | } else { |
304 | 304 | $widget_output = ''; |
305 | 305 | } |
306 | - if(is_string($widget_output)) { |
|
306 | + if (is_string($widget_output)) { |
|
307 | 307 | $_ = $modx->config['enable_filter']; |
308 | 308 | $modx->config['enable_filter'] = 1; |
309 | 309 | $widget_output = $modx->parseText($widget_output, array('value' => $value)); |
@@ -316,7 +316,7 @@ discard block |
||
316 | 316 | |
317 | 317 | default: |
318 | 318 | $value = parseInput($value); |
319 | - if($tvtype == 'checkbox' || $tvtype == 'listbox-multiple') { |
|
319 | + if ($tvtype == 'checkbox' || $tvtype == 'listbox-multiple') { |
|
320 | 320 | // add separator |
321 | 321 | $value = explode('||', $value); |
322 | 322 | $value = implode($sep, $value); |
@@ -327,23 +327,23 @@ discard block |
||
327 | 327 | return $o; |
328 | 328 | } |
329 | 329 | |
330 | -function decodeParamValue($s) { |
|
330 | +function decodeParamValue($s){ |
|
331 | 331 | $s = str_replace("%3D", '=', $s); // = |
332 | 332 | $s = str_replace("%26", '&', $s); // & |
333 | 333 | return $s; |
334 | 334 | } |
335 | 335 | |
336 | 336 | // returns an array if a delimiter is present. returns array is a recordset is present |
337 | -function parseInput($src, $delim = "||", $type = "string", $columns = true) { // type can be: string, array |
|
337 | +function parseInput($src, $delim = "||", $type = "string", $columns = true){ // type can be: string, array |
|
338 | 338 | global $modx; |
339 | - if($modx->db->isResult($src)) { |
|
339 | + if ($modx->db->isResult($src)) { |
|
340 | 340 | // must be a recordset |
341 | 341 | $rows = array(); |
342 | - while($cols = $modx->db->getRow($src, 'num')) $rows[] = ($columns) ? $cols : implode(" ", $cols); |
|
342 | + while ($cols = $modx->db->getRow($src, 'num')) $rows[] = ($columns) ? $cols : implode(" ", $cols); |
|
343 | 343 | return ($type == "array") ? $rows : implode($delim, $rows); |
344 | 344 | } else { |
345 | 345 | // must be a text |
346 | - if($type == "array") { |
|
346 | + if ($type == "array") { |
|
347 | 347 | return explode($delim, $src); |
348 | 348 | } else { |
349 | 349 | return $src; |
@@ -351,21 +351,21 @@ discard block |
||
351 | 351 | } |
352 | 352 | } |
353 | 353 | |
354 | -function getUnixtimeFromDateString($value) { |
|
354 | +function getUnixtimeFromDateString($value){ |
|
355 | 355 | $timestamp = false; |
356 | 356 | // Check for MySQL or legacy style date |
357 | 357 | $date_match_1 = '/^([0-9]{2})-([0-9]{2})-([0-9]{4})\ ([0-9]{2}):([0-9]{2}):([0-9]{2})$/'; |
358 | 358 | $date_match_2 = '/^([0-9]{4})-([0-9]{2})-([0-9]{2})\ ([0-9]{2}):([0-9]{2}):([0-9]{2})$/'; |
359 | 359 | $matches = array(); |
360 | - if(strpos($value, '-') !== false) { |
|
361 | - if(preg_match($date_match_1, $value, $matches)) { |
|
360 | + if (strpos($value, '-') !== false) { |
|
361 | + if (preg_match($date_match_1, $value, $matches)) { |
|
362 | 362 | $timestamp = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[1], $matches[3]); |
363 | - } elseif(preg_match($date_match_2, $value, $matches)) { |
|
363 | + } elseif (preg_match($date_match_2, $value, $matches)) { |
|
364 | 364 | $timestamp = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]); |
365 | 365 | } |
366 | 366 | } |
367 | 367 | // If those didn't work, use strtotime to figure out the date |
368 | - if($timestamp === false || $timestamp === -1) { |
|
368 | + if ($timestamp === false || $timestamp === -1) { |
|
369 | 369 | $timestamp = strtotime($value); |
370 | 370 | } |
371 | 371 | return $timestamp; |
@@ -5,7 +5,8 @@ discard block |
||
5 | 5 | */ |
6 | 6 | |
7 | 7 | // Added by Raymond 20-Jan-2005 |
8 | -function getTVDisplayFormat($name, $value, $format, $paramstring = "", $tvtype = "", $docid = "", $sep = '') { |
|
8 | +function getTVDisplayFormat($name, $value, $format, $paramstring = "", $tvtype = "", $docid = "", $sep = '') |
|
9 | +{ |
|
9 | 10 | |
10 | 11 | global $modx; |
11 | 12 | $o = ''; |
@@ -49,7 +50,9 @@ discard block |
||
49 | 50 | if(isset($params['align']) && $params['align'] != 'none') { |
50 | 51 | $attr['align'] = $params['align']; |
51 | 52 | } |
52 | - foreach($attr as $k => $v) $attributes .= ($v ? ' ' . $k . '="' . $v . '"' : ''); |
|
53 | + foreach($attr as $k => $v) { |
|
54 | + $attributes .= ($v ? ' ' . $k . '="' . $v . '"' : ''); |
|
55 | + } |
|
53 | 56 | $attributes .= ' ' . $params['attrib']; |
54 | 57 | |
55 | 58 | // Output the image with attributes |
@@ -118,7 +121,9 @@ discard block |
||
118 | 121 | 'style' => $params['style'], |
119 | 122 | 'target' => $params['target'], |
120 | 123 | ); |
121 | - foreach($attr as $k => $v) $attributes .= ($v ? ' ' . $k . '="' . $v . '"' : ''); |
|
124 | + foreach($attr as $k => $v) { |
|
125 | + $attributes .= ($v ? ' ' . $k . '="' . $v . '"' : ''); |
|
126 | + } |
|
122 | 127 | $attributes .= ' ' . $params['attrib']; // add extra |
123 | 128 | |
124 | 129 | // Output the link |
@@ -147,7 +152,9 @@ discard block |
||
147 | 152 | 'class' => $params['class'], |
148 | 153 | 'style' => $params['style'], |
149 | 154 | ); |
150 | - foreach($attr as $k => $v) $attributes .= ($v ? ' ' . $k . '="' . $v . '"' : ''); |
|
155 | + foreach($attr as $k => $v) { |
|
156 | + $attributes .= ($v ? ' ' . $k . '="' . $v . '"' : ''); |
|
157 | + } |
|
151 | 158 | $attributes .= ' ' . $params['attrib']; // add extra |
152 | 159 | |
153 | 160 | // Output the HTML Tag |
@@ -327,19 +334,24 @@ discard block |
||
327 | 334 | return $o; |
328 | 335 | } |
329 | 336 | |
330 | -function decodeParamValue($s) { |
|
337 | +function decodeParamValue($s) |
|
338 | +{ |
|
331 | 339 | $s = str_replace("%3D", '=', $s); // = |
332 | 340 | $s = str_replace("%26", '&', $s); // & |
333 | 341 | return $s; |
334 | 342 | } |
335 | 343 | |
336 | 344 | // returns an array if a delimiter is present. returns array is a recordset is present |
337 | -function parseInput($src, $delim = "||", $type = "string", $columns = true) { // type can be: string, array |
|
345 | +function parseInput($src, $delim = "||", $type = "string", $columns = true) |
|
346 | +{ |
|
347 | +// type can be: string, array |
|
338 | 348 | global $modx; |
339 | 349 | if($modx->db->isResult($src)) { |
340 | 350 | // must be a recordset |
341 | 351 | $rows = array(); |
342 | - while($cols = $modx->db->getRow($src, 'num')) $rows[] = ($columns) ? $cols : implode(" ", $cols); |
|
352 | + while($cols = $modx->db->getRow($src, 'num')) { |
|
353 | + $rows[] = ($columns) ? $cols : implode(" ", $cols); |
|
354 | + } |
|
343 | 355 | return ($type == "array") ? $rows : implode($delim, $rows); |
344 | 356 | } else { |
345 | 357 | // must be a text |
@@ -351,7 +363,8 @@ discard block |
||
351 | 363 | } |
352 | 364 | } |
353 | 365 | |
354 | -function getUnixtimeFromDateString($value) { |
|
366 | +function getUnixtimeFromDateString($value) |
|
367 | +{ |
|
355 | 368 | $timestamp = false; |
356 | 369 | // Check for MySQL or legacy style date |
357 | 370 | $date_match_1 = '/^([0-9]{2})-([0-9]{2})-([0-9]{4})\ ([0-9]{2}):([0-9]{2}):([0-9]{2})$/'; |
@@ -5,7 +5,7 @@ |
||
5 | 5 | |
6 | 6 | $load_script = file_get_contents(dirname(__FILE__).'/datepicker.tpl'); |
7 | 7 | if(!isset($modx->config['lang_code'])) $modx->config['lang_code'] = $this->getLangCode(); |
8 | - $modx->config['datetime_format_lc'] = isset($modx->config['datetime_format']) ? strtolower($modx->config['datetime_format']) : 'dd-mm-yyyy'; |
|
8 | + $modx->config['datetime_format_lc'] = isset($modx->config['datetime_format']) ? strtolower($modx->config['datetime_format']) : 'dd-mm-yyyy'; |
|
9 | 9 | return $modx->mergeSettingsContent($load_script); |
10 | 10 | } |
11 | 11 | public function getLangCode() { |
@@ -1,21 +1,21 @@ |
||
1 | 1 | <?php |
2 | -class DATEPICKER { |
|
3 | - public function getDP() { |
|
2 | +class DATEPICKER{ |
|
3 | + public function getDP(){ |
|
4 | 4 | global $modx; |
5 | 5 | |
6 | 6 | $load_script = file_get_contents(dirname(__FILE__).'/datepicker.tpl'); |
7 | - if(!isset($modx->config['lang_code'])) $modx->config['lang_code'] = $this->getLangCode(); |
|
7 | + if (!isset($modx->config['lang_code'])) $modx->config['lang_code'] = $this->getLangCode(); |
|
8 | 8 | $modx->config['datetime_format_lc'] = isset($modx->config['datetime_format']) ? strtolower($modx->config['datetime_format']) : 'dd-mm-yyyy'; |
9 | 9 | return $modx->mergeSettingsContent($load_script); |
10 | 10 | } |
11 | - public function getLangCode() { |
|
11 | + public function getLangCode(){ |
|
12 | 12 | global $modx, $modx_lang_attribute; |
13 | 13 | |
14 | - if(!$modx_lang_attribute) return 'en'; |
|
14 | + if (!$modx_lang_attribute) return 'en'; |
|
15 | 15 | |
16 | 16 | $lc = $modx_lang_attribute; |
17 | - if($lc === 'uk') return 'ru'; |
|
18 | - $dp_path = str_replace('\\','/',dirname(__FILE__)); |
|
17 | + if ($lc === 'uk') return 'ru'; |
|
18 | + $dp_path = str_replace('\\', '/', dirname(__FILE__)); |
|
19 | 19 | |
20 | 20 | return (is_file("{$dp_path}/i18n/datepicker.{$lc}.js")) ? $modx_lang_attribute : 'en'; |
21 | 21 | } |
@@ -1,20 +1,29 @@ |
||
1 | 1 | <?php |
2 | -class DATEPICKER { |
|
3 | - public function getDP() { |
|
2 | +class DATEPICKER |
|
3 | +{ |
|
4 | + public function getDP() |
|
5 | + { |
|
4 | 6 | global $modx; |
5 | 7 | |
6 | 8 | $load_script = file_get_contents(dirname(__FILE__).'/datepicker.tpl'); |
7 | - if(!isset($modx->config['lang_code'])) $modx->config['lang_code'] = $this->getLangCode(); |
|
9 | + if(!isset($modx->config['lang_code'])) { |
|
10 | + $modx->config['lang_code'] = $this->getLangCode(); |
|
11 | + } |
|
8 | 12 | $modx->config['datetime_format_lc'] = isset($modx->config['datetime_format']) ? strtolower($modx->config['datetime_format']) : 'dd-mm-yyyy'; |
9 | 13 | return $modx->mergeSettingsContent($load_script); |
10 | 14 | } |
11 | - public function getLangCode() { |
|
15 | + public function getLangCode() |
|
16 | + { |
|
12 | 17 | global $modx, $modx_lang_attribute; |
13 | 18 | |
14 | - if(!$modx_lang_attribute) return 'en'; |
|
19 | + if(!$modx_lang_attribute) { |
|
20 | + return 'en'; |
|
21 | + } |
|
15 | 22 | |
16 | 23 | $lc = $modx_lang_attribute; |
17 | - if($lc === 'uk') return 'ru'; |
|
24 | + if($lc === 'uk') { |
|
25 | + return 'ru'; |
|
26 | + } |
|
18 | 27 | $dp_path = str_replace('\\','/',dirname(__FILE__)); |
19 | 28 | |
20 | 29 | return (is_file("{$dp_path}/i18n/datepicker.{$lc}.js")) ? $modx_lang_attribute : 'en'; |
@@ -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_plugin')) { |
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 | // Set the item name for logger |
@@ -17,9 +17,9 @@ discard block |
||
17 | 17 | |
18 | 18 | // invoke OnBeforePluginFormDelete event |
19 | 19 | $modx->invokeEvent("OnBeforePluginFormDelete", |
20 | - array( |
|
21 | - "id" => $id |
|
22 | - )); |
|
20 | + array( |
|
21 | + "id" => $id |
|
22 | + )); |
|
23 | 23 | |
24 | 24 | // delete the plugin. |
25 | 25 | $modx->db->delete($modx->getFullTableName('site_plugins'), "id='{$id}'"); |
@@ -29,9 +29,9 @@ discard block |
||
29 | 29 | |
30 | 30 | // invoke OnPluginFormDelete event |
31 | 31 | $modx->invokeEvent("OnPluginFormDelete", |
32 | - array( |
|
33 | - "id" => $id |
|
34 | - )); |
|
32 | + array( |
|
33 | + "id" => $id |
|
34 | + )); |
|
35 | 35 | |
36 | 36 | // empty cache |
37 | 37 | $modx->clearCache('full'); |
@@ -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('delete_plugin')) { |
|
5 | +if (!$modx->hasPermission('delete_plugin')) { |
|
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 | |
@@ -37,5 +37,5 @@ discard block |
||
37 | 37 | $modx->clearCache('full'); |
38 | 38 | |
39 | 39 | // finished emptying cache - redirect |
40 | -$header="Location: index.php?a=76&r=2"; |
|
40 | +$header = "Location: index.php?a=76&r=2"; |
|
41 | 41 | header($header); |
@@ -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_snippet')) { |
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 | // Set the item name for logger |
@@ -17,18 +17,18 @@ discard block |
||
17 | 17 | |
18 | 18 | // invoke OnBeforeChunkFormDelete event |
19 | 19 | $modx->invokeEvent("OnBeforeChunkFormDelete", |
20 | - array( |
|
21 | - "id" => $id |
|
22 | - )); |
|
20 | + array( |
|
21 | + "id" => $id |
|
22 | + )); |
|
23 | 23 | |
24 | 24 | // delete the chunk. |
25 | 25 | $modx->db->delete($modx->getFullTableName('site_htmlsnippets'), "id='{$id}'"); |
26 | 26 | |
27 | 27 | // invoke OnChunkFormDelete event |
28 | 28 | $modx->invokeEvent("OnChunkFormDelete", |
29 | - array( |
|
30 | - "id" => $id |
|
31 | - )); |
|
29 | + array( |
|
30 | + "id" => $id |
|
31 | + )); |
|
32 | 32 | |
33 | 33 | // empty cache |
34 | 34 | $modx->clearCache('full'); |
@@ -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('delete_snippet')) { |
|
5 | +if (!$modx->hasPermission('delete_snippet')) { |
|
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 | |
@@ -34,5 +34,5 @@ discard block |
||
34 | 34 | $modx->clearCache('full'); |
35 | 35 | |
36 | 36 | // finished emptying cache - redirect |
37 | -$header="Location: index.php?a=76&r=2"; |
|
37 | +$header = "Location: index.php?a=76&r=2"; |
|
38 | 38 | header($header); |
@@ -1,22 +1,22 @@ 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 | if(!$modx->hasPermission('delete_template')) { |
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 | // delete the template, but first check it doesn't have any documents using it |
15 | 15 | $rs = $modx->db->select('id, pagetitle,introtext', $modx->getFullTableName('site_content'), "template='{$id}' AND deleted=0"); |
16 | 16 | $limit = $modx->db->getRecordCount($rs); |
17 | 17 | if($limit > 0) { |
18 | - include "header.inc.php"; |
|
19 | - ?> |
|
18 | + include "header.inc.php"; |
|
19 | + ?> |
|
20 | 20 | |
21 | 21 | <h1><?php echo $_lang['manage_templates']; ?></h1> |
22 | 22 | |
@@ -28,20 +28,20 @@ discard block |
||
28 | 28 | <p>Documents using this template:</p> |
29 | 29 | <ul> |
30 | 30 | <?php |
31 | - while($row = $modx->db->getRow($rs)) { |
|
32 | - echo '<li><span style="width: 200px"><a href="index.php?id=' . $row['id'] . '&a=27">' . $row['pagetitle'] . '</a></span>' . ($row['introtext'] != '' ? ' - ' . $row['introtext'] : '') . '</li>'; |
|
33 | - } |
|
34 | - ?> |
|
31 | + while($row = $modx->db->getRow($rs)) { |
|
32 | + echo '<li><span style="width: 200px"><a href="index.php?id=' . $row['id'] . '&a=27">' . $row['pagetitle'] . '</a></span>' . ($row['introtext'] != '' ? ' - ' . $row['introtext'] : '') . '</li>'; |
|
33 | + } |
|
34 | + ?> |
|
35 | 35 | </ul> |
36 | 36 | </div> |
37 | 37 | </div> |
38 | 38 | <?php |
39 | - include_once "footer.inc.php"; |
|
40 | - exit; |
|
39 | + include_once "footer.inc.php"; |
|
40 | + exit; |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | if($id == $default_template) { |
44 | - $modx->webAlertAndQuit("This template is set as the default template. Please choose a different default template in the MODX configuration before deleting this template."); |
|
44 | + $modx->webAlertAndQuit("This template is set as the default template. Please choose a different default template in the MODX configuration before deleting this template."); |
|
45 | 45 | } |
46 | 46 | |
47 | 47 | // Set the item name for logger |
@@ -50,8 +50,8 @@ discard block |
||
50 | 50 | |
51 | 51 | // invoke OnBeforeTempFormDelete event |
52 | 52 | $modx->invokeEvent("OnBeforeTempFormDelete", array( |
53 | - "id" => $id |
|
54 | - )); |
|
53 | + "id" => $id |
|
54 | + )); |
|
55 | 55 | |
56 | 56 | // delete the document. |
57 | 57 | $modx->db->delete($modx->getFullTableName('site_templates'), "id='{$id}'"); |
@@ -60,8 +60,8 @@ discard block |
||
60 | 60 | |
61 | 61 | // invoke OnTempFormDelete event |
62 | 62 | $modx->invokeEvent("OnTempFormDelete", array( |
63 | - "id" => $id |
|
64 | - )); |
|
63 | + "id" => $id |
|
64 | + )); |
|
65 | 65 | |
66 | 66 | // empty cache |
67 | 67 | $modx->clearCache('full'); |
@@ -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('delete_template')) { |
|
5 | +if (!$modx->hasPermission('delete_template')) { |
|
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 | // delete the template, but first check it doesn't have any documents using it |
15 | 15 | $rs = $modx->db->select('id, pagetitle,introtext', $modx->getFullTableName('site_content'), "template='{$id}' AND deleted=0"); |
16 | 16 | $limit = $modx->db->getRecordCount($rs); |
17 | -if($limit > 0) { |
|
17 | +if ($limit > 0) { |
|
18 | 18 | include "header.inc.php"; |
19 | 19 | ?> |
20 | 20 | |
@@ -28,8 +28,8 @@ discard block |
||
28 | 28 | <p>Documents using this template:</p> |
29 | 29 | <ul> |
30 | 30 | <?php |
31 | - while($row = $modx->db->getRow($rs)) { |
|
32 | - echo '<li><span style="width: 200px"><a href="index.php?id=' . $row['id'] . '&a=27">' . $row['pagetitle'] . '</a></span>' . ($row['introtext'] != '' ? ' - ' . $row['introtext'] : '') . '</li>'; |
|
31 | + while ($row = $modx->db->getRow($rs)) { |
|
32 | + echo '<li><span style="width: 200px"><a href="index.php?id='.$row['id'].'&a=27">'.$row['pagetitle'].'</a></span>'.($row['introtext'] != '' ? ' - '.$row['introtext'] : '').'</li>'; |
|
33 | 33 | } |
34 | 34 | ?> |
35 | 35 | </ul> |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | exit; |
41 | 41 | } |
42 | 42 | |
43 | -if($id == $default_template) { |
|
43 | +if ($id == $default_template) { |
|
44 | 44 | $modx->webAlertAndQuit("This template is set as the default template. Please choose a different default template in the MODX configuration before deleting this template."); |
45 | 45 | } |
46 | 46 |