@@ -16,27 +16,27 @@ discard block |
||
16 | 16 | * |
17 | 17 | */ |
18 | 18 | |
19 | -class RSSCache { |
|
20 | - var $BASE_CACHE = './cache'; // where the cache files are stored |
|
21 | - var $MAX_AGE = 3600; // when are files stale, default one hour |
|
22 | - var $ERROR = ""; // accumulate error messages |
|
19 | +class RSSCache{ |
|
20 | + var $BASE_CACHE = './cache'; // where the cache files are stored |
|
21 | + var $MAX_AGE = 3600; // when are files stale, default one hour |
|
22 | + var $ERROR = ""; // accumulate error messages |
|
23 | 23 | |
24 | - function __construct($base='', $age='') { |
|
25 | - if ( $base ) { |
|
24 | + function __construct($base = '', $age = ''){ |
|
25 | + if ($base) { |
|
26 | 26 | $this->BASE_CACHE = $base; |
27 | 27 | } |
28 | - if ( $age ) { |
|
28 | + if ($age) { |
|
29 | 29 | $this->MAX_AGE = $age; |
30 | 30 | } |
31 | 31 | |
32 | 32 | // attempt to make the cache directory |
33 | - if ( ! file_exists( $this->BASE_CACHE ) ) { |
|
34 | - $status = @mkdir( $this->BASE_CACHE, 0755 ); |
|
33 | + if (!file_exists($this->BASE_CACHE)) { |
|
34 | + $status = @mkdir($this->BASE_CACHE, 0755); |
|
35 | 35 | |
36 | 36 | // if make failed |
37 | - if ( ! $status ) { |
|
37 | + if (!$status) { |
|
38 | 38 | $this->error( |
39 | - "Cache couldn't make dir '" . $this->BASE_CACHE . "'." |
|
39 | + "Cache couldn't make dir '".$this->BASE_CACHE."'." |
|
40 | 40 | ); |
41 | 41 | } |
42 | 42 | } |
@@ -48,12 +48,12 @@ discard block |
||
48 | 48 | Input: url from wich the rss file was fetched |
49 | 49 | Output: true on sucess |
50 | 50 | \*=======================================================================*/ |
51 | - function set ($url, $rss) { |
|
51 | + function set($url, $rss){ |
|
52 | 52 | $this->ERROR = ""; |
53 | - $cache_file = $this->file_name( $url ); |
|
54 | - $fp = @fopen( $cache_file, 'w' ); |
|
53 | + $cache_file = $this->file_name($url); |
|
54 | + $fp = @fopen($cache_file, 'w'); |
|
55 | 55 | |
56 | - if ( ! $fp ) { |
|
56 | + if (!$fp) { |
|
57 | 57 | $this->error( |
58 | 58 | "Cache unable to open file for writing: $cache_file" |
59 | 59 | ); |
@@ -61,9 +61,9 @@ discard block |
||
61 | 61 | } |
62 | 62 | |
63 | 63 | |
64 | - $data = $this->serialize( $rss ); |
|
65 | - fwrite( $fp, $data ); |
|
66 | - fclose( $fp ); |
|
64 | + $data = $this->serialize($rss); |
|
65 | + fwrite($fp, $data); |
|
66 | + fclose($fp); |
|
67 | 67 | |
68 | 68 | return $cache_file; |
69 | 69 | } |
@@ -74,11 +74,11 @@ discard block |
||
74 | 74 | Input: url from wich the rss file was fetched |
75 | 75 | Output: cached object on HIT, false on MISS |
76 | 76 | \*=======================================================================*/ |
77 | - function get ($url) { |
|
77 | + function get($url){ |
|
78 | 78 | $this->ERROR = ""; |
79 | - $cache_file = $this->file_name( $url ); |
|
79 | + $cache_file = $this->file_name($url); |
|
80 | 80 | |
81 | - if ( ! file_exists( $cache_file ) ) { |
|
81 | + if (!file_exists($cache_file)) { |
|
82 | 82 | $this->debug( |
83 | 83 | "Cache doesn't contain: $url (cache file: $cache_file)" |
84 | 84 | ); |
@@ -86,16 +86,16 @@ discard block |
||
86 | 86 | } |
87 | 87 | |
88 | 88 | $fp = @fopen($cache_file, 'r'); |
89 | - if ( ! $fp ) { |
|
89 | + if (!$fp) { |
|
90 | 90 | $this->error( |
91 | 91 | "Failed to open cache file for reading: $cache_file" |
92 | 92 | ); |
93 | 93 | return 0; |
94 | 94 | } |
95 | 95 | |
96 | - if ($filesize = filesize($cache_file) ) { |
|
97 | - $data = fread( $fp, filesize($cache_file) ); |
|
98 | - $rss = $this->unserialize( $data ); |
|
96 | + if ($filesize = filesize($cache_file)) { |
|
97 | + $data = fread($fp, filesize($cache_file)); |
|
98 | + $rss = $this->unserialize($data); |
|
99 | 99 | |
100 | 100 | return $rss; |
101 | 101 | } |
@@ -110,16 +110,16 @@ discard block |
||
110 | 110 | Input: url from wich the rss file was fetched |
111 | 111 | Output: cached object on HIT, false on MISS |
112 | 112 | \*=======================================================================*/ |
113 | - function check_cache ( $url ) { |
|
113 | + function check_cache($url){ |
|
114 | 114 | $this->ERROR = ""; |
115 | - $filename = $this->file_name( $url ); |
|
115 | + $filename = $this->file_name($url); |
|
116 | 116 | |
117 | - if ( file_exists( $filename ) ) { |
|
117 | + if (file_exists($filename)) { |
|
118 | 118 | // find how long ago the file was added to the cache |
119 | 119 | // and whether that is longer then MAX_AGE |
120 | - $mtime = filemtime( $filename ); |
|
120 | + $mtime = filemtime($filename); |
|
121 | 121 | $age = time() - $mtime; |
122 | - if ( $this->MAX_AGE > $age ) { |
|
122 | + if ($this->MAX_AGE > $age) { |
|
123 | 123 | // object exists and is current |
124 | 124 | return 'HIT'; |
125 | 125 | } |
@@ -134,10 +134,10 @@ discard block |
||
134 | 134 | } |
135 | 135 | } |
136 | 136 | |
137 | - function cache_age( $cache_key ) { |
|
138 | - $filename = $this->file_name( $url ); |
|
139 | - if ( file_exists( $filename ) ) { |
|
140 | - $mtime = filemtime( $filename ); |
|
137 | + function cache_age($cache_key){ |
|
138 | + $filename = $this->file_name($url); |
|
139 | + if (file_exists($filename)) { |
|
140 | + $mtime = filemtime($filename); |
|
141 | 141 | $age = time() - $mtime; |
142 | 142 | return $age; |
143 | 143 | } |
@@ -149,15 +149,15 @@ discard block |
||
149 | 149 | /*=======================================================================*\ |
150 | 150 | Function: serialize |
151 | 151 | \*=======================================================================*/ |
152 | - function serialize ( $rss ) { |
|
153 | - return serialize( $rss ); |
|
152 | + function serialize($rss){ |
|
153 | + return serialize($rss); |
|
154 | 154 | } |
155 | 155 | |
156 | 156 | /*=======================================================================*\ |
157 | 157 | Function: unserialize |
158 | 158 | \*=======================================================================*/ |
159 | - function unserialize ( $data ) { |
|
160 | - return unserialize( $data ); |
|
159 | + function unserialize($data){ |
|
160 | + return unserialize($data); |
|
161 | 161 | } |
162 | 162 | |
163 | 163 | /*=======================================================================*\ |
@@ -166,31 +166,31 @@ discard block |
||
166 | 166 | Input: url from wich the rss file was fetched |
167 | 167 | Output: a file name |
168 | 168 | \*=======================================================================*/ |
169 | - function file_name ($url) { |
|
170 | - $filename = md5( $url ); |
|
171 | - return implode( DIRECTORY_SEPARATOR, array( $this->BASE_CACHE, $filename ) ); |
|
169 | + function file_name($url){ |
|
170 | + $filename = md5($url); |
|
171 | + return implode(DIRECTORY_SEPARATOR, array($this->BASE_CACHE, $filename)); |
|
172 | 172 | } |
173 | 173 | |
174 | 174 | /*=======================================================================*\ |
175 | 175 | Function: error |
176 | 176 | Purpose: register error |
177 | 177 | \*=======================================================================*/ |
178 | - function error ($errormsg, $lvl=E_USER_WARNING) { |
|
178 | + function error($errormsg, $lvl = E_USER_WARNING){ |
|
179 | 179 | // append PHP's error message if track_errors enabled |
180 | - if ( isset($php_errormsg) ) { |
|
180 | + if (isset($php_errormsg)) { |
|
181 | 181 | $errormsg .= " ($php_errormsg)"; |
182 | 182 | } |
183 | 183 | $this->ERROR = $errormsg; |
184 | - if ( MAGPIE_DEBUG ) { |
|
185 | - trigger_error( $errormsg, $lvl); |
|
184 | + if (MAGPIE_DEBUG) { |
|
185 | + trigger_error($errormsg, $lvl); |
|
186 | 186 | } |
187 | 187 | else { |
188 | - error_log( $errormsg, 0); |
|
188 | + error_log($errormsg, 0); |
|
189 | 189 | } |
190 | 190 | } |
191 | 191 | |
192 | - function debug ($debugmsg, $lvl=E_USER_NOTICE) { |
|
193 | - if ( MAGPIE_DEBUG ) { |
|
192 | + function debug($debugmsg, $lvl = E_USER_NOTICE){ |
|
193 | + if (MAGPIE_DEBUG) { |
|
194 | 194 | $this->error("MagpieRSS [debug] $debugmsg", $lvl); |
195 | 195 | } |
196 | 196 | } |
@@ -1,12 +1,12 @@ 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 | if (!$modx->hasPermission('save_plugin')) { |
6 | 6 | $modx->webAlertAndQuit($_lang['error_no_privileges']); |
7 | 7 | } |
8 | 8 | |
9 | -$id = (int)$_POST['id']; |
|
9 | +$id = (int) $_POST['id']; |
|
10 | 10 | $name = $modx->db->escape(trim($_POST['name'])); |
11 | 11 | $description = $modx->db->escape($_POST['description']); |
12 | 12 | $locked = $_POST['locked'] == 'on' ? '1' : '0'; |
@@ -20,11 +20,11 @@ discard block |
||
20 | 20 | |
21 | 21 | //Kyle Jaebker - added category support |
22 | 22 | if (empty($_POST['newcategory']) && $_POST['categoryid'] > 0) { |
23 | - $categoryid = (int)$_POST['categoryid']; |
|
23 | + $categoryid = (int) $_POST['categoryid']; |
|
24 | 24 | } elseif (empty($_POST['newcategory']) && $_POST['categoryid'] <= 0) { |
25 | 25 | $categoryid = 0; |
26 | 26 | } else { |
27 | - include_once(MODX_MANAGER_PATH . 'includes/categories.inc.php'); |
|
27 | + include_once(MODX_MANAGER_PATH.'includes/categories.inc.php'); |
|
28 | 28 | $categoryid = getCategory($_POST['newcategory']); |
29 | 29 | } |
30 | 30 | |
@@ -40,12 +40,12 @@ discard block |
||
40 | 40 | $moduleguid = isset($parsed['guid']) ? $parsed['guid'] : $moduleguid; |
41 | 41 | |
42 | 42 | $description = isset($parsed['description']) ? $parsed['description'] : $description; |
43 | - $version = isset($parsed['version']) ? '<b>' . $parsed['version'] . '</b> ' : ''; |
|
43 | + $version = isset($parsed['version']) ? '<b>'.$parsed['version'].'</b> ' : ''; |
|
44 | 44 | if ($version) { |
45 | - $description = $version . trim(preg_replace('/(<b>.+?)+(<\/b>)/i', '', $description)); |
|
45 | + $description = $version.trim(preg_replace('/(<b>.+?)+(<\/b>)/i', '', $description)); |
|
46 | 46 | } |
47 | 47 | if (isset($parsed['modx_category'])) { |
48 | - include_once(MODX_MANAGER_PATH . 'includes/categories.inc.php'); |
|
48 | + include_once(MODX_MANAGER_PATH.'includes/categories.inc.php'); |
|
49 | 49 | $categoryid = getCategory($parsed['modx_category']); |
50 | 50 | } |
51 | 51 | } |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | // finished emptying cache - redirect |
104 | 104 | if ($_POST['stay'] != '') { |
105 | 105 | $a = ($_POST['stay'] == '2') ? "102&id=$newid" : '101'; |
106 | - $header = 'Location: index.php?a=' . $a . '&r=2&stay=' . $_POST['stay']; |
|
106 | + $header = 'Location: index.php?a='.$a.'&r=2&stay='.$_POST['stay']; |
|
107 | 107 | header($header); |
108 | 108 | } else { |
109 | 109 | $header = 'Location: index.php?a=76&r=2'; |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | // finished emptying cache - redirect |
159 | 159 | if ($_POST['stay'] != '') { |
160 | 160 | $a = ($_POST['stay'] == '2') ? "102&id=$id" : '101'; |
161 | - $header = 'Location: index.php?a=' . $a . '&r=2&stay=' . $_POST['stay']; |
|
161 | + $header = 'Location: index.php?a='.$a.'&r=2&stay='.$_POST['stay']; |
|
162 | 162 | header($header); |
163 | 163 | } else { |
164 | 164 | $modx->unlockElement(5, $id); |
@@ -177,7 +177,7 @@ discard block |
||
177 | 177 | // save selected system events |
178 | 178 | $formEventList = array(); |
179 | 179 | foreach ($sysevents as $evtId) { |
180 | - if(!preg_match('@^[1-9][0-9]*$@',$evtId)) $evtId = getEventIdByName($evtId); |
|
180 | + if (!preg_match('@^[1-9][0-9]*$@', $evtId)) $evtId = getEventIdByName($evtId); |
|
181 | 181 | if ($mode == '101') { |
182 | 182 | $rs = $modx->db->select('max(priority) as priority', '[+prefix+]site_plugin_events', "evtid='{$evtId}'"); |
183 | 183 | } else { |
@@ -202,13 +202,13 @@ discard block |
||
202 | 202 | $rs = $modx->db->select('*', '[+prefix+]site_plugin_events', sprintf("pluginid='%s'", $id)); |
203 | 203 | $dbEventList = array(); |
204 | 204 | $del = array(); |
205 | - while($row = $modx->db->getRow($rs)) { |
|
206 | - if(!in_array($row['evtid'], $evtids)) $del[] = $row['evtid']; |
|
205 | + while ($row = $modx->db->getRow($rs)) { |
|
206 | + if (!in_array($row['evtid'], $evtids)) $del[] = $row['evtid']; |
|
207 | 207 | } |
208 | 208 | |
209 | - if(empty($del)) return; |
|
209 | + if (empty($del)) return; |
|
210 | 210 | |
211 | - foreach($del as $delid) { |
|
211 | + foreach ($del as $delid) { |
|
212 | 212 | $modx->db->delete('[+prefix+]site_plugin_events', sprintf("evtid='%s' AND pluginid='%s'", $delid, $id)); |
213 | 213 | } |
214 | 214 | } |
@@ -216,9 +216,9 @@ discard block |
||
216 | 216 | function getEventIdByName($name) |
217 | 217 | { |
218 | 218 | global $modx; |
219 | - static $eventIds=array(); |
|
219 | + static $eventIds = array(); |
|
220 | 220 | |
221 | - if(isset($eventIds[$name])) return $eventIds[$name]; |
|
221 | + if (isset($eventIds[$name])) return $eventIds[$name]; |
|
222 | 222 | |
223 | 223 | $rs = $modx->db->select('id, name', '[+prefix+]system_eventnames'); |
224 | 224 | while ($row = $modx->db->getRow($rs)) { |
@@ -5,7 +5,7 @@ discard block |
||
5 | 5 | $modx->getSettings(); |
6 | 6 | $modx->invokeEvent('OnWebPageInit'); |
7 | 7 | |
8 | -$vword = new VeriWord(148,60); |
|
8 | +$vword = new VeriWord(148, 60); |
|
9 | 9 | $vword->output_image(); |
10 | 10 | $vword->destroy_image(); |
11 | 11 | |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | ## see sample.php for test and usage |
42 | 42 | ## sample URL: http://www.program-ruti.org/veriword/ |
43 | 43 | #### |
44 | -class VeriWord { |
|
44 | +class VeriWord{ |
|
45 | 45 | |
46 | 46 | /* path to font directory*/ |
47 | 47 | public $dir_font = "ttf/"; |
@@ -52,44 +52,44 @@ discard block |
||
52 | 52 | public $im_height = 0; |
53 | 53 | public $im; |
54 | 54 | |
55 | - public function __construct($w=200, $h=80) { |
|
55 | + public function __construct($w = 200, $h = 80){ |
|
56 | 56 | /* create session to set word for verification */ |
57 | 57 | $this->set_veriword(); |
58 | - $this->dir_font = dirname(__FILE__) . '/' . $this->dir_font; |
|
58 | + $this->dir_font = dirname(__FILE__).'/'.$this->dir_font; |
|
59 | 59 | $this->im_width = $w; |
60 | 60 | $this->im_height = $h; |
61 | 61 | } |
62 | 62 | |
63 | - public function set_veriword() { |
|
63 | + public function set_veriword(){ |
|
64 | 64 | /* create session variable for verification, |
65 | 65 | you may change the session variable name */ |
66 | 66 | $this->word = $this->pick_word(); |
67 | 67 | $_SESSION['veriword'] = $this->word; |
68 | 68 | } |
69 | 69 | |
70 | - public function output_image() { |
|
70 | + public function output_image(){ |
|
71 | 71 | /* output the image as jpeg */ |
72 | 72 | $this->draw_image(); |
73 | 73 | header("Content-type: image/jpeg"); |
74 | 74 | imagejpeg($this->im); |
75 | 75 | } |
76 | 76 | |
77 | - public function pick_word() { |
|
77 | + public function pick_word(){ |
|
78 | 78 | global $modx; |
79 | 79 | // set default words |
80 | - $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"; |
|
80 | + $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"; |
|
81 | 81 | $words = $modx->config['captcha_words'] ? $modx->config['captcha_words'] : $words; |
82 | 82 | $arr_words = array_filter(array_map('trim', explode(',', $words))); |
83 | 83 | |
84 | 84 | /* pick one randomly for text verification */ |
85 | - return (string) $arr_words[array_rand($arr_words)].rand(10,999); |
|
85 | + return (string) $arr_words[array_rand($arr_words)].rand(10, 999); |
|
86 | 86 | } |
87 | 87 | |
88 | - public function draw_text() { |
|
88 | + public function draw_text(){ |
|
89 | 89 | $dir = dir($this->dir_font); |
90 | 90 | $fontstmp = array(); |
91 | 91 | while (false !== ($file = $dir->read())) { |
92 | - if(substr($file, -4) == '.ttf') { |
|
92 | + if (substr($file, -4) == '.ttf') { |
|
93 | 93 | $fontstmp[] = $this->dir_font.$file; |
94 | 94 | } |
95 | 95 | } |
@@ -97,35 +97,35 @@ discard block |
||
97 | 97 | $text_font = (string) $fontstmp[array_rand($fontstmp)]; |
98 | 98 | |
99 | 99 | /* angle for text inclination */ |
100 | - $text_angle = rand(-9,9); |
|
100 | + $text_angle = rand(-9, 9); |
|
101 | 101 | /* initial text size */ |
102 | 102 | $text_size = 30; |
103 | 103 | /* calculate text width and height */ |
104 | - $box = imagettfbbox ( $text_size, $text_angle, $text_font, $this->word); |
|
105 | - $text_width = $box[2]-$box[0]; //text width |
|
106 | - $text_height= $box[5]-$box[3]; //text height |
|
104 | + $box = imagettfbbox($text_size, $text_angle, $text_font, $this->word); |
|
105 | + $text_width = $box[2] - $box[0]; //text width |
|
106 | + $text_height = $box[5] - $box[3]; //text height |
|
107 | 107 | |
108 | 108 | /* adjust text size */ |
109 | - $text_size = round((20 * $this->im_width)/$text_width); |
|
109 | + $text_size = round((20 * $this->im_width) / $text_width); |
|
110 | 110 | |
111 | 111 | /* recalculate text width and height */ |
112 | - $box = imagettfbbox ( $text_size, $text_angle, $text_font, $this->word); |
|
113 | - $text_width = $box[2]-$box[0]; //text width |
|
114 | - $text_height= $box[5]-$box[3]; //text height |
|
112 | + $box = imagettfbbox($text_size, $text_angle, $text_font, $this->word); |
|
113 | + $text_width = $box[2] - $box[0]; //text width |
|
114 | + $text_height = $box[5] - $box[3]; //text height |
|
115 | 115 | |
116 | 116 | /* calculate center position of text */ |
117 | - $text_x = ($this->im_width - $text_width)/2; |
|
118 | - $text_y = ($this->im_height - $text_height)/2; |
|
117 | + $text_x = ($this->im_width - $text_width) / 2; |
|
118 | + $text_y = ($this->im_height - $text_height) / 2; |
|
119 | 119 | |
120 | 120 | /* create canvas for text drawing */ |
121 | - $im_text = imagecreate ($this->im_width, $this->im_height); |
|
122 | - $bg_color = imagecolorallocate ($im_text, 255, 255, 255); |
|
121 | + $im_text = imagecreate($this->im_width, $this->im_height); |
|
122 | + $bg_color = imagecolorallocate($im_text, 255, 255, 255); |
|
123 | 123 | |
124 | 124 | /* pick color for text */ |
125 | - $text_color = imagecolorallocate ($im_text, 0, 51, 153); |
|
125 | + $text_color = imagecolorallocate($im_text, 0, 51, 153); |
|
126 | 126 | |
127 | 127 | /* draw text into canvas */ |
128 | - imagettftext ( $im_text, |
|
128 | + imagettftext($im_text, |
|
129 | 129 | $text_size, |
130 | 130 | $text_angle, |
131 | 131 | $text_x, |
@@ -140,19 +140,19 @@ discard block |
||
140 | 140 | } |
141 | 141 | |
142 | 142 | |
143 | - public function draw_image() { |
|
143 | + public function draw_image(){ |
|
144 | 144 | |
145 | 145 | /* pick one background image randomly from image directory */ |
146 | - $img_file = $this->dir_noise."noise".rand(1,4).".jpg"; |
|
146 | + $img_file = $this->dir_noise."noise".rand(1, 4).".jpg"; |
|
147 | 147 | |
148 | 148 | /* create "noise" background image from your image stock*/ |
149 | - $noise_img = @imagecreatefromjpeg ($img_file); |
|
149 | + $noise_img = @imagecreatefromjpeg($img_file); |
|
150 | 150 | $noise_width = imagesx($noise_img); |
151 | 151 | $noise_height = imagesy($noise_img); |
152 | 152 | |
153 | 153 | /* resize the background image to fit the size of image output */ |
154 | - $this->im = imagecreatetruecolor($this->im_width,$this->im_height); |
|
155 | - imagecopyresampled ($this->im, |
|
154 | + $this->im = imagecreatetruecolor($this->im_width, $this->im_height); |
|
155 | + imagecopyresampled($this->im, |
|
156 | 156 | $noise_img, |
157 | 157 | 0, 0, 0, 0, |
158 | 158 | $this->im_width, |
@@ -161,17 +161,17 @@ discard block |
||
161 | 161 | $noise_height); |
162 | 162 | |
163 | 163 | /* put text image into background image */ |
164 | - imagecopymerge ( $this->im, |
|
164 | + imagecopymerge($this->im, |
|
165 | 165 | $this->draw_text(), |
166 | 166 | 0, 0, 0, 0, |
167 | 167 | $this->im_width, |
168 | 168 | $this->im_height, |
169 | - 70 ); |
|
169 | + 70); |
|
170 | 170 | |
171 | 171 | return $this->im; |
172 | 172 | } |
173 | 173 | |
174 | - public function destroy_image() { |
|
174 | + public function destroy_image(){ |
|
175 | 175 | |
176 | 176 | imagedestroy($this->im); |
177 | 177 |
@@ -3,10 +3,10 @@ discard block |
||
3 | 3 | global $site_sessionname; |
4 | 4 | $site_sessionname = genEvoSessionName(); // For legacy extras not using startCMSSession |
5 | 5 | |
6 | -function genEvoSessionName() { |
|
6 | +function genEvoSessionName(){ |
|
7 | 7 | $_ = crc32(__FILE__); |
8 | 8 | $_ = sprintf('%u', $_); |
9 | - return 'evo' . base_convert($_,10,36); |
|
9 | + return 'evo'.base_convert($_, 10, 36); |
|
10 | 10 | } |
11 | 11 | |
12 | 12 | function startCMSSession(){ |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | |
16 | 16 | session_name($site_sessionname); |
17 | 17 | removeInvalidCmsSessionIds($site_sessionname); |
18 | - $cookieExpiration= 0; |
|
18 | + $cookieExpiration = 0; |
|
19 | 19 | $secure = ((isset ($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on') || $_SERVER['SERVER_PORT'] == $https_port); |
20 | 20 | $cookiePath = !empty($session_cookie_path) ? $session_cookie_path : MODX_BASE_URL; |
21 | 21 | $cookieDomain = !empty($session_cookie_domain) ? $session_cookie_domain : ''; |
@@ -23,8 +23,8 @@ discard block |
||
23 | 23 | session_start(); |
24 | 24 | $key = "modx.mgr.session.cookie.lifetime"; |
25 | 25 | if (isset($_SESSION[$key]) && is_numeric($_SESSION[$key])) { |
26 | - $cookieLifetime= (int)$_SESSION[$key]; |
|
27 | - if($cookieLifetime) $cookieExpiration = $_SERVER['REQUEST_TIME']+$cookieLifetime; |
|
26 | + $cookieLifetime = (int) $_SESSION[$key]; |
|
27 | + if ($cookieLifetime) $cookieExpiration = $_SERVER['REQUEST_TIME'] + $cookieLifetime; |
|
28 | 28 | setcookie(session_name(), session_id(), $cookieExpiration, $cookiePath, $cookieDomain, $secure, true); |
29 | 29 | } |
30 | 30 | if (!isset($_SESSION['modx.session.created.time'])) { |
@@ -32,14 +32,14 @@ discard block |
||
32 | 32 | } |
33 | 33 | } |
34 | 34 | |
35 | -function removeInvalidCmsSessionFromStorage(&$storage, $session_name) { |
|
35 | +function removeInvalidCmsSessionFromStorage(&$storage, $session_name){ |
|
36 | 36 | if (isset($storage[$session_name]) && ($storage[$session_name] === '' || $storage[$session_name] === 'deleted')) |
37 | 37 | { |
38 | 38 | unset($storage[$session_name]); |
39 | 39 | } |
40 | 40 | } |
41 | 41 | |
42 | -function removeInvalidCmsSessionIds($session_name) { |
|
42 | +function removeInvalidCmsSessionIds($session_name){ |
|
43 | 43 | // session ids is invalid iff it is empty string |
44 | 44 | // storage priorioty can see in PHP source ext/session/session.c |
45 | 45 | removeInvalidCmsSessionFromStorage($_COOKIE, $session_name); |