@@ -42,7 +42,7 @@ |
||
| 42 | 42 | //$oDB = &DB::getInstance(); |
| 43 | 43 | //$oModuleModel = getModel('module'); |
| 44 | 44 | |
| 45 | - return new BaseObject(0,'success_updated'); |
|
| 45 | + return new BaseObject(0, 'success_updated'); |
|
| 46 | 46 | } |
| 47 | 47 | } |
| 48 | 48 | /* End of file trash.class.php */ |
@@ -35,7 +35,7 @@ |
||
| 35 | 35 | * |
| 36 | 36 | * Do not use this directly. You can use getInstance() instead. |
| 37 | 37 | * @param string $url url of memcache |
| 38 | - * @return void |
|
| 38 | + * @return false|null |
|
| 39 | 39 | */ |
| 40 | 40 | function CacheMemcache($url) |
| 41 | 41 | { |
@@ -23,7 +23,7 @@ discard block |
||
| 23 | 23 | */ |
| 24 | 24 | function getInstance($url) |
| 25 | 25 | { |
| 26 | - if(!$GLOBALS['__CacheMemcache__']) |
|
| 26 | + if (!$GLOBALS['__CacheMemcache__']) |
|
| 27 | 27 | { |
| 28 | 28 | $GLOBALS['__CacheMemcache__'] = new CacheMemcache($url); |
| 29 | 29 | } |
@@ -41,12 +41,12 @@ discard block |
||
| 41 | 41 | { |
| 42 | 42 | //$config['url'] = array('memcache://localhost:11211'); |
| 43 | 43 | $config['url'] = is_array($url) ? $url : array($url); |
| 44 | - if(class_exists('Memcached')) |
|
| 44 | + if (class_exists('Memcached')) |
|
| 45 | 45 | { |
| 46 | 46 | $this->Memcache = new Memcached; |
| 47 | 47 | $this->SelectedExtension = 'Memcached'; |
| 48 | 48 | } |
| 49 | - elseif(class_exists('Memcache')) |
|
| 49 | + elseif (class_exists('Memcache')) |
|
| 50 | 50 | { |
| 51 | 51 | $this->Memcache = new Memcache; |
| 52 | 52 | $this->SelectedExtension = 'Memcache'; |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | return false; |
| 57 | 57 | } |
| 58 | 58 | |
| 59 | - foreach($config['url'] as $url) |
|
| 59 | + foreach ($config['url'] as $url) |
|
| 60 | 60 | { |
| 61 | 61 | $info = parse_url($url); |
| 62 | 62 | $this->Memcache->addServer($info['host'], $info['port']); |
@@ -70,15 +70,15 @@ discard block |
||
| 70 | 70 | */ |
| 71 | 71 | function isSupport() |
| 72 | 72 | { |
| 73 | - if(isset($GLOBALS['XE_MEMCACHE_SUPPORT'])) |
|
| 73 | + if (isset($GLOBALS['XE_MEMCACHE_SUPPORT'])) |
|
| 74 | 74 | { |
| 75 | 75 | return $GLOBALS['XE_MEMCACHE_SUPPORT']; |
| 76 | 76 | } |
| 77 | - if($this->SelectedExtension === 'Memcached') |
|
| 77 | + if ($this->SelectedExtension === 'Memcached') |
|
| 78 | 78 | { |
| 79 | 79 | return $GLOBALS['XE_MEMCACHE_SUPPORT'] = $this->Memcache->set('xe', 'xe', 1); |
| 80 | 80 | } |
| 81 | - elseif($this->SelectedExtension === 'Memcache') |
|
| 81 | + elseif ($this->SelectedExtension === 'Memcache') |
|
| 82 | 82 | { |
| 83 | 83 | return $GLOBALS['XE_MEMCACHE_SUPPORT'] = $this->Memcache->set('xe', 'xe', MEMCACHE_COMPRESSED, 1); |
| 84 | 84 | } |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | */ |
| 97 | 97 | function getKey($key) |
| 98 | 98 | { |
| 99 | - return md5(_XE_PATH_ . $key); |
|
| 99 | + return md5(_XE_PATH_.$key); |
|
| 100 | 100 | } |
| 101 | 101 | |
| 102 | 102 | /** |
@@ -118,11 +118,11 @@ discard block |
||
| 118 | 118 | */ |
| 119 | 119 | function put($key, $buff, $valid_time = 0) |
| 120 | 120 | { |
| 121 | - if($valid_time == 0) |
|
| 121 | + if ($valid_time == 0) |
|
| 122 | 122 | { |
| 123 | 123 | $valid_time = $this->valid_time; |
| 124 | 124 | } |
| 125 | - if($this->SelectedExtension === 'Memcached') |
|
| 125 | + if ($this->SelectedExtension === 'Memcached') |
|
| 126 | 126 | { |
| 127 | 127 | return $this->Memcache->set($this->getKey($key), array($_SERVER['REQUEST_TIME'], $buff), $valid_time); |
| 128 | 128 | } |
@@ -145,13 +145,13 @@ discard block |
||
| 145 | 145 | $_key = $this->getKey($key); |
| 146 | 146 | |
| 147 | 147 | $obj = $this->Memcache->get($_key); |
| 148 | - if(!$obj || !is_array($obj)) |
|
| 148 | + if (!$obj || !is_array($obj)) |
|
| 149 | 149 | { |
| 150 | 150 | return false; |
| 151 | 151 | } |
| 152 | 152 | unset($obj[1]); |
| 153 | 153 | |
| 154 | - if($modified_time > 0 && $modified_time > $obj[0]) |
|
| 154 | + if ($modified_time > 0 && $modified_time > $obj[0]) |
|
| 155 | 155 | { |
| 156 | 156 | $this->_delete($_key); |
| 157 | 157 | return false; |
@@ -174,12 +174,12 @@ discard block |
||
| 174 | 174 | { |
| 175 | 175 | $_key = $this->getKey($key); |
| 176 | 176 | $obj = $this->Memcache->get($_key); |
| 177 | - if(!$obj || !is_array($obj)) |
|
| 177 | + if (!$obj || !is_array($obj)) |
|
| 178 | 178 | { |
| 179 | 179 | return false; |
| 180 | 180 | } |
| 181 | 181 | |
| 182 | - if($modified_time > 0 && $modified_time > $obj[0]) |
|
| 182 | + if ($modified_time > 0 && $modified_time > $obj[0]) |
|
| 183 | 183 | { |
| 184 | 184 | $this->_delete($_key); |
| 185 | 185 | return false; |
@@ -45,13 +45,11 @@ discard block |
||
| 45 | 45 | { |
| 46 | 46 | $this->Memcache = new Memcached; |
| 47 | 47 | $this->SelectedExtension = 'Memcached'; |
| 48 | - } |
|
| 49 | - elseif(class_exists('Memcache')) |
|
| 48 | + } elseif(class_exists('Memcache')) |
|
| 50 | 49 | { |
| 51 | 50 | $this->Memcache = new Memcache; |
| 52 | 51 | $this->SelectedExtension = 'Memcache'; |
| 53 | - } |
|
| 54 | - else |
|
| 52 | + } else |
|
| 55 | 53 | { |
| 56 | 54 | return false; |
| 57 | 55 | } |
@@ -77,12 +75,10 @@ discard block |
||
| 77 | 75 | if($this->SelectedExtension === 'Memcached') |
| 78 | 76 | { |
| 79 | 77 | return $GLOBALS['XE_MEMCACHE_SUPPORT'] = $this->Memcache->set('xe', 'xe', 1); |
| 80 | - } |
|
| 81 | - elseif($this->SelectedExtension === 'Memcache') |
|
| 78 | + } elseif($this->SelectedExtension === 'Memcache') |
|
| 82 | 79 | { |
| 83 | 80 | return $GLOBALS['XE_MEMCACHE_SUPPORT'] = $this->Memcache->set('xe', 'xe', MEMCACHE_COMPRESSED, 1); |
| 84 | - } |
|
| 85 | - else |
|
| 81 | + } else |
|
| 86 | 82 | { |
| 87 | 83 | return $GLOBALS['XE_MEMCACHE_SUPPORT'] = false; |
| 88 | 84 | } |
@@ -125,8 +121,7 @@ discard block |
||
| 125 | 121 | if($this->SelectedExtension === 'Memcached') |
| 126 | 122 | { |
| 127 | 123 | return $this->Memcache->set($this->getKey($key), array($_SERVER['REQUEST_TIME'], $buff), $valid_time); |
| 128 | - } |
|
| 129 | - else |
|
| 124 | + } else |
|
| 130 | 125 | { |
| 131 | 126 | return $this->Memcache->set($this->getKey($key), array($_SERVER['REQUEST_TIME'], $buff), MEMCACHE_COMPRESSED, $valid_time); |
| 132 | 127 | } |
@@ -25,7 +25,7 @@ discard block |
||
| 25 | 25 | function printContent(&$oModule) |
| 26 | 26 | { |
| 27 | 27 | // Check if the gzip encoding supported |
| 28 | - if( |
|
| 28 | + if ( |
|
| 29 | 29 | (defined('__OB_GZHANDLER_ENABLE__') && __OB_GZHANDLER_ENABLE__ == 1) && |
| 30 | 30 | strpos($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip') !== FALSE && |
| 31 | 31 | extension_loaded('zlib') && |
@@ -36,23 +36,23 @@ discard block |
||
| 36 | 36 | } |
| 37 | 37 | |
| 38 | 38 | // Extract contents to display by the request method |
| 39 | - if(Context::get('xeVirtualRequestMethod') == 'xml') |
|
| 39 | + if (Context::get('xeVirtualRequestMethod') == 'xml') |
|
| 40 | 40 | { |
| 41 | 41 | $handler = new VirtualXMLDisplayHandler(); |
| 42 | 42 | } |
| 43 | - else if(Context::getRequestMethod() == 'XMLRPC') |
|
| 43 | + else if (Context::getRequestMethod() == 'XMLRPC') |
|
| 44 | 44 | { |
| 45 | 45 | $handler = new XMLDisplayHandler(); |
| 46 | - if(strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== FALSE) |
|
| 46 | + if (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== FALSE) |
|
| 47 | 47 | { |
| 48 | 48 | $this->gz_enabled = FALSE; |
| 49 | 49 | } |
| 50 | 50 | } |
| 51 | - else if(Context::getRequestMethod() == 'JSON') |
|
| 51 | + else if (Context::getRequestMethod() == 'JSON') |
|
| 52 | 52 | { |
| 53 | 53 | $handler = new JSONDisplayHandler(); |
| 54 | 54 | } |
| 55 | - else if(Context::getRequestMethod() == 'JS_CALLBACK') |
|
| 55 | + else if (Context::getRequestMethod() == 'JS_CALLBACK') |
|
| 56 | 56 | { |
| 57 | 57 | $handler = new JSCallbackDisplayHandler(); |
| 58 | 58 | } |
@@ -70,9 +70,9 @@ discard block |
||
| 70 | 70 | $called_position = 'before_display_content'; |
| 71 | 71 | $oAddonController = getController('addon'); |
| 72 | 72 | $addon_file = $oAddonController->getCacheFilePath(Mobile::isFromMobilePhone() ? "mobile" : "pc"); |
| 73 | - if(file_exists($addon_file)) include($addon_file); |
|
| 73 | + if (file_exists($addon_file)) include($addon_file); |
|
| 74 | 74 | |
| 75 | - if(method_exists($handler, "prepareToPrint")) |
|
| 75 | + if (method_exists($handler, "prepareToPrint")) |
|
| 76 | 76 | { |
| 77 | 77 | $handler->prepareToPrint($output); |
| 78 | 78 | } |
@@ -80,17 +80,17 @@ discard block |
||
| 80 | 80 | // header output |
| 81 | 81 | |
| 82 | 82 | $httpStatusCode = $oModule->getHttpStatusCode(); |
| 83 | - if($httpStatusCode && $httpStatusCode != 200) |
|
| 83 | + if ($httpStatusCode && $httpStatusCode != 200) |
|
| 84 | 84 | { |
| 85 | 85 | $this->_printHttpStatusCode($httpStatusCode); |
| 86 | 86 | } |
| 87 | 87 | else |
| 88 | 88 | { |
| 89 | - if(Context::getResponseMethod() == 'JSON' || Context::getResponseMethod() == 'JS_CALLBACK') |
|
| 89 | + if (Context::getResponseMethod() == 'JSON' || Context::getResponseMethod() == 'JS_CALLBACK') |
|
| 90 | 90 | { |
| 91 | 91 | $this->_printJSONHeader(); |
| 92 | 92 | } |
| 93 | - else if(Context::getResponseMethod() != 'HTML') |
|
| 93 | + else if (Context::getResponseMethod() != 'HTML') |
|
| 94 | 94 | { |
| 95 | 95 | $this->_printXMLHeader(); |
| 96 | 96 | } |
@@ -106,13 +106,13 @@ discard block |
||
| 106 | 106 | |
| 107 | 107 | // disable gzip if output already exists |
| 108 | 108 | ob_flush(); |
| 109 | - if(headers_sent()) |
|
| 109 | + if (headers_sent()) |
|
| 110 | 110 | { |
| 111 | 111 | $this->gz_enabled = FALSE; |
| 112 | 112 | } |
| 113 | 113 | |
| 114 | 114 | // enable gzip using zlib extension |
| 115 | - if($this->gz_enabled) |
|
| 115 | + if ($this->gz_enabled) |
|
| 116 | 116 | { |
| 117 | 117 | ini_set('zlib.output_compression', true); |
| 118 | 118 | } |
@@ -133,7 +133,7 @@ discard block |
||
| 133 | 133 | */ |
| 134 | 134 | function _debugOutput() |
| 135 | 135 | { |
| 136 | - if(!__DEBUG__) |
|
| 136 | + if (!__DEBUG__) |
|
| 137 | 137 | { |
| 138 | 138 | return; |
| 139 | 139 | } |
@@ -141,32 +141,32 @@ discard block |
||
| 141 | 141 | $end = getMicroTime(); |
| 142 | 142 | |
| 143 | 143 | // Firebug console output |
| 144 | - if(__DEBUG_OUTPUT__ == 2 && version_compare(PHP_VERSION, '6.0.0') === -1) |
|
| 144 | + if (__DEBUG_OUTPUT__ == 2 && version_compare(PHP_VERSION, '6.0.0') === -1) |
|
| 145 | 145 | { |
| 146 | 146 | static $firephp; |
| 147 | - if(!isset($firephp)) |
|
| 147 | + if (!isset($firephp)) |
|
| 148 | 148 | { |
| 149 | 149 | $firephp = FirePHP::getInstance(true); |
| 150 | 150 | } |
| 151 | 151 | |
| 152 | - if(__DEBUG_PROTECT__ == 1 && __DEBUG_PROTECT_IP__ != $_SERVER['REMOTE_ADDR']) |
|
| 152 | + if (__DEBUG_PROTECT__ == 1 && __DEBUG_PROTECT_IP__ != $_SERVER['REMOTE_ADDR']) |
|
| 153 | 153 | { |
| 154 | 154 | $firephp->fb('Change the value of __DEBUG_PROTECT_IP__ into your IP address in config/config.user.inc.php or config/config.inc.php', 'The IP address is not allowed.'); |
| 155 | 155 | return; |
| 156 | 156 | } |
| 157 | 157 | // display total execution time and Request/Response info |
| 158 | - if(__DEBUG__ & 2) |
|
| 158 | + if (__DEBUG__ & 2) |
|
| 159 | 159 | { |
| 160 | 160 | $firephp->fb( |
| 161 | 161 | array( |
| 162 | - 'Request / Response info >>> ' . $_SERVER['REQUEST_METHOD'] . ' / ' . Context::getResponseMethod(), |
|
| 162 | + 'Request / Response info >>> '.$_SERVER['REQUEST_METHOD'].' / '.Context::getResponseMethod(), |
|
| 163 | 163 | array( |
| 164 | 164 | array('Request URI', 'Request method', 'Response method', 'Response contents size', 'Memory peak usage'), |
| 165 | 165 | array( |
| 166 | 166 | sprintf("%s:%s%s%s%s", $_SERVER['SERVER_NAME'], $_SERVER['SERVER_PORT'], $_SERVER['PHP_SELF'], $_SERVER['QUERY_STRING'] ? '?' : '', $_SERVER['QUERY_STRING']), |
| 167 | 167 | $_SERVER['REQUEST_METHOD'], |
| 168 | 168 | Context::getResponseMethod(), |
| 169 | - $this->content_size . ' byte', |
|
| 169 | + $this->content_size.' byte', |
|
| 170 | 170 | FileHandler::filesize(memory_get_peak_usage()) |
| 171 | 171 | ) |
| 172 | 172 | ) |
@@ -175,7 +175,7 @@ discard block |
||
| 175 | 175 | ); |
| 176 | 176 | $firephp->fb( |
| 177 | 177 | array( |
| 178 | - 'Elapsed time >>> Total : ' . sprintf('%0.5f sec', $end - __StartTime__), |
|
| 178 | + 'Elapsed time >>> Total : '.sprintf('%0.5f sec', $end - __StartTime__), |
|
| 179 | 179 | array(array('DB queries', 'class file load', 'Template compile', 'XmlParse compile', 'PHP', 'Widgets', 'Trans Content'), |
| 180 | 180 | array( |
| 181 | 181 | sprintf('%0.5f sec', $GLOBALS['__db_elapsed_time__']), |
@@ -193,16 +193,16 @@ discard block |
||
| 193 | 193 | } |
| 194 | 194 | |
| 195 | 195 | // display DB query history |
| 196 | - if((__DEBUG__ & 4) && $GLOBALS['__db_queries__']) |
|
| 196 | + if ((__DEBUG__ & 4) && $GLOBALS['__db_queries__']) |
|
| 197 | 197 | { |
| 198 | 198 | $queries_output = array(array('Result/'.PHP_EOL.'Elapsed time', 'Query ID', 'Query')); |
| 199 | - foreach($GLOBALS['__db_queries__'] as $query) |
|
| 199 | + foreach ($GLOBALS['__db_queries__'] as $query) |
|
| 200 | 200 | { |
| 201 | - $queries_output[] = array($query['result'] . PHP_EOL . sprintf('%0.5f', $query['elapsed_time']), str_replace(_XE_PATH_, '', $query['called_file']) . PHP_EOL . $query['called_method'] . '()' . PHP_EOL . $query['query_id'], $query['query']); |
|
| 201 | + $queries_output[] = array($query['result'].PHP_EOL.sprintf('%0.5f', $query['elapsed_time']), str_replace(_XE_PATH_, '', $query['called_file']).PHP_EOL.$query['called_method'].'()'.PHP_EOL.$query['query_id'], $query['query']); |
|
| 202 | 202 | } |
| 203 | 203 | $firephp->fb( |
| 204 | 204 | array( |
| 205 | - 'DB Queries >>> ' . count($GLOBALS['__db_queries__']) . ' Queries, ' . sprintf('%0.5f sec', $GLOBALS['__db_elapsed_time__']), |
|
| 205 | + 'DB Queries >>> '.count($GLOBALS['__db_queries__']).' Queries, '.sprintf('%0.5f sec', $GLOBALS['__db_elapsed_time__']), |
|
| 206 | 206 | $queries_output |
| 207 | 207 | ), |
| 208 | 208 | 'TABLE' |
@@ -215,9 +215,9 @@ discard block |
||
| 215 | 215 | |
| 216 | 216 | $buff = array(); |
| 217 | 217 | // display total execution time and Request/Response info |
| 218 | - if(__DEBUG__ & 2) |
|
| 218 | + if (__DEBUG__ & 2) |
|
| 219 | 219 | { |
| 220 | - if(__DEBUG_PROTECT__ == 1 && __DEBUG_PROTECT_IP__ != $_SERVER['REMOTE_ADDR']) |
|
| 220 | + if (__DEBUG_PROTECT__ == 1 && __DEBUG_PROTECT_IP__ != $_SERVER['REMOTE_ADDR']) |
|
| 221 | 221 | { |
| 222 | 222 | return; |
| 223 | 223 | } |
@@ -248,21 +248,21 @@ discard block |
||
| 248 | 248 | $buff[] = sprintf("\tTrans Content \t\t\t\t\t: %0.5f sec", $GLOBALS['__trans_content_elapsed__']); |
| 249 | 249 | } |
| 250 | 250 | // DB Logging |
| 251 | - if(__DEBUG__ & 4) |
|
| 251 | + if (__DEBUG__ & 4) |
|
| 252 | 252 | { |
| 253 | - if(__DEBUG_PROTECT__ == 1 && __DEBUG_PROTECT_IP__ != $_SERVER['REMOTE_ADDR']) |
|
| 253 | + if (__DEBUG_PROTECT__ == 1 && __DEBUG_PROTECT_IP__ != $_SERVER['REMOTE_ADDR']) |
|
| 254 | 254 | { |
| 255 | 255 | return; |
| 256 | 256 | } |
| 257 | 257 | |
| 258 | - if($GLOBALS['__db_queries__']) |
|
| 258 | + if ($GLOBALS['__db_queries__']) |
|
| 259 | 259 | { |
| 260 | 260 | $buff[] = sprintf("\n- DB Queries : %d Queries. %0.5f sec", count($GLOBALS['__db_queries__']), $GLOBALS['__db_elapsed_time__']); |
| 261 | 261 | $num = 0; |
| 262 | 262 | |
| 263 | - foreach($GLOBALS['__db_queries__'] as $query) |
|
| 263 | + foreach ($GLOBALS['__db_queries__'] as $query) |
|
| 264 | 264 | { |
| 265 | - if($query['result'] == 'Success') |
|
| 265 | + if ($query['result'] == 'Success') |
|
| 266 | 266 | { |
| 267 | 267 | $query_result = "Query Success"; |
| 268 | 268 | } |
@@ -279,30 +279,30 @@ discard block |
||
| 279 | 279 | } |
| 280 | 280 | |
| 281 | 281 | // Output in HTML comments |
| 282 | - if($buff && __DEBUG_OUTPUT__ == 1 && Context::getResponseMethod() == 'HTML') |
|
| 282 | + if ($buff && __DEBUG_OUTPUT__ == 1 && Context::getResponseMethod() == 'HTML') |
|
| 283 | 283 | { |
| 284 | 284 | $buff = implode("\r\n", $buff); |
| 285 | 285 | $buff = sprintf("[%s %s:%d]\r\n%s", date('Y-m-d H:i:s'), $file_name, $line_num, print_r($buff, true)); |
| 286 | 286 | |
| 287 | - if(__DEBUG_PROTECT__ == 1 && __DEBUG_PROTECT_IP__ != $_SERVER['REMOTE_ADDR']) |
|
| 287 | + if (__DEBUG_PROTECT__ == 1 && __DEBUG_PROTECT_IP__ != $_SERVER['REMOTE_ADDR']) |
|
| 288 | 288 | { |
| 289 | 289 | $buff = 'The IP address is not allowed. Change the value of __DEBUG_PROTECT_IP__ into your IP address in config/config.user.inc.php or config/config.inc.php'; |
| 290 | 290 | } |
| 291 | 291 | |
| 292 | - return "<!--\r\n" . $buff . "\r\n-->"; |
|
| 292 | + return "<!--\r\n".$buff."\r\n-->"; |
|
| 293 | 293 | } |
| 294 | 294 | |
| 295 | 295 | // Output to a file |
| 296 | - if($buff && __DEBUG_OUTPUT__ == 0) |
|
| 296 | + if ($buff && __DEBUG_OUTPUT__ == 0) |
|
| 297 | 297 | { |
| 298 | - $debug_file = _XE_PATH_ . 'files/_debug_message.php'; |
|
| 298 | + $debug_file = _XE_PATH_.'files/_debug_message.php'; |
|
| 299 | 299 | $buff = implode(PHP_EOL, $buff); |
| 300 | 300 | $buff = sprintf("[%s]\n%s", date('Y-m-d H:i:s'), print_r($buff, true)); |
| 301 | 301 | |
| 302 | - $buff = str_repeat('=', 80) . "\n" . $buff . "\n" . str_repeat('-', 80); |
|
| 303 | - $buff = "\n<?php\n/*" . $buff . "*/\n?>\n"; |
|
| 302 | + $buff = str_repeat('=', 80)."\n".$buff."\n".str_repeat('-', 80); |
|
| 303 | + $buff = "\n<?php\n/*".$buff."*/\n?>\n"; |
|
| 304 | 304 | |
| 305 | - if (!@file_put_contents($debug_file, $buff, FILE_APPEND|LOCK_EX)) |
|
| 305 | + if (!@file_put_contents($debug_file, $buff, FILE_APPEND | LOCK_EX)) |
|
| 306 | 306 | { |
| 307 | 307 | return; |
| 308 | 308 | } |
@@ -318,7 +318,7 @@ discard block |
||
| 318 | 318 | { |
| 319 | 319 | header("Content-Type: text/xml; charset=UTF-8"); |
| 320 | 320 | header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); |
| 321 | - header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); |
|
| 321 | + header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); |
|
| 322 | 322 | header("Cache-Control: no-store, no-cache, must-revalidate"); |
| 323 | 323 | header("Cache-Control: post-check=0, pre-check=0", false); |
| 324 | 324 | header("Pragma: no-cache"); |
@@ -332,7 +332,7 @@ discard block |
||
| 332 | 332 | { |
| 333 | 333 | header("Content-Type: text/html; charset=UTF-8"); |
| 334 | 334 | header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); |
| 335 | - header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); |
|
| 335 | + header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); |
|
| 336 | 336 | header("Cache-Control: no-store, no-cache, must-revalidate"); |
| 337 | 337 | header("Cache-Control: post-check=0, pre-check=0", false); |
| 338 | 338 | header("Pragma: no-cache"); |
@@ -346,7 +346,7 @@ discard block |
||
| 346 | 346 | { |
| 347 | 347 | header("Content-Type: text/html; charset=UTF-8"); |
| 348 | 348 | header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); |
| 349 | - header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); |
|
| 349 | + header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); |
|
| 350 | 350 | header("Cache-Control: no-store, no-cache, must-revalidate"); |
| 351 | 351 | header("Cache-Control: post-check=0, pre-check=0", false); |
| 352 | 352 | header("Pragma: no-cache"); |
@@ -39,24 +39,20 @@ discard block |
||
| 39 | 39 | if(Context::get('xeVirtualRequestMethod') == 'xml') |
| 40 | 40 | { |
| 41 | 41 | $handler = new VirtualXMLDisplayHandler(); |
| 42 | - } |
|
| 43 | - else if(Context::getRequestMethod() == 'XMLRPC') |
|
| 42 | + } else if(Context::getRequestMethod() == 'XMLRPC') |
|
| 44 | 43 | { |
| 45 | 44 | $handler = new XMLDisplayHandler(); |
| 46 | 45 | if(strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== FALSE) |
| 47 | 46 | { |
| 48 | 47 | $this->gz_enabled = FALSE; |
| 49 | 48 | } |
| 50 | - } |
|
| 51 | - else if(Context::getRequestMethod() == 'JSON') |
|
| 49 | + } else if(Context::getRequestMethod() == 'JSON') |
|
| 52 | 50 | { |
| 53 | 51 | $handler = new JSONDisplayHandler(); |
| 54 | - } |
|
| 55 | - else if(Context::getRequestMethod() == 'JS_CALLBACK') |
|
| 52 | + } else if(Context::getRequestMethod() == 'JS_CALLBACK') |
|
| 56 | 53 | { |
| 57 | 54 | $handler = new JSCallbackDisplayHandler(); |
| 58 | - } |
|
| 59 | - else |
|
| 55 | + } else |
|
| 60 | 56 | { |
| 61 | 57 | $handler = new HTMLDisplayHandler(); |
| 62 | 58 | } |
@@ -70,7 +66,9 @@ discard block |
||
| 70 | 66 | $called_position = 'before_display_content'; |
| 71 | 67 | $oAddonController = getController('addon'); |
| 72 | 68 | $addon_file = $oAddonController->getCacheFilePath(Mobile::isFromMobilePhone() ? "mobile" : "pc"); |
| 73 | - if(file_exists($addon_file)) include($addon_file); |
|
| 69 | + if(file_exists($addon_file)) { |
|
| 70 | + include($addon_file); |
|
| 71 | + } |
|
| 74 | 72 | |
| 75 | 73 | if(method_exists($handler, "prepareToPrint")) |
| 76 | 74 | { |
@@ -83,18 +81,15 @@ discard block |
||
| 83 | 81 | if($httpStatusCode && $httpStatusCode != 200) |
| 84 | 82 | { |
| 85 | 83 | $this->_printHttpStatusCode($httpStatusCode); |
| 86 | - } |
|
| 87 | - else |
|
| 84 | + } else |
|
| 88 | 85 | { |
| 89 | 86 | if(Context::getResponseMethod() == 'JSON' || Context::getResponseMethod() == 'JS_CALLBACK') |
| 90 | 87 | { |
| 91 | 88 | $this->_printJSONHeader(); |
| 92 | - } |
|
| 93 | - else if(Context::getResponseMethod() != 'HTML') |
|
| 89 | + } else if(Context::getResponseMethod() != 'HTML') |
|
| 94 | 90 | { |
| 95 | 91 | $this->_printXMLHeader(); |
| 96 | - } |
|
| 97 | - else |
|
| 92 | + } else |
|
| 98 | 93 | { |
| 99 | 94 | $this->_printHTMLHeader(); |
| 100 | 95 | } |
@@ -209,8 +204,7 @@ discard block |
||
| 209 | 204 | ); |
| 210 | 205 | } |
| 211 | 206 | // dislpay the file and HTML comments |
| 212 | - } |
|
| 213 | - else |
|
| 207 | + } else |
|
| 214 | 208 | { |
| 215 | 209 | |
| 216 | 210 | $buff = array(); |
@@ -265,8 +259,7 @@ discard block |
||
| 265 | 259 | if($query['result'] == 'Success') |
| 266 | 260 | { |
| 267 | 261 | $query_result = "Query Success"; |
| 268 | - } |
|
| 269 | - else |
|
| 262 | + } else |
|
| 270 | 263 | { |
| 271 | 264 | $query_result = sprintf("Query $s : %d\n\t\t\t %s", $query['result'], $query['errno'], $query['errstr']); |
| 272 | 265 | } |
@@ -22,7 +22,7 @@ discard block |
||
| 22 | 22 | $args = new stdClass(); |
| 23 | 23 | $args->title = Context::get('title'); |
| 24 | 24 | $output = executeQuery('module.insertModuleCategory', $args); |
| 25 | - if(!$output->toBool()) return $output; |
|
| 25 | + if (!$output->toBool()) return $output; |
|
| 26 | 26 | |
| 27 | 27 | $this->setMessage("success_registed"); |
| 28 | 28 | |
@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | function procModuleAdminUpdateCategory() |
| 37 | 37 | { |
| 38 | 38 | $output = $this->doUpdateModuleCategory(); |
| 39 | - if(!$output->toBool()) return $output; |
|
| 39 | + if (!$output->toBool()) return $output; |
|
| 40 | 40 | |
| 41 | 41 | $this->setMessage('success_updated'); |
| 42 | 42 | |
@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | function procModuleAdminDeleteCategory() |
| 51 | 51 | { |
| 52 | 52 | $output = $this->doDeleteModuleCategory(); |
| 53 | - if(!$output->toBool()) return $output; |
|
| 53 | + if (!$output->toBool()) return $output; |
|
| 54 | 54 | |
| 55 | 55 | $this->setMessage('success_deleted'); |
| 56 | 56 | |
@@ -85,7 +85,7 @@ discard block |
||
| 85 | 85 | function procModuleAdminCopyModule($args = NULL) |
| 86 | 86 | { |
| 87 | 87 | $isProc = false; |
| 88 | - if(!$args) |
|
| 88 | + if (!$args) |
|
| 89 | 89 | { |
| 90 | 90 | $isProc = true; |
| 91 | 91 | // Get information of the target module to copy |
@@ -97,24 +97,24 @@ discard block |
||
| 97 | 97 | $module_srl = $args->module_srl; |
| 98 | 98 | } |
| 99 | 99 | |
| 100 | - if(!$module_srl) |
|
| 100 | + if (!$module_srl) |
|
| 101 | 101 | { |
| 102 | 102 | return $this->_returnByProc($isProc); |
| 103 | 103 | } |
| 104 | 104 | |
| 105 | 105 | // Get module name to create and browser title |
| 106 | 106 | $clones = array(); |
| 107 | - for($i=1;$i<=10;$i++) |
|
| 107 | + for ($i = 1; $i <= 10; $i++) |
|
| 108 | 108 | { |
| 109 | 109 | $mid = trim($args->{"mid_".$i}); |
| 110 | - if(!$mid) continue; |
|
| 111 | - if(!preg_match("/^[a-zA-Z]([a-zA-Z0-9_]*)$/i", $mid)) return new BaseObject(-1, 'msg_limit_mid'); |
|
| 110 | + if (!$mid) continue; |
|
| 111 | + if (!preg_match("/^[a-zA-Z]([a-zA-Z0-9_]*)$/i", $mid)) return new BaseObject(-1, 'msg_limit_mid'); |
|
| 112 | 112 | $browser_title = $args->{"browser_title_".$i}; |
| 113 | - if(!$mid) continue; |
|
| 114 | - if($mid && !$browser_title) $browser_title = $mid; |
|
| 113 | + if (!$mid) continue; |
|
| 114 | + if ($mid && !$browser_title) $browser_title = $mid; |
|
| 115 | 115 | $clones[$mid] = $browser_title; |
| 116 | 116 | } |
| 117 | - if(count($clones) < 1) |
|
| 117 | + if (count($clones) < 1) |
|
| 118 | 118 | { |
| 119 | 119 | return $this->_returnByProc($isProc); |
| 120 | 120 | } |
@@ -129,9 +129,9 @@ discard block |
||
| 129 | 129 | $module_args->module_srl = $module_srl; |
| 130 | 130 | $output = executeQueryArray('module.getModuleGrants', $module_args); |
| 131 | 131 | $grant = array(); |
| 132 | - if($output->data) |
|
| 132 | + if ($output->data) |
|
| 133 | 133 | { |
| 134 | - foreach($output->data as $val) $grant[$val->name][] = $val->group_srl; |
|
| 134 | + foreach ($output->data as $val) $grant[$val->name][] = $val->group_srl; |
|
| 135 | 135 | } |
| 136 | 136 | |
| 137 | 137 | // get Extra Vars |
@@ -139,9 +139,9 @@ discard block |
||
| 139 | 139 | $extra_args->module_srl = $module_srl; |
| 140 | 140 | $extra_output = executeQueryArray('module.getModuleExtraVars', $extra_args); |
| 141 | 141 | $extra_vars = new stdClass(); |
| 142 | - if($extra_output->toBool() && is_array($extra_output->data)) |
|
| 142 | + if ($extra_output->toBool() && is_array($extra_output->data)) |
|
| 143 | 143 | { |
| 144 | - foreach($extra_output->data as $info) |
|
| 144 | + foreach ($extra_output->data as $info) |
|
| 145 | 145 | { |
| 146 | 146 | $extra_vars->{$info->name} = $info->value; |
| 147 | 147 | } |
@@ -150,17 +150,17 @@ discard block |
||
| 150 | 150 | $tmpModuleSkinVars = $oModuleModel->getModuleSkinVars($module_srl); |
| 151 | 151 | $tmpModuleMobileSkinVars = $oModuleModel->getModuleMobileSkinVars($module_srl); |
| 152 | 152 | |
| 153 | - if($tmpModuleSkinVars) |
|
| 153 | + if ($tmpModuleSkinVars) |
|
| 154 | 154 | { |
| 155 | - foreach($tmpModuleSkinVars as $key=>$value) |
|
| 155 | + foreach ($tmpModuleSkinVars as $key=>$value) |
|
| 156 | 156 | { |
| 157 | 157 | $moduleSkinVars->{$key} = $value->value; |
| 158 | 158 | } |
| 159 | 159 | } |
| 160 | 160 | |
| 161 | - if($tmpModuleMobileSkinVars) |
|
| 161 | + if ($tmpModuleMobileSkinVars) |
|
| 162 | 162 | { |
| 163 | - foreach($tmpModuleMobileSkinVars as $key=>$value) |
|
| 163 | + foreach ($tmpModuleMobileSkinVars as $key=>$value) |
|
| 164 | 164 | { |
| 165 | 165 | $moduleMobileSkinVars->{$key} = $value->value; |
| 166 | 166 | } |
@@ -174,7 +174,7 @@ discard block |
||
| 174 | 174 | $triggerObj->moduleSrlList = array(); |
| 175 | 175 | |
| 176 | 176 | $errorLog = array(); |
| 177 | - foreach($clones as $mid => $browser_title) |
|
| 177 | + foreach ($clones as $mid => $browser_title) |
|
| 178 | 178 | { |
| 179 | 179 | $clone_args = new stdClass; |
| 180 | 180 | $clone_args = clone $module_info; |
@@ -188,29 +188,29 @@ discard block |
||
| 188 | 188 | // Create a module |
| 189 | 189 | $output = $oModuleController->insertModule($clone_args); |
| 190 | 190 | |
| 191 | - if(!$output->toBool()) |
|
| 191 | + if (!$output->toBool()) |
|
| 192 | 192 | { |
| 193 | - $errorLog[] = $mid . ' : '. $output->message; |
|
| 193 | + $errorLog[] = $mid.' : '.$output->message; |
|
| 194 | 194 | continue; |
| 195 | 195 | } |
| 196 | 196 | $module_srl = $output->get('module_srl'); |
| 197 | 197 | |
| 198 | - if($module_info->module == 'page' && $extra_vars->page_type == 'ARTICLE') |
|
| 198 | + if ($module_info->module == 'page' && $extra_vars->page_type == 'ARTICLE') |
|
| 199 | 199 | { |
| 200 | 200 | // copy document |
| 201 | 201 | $oDocumentAdminController = getAdminController('document'); |
| 202 | 202 | $copyOutput = $oDocumentAdminController->copyDocumentModule(array($extra_vars->document_srl), $module_srl, $module_info->category_srl); |
| 203 | 203 | $document_srls = $copyOutput->get('copied_srls'); |
| 204 | - if($document_srls && count($document_srls) > 0) |
|
| 204 | + if ($document_srls && count($document_srls) > 0) |
|
| 205 | 205 | { |
| 206 | 206 | $extra_vars->document_srl = array_pop($document_srls); |
| 207 | 207 | } |
| 208 | 208 | |
| 209 | - if($extra_vars->mdocument_srl) |
|
| 209 | + if ($extra_vars->mdocument_srl) |
|
| 210 | 210 | { |
| 211 | 211 | $copyOutput = $oDocumentAdminController->copyDocumentModule(array($extra_vars->mdocument_srl), $module_srl, $module_info->category_srl); |
| 212 | 212 | $copiedSrls = $copyOutput->get('copied_srls'); |
| 213 | - if($copiedSrls && count($copiedSrls) > 0) |
|
| 213 | + if ($copiedSrls && count($copiedSrls) > 0) |
|
| 214 | 214 | { |
| 215 | 215 | $extra_vars->mdocument_srl = array_pop($copiedSrls); |
| 216 | 216 | } |
@@ -218,11 +218,11 @@ discard block |
||
| 218 | 218 | } |
| 219 | 219 | |
| 220 | 220 | // Grant module permissions |
| 221 | - if(count($grant) > 0) $oModuleController->insertModuleGrants($module_srl, $grant); |
|
| 222 | - if($extra_vars) $oModuleController->insertModuleExtraVars($module_srl, $extra_vars); |
|
| 221 | + if (count($grant) > 0) $oModuleController->insertModuleGrants($module_srl, $grant); |
|
| 222 | + if ($extra_vars) $oModuleController->insertModuleExtraVars($module_srl, $extra_vars); |
|
| 223 | 223 | |
| 224 | - if($moduleSkinVars) $oModuleController->insertModuleSkinVars($module_srl, $moduleSkinVars); |
|
| 225 | - if($moduleMobileSkinVars) $oModuleController->insertModuleMobileSkinVars($module_srl, $moduleMobileSkinVars); |
|
| 224 | + if ($moduleSkinVars) $oModuleController->insertModuleSkinVars($module_srl, $moduleSkinVars); |
|
| 225 | + if ($moduleMobileSkinVars) $oModuleController->insertModuleMobileSkinVars($module_srl, $moduleMobileSkinVars); |
|
| 226 | 226 | |
| 227 | 227 | $triggerObj->moduleSrlList[] = $module_srl; |
| 228 | 228 | } |
@@ -231,7 +231,7 @@ discard block |
||
| 231 | 231 | |
| 232 | 232 | $oDB->commit(); |
| 233 | 233 | |
| 234 | - if(count($errorLog) > 0) |
|
| 234 | + if (count($errorLog) > 0) |
|
| 235 | 235 | { |
| 236 | 236 | $message = implode('\n', $errorLog); |
| 237 | 237 | $this->setMessage($message); |
@@ -242,9 +242,9 @@ discard block |
||
| 242 | 242 | $this->setMessage('success_registed'); |
| 243 | 243 | } |
| 244 | 244 | |
| 245 | - if($isProc) |
|
| 245 | + if ($isProc) |
|
| 246 | 246 | { |
| 247 | - if(!in_array(Context::getRequestMethod(),array('XMLRPC','JSON'))) |
|
| 247 | + if (!in_array(Context::getRequestMethod(), array('XMLRPC', 'JSON'))) |
|
| 248 | 248 | { |
| 249 | 249 | global $lang; |
| 250 | 250 | htmlHeader(); |
@@ -260,9 +260,9 @@ discard block |
||
| 260 | 260 | return $module_srl; |
| 261 | 261 | } |
| 262 | 262 | |
| 263 | - private function _returnByProc($isProc, $msg='msg_invalid_request') |
|
| 263 | + private function _returnByProc($isProc, $msg = 'msg_invalid_request') |
|
| 264 | 264 | { |
| 265 | - if(!$isProc) |
|
| 265 | + if (!$isProc) |
|
| 266 | 266 | return; |
| 267 | 267 | else |
| 268 | 268 | { |
@@ -282,17 +282,17 @@ discard block |
||
| 282 | 282 | // Get information of the module |
| 283 | 283 | $columnList = array('module_srl', 'module'); |
| 284 | 284 | $module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl, $columnList); |
| 285 | - if(!$module_info) return new BaseObject(-1,'msg_invalid_request'); |
|
| 285 | + if (!$module_info) return new BaseObject(-1, 'msg_invalid_request'); |
|
| 286 | 286 | // Register Admin ID |
| 287 | 287 | $oModuleController->deleteAdminId($module_srl); |
| 288 | 288 | $admin_member = Context::get('admin_member'); |
| 289 | - if($admin_member) |
|
| 289 | + if ($admin_member) |
|
| 290 | 290 | { |
| 291 | - $admin_members = explode(',',$admin_member); |
|
| 292 | - foreach($admin_members as $admin_id) |
|
| 291 | + $admin_members = explode(',', $admin_member); |
|
| 292 | + foreach ($admin_members as $admin_id) |
|
| 293 | 293 | { |
| 294 | 294 | $admin_id = trim($admin_id); |
| 295 | - if(!$admin_id) continue; |
|
| 295 | + if (!$admin_id) continue; |
|
| 296 | 296 | $oModuleController->insertAdminId($module_srl, $admin_id); |
| 297 | 297 | } |
| 298 | 298 | } |
@@ -307,13 +307,13 @@ discard block |
||
| 307 | 307 | $grant_list->manager->default = 'manager'; |
| 308 | 308 | |
| 309 | 309 | $grant = new stdClass(); |
| 310 | - foreach($grant_list as $grant_name => $grant_info) |
|
| 310 | + foreach ($grant_list as $grant_name => $grant_info) |
|
| 311 | 311 | { |
| 312 | 312 | // Get the default value |
| 313 | 313 | $default = Context::get($grant_name.'_default'); |
| 314 | 314 | // -1 = Log-in user only, -2 = site members only, -3 = manager only, 0 = all users |
| 315 | 315 | $grant->{$grant_name} = array(); |
| 316 | - if(strlen($default)) |
|
| 316 | + if (strlen($default)) |
|
| 317 | 317 | { |
| 318 | 318 | $grant->{$grant_name}[] = $default; |
| 319 | 319 | continue; |
@@ -322,10 +322,10 @@ discard block |
||
| 322 | 322 | else |
| 323 | 323 | { |
| 324 | 324 | $group_srls = Context::get($grant_name); |
| 325 | - if($group_srls) |
|
| 325 | + if ($group_srls) |
|
| 326 | 326 | { |
| 327 | - if(strpos($group_srls,'|@|')!==false) $group_srls = explode('|@|',$group_srls); |
|
| 328 | - elseif(strpos($group_srls,',')!==false) $group_srls = explode(',',$group_srls); |
|
| 327 | + if (strpos($group_srls, '|@|') !== false) $group_srls = explode('|@|', $group_srls); |
|
| 328 | + elseif (strpos($group_srls, ',') !== false) $group_srls = explode(',', $group_srls); |
|
| 329 | 329 | else $group_srls = array($group_srls); |
| 330 | 330 | $grant->{$grant_name} = $group_srls; |
| 331 | 331 | } |
@@ -338,18 +338,18 @@ discard block |
||
| 338 | 338 | $args = new stdClass(); |
| 339 | 339 | $args->module_srl = $module_srl; |
| 340 | 340 | $output = executeQuery('module.deleteModuleGrants', $args); |
| 341 | - if(!$output->toBool()) return $output; |
|
| 341 | + if (!$output->toBool()) return $output; |
|
| 342 | 342 | // Permissions stored in the DB |
| 343 | - foreach($grant as $grant_name => $group_srls) |
|
| 343 | + foreach ($grant as $grant_name => $group_srls) |
|
| 344 | 344 | { |
| 345 | - foreach($group_srls as $val) |
|
| 345 | + foreach ($group_srls as $val) |
|
| 346 | 346 | { |
| 347 | 347 | $args = new stdClass(); |
| 348 | 348 | $args->module_srl = $module_srl; |
| 349 | 349 | $args->name = $grant_name; |
| 350 | 350 | $args->group_srl = $val; |
| 351 | 351 | $output = executeQuery('module.insertModuleGrant', $args); |
| 352 | - if(!$output->toBool()) return $output; |
|
| 352 | + if (!$output->toBool()) return $output; |
|
| 353 | 353 | } |
| 354 | 354 | } |
| 355 | 355 | $this->setMessage('success_registed'); |
@@ -368,11 +368,11 @@ discard block |
||
| 368 | 368 | $oModuleModel = getModel('module'); |
| 369 | 369 | $columnList = array('module_srl', 'module', 'skin', 'mskin', 'is_skin_fix', 'is_mskin_fix'); |
| 370 | 370 | $module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl, $columnList); |
| 371 | - if($module_info->module_srl) |
|
| 371 | + if ($module_info->module_srl) |
|
| 372 | 372 | { |
| 373 | - if($mode === 'M') |
|
| 373 | + if ($mode === 'M') |
|
| 374 | 374 | { |
| 375 | - if($module_info->is_mskin_fix == 'Y') |
|
| 375 | + if ($module_info->is_mskin_fix == 'Y') |
|
| 376 | 376 | { |
| 377 | 377 | $skin = $module_info->mskin; |
| 378 | 378 | } |
@@ -383,7 +383,7 @@ discard block |
||
| 383 | 383 | } |
| 384 | 384 | else |
| 385 | 385 | { |
| 386 | - if($module_info->is_skin_fix == 'Y') |
|
| 386 | + if ($module_info->is_skin_fix == 'Y') |
|
| 387 | 387 | { |
| 388 | 388 | $skin = $module_info->skin; |
| 389 | 389 | } |
@@ -394,9 +394,9 @@ discard block |
||
| 394 | 394 | } |
| 395 | 395 | |
| 396 | 396 | // Get skin information (to check extra_vars) |
| 397 | - $module_path = _XE_PATH_ . 'modules/'.$module_info->module; |
|
| 397 | + $module_path = _XE_PATH_.'modules/'.$module_info->module; |
|
| 398 | 398 | |
| 399 | - if($mode === 'M') |
|
| 399 | + if ($mode === 'M') |
|
| 400 | 400 | { |
| 401 | 401 | $skin_info = $oModuleModel->loadSkinInfo($module_path, $skin, 'm.skins'); |
| 402 | 402 | $skin_vars = $oModuleModel->getModuleMobileSkinVars($module_srl); |
@@ -417,35 +417,35 @@ discard block |
||
| 417 | 417 | unset($obj->module); |
| 418 | 418 | unset($obj->_mode); |
| 419 | 419 | // Separately handle if a type of extra_vars is an image in the original skin_info |
| 420 | - if($skin_info->extra_vars) |
|
| 420 | + if ($skin_info->extra_vars) |
|
| 421 | 421 | { |
| 422 | - foreach($skin_info->extra_vars as $vars) |
|
| 422 | + foreach ($skin_info->extra_vars as $vars) |
|
| 423 | 423 | { |
| 424 | - if($vars->type!='image') continue; |
|
| 424 | + if ($vars->type != 'image') continue; |
|
| 425 | 425 | |
| 426 | 426 | $image_obj = $obj->{$vars->name}; |
| 427 | 427 | // Get a variable to delete |
| 428 | 428 | $del_var = $obj->{"del_".$vars->name}; |
| 429 | 429 | unset($obj->{"del_".$vars->name}); |
| 430 | - if($del_var == 'Y') |
|
| 430 | + if ($del_var == 'Y') |
|
| 431 | 431 | { |
| 432 | 432 | FileHandler::removeFile($skin_vars[$vars->name]->value); |
| 433 | 433 | continue; |
| 434 | 434 | } |
| 435 | 435 | // Use the previous data if not uploaded |
| 436 | - if(!$image_obj['tmp_name']) |
|
| 436 | + if (!$image_obj['tmp_name']) |
|
| 437 | 437 | { |
| 438 | 438 | $obj->{$vars->name} = $skin_vars[$vars->name]->value; |
| 439 | 439 | continue; |
| 440 | 440 | } |
| 441 | 441 | // Ignore if the file is not successfully uploaded |
| 442 | - if(!is_uploaded_file($image_obj['tmp_name']) || !checkUploadedFile($image_obj['tmp_name'])) |
|
| 442 | + if (!is_uploaded_file($image_obj['tmp_name']) || !checkUploadedFile($image_obj['tmp_name'])) |
|
| 443 | 443 | { |
| 444 | 444 | unset($obj->{$vars->name}); |
| 445 | 445 | continue; |
| 446 | 446 | } |
| 447 | 447 | // Ignore if the file is not an image |
| 448 | - if(!preg_match("/\.(jpg|jpeg|gif|png)$/i", $image_obj['name'])) |
|
| 448 | + if (!preg_match("/\.(jpg|jpeg|gif|png)$/i", $image_obj['name'])) |
|
| 449 | 449 | { |
| 450 | 450 | unset($obj->{$vars->name}); |
| 451 | 451 | continue; |
@@ -453,11 +453,11 @@ discard block |
||
| 453 | 453 | // Upload the file to a path |
| 454 | 454 | $path = sprintf("./files/attach/images/%s/", $module_srl); |
| 455 | 455 | // Create a directory |
| 456 | - if(!FileHandler::makeDir($path)) return false; |
|
| 456 | + if (!FileHandler::makeDir($path)) return false; |
|
| 457 | 457 | |
| 458 | 458 | $filename = $path.$image_obj['name']; |
| 459 | 459 | // Move the file |
| 460 | - if(!move_uploaded_file($image_obj['tmp_name'], $filename)) |
|
| 460 | + if (!move_uploaded_file($image_obj['tmp_name'], $filename)) |
|
| 461 | 461 | { |
| 462 | 462 | unset($obj->{$vars->name}); |
| 463 | 463 | continue; |
@@ -481,7 +481,7 @@ discard block |
||
| 481 | 481 | */ |
| 482 | 482 | $oModuleController = getController('module'); |
| 483 | 483 | |
| 484 | - if($mode === 'M') |
|
| 484 | + if ($mode === 'M') |
|
| 485 | 485 | { |
| 486 | 486 | $output = $oModuleController->insertModuleMobileSkinVars($module_srl, $obj); |
| 487 | 487 | } |
@@ -489,7 +489,7 @@ discard block |
||
| 489 | 489 | { |
| 490 | 490 | $output = $oModuleController->insertModuleSkinVars($module_srl, $obj); |
| 491 | 491 | } |
| 492 | - if(!$output->toBool()) |
|
| 492 | + if (!$output->toBool()) |
|
| 493 | 493 | { |
| 494 | 494 | return $output; |
| 495 | 495 | } |
@@ -506,29 +506,29 @@ discard block |
||
| 506 | 506 | { |
| 507 | 507 | $vars = Context::getRequestVars(); |
| 508 | 508 | |
| 509 | - if(!$vars->module_srls) return new BaseObject(-1,'msg_invalid_request'); |
|
| 509 | + if (!$vars->module_srls) return new BaseObject(-1, 'msg_invalid_request'); |
|
| 510 | 510 | |
| 511 | - $module_srls = explode(',',$vars->module_srls); |
|
| 512 | - if(count($module_srls) < 1) return new BaseObject(-1,'msg_invalid_request'); |
|
| 511 | + $module_srls = explode(',', $vars->module_srls); |
|
| 512 | + if (count($module_srls) < 1) return new BaseObject(-1, 'msg_invalid_request'); |
|
| 513 | 513 | |
| 514 | 514 | $oModuleModel = getModel('module'); |
| 515 | - $oModuleController= getController('module'); |
|
| 515 | + $oModuleController = getController('module'); |
|
| 516 | 516 | $columnList = array('module_srl', 'module', 'menu_srl', 'site_srl', 'mid', 'browser_title', 'is_default', 'content', 'mcontent', 'open_rss', 'regdate'); |
| 517 | - $updateList = array('module_category_srl','layout_srl','skin','mlayout_srl','mskin','description','header_text','footer_text', 'use_mobile'); |
|
| 518 | - foreach($updateList as $key=>$val) |
|
| 517 | + $updateList = array('module_category_srl', 'layout_srl', 'skin', 'mlayout_srl', 'mskin', 'description', 'header_text', 'footer_text', 'use_mobile'); |
|
| 518 | + foreach ($updateList as $key=>$val) |
|
| 519 | 519 | { |
| 520 | - if(!strlen($vars->{$val})) |
|
| 520 | + if (!strlen($vars->{$val})) |
|
| 521 | 521 | { |
| 522 | 522 | unset($updateList[$key]); |
| 523 | 523 | $columnList[] = $val; |
| 524 | 524 | } |
| 525 | 525 | } |
| 526 | 526 | |
| 527 | - foreach($module_srls as $module_srl) |
|
| 527 | + foreach ($module_srls as $module_srl) |
|
| 528 | 528 | { |
| 529 | 529 | $module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl, $columnList); |
| 530 | 530 | |
| 531 | - foreach($updateList as $val) |
|
| 531 | + foreach ($updateList as $val) |
|
| 532 | 532 | { |
| 533 | 533 | $module_info->{$val} = $vars->{$val}; |
| 534 | 534 | } |
@@ -536,9 +536,9 @@ discard block |
||
| 536 | 536 | } |
| 537 | 537 | |
| 538 | 538 | $this->setMessage('success_registed'); |
| 539 | - if(!in_array(Context::getRequestMethod(),array('XMLRPC','JSON'))) |
|
| 539 | + if (!in_array(Context::getRequestMethod(), array('XMLRPC', 'JSON'))) |
|
| 540 | 540 | { |
| 541 | - if(Context::get('success_return_url')) |
|
| 541 | + if (Context::get('success_return_url')) |
|
| 542 | 542 | { |
| 543 | 543 | $this->setRedirectUrl(Context::get('success_return_url')); |
| 544 | 544 | } |
@@ -561,10 +561,10 @@ discard block |
||
| 561 | 561 | function procModuleAdminModuleGrantSetup() |
| 562 | 562 | { |
| 563 | 563 | $module_srls = Context::get('module_srls'); |
| 564 | - if(!$module_srls) return new BaseObject(-1,'msg_invalid_request'); |
|
| 564 | + if (!$module_srls) return new BaseObject(-1, 'msg_invalid_request'); |
|
| 565 | 565 | |
| 566 | - $modules = explode(',',$module_srls); |
|
| 567 | - if(count($modules) < 1) return new BaseObject(-1,'msg_invalid_request'); |
|
| 566 | + $modules = explode(',', $module_srls); |
|
| 567 | + if (count($modules) < 1) return new BaseObject(-1, 'msg_invalid_request'); |
|
| 568 | 568 | |
| 569 | 569 | $oModuleController = getController('module'); |
| 570 | 570 | $oModuleModel = getModel('module'); |
@@ -581,13 +581,13 @@ discard block |
||
| 581 | 581 | |
| 582 | 582 | $grant = new stdClass; |
| 583 | 583 | |
| 584 | - foreach($grant_list as $grant_name => $grant_info) |
|
| 584 | + foreach ($grant_list as $grant_name => $grant_info) |
|
| 585 | 585 | { |
| 586 | 586 | // Get the default value |
| 587 | 587 | $default = Context::get($grant_name.'_default'); |
| 588 | 588 | // -1 = Sign only, 0 = all users |
| 589 | 589 | $grant->{$grant_name} = array(); |
| 590 | - if(strlen($default)) |
|
| 590 | + if (strlen($default)) |
|
| 591 | 591 | { |
| 592 | 592 | $grant->{$grant_name}[] = $default; |
| 593 | 593 | continue; |
@@ -596,12 +596,12 @@ discard block |
||
| 596 | 596 | else |
| 597 | 597 | { |
| 598 | 598 | $group_srls = Context::get($grant_name); |
| 599 | - if($group_srls) |
|
| 599 | + if ($group_srls) |
|
| 600 | 600 | { |
| 601 | - if(!is_array($group_srls)) |
|
| 601 | + if (!is_array($group_srls)) |
|
| 602 | 602 | { |
| 603 | - if(strpos($group_srls,'|@|')!==false) $group_srls = explode('|@|',$group_srls); |
|
| 604 | - elseif(strpos($group_srls,',')!==false) $group_srls = explode(',',$group_srls); |
|
| 603 | + if (strpos($group_srls, '|@|') !== false) $group_srls = explode('|@|', $group_srls); |
|
| 604 | + elseif (strpos($group_srls, ',') !== false) $group_srls = explode(',', $group_srls); |
|
| 605 | 605 | else $group_srls = array($group_srls); |
| 606 | 606 | } |
| 607 | 607 | $grant->{$grant_name} = $group_srls; |
@@ -612,30 +612,30 @@ discard block |
||
| 612 | 612 | } |
| 613 | 613 | |
| 614 | 614 | // Stored in the DB |
| 615 | - foreach($modules as $module_srl) |
|
| 615 | + foreach ($modules as $module_srl) |
|
| 616 | 616 | { |
| 617 | 617 | $args = new stdClass(); |
| 618 | 618 | $args->module_srl = $module_srl; |
| 619 | 619 | $output = executeQuery('module.deleteModuleGrants', $args); |
| 620 | - if(!$output->toBool()) continue; |
|
| 620 | + if (!$output->toBool()) continue; |
|
| 621 | 621 | // Permissions stored in the DB |
| 622 | - foreach($grant as $grant_name => $group_srls) |
|
| 622 | + foreach ($grant as $grant_name => $group_srls) |
|
| 623 | 623 | { |
| 624 | - foreach($group_srls as $val) |
|
| 624 | + foreach ($group_srls as $val) |
|
| 625 | 625 | { |
| 626 | 626 | $args = new stdClass(); |
| 627 | 627 | $args->module_srl = $module_srl; |
| 628 | 628 | $args->name = $grant_name; |
| 629 | 629 | $args->group_srl = $val; |
| 630 | 630 | $output = executeQuery('module.insertModuleGrant', $args); |
| 631 | - if(!$output->toBool()) return $output; |
|
| 631 | + if (!$output->toBool()) return $output; |
|
| 632 | 632 | } |
| 633 | 633 | } |
| 634 | 634 | } |
| 635 | 635 | $this->setMessage('success_registed'); |
| 636 | - if(!in_array(Context::getRequestMethod(),array('XMLRPC','JSON'))) |
|
| 636 | + if (!in_array(Context::getRequestMethod(), array('XMLRPC', 'JSON'))) |
|
| 637 | 637 | { |
| 638 | - if(Context::get('success_return_url')) |
|
| 638 | + if (Context::get('success_return_url')) |
|
| 639 | 639 | { |
| 640 | 640 | $this->setRedirectUrl(Context::get('success_return_url')); |
| 641 | 641 | } |
@@ -662,38 +662,38 @@ discard block |
||
| 662 | 662 | $target = Context::get('target'); |
| 663 | 663 | $module = Context::get('module'); |
| 664 | 664 | $args = new stdClass(); |
| 665 | - $args->site_srl = (int)$site_module_info->site_srl; |
|
| 666 | - $args->name = str_replace(' ','_',Context::get('lang_code')); |
|
| 667 | - $args->lang_name = str_replace(' ','_',Context::get('lang_name')); |
|
| 668 | - if(!empty($args->lang_name)) $args->name = $args->lang_name; |
|
| 665 | + $args->site_srl = (int) $site_module_info->site_srl; |
|
| 666 | + $args->name = str_replace(' ', '_', Context::get('lang_code')); |
|
| 667 | + $args->lang_name = str_replace(' ', '_', Context::get('lang_name')); |
|
| 668 | + if (!empty($args->lang_name)) $args->name = $args->lang_name; |
|
| 669 | 669 | |
| 670 | 670 | // if args->name is empty, random generate for user define language |
| 671 | - if(empty($args->name)) $args->name = 'userLang'.date('YmdHis').''.sprintf('%03d', mt_rand(0, 100)); |
|
| 671 | + if (empty($args->name)) $args->name = 'userLang'.date('YmdHis').''.sprintf('%03d', mt_rand(0, 100)); |
|
| 672 | 672 | |
| 673 | - if(!$args->name) return new BaseObject(-1,'msg_invalid_request'); |
|
| 673 | + if (!$args->name) return new BaseObject(-1, 'msg_invalid_request'); |
|
| 674 | 674 | // Check whether a language code exists |
| 675 | 675 | $output = executeQueryArray('module.getLang', $args); |
| 676 | - if(!$output->toBool()) return $output; |
|
| 676 | + if (!$output->toBool()) return $output; |
|
| 677 | 677 | // If exists, clear the old values for updating |
| 678 | - if($output->data) $output = executeQuery('module.deleteLang', $args); |
|
| 679 | - if(!$output->toBool()) return $output; |
|
| 678 | + if ($output->data) $output = executeQuery('module.deleteLang', $args); |
|
| 679 | + if (!$output->toBool()) return $output; |
|
| 680 | 680 | // Enter |
| 681 | 681 | $lang_supported = Context::get('lang_supported'); |
| 682 | - foreach($lang_supported as $key => $val) |
|
| 682 | + foreach ($lang_supported as $key => $val) |
|
| 683 | 683 | { |
| 684 | 684 | $args->lang_code = $key; |
| 685 | 685 | $args->value = trim(Context::get($key)); |
| 686 | 686 | |
| 687 | 687 | // if request method is json, strip slashes |
| 688 | - if(Context::getRequestMethod() == 'JSON' && version_compare(PHP_VERSION, "5.4.0", "<") && get_magic_quotes_gpc()) |
|
| 688 | + if (Context::getRequestMethod() == 'JSON' && version_compare(PHP_VERSION, "5.4.0", "<") && get_magic_quotes_gpc()) |
|
| 689 | 689 | { |
| 690 | 690 | $args->value = stripslashes($args->value); |
| 691 | 691 | } |
| 692 | 692 | |
| 693 | - if($args->value) |
|
| 693 | + if ($args->value) |
|
| 694 | 694 | { |
| 695 | 695 | $output = executeQuery('module.insertLang', $args); |
| 696 | - if(!$output->toBool()) return $output; |
|
| 696 | + if (!$output->toBool()) return $output; |
|
| 697 | 697 | } |
| 698 | 698 | } |
| 699 | 699 | $this->makeCacheDefinedLangCode($args->site_srl); |
@@ -713,14 +713,14 @@ discard block |
||
| 713 | 713 | // Get language code |
| 714 | 714 | $site_module_info = Context::get('site_module_info'); |
| 715 | 715 | $args = new stdClass(); |
| 716 | - $args->site_srl = (int)$site_module_info->site_srl; |
|
| 717 | - $args->name = str_replace(' ','_',Context::get('name')); |
|
| 718 | - $args->lang_name = str_replace(' ','_',Context::get('lang_name')); |
|
| 719 | - if(!empty($args->lang_name)) $args->name = $args->lang_name; |
|
| 720 | - if(!$args->name) return new BaseObject(-1,'msg_invalid_request'); |
|
| 716 | + $args->site_srl = (int) $site_module_info->site_srl; |
|
| 717 | + $args->name = str_replace(' ', '_', Context::get('name')); |
|
| 718 | + $args->lang_name = str_replace(' ', '_', Context::get('lang_name')); |
|
| 719 | + if (!empty($args->lang_name)) $args->name = $args->lang_name; |
|
| 720 | + if (!$args->name) return new BaseObject(-1, 'msg_invalid_request'); |
|
| 721 | 721 | |
| 722 | 722 | $output = executeQuery('module.deleteLang', $args); |
| 723 | - if(!$output->toBool()) return $output; |
|
| 723 | + if (!$output->toBool()) return $output; |
|
| 724 | 724 | $this->makeCacheDefinedLangCode($args->site_srl); |
| 725 | 725 | |
| 726 | 726 | $this->setMessage("success_deleted", 'info'); |
@@ -731,7 +731,7 @@ discard block |
||
| 731 | 731 | |
| 732 | 732 | function procModuleAdminGetList() |
| 733 | 733 | { |
| 734 | - if(!Context::get('is_logged')) return new BaseObject(-1, 'msg_not_permitted'); |
|
| 734 | + if (!Context::get('is_logged')) return new BaseObject(-1, 'msg_not_permitted'); |
|
| 735 | 735 | |
| 736 | 736 | $oModuleController = getController('module'); |
| 737 | 737 | $oModuleModel = getModel('module'); |
@@ -744,12 +744,12 @@ discard block |
||
| 744 | 744 | $args = new stdClass; |
| 745 | 745 | $logged_info = Context::get('logged_info'); |
| 746 | 746 | $site_module_info = Context::get('site_module_info'); |
| 747 | - if($site_keyword) $args->site_keyword = $site_keyword; |
|
| 747 | + if ($site_keyword) $args->site_keyword = $site_keyword; |
|
| 748 | 748 | |
| 749 | - if(!$site_srl) |
|
| 749 | + if (!$site_srl) |
|
| 750 | 750 | { |
| 751 | - if($logged_info->is_admin == 'Y' && !$site_keyword && !$vid) $args->site_srl = 0; |
|
| 752 | - else $args->site_srl = (int)$site_module_info->site_srl; |
|
| 751 | + if ($logged_info->is_admin == 'Y' && !$site_keyword && !$vid) $args->site_srl = 0; |
|
| 752 | + else $args->site_srl = (int) $site_module_info->site_srl; |
|
| 753 | 753 | } |
| 754 | 754 | else $args->site_srl = $site_srl; |
| 755 | 755 | |
@@ -759,12 +759,12 @@ discard block |
||
| 759 | 759 | // Get a list of modules at the site |
| 760 | 760 | $output = executeQueryArray('module.getSiteModules', $args); |
| 761 | 761 | $mid_list = array(); |
| 762 | - if(count($output->data) > 0) |
|
| 762 | + if (count($output->data) > 0) |
|
| 763 | 763 | { |
| 764 | - foreach($output->data as $val) |
|
| 764 | + foreach ($output->data as $val) |
|
| 765 | 765 | { |
| 766 | 766 | $module = trim($val->module); |
| 767 | - if(!$module) continue; |
|
| 767 | + if (!$module) continue; |
|
| 768 | 768 | |
| 769 | 769 | // replace user defined lang. |
| 770 | 770 | $oModuleController->replaceDefinedLangCode($val->browser_title); |
@@ -775,7 +775,7 @@ discard block |
||
| 775 | 775 | $obj->browser_title = $val->browser_title; |
| 776 | 776 | $obj->mid = $val->mid; |
| 777 | 777 | $obj->module_category_srl = $val->module_category_srl; |
| 778 | - if($val->module_category_srl > 0) |
|
| 778 | + if ($val->module_category_srl > 0) |
|
| 779 | 779 | { |
| 780 | 780 | $moduleCategorySrl[] = $val->module_category_srl; |
| 781 | 781 | } |
@@ -787,23 +787,23 @@ discard block |
||
| 787 | 787 | $moduleCategorySrl = array_unique($moduleCategorySrl); |
| 788 | 788 | $output = $oModuleModel->getModuleCategories($moduleCategorySrl); |
| 789 | 789 | $categoryNameList = array(); |
| 790 | - if(is_array($output)) |
|
| 790 | + if (is_array($output)) |
|
| 791 | 791 | { |
| 792 | - foreach($output as $value) |
|
| 792 | + foreach ($output as $value) |
|
| 793 | 793 | { |
| 794 | 794 | $categoryNameList[$value->module_category_srl] = $value->title; |
| 795 | 795 | } |
| 796 | 796 | } |
| 797 | 797 | |
| 798 | 798 | $selected_module = Context::get('selected_module'); |
| 799 | - if(count($mid_list) > 0) |
|
| 799 | + if (count($mid_list) > 0) |
|
| 800 | 800 | { |
| 801 | - foreach($mid_list as $module => $val) |
|
| 801 | + foreach ($mid_list as $module => $val) |
|
| 802 | 802 | { |
| 803 | - if(!$selected_module) $selected_module = $module; |
|
| 803 | + if (!$selected_module) $selected_module = $module; |
|
| 804 | 804 | $xml_info = $oModuleModel->getModuleInfoXml($module); |
| 805 | 805 | |
| 806 | - if(!$xml_info) |
|
| 806 | + if (!$xml_info) |
|
| 807 | 807 | { |
| 808 | 808 | unset($mid_list[$module]); |
| 809 | 809 | continue; |
@@ -812,14 +812,14 @@ discard block |
||
| 812 | 812 | $mid_list[$module]->title = $xml_info->title; |
| 813 | 813 | |
| 814 | 814 | // change module category srl to title |
| 815 | - if(is_array($val->list)) |
|
| 815 | + if (is_array($val->list)) |
|
| 816 | 816 | { |
| 817 | - foreach($val->list as $key=>$value) |
|
| 817 | + foreach ($val->list as $key=>$value) |
|
| 818 | 818 | { |
| 819 | - if($value->module_category_srl > 0) |
|
| 819 | + if ($value->module_category_srl > 0) |
|
| 820 | 820 | { |
| 821 | 821 | $categorySrl = $mid_list[$module]->list[$key]->module_category_srl; |
| 822 | - if(isset($categoryNameList[$categorySrl])) |
|
| 822 | + if (isset($categoryNameList[$categorySrl])) |
|
| 823 | 823 | { |
| 824 | 824 | $mid_list[$module]->list[$key]->module_category_srl = $categoryNameList[$categorySrl]; |
| 825 | 825 | } |
@@ -847,20 +847,20 @@ discard block |
||
| 847 | 847 | $args = new stdClass(); |
| 848 | 848 | |
| 849 | 849 | // Get the language file of the current site |
| 850 | - if(!$site_srl) |
|
| 850 | + if (!$site_srl) |
|
| 851 | 851 | { |
| 852 | 852 | $site_module_info = Context::get('site_module_info'); |
| 853 | - $args->site_srl = (int)$site_module_info->site_srl; |
|
| 853 | + $args->site_srl = (int) $site_module_info->site_srl; |
|
| 854 | 854 | } |
| 855 | 855 | else |
| 856 | 856 | { |
| 857 | 857 | $args->site_srl = $site_srl; |
| 858 | 858 | } |
| 859 | 859 | $output = executeQueryArray('module.getLang', $args); |
| 860 | - if(!$output->toBool() || !$output->data) return; |
|
| 860 | + if (!$output->toBool() || !$output->data) return; |
|
| 861 | 861 | |
| 862 | 862 | $langMap = array(); |
| 863 | - foreach($output->data as $lang) |
|
| 863 | + foreach ($output->data as $lang) |
|
| 864 | 864 | { |
| 865 | 865 | $langMap[$lang->lang_code][$lang->name] = $lang->value; |
| 866 | 866 | } |
@@ -869,29 +869,29 @@ discard block |
||
| 869 | 869 | $dbInfo = Context::getDBInfo(); |
| 870 | 870 | $defaultLang = $dbInfo->lang_type; |
| 871 | 871 | |
| 872 | - if(!is_array($langMap[$defaultLang])) |
|
| 872 | + if (!is_array($langMap[$defaultLang])) |
|
| 873 | 873 | { |
| 874 | 874 | $langMap[$defaultLang] = array(); |
| 875 | 875 | } |
| 876 | 876 | |
| 877 | 877 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
| 878 | 878 | |
| 879 | - foreach($lang_supported as $langCode => $langName) |
|
| 879 | + foreach ($lang_supported as $langCode => $langName) |
|
| 880 | 880 | { |
| 881 | - if(!is_array($langMap[$langCode])) |
|
| 881 | + if (!is_array($langMap[$langCode])) |
|
| 882 | 882 | { |
| 883 | 883 | $langMap[$langCode] = array(); |
| 884 | 884 | } |
| 885 | 885 | |
| 886 | 886 | $langMap[$langCode] += $langMap[$defaultLang]; |
| 887 | - foreach($lang_supported as $targetLangCode => $targetLangName) |
|
| 887 | + foreach ($lang_supported as $targetLangCode => $targetLangName) |
|
| 888 | 888 | { |
| 889 | - if($langCode == $targetLangCode || $langCode == $defaultLang) |
|
| 889 | + if ($langCode == $targetLangCode || $langCode == $defaultLang) |
|
| 890 | 890 | { |
| 891 | 891 | continue; |
| 892 | 892 | } |
| 893 | 893 | |
| 894 | - if(!is_array($langMap[$targetLangCode])) |
|
| 894 | + if (!is_array($langMap[$targetLangCode])) |
|
| 895 | 895 | { |
| 896 | 896 | $langMap[$targetLangCode] = array(); |
| 897 | 897 | } |
@@ -899,9 +899,9 @@ discard block |
||
| 899 | 899 | $langMap[$langCode] += $langMap[$targetLangCode]; |
| 900 | 900 | } |
| 901 | 901 | |
| 902 | - if($oCacheHandler->isSupport()) |
|
| 902 | + if ($oCacheHandler->isSupport()) |
|
| 903 | 903 | { |
| 904 | - $object_key = 'user_defined_langs:' . $args->site_srl . ':' . $langCode; |
|
| 904 | + $object_key = 'user_defined_langs:'.$args->site_srl.':'.$langCode; |
|
| 905 | 905 | $cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key); |
| 906 | 906 | $oCacheHandler->put($cache_key, $langMap[$langCode]); |
| 907 | 907 | } |
@@ -922,7 +922,7 @@ discard block |
||
| 922 | 922 | |
| 923 | 923 | $isSkinFix = Context::get('is_skin_fix'); |
| 924 | 924 | |
| 925 | - if($isSkinFix) |
|
| 925 | + if ($isSkinFix) |
|
| 926 | 926 | { |
| 927 | 927 | $isSkinFix = ($isSkinFix == 'N') ? 'N' : 'Y'; |
| 928 | 928 | } |
@@ -938,14 +938,14 @@ discard block |
||
| 938 | 938 | |
| 939 | 939 | public function setDesignInfo($moduleSrl = 0, $mid = '', $skinType = 'P', $layoutSrl = 0, $isSkinFix = 'Y', $skinName = '', $skinVars = NULL) |
| 940 | 940 | { |
| 941 | - if(!$moduleSrl && !$mid) |
|
| 941 | + if (!$moduleSrl && !$mid) |
|
| 942 | 942 | { |
| 943 | 943 | return $this->stop(-1, 'msg_invalid_request'); |
| 944 | 944 | } |
| 945 | 945 | |
| 946 | 946 | $oModuleModel = getModel('module'); |
| 947 | 947 | |
| 948 | - if($mid) |
|
| 948 | + if ($mid) |
|
| 949 | 949 | { |
| 950 | 950 | $moduleInfo = $oModuleModel->getModuleInfoByMid($mid); |
| 951 | 951 | } |
@@ -954,7 +954,7 @@ discard block |
||
| 954 | 954 | $moduleInfo = $oModuleModel->getModuleInfoByModuleSrl($moduleSrl); |
| 955 | 955 | } |
| 956 | 956 | |
| 957 | - if(!$moduleInfo) |
|
| 957 | + if (!$moduleInfo) |
|
| 958 | 958 | { |
| 959 | 959 | return $this->stop(-1, 'msg_module_not_exists'); |
| 960 | 960 | } |
@@ -963,26 +963,26 @@ discard block |
||
| 963 | 963 | $layoutTargetValue = ($skinType == 'M') ? 'mlayout_srl' : 'layout_srl'; |
| 964 | 964 | $skinFixTargetValue = ($skinType == 'M') ? 'is_mskin_fix' : 'is_skin_fix'; |
| 965 | 965 | |
| 966 | - if(strlen($layoutSrl)) |
|
| 966 | + if (strlen($layoutSrl)) |
|
| 967 | 967 | { |
| 968 | 968 | $moduleInfo->{$layoutTargetValue} = $layoutSrl; |
| 969 | 969 | } |
| 970 | 970 | |
| 971 | - if(strlen($isSkinFix)) |
|
| 971 | + if (strlen($isSkinFix)) |
|
| 972 | 972 | { |
| 973 | 973 | $moduleInfo->{$skinFixTargetValue} = $isSkinFix; |
| 974 | 974 | } |
| 975 | 975 | |
| 976 | - if($isSkinFix == 'Y') |
|
| 976 | + if ($isSkinFix == 'Y') |
|
| 977 | 977 | { |
| 978 | 978 | $moduleInfo->{$skinTargetValue} = $skinName; |
| 979 | 979 | $skinVars = json_decode($skinVars); |
| 980 | 980 | |
| 981 | - if(is_array($skinVars)) |
|
| 981 | + if (is_array($skinVars)) |
|
| 982 | 982 | { |
| 983 | - foreach($skinVars as $key => $val) |
|
| 983 | + foreach ($skinVars as $key => $val) |
|
| 984 | 984 | { |
| 985 | - if(empty($val)) |
|
| 985 | + if (empty($val)) |
|
| 986 | 986 | { |
| 987 | 987 | continue; |
| 988 | 988 | } |
@@ -1003,7 +1003,7 @@ discard block |
||
| 1003 | 1003 | $menuItemSrl = Context::get('menu_item_srl'); |
| 1004 | 1004 | $useMobile = Context::get('use_mobile'); |
| 1005 | 1005 | |
| 1006 | - if(!$menuItemSrl) |
|
| 1006 | + if (!$menuItemSrl) |
|
| 1007 | 1007 | { |
| 1008 | 1008 | return $this->stop(-1, 'msg_invalid_request'); |
| 1009 | 1009 | } |
@@ -22,7 +22,9 @@ discard block |
||
| 22 | 22 | $args = new stdClass(); |
| 23 | 23 | $args->title = Context::get('title'); |
| 24 | 24 | $output = executeQuery('module.insertModuleCategory', $args); |
| 25 | - if(!$output->toBool()) return $output; |
|
| 25 | + if(!$output->toBool()) { |
|
| 26 | + return $output; |
|
| 27 | + } |
|
| 26 | 28 | |
| 27 | 29 | $this->setMessage("success_registed"); |
| 28 | 30 | |
@@ -36,7 +38,9 @@ discard block |
||
| 36 | 38 | function procModuleAdminUpdateCategory() |
| 37 | 39 | { |
| 38 | 40 | $output = $this->doUpdateModuleCategory(); |
| 39 | - if(!$output->toBool()) return $output; |
|
| 41 | + if(!$output->toBool()) { |
|
| 42 | + return $output; |
|
| 43 | + } |
|
| 40 | 44 | |
| 41 | 45 | $this->setMessage('success_updated'); |
| 42 | 46 | |
@@ -50,7 +54,9 @@ discard block |
||
| 50 | 54 | function procModuleAdminDeleteCategory() |
| 51 | 55 | { |
| 52 | 56 | $output = $this->doDeleteModuleCategory(); |
| 53 | - if(!$output->toBool()) return $output; |
|
| 57 | + if(!$output->toBool()) { |
|
| 58 | + return $output; |
|
| 59 | + } |
|
| 54 | 60 | |
| 55 | 61 | $this->setMessage('success_deleted'); |
| 56 | 62 | |
@@ -91,8 +97,7 @@ discard block |
||
| 91 | 97 | // Get information of the target module to copy |
| 92 | 98 | $module_srl = Context::get('module_srl'); |
| 93 | 99 | $args = Context::getRequestVars(); |
| 94 | - } |
|
| 95 | - else |
|
| 100 | + } else |
|
| 96 | 101 | { |
| 97 | 102 | $module_srl = $args->module_srl; |
| 98 | 103 | } |
@@ -107,11 +112,19 @@ discard block |
||
| 107 | 112 | for($i=1;$i<=10;$i++) |
| 108 | 113 | { |
| 109 | 114 | $mid = trim($args->{"mid_".$i}); |
| 110 | - if(!$mid) continue; |
|
| 111 | - if(!preg_match("/^[a-zA-Z]([a-zA-Z0-9_]*)$/i", $mid)) return new BaseObject(-1, 'msg_limit_mid'); |
|
| 115 | + if(!$mid) { |
|
| 116 | + continue; |
|
| 117 | + } |
|
| 118 | + if(!preg_match("/^[a-zA-Z]([a-zA-Z0-9_]*)$/i", $mid)) { |
|
| 119 | + return new BaseObject(-1, 'msg_limit_mid'); |
|
| 120 | + } |
|
| 112 | 121 | $browser_title = $args->{"browser_title_".$i}; |
| 113 | - if(!$mid) continue; |
|
| 114 | - if($mid && !$browser_title) $browser_title = $mid; |
|
| 122 | + if(!$mid) { |
|
| 123 | + continue; |
|
| 124 | + } |
|
| 125 | + if($mid && !$browser_title) { |
|
| 126 | + $browser_title = $mid; |
|
| 127 | + } |
|
| 115 | 128 | $clones[$mid] = $browser_title; |
| 116 | 129 | } |
| 117 | 130 | if(count($clones) < 1) |
@@ -131,7 +144,9 @@ discard block |
||
| 131 | 144 | $grant = array(); |
| 132 | 145 | if($output->data) |
| 133 | 146 | { |
| 134 | - foreach($output->data as $val) $grant[$val->name][] = $val->group_srl; |
|
| 147 | + foreach($output->data as $val) { |
|
| 148 | + $grant[$val->name][] = $val->group_srl; |
|
| 149 | + } |
|
| 135 | 150 | } |
| 136 | 151 | |
| 137 | 152 | // get Extra Vars |
@@ -218,11 +233,19 @@ discard block |
||
| 218 | 233 | } |
| 219 | 234 | |
| 220 | 235 | // Grant module permissions |
| 221 | - if(count($grant) > 0) $oModuleController->insertModuleGrants($module_srl, $grant); |
|
| 222 | - if($extra_vars) $oModuleController->insertModuleExtraVars($module_srl, $extra_vars); |
|
| 236 | + if(count($grant) > 0) { |
|
| 237 | + $oModuleController->insertModuleGrants($module_srl, $grant); |
|
| 238 | + } |
|
| 239 | + if($extra_vars) { |
|
| 240 | + $oModuleController->insertModuleExtraVars($module_srl, $extra_vars); |
|
| 241 | + } |
|
| 223 | 242 | |
| 224 | - if($moduleSkinVars) $oModuleController->insertModuleSkinVars($module_srl, $moduleSkinVars); |
|
| 225 | - if($moduleMobileSkinVars) $oModuleController->insertModuleMobileSkinVars($module_srl, $moduleMobileSkinVars); |
|
| 243 | + if($moduleSkinVars) { |
|
| 244 | + $oModuleController->insertModuleSkinVars($module_srl, $moduleSkinVars); |
|
| 245 | + } |
|
| 246 | + if($moduleMobileSkinVars) { |
|
| 247 | + $oModuleController->insertModuleMobileSkinVars($module_srl, $moduleMobileSkinVars); |
|
| 248 | + } |
|
| 226 | 249 | |
| 227 | 250 | $triggerObj->moduleSrlList[] = $module_srl; |
| 228 | 251 | } |
@@ -235,8 +258,7 @@ discard block |
||
| 235 | 258 | { |
| 236 | 259 | $message = implode('\n', $errorLog); |
| 237 | 260 | $this->setMessage($message); |
| 238 | - } |
|
| 239 | - else |
|
| 261 | + } else |
|
| 240 | 262 | { |
| 241 | 263 | $message = $lang->success_registed; |
| 242 | 264 | $this->setMessage('success_registed'); |
@@ -262,9 +284,9 @@ discard block |
||
| 262 | 284 | |
| 263 | 285 | private function _returnByProc($isProc, $msg='msg_invalid_request') |
| 264 | 286 | { |
| 265 | - if(!$isProc) |
|
| 266 | - return; |
|
| 267 | - else |
|
| 287 | + if(!$isProc) { |
|
| 288 | + return; |
|
| 289 | + } else |
|
| 268 | 290 | { |
| 269 | 291 | return new BaseObject(-1, $msg); |
| 270 | 292 | } |
@@ -282,7 +304,9 @@ discard block |
||
| 282 | 304 | // Get information of the module |
| 283 | 305 | $columnList = array('module_srl', 'module'); |
| 284 | 306 | $module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl, $columnList); |
| 285 | - if(!$module_info) return new BaseObject(-1,'msg_invalid_request'); |
|
| 307 | + if(!$module_info) { |
|
| 308 | + return new BaseObject(-1,'msg_invalid_request'); |
|
| 309 | + } |
|
| 286 | 310 | // Register Admin ID |
| 287 | 311 | $oModuleController->deleteAdminId($module_srl); |
| 288 | 312 | $admin_member = Context::get('admin_member'); |
@@ -292,7 +316,9 @@ discard block |
||
| 292 | 316 | foreach($admin_members as $admin_id) |
| 293 | 317 | { |
| 294 | 318 | $admin_id = trim($admin_id); |
| 295 | - if(!$admin_id) continue; |
|
| 319 | + if(!$admin_id) { |
|
| 320 | + continue; |
|
| 321 | + } |
|
| 296 | 322 | $oModuleController->insertAdminId($module_srl, $admin_id); |
| 297 | 323 | } |
| 298 | 324 | } |
@@ -318,15 +344,18 @@ discard block |
||
| 318 | 344 | $grant->{$grant_name}[] = $default; |
| 319 | 345 | continue; |
| 320 | 346 | // users in a particular group |
| 321 | - } |
|
| 322 | - else |
|
| 347 | + } else |
|
| 323 | 348 | { |
| 324 | 349 | $group_srls = Context::get($grant_name); |
| 325 | 350 | if($group_srls) |
| 326 | 351 | { |
| 327 | - if(strpos($group_srls,'|@|')!==false) $group_srls = explode('|@|',$group_srls); |
|
| 328 | - elseif(strpos($group_srls,',')!==false) $group_srls = explode(',',$group_srls); |
|
| 329 | - else $group_srls = array($group_srls); |
|
| 352 | + if(strpos($group_srls,'|@|')!==false) { |
|
| 353 | + $group_srls = explode('|@|',$group_srls); |
|
| 354 | + } elseif(strpos($group_srls,',')!==false) { |
|
| 355 | + $group_srls = explode(',',$group_srls); |
|
| 356 | + } else { |
|
| 357 | + $group_srls = array($group_srls); |
|
| 358 | + } |
|
| 330 | 359 | $grant->{$grant_name} = $group_srls; |
| 331 | 360 | } |
| 332 | 361 | continue; |
@@ -338,7 +367,9 @@ discard block |
||
| 338 | 367 | $args = new stdClass(); |
| 339 | 368 | $args->module_srl = $module_srl; |
| 340 | 369 | $output = executeQuery('module.deleteModuleGrants', $args); |
| 341 | - if(!$output->toBool()) return $output; |
|
| 370 | + if(!$output->toBool()) { |
|
| 371 | + return $output; |
|
| 372 | + } |
|
| 342 | 373 | // Permissions stored in the DB |
| 343 | 374 | foreach($grant as $grant_name => $group_srls) |
| 344 | 375 | { |
@@ -349,7 +380,9 @@ discard block |
||
| 349 | 380 | $args->name = $grant_name; |
| 350 | 381 | $args->group_srl = $val; |
| 351 | 382 | $output = executeQuery('module.insertModuleGrant', $args); |
| 352 | - if(!$output->toBool()) return $output; |
|
| 383 | + if(!$output->toBool()) { |
|
| 384 | + return $output; |
|
| 385 | + } |
|
| 353 | 386 | } |
| 354 | 387 | } |
| 355 | 388 | $this->setMessage('success_registed'); |
@@ -375,19 +408,16 @@ discard block |
||
| 375 | 408 | if($module_info->is_mskin_fix == 'Y') |
| 376 | 409 | { |
| 377 | 410 | $skin = $module_info->mskin; |
| 378 | - } |
|
| 379 | - else |
|
| 411 | + } else |
|
| 380 | 412 | { |
| 381 | 413 | $skin = $oModuleModel->getModuleDefaultSkin($module_info->module, 'M'); |
| 382 | 414 | } |
| 383 | - } |
|
| 384 | - else |
|
| 415 | + } else |
|
| 385 | 416 | { |
| 386 | 417 | if($module_info->is_skin_fix == 'Y') |
| 387 | 418 | { |
| 388 | 419 | $skin = $module_info->skin; |
| 389 | - } |
|
| 390 | - else |
|
| 420 | + } else |
|
| 391 | 421 | { |
| 392 | 422 | $skin = $oModuleModel->getModuleDefaultSkin($module_info->module, 'P'); |
| 393 | 423 | } |
@@ -400,8 +430,7 @@ discard block |
||
| 400 | 430 | { |
| 401 | 431 | $skin_info = $oModuleModel->loadSkinInfo($module_path, $skin, 'm.skins'); |
| 402 | 432 | $skin_vars = $oModuleModel->getModuleMobileSkinVars($module_srl); |
| 403 | - } |
|
| 404 | - else |
|
| 433 | + } else |
|
| 405 | 434 | { |
| 406 | 435 | $skin_info = $oModuleModel->loadSkinInfo($module_path, $skin); |
| 407 | 436 | $skin_vars = $oModuleModel->getModuleSkinVars($module_srl); |
@@ -421,7 +450,9 @@ discard block |
||
| 421 | 450 | { |
| 422 | 451 | foreach($skin_info->extra_vars as $vars) |
| 423 | 452 | { |
| 424 | - if($vars->type!='image') continue; |
|
| 453 | + if($vars->type!='image') { |
|
| 454 | + continue; |
|
| 455 | + } |
|
| 425 | 456 | |
| 426 | 457 | $image_obj = $obj->{$vars->name}; |
| 427 | 458 | // Get a variable to delete |
@@ -453,7 +484,9 @@ discard block |
||
| 453 | 484 | // Upload the file to a path |
| 454 | 485 | $path = sprintf("./files/attach/images/%s/", $module_srl); |
| 455 | 486 | // Create a directory |
| 456 | - if(!FileHandler::makeDir($path)) return false; |
|
| 487 | + if(!FileHandler::makeDir($path)) { |
|
| 488 | + return false; |
|
| 489 | + } |
|
| 457 | 490 | |
| 458 | 491 | $filename = $path.$image_obj['name']; |
| 459 | 492 | // Move the file |
@@ -484,8 +517,7 @@ discard block |
||
| 484 | 517 | if($mode === 'M') |
| 485 | 518 | { |
| 486 | 519 | $output = $oModuleController->insertModuleMobileSkinVars($module_srl, $obj); |
| 487 | - } |
|
| 488 | - else |
|
| 520 | + } else |
|
| 489 | 521 | { |
| 490 | 522 | $output = $oModuleController->insertModuleSkinVars($module_srl, $obj); |
| 491 | 523 | } |
@@ -506,10 +538,14 @@ discard block |
||
| 506 | 538 | { |
| 507 | 539 | $vars = Context::getRequestVars(); |
| 508 | 540 | |
| 509 | - if(!$vars->module_srls) return new BaseObject(-1,'msg_invalid_request'); |
|
| 541 | + if(!$vars->module_srls) { |
|
| 542 | + return new BaseObject(-1,'msg_invalid_request'); |
|
| 543 | + } |
|
| 510 | 544 | |
| 511 | 545 | $module_srls = explode(',',$vars->module_srls); |
| 512 | - if(count($module_srls) < 1) return new BaseObject(-1,'msg_invalid_request'); |
|
| 546 | + if(count($module_srls) < 1) { |
|
| 547 | + return new BaseObject(-1,'msg_invalid_request'); |
|
| 548 | + } |
|
| 513 | 549 | |
| 514 | 550 | $oModuleModel = getModel('module'); |
| 515 | 551 | $oModuleController= getController('module'); |
@@ -541,8 +577,7 @@ discard block |
||
| 541 | 577 | if(Context::get('success_return_url')) |
| 542 | 578 | { |
| 543 | 579 | $this->setRedirectUrl(Context::get('success_return_url')); |
| 544 | - } |
|
| 545 | - else |
|
| 580 | + } else |
|
| 546 | 581 | { |
| 547 | 582 | global $lang; |
| 548 | 583 | htmlHeader(); |
@@ -561,10 +596,14 @@ discard block |
||
| 561 | 596 | function procModuleAdminModuleGrantSetup() |
| 562 | 597 | { |
| 563 | 598 | $module_srls = Context::get('module_srls'); |
| 564 | - if(!$module_srls) return new BaseObject(-1,'msg_invalid_request'); |
|
| 599 | + if(!$module_srls) { |
|
| 600 | + return new BaseObject(-1,'msg_invalid_request'); |
|
| 601 | + } |
|
| 565 | 602 | |
| 566 | 603 | $modules = explode(',',$module_srls); |
| 567 | - if(count($modules) < 1) return new BaseObject(-1,'msg_invalid_request'); |
|
| 604 | + if(count($modules) < 1) { |
|
| 605 | + return new BaseObject(-1,'msg_invalid_request'); |
|
| 606 | + } |
|
| 568 | 607 | |
| 569 | 608 | $oModuleController = getController('module'); |
| 570 | 609 | $oModuleModel = getModel('module'); |
@@ -592,17 +631,20 @@ discard block |
||
| 592 | 631 | $grant->{$grant_name}[] = $default; |
| 593 | 632 | continue; |
| 594 | 633 | // Users in a particular group |
| 595 | - } |
|
| 596 | - else |
|
| 634 | + } else |
|
| 597 | 635 | { |
| 598 | 636 | $group_srls = Context::get($grant_name); |
| 599 | 637 | if($group_srls) |
| 600 | 638 | { |
| 601 | 639 | if(!is_array($group_srls)) |
| 602 | 640 | { |
| 603 | - if(strpos($group_srls,'|@|')!==false) $group_srls = explode('|@|',$group_srls); |
|
| 604 | - elseif(strpos($group_srls,',')!==false) $group_srls = explode(',',$group_srls); |
|
| 605 | - else $group_srls = array($group_srls); |
|
| 641 | + if(strpos($group_srls,'|@|')!==false) { |
|
| 642 | + $group_srls = explode('|@|',$group_srls); |
|
| 643 | + } elseif(strpos($group_srls,',')!==false) { |
|
| 644 | + $group_srls = explode(',',$group_srls); |
|
| 645 | + } else { |
|
| 646 | + $group_srls = array($group_srls); |
|
| 647 | + } |
|
| 606 | 648 | } |
| 607 | 649 | $grant->{$grant_name} = $group_srls; |
| 608 | 650 | } |
@@ -617,7 +659,9 @@ discard block |
||
| 617 | 659 | $args = new stdClass(); |
| 618 | 660 | $args->module_srl = $module_srl; |
| 619 | 661 | $output = executeQuery('module.deleteModuleGrants', $args); |
| 620 | - if(!$output->toBool()) continue; |
|
| 662 | + if(!$output->toBool()) { |
|
| 663 | + continue; |
|
| 664 | + } |
|
| 621 | 665 | // Permissions stored in the DB |
| 622 | 666 | foreach($grant as $grant_name => $group_srls) |
| 623 | 667 | { |
@@ -628,7 +672,9 @@ discard block |
||
| 628 | 672 | $args->name = $grant_name; |
| 629 | 673 | $args->group_srl = $val; |
| 630 | 674 | $output = executeQuery('module.insertModuleGrant', $args); |
| 631 | - if(!$output->toBool()) return $output; |
|
| 675 | + if(!$output->toBool()) { |
|
| 676 | + return $output; |
|
| 677 | + } |
|
| 632 | 678 | } |
| 633 | 679 | } |
| 634 | 680 | } |
@@ -638,8 +684,7 @@ discard block |
||
| 638 | 684 | if(Context::get('success_return_url')) |
| 639 | 685 | { |
| 640 | 686 | $this->setRedirectUrl(Context::get('success_return_url')); |
| 641 | - } |
|
| 642 | - else |
|
| 687 | + } else |
|
| 643 | 688 | { |
| 644 | 689 | global $lang; |
| 645 | 690 | htmlHeader(); |
@@ -665,18 +710,30 @@ discard block |
||
| 665 | 710 | $args->site_srl = (int)$site_module_info->site_srl; |
| 666 | 711 | $args->name = str_replace(' ','_',Context::get('lang_code')); |
| 667 | 712 | $args->lang_name = str_replace(' ','_',Context::get('lang_name')); |
| 668 | - if(!empty($args->lang_name)) $args->name = $args->lang_name; |
|
| 713 | + if(!empty($args->lang_name)) { |
|
| 714 | + $args->name = $args->lang_name; |
|
| 715 | + } |
|
| 669 | 716 | |
| 670 | 717 | // if args->name is empty, random generate for user define language |
| 671 | - if(empty($args->name)) $args->name = 'userLang'.date('YmdHis').''.sprintf('%03d', mt_rand(0, 100)); |
|
| 718 | + if(empty($args->name)) { |
|
| 719 | + $args->name = 'userLang'.date('YmdHis').''.sprintf('%03d', mt_rand(0, 100)); |
|
| 720 | + } |
|
| 672 | 721 | |
| 673 | - if(!$args->name) return new BaseObject(-1,'msg_invalid_request'); |
|
| 722 | + if(!$args->name) { |
|
| 723 | + return new BaseObject(-1,'msg_invalid_request'); |
|
| 724 | + } |
|
| 674 | 725 | // Check whether a language code exists |
| 675 | 726 | $output = executeQueryArray('module.getLang', $args); |
| 676 | - if(!$output->toBool()) return $output; |
|
| 727 | + if(!$output->toBool()) { |
|
| 728 | + return $output; |
|
| 729 | + } |
|
| 677 | 730 | // If exists, clear the old values for updating |
| 678 | - if($output->data) $output = executeQuery('module.deleteLang', $args); |
|
| 679 | - if(!$output->toBool()) return $output; |
|
| 731 | + if($output->data) { |
|
| 732 | + $output = executeQuery('module.deleteLang', $args); |
|
| 733 | + } |
|
| 734 | + if(!$output->toBool()) { |
|
| 735 | + return $output; |
|
| 736 | + } |
|
| 680 | 737 | // Enter |
| 681 | 738 | $lang_supported = Context::get('lang_supported'); |
| 682 | 739 | foreach($lang_supported as $key => $val) |
@@ -693,7 +750,9 @@ discard block |
||
| 693 | 750 | if($args->value) |
| 694 | 751 | { |
| 695 | 752 | $output = executeQuery('module.insertLang', $args); |
| 696 | - if(!$output->toBool()) return $output; |
|
| 753 | + if(!$output->toBool()) { |
|
| 754 | + return $output; |
|
| 755 | + } |
|
| 697 | 756 | } |
| 698 | 757 | } |
| 699 | 758 | $this->makeCacheDefinedLangCode($args->site_srl); |
@@ -716,11 +775,17 @@ discard block |
||
| 716 | 775 | $args->site_srl = (int)$site_module_info->site_srl; |
| 717 | 776 | $args->name = str_replace(' ','_',Context::get('name')); |
| 718 | 777 | $args->lang_name = str_replace(' ','_',Context::get('lang_name')); |
| 719 | - if(!empty($args->lang_name)) $args->name = $args->lang_name; |
|
| 720 | - if(!$args->name) return new BaseObject(-1,'msg_invalid_request'); |
|
| 778 | + if(!empty($args->lang_name)) { |
|
| 779 | + $args->name = $args->lang_name; |
|
| 780 | + } |
|
| 781 | + if(!$args->name) { |
|
| 782 | + return new BaseObject(-1,'msg_invalid_request'); |
|
| 783 | + } |
|
| 721 | 784 | |
| 722 | 785 | $output = executeQuery('module.deleteLang', $args); |
| 723 | - if(!$output->toBool()) return $output; |
|
| 786 | + if(!$output->toBool()) { |
|
| 787 | + return $output; |
|
| 788 | + } |
|
| 724 | 789 | $this->makeCacheDefinedLangCode($args->site_srl); |
| 725 | 790 | |
| 726 | 791 | $this->setMessage("success_deleted", 'info'); |
@@ -731,7 +796,9 @@ discard block |
||
| 731 | 796 | |
| 732 | 797 | function procModuleAdminGetList() |
| 733 | 798 | { |
| 734 | - if(!Context::get('is_logged')) return new BaseObject(-1, 'msg_not_permitted'); |
|
| 799 | + if(!Context::get('is_logged')) { |
|
| 800 | + return new BaseObject(-1, 'msg_not_permitted'); |
|
| 801 | + } |
|
| 735 | 802 | |
| 736 | 803 | $oModuleController = getController('module'); |
| 737 | 804 | $oModuleModel = getModel('module'); |
@@ -744,14 +811,20 @@ discard block |
||
| 744 | 811 | $args = new stdClass; |
| 745 | 812 | $logged_info = Context::get('logged_info'); |
| 746 | 813 | $site_module_info = Context::get('site_module_info'); |
| 747 | - if($site_keyword) $args->site_keyword = $site_keyword; |
|
| 814 | + if($site_keyword) { |
|
| 815 | + $args->site_keyword = $site_keyword; |
|
| 816 | + } |
|
| 748 | 817 | |
| 749 | 818 | if(!$site_srl) |
| 750 | 819 | { |
| 751 | - if($logged_info->is_admin == 'Y' && !$site_keyword && !$vid) $args->site_srl = 0; |
|
| 752 | - else $args->site_srl = (int)$site_module_info->site_srl; |
|
| 820 | + if($logged_info->is_admin == 'Y' && !$site_keyword && !$vid) { |
|
| 821 | + $args->site_srl = 0; |
|
| 822 | + } else { |
|
| 823 | + $args->site_srl = (int)$site_module_info->site_srl; |
|
| 824 | + } |
|
| 825 | + } else { |
|
| 826 | + $args->site_srl = $site_srl; |
|
| 753 | 827 | } |
| 754 | - else $args->site_srl = $site_srl; |
|
| 755 | 828 | |
| 756 | 829 | $args->sort_index1 = 'sites.domain'; |
| 757 | 830 | |
@@ -764,7 +837,9 @@ discard block |
||
| 764 | 837 | foreach($output->data as $val) |
| 765 | 838 | { |
| 766 | 839 | $module = trim($val->module); |
| 767 | - if(!$module) continue; |
|
| 840 | + if(!$module) { |
|
| 841 | + continue; |
|
| 842 | + } |
|
| 768 | 843 | |
| 769 | 844 | // replace user defined lang. |
| 770 | 845 | $oModuleController->replaceDefinedLangCode($val->browser_title); |
@@ -800,7 +875,9 @@ discard block |
||
| 800 | 875 | { |
| 801 | 876 | foreach($mid_list as $module => $val) |
| 802 | 877 | { |
| 803 | - if(!$selected_module) $selected_module = $module; |
|
| 878 | + if(!$selected_module) { |
|
| 879 | + $selected_module = $module; |
|
| 880 | + } |
|
| 804 | 881 | $xml_info = $oModuleModel->getModuleInfoXml($module); |
| 805 | 882 | |
| 806 | 883 | if(!$xml_info) |
@@ -823,8 +900,7 @@ discard block |
||
| 823 | 900 | { |
| 824 | 901 | $mid_list[$module]->list[$key]->module_category_srl = $categoryNameList[$categorySrl]; |
| 825 | 902 | } |
| 826 | - } |
|
| 827 | - else |
|
| 903 | + } else |
|
| 828 | 904 | { |
| 829 | 905 | $mid_list[$module]->list[$key]->module_category_srl = Context::getLang('none_category'); |
| 830 | 906 | } |
@@ -851,13 +927,14 @@ discard block |
||
| 851 | 927 | { |
| 852 | 928 | $site_module_info = Context::get('site_module_info'); |
| 853 | 929 | $args->site_srl = (int)$site_module_info->site_srl; |
| 854 | - } |
|
| 855 | - else |
|
| 930 | + } else |
|
| 856 | 931 | { |
| 857 | 932 | $args->site_srl = $site_srl; |
| 858 | 933 | } |
| 859 | 934 | $output = executeQueryArray('module.getLang', $args); |
| 860 | - if(!$output->toBool() || !$output->data) return; |
|
| 935 | + if(!$output->toBool() || !$output->data) { |
|
| 936 | + return; |
|
| 937 | + } |
|
| 861 | 938 | |
| 862 | 939 | $langMap = array(); |
| 863 | 940 | foreach($output->data as $lang) |
@@ -948,8 +1025,7 @@ discard block |
||
| 948 | 1025 | if($mid) |
| 949 | 1026 | { |
| 950 | 1027 | $moduleInfo = $oModuleModel->getModuleInfoByMid($mid); |
| 951 | - } |
|
| 952 | - else |
|
| 1028 | + } else |
|
| 953 | 1029 | { |
| 954 | 1030 | $moduleInfo = $oModuleModel->getModuleInfoByModuleSrl($moduleSrl); |
| 955 | 1031 | } |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | $output = executeQuery('module.insertActionForward', $args); |
| 30 | 30 | |
| 31 | 31 | $oCacheHandler = CacheHandler::getInstance('object', NULL, TRUE); |
| 32 | - if($oCacheHandler->isSupport()) |
|
| 32 | + if ($oCacheHandler->isSupport()) |
|
| 33 | 33 | { |
| 34 | 34 | $cache_key = 'action_forward'; |
| 35 | 35 | $oCacheHandler->delete($cache_key); |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | $output = executeQuery('module.deleteActionForward', $args); |
| 52 | 52 | |
| 53 | 53 | $oCacheHandler = CacheHandler::getInstance('object', NULL, TRUE); |
| 54 | - if($oCacheHandler->isSupport()) |
|
| 54 | + if ($oCacheHandler->isSupport()) |
|
| 55 | 55 | { |
| 56 | 56 | $cache_key = 'action_forward'; |
| 57 | 57 | $oCacheHandler->delete($cache_key); |
@@ -75,12 +75,12 @@ discard block |
||
| 75 | 75 | $args->called_position = $called_position; |
| 76 | 76 | |
| 77 | 77 | $output = executeQuery('module.insertTrigger', $args); |
| 78 | - if($output->toBool()) |
|
| 78 | + if ($output->toBool()) |
|
| 79 | 79 | { |
| 80 | 80 | //remove from cache |
| 81 | 81 | $GLOBALS['__triggers__'] = NULL; |
| 82 | 82 | $oCacheHandler = CacheHandler::getInstance('object', NULL, TRUE); |
| 83 | - if($oCacheHandler->isSupport()) |
|
| 83 | + if ($oCacheHandler->isSupport()) |
|
| 84 | 84 | { |
| 85 | 85 | $cache_key = 'triggers'; |
| 86 | 86 | $oCacheHandler->delete($cache_key); |
@@ -104,12 +104,12 @@ discard block |
||
| 104 | 104 | $args->called_position = $called_position; |
| 105 | 105 | |
| 106 | 106 | $output = executeQuery('module.deleteTrigger', $args); |
| 107 | - if($output->toBool()) |
|
| 107 | + if ($output->toBool()) |
|
| 108 | 108 | { |
| 109 | 109 | //remove from cache |
| 110 | 110 | $GLOBALS['__triggers__'] = NULL; |
| 111 | 111 | $oCacheHandler = CacheHandler::getInstance('object', NULL, TRUE); |
| 112 | - if($oCacheHandler->isSupport()) |
|
| 112 | + if ($oCacheHandler->isSupport()) |
|
| 113 | 113 | { |
| 114 | 114 | $cache_key = 'triggers'; |
| 115 | 115 | $oCacheHandler->delete($cache_key); |
@@ -129,12 +129,12 @@ discard block |
||
| 129 | 129 | $args->module = $module; |
| 130 | 130 | |
| 131 | 131 | $output = executeQuery('module.deleteModuleTriggers', $args); |
| 132 | - if($output->toBool()) |
|
| 132 | + if ($output->toBool()) |
|
| 133 | 133 | { |
| 134 | 134 | //remove from cache |
| 135 | 135 | $GLOBALS['__triggers__'] = NULL; |
| 136 | 136 | $oCacheHandler = CacheHandler::getInstance('object', NULL, TRUE); |
| 137 | - if($oCacheHandler->isSupport()) |
|
| 137 | + if ($oCacheHandler->isSupport()) |
|
| 138 | 138 | { |
| 139 | 139 | $cache_key = 'triggers'; |
| 140 | 140 | $oCacheHandler->delete($cache_key); |
@@ -148,11 +148,11 @@ discard block |
||
| 148 | 148 | * @brief Add module extend |
| 149 | 149 | * |
| 150 | 150 | */ |
| 151 | - function insertModuleExtend($parent_module, $extend_module, $type, $kind='') |
|
| 151 | + function insertModuleExtend($parent_module, $extend_module, $type, $kind = '') |
|
| 152 | 152 | { |
| 153 | - if($kind != 'admin') $kind = ''; |
|
| 154 | - if(!in_array($type,array('model','controller','view','api','mobile'))) return false; |
|
| 155 | - if(in_array($parent_module, array('module','addon','widget','layout'))) return false; |
|
| 153 | + if ($kind != 'admin') $kind = ''; |
|
| 154 | + if (!in_array($type, array('model', 'controller', 'view', 'api', 'mobile'))) return false; |
|
| 155 | + if (in_array($parent_module, array('module', 'addon', 'widget', 'layout'))) return false; |
|
| 156 | 156 | |
| 157 | 157 | $cache_file = './files/config/module_extend.php'; |
| 158 | 158 | FileHandler::removeFile($cache_file); |
@@ -164,7 +164,7 @@ discard block |
||
| 164 | 164 | $args->kind = $kind; |
| 165 | 165 | |
| 166 | 166 | $output = executeQuery('module.getModuleExtendCount', $args); |
| 167 | - if($output->data->count>0) return false; |
|
| 167 | + if ($output->data->count > 0) return false; |
|
| 168 | 168 | |
| 169 | 169 | $output = executeQuery('module.insertModuleExtend', $args); |
| 170 | 170 | return $output; |
@@ -174,7 +174,7 @@ discard block |
||
| 174 | 174 | * @brief Delete module extend |
| 175 | 175 | * |
| 176 | 176 | */ |
| 177 | - function deleteModuleExtend($parent_module, $extend_module, $type, $kind='') |
|
| 177 | + function deleteModuleExtend($parent_module, $extend_module, $type, $kind = '') |
|
| 178 | 178 | { |
| 179 | 179 | $cache_file = './files/config/module_extend.php'; |
| 180 | 180 | FileHandler::removeFile($cache_file); |
@@ -199,9 +199,9 @@ discard block |
||
| 199 | 199 | $oModuleModel = getModel('module'); |
| 200 | 200 | $origin_config = $oModuleModel->getModuleConfig($module, $site_srl); |
| 201 | 201 | |
| 202 | - if(!$origin_config) $origin_config = new stdClass; |
|
| 202 | + if (!$origin_config) $origin_config = new stdClass; |
|
| 203 | 203 | |
| 204 | - foreach($config as $key => $val) |
|
| 204 | + foreach ($config as $key => $val) |
|
| 205 | 205 | { |
| 206 | 206 | $origin_config->{$key} = $val; |
| 207 | 207 | } |
@@ -215,19 +215,19 @@ discard block |
||
| 215 | 215 | */ |
| 216 | 216 | function insertModuleConfig($module, $config, $site_srl = 0) |
| 217 | 217 | { |
| 218 | - $args =new stdClass(); |
|
| 218 | + $args = new stdClass(); |
|
| 219 | 219 | $args->module = $module; |
| 220 | 220 | $args->config = serialize($config); |
| 221 | 221 | $args->site_srl = $site_srl; |
| 222 | 222 | |
| 223 | 223 | $output = executeQuery('module.deleteModuleConfig', $args); |
| 224 | - if(!$output->toBool()) return $output; |
|
| 224 | + if (!$output->toBool()) return $output; |
|
| 225 | 225 | |
| 226 | 226 | $output = executeQuery('module.insertModuleConfig', $args); |
| 227 | 227 | |
| 228 | 228 | //remove from cache |
| 229 | 229 | $oCacheHandler = CacheHandler::getInstance('object', NULL, TRUE); |
| 230 | - if($oCacheHandler->isSupport()) |
|
| 230 | + if ($oCacheHandler->isSupport()) |
|
| 231 | 231 | { |
| 232 | 232 | $oCacheHandler->invalidateGroupKey('site_and_module'); |
| 233 | 233 | } |
@@ -246,13 +246,13 @@ discard block |
||
| 246 | 246 | $args->config = serialize($config); |
| 247 | 247 | |
| 248 | 248 | $output = executeQuery('module.deleteModulePartConfig', $args); |
| 249 | - if(!$output->toBool()) return $output; |
|
| 249 | + if (!$output->toBool()) return $output; |
|
| 250 | 250 | |
| 251 | 251 | $output = executeQuery('module.insertModulePartConfig', $args); |
| 252 | 252 | |
| 253 | 253 | //remove from cache |
| 254 | 254 | $oCacheHandler = CacheHandler::getInstance('object', NULL, TRUE); |
| 255 | - if($oCacheHandler->isSupport()) |
|
| 255 | + if ($oCacheHandler->isSupport()) |
|
| 256 | 256 | { |
| 257 | 257 | $oCacheHandler->invalidateGroupKey('site_and_module'); |
| 258 | 258 | } |
@@ -265,10 +265,10 @@ discard block |
||
| 265 | 265 | */ |
| 266 | 266 | function insertSite($domain, $index_module_srl) |
| 267 | 267 | { |
| 268 | - if(isSiteID($domain)) |
|
| 268 | + if (isSiteID($domain)) |
|
| 269 | 269 | { |
| 270 | 270 | $oModuleModel = getModel('module'); |
| 271 | - if($oModuleModel->isIDExists($domain, 0)) return new BaseObject(-1,'msg_already_registed_vid'); |
|
| 271 | + if ($oModuleModel->isIDExists($domain, 0)) return new BaseObject(-1, 'msg_already_registed_vid'); |
|
| 272 | 272 | } |
| 273 | 273 | else |
| 274 | 274 | { |
@@ -284,10 +284,10 @@ discard block |
||
| 284 | 284 | $columnList = array('modules.site_srl'); |
| 285 | 285 | $oModuleModel = getModel('module'); |
| 286 | 286 | $output = $oModuleModel->getSiteInfoByDomain($args->domain, $columnList); |
| 287 | - if($output) return new BaseObject(-1,'msg_already_registed_vid'); |
|
| 287 | + if ($output) return new BaseObject(-1, 'msg_already_registed_vid'); |
|
| 288 | 288 | |
| 289 | 289 | $output = executeQuery('module.insertSite', $args); |
| 290 | - if(!$output->toBool()) return $output; |
|
| 290 | + if (!$output->toBool()) return $output; |
|
| 291 | 291 | |
| 292 | 292 | $output->add('site_srl', $args->site_srl); |
| 293 | 293 | return $output; |
@@ -302,32 +302,32 @@ discard block |
||
| 302 | 302 | $columnList = array('sites.site_srl', 'sites.domain'); |
| 303 | 303 | $site_info = $oModuleModel->getSiteInfo($args->site_srl, $columnList); |
| 304 | 304 | |
| 305 | - if(!$args->domain && $site_info->site_srl == $args->site_srl) |
|
| 305 | + if (!$args->domain && $site_info->site_srl == $args->site_srl) |
|
| 306 | 306 | { |
| 307 | 307 | $args->domain = $site_info->domain; |
| 308 | 308 | } |
| 309 | 309 | |
| 310 | - if($site_info->domain != $args->domain) |
|
| 310 | + if ($site_info->domain != $args->domain) |
|
| 311 | 311 | { |
| 312 | 312 | $info = $oModuleModel->getSiteInfoByDomain($args->domain, $columnList); |
| 313 | - if($info->site_srl && $info->site_srl != $args->site_srl) return new BaseObject(-1,'msg_already_registed_domain'); |
|
| 314 | - if(isSiteID($args->domain) && $oModuleModel->isIDExists($args->domain)) return new BaseObject(-1,'msg_already_registed_vid'); |
|
| 313 | + if ($info->site_srl && $info->site_srl != $args->site_srl) return new BaseObject(-1, 'msg_already_registed_domain'); |
|
| 314 | + if (isSiteID($args->domain) && $oModuleModel->isIDExists($args->domain)) return new BaseObject(-1, 'msg_already_registed_vid'); |
|
| 315 | 315 | |
| 316 | - if($args->domain && !isSiteID($args->domain)) |
|
| 316 | + if ($args->domain && !isSiteID($args->domain)) |
|
| 317 | 317 | { |
| 318 | 318 | $args->domain = (strlen($args->domain) >= 1 && substr_compare($args->domain, '/', -1) === 0) ? substr($args->domain, 0, -1) : $args->domain; |
| 319 | 319 | } |
| 320 | 320 | } |
| 321 | 321 | $output = executeQuery('module.updateSite', $args); |
| 322 | 322 | //clear cache for default mid |
| 323 | - if($args->site_srl == 0) $vid=''; |
|
| 324 | - else $vid=$args->domain; |
|
| 323 | + if ($args->site_srl == 0) $vid = ''; |
|
| 324 | + else $vid = $args->domain; |
|
| 325 | 325 | |
| 326 | 326 | $module_info = $oModuleModel->getModuleInfoByModuleSrl($args->index_module_srl); |
| 327 | 327 | $mid = $module_info->mid; |
| 328 | 328 | |
| 329 | 329 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
| 330 | - if($oCacheHandler->isSupport()) |
|
| 330 | + if ($oCacheHandler->isSupport()) |
|
| 331 | 331 | { |
| 332 | 332 | $oCacheHandler->invalidateGroupKey('site_and_module'); |
| 333 | 333 | } |
@@ -345,7 +345,7 @@ discard block |
||
| 345 | 345 | unset($args->act); |
| 346 | 346 | unset($args->page); |
| 347 | 347 | // Test mid value |
| 348 | - if(!preg_match("/^[a-z][a-z0-9_]+$/i", $args->mid)) return new BaseObject(-1, 'msg_limit_mid'); |
|
| 348 | + if (!preg_match("/^[a-z][a-z0-9_]+$/i", $args->mid)) return new BaseObject(-1, 'msg_limit_mid'); |
|
| 349 | 349 | // Test variables (separate basic vars and other vars in modules) |
| 350 | 350 | $extra_vars = clone($args); |
| 351 | 351 | unset($extra_vars->module_srl); |
@@ -379,7 +379,7 @@ discard block |
||
| 379 | 379 | */ |
| 380 | 380 | function insertModule($args) |
| 381 | 381 | { |
| 382 | - if(isset($args->isMenuCreate)) |
|
| 382 | + if (isset($args->isMenuCreate)) |
|
| 383 | 383 | { |
| 384 | 384 | $isMenuCreate = $args->isMenuCreate; |
| 385 | 385 | } |
@@ -389,11 +389,11 @@ discard block |
||
| 389 | 389 | } |
| 390 | 390 | |
| 391 | 391 | $output = $this->arrangeModuleInfo($args, $extra_vars); |
| 392 | - if(!$output->toBool()) return $output; |
|
| 392 | + if (!$output->toBool()) return $output; |
|
| 393 | 393 | // Check whether the module name already exists |
| 394 | - if(!$args->site_srl) $args->site_srl = 0; |
|
| 394 | + if (!$args->site_srl) $args->site_srl = 0; |
|
| 395 | 395 | $oModuleModel = getModel('module'); |
| 396 | - if($oModuleModel->isIDExists($args->mid, $args->site_srl)) return new BaseObject(-1, 'msg_module_name_exists'); |
|
| 396 | + if ($oModuleModel->isIDExists($args->mid, $args->site_srl)) return new BaseObject(-1, 'msg_module_name_exists'); |
|
| 397 | 397 | |
| 398 | 398 | // begin transaction |
| 399 | 399 | $oDB = &DB::getInstance(); |
@@ -404,16 +404,16 @@ discard block |
||
| 404 | 404 | $skin_vars = new stdClass(); |
| 405 | 405 | $skin_vars->colorset = $skin_info->colorset[0]->name; |
| 406 | 406 | // Arrange variables and then execute a query |
| 407 | - if(!$args->module_srl) $args->module_srl = getNextSequence(); |
|
| 407 | + if (!$args->module_srl) $args->module_srl = getNextSequence(); |
|
| 408 | 408 | |
| 409 | 409 | // default value |
| 410 | - if($args->skin == '/USE_DEFAULT/') |
|
| 410 | + if ($args->skin == '/USE_DEFAULT/') |
|
| 411 | 411 | { |
| 412 | 412 | $args->is_skin_fix = 'N'; |
| 413 | 413 | } |
| 414 | 414 | else |
| 415 | 415 | { |
| 416 | - if(isset($args->is_skin_fix)) |
|
| 416 | + if (isset($args->is_skin_fix)) |
|
| 417 | 417 | { |
| 418 | 418 | $args->is_skin_fix = ($args->is_skin_fix != 'Y') ? 'N' : 'Y'; |
| 419 | 419 | } |
@@ -423,13 +423,13 @@ discard block |
||
| 423 | 423 | } |
| 424 | 424 | } |
| 425 | 425 | |
| 426 | - if($args->mskin == '/USE_DEFAULT/') |
|
| 426 | + if ($args->mskin == '/USE_DEFAULT/') |
|
| 427 | 427 | { |
| 428 | 428 | $args->is_mskin_fix = 'N'; |
| 429 | 429 | } |
| 430 | 430 | else |
| 431 | 431 | { |
| 432 | - if(isset($args->is_mskin_fix)) |
|
| 432 | + if (isset($args->is_mskin_fix)) |
|
| 433 | 433 | { |
| 434 | 434 | $args->is_mskin_fix = ($args->is_mskin_fix != 'Y') ? 'N' : 'Y'; |
| 435 | 435 | } |
@@ -443,14 +443,14 @@ discard block |
||
| 443 | 443 | |
| 444 | 444 | $args->browser_title = strip_tags($args->browser_title); |
| 445 | 445 | |
| 446 | - if($isMenuCreate === TRUE) |
|
| 446 | + if ($isMenuCreate === TRUE) |
|
| 447 | 447 | { |
| 448 | 448 | $menuArgs = new stdClass; |
| 449 | 449 | $menuArgs->menu_srl = $args->menu_srl; |
| 450 | 450 | $menuOutput = executeQuery('menu.getMenu', $menuArgs); |
| 451 | 451 | |
| 452 | 452 | // if menu is not created, create menu also. and does not supported that in virtual site. |
| 453 | - if(!$menuOutput->data && !$args->site_srl) |
|
| 453 | + if (!$menuOutput->data && !$args->site_srl) |
|
| 454 | 454 | { |
| 455 | 455 | $oMenuAdminModel = getAdminModel('menu'); |
| 456 | 456 | |
@@ -468,7 +468,7 @@ discard block |
||
| 468 | 468 | $menuArgs->listorder = $args->menu_item_srl * -1; |
| 469 | 469 | |
| 470 | 470 | $menuItemOutput = executeQuery('menu.insertMenuItem', $menuArgs); |
| 471 | - if(!$menuItemOutput->toBool()) |
|
| 471 | + if (!$menuItemOutput->toBool()) |
|
| 472 | 472 | { |
| 473 | 473 | $oDB->rollback(); |
| 474 | 474 | return $menuItemOutput; |
@@ -481,7 +481,7 @@ discard block |
||
| 481 | 481 | // Insert a module |
| 482 | 482 | $args->menu_srl = $menuArgs->menu_srl; |
| 483 | 483 | $output = executeQuery('module.insertModule', $args); |
| 484 | - if(!$output->toBool()) |
|
| 484 | + if (!$output->toBool()) |
|
| 485 | 485 | { |
| 486 | 486 | $oDB->rollback(); |
| 487 | 487 | return $output; |
@@ -493,12 +493,12 @@ discard block |
||
| 493 | 493 | $oDB->commit(); |
| 494 | 494 | |
| 495 | 495 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
| 496 | - if($oCacheHandler->isSupport()) |
|
| 496 | + if ($oCacheHandler->isSupport()) |
|
| 497 | 497 | { |
| 498 | 498 | $oCacheHandler->invalidateGroupKey('site_and_module'); |
| 499 | 499 | } |
| 500 | 500 | |
| 501 | - $output->add('module_srl',$args->module_srl); |
|
| 501 | + $output->add('module_srl', $args->module_srl); |
|
| 502 | 502 | return $output; |
| 503 | 503 | } |
| 504 | 504 | |
@@ -507,7 +507,7 @@ discard block |
||
| 507 | 507 | */ |
| 508 | 508 | function updateModule($args) |
| 509 | 509 | { |
| 510 | - if(isset($args->isMenuCreate)) |
|
| 510 | + if (isset($args->isMenuCreate)) |
|
| 511 | 511 | { |
| 512 | 512 | $isMenuCreate = $args->isMenuCreate; |
| 513 | 513 | } |
@@ -517,7 +517,7 @@ discard block |
||
| 517 | 517 | } |
| 518 | 518 | |
| 519 | 519 | $output = $this->arrangeModuleInfo($args, $extra_vars); |
| 520 | - if(!$output->toBool()) return $output; |
|
| 520 | + if (!$output->toBool()) return $output; |
|
| 521 | 521 | // begin transaction |
| 522 | 522 | $oDB = &DB::getInstance(); |
| 523 | 523 | $oDB->begin(); |
@@ -526,29 +526,29 @@ discard block |
||
| 526 | 526 | $columnList = array('module_srl', 'site_srl', 'browser_title', 'mid'); |
| 527 | 527 | $module_info = $oModuleModel->getModuleInfoByModuleSrl($args->module_srl); |
| 528 | 528 | |
| 529 | - if(!$args->site_srl || !$args->browser_title) |
|
| 529 | + if (!$args->site_srl || !$args->browser_title) |
|
| 530 | 530 | { |
| 531 | - if(!$args->site_srl) $args->site_srl = (int)$module_info->site_srl; |
|
| 532 | - if(!$args->browser_title) $args->browser_title = $module_info->browser_title; |
|
| 531 | + if (!$args->site_srl) $args->site_srl = (int) $module_info->site_srl; |
|
| 532 | + if (!$args->browser_title) $args->browser_title = $module_info->browser_title; |
|
| 533 | 533 | } |
| 534 | 534 | |
| 535 | 535 | $args->browser_title = strip_tags($args->browser_title); |
| 536 | 536 | |
| 537 | 537 | $output = executeQuery('module.isExistsModuleName', $args); |
| 538 | - if(!$output->toBool() || $output->data->count) |
|
| 538 | + if (!$output->toBool() || $output->data->count) |
|
| 539 | 539 | { |
| 540 | 540 | $oDB->rollback(); |
| 541 | 541 | return new BaseObject(-1, 'msg_module_name_exists'); |
| 542 | 542 | } |
| 543 | 543 | |
| 544 | 544 | // default value |
| 545 | - if($args->skin == '/USE_DEFAULT/') |
|
| 545 | + if ($args->skin == '/USE_DEFAULT/') |
|
| 546 | 546 | { |
| 547 | 547 | $args->is_skin_fix = 'N'; |
| 548 | 548 | } |
| 549 | 549 | else |
| 550 | 550 | { |
| 551 | - if(isset($args->is_skin_fix)) |
|
| 551 | + if (isset($args->is_skin_fix)) |
|
| 552 | 552 | { |
| 553 | 553 | $args->is_skin_fix = ($args->is_skin_fix != 'Y') ? 'N' : 'Y'; |
| 554 | 554 | } |
@@ -558,13 +558,13 @@ discard block |
||
| 558 | 558 | } |
| 559 | 559 | } |
| 560 | 560 | |
| 561 | - if($args->mskin == '/USE_DEFAULT/') |
|
| 561 | + if ($args->mskin == '/USE_DEFAULT/') |
|
| 562 | 562 | { |
| 563 | 563 | $args->is_mskin_fix = 'N'; |
| 564 | 564 | } |
| 565 | 565 | else |
| 566 | 566 | { |
| 567 | - if(isset($args->is_mskin_fix)) |
|
| 567 | + if (isset($args->is_mskin_fix)) |
|
| 568 | 568 | { |
| 569 | 569 | $args->is_mskin_fix = ($args->is_mskin_fix != 'Y') ? 'N' : 'Y'; |
| 570 | 570 | } |
@@ -574,27 +574,27 @@ discard block |
||
| 574 | 574 | } |
| 575 | 575 | } |
| 576 | 576 | $output = executeQuery('module.updateModule', $args); |
| 577 | - if(!$output->toBool()) |
|
| 577 | + if (!$output->toBool()) |
|
| 578 | 578 | { |
| 579 | 579 | $oDB->rollback(); |
| 580 | 580 | return $output; |
| 581 | 581 | } |
| 582 | 582 | |
| 583 | - if($isMenuCreate === TRUE) |
|
| 583 | + if ($isMenuCreate === TRUE) |
|
| 584 | 584 | { |
| 585 | 585 | $menuArgs = new stdClass; |
| 586 | 586 | $menuArgs->url = $module_info->mid; |
| 587 | 587 | $menuArgs->site_srl = $module_info->site_srl; |
| 588 | 588 | $menuOutput = executeQueryArray('menu.getMenuItemByUrl', $menuArgs); |
| 589 | - if($menuOutput->data && count($menuOutput->data)) |
|
| 589 | + if ($menuOutput->data && count($menuOutput->data)) |
|
| 590 | 590 | { |
| 591 | 591 | $oMenuAdminController = getAdminController('menu'); |
| 592 | - foreach($menuOutput->data as $itemInfo) |
|
| 592 | + foreach ($menuOutput->data as $itemInfo) |
|
| 593 | 593 | { |
| 594 | 594 | $itemInfo->url = $args->mid; |
| 595 | 595 | |
| 596 | 596 | $updateMenuItemOutput = $oMenuAdminController->updateMenuItem($itemInfo); |
| 597 | - if(!$updateMenuItemOutput->toBool()) |
|
| 597 | + if (!$updateMenuItemOutput->toBool()) |
|
| 598 | 598 | { |
| 599 | 599 | $oDB->rollback(); |
| 600 | 600 | return $updateMenuItemOutput; |
@@ -604,7 +604,7 @@ discard block |
||
| 604 | 604 | } |
| 605 | 605 | |
| 606 | 606 | // if mid changed, change mid of success_return_url to new mid |
| 607 | - if($module_info->mid != $args->mid && Context::get('success_return_url')) |
|
| 607 | + if ($module_info->mid != $args->mid && Context::get('success_return_url')) |
|
| 608 | 608 | { |
| 609 | 609 | changeValueInUrl('mid', $args->mid, $module_info->mid); |
| 610 | 610 | } |
@@ -614,11 +614,11 @@ discard block |
||
| 614 | 614 | |
| 615 | 615 | $oDB->commit(); |
| 616 | 616 | |
| 617 | - $output->add('module_srl',$args->module_srl); |
|
| 617 | + $output->add('module_srl', $args->module_srl); |
|
| 618 | 618 | |
| 619 | 619 | //remove from cache |
| 620 | 620 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
| 621 | - if($oCacheHandler->isSupport()) |
|
| 621 | + if ($oCacheHandler->isSupport()) |
|
| 622 | 622 | { |
| 623 | 623 | $oCacheHandler->invalidateGroupKey('site_and_module'); |
| 624 | 624 | } |
@@ -637,7 +637,7 @@ discard block |
||
| 637 | 637 | $args->update_id = $update_id; |
| 638 | 638 | $output = executeQuery('module.insertModuleUpdateLog', $args); |
| 639 | 639 | |
| 640 | - if(!!$output->error) return false; |
|
| 640 | + if (!!$output->error) return false; |
|
| 641 | 641 | |
| 642 | 642 | return true; |
| 643 | 643 | } |
@@ -652,11 +652,11 @@ discard block |
||
| 652 | 652 | $args->site_srl = $site_srl; |
| 653 | 653 | $args->layout_srl = $layout_srl; |
| 654 | 654 | $output = executeQuery('module.updateModuleSite', $args); |
| 655 | - if(!$output->toBool()) return $output; |
|
| 655 | + if (!$output->toBool()) return $output; |
|
| 656 | 656 | |
| 657 | 657 | //remove from cache |
| 658 | 658 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
| 659 | - if($oCacheHandler->isSupport()) |
|
| 659 | + if ($oCacheHandler->isSupport()) |
|
| 660 | 660 | { |
| 661 | 661 | $oCacheHandler->invalidateGroupKey('site_and_module'); |
| 662 | 662 | } |
@@ -671,7 +671,7 @@ discard block |
||
| 671 | 671 | */ |
| 672 | 672 | function deleteModule($module_srl, $site_srl = 0) |
| 673 | 673 | { |
| 674 | - if(!$module_srl) return new BaseObject(-1,'msg_invalid_request'); |
|
| 674 | + if (!$module_srl) return new BaseObject(-1, 'msg_invalid_request'); |
|
| 675 | 675 | |
| 676 | 676 | $site_module_info = Context::get('site_module_info'); |
| 677 | 677 | |
@@ -681,7 +681,7 @@ discard block |
||
| 681 | 681 | $args = new stdClass(); |
| 682 | 682 | $args->url = $output->mid; |
| 683 | 683 | $args->is_shortcut = 'N'; |
| 684 | - if(!$site_srl) $args->site_srl = $site_module_info->site_srl; |
|
| 684 | + if (!$site_srl) $args->site_srl = $site_module_info->site_srl; |
|
| 685 | 685 | else $args->site_srl = $site_srl; |
| 686 | 686 | |
| 687 | 687 | unset($output); |
@@ -690,9 +690,9 @@ discard block |
||
| 690 | 690 | $menuOutput = $oMenuAdminModel->getMenuList($args); |
| 691 | 691 | |
| 692 | 692 | // get menu_srl by site_srl |
| 693 | - if(is_array($menuOutput->data)) |
|
| 693 | + if (is_array($menuOutput->data)) |
|
| 694 | 694 | { |
| 695 | - foreach($menuOutput->data AS $key=>$value) |
|
| 695 | + foreach ($menuOutput->data AS $key=>$value) |
|
| 696 | 696 | { |
| 697 | 697 | $args->menu_srl = $value->menu_srl; |
| 698 | 698 | break; |
@@ -701,7 +701,7 @@ discard block |
||
| 701 | 701 | |
| 702 | 702 | $output = executeQuery('menu.getMenuItemByUrl', $args); |
| 703 | 703 | // menu delete |
| 704 | - if($output->data) |
|
| 704 | + if ($output->data) |
|
| 705 | 705 | { |
| 706 | 706 | unset($args); |
| 707 | 707 | $args = new stdClass; |
@@ -712,7 +712,7 @@ discard block |
||
| 712 | 712 | $oMenuAdminController = getAdminController('menu'); |
| 713 | 713 | $output = $oMenuAdminController->deleteItem($args); |
| 714 | 714 | |
| 715 | - if($output->isSuccess) |
|
| 715 | + if ($output->isSuccess) |
|
| 716 | 716 | { |
| 717 | 717 | return new BaseObject(0, 'success_deleted'); |
| 718 | 718 | } |
@@ -734,19 +734,19 @@ discard block |
||
| 734 | 734 | */ |
| 735 | 735 | public function onlyDeleteModule($module_srl) |
| 736 | 736 | { |
| 737 | - if(!$module_srl) return new BaseObject(-1,'msg_invalid_request'); |
|
| 737 | + if (!$module_srl) return new BaseObject(-1, 'msg_invalid_request'); |
|
| 738 | 738 | |
| 739 | 739 | // check start module |
| 740 | 740 | $oModuleModel = getModel('module'); |
| 741 | 741 | $columnList = array('sites.index_module_srl'); |
| 742 | 742 | $start_module = $oModuleModel->getSiteInfo(0, $columnList); |
| 743 | - if($module_srl == $start_module->index_module_srl) return new BaseObject(-1, 'msg_cannot_delete_startmodule'); |
|
| 743 | + if ($module_srl == $start_module->index_module_srl) return new BaseObject(-1, 'msg_cannot_delete_startmodule'); |
|
| 744 | 744 | |
| 745 | 745 | // Call a trigger (before) |
| 746 | 746 | $trigger_obj = new stdClass(); |
| 747 | 747 | $trigger_obj->module_srl = $module_srl; |
| 748 | 748 | $output = ModuleHandler::triggerCall('module.deleteModule', 'before', $trigger_obj); |
| 749 | - if(!$output->toBool()) return $output; |
|
| 749 | + if (!$output->toBool()) return $output; |
|
| 750 | 750 | |
| 751 | 751 | // begin transaction |
| 752 | 752 | $oDB = &DB::getInstance(); |
@@ -756,7 +756,7 @@ discard block |
||
| 756 | 756 | $args->module_srl = $module_srl; |
| 757 | 757 | // Delete module information from the DB |
| 758 | 758 | $output = executeQuery('module.deleteModule', $args); |
| 759 | - if(!$output->toBool()) |
|
| 759 | + if (!$output->toBool()) |
|
| 760 | 760 | { |
| 761 | 761 | $oDB->rollback(); |
| 762 | 762 | return $output; |
@@ -770,10 +770,10 @@ discard block |
||
| 770 | 770 | // Remove the module manager |
| 771 | 771 | $this->deleteAdminId($module_srl); |
| 772 | 772 | // Call a trigger (after) |
| 773 | - if($output->toBool()) |
|
| 773 | + if ($output->toBool()) |
|
| 774 | 774 | { |
| 775 | 775 | $trigger_output = ModuleHandler::triggerCall('module.deleteModule', 'after', $trigger_obj); |
| 776 | - if(!$trigger_output->toBool()) |
|
| 776 | + if (!$trigger_output->toBool()) |
|
| 777 | 777 | { |
| 778 | 778 | $oDB->rollback(); |
| 779 | 779 | return $trigger_output; |
@@ -785,7 +785,7 @@ discard block |
||
| 785 | 785 | |
| 786 | 786 | //remove from cache |
| 787 | 787 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
| 788 | - if($oCacheHandler->isSupport()) |
|
| 788 | + if ($oCacheHandler->isSupport()) |
|
| 789 | 789 | { |
| 790 | 790 | $oCacheHandler->invalidateGroupKey('site_and_module'); |
| 791 | 791 | } |
@@ -807,10 +807,10 @@ discard block |
||
| 807 | 807 | function clearDefaultModule() |
| 808 | 808 | { |
| 809 | 809 | $output = executeQuery('module.clearDefaultModule'); |
| 810 | - if(!$output->toBool()) return $output; |
|
| 810 | + if (!$output->toBool()) return $output; |
|
| 811 | 811 | |
| 812 | 812 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
| 813 | - if($oCacheHandler->isSupport()) |
|
| 813 | + if ($oCacheHandler->isSupport()) |
|
| 814 | 814 | { |
| 815 | 815 | $oCacheHandler->invalidateGroupKey('site_and_module'); |
| 816 | 816 | } |
@@ -826,7 +826,7 @@ discard block |
||
| 826 | 826 | $output = executeQuery('module.updateModuleMenu', $args); |
| 827 | 827 | |
| 828 | 828 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
| 829 | - if($oCacheHandler->isSupport()) |
|
| 829 | + if ($oCacheHandler->isSupport()) |
|
| 830 | 830 | { |
| 831 | 831 | $oCacheHandler->invalidateGroupKey('site_and_module'); |
| 832 | 832 | } |
@@ -839,15 +839,15 @@ discard block |
||
| 839 | 839 | */ |
| 840 | 840 | function updateModuleLayout($layout_srl, $menu_srl_list) |
| 841 | 841 | { |
| 842 | - if(!count($menu_srl_list)) return; |
|
| 842 | + if (!count($menu_srl_list)) return; |
|
| 843 | 843 | |
| 844 | 844 | $args = new stdClass; |
| 845 | 845 | $args->layout_srl = $layout_srl; |
| 846 | - $args->menu_srls = implode(',',$menu_srl_list); |
|
| 846 | + $args->menu_srls = implode(',', $menu_srl_list); |
|
| 847 | 847 | $output = executeQuery('module.updateModuleLayout', $args); |
| 848 | 848 | |
| 849 | 849 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
| 850 | - if($oCacheHandler->isSupport()) |
|
| 850 | + if ($oCacheHandler->isSupport()) |
|
| 851 | 851 | { |
| 852 | 852 | $oCacheHandler->invalidateGroupKey('site_and_module'); |
| 853 | 853 | } |
@@ -866,37 +866,37 @@ discard block |
||
| 866 | 866 | |
| 867 | 867 | $output = executeQuery('module.deleteSiteAdmin', $args); |
| 868 | 868 | |
| 869 | - if(!$output->toBool()) return $output; |
|
| 869 | + if (!$output->toBool()) return $output; |
|
| 870 | 870 | // Get user id of an administrator |
| 871 | - if(!is_array($arr_admins) || !count($arr_admins)) return new BaseObject(); |
|
| 872 | - foreach($arr_admins as $key => $user_id) |
|
| 871 | + if (!is_array($arr_admins) || !count($arr_admins)) return new BaseObject(); |
|
| 872 | + foreach ($arr_admins as $key => $user_id) |
|
| 873 | 873 | { |
| 874 | - if(!trim($user_id)) continue; |
|
| 874 | + if (!trim($user_id)) continue; |
|
| 875 | 875 | $admins[] = trim($user_id); |
| 876 | 876 | } |
| 877 | - if(!count($admins)) return new BaseObject(); |
|
| 877 | + if (!count($admins)) return new BaseObject(); |
|
| 878 | 878 | |
| 879 | 879 | $oMemberModel = getModel('member'); |
| 880 | 880 | $member_config = $oMemberModel->getMemberConfig(); |
| 881 | - if($member_config->identifier == 'email_address') |
|
| 881 | + if ($member_config->identifier == 'email_address') |
|
| 882 | 882 | { |
| 883 | - $args->email_address = '\''.implode('\',\'',$admins).'\''; |
|
| 883 | + $args->email_address = '\''.implode('\',\'', $admins).'\''; |
|
| 884 | 884 | } |
| 885 | 885 | else |
| 886 | 886 | { |
| 887 | - $args->user_ids = '\''.implode('\',\'',$admins).'\''; |
|
| 887 | + $args->user_ids = '\''.implode('\',\'', $admins).'\''; |
|
| 888 | 888 | } |
| 889 | 889 | $output = executeQueryArray('module.getAdminSrls', $args); |
| 890 | - if(!$output->toBool()||!$output->data) return $output; |
|
| 890 | + if (!$output->toBool() || !$output->data) return $output; |
|
| 891 | 891 | |
| 892 | - foreach($output->data as $key => $val) |
|
| 892 | + foreach ($output->data as $key => $val) |
|
| 893 | 893 | { |
| 894 | 894 | unset($args); |
| 895 | 895 | $args = new stdClass; |
| 896 | 896 | $args->site_srl = $site_srl; |
| 897 | 897 | $args->member_srl = $val->member_srl; |
| 898 | 898 | $output = executeQueryArray('module.insertSiteAdmin', $args); |
| 899 | - if(!$output->toBool()) return $output; |
|
| 899 | + if (!$output->toBool()) return $output; |
|
| 900 | 900 | } |
| 901 | 901 | return new BaseObject(); |
| 902 | 902 | } |
@@ -909,12 +909,12 @@ discard block |
||
| 909 | 909 | $oMemberModel = getModel('member'); |
| 910 | 910 | $member_config = $oMemberModel->getMemberConfig(); |
| 911 | 911 | |
| 912 | - if($member_config->identifier == 'email_address') |
|
| 912 | + if ($member_config->identifier == 'email_address') |
|
| 913 | 913 | $member_info = $oMemberModel->getMemberInfoByEmailAddress($admin_id); |
| 914 | 914 | else |
| 915 | 915 | $member_info = $oMemberModel->getMemberInfoByUserID($admin_id); |
| 916 | 916 | |
| 917 | - if(!$member_info->member_srl) return; |
|
| 917 | + if (!$member_info->member_srl) return; |
|
| 918 | 918 | $args = new stdClass(); |
| 919 | 919 | $args->module_srl = $module_srl; |
| 920 | 920 | $args->member_srl = $member_info->member_srl; |
@@ -929,11 +929,11 @@ discard block |
||
| 929 | 929 | $args = new stdClass(); |
| 930 | 930 | $args->module_srl = $module_srl; |
| 931 | 931 | |
| 932 | - if($admin_id) |
|
| 932 | + if ($admin_id) |
|
| 933 | 933 | { |
| 934 | 934 | $oMemberModel = getModel('member'); |
| 935 | 935 | $member_info = $oMemberModel->getMemberInfoByUserID($admin_id); |
| 936 | - if($member_info->member_srl) $args->member_srl = $member_info->member_srl; |
|
| 936 | + if ($member_info->member_srl) $args->member_srl = $member_info->member_srl; |
|
| 937 | 937 | } |
| 938 | 938 | return executeQuery('module.deleteAdminId', $args); |
| 939 | 939 | } |
@@ -970,18 +970,18 @@ discard block |
||
| 970 | 970 | $oDB->begin(); |
| 971 | 971 | |
| 972 | 972 | $output = $this->_deleteModuleSkinVars($module_srl, $mode); |
| 973 | - if(!$output->toBool()) |
|
| 973 | + if (!$output->toBool()) |
|
| 974 | 974 | { |
| 975 | 975 | $oDB->rollback(); |
| 976 | 976 | return $output; |
| 977 | 977 | } |
| 978 | 978 | |
| 979 | 979 | getDestroyXeVars($obj); |
| 980 | - if(!$obj || !count($obj)) return new BaseObject(); |
|
| 980 | + if (!$obj || !count($obj)) return new BaseObject(); |
|
| 981 | 981 | |
| 982 | 982 | $args = new stdClass; |
| 983 | 983 | $args->module_srl = $module_srl; |
| 984 | - foreach($obj as $key => $val) |
|
| 984 | + foreach ($obj as $key => $val) |
|
| 985 | 985 | { |
| 986 | 986 | // #17927989 For an old board which used the old blog module |
| 987 | 987 | // it often saved menu item(stdClass) on the skin info column |
@@ -992,9 +992,9 @@ discard block |
||
| 992 | 992 | |
| 993 | 993 | $args->name = trim($key); |
| 994 | 994 | $args->value = trim($val); |
| 995 | - if(!$args->name || !$args->value) continue; |
|
| 995 | + if (!$args->name || !$args->value) continue; |
|
| 996 | 996 | |
| 997 | - if($mode === 'P') |
|
| 997 | + if ($mode === 'P') |
|
| 998 | 998 | { |
| 999 | 999 | $output = executeQuery('module.insertModuleSkinVars', $args); |
| 1000 | 1000 | } |
@@ -1002,7 +1002,7 @@ discard block |
||
| 1002 | 1002 | { |
| 1003 | 1003 | $output = executeQuery('module.insertModuleMobileSkinVars', $args); |
| 1004 | 1004 | } |
| 1005 | - if(!$output->toBool()) |
|
| 1005 | + if (!$output->toBool()) |
|
| 1006 | 1006 | { |
| 1007 | 1007 | return $output; |
| 1008 | 1008 | $oDB->rollback(); |
@@ -1041,7 +1041,7 @@ discard block |
||
| 1041 | 1041 | $args->module_srl = $module_srl; |
| 1042 | 1042 | $mode = $mode === 'P' ? 'P' : 'M'; |
| 1043 | 1043 | |
| 1044 | - if($mode === 'P') |
|
| 1044 | + if ($mode === 'P') |
|
| 1045 | 1045 | { |
| 1046 | 1046 | $object_key = 'module_skin_vars:'.$module_srl; |
| 1047 | 1047 | $query = 'module.deleteModuleSkinVars'; |
@@ -1055,7 +1055,7 @@ discard block |
||
| 1055 | 1055 | //remove from cache |
| 1056 | 1056 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
| 1057 | 1057 | $cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key); |
| 1058 | - if($oCacheHandler->isSupport()) |
|
| 1058 | + if ($oCacheHandler->isSupport()) |
|
| 1059 | 1059 | { |
| 1060 | 1060 | $oCacheHandler->delete($cache_key); |
| 1061 | 1061 | } |
@@ -1070,22 +1070,22 @@ discard block |
||
| 1070 | 1070 | { |
| 1071 | 1071 | $this->deleteModuleExtraVars($module_srl); |
| 1072 | 1072 | getDestroyXeVars($obj); |
| 1073 | - if(!$obj || !count($obj)) return; |
|
| 1073 | + if (!$obj || !count($obj)) return; |
|
| 1074 | 1074 | |
| 1075 | - foreach($obj as $key => $val) |
|
| 1075 | + foreach ($obj as $key => $val) |
|
| 1076 | 1076 | { |
| 1077 | - if(is_object($val) || is_array($val)) continue; |
|
| 1077 | + if (is_object($val) || is_array($val)) continue; |
|
| 1078 | 1078 | |
| 1079 | 1079 | $args = new stdClass(); |
| 1080 | 1080 | $args->module_srl = $module_srl; |
| 1081 | 1081 | $args->name = trim($key); |
| 1082 | 1082 | $args->value = trim($val); |
| 1083 | - if(!$args->name || !$args->value) continue; |
|
| 1083 | + if (!$args->name || !$args->value) continue; |
|
| 1084 | 1084 | $output = executeQuery('module.insertModuleExtraVars', $args); |
| 1085 | 1085 | } |
| 1086 | 1086 | |
| 1087 | 1087 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
| 1088 | - if($oCacheHandler->isSupport()) |
|
| 1088 | + if ($oCacheHandler->isSupport()) |
|
| 1089 | 1089 | { |
| 1090 | 1090 | $object_key = 'module_extra_vars:'.$module_srl; |
| 1091 | 1091 | $cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key); |
@@ -1104,7 +1104,7 @@ discard block |
||
| 1104 | 1104 | |
| 1105 | 1105 | //remove from cache |
| 1106 | 1106 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
| 1107 | - if($oCacheHandler->isSupport()) |
|
| 1107 | + if ($oCacheHandler->isSupport()) |
|
| 1108 | 1108 | { |
| 1109 | 1109 | $object_key = 'module_extra_vars:'.$module_srl; |
| 1110 | 1110 | $cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key); |
@@ -1120,19 +1120,19 @@ discard block |
||
| 1120 | 1120 | function insertModuleGrants($module_srl, $obj) |
| 1121 | 1121 | { |
| 1122 | 1122 | $this->deleteModuleGrants($module_srl); |
| 1123 | - if(!$obj || !count($obj)) return; |
|
| 1123 | + if (!$obj || !count($obj)) return; |
|
| 1124 | 1124 | |
| 1125 | - foreach($obj as $name => $val) |
|
| 1125 | + foreach ($obj as $name => $val) |
|
| 1126 | 1126 | { |
| 1127 | - if(!$val || !count($val)) continue; |
|
| 1127 | + if (!$val || !count($val)) continue; |
|
| 1128 | 1128 | |
| 1129 | - foreach($val as $group_srl) |
|
| 1129 | + foreach ($val as $group_srl) |
|
| 1130 | 1130 | { |
| 1131 | 1131 | $args = new stdClass(); |
| 1132 | 1132 | $args->module_srl = $module_srl; |
| 1133 | 1133 | $args->name = $name; |
| 1134 | 1134 | $args->group_srl = trim($group_srl); |
| 1135 | - if(!$args->name || !$args->group_srl) continue; |
|
| 1135 | + if (!$args->name || !$args->group_srl) continue; |
|
| 1136 | 1136 | executeQuery('module.insertModuleGrant', $args); |
| 1137 | 1137 | } |
| 1138 | 1138 | } |
@@ -1153,9 +1153,9 @@ discard block |
||
| 1153 | 1153 | */ |
| 1154 | 1154 | function replaceDefinedLangCode(&$output, $isReplaceLangCode = true) |
| 1155 | 1155 | { |
| 1156 | - if($isReplaceLangCode) |
|
| 1156 | + if ($isReplaceLangCode) |
|
| 1157 | 1157 | { |
| 1158 | - $output = preg_replace_callback('!\$user_lang->([a-z0-9\_]+)!is', array($this,'_replaceLangCode'), $output); |
|
| 1158 | + $output = preg_replace_callback('!\$user_lang->([a-z0-9\_]+)!is', array($this, '_replaceLangCode'), $output); |
|
| 1159 | 1159 | } |
| 1160 | 1160 | } |
| 1161 | 1161 | |
@@ -1164,29 +1164,29 @@ discard block |
||
| 1164 | 1164 | static $lang = false; |
| 1165 | 1165 | |
| 1166 | 1166 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
| 1167 | - if($lang === false && $oCacheHandler->isSupport()) |
|
| 1167 | + if ($lang === false && $oCacheHandler->isSupport()) |
|
| 1168 | 1168 | { |
| 1169 | 1169 | $site_module_info = Context::get('site_module_info'); |
| 1170 | - if(!$site_module_info) |
|
| 1170 | + if (!$site_module_info) |
|
| 1171 | 1171 | { |
| 1172 | 1172 | $oModuleModel = getModel('module'); |
| 1173 | 1173 | $site_module_info = $oModuleModel->getDefaultMid(); |
| 1174 | 1174 | Context::set('site_module_info', $site_module_info); |
| 1175 | 1175 | } |
| 1176 | 1176 | |
| 1177 | - $object_key = 'user_defined_langs:' . $site_module_info->site_srl . ':' . Context::getLangType(); |
|
| 1177 | + $object_key = 'user_defined_langs:'.$site_module_info->site_srl.':'.Context::getLangType(); |
|
| 1178 | 1178 | $cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key); |
| 1179 | 1179 | $lang = $oCacheHandler->get($cache_key); |
| 1180 | 1180 | |
| 1181 | - if($lang === false) { |
|
| 1181 | + if ($lang === false) { |
|
| 1182 | 1182 | $oModuleAdminController = getAdminController('module'); |
| 1183 | 1183 | $lang = $oModuleAdminController->makeCacheDefinedLangCode($site_module_info->site_srl); |
| 1184 | 1184 | } |
| 1185 | 1185 | } |
| 1186 | 1186 | |
| 1187 | - if(!Context::get($matches[1]) && $lang[$matches[1]]) return $lang[$matches[1]]; |
|
| 1187 | + if (!Context::get($matches[1]) && $lang[$matches[1]]) return $lang[$matches[1]]; |
|
| 1188 | 1188 | |
| 1189 | - return str_replace('$user_lang->','',$matches[0]); |
|
| 1189 | + return str_replace('$user_lang->', '', $matches[0]); |
|
| 1190 | 1190 | } |
| 1191 | 1191 | |
| 1192 | 1192 | |
@@ -1199,17 +1199,17 @@ discard block |
||
| 1199 | 1199 | if ($ajax) Context::setRequestMethod('JSON'); |
| 1200 | 1200 | |
| 1201 | 1201 | $logged_info = Context::get('logged_info'); |
| 1202 | - if($logged_info->is_admin !='Y' && !$logged_info->is_site_admin) return new BaseObject(-1, 'msg_not_permitted'); |
|
| 1202 | + if ($logged_info->is_admin != 'Y' && !$logged_info->is_site_admin) return new BaseObject(-1, 'msg_not_permitted'); |
|
| 1203 | 1203 | |
| 1204 | - $vars = Context::gets('addfile','filter'); |
|
| 1204 | + $vars = Context::gets('addfile', 'filter'); |
|
| 1205 | 1205 | $attributeNames = Context::get('attribute_name'); |
| 1206 | 1206 | $attributeValues = Context::get('attribute_value'); |
| 1207 | - if(is_array($attributeNames) && is_array($attributeValues) && count($attributeNames) == count($attributeValues)) |
|
| 1207 | + if (is_array($attributeNames) && is_array($attributeValues) && count($attributeNames) == count($attributeValues)) |
|
| 1208 | 1208 | { |
| 1209 | 1209 | $attributes = array(); |
| 1210 | - foreach($attributeNames as $no => $name) |
|
| 1210 | + foreach ($attributeNames as $no => $name) |
|
| 1211 | 1211 | { |
| 1212 | - if(empty($name)) |
|
| 1212 | + if (empty($name)) |
|
| 1213 | 1213 | { |
| 1214 | 1214 | continue; |
| 1215 | 1215 | } |
@@ -1221,16 +1221,16 @@ discard block |
||
| 1221 | 1221 | $vars->comment = $attributes; |
| 1222 | 1222 | $module_filebox_srl = Context::get('module_filebox_srl'); |
| 1223 | 1223 | |
| 1224 | - $ext = strtolower(substr(strrchr($vars->addfile['name'],'.'),1)); |
|
| 1224 | + $ext = strtolower(substr(strrchr($vars->addfile['name'], '.'), 1)); |
|
| 1225 | 1225 | $vars->ext = $ext; |
| 1226 | - if($vars->filter) $filter = explode(',',$vars->filter); |
|
| 1227 | - else $filter = array('jpg','jpeg','gif','png'); |
|
| 1228 | - if(!in_array($ext,$filter)) return new BaseObject(-1, 'msg_error_occured'); |
|
| 1226 | + if ($vars->filter) $filter = explode(',', $vars->filter); |
|
| 1227 | + else $filter = array('jpg', 'jpeg', 'gif', 'png'); |
|
| 1228 | + if (!in_array($ext, $filter)) return new BaseObject(-1, 'msg_error_occured'); |
|
| 1229 | 1229 | |
| 1230 | 1230 | $vars->member_srl = $logged_info->member_srl; |
| 1231 | 1231 | |
| 1232 | 1232 | // update |
| 1233 | - if($module_filebox_srl > 0) |
|
| 1233 | + if ($module_filebox_srl > 0) |
|
| 1234 | 1234 | { |
| 1235 | 1235 | $vars->module_filebox_srl = $module_filebox_srl; |
| 1236 | 1236 | $output = $this->updateModuleFileBox($vars); |
@@ -1238,10 +1238,10 @@ discard block |
||
| 1238 | 1238 | // insert |
| 1239 | 1239 | else |
| 1240 | 1240 | { |
| 1241 | - if(!Context::isUploaded()) return new BaseObject(-1, 'msg_error_occured'); |
|
| 1241 | + if (!Context::isUploaded()) return new BaseObject(-1, 'msg_error_occured'); |
|
| 1242 | 1242 | $addfile = Context::get('addfile'); |
| 1243 | - if(!is_uploaded_file($addfile['tmp_name'])) return new BaseObject(-1, 'msg_error_occured'); |
|
| 1244 | - if($vars->addfile['error'] != 0) return new BaseObject(-1, 'msg_error_occured'); |
|
| 1243 | + if (!is_uploaded_file($addfile['tmp_name'])) return new BaseObject(-1, 'msg_error_occured'); |
|
| 1244 | + if ($vars->addfile['error'] != 0) return new BaseObject(-1, 'msg_error_occured'); |
|
| 1245 | 1245 | $output = $this->insertModuleFileBox($vars); |
| 1246 | 1246 | } |
| 1247 | 1247 | |
@@ -1255,7 +1255,7 @@ discard block |
||
| 1255 | 1255 | } |
| 1256 | 1256 | else |
| 1257 | 1257 | { |
| 1258 | - if($output) $this->add('save_filename', $output->get('save_filename')); |
|
| 1258 | + if ($output) $this->add('save_filename', $output->get('save_filename')); |
|
| 1259 | 1259 | else $this->add('save_filename', ''); |
| 1260 | 1260 | } |
| 1261 | 1261 | } |
@@ -1267,7 +1267,7 @@ discard block |
||
| 1267 | 1267 | { |
| 1268 | 1268 | $args = new stdClass; |
| 1269 | 1269 | // have file |
| 1270 | - if($vars->addfile['tmp_name'] && is_uploaded_file($vars->addfile['tmp_name'])) |
|
| 1270 | + if ($vars->addfile['tmp_name'] && is_uploaded_file($vars->addfile['tmp_name'])) |
|
| 1271 | 1271 | { |
| 1272 | 1272 | $oModuleModel = getModel('module'); |
| 1273 | 1273 | $output = $oModuleModel->getModuleFileBox($vars->module_filebox_srl); |
@@ -1276,18 +1276,18 @@ discard block |
||
| 1276 | 1276 | $path = $oModuleModel->getModuleFileBoxPath($vars->module_filebox_srl); |
| 1277 | 1277 | FileHandler::makeDir($path); |
| 1278 | 1278 | |
| 1279 | - $save_filename = sprintf('%s%s.%s',$path, $vars->module_filebox_srl, $ext); |
|
| 1279 | + $save_filename = sprintf('%s%s.%s', $path, $vars->module_filebox_srl, $ext); |
|
| 1280 | 1280 | $tmp = $vars->addfile['tmp_name']; |
| 1281 | 1281 | |
| 1282 | 1282 | // Check uploaded file |
| 1283 | - if(!checkUploadedFile($tmp)) return false; |
|
| 1283 | + if (!checkUploadedFile($tmp)) return false; |
|
| 1284 | 1284 | |
| 1285 | - if(!@move_uploaded_file($tmp, $save_filename)) |
|
| 1285 | + if (!@move_uploaded_file($tmp, $save_filename)) |
|
| 1286 | 1286 | { |
| 1287 | 1287 | return false; |
| 1288 | 1288 | } |
| 1289 | 1289 | |
| 1290 | - $args->fileextension = strtolower(substr(strrchr($vars->addfile['name'],'.'),1)); |
|
| 1290 | + $args->fileextension = strtolower(substr(strrchr($vars->addfile['name'], '.'), 1)); |
|
| 1291 | 1291 | $args->filename = $save_filename; |
| 1292 | 1292 | $args->filesize = $vars->addfile['size']; |
| 1293 | 1293 | } |
@@ -1313,14 +1313,14 @@ discard block |
||
| 1313 | 1313 | $oModuleModel = getModel('module'); |
| 1314 | 1314 | $path = $oModuleModel->getModuleFileBoxPath($vars->module_filebox_srl); |
| 1315 | 1315 | FileHandler::makeDir($path); |
| 1316 | - $save_filename = sprintf('%s%s.%s',$path, $vars->module_filebox_srl, $vars->ext); |
|
| 1316 | + $save_filename = sprintf('%s%s.%s', $path, $vars->module_filebox_srl, $vars->ext); |
|
| 1317 | 1317 | $tmp = $vars->addfile['tmp_name']; |
| 1318 | 1318 | |
| 1319 | 1319 | // Check uploaded file |
| 1320 | - if(!checkUploadedFile($tmp)) return false; |
|
| 1320 | + if (!checkUploadedFile($tmp)) return false; |
|
| 1321 | 1321 | |
| 1322 | 1322 | // upload |
| 1323 | - if(!@move_uploaded_file($tmp, $save_filename)) |
|
| 1323 | + if (!@move_uploaded_file($tmp, $save_filename)) |
|
| 1324 | 1324 | { |
| 1325 | 1325 | return false; |
| 1326 | 1326 | } |
@@ -1331,7 +1331,7 @@ discard block |
||
| 1331 | 1331 | $args->member_srl = $vars->member_srl; |
| 1332 | 1332 | $args->comment = $vars->comment; |
| 1333 | 1333 | $args->filename = $save_filename; |
| 1334 | - $args->fileextension = strtolower(substr(strrchr($vars->addfile['name'],'.'),1)); |
|
| 1334 | + $args->fileextension = strtolower(substr(strrchr($vars->addfile['name'], '.'), 1)); |
|
| 1335 | 1335 | $args->filesize = $vars->addfile['size']; |
| 1336 | 1336 | |
| 1337 | 1337 | $output = executeQuery('module.insertModuleFileBox', $args); |
@@ -1346,14 +1346,14 @@ discard block |
||
| 1346 | 1346 | function procModuleFileBoxDelete() |
| 1347 | 1347 | { |
| 1348 | 1348 | $logged_info = Context::get('logged_info'); |
| 1349 | - if($logged_info->is_admin !='Y' && !$logged_info->is_site_admin) return new BaseObject(-1, 'msg_not_permitted'); |
|
| 1349 | + if ($logged_info->is_admin != 'Y' && !$logged_info->is_site_admin) return new BaseObject(-1, 'msg_not_permitted'); |
|
| 1350 | 1350 | |
| 1351 | 1351 | $module_filebox_srl = Context::get('module_filebox_srl'); |
| 1352 | - if(!$module_filebox_srl) return new BaseObject(-1, 'msg_invalid_request'); |
|
| 1352 | + if (!$module_filebox_srl) return new BaseObject(-1, 'msg_invalid_request'); |
|
| 1353 | 1353 | $vars = new stdClass(); |
| 1354 | 1354 | $vars->module_filebox_srl = $module_filebox_srl; |
| 1355 | 1355 | $output = $this->deleteModuleFileBox($vars); |
| 1356 | - if(!$output->toBool()) return $output; |
|
| 1356 | + if (!$output->toBool()) return $output; |
|
| 1357 | 1357 | } |
| 1358 | 1358 | |
| 1359 | 1359 | function deleteModuleFileBox($vars) |
@@ -1376,11 +1376,11 @@ discard block |
||
| 1376 | 1376 | $this->unlockTimeoutPassed(); |
| 1377 | 1377 | $args = new stdClass; |
| 1378 | 1378 | $args->lock_name = $lock_name; |
| 1379 | - if(!$timeout) $timeout = 60; |
|
| 1379 | + if (!$timeout) $timeout = 60; |
|
| 1380 | 1380 | $args->deadline = date("YmdHis", $_SERVER['REQUEST_TIME'] + $timeout); |
| 1381 | - if($member_srl) $args->member_srl = $member_srl; |
|
| 1381 | + if ($member_srl) $args->member_srl = $member_srl; |
|
| 1382 | 1382 | $output = executeQuery('module.insertLock', $args); |
| 1383 | - if($output->toBool()) |
|
| 1383 | + if ($output->toBool()) |
|
| 1384 | 1384 | { |
| 1385 | 1385 | $output->add('lock_name', $lock_name); |
| 1386 | 1386 | $output->add('deadline', $args->deadline); |
@@ -1409,7 +1409,7 @@ discard block |
||
| 1409 | 1409 | $output = executeQuery('module.updateModuleInSites', $args); |
| 1410 | 1410 | |
| 1411 | 1411 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
| 1412 | - if($oCacheHandler->isSupport()) |
|
| 1412 | + if ($oCacheHandler->isSupport()) |
|
| 1413 | 1413 | { |
| 1414 | 1414 | $oCacheHandler->invalidateGroupKey('site_and_module'); |
| 1415 | 1415 | } |
@@ -150,9 +150,15 @@ discard block |
||
| 150 | 150 | */ |
| 151 | 151 | function insertModuleExtend($parent_module, $extend_module, $type, $kind='') |
| 152 | 152 | { |
| 153 | - if($kind != 'admin') $kind = ''; |
|
| 154 | - if(!in_array($type,array('model','controller','view','api','mobile'))) return false; |
|
| 155 | - if(in_array($parent_module, array('module','addon','widget','layout'))) return false; |
|
| 153 | + if($kind != 'admin') { |
|
| 154 | + $kind = ''; |
|
| 155 | + } |
|
| 156 | + if(!in_array($type,array('model','controller','view','api','mobile'))) { |
|
| 157 | + return false; |
|
| 158 | + } |
|
| 159 | + if(in_array($parent_module, array('module','addon','widget','layout'))) { |
|
| 160 | + return false; |
|
| 161 | + } |
|
| 156 | 162 | |
| 157 | 163 | $cache_file = './files/config/module_extend.php'; |
| 158 | 164 | FileHandler::removeFile($cache_file); |
@@ -164,7 +170,9 @@ discard block |
||
| 164 | 170 | $args->kind = $kind; |
| 165 | 171 | |
| 166 | 172 | $output = executeQuery('module.getModuleExtendCount', $args); |
| 167 | - if($output->data->count>0) return false; |
|
| 173 | + if($output->data->count>0) { |
|
| 174 | + return false; |
|
| 175 | + } |
|
| 168 | 176 | |
| 169 | 177 | $output = executeQuery('module.insertModuleExtend', $args); |
| 170 | 178 | return $output; |
@@ -199,7 +207,9 @@ discard block |
||
| 199 | 207 | $oModuleModel = getModel('module'); |
| 200 | 208 | $origin_config = $oModuleModel->getModuleConfig($module, $site_srl); |
| 201 | 209 | |
| 202 | - if(!$origin_config) $origin_config = new stdClass; |
|
| 210 | + if(!$origin_config) { |
|
| 211 | + $origin_config = new stdClass; |
|
| 212 | + } |
|
| 203 | 213 | |
| 204 | 214 | foreach($config as $key => $val) |
| 205 | 215 | { |
@@ -221,7 +231,9 @@ discard block |
||
| 221 | 231 | $args->site_srl = $site_srl; |
| 222 | 232 | |
| 223 | 233 | $output = executeQuery('module.deleteModuleConfig', $args); |
| 224 | - if(!$output->toBool()) return $output; |
|
| 234 | + if(!$output->toBool()) { |
|
| 235 | + return $output; |
|
| 236 | + } |
|
| 225 | 237 | |
| 226 | 238 | $output = executeQuery('module.insertModuleConfig', $args); |
| 227 | 239 | |
@@ -246,7 +258,9 @@ discard block |
||
| 246 | 258 | $args->config = serialize($config); |
| 247 | 259 | |
| 248 | 260 | $output = executeQuery('module.deleteModulePartConfig', $args); |
| 249 | - if(!$output->toBool()) return $output; |
|
| 261 | + if(!$output->toBool()) { |
|
| 262 | + return $output; |
|
| 263 | + } |
|
| 250 | 264 | |
| 251 | 265 | $output = executeQuery('module.insertModulePartConfig', $args); |
| 252 | 266 | |
@@ -268,9 +282,10 @@ discard block |
||
| 268 | 282 | if(isSiteID($domain)) |
| 269 | 283 | { |
| 270 | 284 | $oModuleModel = getModel('module'); |
| 271 | - if($oModuleModel->isIDExists($domain, 0)) return new BaseObject(-1,'msg_already_registed_vid'); |
|
| 272 | - } |
|
| 273 | - else |
|
| 285 | + if($oModuleModel->isIDExists($domain, 0)) { |
|
| 286 | + return new BaseObject(-1,'msg_already_registed_vid'); |
|
| 287 | + } |
|
| 288 | + } else |
|
| 274 | 289 | { |
| 275 | 290 | $domain = strtolower($domain); |
| 276 | 291 | } |
@@ -284,10 +299,14 @@ discard block |
||
| 284 | 299 | $columnList = array('modules.site_srl'); |
| 285 | 300 | $oModuleModel = getModel('module'); |
| 286 | 301 | $output = $oModuleModel->getSiteInfoByDomain($args->domain, $columnList); |
| 287 | - if($output) return new BaseObject(-1,'msg_already_registed_vid'); |
|
| 302 | + if($output) { |
|
| 303 | + return new BaseObject(-1,'msg_already_registed_vid'); |
|
| 304 | + } |
|
| 288 | 305 | |
| 289 | 306 | $output = executeQuery('module.insertSite', $args); |
| 290 | - if(!$output->toBool()) return $output; |
|
| 307 | + if(!$output->toBool()) { |
|
| 308 | + return $output; |
|
| 309 | + } |
|
| 291 | 310 | |
| 292 | 311 | $output->add('site_srl', $args->site_srl); |
| 293 | 312 | return $output; |
@@ -310,8 +329,12 @@ discard block |
||
| 310 | 329 | if($site_info->domain != $args->domain) |
| 311 | 330 | { |
| 312 | 331 | $info = $oModuleModel->getSiteInfoByDomain($args->domain, $columnList); |
| 313 | - if($info->site_srl && $info->site_srl != $args->site_srl) return new BaseObject(-1,'msg_already_registed_domain'); |
|
| 314 | - if(isSiteID($args->domain) && $oModuleModel->isIDExists($args->domain)) return new BaseObject(-1,'msg_already_registed_vid'); |
|
| 332 | + if($info->site_srl && $info->site_srl != $args->site_srl) { |
|
| 333 | + return new BaseObject(-1,'msg_already_registed_domain'); |
|
| 334 | + } |
|
| 335 | + if(isSiteID($args->domain) && $oModuleModel->isIDExists($args->domain)) { |
|
| 336 | + return new BaseObject(-1,'msg_already_registed_vid'); |
|
| 337 | + } |
|
| 315 | 338 | |
| 316 | 339 | if($args->domain && !isSiteID($args->domain)) |
| 317 | 340 | { |
@@ -320,8 +343,11 @@ discard block |
||
| 320 | 343 | } |
| 321 | 344 | $output = executeQuery('module.updateSite', $args); |
| 322 | 345 | //clear cache for default mid |
| 323 | - if($args->site_srl == 0) $vid=''; |
|
| 324 | - else $vid=$args->domain; |
|
| 346 | + if($args->site_srl == 0) { |
|
| 347 | + $vid=''; |
|
| 348 | + } else { |
|
| 349 | + $vid=$args->domain; |
|
| 350 | + } |
|
| 325 | 351 | |
| 326 | 352 | $module_info = $oModuleModel->getModuleInfoByModuleSrl($args->index_module_srl); |
| 327 | 353 | $mid = $module_info->mid; |
@@ -345,7 +371,9 @@ discard block |
||
| 345 | 371 | unset($args->act); |
| 346 | 372 | unset($args->page); |
| 347 | 373 | // Test mid value |
| 348 | - if(!preg_match("/^[a-z][a-z0-9_]+$/i", $args->mid)) return new BaseObject(-1, 'msg_limit_mid'); |
|
| 374 | + if(!preg_match("/^[a-z][a-z0-9_]+$/i", $args->mid)) { |
|
| 375 | + return new BaseObject(-1, 'msg_limit_mid'); |
|
| 376 | + } |
|
| 349 | 377 | // Test variables (separate basic vars and other vars in modules) |
| 350 | 378 | $extra_vars = clone($args); |
| 351 | 379 | unset($extra_vars->module_srl); |
@@ -382,18 +410,23 @@ discard block |
||
| 382 | 410 | if(isset($args->isMenuCreate)) |
| 383 | 411 | { |
| 384 | 412 | $isMenuCreate = $args->isMenuCreate; |
| 385 | - } |
|
| 386 | - else |
|
| 413 | + } else |
|
| 387 | 414 | { |
| 388 | 415 | $isMenuCreate = TRUE; |
| 389 | 416 | } |
| 390 | 417 | |
| 391 | 418 | $output = $this->arrangeModuleInfo($args, $extra_vars); |
| 392 | - if(!$output->toBool()) return $output; |
|
| 419 | + if(!$output->toBool()) { |
|
| 420 | + return $output; |
|
| 421 | + } |
|
| 393 | 422 | // Check whether the module name already exists |
| 394 | - if(!$args->site_srl) $args->site_srl = 0; |
|
| 423 | + if(!$args->site_srl) { |
|
| 424 | + $args->site_srl = 0; |
|
| 425 | + } |
|
| 395 | 426 | $oModuleModel = getModel('module'); |
| 396 | - if($oModuleModel->isIDExists($args->mid, $args->site_srl)) return new BaseObject(-1, 'msg_module_name_exists'); |
|
| 427 | + if($oModuleModel->isIDExists($args->mid, $args->site_srl)) { |
|
| 428 | + return new BaseObject(-1, 'msg_module_name_exists'); |
|
| 429 | + } |
|
| 397 | 430 | |
| 398 | 431 | // begin transaction |
| 399 | 432 | $oDB = &DB::getInstance(); |
@@ -404,20 +437,20 @@ discard block |
||
| 404 | 437 | $skin_vars = new stdClass(); |
| 405 | 438 | $skin_vars->colorset = $skin_info->colorset[0]->name; |
| 406 | 439 | // Arrange variables and then execute a query |
| 407 | - if(!$args->module_srl) $args->module_srl = getNextSequence(); |
|
| 440 | + if(!$args->module_srl) { |
|
| 441 | + $args->module_srl = getNextSequence(); |
|
| 442 | + } |
|
| 408 | 443 | |
| 409 | 444 | // default value |
| 410 | 445 | if($args->skin == '/USE_DEFAULT/') |
| 411 | 446 | { |
| 412 | 447 | $args->is_skin_fix = 'N'; |
| 413 | - } |
|
| 414 | - else |
|
| 448 | + } else |
|
| 415 | 449 | { |
| 416 | 450 | if(isset($args->is_skin_fix)) |
| 417 | 451 | { |
| 418 | 452 | $args->is_skin_fix = ($args->is_skin_fix != 'Y') ? 'N' : 'Y'; |
| 419 | - } |
|
| 420 | - else |
|
| 453 | + } else |
|
| 421 | 454 | { |
| 422 | 455 | $args->is_skin_fix = 'Y'; |
| 423 | 456 | } |
@@ -426,14 +459,12 @@ discard block |
||
| 426 | 459 | if($args->mskin == '/USE_DEFAULT/') |
| 427 | 460 | { |
| 428 | 461 | $args->is_mskin_fix = 'N'; |
| 429 | - } |
|
| 430 | - else |
|
| 462 | + } else |
|
| 431 | 463 | { |
| 432 | 464 | if(isset($args->is_mskin_fix)) |
| 433 | 465 | { |
| 434 | 466 | $args->is_mskin_fix = ($args->is_mskin_fix != 'Y') ? 'N' : 'Y'; |
| 435 | - } |
|
| 436 | - else |
|
| 467 | + } else |
|
| 437 | 468 | { |
| 438 | 469 | $args->is_mskin_fix = 'Y'; |
| 439 | 470 | } |
@@ -510,14 +541,15 @@ discard block |
||
| 510 | 541 | if(isset($args->isMenuCreate)) |
| 511 | 542 | { |
| 512 | 543 | $isMenuCreate = $args->isMenuCreate; |
| 513 | - } |
|
| 514 | - else |
|
| 544 | + } else |
|
| 515 | 545 | { |
| 516 | 546 | $isMenuCreate = TRUE; |
| 517 | 547 | } |
| 518 | 548 | |
| 519 | 549 | $output = $this->arrangeModuleInfo($args, $extra_vars); |
| 520 | - if(!$output->toBool()) return $output; |
|
| 550 | + if(!$output->toBool()) { |
|
| 551 | + return $output; |
|
| 552 | + } |
|
| 521 | 553 | // begin transaction |
| 522 | 554 | $oDB = &DB::getInstance(); |
| 523 | 555 | $oDB->begin(); |
@@ -528,8 +560,12 @@ discard block |
||
| 528 | 560 | |
| 529 | 561 | if(!$args->site_srl || !$args->browser_title) |
| 530 | 562 | { |
| 531 | - if(!$args->site_srl) $args->site_srl = (int)$module_info->site_srl; |
|
| 532 | - if(!$args->browser_title) $args->browser_title = $module_info->browser_title; |
|
| 563 | + if(!$args->site_srl) { |
|
| 564 | + $args->site_srl = (int)$module_info->site_srl; |
|
| 565 | + } |
|
| 566 | + if(!$args->browser_title) { |
|
| 567 | + $args->browser_title = $module_info->browser_title; |
|
| 568 | + } |
|
| 533 | 569 | } |
| 534 | 570 | |
| 535 | 571 | $args->browser_title = strip_tags($args->browser_title); |
@@ -545,14 +581,12 @@ discard block |
||
| 545 | 581 | if($args->skin == '/USE_DEFAULT/') |
| 546 | 582 | { |
| 547 | 583 | $args->is_skin_fix = 'N'; |
| 548 | - } |
|
| 549 | - else |
|
| 584 | + } else |
|
| 550 | 585 | { |
| 551 | 586 | if(isset($args->is_skin_fix)) |
| 552 | 587 | { |
| 553 | 588 | $args->is_skin_fix = ($args->is_skin_fix != 'Y') ? 'N' : 'Y'; |
| 554 | - } |
|
| 555 | - else |
|
| 589 | + } else |
|
| 556 | 590 | { |
| 557 | 591 | $args->is_skin_fix = 'Y'; |
| 558 | 592 | } |
@@ -561,14 +595,12 @@ discard block |
||
| 561 | 595 | if($args->mskin == '/USE_DEFAULT/') |
| 562 | 596 | { |
| 563 | 597 | $args->is_mskin_fix = 'N'; |
| 564 | - } |
|
| 565 | - else |
|
| 598 | + } else |
|
| 566 | 599 | { |
| 567 | 600 | if(isset($args->is_mskin_fix)) |
| 568 | 601 | { |
| 569 | 602 | $args->is_mskin_fix = ($args->is_mskin_fix != 'Y') ? 'N' : 'Y'; |
| 570 | - } |
|
| 571 | - else |
|
| 603 | + } else |
|
| 572 | 604 | { |
| 573 | 605 | $args->is_mskin_fix = 'Y'; |
| 574 | 606 | } |
@@ -637,7 +669,9 @@ discard block |
||
| 637 | 669 | $args->update_id = $update_id; |
| 638 | 670 | $output = executeQuery('module.insertModuleUpdateLog', $args); |
| 639 | 671 | |
| 640 | - if(!!$output->error) return false; |
|
| 672 | + if(!!$output->error) { |
|
| 673 | + return false; |
|
| 674 | + } |
|
| 641 | 675 | |
| 642 | 676 | return true; |
| 643 | 677 | } |
@@ -652,7 +686,9 @@ discard block |
||
| 652 | 686 | $args->site_srl = $site_srl; |
| 653 | 687 | $args->layout_srl = $layout_srl; |
| 654 | 688 | $output = executeQuery('module.updateModuleSite', $args); |
| 655 | - if(!$output->toBool()) return $output; |
|
| 689 | + if(!$output->toBool()) { |
|
| 690 | + return $output; |
|
| 691 | + } |
|
| 656 | 692 | |
| 657 | 693 | //remove from cache |
| 658 | 694 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
@@ -671,7 +707,9 @@ discard block |
||
| 671 | 707 | */ |
| 672 | 708 | function deleteModule($module_srl, $site_srl = 0) |
| 673 | 709 | { |
| 674 | - if(!$module_srl) return new BaseObject(-1,'msg_invalid_request'); |
|
| 710 | + if(!$module_srl) { |
|
| 711 | + return new BaseObject(-1,'msg_invalid_request'); |
|
| 712 | + } |
|
| 675 | 713 | |
| 676 | 714 | $site_module_info = Context::get('site_module_info'); |
| 677 | 715 | |
@@ -681,8 +719,11 @@ discard block |
||
| 681 | 719 | $args = new stdClass(); |
| 682 | 720 | $args->url = $output->mid; |
| 683 | 721 | $args->is_shortcut = 'N'; |
| 684 | - if(!$site_srl) $args->site_srl = $site_module_info->site_srl; |
|
| 685 | - else $args->site_srl = $site_srl; |
|
| 722 | + if(!$site_srl) { |
|
| 723 | + $args->site_srl = $site_module_info->site_srl; |
|
| 724 | + } else { |
|
| 725 | + $args->site_srl = $site_srl; |
|
| 726 | + } |
|
| 686 | 727 | |
| 687 | 728 | unset($output); |
| 688 | 729 | |
@@ -715,8 +756,7 @@ discard block |
||
| 715 | 756 | if($output->isSuccess) |
| 716 | 757 | { |
| 717 | 758 | return new BaseObject(0, 'success_deleted'); |
| 718 | - } |
|
| 719 | - else |
|
| 759 | + } else |
|
| 720 | 760 | { |
| 721 | 761 | return new BaseObject($output->error, $output->message); |
| 722 | 762 | } |
@@ -734,19 +774,25 @@ discard block |
||
| 734 | 774 | */ |
| 735 | 775 | public function onlyDeleteModule($module_srl) |
| 736 | 776 | { |
| 737 | - if(!$module_srl) return new BaseObject(-1,'msg_invalid_request'); |
|
| 777 | + if(!$module_srl) { |
|
| 778 | + return new BaseObject(-1,'msg_invalid_request'); |
|
| 779 | + } |
|
| 738 | 780 | |
| 739 | 781 | // check start module |
| 740 | 782 | $oModuleModel = getModel('module'); |
| 741 | 783 | $columnList = array('sites.index_module_srl'); |
| 742 | 784 | $start_module = $oModuleModel->getSiteInfo(0, $columnList); |
| 743 | - if($module_srl == $start_module->index_module_srl) return new BaseObject(-1, 'msg_cannot_delete_startmodule'); |
|
| 785 | + if($module_srl == $start_module->index_module_srl) { |
|
| 786 | + return new BaseObject(-1, 'msg_cannot_delete_startmodule'); |
|
| 787 | + } |
|
| 744 | 788 | |
| 745 | 789 | // Call a trigger (before) |
| 746 | 790 | $trigger_obj = new stdClass(); |
| 747 | 791 | $trigger_obj->module_srl = $module_srl; |
| 748 | 792 | $output = ModuleHandler::triggerCall('module.deleteModule', 'before', $trigger_obj); |
| 749 | - if(!$output->toBool()) return $output; |
|
| 793 | + if(!$output->toBool()) { |
|
| 794 | + return $output; |
|
| 795 | + } |
|
| 750 | 796 | |
| 751 | 797 | // begin transaction |
| 752 | 798 | $oDB = &DB::getInstance(); |
@@ -807,7 +853,9 @@ discard block |
||
| 807 | 853 | function clearDefaultModule() |
| 808 | 854 | { |
| 809 | 855 | $output = executeQuery('module.clearDefaultModule'); |
| 810 | - if(!$output->toBool()) return $output; |
|
| 856 | + if(!$output->toBool()) { |
|
| 857 | + return $output; |
|
| 858 | + } |
|
| 811 | 859 | |
| 812 | 860 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
| 813 | 861 | if($oCacheHandler->isSupport()) |
@@ -839,7 +887,9 @@ discard block |
||
| 839 | 887 | */ |
| 840 | 888 | function updateModuleLayout($layout_srl, $menu_srl_list) |
| 841 | 889 | { |
| 842 | - if(!count($menu_srl_list)) return; |
|
| 890 | + if(!count($menu_srl_list)) { |
|
| 891 | + return; |
|
| 892 | + } |
|
| 843 | 893 | |
| 844 | 894 | $args = new stdClass; |
| 845 | 895 | $args->layout_srl = $layout_srl; |
@@ -866,28 +916,37 @@ discard block |
||
| 866 | 916 | |
| 867 | 917 | $output = executeQuery('module.deleteSiteAdmin', $args); |
| 868 | 918 | |
| 869 | - if(!$output->toBool()) return $output; |
|
| 919 | + if(!$output->toBool()) { |
|
| 920 | + return $output; |
|
| 921 | + } |
|
| 870 | 922 | // Get user id of an administrator |
| 871 | - if(!is_array($arr_admins) || !count($arr_admins)) return new BaseObject(); |
|
| 923 | + if(!is_array($arr_admins) || !count($arr_admins)) { |
|
| 924 | + return new BaseObject(); |
|
| 925 | + } |
|
| 872 | 926 | foreach($arr_admins as $key => $user_id) |
| 873 | 927 | { |
| 874 | - if(!trim($user_id)) continue; |
|
| 928 | + if(!trim($user_id)) { |
|
| 929 | + continue; |
|
| 930 | + } |
|
| 875 | 931 | $admins[] = trim($user_id); |
| 876 | 932 | } |
| 877 | - if(!count($admins)) return new BaseObject(); |
|
| 933 | + if(!count($admins)) { |
|
| 934 | + return new BaseObject(); |
|
| 935 | + } |
|
| 878 | 936 | |
| 879 | 937 | $oMemberModel = getModel('member'); |
| 880 | 938 | $member_config = $oMemberModel->getMemberConfig(); |
| 881 | 939 | if($member_config->identifier == 'email_address') |
| 882 | 940 | { |
| 883 | 941 | $args->email_address = '\''.implode('\',\'',$admins).'\''; |
| 884 | - } |
|
| 885 | - else |
|
| 942 | + } else |
|
| 886 | 943 | { |
| 887 | 944 | $args->user_ids = '\''.implode('\',\'',$admins).'\''; |
| 888 | 945 | } |
| 889 | 946 | $output = executeQueryArray('module.getAdminSrls', $args); |
| 890 | - if(!$output->toBool()||!$output->data) return $output; |
|
| 947 | + if(!$output->toBool()||!$output->data) { |
|
| 948 | + return $output; |
|
| 949 | + } |
|
| 891 | 950 | |
| 892 | 951 | foreach($output->data as $key => $val) |
| 893 | 952 | { |
@@ -896,7 +955,9 @@ discard block |
||
| 896 | 955 | $args->site_srl = $site_srl; |
| 897 | 956 | $args->member_srl = $val->member_srl; |
| 898 | 957 | $output = executeQueryArray('module.insertSiteAdmin', $args); |
| 899 | - if(!$output->toBool()) return $output; |
|
| 958 | + if(!$output->toBool()) { |
|
| 959 | + return $output; |
|
| 960 | + } |
|
| 900 | 961 | } |
| 901 | 962 | return new BaseObject(); |
| 902 | 963 | } |
@@ -909,12 +970,15 @@ discard block |
||
| 909 | 970 | $oMemberModel = getModel('member'); |
| 910 | 971 | $member_config = $oMemberModel->getMemberConfig(); |
| 911 | 972 | |
| 912 | - if($member_config->identifier == 'email_address') |
|
| 913 | - $member_info = $oMemberModel->getMemberInfoByEmailAddress($admin_id); |
|
| 914 | - else |
|
| 915 | - $member_info = $oMemberModel->getMemberInfoByUserID($admin_id); |
|
| 973 | + if($member_config->identifier == 'email_address') { |
|
| 974 | + $member_info = $oMemberModel->getMemberInfoByEmailAddress($admin_id); |
|
| 975 | + } else { |
|
| 976 | + $member_info = $oMemberModel->getMemberInfoByUserID($admin_id); |
|
| 977 | + } |
|
| 916 | 978 | |
| 917 | - if(!$member_info->member_srl) return; |
|
| 979 | + if(!$member_info->member_srl) { |
|
| 980 | + return; |
|
| 981 | + } |
|
| 918 | 982 | $args = new stdClass(); |
| 919 | 983 | $args->module_srl = $module_srl; |
| 920 | 984 | $args->member_srl = $member_info->member_srl; |
@@ -933,7 +997,9 @@ discard block |
||
| 933 | 997 | { |
| 934 | 998 | $oMemberModel = getModel('member'); |
| 935 | 999 | $member_info = $oMemberModel->getMemberInfoByUserID($admin_id); |
| 936 | - if($member_info->member_srl) $args->member_srl = $member_info->member_srl; |
|
| 1000 | + if($member_info->member_srl) { |
|
| 1001 | + $args->member_srl = $member_info->member_srl; |
|
| 1002 | + } |
|
| 937 | 1003 | } |
| 938 | 1004 | return executeQuery('module.deleteAdminId', $args); |
| 939 | 1005 | } |
@@ -977,7 +1043,9 @@ discard block |
||
| 977 | 1043 | } |
| 978 | 1044 | |
| 979 | 1045 | getDestroyXeVars($obj); |
| 980 | - if(!$obj || !count($obj)) return new BaseObject(); |
|
| 1046 | + if(!$obj || !count($obj)) { |
|
| 1047 | + return new BaseObject(); |
|
| 1048 | + } |
|
| 981 | 1049 | |
| 982 | 1050 | $args = new stdClass; |
| 983 | 1051 | $args->module_srl = $module_srl; |
@@ -987,18 +1055,23 @@ discard block |
||
| 987 | 1055 | // it often saved menu item(stdClass) on the skin info column |
| 988 | 1056 | // When updating the module on XE core 1.2.0 later versions, it occurs an error |
| 989 | 1057 | // fixed the error |
| 990 | - if (is_object($val)) continue; |
|
| 991 | - if (is_array($val)) $val = serialize($val); |
|
| 1058 | + if (is_object($val)) { |
|
| 1059 | + continue; |
|
| 1060 | + } |
|
| 1061 | + if (is_array($val)) { |
|
| 1062 | + $val = serialize($val); |
|
| 1063 | + } |
|
| 992 | 1064 | |
| 993 | 1065 | $args->name = trim($key); |
| 994 | 1066 | $args->value = trim($val); |
| 995 | - if(!$args->name || !$args->value) continue; |
|
| 1067 | + if(!$args->name || !$args->value) { |
|
| 1068 | + continue; |
|
| 1069 | + } |
|
| 996 | 1070 | |
| 997 | 1071 | if($mode === 'P') |
| 998 | 1072 | { |
| 999 | 1073 | $output = executeQuery('module.insertModuleSkinVars', $args); |
| 1000 | - } |
|
| 1001 | - else |
|
| 1074 | + } else |
|
| 1002 | 1075 | { |
| 1003 | 1076 | $output = executeQuery('module.insertModuleMobileSkinVars', $args); |
| 1004 | 1077 | } |
@@ -1045,8 +1118,7 @@ discard block |
||
| 1045 | 1118 | { |
| 1046 | 1119 | $object_key = 'module_skin_vars:'.$module_srl; |
| 1047 | 1120 | $query = 'module.deleteModuleSkinVars'; |
| 1048 | - } |
|
| 1049 | - else |
|
| 1121 | + } else |
|
| 1050 | 1122 | { |
| 1051 | 1123 | $object_key = 'module_mobile_skin_vars:'.$module_srl; |
| 1052 | 1124 | $query = 'module.deleteModuleMobileSkinVars'; |
@@ -1070,17 +1142,23 @@ discard block |
||
| 1070 | 1142 | { |
| 1071 | 1143 | $this->deleteModuleExtraVars($module_srl); |
| 1072 | 1144 | getDestroyXeVars($obj); |
| 1073 | - if(!$obj || !count($obj)) return; |
|
| 1145 | + if(!$obj || !count($obj)) { |
|
| 1146 | + return; |
|
| 1147 | + } |
|
| 1074 | 1148 | |
| 1075 | 1149 | foreach($obj as $key => $val) |
| 1076 | 1150 | { |
| 1077 | - if(is_object($val) || is_array($val)) continue; |
|
| 1151 | + if(is_object($val) || is_array($val)) { |
|
| 1152 | + continue; |
|
| 1153 | + } |
|
| 1078 | 1154 | |
| 1079 | 1155 | $args = new stdClass(); |
| 1080 | 1156 | $args->module_srl = $module_srl; |
| 1081 | 1157 | $args->name = trim($key); |
| 1082 | 1158 | $args->value = trim($val); |
| 1083 | - if(!$args->name || !$args->value) continue; |
|
| 1159 | + if(!$args->name || !$args->value) { |
|
| 1160 | + continue; |
|
| 1161 | + } |
|
| 1084 | 1162 | $output = executeQuery('module.insertModuleExtraVars', $args); |
| 1085 | 1163 | } |
| 1086 | 1164 | |
@@ -1120,11 +1198,15 @@ discard block |
||
| 1120 | 1198 | function insertModuleGrants($module_srl, $obj) |
| 1121 | 1199 | { |
| 1122 | 1200 | $this->deleteModuleGrants($module_srl); |
| 1123 | - if(!$obj || !count($obj)) return; |
|
| 1201 | + if(!$obj || !count($obj)) { |
|
| 1202 | + return; |
|
| 1203 | + } |
|
| 1124 | 1204 | |
| 1125 | 1205 | foreach($obj as $name => $val) |
| 1126 | 1206 | { |
| 1127 | - if(!$val || !count($val)) continue; |
|
| 1207 | + if(!$val || !count($val)) { |
|
| 1208 | + continue; |
|
| 1209 | + } |
|
| 1128 | 1210 | |
| 1129 | 1211 | foreach($val as $group_srl) |
| 1130 | 1212 | { |
@@ -1132,7 +1214,9 @@ discard block |
||
| 1132 | 1214 | $args->module_srl = $module_srl; |
| 1133 | 1215 | $args->name = $name; |
| 1134 | 1216 | $args->group_srl = trim($group_srl); |
| 1135 | - if(!$args->name || !$args->group_srl) continue; |
|
| 1217 | + if(!$args->name || !$args->group_srl) { |
|
| 1218 | + continue; |
|
| 1219 | + } |
|
| 1136 | 1220 | executeQuery('module.insertModuleGrant', $args); |
| 1137 | 1221 | } |
| 1138 | 1222 | } |
@@ -1184,7 +1268,9 @@ discard block |
||
| 1184 | 1268 | } |
| 1185 | 1269 | } |
| 1186 | 1270 | |
| 1187 | - if(!Context::get($matches[1]) && $lang[$matches[1]]) return $lang[$matches[1]]; |
|
| 1271 | + if(!Context::get($matches[1]) && $lang[$matches[1]]) { |
|
| 1272 | + return $lang[$matches[1]]; |
|
| 1273 | + } |
|
| 1188 | 1274 | |
| 1189 | 1275 | return str_replace('$user_lang->','',$matches[0]); |
| 1190 | 1276 | } |
@@ -1196,10 +1282,14 @@ discard block |
||
| 1196 | 1282 | function procModuleFileBoxAdd() |
| 1197 | 1283 | { |
| 1198 | 1284 | $ajax = Context::get('ajax'); |
| 1199 | - if ($ajax) Context::setRequestMethod('JSON'); |
|
| 1285 | + if ($ajax) { |
|
| 1286 | + Context::setRequestMethod('JSON'); |
|
| 1287 | + } |
|
| 1200 | 1288 | |
| 1201 | 1289 | $logged_info = Context::get('logged_info'); |
| 1202 | - if($logged_info->is_admin !='Y' && !$logged_info->is_site_admin) return new BaseObject(-1, 'msg_not_permitted'); |
|
| 1290 | + if($logged_info->is_admin !='Y' && !$logged_info->is_site_admin) { |
|
| 1291 | + return new BaseObject(-1, 'msg_not_permitted'); |
|
| 1292 | + } |
|
| 1203 | 1293 | |
| 1204 | 1294 | $vars = Context::gets('addfile','filter'); |
| 1205 | 1295 | $attributeNames = Context::get('attribute_name'); |
@@ -1223,9 +1313,14 @@ discard block |
||
| 1223 | 1313 | |
| 1224 | 1314 | $ext = strtolower(substr(strrchr($vars->addfile['name'],'.'),1)); |
| 1225 | 1315 | $vars->ext = $ext; |
| 1226 | - if($vars->filter) $filter = explode(',',$vars->filter); |
|
| 1227 | - else $filter = array('jpg','jpeg','gif','png'); |
|
| 1228 | - if(!in_array($ext,$filter)) return new BaseObject(-1, 'msg_error_occured'); |
|
| 1316 | + if($vars->filter) { |
|
| 1317 | + $filter = explode(',',$vars->filter); |
|
| 1318 | + } else { |
|
| 1319 | + $filter = array('jpg','jpeg','gif','png'); |
|
| 1320 | + } |
|
| 1321 | + if(!in_array($ext,$filter)) { |
|
| 1322 | + return new BaseObject(-1, 'msg_error_occured'); |
|
| 1323 | + } |
|
| 1229 | 1324 | |
| 1230 | 1325 | $vars->member_srl = $logged_info->member_srl; |
| 1231 | 1326 | |
@@ -1238,10 +1333,16 @@ discard block |
||
| 1238 | 1333 | // insert |
| 1239 | 1334 | else |
| 1240 | 1335 | { |
| 1241 | - if(!Context::isUploaded()) return new BaseObject(-1, 'msg_error_occured'); |
|
| 1336 | + if(!Context::isUploaded()) { |
|
| 1337 | + return new BaseObject(-1, 'msg_error_occured'); |
|
| 1338 | + } |
|
| 1242 | 1339 | $addfile = Context::get('addfile'); |
| 1243 | - if(!is_uploaded_file($addfile['tmp_name'])) return new BaseObject(-1, 'msg_error_occured'); |
|
| 1244 | - if($vars->addfile['error'] != 0) return new BaseObject(-1, 'msg_error_occured'); |
|
| 1340 | + if(!is_uploaded_file($addfile['tmp_name'])) { |
|
| 1341 | + return new BaseObject(-1, 'msg_error_occured'); |
|
| 1342 | + } |
|
| 1343 | + if($vars->addfile['error'] != 0) { |
|
| 1344 | + return new BaseObject(-1, 'msg_error_occured'); |
|
| 1345 | + } |
|
| 1245 | 1346 | $output = $this->insertModuleFileBox($vars); |
| 1246 | 1347 | } |
| 1247 | 1348 | |
@@ -1252,11 +1353,13 @@ discard block |
||
| 1252 | 1353 | $returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispModuleAdminFileBox'); |
| 1253 | 1354 | $this->setRedirectUrl($returnUrl); |
| 1254 | 1355 | return; |
| 1255 | - } |
|
| 1256 | - else |
|
| 1356 | + } else |
|
| 1257 | 1357 | { |
| 1258 | - if($output) $this->add('save_filename', $output->get('save_filename')); |
|
| 1259 | - else $this->add('save_filename', ''); |
|
| 1358 | + if($output) { |
|
| 1359 | + $this->add('save_filename', $output->get('save_filename')); |
|
| 1360 | + } else { |
|
| 1361 | + $this->add('save_filename', ''); |
|
| 1362 | + } |
|
| 1260 | 1363 | } |
| 1261 | 1364 | } |
| 1262 | 1365 | |
@@ -1280,7 +1383,9 @@ discard block |
||
| 1280 | 1383 | $tmp = $vars->addfile['tmp_name']; |
| 1281 | 1384 | |
| 1282 | 1385 | // Check uploaded file |
| 1283 | - if(!checkUploadedFile($tmp)) return false; |
|
| 1386 | + if(!checkUploadedFile($tmp)) { |
|
| 1387 | + return false; |
|
| 1388 | + } |
|
| 1284 | 1389 | |
| 1285 | 1390 | if(!@move_uploaded_file($tmp, $save_filename)) |
| 1286 | 1391 | { |
@@ -1317,7 +1422,9 @@ discard block |
||
| 1317 | 1422 | $tmp = $vars->addfile['tmp_name']; |
| 1318 | 1423 | |
| 1319 | 1424 | // Check uploaded file |
| 1320 | - if(!checkUploadedFile($tmp)) return false; |
|
| 1425 | + if(!checkUploadedFile($tmp)) { |
|
| 1426 | + return false; |
|
| 1427 | + } |
|
| 1321 | 1428 | |
| 1322 | 1429 | // upload |
| 1323 | 1430 | if(!@move_uploaded_file($tmp, $save_filename)) |
@@ -1346,14 +1453,20 @@ discard block |
||
| 1346 | 1453 | function procModuleFileBoxDelete() |
| 1347 | 1454 | { |
| 1348 | 1455 | $logged_info = Context::get('logged_info'); |
| 1349 | - if($logged_info->is_admin !='Y' && !$logged_info->is_site_admin) return new BaseObject(-1, 'msg_not_permitted'); |
|
| 1456 | + if($logged_info->is_admin !='Y' && !$logged_info->is_site_admin) { |
|
| 1457 | + return new BaseObject(-1, 'msg_not_permitted'); |
|
| 1458 | + } |
|
| 1350 | 1459 | |
| 1351 | 1460 | $module_filebox_srl = Context::get('module_filebox_srl'); |
| 1352 | - if(!$module_filebox_srl) return new BaseObject(-1, 'msg_invalid_request'); |
|
| 1461 | + if(!$module_filebox_srl) { |
|
| 1462 | + return new BaseObject(-1, 'msg_invalid_request'); |
|
| 1463 | + } |
|
| 1353 | 1464 | $vars = new stdClass(); |
| 1354 | 1465 | $vars->module_filebox_srl = $module_filebox_srl; |
| 1355 | 1466 | $output = $this->deleteModuleFileBox($vars); |
| 1356 | - if(!$output->toBool()) return $output; |
|
| 1467 | + if(!$output->toBool()) { |
|
| 1468 | + return $output; |
|
| 1469 | + } |
|
| 1357 | 1470 | } |
| 1358 | 1471 | |
| 1359 | 1472 | function deleteModuleFileBox($vars) |
@@ -1376,9 +1489,13 @@ discard block |
||
| 1376 | 1489 | $this->unlockTimeoutPassed(); |
| 1377 | 1490 | $args = new stdClass; |
| 1378 | 1491 | $args->lock_name = $lock_name; |
| 1379 | - if(!$timeout) $timeout = 60; |
|
| 1492 | + if(!$timeout) { |
|
| 1493 | + $timeout = 60; |
|
| 1494 | + } |
|
| 1380 | 1495 | $args->deadline = date("YmdHis", $_SERVER['REQUEST_TIME'] + $timeout); |
| 1381 | - if($member_srl) $args->member_srl = $member_srl; |
|
| 1496 | + if($member_srl) { |
|
| 1497 | + $args->member_srl = $member_srl; |
|
| 1498 | + } |
|
| 1382 | 1499 | $output = executeQuery('module.insertLock', $args); |
| 1383 | 1500 | if($output->toBool()) |
| 1384 | 1501 | { |