@@ -105,7 +105,8 @@ discard block |
||
105 | 105 | } |
106 | 106 | } |
107 | 107 | |
108 | - private function getUserIP() { |
|
108 | + private function getUserIP() |
|
109 | + { |
|
109 | 110 | if( array_key_exists('HTTP_X_FORWARDED_FOR', $_SERVER) && !empty($_SERVER['HTTP_X_FORWARDED_FOR']) ) { |
110 | 111 | if (strpos($_SERVER['HTTP_X_FORWARDED_FOR'], ',')>0) { |
111 | 112 | $addr = explode(",",$_SERVER['HTTP_X_FORWARDED_FOR']); |
@@ -113,8 +114,7 @@ discard block |
||
113 | 114 | } else { |
114 | 115 | return $_SERVER['HTTP_X_FORWARDED_FOR']; |
115 | 116 | } |
116 | - } |
|
117 | - else { |
|
117 | + } else { |
|
118 | 118 | return $_SERVER['REMOTE_ADDR']; |
119 | 119 | } |
120 | 120 | } |
@@ -36,16 +36,16 @@ discard block |
||
36 | 36 | $action = "", |
37 | 37 | $itemid = "", |
38 | 38 | $itemname = "" |
39 | - ) { |
|
39 | + ){ |
|
40 | 40 | $modx = evolutionCMS(); |
41 | 41 | $this->entry['msg'] = $msg; // writes testmessage to the object |
42 | - $this->entry['action'] = empty($action) ? $modx->getManagerApi()->action : $action; // writes the action to the object |
|
42 | + $this->entry['action'] = empty($action) ? $modx->getManagerApi()->action : $action; // writes the action to the object |
|
43 | 43 | |
44 | 44 | // User Credentials |
45 | 45 | $this->entry['internalKey'] = $internalKey == "" ? $modx->getLoginUserID() : $internalKey; |
46 | 46 | $this->entry['username'] = $username == "" ? $modx->getLoginUserName() : $username; |
47 | 47 | |
48 | - $this->entry['itemId'] = (empty($itemid) && isset($_REQUEST['id'])) ? (int)$_REQUEST['id'] : $itemid; // writes the id to the object |
|
48 | + $this->entry['itemId'] = (empty($itemid) && isset($_REQUEST['id'])) ? (int) $_REQUEST['id'] : $itemid; // writes the id to the object |
|
49 | 49 | if ($this->entry['itemId'] == 0) { |
50 | 50 | $this->entry['itemId'] = "-"; |
51 | 51 | } // to stop items having id 0 |
@@ -96,20 +96,20 @@ discard block |
||
96 | 96 | |
97 | 97 | $insert_id = $modx->getDatabase()->insert($fields, $tbl_manager_log); |
98 | 98 | if (!$insert_id) { |
99 | - $modx->messageQuit("Logging error: couldn't save log to table! Error code: " . $modx->getDatabase()->getLastError()); |
|
99 | + $modx->messageQuit("Logging error: couldn't save log to table! Error code: ".$modx->getDatabase()->getLastError()); |
|
100 | 100 | } else { |
101 | - $limit = (isset($modx->config['manager_log_limit'])) ? (int)$modx->config['manager_log_limit'] : 3000; |
|
102 | - $trim = (isset($modx->config['manager_log_trim'])) ? (int)$modx->config['manager_log_trim'] : 100; |
|
101 | + $limit = (isset($modx->config['manager_log_limit'])) ? (int) $modx->config['manager_log_limit'] : 3000; |
|
102 | + $trim = (isset($modx->config['manager_log_trim'])) ? (int) $modx->config['manager_log_trim'] : 100; |
|
103 | 103 | if (($insert_id % $trim) === 0) { |
104 | 104 | $modx->rotate_log('manager_log', $limit, $trim); |
105 | 105 | } |
106 | 106 | } |
107 | 107 | } |
108 | 108 | |
109 | - private function getUserIP() { |
|
110 | - if( array_key_exists('HTTP_X_FORWARDED_FOR', $_SERVER) && !empty($_SERVER['HTTP_X_FORWARDED_FOR']) ) { |
|
111 | - if (strpos($_SERVER['HTTP_X_FORWARDED_FOR'], ',')>0) { |
|
112 | - $addr = explode(",",$_SERVER['HTTP_X_FORWARDED_FOR']); |
|
109 | + private function getUserIP(){ |
|
110 | + if (array_key_exists('HTTP_X_FORWARDED_FOR', $_SERVER) && !empty($_SERVER['HTTP_X_FORWARDED_FOR'])) { |
|
111 | + if (strpos($_SERVER['HTTP_X_FORWARDED_FOR'], ',') > 0) { |
|
112 | + $addr = explode(",", $_SERVER['HTTP_X_FORWARDED_FOR']); |
|
113 | 113 | return trim($addr[0]); |
114 | 114 | } else { |
115 | 115 | return $_SERVER['HTTP_X_FORWARDED_FOR']; |
@@ -8,7 +8,8 @@ discard block |
||
8 | 8 | * @param array $data |
9 | 9 | * @return string |
10 | 10 | */ |
11 | - public function output($config = array(), $data = array()) { |
|
11 | + public function output($config = array(), $data = array()) |
|
12 | + { |
|
12 | 13 | $modx = evolutionCMS(); |
13 | 14 | |
14 | 15 | $output = ''; |
@@ -64,7 +65,8 @@ discard block |
||
64 | 65 | * @param array $data |
65 | 66 | * @return string |
66 | 67 | */ |
67 | - private function render($data) { |
|
68 | + private function render($data) |
|
69 | + { |
|
68 | 70 | $modx = evolutionCMS(); global $_lang, $_country_lang; |
69 | 71 | |
70 | 72 | $data['lang.name'] = (isset($_lang[$data['alias']]) ? $_lang[$data['alias']] : $data['alias']); |
@@ -1,6 +1,6 @@ |
||
1 | 1 | <?php namespace EvolutionCMS\Legacy; |
2 | 2 | |
3 | -Class TemplateParser |
|
3 | +class TemplateParser |
|
4 | 4 | { |
5 | 5 | |
6 | 6 | /** |
@@ -8,46 +8,46 @@ discard block |
||
8 | 8 | * @param array $data |
9 | 9 | * @return string |
10 | 10 | */ |
11 | - public function output($config = array(), $data = array()) { |
|
11 | + public function output($config = array(), $data = array()){ |
|
12 | 12 | $modx = evolutionCMS(); |
13 | 13 | |
14 | 14 | $output = ''; |
15 | 15 | $action = !empty($config['action']) ? $config['action'] : (!empty($_REQUEST['a']) ? $_REQUEST['a'] : ''); |
16 | - $tab = isset($config['tab']) ? ' AND tab IN(' . $config['tab'] . ')' : ''; |
|
16 | + $tab = isset($config['tab']) ? ' AND tab IN('.$config['tab'].')' : ''; |
|
17 | 17 | |
18 | - if($action) { |
|
18 | + if ($action) { |
|
19 | 19 | $sql = $modx->getDatabase()->query('SELECT t1.*, IF(t1.alias=\'\',t1.name,t1.alias) AS alias, t2.category AS category_name |
20 | - FROM ' . $modx->getDatabase()->getFullTableName('system_templates') . ' AS t1 |
|
21 | - INNER JOIN ' . $modx->getDatabase()->getFullTableName('categories') . ' AS t2 ON t2.id=t1.category |
|
22 | - WHERE t1.action IN(' . $action . ') ' . $tab . ' |
|
20 | + FROM ' . $modx->getDatabase()->getFullTableName('system_templates').' AS t1 |
|
21 | + INNER JOIN ' . $modx->getDatabase()->getFullTableName('categories').' AS t2 ON t2.id=t1.category |
|
22 | + WHERE t1.action IN(' . $action.') '.$tab.' |
|
23 | 23 | ORDER BY t1.tab ASC, t1.rank ASC'); |
24 | 24 | |
25 | - if($modx->getDatabase()->getRecordCount($sql)) { |
|
25 | + if ($modx->getDatabase()->getRecordCount($sql)) { |
|
26 | 26 | $tabs = array(); |
27 | - while($row = $modx->getDatabase()->getRow($sql)) { |
|
28 | - if(!$row['value'] && !empty($data[$row['name']])) { |
|
27 | + while ($row = $modx->getDatabase()->getRow($sql)) { |
|
28 | + if (!$row['value'] && !empty($data[$row['name']])) { |
|
29 | 29 | $row['value'] = $data[$row['name']]; |
30 | 30 | } |
31 | 31 | $tabs[$row['tab']]['category_name'] = $row['category_name']; |
32 | 32 | $tabs[$row['tab']][$row['name']] = $this->render($row); |
33 | 33 | } |
34 | 34 | |
35 | - if(!empty($config['toArray'])) { |
|
35 | + if (!empty($config['toArray'])) { |
|
36 | 36 | $output = $tabs; |
37 | 37 | } else { |
38 | - $output .= '<div class="tab-pane" id="pane_' . $action . '">'; |
|
38 | + $output .= '<div class="tab-pane" id="pane_'.$action.'">'; |
|
39 | 39 | $output .= ' |
40 | 40 | <script type="text/javascript"> |
41 | - var pane_' . $action . ' = new WebFXTabPane(document.getElementById("pane_' . $action . '"), ' . ($modx->config['remember_last_tab'] == 1 ? 'true' : 'false') . '); |
|
41 | + var pane_' . $action.' = new WebFXTabPane(document.getElementById("pane_'.$action.'"), '.($modx->config['remember_last_tab'] == 1 ? 'true' : 'false').'); |
|
42 | 42 | </script>'; |
43 | 43 | |
44 | - foreach($tabs as $idTab => $tab) { |
|
45 | - $output .= '<div class="tab-page" id="tab_' . $action . '_' . $idTab . '">'; |
|
44 | + foreach ($tabs as $idTab => $tab) { |
|
45 | + $output .= '<div class="tab-page" id="tab_'.$action.'_'.$idTab.'">'; |
|
46 | 46 | $output .= ' |
47 | - <h2 class="tab">' . (!empty($config['tabs'][$idTab]) ? $config['tabs'][$idTab] : $tab['category_name']) . '</h2> |
|
48 | - <script type="text/javascript">pane_' . $action . '.addTabPage(document.getElementById("tab_' . $action . '_' . $idTab . '"));</script>'; |
|
47 | + <h2 class="tab">' . (!empty($config['tabs'][$idTab]) ? $config['tabs'][$idTab] : $tab['category_name']).'</h2> |
|
48 | + <script type="text/javascript">pane_' . $action.'.addTabPage(document.getElementById("tab_'.$action.'_'.$idTab.'"));</script>'; |
|
49 | 49 | unset($tab['category_name']); |
50 | - foreach($tab as $item) { |
|
50 | + foreach ($tab as $item) { |
|
51 | 51 | $output .= $item; |
52 | 52 | } |
53 | 53 | $output .= '</div>'; |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | * @param array $data |
65 | 65 | * @return string |
66 | 66 | */ |
67 | - private function render($data) { |
|
67 | + private function render($data){ |
|
68 | 68 | $modx = evolutionCMS(); global $_lang, $_country_lang; |
69 | 69 | |
70 | 70 | $data['lang.name'] = (isset($_lang[$data['alias']]) ? $_lang[$data['alias']] : $data['alias']); |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | $output = ''; |
75 | 75 | $output .= '<div class="form-group row">'; |
76 | 76 | |
77 | - switch($data['type']) { |
|
77 | + switch ($data['type']) { |
|
78 | 78 | |
79 | 79 | case 'text': |
80 | 80 | $output .= '<label class="col-sm-3" for="[+name+]">[+lang.name+]</label> |
@@ -108,18 +108,18 @@ discard block |
||
108 | 108 | $output .= '<label class="col-sm-3" for="[+name+]">[+lang.name+]</label>'; |
109 | 109 | $output .= '<div class="col-sm-7">'; |
110 | 110 | $output .= '<select name="[+name+]" class="form-control" id="[+name+]" onChange="documentDirty=true;">'; |
111 | - if($data['name'] == 'country' && isset($_country_lang)) { |
|
111 | + if ($data['name'] == 'country' && isset($_country_lang)) { |
|
112 | 112 | $chosenCountry = isset($_POST['country']) ? $_POST['country'] : $data['country']; |
113 | - $output .= '<option value=""' . (!isset($chosenCountry) ? ' selected' : '') . '> </option>'; |
|
114 | - foreach($_country_lang as $key => $value) { |
|
115 | - $output .= '<option value="' . $key . '"' . (isset($chosenCountry) && $chosenCountry == $key ? ' selected' : '') . '>' . $value . '</option>'; |
|
113 | + $output .= '<option value=""'.(!isset($chosenCountry) ? ' selected' : '').'> </option>'; |
|
114 | + foreach ($_country_lang as $key => $value) { |
|
115 | + $output .= '<option value="'.$key.'"'.(isset($chosenCountry) && $chosenCountry == $key ? ' selected' : '').'>'.$value.'</option>'; |
|
116 | 116 | } |
117 | 117 | } else { |
118 | - if($data['elements']) { |
|
118 | + if ($data['elements']) { |
|
119 | 119 | $elements = explode('||', $data['elements']); |
120 | - foreach($elements as $key => $value) { |
|
120 | + foreach ($elements as $key => $value) { |
|
121 | 121 | $value = explode('==', $value); |
122 | - $output .= '<option value="' . $value[1] . '">' . (isset($_lang[$value[0]]) ? $_lang[$value[0]] : $value[0]) . '</option>'; |
|
122 | + $output .= '<option value="'.$value[1].'">'.(isset($_lang[$value[0]]) ? $_lang[$value[0]] : $value[0]).'</option>'; |
|
123 | 123 | } |
124 | 124 | } |
125 | 125 | } |
@@ -133,11 +133,11 @@ discard block |
||
133 | 133 | $output .= '<label class="col-sm-3" for="[+name+]">[+lang.name+]</label>'; |
134 | 134 | $output .= '<div class="col-sm-7">'; |
135 | 135 | $output .= '<input type="checkbox" name="[+name+]" class="form-control" id="[+name+]" value="[+value+]" onChange="documentDirty=true;"[+readonly+] />'; |
136 | - if($data['elements']) { |
|
136 | + if ($data['elements']) { |
|
137 | 137 | $elements = explode('||', $data['elements']); |
138 | - foreach($elements as $key => $value) { |
|
138 | + foreach ($elements as $key => $value) { |
|
139 | 139 | $value = explode('==', $value); |
140 | - $output .= '<br /><input type="checkbox" name="' . $value[0] . '" class="form-control" id="' . $value[0] . '" value="' . $value[1] . '" onChange="documentDirty=true;"[+readonly+] /> ' . (isset($_lang[$value[0]]) ? $_lang[$value[0]] : $value[0]); |
|
140 | + $output .= '<br /><input type="checkbox" name="'.$value[0].'" class="form-control" id="'.$value[0].'" value="'.$value[1].'" onChange="documentDirty=true;"[+readonly+] /> '.(isset($_lang[$value[0]]) ? $_lang[$value[0]] : $value[0]); |
|
141 | 141 | } |
142 | 142 | } |
143 | 143 | $output .= $data['content']; |
@@ -149,11 +149,11 @@ discard block |
||
149 | 149 | $output .= '<label class="col-sm-3" for="[+name+]">[+lang.name+]</label>'; |
150 | 150 | $output .= '<div class="col-sm-7">'; |
151 | 151 | $output .= '<input type="radio" name="[+name+]" class="form-control" id="[+name+]" value="[+value+]" onChange="documentDirty=true;"[+readonly+] />'; |
152 | - if($data['elements']) { |
|
152 | + if ($data['elements']) { |
|
153 | 153 | $elements = explode('||', $data['elements']); |
154 | - foreach($elements as $key => $value) { |
|
154 | + foreach ($elements as $key => $value) { |
|
155 | 155 | $value = explode('==', $value); |
156 | - $output .= '<br /><input type="radio" name="[+name+]" class="form-control" id="[+name+]_' . $key . '" value="' . $value[1] . '" onChange="documentDirty=true;"[+readonly+] /> ' . (isset($_lang[$value[0]]) ? $_lang[$value[0]] : $value[0]); |
|
156 | + $output .= '<br /><input type="radio" name="[+name+]" class="form-control" id="[+name+]_'.$key.'" value="'.$value[1].'" onChange="documentDirty=true;"[+readonly+] /> '.(isset($_lang[$value[0]]) ? $_lang[$value[0]] : $value[0]); |
|
157 | 157 | } |
158 | 158 | } |
159 | 159 | $output .= $data['content']; |
@@ -90,14 +90,14 @@ discard block |
||
90 | 90 | $countChild++; |
91 | 91 | $id = $value[0]; |
92 | 92 | $ph['id'] = $id; |
93 | - $ph['li_class'] = $this->getItemClass($id) . $value[10]; |
|
93 | + $ph['li_class'] = $this->getItemClass($id).$value[10]; |
|
94 | 94 | $ph['href'] = $value[3]; |
95 | 95 | $ph['alt'] = $value[4]; |
96 | 96 | $ph['target'] = $value[7]; |
97 | 97 | $ph['onclick'] = $value[5]; |
98 | 98 | $ph['a_class'] = $this->getLinkClass($id); |
99 | 99 | $ph['LinkAttr'] = $this->getLinkAttr($id); |
100 | - $ph['itemName'] = $value[2] . $this->getItemName($id); |
|
100 | + $ph['itemName'] = $value[2].$this->getItemName($id); |
|
101 | 101 | |
102 | 102 | $ph['DrawSub'] = ''; |
103 | 103 | |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | public function getLinkClass($id) |
146 | 146 | { |
147 | 147 | if (isset($this->menu[$id])) { |
148 | - return ' class="' . $this->defaults['parentLinkClass'] . '"'; |
|
148 | + return ' class="'.$this->defaults['parentLinkClass'].'"'; |
|
149 | 149 | } else { |
150 | 150 | return ''; |
151 | 151 | } |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | public function getItemClass($id) |
172 | 172 | { |
173 | 173 | if (isset($this->menu[$id])) { |
174 | - return $this->defaults['parentClass'] . ' '; |
|
174 | + return $this->defaults['parentClass'].' '; |
|
175 | 175 | } else { |
176 | 176 | return ''; |
177 | 177 | } |
@@ -43,44 +43,44 @@ discard block |
||
43 | 43 | public $im_height = 0; |
44 | 44 | public $im; |
45 | 45 | |
46 | - public function __construct($w=200, $h=80) { |
|
46 | + public function __construct($w = 200, $h = 80){ |
|
47 | 47 | /* create session to set word for verification */ |
48 | 48 | $this->setVeriword(); |
49 | - $this->dir_font = MODX_BASE_PATH . 'assets/' . $this->dir_font; |
|
49 | + $this->dir_font = MODX_BASE_PATH.'assets/'.$this->dir_font; |
|
50 | 50 | $this->im_width = $w; |
51 | 51 | $this->im_height = $h; |
52 | 52 | } |
53 | 53 | |
54 | - public function setVeriword() { |
|
54 | + public function setVeriword(){ |
|
55 | 55 | /* create session variable for verification, |
56 | 56 | you may change the session variable name */ |
57 | 57 | $this->word = $this->makeText(); |
58 | 58 | $_SESSION['veriword'] = $this->word; |
59 | 59 | } |
60 | 60 | |
61 | - public function output() { |
|
61 | + public function output(){ |
|
62 | 62 | /* output the image as jpeg */ |
63 | 63 | $this->drawImage(); |
64 | 64 | header("Content-type: image/jpeg"); |
65 | 65 | imagejpeg($this->im); |
66 | 66 | } |
67 | 67 | |
68 | - public function makeText() { |
|
68 | + public function makeText(){ |
|
69 | 69 | $modx = evolutionCMS(); |
70 | 70 | // set default words |
71 | - $words="MODX,Access,Better,BitCode,Chunk,Cache,Desc,Design,Excell,Enjoy,URLs,TechView,Gerald,Griff,Humphrey,Holiday,Intel,Integration,Joystick,Join(),Oscope,Genetic,Light,Likeness,Marit,Maaike,Niche,Netherlands,Ordinance,Oscillo,Parser,Phusion,Query,Question,Regalia,Righteous,Snippet,Sentinel,Template,Thespian,Unity,Enterprise,Verily,Veri,Website,WideWeb,Yap,Yellow,Zebra,Zygote"; |
|
71 | + $words = "MODX,Access,Better,BitCode,Chunk,Cache,Desc,Design,Excell,Enjoy,URLs,TechView,Gerald,Griff,Humphrey,Holiday,Intel,Integration,Joystick,Join(),Oscope,Genetic,Light,Likeness,Marit,Maaike,Niche,Netherlands,Ordinance,Oscillo,Parser,Phusion,Query,Question,Regalia,Righteous,Snippet,Sentinel,Template,Thespian,Unity,Enterprise,Verily,Veri,Website,WideWeb,Yap,Yellow,Zebra,Zygote"; |
|
72 | 72 | $words = $modx->config['captcha_words'] ? $modx->config['captcha_words'] : $words; |
73 | 73 | $arr_words = array_filter(array_map('trim', explode(',', $words))); |
74 | 74 | |
75 | 75 | /* pick one randomly for text verification */ |
76 | - return (string) $arr_words[array_rand($arr_words)].rand(10,999); |
|
76 | + return (string) $arr_words[array_rand($arr_words)].rand(10, 999); |
|
77 | 77 | } |
78 | 78 | |
79 | - public function drawText() { |
|
79 | + public function drawText(){ |
|
80 | 80 | $dir = dir($this->dir_font); |
81 | 81 | $fontstmp = array(); |
82 | 82 | while (false !== ($file = $dir->read())) { |
83 | - if(substr($file, -4) == '.ttf') { |
|
83 | + if (substr($file, -4) == '.ttf') { |
|
84 | 84 | $fontstmp[] = $this->dir_font.$file; |
85 | 85 | } |
86 | 86 | } |
@@ -88,35 +88,35 @@ discard block |
||
88 | 88 | $text_font = (string) $fontstmp[array_rand($fontstmp)]; |
89 | 89 | |
90 | 90 | /* angle for text inclination */ |
91 | - $text_angle = rand(-9,9); |
|
91 | + $text_angle = rand(-9, 9); |
|
92 | 92 | /* initial text size */ |
93 | 93 | $text_size = 30; |
94 | 94 | /* calculate text width and height */ |
95 | - $box = imagettfbbox ( $text_size, $text_angle, $text_font, $this->word); |
|
96 | - $text_width = $box[2]-$box[0]; //text width |
|
97 | - $text_height= $box[5]-$box[3]; //text height |
|
95 | + $box = imagettfbbox($text_size, $text_angle, $text_font, $this->word); |
|
96 | + $text_width = $box[2] - $box[0]; //text width |
|
97 | + $text_height = $box[5] - $box[3]; //text height |
|
98 | 98 | |
99 | 99 | /* adjust text size */ |
100 | - $text_size = round((20 * $this->im_width)/$text_width); |
|
100 | + $text_size = round((20 * $this->im_width) / $text_width); |
|
101 | 101 | |
102 | 102 | /* recalculate text width and height */ |
103 | - $box = imagettfbbox ( $text_size, $text_angle, $text_font, $this->word); |
|
104 | - $text_width = $box[2]-$box[0]; //text width |
|
105 | - $text_height= $box[5]-$box[3]; //text height |
|
103 | + $box = imagettfbbox($text_size, $text_angle, $text_font, $this->word); |
|
104 | + $text_width = $box[2] - $box[0]; //text width |
|
105 | + $text_height = $box[5] - $box[3]; //text height |
|
106 | 106 | |
107 | 107 | /* calculate center position of text */ |
108 | - $text_x = ($this->im_width - $text_width)/2; |
|
109 | - $text_y = ($this->im_height - $text_height)/2; |
|
108 | + $text_x = ($this->im_width - $text_width) / 2; |
|
109 | + $text_y = ($this->im_height - $text_height) / 2; |
|
110 | 110 | |
111 | 111 | /* create canvas for text drawing */ |
112 | - $im_text = imagecreate ($this->im_width, $this->im_height); |
|
113 | - $bg_color = imagecolorallocate ($im_text, 255, 255, 255); |
|
112 | + $im_text = imagecreate($this->im_width, $this->im_height); |
|
113 | + $bg_color = imagecolorallocate($im_text, 255, 255, 255); |
|
114 | 114 | |
115 | 115 | /* pick color for text */ |
116 | - $text_color = imagecolorallocate ($im_text, 0, 51, 153); |
|
116 | + $text_color = imagecolorallocate($im_text, 0, 51, 153); |
|
117 | 117 | |
118 | 118 | /* draw text into canvas */ |
119 | - imagettftext ( $im_text, |
|
119 | + imagettftext($im_text, |
|
120 | 120 | $text_size, |
121 | 121 | $text_angle, |
122 | 122 | $text_x, |
@@ -131,19 +131,19 @@ discard block |
||
131 | 131 | } |
132 | 132 | |
133 | 133 | |
134 | - public function drawImage() { |
|
134 | + public function drawImage(){ |
|
135 | 135 | |
136 | 136 | /* pick one background image randomly from image directory */ |
137 | - $img_file = MODX_BASE_PATH . 'assets/' . $this->dir_noise."noise".rand(1,4).".jpg"; |
|
137 | + $img_file = MODX_BASE_PATH.'assets/'.$this->dir_noise."noise".rand(1, 4).".jpg"; |
|
138 | 138 | |
139 | 139 | /* create "noise" background image from your image stock*/ |
140 | - $noise_img = @imagecreatefromjpeg ($img_file); |
|
140 | + $noise_img = @imagecreatefromjpeg($img_file); |
|
141 | 141 | $noise_width = imagesx($noise_img); |
142 | 142 | $noise_height = imagesy($noise_img); |
143 | 143 | |
144 | 144 | /* resize the background image to fit the size of image output */ |
145 | - $this->im = imagecreatetruecolor($this->im_width,$this->im_height); |
|
146 | - imagecopyresampled ($this->im, |
|
145 | + $this->im = imagecreatetruecolor($this->im_width, $this->im_height); |
|
146 | + imagecopyresampled($this->im, |
|
147 | 147 | $noise_img, |
148 | 148 | 0, 0, 0, 0, |
149 | 149 | $this->im_width, |
@@ -152,17 +152,17 @@ discard block |
||
152 | 152 | $noise_height); |
153 | 153 | |
154 | 154 | /* put text image into background image */ |
155 | - imagecopymerge ( $this->im, |
|
155 | + imagecopymerge($this->im, |
|
156 | 156 | $this->drawText(), |
157 | 157 | 0, 0, 0, 0, |
158 | 158 | $this->im_width, |
159 | 159 | $this->im_height, |
160 | - 70 ); |
|
160 | + 70); |
|
161 | 161 | |
162 | 162 | return $this->im; |
163 | 163 | } |
164 | 164 | |
165 | - public function destroy() { |
|
165 | + public function destroy(){ |
|
166 | 166 | imagedestroy($this->im); |
167 | 167 | } |
168 | 168 | } |
@@ -43,7 +43,8 @@ discard block |
||
43 | 43 | public $im_height = 0; |
44 | 44 | public $im; |
45 | 45 | |
46 | - public function __construct($w=200, $h=80) { |
|
46 | + public function __construct($w=200, $h=80) |
|
47 | + { |
|
47 | 48 | /* create session to set word for verification */ |
48 | 49 | $this->setVeriword(); |
49 | 50 | $this->dir_font = MODX_BASE_PATH . 'assets/' . $this->dir_font; |
@@ -51,21 +52,24 @@ discard block |
||
51 | 52 | $this->im_height = $h; |
52 | 53 | } |
53 | 54 | |
54 | - public function setVeriword() { |
|
55 | + public function setVeriword() |
|
56 | + { |
|
55 | 57 | /* create session variable for verification, |
56 | 58 | you may change the session variable name */ |
57 | 59 | $this->word = $this->makeText(); |
58 | 60 | $_SESSION['veriword'] = $this->word; |
59 | 61 | } |
60 | 62 | |
61 | - public function output() { |
|
63 | + public function output() |
|
64 | + { |
|
62 | 65 | /* output the image as jpeg */ |
63 | 66 | $this->drawImage(); |
64 | 67 | header("Content-type: image/jpeg"); |
65 | 68 | imagejpeg($this->im); |
66 | 69 | } |
67 | 70 | |
68 | - public function makeText() { |
|
71 | + public function makeText() |
|
72 | + { |
|
69 | 73 | $modx = evolutionCMS(); |
70 | 74 | // set default words |
71 | 75 | $words="MODX,Access,Better,BitCode,Chunk,Cache,Desc,Design,Excell,Enjoy,URLs,TechView,Gerald,Griff,Humphrey,Holiday,Intel,Integration,Joystick,Join(),Oscope,Genetic,Light,Likeness,Marit,Maaike,Niche,Netherlands,Ordinance,Oscillo,Parser,Phusion,Query,Question,Regalia,Righteous,Snippet,Sentinel,Template,Thespian,Unity,Enterprise,Verily,Veri,Website,WideWeb,Yap,Yellow,Zebra,Zygote"; |
@@ -76,7 +80,8 @@ discard block |
||
76 | 80 | return (string) $arr_words[array_rand($arr_words)].rand(10,999); |
77 | 81 | } |
78 | 82 | |
79 | - public function drawText() { |
|
83 | + public function drawText() |
|
84 | + { |
|
80 | 85 | $dir = dir($this->dir_font); |
81 | 86 | $fontstmp = array(); |
82 | 87 | while (false !== ($file = $dir->read())) { |
@@ -131,7 +136,8 @@ discard block |
||
131 | 136 | } |
132 | 137 | |
133 | 138 | |
134 | - public function drawImage() { |
|
139 | + public function drawImage() |
|
140 | + { |
|
135 | 141 | |
136 | 142 | /* pick one background image randomly from image directory */ |
137 | 143 | $img_file = MODX_BASE_PATH . 'assets/' . $this->dir_noise."noise".rand(1,4).".jpg"; |
@@ -162,7 +168,8 @@ discard block |
||
162 | 168 | return $this->im; |
163 | 169 | } |
164 | 170 | |
165 | - public function destroy() { |
|
171 | + public function destroy() |
|
172 | + { |
|
166 | 173 | imagedestroy($this->im); |
167 | 174 | } |
168 | 175 | } |
@@ -8,8 +8,8 @@ |
||
8 | 8 | * @todo could be unnecessary |
9 | 9 | * |
10 | 10 | */ |
11 | -Class TemplateParser extends EvolutionCMS\Legacy\TemplateParser |
|
12 | -{ |
|
11 | +Class TemplateParser extends EvolutionCMS\Legacy\TemplateParser |
|
12 | +{ |
|
13 | 13 | } |
14 | 14 | |
15 | 15 | ?> |
@@ -8,7 +8,7 @@ |
||
8 | 8 | * @todo could be unnecessary |
9 | 9 | * |
10 | 10 | */ |
11 | -Class TemplateParser extends EvolutionCMS\Legacy\TemplateParser |
|
11 | +class TemplateParser extends EvolutionCMS\Legacy\TemplateParser |
|
12 | 12 | { |
13 | 13 | } |
14 | 14 |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | $_ = crc32(__FILE__); |
33 | 33 | $_ = sprintf('%u', $_); |
34 | 34 | |
35 | - return 'evo' . base_convert($_, 10, 36); |
|
35 | + return 'evo'.base_convert($_, 10, 36); |
|
36 | 36 | } |
37 | 37 | } |
38 | 38 | |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | session_start(); |
58 | 58 | $key = "modx.mgr.session.cookie.lifetime"; |
59 | 59 | if (isset($_SESSION[$key]) && is_numeric($_SESSION[$key])) { |
60 | - $cookieLifetime = (int)$_SESSION[$key]; |
|
60 | + $cookieLifetime = (int) $_SESSION[$key]; |
|
61 | 61 | if ($cookieLifetime) { |
62 | 62 | $cookieExpiration = $_SERVER['REQUEST_TIME'] + $cookieLifetime; |
63 | 63 | } |
@@ -4,24 +4,24 @@ discard block |
||
4 | 4 | } |
5 | 5 | |
6 | 6 | if(!$modx->hasPermission('category_manager')) { |
7 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
7 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
8 | 8 | } |
9 | 9 | |
10 | 10 | $_module_params = array( |
11 | - 'module_version' => '1.0.0', |
|
12 | - 'module_params' => '', |
|
13 | - 'module_id' => $_GET['id'], |
|
14 | - 'package_name' => 'Module_Categories_Manager', |
|
15 | - 'native_language' => 'de', |
|
16 | - 'name' => 'Categories Manager', |
|
17 | - 'dirname' => $site_manager_url, |
|
18 | - 'url' => 'index.php?a=120&id=' . $_GET['id'], |
|
19 | - 'path' => realpath( dirname(__FILE__) ) . DIRECTORY_SEPARATOR . 'category_mgr' . DIRECTORY_SEPARATOR, |
|
20 | - 'inc_dir' => realpath( dirname(__FILE__) ) . DIRECTORY_SEPARATOR . 'category_mgr' . DIRECTORY_SEPARATOR . 'inc' . DIRECTORY_SEPARATOR, |
|
21 | - 'languages_dir' => realpath( dirname(__FILE__) ) . DIRECTORY_SEPARATOR . 'category_mgr' . DIRECTORY_SEPARATOR . 'lang' . DIRECTORY_SEPARATOR, |
|
22 | - 'views_dir' => realpath( dirname(__FILE__) ) . DIRECTORY_SEPARATOR . 'category_mgr' . DIRECTORY_SEPARATOR . 'skin' . DIRECTORY_SEPARATOR, |
|
23 | - 'request_key' => 'module_categories_manager', |
|
24 | - 'messages' => array() |
|
11 | + 'module_version' => '1.0.0', |
|
12 | + 'module_params' => '', |
|
13 | + 'module_id' => $_GET['id'], |
|
14 | + 'package_name' => 'Module_Categories_Manager', |
|
15 | + 'native_language' => 'de', |
|
16 | + 'name' => 'Categories Manager', |
|
17 | + 'dirname' => $site_manager_url, |
|
18 | + 'url' => 'index.php?a=120&id=' . $_GET['id'], |
|
19 | + 'path' => realpath( dirname(__FILE__) ) . DIRECTORY_SEPARATOR . 'category_mgr' . DIRECTORY_SEPARATOR, |
|
20 | + 'inc_dir' => realpath( dirname(__FILE__) ) . DIRECTORY_SEPARATOR . 'category_mgr' . DIRECTORY_SEPARATOR . 'inc' . DIRECTORY_SEPARATOR, |
|
21 | + 'languages_dir' => realpath( dirname(__FILE__) ) . DIRECTORY_SEPARATOR . 'category_mgr' . DIRECTORY_SEPARATOR . 'lang' . DIRECTORY_SEPARATOR, |
|
22 | + 'views_dir' => realpath( dirname(__FILE__) ) . DIRECTORY_SEPARATOR . 'category_mgr' . DIRECTORY_SEPARATOR . 'skin' . DIRECTORY_SEPARATOR, |
|
23 | + 'request_key' => 'module_categories_manager', |
|
24 | + 'messages' => array() |
|
25 | 25 | ); |
26 | 26 | |
27 | 27 | $cm = new EvolutionCMS\Legacy\ModuleCategoriesManager(); |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | // assign module_params to internal params |
30 | 30 | foreach( $_module_params as $param => $value ) |
31 | 31 | { |
32 | - $cm->set( $param, $value ); |
|
32 | + $cm->set( $param, $value ); |
|
33 | 33 | } |
34 | 34 | |
35 | 35 | // catch the request actions |
@@ -37,8 +37,8 @@ discard block |
||
37 | 37 | |
38 | 38 | if( !$categories = $cm->getCategories() ) |
39 | 39 | { |
40 | - setcookie('webfxtab_manage-categories-pane', 0 ); |
|
41 | - $cm->addMessage( $cm->txt('Currently no categories available... JUST ADD A NEW ONE!'), 'global' ); |
|
40 | + setcookie('webfxtab_manage-categories-pane', 0 ); |
|
41 | + $cm->addMessage( $cm->txt('Currently no categories available... JUST ADD A NEW ONE!'), 'global' ); |
|
42 | 42 | } |
43 | 43 | |
44 | 44 | $cm->renderView('main', $categories ); |
@@ -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 | -if(!$modx->hasPermission('category_manager')) { |
|
6 | +if (!$modx->hasPermission('category_manager')) { |
|
7 | 7 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
8 | 8 | } |
9 | 9 | |
@@ -15,11 +15,11 @@ discard block |
||
15 | 15 | 'native_language' => 'de', |
16 | 16 | 'name' => 'Categories Manager', |
17 | 17 | 'dirname' => $site_manager_url, |
18 | - 'url' => 'index.php?a=120&id=' . $_GET['id'], |
|
19 | - 'path' => realpath( dirname(__FILE__) ) . DIRECTORY_SEPARATOR . 'category_mgr' . DIRECTORY_SEPARATOR, |
|
20 | - 'inc_dir' => realpath( dirname(__FILE__) ) . DIRECTORY_SEPARATOR . 'category_mgr' . DIRECTORY_SEPARATOR . 'inc' . DIRECTORY_SEPARATOR, |
|
21 | - 'languages_dir' => realpath( dirname(__FILE__) ) . DIRECTORY_SEPARATOR . 'category_mgr' . DIRECTORY_SEPARATOR . 'lang' . DIRECTORY_SEPARATOR, |
|
22 | - 'views_dir' => realpath( dirname(__FILE__) ) . DIRECTORY_SEPARATOR . 'category_mgr' . DIRECTORY_SEPARATOR . 'skin' . DIRECTORY_SEPARATOR, |
|
18 | + 'url' => 'index.php?a=120&id='.$_GET['id'], |
|
19 | + 'path' => realpath(dirname(__FILE__)).DIRECTORY_SEPARATOR.'category_mgr'.DIRECTORY_SEPARATOR, |
|
20 | + 'inc_dir' => realpath(dirname(__FILE__)).DIRECTORY_SEPARATOR.'category_mgr'.DIRECTORY_SEPARATOR.'inc'.DIRECTORY_SEPARATOR, |
|
21 | + 'languages_dir' => realpath(dirname(__FILE__)).DIRECTORY_SEPARATOR.'category_mgr'.DIRECTORY_SEPARATOR.'lang'.DIRECTORY_SEPARATOR, |
|
22 | + 'views_dir' => realpath(dirname(__FILE__)).DIRECTORY_SEPARATOR.'category_mgr'.DIRECTORY_SEPARATOR.'skin'.DIRECTORY_SEPARATOR, |
|
23 | 23 | 'request_key' => 'module_categories_manager', |
24 | 24 | 'messages' => array() |
25 | 25 | ); |
@@ -27,19 +27,19 @@ discard block |
||
27 | 27 | $cm = new EvolutionCMS\Legacy\ModuleCategoriesManager(); |
28 | 28 | |
29 | 29 | // assign module_params to internal params |
30 | -foreach( $_module_params as $param => $value ) |
|
30 | +foreach ($_module_params as $param => $value) |
|
31 | 31 | { |
32 | - $cm->set( $param, $value ); |
|
32 | + $cm->set($param, $value); |
|
33 | 33 | } |
34 | 34 | |
35 | 35 | // catch the request actions |
36 | -include_once $cm->get('inc_dir') . 'request_trigger.inc.php'; |
|
36 | +include_once $cm->get('inc_dir').'request_trigger.inc.php'; |
|
37 | 37 | |
38 | -if( !$categories = $cm->getCategories() ) |
|
38 | +if (!$categories = $cm->getCategories()) |
|
39 | 39 | { |
40 | - setcookie('webfxtab_manage-categories-pane', 0 ); |
|
41 | - $cm->addMessage( $cm->txt('Currently no categories available... JUST ADD A NEW ONE!'), 'global' ); |
|
40 | + setcookie('webfxtab_manage-categories-pane', 0); |
|
41 | + $cm->addMessage($cm->txt('Currently no categories available... JUST ADD A NEW ONE!'), 'global'); |
|
42 | 42 | } |
43 | 43 | |
44 | -$cm->renderView('main', $categories ); |
|
44 | +$cm->renderView('main', $categories); |
|
45 | 45 | return; |
@@ -27,16 +27,14 @@ |
||
27 | 27 | $cm = new EvolutionCMS\Legacy\ModuleCategoriesManager(); |
28 | 28 | |
29 | 29 | // assign module_params to internal params |
30 | -foreach( $_module_params as $param => $value ) |
|
31 | -{ |
|
30 | +foreach( $_module_params as $param => $value ) { |
|
32 | 31 | $cm->set( $param, $value ); |
33 | 32 | } |
34 | 33 | |
35 | 34 | // catch the request actions |
36 | 35 | include_once $cm->get('inc_dir') . 'request_trigger.inc.php'; |
37 | 36 | |
38 | -if( !$categories = $cm->getCategories() ) |
|
39 | -{ |
|
37 | +if( !$categories = $cm->getCategories() ) { |
|
40 | 38 | setcookie('webfxtab_manage-categories-pane', 0 ); |
41 | 39 | $cm->addMessage( $cm->txt('Currently no categories available... JUST ADD A NEW ONE!'), 'global' ); |
42 | 40 | } |
@@ -1,5 +1,5 @@ |
||
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,4 +6,6 @@ |
||
6 | 6 | /** |
7 | 7 | * Don't delete |
8 | 8 | */ |
9 | -class mgrResources extends EvolutionCMS\Legacy\mgrResources{} |
|
9 | +class mgrResources extends EvolutionCMS\Legacy\mgrResources |
|
10 | +{ |
|
11 | +} |
@@ -4,4 +4,6 @@ |
||
4 | 4 | * Class to handle the modx-categories |
5 | 5 | * @deprecated use EvolutionCMS\Legacy\Categories |
6 | 6 | */ |
7 | -class Categories extends EvolutionCMS\Legacy\Categories{} |
|
7 | +class Categories extends EvolutionCMS\Legacy\Categories |
|
8 | +{ |
|
9 | +} |