@@ -382,6 +382,9 @@ discard block |
||
| 382 | 382 | $this->setTemplateFile('layout_preview'); |
| 383 | 383 | } |
| 384 | 384 | |
| 385 | + /** |
|
| 386 | + * @return string |
|
| 387 | + */ |
|
| 385 | 388 | private function getRealLayoutFile($layoutSrl) |
| 386 | 389 | { |
| 387 | 390 | $oLayoutModel = getModel('layout'); |
@@ -398,6 +401,9 @@ discard block |
||
| 398 | 401 | |
| 399 | 402 | } |
| 400 | 403 | |
| 404 | + /** |
|
| 405 | + * @return string |
|
| 406 | + */ |
|
| 401 | 407 | private function getRealLayoutCSS($layoutSrl) |
| 402 | 408 | { |
| 403 | 409 | $oLayoutModel = getModel('layout'); |
@@ -25,7 +25,7 @@ discard block |
||
| 25 | 25 | // Get the layout information |
| 26 | 26 | $oLayoutModel = getModel('layout'); |
| 27 | 27 | $layout_info = $oLayoutModel->getLayoutInfo(Context::get('selected_layout')); |
| 28 | - if(!$layout_info) exit(); |
|
| 28 | + if (!$layout_info) exit(); |
|
| 29 | 29 | Context::set('layout_info', $layout_info); |
| 30 | 30 | // Set the layout to be pop-up |
| 31 | 31 | $this->setLayoutFile('popup_layout'); |
@@ -53,13 +53,13 @@ discard block |
||
| 53 | 53 | // admin check |
| 54 | 54 | // this act is admin view but in normal view because do not load admin css/js files |
| 55 | 55 | $logged_info = Context::get('logged_info'); |
| 56 | - if($logged_info->is_admin != 'Y') |
|
| 56 | + if ($logged_info->is_admin != 'Y') |
|
| 57 | 57 | { |
| 58 | 58 | throw new Exception(Context::getLang('msg_invalid_request')); |
| 59 | 59 | } |
| 60 | 60 | |
| 61 | 61 | // if module is 'ARTiCLE' and from site design setting, make content directly |
| 62 | - if($module == 'ARTICLE' && !$mid) |
|
| 62 | + if ($module == 'ARTICLE' && !$mid) |
|
| 63 | 63 | { |
| 64 | 64 | $oDocumentModel = getModel('document'); |
| 65 | 65 | $oDocument = $oDocumentModel->getDocument(0, true); |
@@ -67,12 +67,12 @@ discard block |
||
| 67 | 67 | $t = Context::getLang('article_preview_title'); |
| 68 | 68 | |
| 69 | 69 | $c = ''; |
| 70 | - for($i = 0; $i < 4; $i++) |
|
| 70 | + for ($i = 0; $i < 4; $i++) |
|
| 71 | 71 | { |
| 72 | 72 | $c .= '<p>'; |
| 73 | - for($j = 0; $j < 20; $j++) |
|
| 73 | + for ($j = 0; $j < 20; $j++) |
|
| 74 | 74 | { |
| 75 | - $c .= Context::getLang('article_preview_content') . ' '; |
|
| 75 | + $c .= Context::getLang('article_preview_content').' '; |
|
| 76 | 76 | } |
| 77 | 77 | $c .= '</p>'; |
| 78 | 78 | } |
@@ -87,12 +87,12 @@ discard block |
||
| 87 | 87 | |
| 88 | 88 | if ($skinType == 'M') |
| 89 | 89 | { |
| 90 | - $templatePath = _XE_PATH_ . 'modules/page/m.skins/' . $skin; |
|
| 90 | + $templatePath = _XE_PATH_.'modules/page/m.skins/'.$skin; |
|
| 91 | 91 | $templateFile = 'mobile'; |
| 92 | 92 | } |
| 93 | 93 | else |
| 94 | 94 | { |
| 95 | - $templatePath = _XE_PATH_ . 'modules/page/skins/' . $skin; |
|
| 95 | + $templatePath = _XE_PATH_.'modules/page/skins/'.$skin; |
|
| 96 | 96 | $templateFile = 'content'; |
| 97 | 97 | } |
| 98 | 98 | |
@@ -108,15 +108,15 @@ discard block |
||
| 108 | 108 | Context::set('content', $content); |
| 109 | 109 | |
| 110 | 110 | // find layout |
| 111 | - if($layoutSrl) |
|
| 111 | + if ($layoutSrl) |
|
| 112 | 112 | { |
| 113 | - if($layoutSrl == -1) |
|
| 113 | + if ($layoutSrl == -1) |
|
| 114 | 114 | { |
| 115 | 115 | $site_srl = ($oModule) ? $oModule->module_info->site_srl : 0; |
| 116 | - $designInfoFile = sprintf(_XE_PATH_ . 'files/site_design/design_%s.php', $site_srl); |
|
| 116 | + $designInfoFile = sprintf(_XE_PATH_.'files/site_design/design_%s.php', $site_srl); |
|
| 117 | 117 | include($designInfoFile); |
| 118 | 118 | |
| 119 | - if($skinType == 'M') |
|
| 119 | + if ($skinType == 'M') |
|
| 120 | 120 | { |
| 121 | 121 | $layoutSrl = $designInfo->mlayout_srl; |
| 122 | 122 | } |
@@ -130,21 +130,21 @@ discard block |
||
| 130 | 130 | $layoutInfo = $oLayoutModel->getLayout($layoutSrl); |
| 131 | 131 | |
| 132 | 132 | // If there is no layout, pass it. |
| 133 | - if($layoutInfo) |
|
| 133 | + if ($layoutInfo) |
|
| 134 | 134 | { |
| 135 | 135 | // Adhoc... |
| 136 | 136 | |
| 137 | 137 | // Input extra_vars into $layout_info |
| 138 | - if($layoutInfo->extra_var_count) |
|
| 138 | + if ($layoutInfo->extra_var_count) |
|
| 139 | 139 | { |
| 140 | 140 | |
| 141 | - foreach($layoutInfo->extra_var as $var_id => $val) |
|
| 141 | + foreach ($layoutInfo->extra_var as $var_id => $val) |
|
| 142 | 142 | { |
| 143 | - if($val->type == 'image') |
|
| 143 | + if ($val->type == 'image') |
|
| 144 | 144 | { |
| 145 | - if(strncmp('./files/attach/images/', $val->value, 22) === 0) |
|
| 145 | + if (strncmp('./files/attach/images/', $val->value, 22) === 0) |
|
| 146 | 146 | { |
| 147 | - $val->value = Context::getRequestUri() . substr($val->value, 2); |
|
| 147 | + $val->value = Context::getRequestUri().substr($val->value, 2); |
|
| 148 | 148 | } |
| 149 | 149 | } |
| 150 | 150 | $layoutInfo->{$var_id} = $val->value; |
@@ -152,25 +152,25 @@ discard block |
||
| 152 | 152 | } |
| 153 | 153 | |
| 154 | 154 | // Set menus into context |
| 155 | - if($layoutInfo->menu_count) |
|
| 155 | + if ($layoutInfo->menu_count) |
|
| 156 | 156 | { |
| 157 | - foreach($layoutInfo->menu as $menu_id => $menu) |
|
| 157 | + foreach ($layoutInfo->menu as $menu_id => $menu) |
|
| 158 | 158 | { |
| 159 | 159 | // set default menu set(included home menu) |
| 160 | - if(!$menu->menu_srl || $menu->menu_srl == -1) |
|
| 160 | + if (!$menu->menu_srl || $menu->menu_srl == -1) |
|
| 161 | 161 | { |
| 162 | 162 | $oMenuAdminController = getAdminController('menu'); |
| 163 | 163 | $homeMenuCacheFile = $oMenuAdminController->getHomeMenuCacheFile(); |
| 164 | 164 | |
| 165 | - if(file_exists($homeMenuCacheFile)) |
|
| 165 | + if (file_exists($homeMenuCacheFile)) |
|
| 166 | 166 | { |
| 167 | 167 | include($homeMenuCacheFile); |
| 168 | 168 | } |
| 169 | 169 | |
| 170 | - if(!$menu->menu_srl) |
|
| 170 | + if (!$menu->menu_srl) |
|
| 171 | 171 | { |
| 172 | - $menu->xml_file = str_replace('.xml.php', $homeMenuSrl . '.xml.php', $menu->xml_file); |
|
| 173 | - $menu->php_file = str_replace('.php', $homeMenuSrl . '.php', $menu->php_file); |
|
| 172 | + $menu->xml_file = str_replace('.xml.php', $homeMenuSrl.'.xml.php', $menu->xml_file); |
|
| 173 | + $menu->php_file = str_replace('.php', $homeMenuSrl.'.php', $menu->php_file); |
|
| 174 | 174 | $layoutInfo->menu->{$menu_id}->menu_srl = $homeMenuSrl; |
| 175 | 175 | } |
| 176 | 176 | else |
@@ -181,7 +181,7 @@ discard block |
||
| 181 | 181 | } |
| 182 | 182 | |
| 183 | 183 | $menu->php_file = FileHandler::getRealPath($menu->php_file); |
| 184 | - if(FileHandler::exists($menu->php_file)) |
|
| 184 | + if (FileHandler::exists($menu->php_file)) |
|
| 185 | 185 | { |
| 186 | 186 | include($menu->php_file); |
| 187 | 187 | } |
@@ -193,9 +193,9 @@ discard block |
||
| 193 | 193 | } |
| 194 | 194 | } |
| 195 | 195 | } |
| 196 | - catch(Exception $e) |
|
| 196 | + catch (Exception $e) |
|
| 197 | 197 | { |
| 198 | - $content = '<div class="message error"><p id="preview_error">' . $e->getMessage() . '</p></div>'; |
|
| 198 | + $content = '<div class="message error"><p id="preview_error">'.$e->getMessage().'</p></div>'; |
|
| 199 | 199 | Context::set('content', $content); |
| 200 | 200 | $layoutSrl = 0; |
| 201 | 201 | } |
@@ -204,12 +204,12 @@ discard block |
||
| 204 | 204 | $oTemplate = TemplateHandler::getInstance(); |
| 205 | 205 | Context::clearHtmlHeader(); |
| 206 | 206 | |
| 207 | - if($layoutInfo) |
|
| 207 | + if ($layoutInfo) |
|
| 208 | 208 | { |
| 209 | 209 | $layout_path = $layoutInfo->path; |
| 210 | 210 | $editLayoutTPL = $this->getRealLayoutFile($layoutSrl); |
| 211 | 211 | $editLayoutCSS = $this->getRealLayoutCSS($layoutSrl); |
| 212 | - if($editLayoutCSS != '') |
|
| 212 | + if ($editLayoutCSS != '') |
|
| 213 | 213 | { |
| 214 | 214 | Context::addCSSFile($editLayoutCSS); |
| 215 | 215 | } |
@@ -225,7 +225,7 @@ discard block |
||
| 225 | 225 | } |
| 226 | 226 | |
| 227 | 227 | $layout_tpl = $oTemplate->compile($layout_path, $layout_file, $editLayoutTPL); |
| 228 | - Context::set('layout','none'); |
|
| 228 | + Context::set('layout', 'none'); |
|
| 229 | 229 | |
| 230 | 230 | // Convert widgets and others |
| 231 | 231 | $oContext = Context::getInstance(); |
@@ -246,18 +246,18 @@ discard block |
||
| 246 | 246 | private function procRealModule($module, $mid, $skin, $skinType) |
| 247 | 247 | { |
| 248 | 248 | // if form site design and preview module, find target module |
| 249 | - if($module && !$mid) |
|
| 249 | + if ($module && !$mid) |
|
| 250 | 250 | { |
| 251 | 251 | $args = new stdClass(); |
| 252 | 252 | $args->module = $module; |
| 253 | 253 | $output = executeQuery('layout.getOneModuleInstanceByModuleName', $args); |
| 254 | - if(!$output->toBool()) |
|
| 254 | + if (!$output->toBool()) |
|
| 255 | 255 | { |
| 256 | 256 | throw new Exception($output->getMessage()); |
| 257 | 257 | } |
| 258 | 258 | |
| 259 | 259 | // if there is no module instance, error... |
| 260 | - if(!$output->data) |
|
| 260 | + if (!$output->data) |
|
| 261 | 261 | { |
| 262 | 262 | throw new Exception(Context::getLang('msg_unabled_preview')); |
| 263 | 263 | } |
@@ -266,7 +266,7 @@ discard block |
||
| 266 | 266 | } |
| 267 | 267 | |
| 268 | 268 | // if form site design and preview layout, find start module |
| 269 | - elseif(!$module && !$mid) |
|
| 269 | + elseif (!$module && !$mid) |
|
| 270 | 270 | { |
| 271 | 271 | $oModuleModel = getModel('module'); |
| 272 | 272 | $columnList = array('modules.mid', 'sites.index_module_srl'); |
@@ -286,7 +286,7 @@ discard block |
||
| 286 | 286 | $oModuleHandler->module_info->is_skin_fix = 'Y'; |
| 287 | 287 | $oModuleHandler->module_info->is_mskin_fix = 'Y'; |
| 288 | 288 | |
| 289 | - if($skinType == 'M') |
|
| 289 | + if ($skinType == 'M') |
|
| 290 | 290 | { |
| 291 | 291 | Mobile::setMobile(TRUE); |
| 292 | 292 | $oModuleHandler->module_info->mskin = $skin; |
@@ -299,13 +299,13 @@ discard block |
||
| 299 | 299 | |
| 300 | 300 | // Proc module |
| 301 | 301 | $oModule = $oModuleHandler->procModule(); |
| 302 | - if(!$oModule->toBool()) |
|
| 302 | + if (!$oModule->toBool()) |
|
| 303 | 303 | { |
| 304 | 304 | throw new Exception(Context::getLang('not_support_layout_preview')); |
| 305 | 305 | } |
| 306 | 306 | |
| 307 | 307 | // get module html |
| 308 | - require_once(_XE_PATH_ . "classes/display/HTMLDisplayHandler.php"); |
|
| 308 | + require_once(_XE_PATH_."classes/display/HTMLDisplayHandler.php"); |
|
| 309 | 309 | $handler = new HTMLDisplayHandler(); |
| 310 | 310 | return $handler->toDoc($oModule); |
| 311 | 311 | } |
@@ -316,7 +316,7 @@ discard block |
||
| 316 | 316 | */ |
| 317 | 317 | function dispLayoutPreview() |
| 318 | 318 | { |
| 319 | - if(!checkCSRF()) |
|
| 319 | + if (!checkCSRF()) |
|
| 320 | 320 | { |
| 321 | 321 | $this->stop('msg_invalid_request'); |
| 322 | 322 | return new BaseObject(-1, 'msg_invalid_request'); |
@@ -325,36 +325,36 @@ discard block |
||
| 325 | 325 | // admin check |
| 326 | 326 | // this act is admin view but in normal view because do not load admin css/js files |
| 327 | 327 | $logged_info = Context::get('logged_info'); |
| 328 | - if($logged_info->is_admin != 'Y') return $this->stop('msg_invalid_request'); |
|
| 328 | + if ($logged_info->is_admin != 'Y') return $this->stop('msg_invalid_request'); |
|
| 329 | 329 | |
| 330 | 330 | $layout_srl = Context::get('layout_srl'); |
| 331 | 331 | $code = Context::get('code'); |
| 332 | 332 | |
| 333 | 333 | $code_css = Context::get('code_css'); |
| 334 | - if(!$layout_srl || !$code) return new BaseObject(-1, 'msg_invalid_request'); |
|
| 334 | + if (!$layout_srl || !$code) return new BaseObject(-1, 'msg_invalid_request'); |
|
| 335 | 335 | // Get the layout information |
| 336 | 336 | $oLayoutModel = getModel('layout'); |
| 337 | 337 | $layout_info = $oLayoutModel->getLayout($layout_srl); |
| 338 | - if(!$layout_info) return new BaseObject(-1, 'msg_invalid_request'); |
|
| 338 | + if (!$layout_info) return new BaseObject(-1, 'msg_invalid_request'); |
|
| 339 | 339 | // Separately handle the layout if its type is faceoff |
| 340 | - if($layout_info && $layout_info->type == 'faceoff') $oLayoutModel->doActivateFaceOff($layout_info); |
|
| 340 | + if ($layout_info && $layout_info->type == 'faceoff') $oLayoutModel->doActivateFaceOff($layout_info); |
|
| 341 | 341 | // Apply CSS directly |
| 342 | 342 | Context::addHtmlHeader("<style type=\"text/css\" charset=\"UTF-8\">".$code_css."</style>"); |
| 343 | 343 | // Set names and values of extra_vars to $layout_info |
| 344 | - if($layout_info->extra_var_count) |
|
| 344 | + if ($layout_info->extra_var_count) |
|
| 345 | 345 | { |
| 346 | - foreach($layout_info->extra_var as $var_id => $val) |
|
| 346 | + foreach ($layout_info->extra_var as $var_id => $val) |
|
| 347 | 347 | { |
| 348 | 348 | $layout_info->{$var_id} = $val->value; |
| 349 | 349 | } |
| 350 | 350 | } |
| 351 | 351 | // menu in layout information becomes an argument for Context:: set |
| 352 | - if($layout_info->menu_count) |
|
| 352 | + if ($layout_info->menu_count) |
|
| 353 | 353 | { |
| 354 | - foreach($layout_info->menu as $menu_id => $menu) |
|
| 354 | + foreach ($layout_info->menu as $menu_id => $menu) |
|
| 355 | 355 | { |
| 356 | 356 | $menu->php_file = FileHandler::getRealPath($menu->php_file); |
| 357 | - if(FileHandler::exists($menu->php_file)) include($menu->php_file); |
|
| 357 | + if (FileHandler::exists($menu->php_file)) include($menu->php_file); |
|
| 358 | 358 | |
| 359 | 359 | Context::set($menu_id, $menu); |
| 360 | 360 | } |
@@ -363,7 +363,7 @@ discard block |
||
| 363 | 363 | Context::set('layout_info', $layout_info); |
| 364 | 364 | Context::set('content', Context::getLang('layout_preview_content')); |
| 365 | 365 | // Temporary save the codes |
| 366 | - $edited_layout_file = _XE_PATH_ . 'files/cache/layout/tmp.tpl'; |
|
| 366 | + $edited_layout_file = _XE_PATH_.'files/cache/layout/tmp.tpl'; |
|
| 367 | 367 | FileHandler::writeFile($edited_layout_file, $code); |
| 368 | 368 | |
| 369 | 369 | // Compile |
@@ -373,7 +373,7 @@ discard block |
||
| 373 | 373 | $layout_file = 'layout'; |
| 374 | 374 | |
| 375 | 375 | $layout_tpl = $oTemplate->compile($layout_path, $layout_file, $edited_layout_file); |
| 376 | - Context::set('layout','none'); |
|
| 376 | + Context::set('layout', 'none'); |
|
| 377 | 377 | // Convert widgets and others |
| 378 | 378 | $oContext = &Context::getInstance(); |
| 379 | 379 | Context::set('layout_tpl', $layout_tpl); |
@@ -387,7 +387,7 @@ discard block |
||
| 387 | 387 | $oLayoutModel = getModel('layout'); |
| 388 | 388 | $layoutFile = $oLayoutModel->getUserLayoutHtml($layoutSrl); |
| 389 | 389 | |
| 390 | - if(file_exists($layoutFile)) |
|
| 390 | + if (file_exists($layoutFile)) |
|
| 391 | 391 | { |
| 392 | 392 | return $layoutFile; |
| 393 | 393 | } |
@@ -403,7 +403,7 @@ discard block |
||
| 403 | 403 | $oLayoutModel = getModel('layout'); |
| 404 | 404 | $cssFile = $oLayoutModel->getUserLayoutCss($layoutSrl); |
| 405 | 405 | |
| 406 | - if(file_exists($cssFile)) |
|
| 406 | + if (file_exists($cssFile)) |
|
| 407 | 407 | { |
| 408 | 408 | return $cssFile; |
| 409 | 409 | } |
@@ -25,7 +25,9 @@ discard block |
||
| 25 | 25 | // Get the layout information |
| 26 | 26 | $oLayoutModel = getModel('layout'); |
| 27 | 27 | $layout_info = $oLayoutModel->getLayoutInfo(Context::get('selected_layout')); |
| 28 | - if(!$layout_info) exit(); |
|
| 28 | + if(!$layout_info) { |
|
| 29 | + exit(); |
|
| 30 | + } |
|
| 29 | 31 | Context::set('layout_info', $layout_info); |
| 30 | 32 | // Set the layout to be pop-up |
| 31 | 33 | $this->setLayoutFile('popup_layout'); |
@@ -89,8 +91,7 @@ discard block |
||
| 89 | 91 | { |
| 90 | 92 | $templatePath = _XE_PATH_ . 'modules/page/m.skins/' . $skin; |
| 91 | 93 | $templateFile = 'mobile'; |
| 92 | - } |
|
| 93 | - else |
|
| 94 | + } else |
|
| 94 | 95 | { |
| 95 | 96 | $templatePath = _XE_PATH_ . 'modules/page/skins/' . $skin; |
| 96 | 97 | $templateFile = 'content'; |
@@ -119,8 +120,7 @@ discard block |
||
| 119 | 120 | if($skinType == 'M') |
| 120 | 121 | { |
| 121 | 122 | $layoutSrl = $designInfo->mlayout_srl; |
| 122 | - } |
|
| 123 | - else |
|
| 123 | + } else |
|
| 124 | 124 | { |
| 125 | 125 | $layoutSrl = $designInfo->layout_srl; |
| 126 | 126 | } |
@@ -172,8 +172,7 @@ discard block |
||
| 172 | 172 | $menu->xml_file = str_replace('.xml.php', $homeMenuSrl . '.xml.php', $menu->xml_file); |
| 173 | 173 | $menu->php_file = str_replace('.php', $homeMenuSrl . '.php', $menu->php_file); |
| 174 | 174 | $layoutInfo->menu->{$menu_id}->menu_srl = $homeMenuSrl; |
| 175 | - } |
|
| 176 | - else |
|
| 175 | + } else |
|
| 177 | 176 | { |
| 178 | 177 | $menu->xml_file = str_replace($menu->menu_srl, $homeMenuSrl, $menu->xml_file); |
| 179 | 178 | $menu->php_file = str_replace($menu->menu_srl, $homeMenuSrl, $menu->php_file); |
@@ -192,8 +191,7 @@ discard block |
||
| 192 | 191 | Context::set('layout_info', $layoutInfo); |
| 193 | 192 | } |
| 194 | 193 | } |
| 195 | - } |
|
| 196 | - catch(Exception $e) |
|
| 194 | + } catch(Exception $e) |
|
| 197 | 195 | { |
| 198 | 196 | $content = '<div class="message error"><p id="preview_error">' . $e->getMessage() . '</p></div>'; |
| 199 | 197 | Context::set('content', $content); |
@@ -217,8 +215,7 @@ discard block |
||
| 217 | 215 | $oModuleModel = getModel('module'); |
| 218 | 216 | $part_config = $oModuleModel->getModulePartConfig('layout', $layoutSrl); |
| 219 | 217 | Context::addHtmlHeader($part_config->header_script); |
| 220 | - } |
|
| 221 | - else |
|
| 218 | + } else |
|
| 222 | 219 | { |
| 223 | 220 | $layout_path = './common/tpl'; |
| 224 | 221 | $layout_file = 'default_layout'; |
@@ -290,8 +287,7 @@ discard block |
||
| 290 | 287 | { |
| 291 | 288 | Mobile::setMobile(TRUE); |
| 292 | 289 | $oModuleHandler->module_info->mskin = $skin; |
| 293 | - } |
|
| 294 | - else |
|
| 290 | + } else |
|
| 295 | 291 | { |
| 296 | 292 | Mobile::setMobile(FALSE); |
| 297 | 293 | $oModuleHandler->module_info->skin = $skin; |
@@ -325,19 +321,27 @@ discard block |
||
| 325 | 321 | // admin check |
| 326 | 322 | // this act is admin view but in normal view because do not load admin css/js files |
| 327 | 323 | $logged_info = Context::get('logged_info'); |
| 328 | - if($logged_info->is_admin != 'Y') return $this->stop('msg_invalid_request'); |
|
| 324 | + if($logged_info->is_admin != 'Y') { |
|
| 325 | + return $this->stop('msg_invalid_request'); |
|
| 326 | + } |
|
| 329 | 327 | |
| 330 | 328 | $layout_srl = Context::get('layout_srl'); |
| 331 | 329 | $code = Context::get('code'); |
| 332 | 330 | |
| 333 | 331 | $code_css = Context::get('code_css'); |
| 334 | - if(!$layout_srl || !$code) return new BaseObject(-1, 'msg_invalid_request'); |
|
| 332 | + if(!$layout_srl || !$code) { |
|
| 333 | + return new BaseObject(-1, 'msg_invalid_request'); |
|
| 334 | + } |
|
| 335 | 335 | // Get the layout information |
| 336 | 336 | $oLayoutModel = getModel('layout'); |
| 337 | 337 | $layout_info = $oLayoutModel->getLayout($layout_srl); |
| 338 | - if(!$layout_info) return new BaseObject(-1, 'msg_invalid_request'); |
|
| 338 | + if(!$layout_info) { |
|
| 339 | + return new BaseObject(-1, 'msg_invalid_request'); |
|
| 340 | + } |
|
| 339 | 341 | // Separately handle the layout if its type is faceoff |
| 340 | - if($layout_info && $layout_info->type == 'faceoff') $oLayoutModel->doActivateFaceOff($layout_info); |
|
| 342 | + if($layout_info && $layout_info->type == 'faceoff') { |
|
| 343 | + $oLayoutModel->doActivateFaceOff($layout_info); |
|
| 344 | + } |
|
| 341 | 345 | // Apply CSS directly |
| 342 | 346 | Context::addHtmlHeader("<style type=\"text/css\" charset=\"UTF-8\">".$code_css."</style>"); |
| 343 | 347 | // Set names and values of extra_vars to $layout_info |
@@ -354,7 +358,9 @@ discard block |
||
| 354 | 358 | foreach($layout_info->menu as $menu_id => $menu) |
| 355 | 359 | { |
| 356 | 360 | $menu->php_file = FileHandler::getRealPath($menu->php_file); |
| 357 | - if(FileHandler::exists($menu->php_file)) include($menu->php_file); |
|
| 361 | + if(FileHandler::exists($menu->php_file)) { |
|
| 362 | + include($menu->php_file); |
|
| 363 | + } |
|
| 358 | 364 | |
| 359 | 365 | Context::set($menu_id, $menu); |
| 360 | 366 | } |
@@ -390,8 +396,7 @@ discard block |
||
| 390 | 396 | if(file_exists($layoutFile)) |
| 391 | 397 | { |
| 392 | 398 | return $layoutFile; |
| 393 | - } |
|
| 394 | - else |
|
| 399 | + } else |
|
| 395 | 400 | { |
| 396 | 401 | return ''; |
| 397 | 402 | } |
@@ -406,8 +411,7 @@ discard block |
||
| 406 | 411 | if(file_exists($cssFile)) |
| 407 | 412 | { |
| 408 | 413 | return $cssFile; |
| 409 | - } |
|
| 410 | - else |
|
| 414 | + } else |
|
| 411 | 415 | { |
| 412 | 416 | return ''; |
| 413 | 417 | } |
@@ -490,7 +490,7 @@ discard block |
||
| 490 | 490 | |
| 491 | 491 | /** |
| 492 | 492 | * Returns object of error info |
| 493 | - * @return object object of error |
|
| 493 | + * @return BaseObject object of error |
|
| 494 | 494 | */ |
| 495 | 495 | function getError() |
| 496 | 496 | { |
@@ -667,7 +667,7 @@ discard block |
||
| 667 | 667 | * Returns counter cache data |
| 668 | 668 | * @param array|string $tables tables to get data |
| 669 | 669 | * @param string $condition condition to get data |
| 670 | - * @return int count of cache data |
|
| 670 | + * @return boolean count of cache data |
|
| 671 | 671 | */ |
| 672 | 672 | function getCountCache($tables, $condition) |
| 673 | 673 | { |
@@ -727,7 +727,7 @@ discard block |
||
| 727 | 727 | * @param array|string $tables tables to save data |
| 728 | 728 | * @param string $condition condition to save data |
| 729 | 729 | * @param int $count count of cache data to save |
| 730 | - * @return void |
|
| 730 | + * @return boolean |
|
| 731 | 731 | */ |
| 732 | 732 | function putCountCache($tables, $condition, $count = 0) |
| 733 | 733 | { |
@@ -809,7 +809,7 @@ discard block |
||
| 809 | 809 | |
| 810 | 810 | /** |
| 811 | 811 | * Return select query string |
| 812 | - * @param object $query |
|
| 812 | + * @param BaseObject $query |
|
| 813 | 813 | * @param boolean $with_values |
| 814 | 814 | * @return string |
| 815 | 815 | */ |
@@ -903,7 +903,7 @@ discard block |
||
| 903 | 903 | |
| 904 | 904 | /** |
| 905 | 905 | * Return delete query string |
| 906 | - * @param object $query |
|
| 906 | + * @param BaseObject $query |
|
| 907 | 907 | * @param boolean $with_values |
| 908 | 908 | * @param boolean $with_priority |
| 909 | 909 | * @return string |
@@ -935,7 +935,7 @@ discard block |
||
| 935 | 935 | |
| 936 | 936 | /** |
| 937 | 937 | * Return update query string |
| 938 | - * @param object $query |
|
| 938 | + * @param BaseObject $query |
|
| 939 | 939 | * @param boolean $with_values |
| 940 | 940 | * @param boolean $with_priority |
| 941 | 941 | * @return string |
@@ -967,7 +967,7 @@ discard block |
||
| 967 | 967 | |
| 968 | 968 | /** |
| 969 | 969 | * Return insert query string |
| 970 | - * @param object $query |
|
| 970 | + * @param BaseObject $query |
|
| 971 | 971 | * @param boolean $with_values |
| 972 | 972 | * @param boolean $with_priority |
| 973 | 973 | * @return string |
@@ -1238,7 +1238,7 @@ discard block |
||
| 1238 | 1238 | * DB Connect |
| 1239 | 1239 | * this method is protected |
| 1240 | 1240 | * @param array $connection |
| 1241 | - * @return void |
|
| 1241 | + * @return resource |
|
| 1242 | 1242 | */ |
| 1243 | 1243 | function __connect($connection) |
| 1244 | 1244 | { |
@@ -141,24 +141,24 @@ discard block |
||
| 141 | 141 | */ |
| 142 | 142 | function getInstance($db_type = NULL) |
| 143 | 143 | { |
| 144 | - if(!$db_type) |
|
| 144 | + if (!$db_type) |
|
| 145 | 145 | { |
| 146 | 146 | $db_type = Context::getDBType(); |
| 147 | 147 | } |
| 148 | - if(!$db_type && Context::isInstalled()) |
|
| 148 | + if (!$db_type && Context::isInstalled()) |
|
| 149 | 149 | { |
| 150 | 150 | return new BaseObject(-1, 'msg_db_not_setted'); |
| 151 | 151 | } |
| 152 | 152 | |
| 153 | - if(!isset($GLOBALS['__DB__'])) |
|
| 153 | + if (!isset($GLOBALS['__DB__'])) |
|
| 154 | 154 | { |
| 155 | 155 | $GLOBALS['__DB__'] = array(); |
| 156 | 156 | } |
| 157 | - if(!isset($GLOBALS['__DB__'][$db_type])) |
|
| 157 | + if (!isset($GLOBALS['__DB__'][$db_type])) |
|
| 158 | 158 | { |
| 159 | - $class_name = 'DB' . ucfirst($db_type); |
|
| 160 | - $class_file = _XE_PATH_ . "classes/db/$class_name.class.php"; |
|
| 161 | - if(!file_exists($class_file)) |
|
| 159 | + $class_name = 'DB'.ucfirst($db_type); |
|
| 160 | + $class_file = _XE_PATH_."classes/db/$class_name.class.php"; |
|
| 161 | + if (!file_exists($class_file)) |
|
| 162 | 162 | { |
| 163 | 163 | return new BaseObject(-1, 'msg_db_not_setted'); |
| 164 | 164 | } |
@@ -187,8 +187,8 @@ discard block |
||
| 187 | 187 | */ |
| 188 | 188 | function DB() |
| 189 | 189 | { |
| 190 | - $this->count_cache_path = _XE_PATH_ . $this->count_cache_path; |
|
| 191 | - $this->cache_file = _XE_PATH_ . $this->cache_file; |
|
| 190 | + $this->count_cache_path = _XE_PATH_.$this->count_cache_path; |
|
| 191 | + $this->cache_file = _XE_PATH_.$this->cache_file; |
|
| 192 | 192 | } |
| 193 | 193 | |
| 194 | 194 | /** |
@@ -210,18 +210,18 @@ discard block |
||
| 210 | 210 | */ |
| 211 | 211 | public static function getEnableList() |
| 212 | 212 | { |
| 213 | - if(!self::$supported_list) |
|
| 213 | + if (!self::$supported_list) |
|
| 214 | 214 | { |
| 215 | 215 | $oDB = new DB(); |
| 216 | 216 | self::$supported_list = $oDB->_getSupportedList(); |
| 217 | 217 | } |
| 218 | 218 | |
| 219 | 219 | $enableList = array(); |
| 220 | - if(is_array(self::$supported_list)) |
|
| 220 | + if (is_array(self::$supported_list)) |
|
| 221 | 221 | { |
| 222 | - foreach(self::$supported_list AS $key => $value) |
|
| 222 | + foreach (self::$supported_list AS $key => $value) |
|
| 223 | 223 | { |
| 224 | - if($value->enable) |
|
| 224 | + if ($value->enable) |
|
| 225 | 225 | { |
| 226 | 226 | $enableList[] = $value; |
| 227 | 227 | } |
@@ -237,18 +237,18 @@ discard block |
||
| 237 | 237 | */ |
| 238 | 238 | public static function getDisableList() |
| 239 | 239 | { |
| 240 | - if(!self::$supported_list) |
|
| 240 | + if (!self::$supported_list) |
|
| 241 | 241 | { |
| 242 | 242 | $oDB = new DB(); |
| 243 | 243 | self::$supported_list = $oDB->_getSupportedList(); |
| 244 | 244 | } |
| 245 | 245 | |
| 246 | 246 | $disableList = array(); |
| 247 | - if(is_array(self::$supported_list)) |
|
| 247 | + if (is_array(self::$supported_list)) |
|
| 248 | 248 | { |
| 249 | - foreach(self::$supported_list AS $key => $value) |
|
| 249 | + foreach (self::$supported_list AS $key => $value) |
|
| 250 | 250 | { |
| 251 | - if(!$value->enable) |
|
| 251 | + if (!$value->enable) |
|
| 252 | 252 | { |
| 253 | 253 | $disableList[] = $value; |
| 254 | 254 | } |
@@ -265,24 +265,24 @@ discard block |
||
| 265 | 265 | function _getSupportedList() |
| 266 | 266 | { |
| 267 | 267 | static $get_supported_list = ''; |
| 268 | - if(is_array($get_supported_list)) |
|
| 268 | + if (is_array($get_supported_list)) |
|
| 269 | 269 | { |
| 270 | 270 | self::$supported_list = $get_supported_list; |
| 271 | 271 | return self::$supported_list; |
| 272 | 272 | } |
| 273 | 273 | $get_supported_list = array(); |
| 274 | - $db_classes_path = _XE_PATH_ . "classes/db/"; |
|
| 274 | + $db_classes_path = _XE_PATH_."classes/db/"; |
|
| 275 | 275 | $filter = "/^DB([^\.]+)\.class\.php/i"; |
| 276 | 276 | $supported_list = FileHandler::readDir($db_classes_path, $filter, TRUE); |
| 277 | 277 | |
| 278 | 278 | // after creating instance of class, check is supported |
| 279 | - for($i = 0; $i < count($supported_list); $i++) |
|
| 279 | + for ($i = 0; $i < count($supported_list); $i++) |
|
| 280 | 280 | { |
| 281 | 281 | $db_type = $supported_list[$i]; |
| 282 | 282 | |
| 283 | 283 | $class_name = sprintf("DB%s%s", strtoupper(substr($db_type, 0, 1)), strtolower(substr($db_type, 1))); |
| 284 | - $class_file = sprintf(_XE_PATH_ . "classes/db/%s.class.php", $class_name); |
|
| 285 | - if(!file_exists($class_file)) |
|
| 284 | + $class_file = sprintf(_XE_PATH_."classes/db/%s.class.php", $class_name); |
|
| 285 | + if (!file_exists($class_file)) |
|
| 286 | 286 | { |
| 287 | 287 | continue; |
| 288 | 288 | } |
@@ -291,7 +291,7 @@ discard block |
||
| 291 | 291 | require_once($class_file); |
| 292 | 292 | $oDB = new $class_name(FALSE); |
| 293 | 293 | |
| 294 | - if(!$oDB) |
|
| 294 | + if (!$oDB) |
|
| 295 | 295 | { |
| 296 | 296 | continue; |
| 297 | 297 | } |
@@ -315,7 +315,7 @@ discard block |
||
| 315 | 315 | */ |
| 316 | 316 | function _sortDBMS($a, $b) |
| 317 | 317 | { |
| 318 | - if(!isset($this->priority_dbms[$a->db_type])) |
|
| 318 | + if (!isset($this->priority_dbms[$a->db_type])) |
|
| 319 | 319 | { |
| 320 | 320 | $priority_a = 0; |
| 321 | 321 | } |
@@ -324,7 +324,7 @@ discard block |
||
| 324 | 324 | $priority_a = $this->priority_dbms[$a->db_type]; |
| 325 | 325 | } |
| 326 | 326 | |
| 327 | - if(!isset($this->priority_dbms[$b->db_type])) |
|
| 327 | + if (!isset($this->priority_dbms[$b->db_type])) |
|
| 328 | 328 | { |
| 329 | 329 | $priority_b = 0; |
| 330 | 330 | } |
@@ -333,7 +333,7 @@ discard block |
||
| 333 | 333 | $priority_b = $this->priority_dbms[$b->db_type]; |
| 334 | 334 | } |
| 335 | 335 | |
| 336 | - if($priority_a == $priority_b) |
|
| 336 | + if ($priority_a == $priority_b) |
|
| 337 | 337 | { |
| 338 | 338 | return 0; |
| 339 | 339 | } |
@@ -359,7 +359,7 @@ discard block |
||
| 359 | 359 | */ |
| 360 | 360 | function isConnected($type = 'master', $indx = 0) |
| 361 | 361 | { |
| 362 | - if($type == 'master') |
|
| 362 | + if ($type == 'master') |
|
| 363 | 363 | { |
| 364 | 364 | return $this->master_db["is_connected"] ? TRUE : FALSE; |
| 365 | 365 | } |
@@ -388,7 +388,7 @@ discard block |
||
| 388 | 388 | */ |
| 389 | 389 | function actFinish() |
| 390 | 390 | { |
| 391 | - if(!$this->query) |
|
| 391 | + if (!$this->query) |
|
| 392 | 392 | { |
| 393 | 393 | return; |
| 394 | 394 | } |
@@ -409,14 +409,14 @@ discard block |
||
| 409 | 409 | |
| 410 | 410 | $bt = version_compare(PHP_VERSION, '5.3.6', '>=') ? debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS) : debug_backtrace(); |
| 411 | 411 | |
| 412 | - foreach($bt as $no => $call) |
|
| 412 | + foreach ($bt as $no => $call) |
|
| 413 | 413 | { |
| 414 | - if($call['function'] == 'executeQuery' || $call['function'] == 'executeQueryArray') |
|
| 414 | + if ($call['function'] == 'executeQuery' || $call['function'] == 'executeQueryArray') |
|
| 415 | 415 | { |
| 416 | 416 | $call_no = $no; |
| 417 | 417 | $call_no++; |
| 418 | 418 | $log['called_file'] = $bt[$call_no]['file'].':'.$bt[$call_no]['line']; |
| 419 | - $log['called_file'] = str_replace(_XE_PATH_ , '', $log['called_file']); |
|
| 419 | + $log['called_file'] = str_replace(_XE_PATH_, '', $log['called_file']); |
|
| 420 | 420 | $call_no++; |
| 421 | 421 | $log['called_method'] = $bt[$call_no]['class'].$bt[$call_no]['type'].$bt[$call_no]['function']; |
| 422 | 422 | break; |
@@ -424,22 +424,22 @@ discard block |
||
| 424 | 424 | } |
| 425 | 425 | |
| 426 | 426 | // leave error log if an error occured (if __DEBUG_DB_OUTPUT__ is defined) |
| 427 | - if($this->isError()) |
|
| 427 | + if ($this->isError()) |
|
| 428 | 428 | { |
| 429 | 429 | $log['result'] = 'Failed'; |
| 430 | 430 | $log['errno'] = $this->errno; |
| 431 | 431 | $log['errstr'] = $this->errstr; |
| 432 | 432 | |
| 433 | - if(__DEBUG_DB_OUTPUT__ == 1) |
|
| 433 | + if (__DEBUG_DB_OUTPUT__ == 1) |
|
| 434 | 434 | { |
| 435 | - $debug_file = _XE_PATH_ . "files/_debug_db_query.php"; |
|
| 435 | + $debug_file = _XE_PATH_."files/_debug_db_query.php"; |
|
| 436 | 436 | $buff = array(); |
| 437 | - if(!file_exists($debug_file)) |
|
| 437 | + if (!file_exists($debug_file)) |
|
| 438 | 438 | { |
| 439 | - $buff[] = '<?php exit(); ?' . '>'; |
|
| 439 | + $buff[] = '<?php exit(); ?'.'>'; |
|
| 440 | 440 | } |
| 441 | 441 | $buff[] = print_r($log, TRUE); |
| 442 | - @file_put_contents($log_file, implode("\n", $buff) . "\n\n", FILE_APPEND|LOCK_EX); |
|
| 442 | + @file_put_contents($log_file, implode("\n", $buff)."\n\n", FILE_APPEND | LOCK_EX); |
|
| 443 | 443 | } |
| 444 | 444 | } |
| 445 | 445 | else |
@@ -452,7 +452,7 @@ discard block |
||
| 452 | 452 | $log_args = new stdClass; |
| 453 | 453 | $log_args->query = $this->query; |
| 454 | 454 | $log_args->query_id = $this->query_id; |
| 455 | - $log_args->caller = $log['called_method'] . '() in ' . $log['called_file']; |
|
| 455 | + $log_args->caller = $log['called_method'].'() in '.$log['called_file']; |
|
| 456 | 456 | $log_args->connection = $log['connection']; |
| 457 | 457 | writeSlowlog('query', $elapsed_time, $log_args); |
| 458 | 458 | } |
@@ -510,11 +510,11 @@ discard block |
||
| 510 | 510 | { |
| 511 | 511 | static $cache_file = array(); |
| 512 | 512 | |
| 513 | - if(!$query_id) |
|
| 513 | + if (!$query_id) |
|
| 514 | 514 | { |
| 515 | 515 | return new BaseObject(-1, 'msg_invalid_queryid'); |
| 516 | 516 | } |
| 517 | - if(!$this->db_type) |
|
| 517 | + if (!$this->db_type) |
|
| 518 | 518 | { |
| 519 | 519 | return; |
| 520 | 520 | } |
@@ -523,20 +523,20 @@ discard block |
||
| 523 | 523 | |
| 524 | 524 | $this->query_id = $query_id; |
| 525 | 525 | |
| 526 | - if(!isset($cache_file[$query_id]) || !file_exists($cache_file[$query_id])) |
|
| 526 | + if (!isset($cache_file[$query_id]) || !file_exists($cache_file[$query_id])) |
|
| 527 | 527 | { |
| 528 | 528 | $id_args = explode('.', $query_id); |
| 529 | - if(count($id_args) == 2) |
|
| 529 | + if (count($id_args) == 2) |
|
| 530 | 530 | { |
| 531 | 531 | $target = 'modules'; |
| 532 | 532 | $module = $id_args[0]; |
| 533 | 533 | $id = $id_args[1]; |
| 534 | 534 | } |
| 535 | - elseif(count($id_args) == 3) |
|
| 535 | + elseif (count($id_args) == 3) |
|
| 536 | 536 | { |
| 537 | 537 | $target = $id_args[0]; |
| 538 | 538 | $typeList = array('addons' => 1, 'widgets' => 1); |
| 539 | - if(!isset($typeList[$target])) |
|
| 539 | + if (!isset($typeList[$target])) |
|
| 540 | 540 | { |
| 541 | 541 | $this->actDBClassFinish(); |
| 542 | 542 | return; |
@@ -544,14 +544,14 @@ discard block |
||
| 544 | 544 | $module = $id_args[1]; |
| 545 | 545 | $id = $id_args[2]; |
| 546 | 546 | } |
| 547 | - if(!$target || !$module || !$id) |
|
| 547 | + if (!$target || !$module || !$id) |
|
| 548 | 548 | { |
| 549 | 549 | $this->actDBClassFinish(); |
| 550 | 550 | return new BaseObject(-1, 'msg_invalid_queryid'); |
| 551 | 551 | } |
| 552 | 552 | |
| 553 | 553 | $xml_file = sprintf('%s%s/%s/queries/%s.xml', _XE_PATH_, $target, $module, $id); |
| 554 | - if(!file_exists($xml_file)) |
|
| 554 | + if (!file_exists($xml_file)) |
|
| 555 | 555 | { |
| 556 | 556 | $this->actDBClassFinish(); |
| 557 | 557 | return new BaseObject(-1, 'msg_invalid_queryid'); |
@@ -579,13 +579,13 @@ discard block |
||
| 579 | 579 | $cache_file = sprintf('%s%s%s.%s.%s.cache.php', _XE_PATH_, $this->cache_file, $query_id, __ZBXE_VERSION__, $this->db_type); |
| 580 | 580 | |
| 581 | 581 | $cache_time = -1; |
| 582 | - if(file_exists($cache_file)) |
|
| 582 | + if (file_exists($cache_file)) |
|
| 583 | 583 | { |
| 584 | 584 | $cache_time = filemtime($cache_file); |
| 585 | 585 | } |
| 586 | 586 | |
| 587 | 587 | // if there is no cache file or is not new, find original xml query file and parse it |
| 588 | - if($cache_time < filemtime($xml_file) || $cache_time < filemtime(_XE_PATH_ . 'classes/db/DB.class.php') || $cache_time < filemtime(_XE_PATH_ . 'classes/xml/XmlQueryParser.class.php')) |
|
| 588 | + if ($cache_time < filemtime($xml_file) || $cache_time < filemtime(_XE_PATH_.'classes/db/DB.class.php') || $cache_time < filemtime(_XE_PATH_.'classes/xml/XmlQueryParser.class.php')) |
|
| 589 | 589 | { |
| 590 | 590 | $oParser = new XmlQueryParser(); |
| 591 | 591 | $oParser->parse($query_id, $xml_file, $cache_file); |
@@ -606,27 +606,27 @@ discard block |
||
| 606 | 606 | { |
| 607 | 607 | global $lang; |
| 608 | 608 | |
| 609 | - if(!in_array($type, array('master','slave'))) $type = 'slave'; |
|
| 609 | + if (!in_array($type, array('master', 'slave'))) $type = 'slave'; |
|
| 610 | 610 | |
| 611 | - if(!file_exists($cache_file)) |
|
| 611 | + if (!file_exists($cache_file)) |
|
| 612 | 612 | { |
| 613 | 613 | return new BaseObject(-1, 'msg_invalid_queryid'); |
| 614 | 614 | } |
| 615 | 615 | |
| 616 | - if($source_args) |
|
| 616 | + if ($source_args) |
|
| 617 | 617 | { |
| 618 | 618 | $args = clone $source_args; |
| 619 | 619 | } |
| 620 | 620 | |
| 621 | 621 | $output = include($cache_file); |
| 622 | 622 | |
| 623 | - if((is_a($output, 'BaseObject') || is_subclass_of($output, 'BaseObject')) && !$output->toBool()) |
|
| 623 | + if ((is_a($output, 'BaseObject') || is_subclass_of($output, 'BaseObject')) && !$output->toBool()) |
|
| 624 | 624 | { |
| 625 | 625 | return $output; |
| 626 | 626 | } |
| 627 | 627 | |
| 628 | 628 | // execute appropriate query |
| 629 | - switch($output->getAction()) |
|
| 629 | + switch ($output->getAction()) |
|
| 630 | 630 | { |
| 631 | 631 | case 'insert' : |
| 632 | 632 | case 'insert-select' : |
@@ -649,11 +649,11 @@ discard block |
||
| 649 | 649 | break; |
| 650 | 650 | } |
| 651 | 651 | |
| 652 | - if($this->isError()) |
|
| 652 | + if ($this->isError()) |
|
| 653 | 653 | { |
| 654 | 654 | $output = $this->getError(); |
| 655 | 655 | } |
| 656 | - else if(!is_a($output, 'BaseObject') && !is_subclass_of($output, 'BaseObject')) |
|
| 656 | + else if (!is_a($output, 'BaseObject') && !is_subclass_of($output, 'BaseObject')) |
|
| 657 | 657 | { |
| 658 | 658 | $output = new BaseObject(); |
| 659 | 659 | } |
@@ -799,7 +799,7 @@ discard block |
||
| 799 | 799 | */ |
| 800 | 800 | function dropTable($table_name) |
| 801 | 801 | { |
| 802 | - if(!$table_name) |
|
| 802 | + if (!$table_name) |
|
| 803 | 803 | { |
| 804 | 804 | return; |
| 805 | 805 | } |
@@ -816,59 +816,59 @@ discard block |
||
| 816 | 816 | function getSelectSql($query, $with_values = TRUE) |
| 817 | 817 | { |
| 818 | 818 | $select = $query->getSelectString($with_values); |
| 819 | - if($select == '') |
|
| 819 | + if ($select == '') |
|
| 820 | 820 | { |
| 821 | 821 | return new BaseObject(-1, "Invalid query"); |
| 822 | 822 | } |
| 823 | - $select = 'SELECT ' . $select; |
|
| 823 | + $select = 'SELECT '.$select; |
|
| 824 | 824 | |
| 825 | 825 | $from = $query->getFromString($with_values); |
| 826 | - if($from == '') |
|
| 826 | + if ($from == '') |
|
| 827 | 827 | { |
| 828 | 828 | return new BaseObject(-1, "Invalid query"); |
| 829 | 829 | } |
| 830 | - $from = ' FROM ' . $from; |
|
| 830 | + $from = ' FROM '.$from; |
|
| 831 | 831 | |
| 832 | 832 | $where = $query->getWhereString($with_values); |
| 833 | - if($where != '') |
|
| 833 | + if ($where != '') |
|
| 834 | 834 | { |
| 835 | - $where = ' WHERE ' . $where; |
|
| 835 | + $where = ' WHERE '.$where; |
|
| 836 | 836 | } |
| 837 | 837 | |
| 838 | 838 | $tableObjects = $query->getTables(); |
| 839 | 839 | $index_hint_list = ''; |
| 840 | - foreach($tableObjects as $tableObject) |
|
| 840 | + foreach ($tableObjects as $tableObject) |
|
| 841 | 841 | { |
| 842 | - if(is_a($tableObject, 'CubridTableWithHint')) |
|
| 842 | + if (is_a($tableObject, 'CubridTableWithHint')) |
|
| 843 | 843 | { |
| 844 | - $index_hint_list .= $tableObject->getIndexHintString() . ', '; |
|
| 844 | + $index_hint_list .= $tableObject->getIndexHintString().', '; |
|
| 845 | 845 | } |
| 846 | 846 | } |
| 847 | 847 | $index_hint_list = substr($index_hint_list, 0, -2); |
| 848 | - if($index_hint_list != '') |
|
| 848 | + if ($index_hint_list != '') |
|
| 849 | 849 | { |
| 850 | - $index_hint_list = 'USING INDEX ' . $index_hint_list; |
|
| 850 | + $index_hint_list = 'USING INDEX '.$index_hint_list; |
|
| 851 | 851 | } |
| 852 | 852 | |
| 853 | 853 | $groupBy = $query->getGroupByString(); |
| 854 | - if($groupBy != '') |
|
| 854 | + if ($groupBy != '') |
|
| 855 | 855 | { |
| 856 | - $groupBy = ' GROUP BY ' . $groupBy; |
|
| 856 | + $groupBy = ' GROUP BY '.$groupBy; |
|
| 857 | 857 | } |
| 858 | 858 | |
| 859 | 859 | $orderBy = $query->getOrderByString(); |
| 860 | - if($orderBy != '') |
|
| 860 | + if ($orderBy != '') |
|
| 861 | 861 | { |
| 862 | - $orderBy = ' ORDER BY ' . $orderBy; |
|
| 862 | + $orderBy = ' ORDER BY '.$orderBy; |
|
| 863 | 863 | } |
| 864 | 864 | |
| 865 | 865 | $limit = $query->getLimitString(); |
| 866 | - if($limit != '') |
|
| 866 | + if ($limit != '') |
|
| 867 | 867 | { |
| 868 | - $limit = ' LIMIT ' . $limit; |
|
| 868 | + $limit = ' LIMIT '.$limit; |
|
| 869 | 869 | } |
| 870 | 870 | |
| 871 | - return $select . ' ' . $from . ' ' . $where . ' ' . $index_hint_list . ' ' . $groupBy . ' ' . $orderBy . ' ' . $limit; |
|
| 871 | + return $select.' '.$from.' '.$where.' '.$index_hint_list.' '.$groupBy.' '.$orderBy.' '.$limit; |
|
| 872 | 872 | } |
| 873 | 873 | |
| 874 | 874 | /** |
@@ -886,7 +886,7 @@ discard block |
||
| 886 | 886 | { |
| 887 | 887 | $new_update_columns = array(); |
| 888 | 888 | $click_count_columns = $queryObject->getClickCountColumns(); |
| 889 | - foreach($click_count_columns as $click_count_column) |
|
| 889 | + foreach ($click_count_columns as $click_count_column) |
|
| 890 | 890 | { |
| 891 | 891 | $click_count_column_name = $click_count_column->column_name; |
| 892 | 892 | |
@@ -918,16 +918,16 @@ discard block |
||
| 918 | 918 | $sql .= $tables[0]->getAlias(); |
| 919 | 919 | |
| 920 | 920 | $from = $query->getFromString($with_values); |
| 921 | - if($from == '') |
|
| 921 | + if ($from == '') |
|
| 922 | 922 | { |
| 923 | 923 | return new BaseObject(-1, "Invalid query"); |
| 924 | 924 | } |
| 925 | - $sql .= ' FROM ' . $from; |
|
| 925 | + $sql .= ' FROM '.$from; |
|
| 926 | 926 | |
| 927 | 927 | $where = $query->getWhereString($with_values); |
| 928 | - if($where != '') |
|
| 928 | + if ($where != '') |
|
| 929 | 929 | { |
| 930 | - $sql .= ' WHERE ' . $where; |
|
| 930 | + $sql .= ' WHERE '.$where; |
|
| 931 | 931 | } |
| 932 | 932 | |
| 933 | 933 | return $sql; |
@@ -943,26 +943,26 @@ discard block |
||
| 943 | 943 | function getUpdateSql($query, $with_values = TRUE, $with_priority = FALSE) |
| 944 | 944 | { |
| 945 | 945 | $columnsList = $query->getUpdateString($with_values); |
| 946 | - if($columnsList == '') |
|
| 946 | + if ($columnsList == '') |
|
| 947 | 947 | { |
| 948 | 948 | return new BaseObject(-1, "Invalid query"); |
| 949 | 949 | } |
| 950 | 950 | |
| 951 | 951 | $tables = $query->getFromString($with_values); |
| 952 | - if($tables == '') |
|
| 952 | + if ($tables == '') |
|
| 953 | 953 | { |
| 954 | 954 | return new BaseObject(-1, "Invalid query"); |
| 955 | 955 | } |
| 956 | 956 | |
| 957 | 957 | $where = $query->getWhereString($with_values); |
| 958 | - if($where != '') |
|
| 958 | + if ($where != '') |
|
| 959 | 959 | { |
| 960 | - $where = ' WHERE ' . $where; |
|
| 960 | + $where = ' WHERE '.$where; |
|
| 961 | 961 | } |
| 962 | 962 | |
| 963 | 963 | $priority = $with_priority ? $query->getPriority() : ''; |
| 964 | 964 | |
| 965 | - return "UPDATE $priority $tables SET $columnsList " . $where; |
|
| 965 | + return "UPDATE $priority $tables SET $columnsList ".$where; |
|
| 966 | 966 | } |
| 967 | 967 | |
| 968 | 968 | /** |
@@ -1000,27 +1000,27 @@ discard block |
||
| 1000 | 1000 | */ |
| 1001 | 1001 | function _getConnection($type = 'master', $indx = NULL) |
| 1002 | 1002 | { |
| 1003 | - if($type == 'master') |
|
| 1003 | + if ($type == 'master') |
|
| 1004 | 1004 | { |
| 1005 | - if(!$this->master_db['is_connected']) |
|
| 1005 | + if (!$this->master_db['is_connected']) |
|
| 1006 | 1006 | { |
| 1007 | 1007 | $this->_connect($type); |
| 1008 | 1008 | } |
| 1009 | - $this->connection = 'Master ' . $this->master_db['db_hostname']; |
|
| 1009 | + $this->connection = 'Master '.$this->master_db['db_hostname']; |
|
| 1010 | 1010 | return $this->master_db["resource"]; |
| 1011 | 1011 | } |
| 1012 | 1012 | |
| 1013 | - if($indx === NULL) |
|
| 1013 | + if ($indx === NULL) |
|
| 1014 | 1014 | { |
| 1015 | 1015 | $indx = $this->_getSlaveConnectionStringIndex($type); |
| 1016 | 1016 | } |
| 1017 | 1017 | |
| 1018 | - if(!$this->slave_db[$indx]['is_connected']) |
|
| 1018 | + if (!$this->slave_db[$indx]['is_connected']) |
|
| 1019 | 1019 | { |
| 1020 | 1020 | $this->_connect($type, $indx); |
| 1021 | 1021 | } |
| 1022 | 1022 | |
| 1023 | - $this->connection = 'Slave ' . $this->slave_db[$indx]['db_hostname']; |
|
| 1023 | + $this->connection = 'Slave '.$this->slave_db[$indx]['db_hostname']; |
|
| 1024 | 1024 | return $this->slave_db[$indx]["resource"]; |
| 1025 | 1025 | } |
| 1026 | 1026 | |
@@ -1030,11 +1030,11 @@ discard block |
||
| 1030 | 1030 | */ |
| 1031 | 1031 | function _dbInfoExists() |
| 1032 | 1032 | { |
| 1033 | - if(!$this->master_db) |
|
| 1033 | + if (!$this->master_db) |
|
| 1034 | 1034 | { |
| 1035 | 1035 | return FALSE; |
| 1036 | 1036 | } |
| 1037 | - if(count($this->slave_db) === 0) |
|
| 1037 | + if (count($this->slave_db) === 0) |
|
| 1038 | 1038 | { |
| 1039 | 1039 | return FALSE; |
| 1040 | 1040 | } |
@@ -1060,12 +1060,12 @@ discard block |
||
| 1060 | 1060 | */ |
| 1061 | 1061 | function close($type = 'master', $indx = 0) |
| 1062 | 1062 | { |
| 1063 | - if(!$this->isConnected($type, $indx)) |
|
| 1063 | + if (!$this->isConnected($type, $indx)) |
|
| 1064 | 1064 | { |
| 1065 | 1065 | return; |
| 1066 | 1066 | } |
| 1067 | 1067 | |
| 1068 | - if($type == 'master') |
|
| 1068 | + if ($type == 'master') |
|
| 1069 | 1069 | { |
| 1070 | 1070 | $connection = &$this->master_db; |
| 1071 | 1071 | } |
@@ -1096,12 +1096,12 @@ discard block |
||
| 1096 | 1096 | */ |
| 1097 | 1097 | function begin() |
| 1098 | 1098 | { |
| 1099 | - if(!$this->isConnected()) |
|
| 1099 | + if (!$this->isConnected()) |
|
| 1100 | 1100 | { |
| 1101 | 1101 | return; |
| 1102 | 1102 | } |
| 1103 | 1103 | |
| 1104 | - if($this->_begin($this->transactionNestedLevel)) |
|
| 1104 | + if ($this->_begin($this->transactionNestedLevel)) |
|
| 1105 | 1105 | { |
| 1106 | 1106 | $this->transaction_started = TRUE; |
| 1107 | 1107 | $this->transactionNestedLevel++; |
@@ -1124,15 +1124,15 @@ discard block |
||
| 1124 | 1124 | */ |
| 1125 | 1125 | function rollback() |
| 1126 | 1126 | { |
| 1127 | - if(!$this->isConnected() || !$this->transaction_started) |
|
| 1127 | + if (!$this->isConnected() || !$this->transaction_started) |
|
| 1128 | 1128 | { |
| 1129 | 1129 | return; |
| 1130 | 1130 | } |
| 1131 | - if($this->_rollback($this->transactionNestedLevel)) |
|
| 1131 | + if ($this->_rollback($this->transactionNestedLevel)) |
|
| 1132 | 1132 | { |
| 1133 | 1133 | $this->transactionNestedLevel--; |
| 1134 | 1134 | |
| 1135 | - if(!$this->transactionNestedLevel) |
|
| 1135 | + if (!$this->transactionNestedLevel) |
|
| 1136 | 1136 | { |
| 1137 | 1137 | $this->transaction_started = FALSE; |
| 1138 | 1138 | } |
@@ -1156,11 +1156,11 @@ discard block |
||
| 1156 | 1156 | */ |
| 1157 | 1157 | function commit($force = FALSE) |
| 1158 | 1158 | { |
| 1159 | - if(!$force && (!$this->isConnected() || !$this->transaction_started)) |
|
| 1159 | + if (!$force && (!$this->isConnected() || !$this->transaction_started)) |
|
| 1160 | 1160 | { |
| 1161 | 1161 | return; |
| 1162 | 1162 | } |
| 1163 | - if($this->transactionNestedLevel == 1 && $this->_commit()) |
|
| 1163 | + if ($this->transactionNestedLevel == 1 && $this->_commit()) |
|
| 1164 | 1164 | { |
| 1165 | 1165 | $this->transaction_started = FALSE; |
| 1166 | 1166 | $this->transactionNestedLevel = 0; |
@@ -1192,7 +1192,7 @@ discard block |
||
| 1192 | 1192 | */ |
| 1193 | 1193 | function _query($query, $connection = NULL) |
| 1194 | 1194 | { |
| 1195 | - if($connection == NULL) |
|
| 1195 | + if ($connection == NULL) |
|
| 1196 | 1196 | { |
| 1197 | 1197 | $connection = $this->_getConnection('master'); |
| 1198 | 1198 | } |
@@ -1217,7 +1217,7 @@ discard block |
||
| 1217 | 1217 | { |
| 1218 | 1218 | $db_info = Context::getDBInfo(); |
| 1219 | 1219 | $this->master_db = $db_info->master_db; |
| 1220 | - if($db_info->master_db["db_hostname"] == $db_info->slave_db[0]["db_hostname"] |
|
| 1220 | + if ($db_info->master_db["db_hostname"] == $db_info->slave_db[0]["db_hostname"] |
|
| 1221 | 1221 | && $db_info->master_db["db_port"] == $db_info->slave_db[0]["db_port"] |
| 1222 | 1222 | && $db_info->master_db["db_userid"] == $db_info->slave_db[0]["db_userid"] |
| 1223 | 1223 | && $db_info->master_db["db_password"] == $db_info->slave_db[0]["db_password"] |
@@ -1265,18 +1265,18 @@ discard block |
||
| 1265 | 1265 | */ |
| 1266 | 1266 | function _connect($type = 'master', $indx = 0) |
| 1267 | 1267 | { |
| 1268 | - if($this->isConnected($type, $indx)) |
|
| 1268 | + if ($this->isConnected($type, $indx)) |
|
| 1269 | 1269 | { |
| 1270 | 1270 | return; |
| 1271 | 1271 | } |
| 1272 | 1272 | |
| 1273 | 1273 | // Ignore if no DB information exists |
| 1274 | - if(!$this->_dbInfoExists()) |
|
| 1274 | + if (!$this->_dbInfoExists()) |
|
| 1275 | 1275 | { |
| 1276 | 1276 | return; |
| 1277 | 1277 | } |
| 1278 | 1278 | |
| 1279 | - if($type == 'master') |
|
| 1279 | + if ($type == 'master') |
|
| 1280 | 1280 | { |
| 1281 | 1281 | $connection = &$this->master_db; |
| 1282 | 1282 | } |
@@ -1286,7 +1286,7 @@ discard block |
||
| 1286 | 1286 | } |
| 1287 | 1287 | |
| 1288 | 1288 | $result = $this->__connect($connection); |
| 1289 | - if($result === NULL || $result === FALSE) |
|
| 1289 | + if ($result === NULL || $result === FALSE) |
|
| 1290 | 1290 | { |
| 1291 | 1291 | $connection["is_connected"] = FALSE; |
| 1292 | 1292 | return; |
@@ -1297,7 +1297,7 @@ discard block |
||
| 1297 | 1297 | $connection["is_connected"] = TRUE; |
| 1298 | 1298 | |
| 1299 | 1299 | // Save connection info for db logs |
| 1300 | - $this->connection = ucfirst($type) . ' ' . $connection["db_hostname"]; |
|
| 1300 | + $this->connection = ucfirst($type).' '.$connection["db_hostname"]; |
|
| 1301 | 1301 | |
| 1302 | 1302 | // regist $this->close callback |
| 1303 | 1303 | register_shutdown_function(array($this, "close")); |
@@ -1322,7 +1322,7 @@ discard block |
||
| 1322 | 1322 | */ |
| 1323 | 1323 | function actDBClassFinish() |
| 1324 | 1324 | { |
| 1325 | - if(!$this->query) |
|
| 1325 | + if (!$this->query) |
|
| 1326 | 1326 | { |
| 1327 | 1327 | return; |
| 1328 | 1328 | } |
@@ -1345,7 +1345,7 @@ discard block |
||
| 1345 | 1345 | function getParser($force = FALSE) |
| 1346 | 1346 | { |
| 1347 | 1347 | static $dbParser = NULL; |
| 1348 | - if(!$dbParser || $force) |
|
| 1348 | + if (!$dbParser || $force) |
|
| 1349 | 1349 | { |
| 1350 | 1350 | $oDB = DB::getInstance(); |
| 1351 | 1351 | $dbParser = $oDB->getParser(); |
@@ -318,8 +318,7 @@ discard block |
||
| 318 | 318 | if(!isset($this->priority_dbms[$a->db_type])) |
| 319 | 319 | { |
| 320 | 320 | $priority_a = 0; |
| 321 | - } |
|
| 322 | - else |
|
| 321 | + } else |
|
| 323 | 322 | { |
| 324 | 323 | $priority_a = $this->priority_dbms[$a->db_type]; |
| 325 | 324 | } |
@@ -327,8 +326,7 @@ discard block |
||
| 327 | 326 | if(!isset($this->priority_dbms[$b->db_type])) |
| 328 | 327 | { |
| 329 | 328 | $priority_b = 0; |
| 330 | - } |
|
| 331 | - else |
|
| 329 | + } else |
|
| 332 | 330 | { |
| 333 | 331 | $priority_b = $this->priority_dbms[$b->db_type]; |
| 334 | 332 | } |
@@ -362,8 +360,7 @@ discard block |
||
| 362 | 360 | if($type == 'master') |
| 363 | 361 | { |
| 364 | 362 | return $this->master_db["is_connected"] ? TRUE : FALSE; |
| 365 | - } |
|
| 366 | - else |
|
| 363 | + } else |
|
| 367 | 364 | { |
| 368 | 365 | return $this->slave_db[$indx]["is_connected"] ? TRUE : FALSE; |
| 369 | 366 | } |
@@ -441,8 +438,7 @@ discard block |
||
| 441 | 438 | $buff[] = print_r($log, TRUE); |
| 442 | 439 | @file_put_contents($log_file, implode("\n", $buff) . "\n\n", FILE_APPEND|LOCK_EX); |
| 443 | 440 | } |
| 444 | - } |
|
| 445 | - else |
|
| 441 | + } else |
|
| 446 | 442 | { |
| 447 | 443 | $log['result'] = 'Success'; |
| 448 | 444 | } |
@@ -531,8 +527,7 @@ discard block |
||
| 531 | 527 | $target = 'modules'; |
| 532 | 528 | $module = $id_args[0]; |
| 533 | 529 | $id = $id_args[1]; |
| 534 | - } |
|
| 535 | - elseif(count($id_args) == 3) |
|
| 530 | + } elseif(count($id_args) == 3) |
|
| 536 | 531 | { |
| 537 | 532 | $target = $id_args[0]; |
| 538 | 533 | $typeList = array('addons' => 1, 'widgets' => 1); |
@@ -606,7 +601,9 @@ discard block |
||
| 606 | 601 | { |
| 607 | 602 | global $lang; |
| 608 | 603 | |
| 609 | - if(!in_array($type, array('master','slave'))) $type = 'slave'; |
|
| 604 | + if(!in_array($type, array('master','slave'))) { |
|
| 605 | + $type = 'slave'; |
|
| 606 | + } |
|
| 610 | 607 | |
| 611 | 608 | if(!file_exists($cache_file)) |
| 612 | 609 | { |
@@ -652,8 +649,7 @@ discard block |
||
| 652 | 649 | if($this->isError()) |
| 653 | 650 | { |
| 654 | 651 | $output = $this->getError(); |
| 655 | - } |
|
| 656 | - else if(!is_a($output, 'BaseObject') && !is_subclass_of($output, 'BaseObject')) |
|
| 652 | + } else if(!is_a($output, 'BaseObject') && !is_subclass_of($output, 'BaseObject')) |
|
| 657 | 653 | { |
| 658 | 654 | $output = new BaseObject(); |
| 659 | 655 | } |
@@ -1068,8 +1064,7 @@ discard block |
||
| 1068 | 1064 | if($type == 'master') |
| 1069 | 1065 | { |
| 1070 | 1066 | $connection = &$this->master_db; |
| 1071 | - } |
|
| 1072 | - else |
|
| 1067 | + } else |
|
| 1073 | 1068 | { |
| 1074 | 1069 | $connection = &$this->slave_db[$indx]; |
| 1075 | 1070 | } |
@@ -1164,8 +1159,7 @@ discard block |
||
| 1164 | 1159 | { |
| 1165 | 1160 | $this->transaction_started = FALSE; |
| 1166 | 1161 | $this->transactionNestedLevel = 0; |
| 1167 | - } |
|
| 1168 | - else |
|
| 1162 | + } else |
|
| 1169 | 1163 | { |
| 1170 | 1164 | $this->transactionNestedLevel--; |
| 1171 | 1165 | } |
@@ -1225,8 +1219,7 @@ discard block |
||
| 1225 | 1219 | ) |
| 1226 | 1220 | { |
| 1227 | 1221 | $this->slave_db[0] = &$this->master_db; |
| 1228 | - } |
|
| 1229 | - else |
|
| 1222 | + } else |
|
| 1230 | 1223 | { |
| 1231 | 1224 | $this->slave_db = $db_info->slave_db; |
| 1232 | 1225 | } |
@@ -1279,8 +1272,7 @@ discard block |
||
| 1279 | 1272 | if($type == 'master') |
| 1280 | 1273 | { |
| 1281 | 1274 | $connection = &$this->master_db; |
| 1282 | - } |
|
| 1283 | - else |
|
| 1275 | + } else |
|
| 1284 | 1276 | { |
| 1285 | 1277 | $connection = &$this->slave_db[$indx]; |
| 1286 | 1278 | } |
@@ -477,7 +477,7 @@ discard block |
||
| 477 | 477 | * @param int $size column size |
| 478 | 478 | * @param string|int $default default value |
| 479 | 479 | * @param boolean $notnull not null status, default value is false |
| 480 | - * @return void |
|
| 480 | + * @return resource|null |
|
| 481 | 481 | */ |
| 482 | 482 | function addColumn($table_name, $column_name, $type = 'number', $size = '', $default = null, $notnull = FALSE) |
| 483 | 483 | { |
@@ -693,7 +693,7 @@ discard block |
||
| 693 | 693 | /** |
| 694 | 694 | * Creates a table by using xml contents |
| 695 | 695 | * @param string $xml_doc xml schema contents |
| 696 | - * @return void|object |
|
| 696 | + * @return null|resource |
|
| 697 | 697 | */ |
| 698 | 698 | function createTableByXml($xml_doc) |
| 699 | 699 | { |
@@ -703,7 +703,7 @@ discard block |
||
| 703 | 703 | /** |
| 704 | 704 | * Creates a table by using xml file path |
| 705 | 705 | * @param string $file_name xml schema file path |
| 706 | - * @return void|object |
|
| 706 | + * @return null|resource |
|
| 707 | 707 | */ |
| 708 | 708 | function createTableByXmlFile($file_name) |
| 709 | 709 | { |
@@ -723,7 +723,7 @@ discard block |
||
| 723 | 723 | * opt : notnull, default, size\n |
| 724 | 724 | * index : primary key, index, unique\n |
| 725 | 725 | * @param string $xml_doc xml schema contents |
| 726 | - * @return void|object |
|
| 726 | + * @return null|resource |
|
| 727 | 727 | */ |
| 728 | 728 | function _createTable($xml_doc) |
| 729 | 729 | { |
@@ -1125,7 +1125,7 @@ discard block |
||
| 1125 | 1125 | |
| 1126 | 1126 | /** |
| 1127 | 1127 | * If select query execute, return paging sql |
| 1128 | - * @param object $query |
|
| 1128 | + * @param BaseObject $query |
|
| 1129 | 1129 | * @param boolean $with_values |
| 1130 | 1130 | * @param int $start_count |
| 1131 | 1131 | * @param int $list_count |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | function DBCubrid($auto_connect = TRUE) |
| 53 | 53 | { |
| 54 | 54 | $this->_setDBInfo(); |
| 55 | - if($auto_connect) $this->_connect(); |
|
| 55 | + if ($auto_connect) $this->_connect(); |
|
| 56 | 56 | } |
| 57 | 57 | |
| 58 | 58 | /** |
@@ -76,21 +76,21 @@ discard block |
||
| 76 | 76 | $result = @cubrid_connect($connection["db_hostname"], $connection["db_port"], $connection["db_database"], $connection["db_userid"], $connection["db_password"]); |
| 77 | 77 | |
| 78 | 78 | // check connections |
| 79 | - if(!$result) |
|
| 79 | + if (!$result) |
|
| 80 | 80 | { |
| 81 | 81 | $this->setError(-1, 'database connect fail'); |
| 82 | 82 | return; |
| 83 | 83 | } |
| 84 | 84 | |
| 85 | - if(!defined('__CUBRID_VERSION__')) |
|
| 85 | + if (!defined('__CUBRID_VERSION__')) |
|
| 86 | 86 | { |
| 87 | 87 | $cubrid_version = cubrid_get_server_info($result); |
| 88 | 88 | $cubrid_version_elem = explode('.', $cubrid_version); |
| 89 | - $cubrid_version = $cubrid_version_elem[0] . '.' . $cubrid_version_elem[1] . '.' . $cubrid_version_elem[2]; |
|
| 89 | + $cubrid_version = $cubrid_version_elem[0].'.'.$cubrid_version_elem[1].'.'.$cubrid_version_elem[2]; |
|
| 90 | 90 | define('__CUBRID_VERSION__', $cubrid_version); |
| 91 | 91 | } |
| 92 | 92 | |
| 93 | - if(__CUBRID_VERSION__ >= '8.4.0') |
|
| 93 | + if (__CUBRID_VERSION__ >= '8.4.0') |
|
| 94 | 94 | cubrid_set_autocommit($result, CUBRID_AUTOCOMMIT_TRUE); |
| 95 | 95 | |
| 96 | 96 | return $result; |
@@ -116,13 +116,13 @@ discard block |
||
| 116 | 116 | */ |
| 117 | 117 | function addQuotes($string) |
| 118 | 118 | { |
| 119 | - if(version_compare(PHP_VERSION, "5.4.0", "<") && |
|
| 119 | + if (version_compare(PHP_VERSION, "5.4.0", "<") && |
|
| 120 | 120 | get_magic_quotes_gpc()) |
| 121 | 121 | { |
| 122 | 122 | $string = stripslashes(str_replace("\\", "\\\\", $string)); |
| 123 | 123 | } |
| 124 | 124 | |
| 125 | - if(!is_numeric($string)) |
|
| 125 | + if (!is_numeric($string)) |
|
| 126 | 126 | { |
| 127 | 127 | /* |
| 128 | 128 | if ($this->isConnected()) { |
@@ -146,17 +146,17 @@ discard block |
||
| 146 | 146 | */ |
| 147 | 147 | function _begin($transactionLevel = 0) |
| 148 | 148 | { |
| 149 | - if(__CUBRID_VERSION__ >= '8.4.0') |
|
| 149 | + if (__CUBRID_VERSION__ >= '8.4.0') |
|
| 150 | 150 | { |
| 151 | 151 | $connection = $this->_getConnection('master'); |
| 152 | 152 | |
| 153 | - if(!$transactionLevel) |
|
| 153 | + if (!$transactionLevel) |
|
| 154 | 154 | { |
| 155 | 155 | cubrid_set_autocommit($connection, CUBRID_AUTOCOMMIT_FALSE); |
| 156 | 156 | } |
| 157 | 157 | else |
| 158 | 158 | { |
| 159 | - $this->_query("SAVEPOINT SP" . $transactionLevel, $connection); |
|
| 159 | + $this->_query("SAVEPOINT SP".$transactionLevel, $connection); |
|
| 160 | 160 | } |
| 161 | 161 | } |
| 162 | 162 | return TRUE; |
@@ -173,9 +173,9 @@ discard block |
||
| 173 | 173 | |
| 174 | 174 | $point = $transactionLevel - 1; |
| 175 | 175 | |
| 176 | - if($point) |
|
| 176 | + if ($point) |
|
| 177 | 177 | { |
| 178 | - $this->_query("ROLLBACK TO SP" . $point, $connection); |
|
| 178 | + $this->_query("ROLLBACK TO SP".$point, $connection); |
|
| 179 | 179 | } |
| 180 | 180 | else |
| 181 | 181 | { |
@@ -206,29 +206,29 @@ discard block |
||
| 206 | 206 | */ |
| 207 | 207 | function __query($query, $connection) |
| 208 | 208 | { |
| 209 | - if($this->use_prepared_statements == 'Y') |
|
| 209 | + if ($this->use_prepared_statements == 'Y') |
|
| 210 | 210 | { |
| 211 | 211 | $req = @cubrid_prepare($connection, $query); |
| 212 | - if(!$req) |
|
| 212 | + if (!$req) |
|
| 213 | 213 | { |
| 214 | 214 | $this->_setError(); |
| 215 | 215 | return false; |
| 216 | 216 | } |
| 217 | 217 | |
| 218 | 218 | $position = 0; |
| 219 | - if($this->param) |
|
| 219 | + if ($this->param) |
|
| 220 | 220 | { |
| 221 | - foreach($this->param as $param) |
|
| 221 | + foreach ($this->param as $param) |
|
| 222 | 222 | { |
| 223 | 223 | $value = $param->getUnescapedValue(); |
| 224 | 224 | $type = $param->getType(); |
| 225 | 225 | |
| 226 | - if($param->isColumnName()) |
|
| 226 | + if ($param->isColumnName()) |
|
| 227 | 227 | { |
| 228 | 228 | continue; |
| 229 | 229 | } |
| 230 | 230 | |
| 231 | - switch($type) |
|
| 231 | + switch ($type) |
|
| 232 | 232 | { |
| 233 | 233 | case 'number' : |
| 234 | 234 | $bind_type = 'numeric'; |
@@ -240,12 +240,12 @@ discard block |
||
| 240 | 240 | $bind_type = 'string'; |
| 241 | 241 | } |
| 242 | 242 | |
| 243 | - if(is_array($value)) |
|
| 243 | + if (is_array($value)) |
|
| 244 | 244 | { |
| 245 | - foreach($value as $v) |
|
| 245 | + foreach ($value as $v) |
|
| 246 | 246 | { |
| 247 | 247 | $bound = @cubrid_bind($req, ++$position, $v, $bind_type); |
| 248 | - if(!$bound) |
|
| 248 | + if (!$bound) |
|
| 249 | 249 | { |
| 250 | 250 | $this->_setError(); |
| 251 | 251 | return false; |
@@ -255,7 +255,7 @@ discard block |
||
| 255 | 255 | else |
| 256 | 256 | { |
| 257 | 257 | $bound = @cubrid_bind($req, ++$position, $value, $bind_type); |
| 258 | - if(!$bound) |
|
| 258 | + if (!$bound) |
|
| 259 | 259 | { |
| 260 | 260 | $this->_setError(); |
| 261 | 261 | return false; |
@@ -265,7 +265,7 @@ discard block |
||
| 265 | 265 | } |
| 266 | 266 | |
| 267 | 267 | $result = @cubrid_execute($req); |
| 268 | - if(!$result) |
|
| 268 | + if (!$result) |
|
| 269 | 269 | { |
| 270 | 270 | $this->_setError(); |
| 271 | 271 | return false; |
@@ -275,7 +275,7 @@ discard block |
||
| 275 | 275 | // Execute the query |
| 276 | 276 | $result = @cubrid_execute($connection, $query); |
| 277 | 277 | // error check |
| 278 | - if(!$result) |
|
| 278 | + if (!$result) |
|
| 279 | 279 | { |
| 280 | 280 | $this->_setError(); |
| 281 | 281 | return false; |
@@ -306,12 +306,12 @@ discard block |
||
| 306 | 306 | function _fetch($result, $arrayIndexEndValue = NULL) |
| 307 | 307 | { |
| 308 | 308 | $output = array(); |
| 309 | - if(!$this->isConnected() || $this->isError() || !$result) |
|
| 309 | + if (!$this->isConnected() || $this->isError() || !$result) |
|
| 310 | 310 | { |
| 311 | 311 | return array(); |
| 312 | 312 | } |
| 313 | 313 | |
| 314 | - if($this->use_prepared_statements == 'Y') |
|
| 314 | + if ($this->use_prepared_statements == 'Y') |
|
| 315 | 315 | { |
| 316 | 316 | |
| 317 | 317 | } |
@@ -322,25 +322,25 @@ discard block |
||
| 322 | 322 | $col_names = cubrid_column_names($result); |
| 323 | 323 | $max = count($col_types); |
| 324 | 324 | |
| 325 | - for($count = 0; $count < $max; $count++) |
|
| 325 | + for ($count = 0; $count < $max; $count++) |
|
| 326 | 326 | { |
| 327 | - if(preg_match("/^char/", $col_types[$count]) > 0) |
|
| 327 | + if (preg_match("/^char/", $col_types[$count]) > 0) |
|
| 328 | 328 | { |
| 329 | 329 | $char_type_fields[] = $col_names[$count]; |
| 330 | 330 | } |
| 331 | 331 | } |
| 332 | 332 | |
| 333 | - while($tmp = cubrid_fetch($result, CUBRID_OBJECT)) |
|
| 333 | + while ($tmp = cubrid_fetch($result, CUBRID_OBJECT)) |
|
| 334 | 334 | { |
| 335 | - if(is_array($char_type_fields)) |
|
| 335 | + if (is_array($char_type_fields)) |
|
| 336 | 336 | { |
| 337 | - foreach($char_type_fields as $val) |
|
| 337 | + foreach ($char_type_fields as $val) |
|
| 338 | 338 | { |
| 339 | 339 | $tmp->{$val} = rtrim($tmp->{$val}); |
| 340 | 340 | } |
| 341 | 341 | } |
| 342 | 342 | |
| 343 | - if($arrayIndexEndValue) |
|
| 343 | + if ($arrayIndexEndValue) |
|
| 344 | 344 | { |
| 345 | 345 | $output[$arrayIndexEndValue--] = $tmp; |
| 346 | 346 | } |
@@ -352,15 +352,15 @@ discard block |
||
| 352 | 352 | |
| 353 | 353 | unset($char_type_fields); |
| 354 | 354 | |
| 355 | - if($result) |
|
| 355 | + if ($result) |
|
| 356 | 356 | { |
| 357 | 357 | cubrid_close_request($result); |
| 358 | 358 | } |
| 359 | 359 | |
| 360 | - if(count($output) == 1) |
|
| 360 | + if (count($output) == 1) |
|
| 361 | 361 | { |
| 362 | 362 | // If call is made for pagination, always return array |
| 363 | - if(isset($arrayIndexEndValue)) |
|
| 363 | + if (isset($arrayIndexEndValue)) |
|
| 364 | 364 | { |
| 365 | 365 | return $output; |
| 366 | 366 | } |
@@ -395,7 +395,7 @@ discard block |
||
| 395 | 395 | */ |
| 396 | 396 | function _makeSequence() |
| 397 | 397 | { |
| 398 | - if($_GLOBALS['XE_EXISTS_SEQUENCE']) |
|
| 398 | + if ($_GLOBALS['XE_EXISTS_SEQUENCE']) |
|
| 399 | 399 | return; |
| 400 | 400 | |
| 401 | 401 | // check cubrid serial |
@@ -404,21 +404,21 @@ discard block |
||
| 404 | 404 | $output = $this->_fetch($result); |
| 405 | 405 | |
| 406 | 406 | // if do not create serial |
| 407 | - if($output->count == 0) |
|
| 408 | - { |
|
| 409 | - $query = sprintf('select max("a"."srl") as "srl" from ' . |
|
| 410 | - '( select max("document_srl") as "srl" from ' . |
|
| 411 | - '"%sdocuments" UNION ' . |
|
| 412 | - 'select max("comment_srl") as "srl" from ' . |
|
| 413 | - '"%scomments" UNION ' . |
|
| 414 | - 'select max("member_srl") as "srl" from ' . |
|
| 415 | - '"%smember"' . |
|
| 407 | + if ($output->count == 0) |
|
| 408 | + { |
|
| 409 | + $query = sprintf('select max("a"."srl") as "srl" from '. |
|
| 410 | + '( select max("document_srl") as "srl" from '. |
|
| 411 | + '"%sdocuments" UNION '. |
|
| 412 | + 'select max("comment_srl") as "srl" from '. |
|
| 413 | + '"%scomments" UNION '. |
|
| 414 | + 'select max("member_srl") as "srl" from '. |
|
| 415 | + '"%smember"'. |
|
| 416 | 416 | ') as "a"', $this->prefix, $this->prefix, $this->prefix); |
| 417 | 417 | |
| 418 | 418 | $result = $this->_query($query); |
| 419 | 419 | $output = $this->_fetch($result); |
| 420 | 420 | $srl = $output->srl; |
| 421 | - if($srl < 1) |
|
| 421 | + if ($srl < 1) |
|
| 422 | 422 | { |
| 423 | 423 | $start = 1; |
| 424 | 424 | } |
@@ -442,7 +442,7 @@ discard block |
||
| 442 | 442 | */ |
| 443 | 443 | function isTableExists($target_name) |
| 444 | 444 | { |
| 445 | - if($target_name == 'sequence') |
|
| 445 | + if ($target_name == 'sequence') |
|
| 446 | 446 | { |
| 447 | 447 | $query = sprintf("select \"name\" from \"db_serial\" where \"name\" = '%s%s'", $this->prefix, $target_name); |
| 448 | 448 | } |
@@ -452,7 +452,7 @@ discard block |
||
| 452 | 452 | } |
| 453 | 453 | |
| 454 | 454 | $result = $this->_query($query); |
| 455 | - if(cubrid_num_rows($result) > 0) |
|
| 455 | + if (cubrid_num_rows($result) > 0) |
|
| 456 | 456 | { |
| 457 | 457 | $output = TRUE; |
| 458 | 458 | } |
@@ -461,7 +461,7 @@ discard block |
||
| 461 | 461 | $output = FALSE; |
| 462 | 462 | } |
| 463 | 463 | |
| 464 | - if($result) |
|
| 464 | + if ($result) |
|
| 465 | 465 | { |
| 466 | 466 | cubrid_close_request($result); |
| 467 | 467 | } |
@@ -482,22 +482,22 @@ discard block |
||
| 482 | 482 | function addColumn($table_name, $column_name, $type = 'number', $size = '', $default = null, $notnull = FALSE) |
| 483 | 483 | { |
| 484 | 484 | $type = strtoupper($this->column_type[$type]); |
| 485 | - if($type == 'INTEGER') |
|
| 485 | + if ($type == 'INTEGER') |
|
| 486 | 486 | { |
| 487 | 487 | $size = ''; |
| 488 | 488 | } |
| 489 | 489 | |
| 490 | 490 | $query = sprintf("alter class \"%s%s\" add \"%s\" ", $this->prefix, $table_name, $column_name); |
| 491 | 491 | |
| 492 | - if($type == 'char' || $type == 'varchar') |
|
| 492 | + if ($type == 'char' || $type == 'varchar') |
|
| 493 | 493 | { |
| 494 | - if($size) |
|
| 494 | + if ($size) |
|
| 495 | 495 | { |
| 496 | 496 | $size = $size * 3; |
| 497 | 497 | } |
| 498 | 498 | } |
| 499 | 499 | |
| 500 | - if($size) |
|
| 500 | + if ($size) |
|
| 501 | 501 | { |
| 502 | 502 | $query .= sprintf("%s(%s) ", $type, $size); |
| 503 | 503 | } |
@@ -506,9 +506,9 @@ discard block |
||
| 506 | 506 | $query .= sprintf("%s ", $type); |
| 507 | 507 | } |
| 508 | 508 | |
| 509 | - if(isset($default)) |
|
| 509 | + if (isset($default)) |
|
| 510 | 510 | { |
| 511 | - if($type == 'INTEGER' || $type == 'BIGINT' || $type == 'INT') |
|
| 511 | + if ($type == 'INTEGER' || $type == 'BIGINT' || $type == 'INT') |
|
| 512 | 512 | { |
| 513 | 513 | $query .= sprintf("default %d ", $default); |
| 514 | 514 | } |
@@ -518,7 +518,7 @@ discard block |
||
| 518 | 518 | } |
| 519 | 519 | } |
| 520 | 520 | |
| 521 | - if($notnull) |
|
| 521 | + if ($notnull) |
|
| 522 | 522 | { |
| 523 | 523 | $query .= "not null "; |
| 524 | 524 | } |
@@ -547,10 +547,10 @@ discard block |
||
| 547 | 547 | */ |
| 548 | 548 | function isColumnExists($table_name, $column_name) |
| 549 | 549 | { |
| 550 | - $query = sprintf("select \"attr_name\" from \"db_attribute\" where " . "\"attr_name\" ='%s' and \"class_name\" = '%s%s'", $column_name, $this->prefix, $table_name); |
|
| 550 | + $query = sprintf("select \"attr_name\" from \"db_attribute\" where "."\"attr_name\" ='%s' and \"class_name\" = '%s%s'", $column_name, $this->prefix, $table_name); |
|
| 551 | 551 | $result = $this->_query($query); |
| 552 | 552 | |
| 553 | - if(cubrid_num_rows($result) > 0) |
|
| 553 | + if (cubrid_num_rows($result) > 0) |
|
| 554 | 554 | { |
| 555 | 555 | $output = TRUE; |
| 556 | 556 | } |
@@ -559,7 +559,7 @@ discard block |
||
| 559 | 559 | $output = FALSE; |
| 560 | 560 | } |
| 561 | 561 | |
| 562 | - if($result) |
|
| 562 | + if ($result) |
|
| 563 | 563 | { |
| 564 | 564 | cubrid_close_request($result); |
| 565 | 565 | } |
@@ -579,12 +579,12 @@ discard block |
||
| 579 | 579 | */ |
| 580 | 580 | function addIndex($table_name, $index_name, $target_columns, $is_unique = FALSE) |
| 581 | 581 | { |
| 582 | - if(!is_array($target_columns)) |
|
| 582 | + if (!is_array($target_columns)) |
|
| 583 | 583 | { |
| 584 | 584 | $target_columns = array($target_columns); |
| 585 | 585 | } |
| 586 | 586 | |
| 587 | - $query = sprintf("create %s index \"%s\" on \"%s%s\" (%s);", $is_unique ? 'unique' : '', $index_name, $this->prefix, $table_name, '"' . implode('","', $target_columns) . '"'); |
|
| 587 | + $query = sprintf("create %s index \"%s\" on \"%s%s\" (%s);", $is_unique ? 'unique' : '', $index_name, $this->prefix, $table_name, '"'.implode('","', $target_columns).'"'); |
|
| 588 | 588 | |
| 589 | 589 | $this->_query($query); |
| 590 | 590 | } |
@@ -611,17 +611,17 @@ discard block |
||
| 611 | 611 | */ |
| 612 | 612 | function isIndexExists($table_name, $index_name) |
| 613 | 613 | { |
| 614 | - $query = sprintf("select \"index_name\" from \"db_index\" where " . "\"class_name\" = '%s%s' and (\"index_name\" = '%s' or \"index_name\" = '%s') ", $this->prefix, $table_name, $this->prefix . $index_name, $index_name); |
|
| 614 | + $query = sprintf("select \"index_name\" from \"db_index\" where "."\"class_name\" = '%s%s' and (\"index_name\" = '%s' or \"index_name\" = '%s') ", $this->prefix, $table_name, $this->prefix.$index_name, $index_name); |
|
| 615 | 615 | $result = $this->_query($query); |
| 616 | 616 | |
| 617 | - if($this->isError()) |
|
| 617 | + if ($this->isError()) |
|
| 618 | 618 | { |
| 619 | 619 | return FALSE; |
| 620 | 620 | } |
| 621 | 621 | |
| 622 | 622 | $output = $this->_fetch($result); |
| 623 | 623 | |
| 624 | - if(!$output) |
|
| 624 | + if (!$output) |
|
| 625 | 625 | { |
| 626 | 626 | return FALSE; |
| 627 | 627 | } |
@@ -653,25 +653,25 @@ discard block |
||
| 653 | 653 | ", strlen($this->prefix) |
| 654 | 654 | , $this->prefix |
| 655 | 655 | , strlen($this->prefix) + 1 |
| 656 | - , "'" . $this->prefix . '%' . "'" |
|
| 656 | + , "'".$this->prefix.'%'."'" |
|
| 657 | 657 | , strlen($this->prefix) |
| 658 | 658 | , $this->prefix |
| 659 | 659 | , strlen($this->prefix) + 1 |
| 660 | 660 | ); |
| 661 | 661 | $result = $this->_query($query); |
| 662 | 662 | |
| 663 | - if($this->isError()) |
|
| 663 | + if ($this->isError()) |
|
| 664 | 664 | { |
| 665 | 665 | return FALSE; |
| 666 | 666 | } |
| 667 | 667 | |
| 668 | 668 | $output = $this->_fetch($result); |
| 669 | - if(!$output) |
|
| 669 | + if (!$output) |
|
| 670 | 670 | { |
| 671 | 671 | return FALSE; |
| 672 | 672 | } |
| 673 | 673 | |
| 674 | - if(!is_array($output)) |
|
| 674 | + if (!is_array($output)) |
|
| 675 | 675 | { |
| 676 | 676 | $indexes_to_be_deleted = array($output); |
| 677 | 677 | } |
@@ -680,10 +680,10 @@ discard block |
||
| 680 | 680 | $indexes_to_be_deleted = $output; |
| 681 | 681 | } |
| 682 | 682 | |
| 683 | - foreach($indexes_to_be_deleted as $index) |
|
| 683 | + foreach ($indexes_to_be_deleted as $index) |
|
| 684 | 684 | { |
| 685 | 685 | $this->dropIndex(substr($index->class_name, strlen($this->prefix)) |
| 686 | - , $this->prefix . $index->unprefixed_index_name |
|
| 686 | + , $this->prefix.$index->unprefixed_index_name |
|
| 687 | 687 | , $index->is_unique == 'YES' ? TRUE : FALSE); |
| 688 | 688 | } |
| 689 | 689 | |
@@ -707,7 +707,7 @@ discard block |
||
| 707 | 707 | */ |
| 708 | 708 | function createTableByXmlFile($file_name) |
| 709 | 709 | { |
| 710 | - if(!file_exists($file_name)) |
|
| 710 | + if (!file_exists($file_name)) |
|
| 711 | 711 | { |
| 712 | 712 | return; |
| 713 | 713 | } |
@@ -734,28 +734,28 @@ discard block |
||
| 734 | 734 | $table_name = $xml_obj->table->attrs->name; |
| 735 | 735 | |
| 736 | 736 | // if the table already exists exit function |
| 737 | - if($this->isTableExists($table_name)) |
|
| 737 | + if ($this->isTableExists($table_name)) |
|
| 738 | 738 | { |
| 739 | 739 | return; |
| 740 | 740 | } |
| 741 | 741 | |
| 742 | 742 | // If the table name is sequence, it creates a serial |
| 743 | - if($table_name == 'sequence') |
|
| 743 | + if ($table_name == 'sequence') |
|
| 744 | 744 | { |
| 745 | - $query = sprintf('create serial "%s" start with 1 increment by 1' . |
|
| 746 | - ' minvalue 1 ' . |
|
| 747 | - 'maxvalue 10000000000000000000000000000000000000' . ' nocycle;', $this->prefix . $table_name); |
|
| 745 | + $query = sprintf('create serial "%s" start with 1 increment by 1'. |
|
| 746 | + ' minvalue 1 '. |
|
| 747 | + 'maxvalue 10000000000000000000000000000000000000'.' nocycle;', $this->prefix.$table_name); |
|
| 748 | 748 | |
| 749 | 749 | return $this->_query($query); |
| 750 | 750 | } |
| 751 | 751 | |
| 752 | 752 | |
| 753 | - $table_name = $this->prefix . $table_name; |
|
| 753 | + $table_name = $this->prefix.$table_name; |
|
| 754 | 754 | |
| 755 | 755 | $query = sprintf('create class "%s";', $table_name); |
| 756 | 756 | $this->_query($query); |
| 757 | 757 | |
| 758 | - if(!is_array($xml_obj->table->column)) |
|
| 758 | + if (!is_array($xml_obj->table->column)) |
|
| 759 | 759 | { |
| 760 | 760 | $columns[] = $xml_obj->table->column; |
| 761 | 761 | } |
@@ -770,7 +770,7 @@ discard block |
||
| 770 | 770 | $unique_list = array(); |
| 771 | 771 | $index_list = array(); |
| 772 | 772 | |
| 773 | - foreach($columns as $column) |
|
| 773 | + foreach ($columns as $column) |
|
| 774 | 774 | { |
| 775 | 775 | $name = $column->attrs->name; |
| 776 | 776 | $type = $column->attrs->type; |
@@ -781,7 +781,7 @@ discard block |
||
| 781 | 781 | $unique = $column->attrs->unique; |
| 782 | 782 | $default = $column->attrs->default; |
| 783 | 783 | |
| 784 | - switch($this->column_type[$type]) |
|
| 784 | + switch ($this->column_type[$type]) |
|
| 785 | 785 | { |
| 786 | 786 | case 'integer' : |
| 787 | 787 | $size = NULL; |
@@ -791,58 +791,58 @@ discard block |
||
| 791 | 791 | break; |
| 792 | 792 | } |
| 793 | 793 | |
| 794 | - if(isset($default) && ($type == 'varchar' || $type == 'char' || |
|
| 794 | + if (isset($default) && ($type == 'varchar' || $type == 'char' || |
|
| 795 | 795 | $type == 'text' || $type == 'tinytext' || $type == 'bigtext')) |
| 796 | 796 | { |
| 797 | 797 | $default = sprintf("'%s'", $default); |
| 798 | 798 | } |
| 799 | 799 | |
| 800 | - if($type == 'varchar' || $type == 'char') |
|
| 800 | + if ($type == 'varchar' || $type == 'char') |
|
| 801 | 801 | { |
| 802 | - if($size) |
|
| 802 | + if ($size) |
|
| 803 | 803 | $size = $size * 3; |
| 804 | 804 | } |
| 805 | 805 | |
| 806 | 806 | |
| 807 | - $column_schema[] = sprintf('"%s" %s%s %s %s', $name, $this->column_type[$type], $size ? '(' . $size . ')' : '', isset($default) ? "default " . $default : '', $notnull ? 'not null' : ''); |
|
| 807 | + $column_schema[] = sprintf('"%s" %s%s %s %s', $name, $this->column_type[$type], $size ? '('.$size.')' : '', isset($default) ? "default ".$default : '', $notnull ? 'not null' : ''); |
|
| 808 | 808 | |
| 809 | - if($primary_key) |
|
| 809 | + if ($primary_key) |
|
| 810 | 810 | { |
| 811 | 811 | $primary_list[] = $name; |
| 812 | 812 | } |
| 813 | - else if($unique) |
|
| 813 | + else if ($unique) |
|
| 814 | 814 | { |
| 815 | 815 | $unique_list[$unique][] = $name; |
| 816 | 816 | } |
| 817 | - else if($index) |
|
| 817 | + else if ($index) |
|
| 818 | 818 | { |
| 819 | 819 | $index_list[$index][] = $name; |
| 820 | 820 | } |
| 821 | 821 | } |
| 822 | 822 | |
| 823 | - $query .= implode(',', $column_schema) . ';'; |
|
| 823 | + $query .= implode(',', $column_schema).';'; |
|
| 824 | 824 | $this->_query($query); |
| 825 | 825 | |
| 826 | - if(count($primary_list)) |
|
| 826 | + if (count($primary_list)) |
|
| 827 | 827 | { |
| 828 | - $query = sprintf("alter class \"%s\" add attribute constraint " . "\"pkey_%s\" PRIMARY KEY(%s);", $table_name, $table_name, '"' . implode('","', $primary_list) . '"'); |
|
| 828 | + $query = sprintf("alter class \"%s\" add attribute constraint "."\"pkey_%s\" PRIMARY KEY(%s);", $table_name, $table_name, '"'.implode('","', $primary_list).'"'); |
|
| 829 | 829 | $this->_query($query); |
| 830 | 830 | } |
| 831 | 831 | |
| 832 | - if(count($unique_list)) |
|
| 832 | + if (count($unique_list)) |
|
| 833 | 833 | { |
| 834 | - foreach($unique_list as $key => $val) |
|
| 834 | + foreach ($unique_list as $key => $val) |
|
| 835 | 835 | { |
| 836 | - $query = sprintf("create unique index \"%s\" on \"%s\" " . "(%s);", $key, $table_name, '"' . implode('","', $val) . '"'); |
|
| 836 | + $query = sprintf("create unique index \"%s\" on \"%s\" "."(%s);", $key, $table_name, '"'.implode('","', $val).'"'); |
|
| 837 | 837 | $this->_query($query); |
| 838 | 838 | } |
| 839 | 839 | } |
| 840 | 840 | |
| 841 | - if(count($index_list)) |
|
| 841 | + if (count($index_list)) |
|
| 842 | 842 | { |
| 843 | - foreach($index_list as $key => $val) |
|
| 843 | + foreach ($index_list as $key => $val) |
|
| 844 | 844 | { |
| 845 | - $query = sprintf("create index \"%s\" on \"%s\" (%s);", $key, $table_name, '"' . implode('","', $val) . '"'); |
|
| 845 | + $query = sprintf("create index \"%s\" on \"%s\" (%s);", $key, $table_name, '"'.implode('","', $val).'"'); |
|
| 846 | 846 | $this->_query($query); |
| 847 | 847 | } |
| 848 | 848 | } |
@@ -856,22 +856,22 @@ discard block |
||
| 856 | 856 | */ |
| 857 | 857 | function _executeInsertAct($queryObject, $with_values = TRUE) |
| 858 | 858 | { |
| 859 | - if($this->use_prepared_statements == 'Y') |
|
| 859 | + if ($this->use_prepared_statements == 'Y') |
|
| 860 | 860 | { |
| 861 | 861 | $this->param = $queryObject->getArguments(); |
| 862 | 862 | $with_values = FALSE; |
| 863 | 863 | } |
| 864 | 864 | $query = $this->getInsertSql($queryObject, $with_values); |
| 865 | - if(is_a($query, 'BaseObject')) |
|
| 865 | + if (is_a($query, 'BaseObject')) |
|
| 866 | 866 | { |
| 867 | 867 | unset($this->param); |
| 868 | 868 | return; |
| 869 | 869 | } |
| 870 | 870 | |
| 871 | - $query .= (__DEBUG_QUERY__ & 1 && $this->query_id) ? sprintf(' ' . $this->comment_syntax, $this->query_id) : ''; |
|
| 871 | + $query .= (__DEBUG_QUERY__ & 1 && $this->query_id) ? sprintf(' '.$this->comment_syntax, $this->query_id) : ''; |
|
| 872 | 872 | |
| 873 | 873 | $result = $this->_query($query); |
| 874 | - if($result && !$this->transaction_started) |
|
| 874 | + if ($result && !$this->transaction_started) |
|
| 875 | 875 | { |
| 876 | 876 | $this->_commit(); |
| 877 | 877 | } |
@@ -887,23 +887,23 @@ discard block |
||
| 887 | 887 | */ |
| 888 | 888 | function _executeUpdateAct($queryObject, $with_values = TRUE) |
| 889 | 889 | { |
| 890 | - if($this->use_prepared_statements == 'Y') |
|
| 890 | + if ($this->use_prepared_statements == 'Y') |
|
| 891 | 891 | { |
| 892 | 892 | $this->param = $queryObject->getArguments(); |
| 893 | 893 | $with_values = FALSE; |
| 894 | 894 | } |
| 895 | 895 | $query = $this->getUpdateSql($queryObject, $with_values); |
| 896 | - if(is_a($query, 'BaseObject')) |
|
| 896 | + if (is_a($query, 'BaseObject')) |
|
| 897 | 897 | { |
| 898 | 898 | unset($this->param); |
| 899 | 899 | return; |
| 900 | 900 | } |
| 901 | 901 | |
| 902 | - $query .= (__DEBUG_QUERY__ & 1 && $this->query_id) ? sprintf(' ' . $this->comment_syntax, $this->query_id) : ''; |
|
| 902 | + $query .= (__DEBUG_QUERY__ & 1 && $this->query_id) ? sprintf(' '.$this->comment_syntax, $this->query_id) : ''; |
|
| 903 | 903 | |
| 904 | 904 | $result = $this->_query($query); |
| 905 | 905 | |
| 906 | - if($result && !$this->transaction_started) |
|
| 906 | + if ($result && !$this->transaction_started) |
|
| 907 | 907 | { |
| 908 | 908 | $this->_commit(); |
| 909 | 909 | } |
@@ -919,23 +919,23 @@ discard block |
||
| 919 | 919 | */ |
| 920 | 920 | function _executeDeleteAct($queryObject, $with_values = TRUE) |
| 921 | 921 | { |
| 922 | - if($this->use_prepared_statements == 'Y') |
|
| 922 | + if ($this->use_prepared_statements == 'Y') |
|
| 923 | 923 | { |
| 924 | 924 | $this->param = $queryObject->getArguments(); |
| 925 | 925 | $with_values = FALSE; |
| 926 | 926 | } |
| 927 | 927 | $query = $this->getDeleteSql($queryObject, $with_values); |
| 928 | - if(is_a($query, 'BaseObject')) |
|
| 928 | + if (is_a($query, 'BaseObject')) |
|
| 929 | 929 | { |
| 930 | 930 | unset($this->param); |
| 931 | 931 | return; |
| 932 | 932 | } |
| 933 | 933 | |
| 934 | - $query .= (__DEBUG_QUERY__ & 1 && $this->query_id) ? sprintf(' ' . $this->comment_syntax, $this->query_id) : ''; |
|
| 934 | + $query .= (__DEBUG_QUERY__ & 1 && $this->query_id) ? sprintf(' '.$this->comment_syntax, $this->query_id) : ''; |
|
| 935 | 935 | |
| 936 | 936 | $result = $this->_query($query); |
| 937 | 937 | |
| 938 | - if($result && !$this->transaction_started) |
|
| 938 | + if ($result && !$this->transaction_started) |
|
| 939 | 939 | { |
| 940 | 940 | $this->_commit(); |
| 941 | 941 | } |
@@ -955,29 +955,29 @@ discard block |
||
| 955 | 955 | */ |
| 956 | 956 | function _executeSelectAct($queryObject, $connection = NULL, $with_values = TRUE) |
| 957 | 957 | { |
| 958 | - if($this->use_prepared_statements == 'Y') |
|
| 958 | + if ($this->use_prepared_statements == 'Y') |
|
| 959 | 959 | { |
| 960 | 960 | $this->param = $queryObject->getArguments(); |
| 961 | 961 | $with_values = FALSE; |
| 962 | 962 | } |
| 963 | 963 | $limit = $queryObject->getLimit(); |
| 964 | - if($limit && $limit->isPageHandler()) |
|
| 964 | + if ($limit && $limit->isPageHandler()) |
|
| 965 | 965 | { |
| 966 | 966 | return $this->queryPageLimit($queryObject, $connection, $with_values); |
| 967 | 967 | } |
| 968 | 968 | else |
| 969 | 969 | { |
| 970 | 970 | $query = $this->getSelectSql($queryObject, $with_values); |
| 971 | - if(is_a($query, 'BaseObject')) |
|
| 971 | + if (is_a($query, 'BaseObject')) |
|
| 972 | 972 | { |
| 973 | 973 | unset($this->param); |
| 974 | 974 | return; |
| 975 | 975 | } |
| 976 | 976 | |
| 977 | - $query .= (__DEBUG_QUERY__ & 1 && $this->query_id) ? sprintf(' ' . $this->comment_syntax, $this->query_id) : ''; |
|
| 977 | + $query .= (__DEBUG_QUERY__ & 1 && $this->query_id) ? sprintf(' '.$this->comment_syntax, $this->query_id) : ''; |
|
| 978 | 978 | $result = $this->_query($query, $connection); |
| 979 | 979 | |
| 980 | - if($this->isError()) |
|
| 980 | + if ($this->isError()) |
|
| 981 | 981 | { |
| 982 | 982 | unset($this->param); |
| 983 | 983 | return $this->queryError($queryObject); |
@@ -1000,16 +1000,16 @@ discard block |
||
| 1000 | 1000 | function queryError($queryObject) |
| 1001 | 1001 | { |
| 1002 | 1002 | $limit = $queryObject->getLimit(); |
| 1003 | - if($limit && $limit->isPageHandler()) |
|
| 1003 | + if ($limit && $limit->isPageHandler()) |
|
| 1004 | 1004 | { |
| 1005 | - $buff = new BaseObject (); |
|
| 1005 | + $buff = new BaseObject(); |
|
| 1006 | 1006 | $buff->total_count = 0; |
| 1007 | 1007 | $buff->total_page = 0; |
| 1008 | 1008 | $buff->page = 1; |
| 1009 | 1009 | $buff->data = array(); |
| 1010 | 1010 | $buff->page_navigation = new PageHandler(/* $total_count */0, /* $total_page */1, /* $page */1, /* $page_count */10); //default page handler values |
| 1011 | 1011 | return $buff; |
| 1012 | - }else |
|
| 1012 | + } else |
|
| 1013 | 1013 | return; |
| 1014 | 1014 | } |
| 1015 | 1015 | |
@@ -1025,48 +1025,48 @@ discard block |
||
| 1025 | 1025 | $limit = $queryObject->getLimit(); |
| 1026 | 1026 | // Total count |
| 1027 | 1027 | $temp_where = $queryObject->getWhereString($with_values, FALSE); |
| 1028 | - $count_query = sprintf('select count(*) as "count" %s %s', 'FROM ' . $queryObject->getFromString($with_values), ($temp_where === '' ? '' : ' WHERE ' . $temp_where)); |
|
| 1028 | + $count_query = sprintf('select count(*) as "count" %s %s', 'FROM '.$queryObject->getFromString($with_values), ($temp_where === '' ? '' : ' WHERE '.$temp_where)); |
|
| 1029 | 1029 | |
| 1030 | 1030 | // Check for distinct query and if found update count query structure |
| 1031 | 1031 | $temp_select = $queryObject->getSelectString($with_values); |
| 1032 | 1032 | $uses_distinct = stripos($temp_select, "distinct") !== FALSE; |
| 1033 | 1033 | $uses_groupby = $queryObject->getGroupByString() != ''; |
| 1034 | - if($uses_distinct || $uses_groupby) |
|
| 1034 | + if ($uses_distinct || $uses_groupby) |
|
| 1035 | 1035 | { |
| 1036 | 1036 | $count_query = sprintf('select %s %s %s %s' |
| 1037 | 1037 | , $temp_select |
| 1038 | - , 'FROM ' . $queryObject->getFromString($with_values) |
|
| 1039 | - , ($temp_where === '' ? '' : ' WHERE ' . $temp_where) |
|
| 1040 | - , ($uses_groupby ? ' GROUP BY ' . $queryObject->getGroupByString() : '') |
|
| 1038 | + , 'FROM '.$queryObject->getFromString($with_values) |
|
| 1039 | + , ($temp_where === '' ? '' : ' WHERE '.$temp_where) |
|
| 1040 | + , ($uses_groupby ? ' GROUP BY '.$queryObject->getGroupByString() : '') |
|
| 1041 | 1041 | ); |
| 1042 | 1042 | |
| 1043 | 1043 | // If query uses grouping or distinct, count from original select |
| 1044 | 1044 | $count_query = sprintf('select count(*) as "count" from (%s) xet', $count_query); |
| 1045 | 1045 | } |
| 1046 | 1046 | |
| 1047 | - $count_query .= (__DEBUG_QUERY__ & 1 && $queryObject->queryID) ? sprintf(' ' . $this->comment_syntax, $queryObject->queryID) : ''; |
|
| 1047 | + $count_query .= (__DEBUG_QUERY__ & 1 && $queryObject->queryID) ? sprintf(' '.$this->comment_syntax, $queryObject->queryID) : ''; |
|
| 1048 | 1048 | $result = $this->_query($count_query, $connection); |
| 1049 | 1049 | $count_output = $this->_fetch($result); |
| 1050 | 1050 | $total_count = (int) (isset($count_output->count) ? $count_output->count : NULL); |
| 1051 | 1051 | |
| 1052 | 1052 | $list_count = $limit->list_count->getValue(); |
| 1053 | - if(!$list_count) |
|
| 1053 | + if (!$list_count) |
|
| 1054 | 1054 | { |
| 1055 | 1055 | $list_count = 20; |
| 1056 | 1056 | } |
| 1057 | 1057 | $page_count = $limit->page_count->getValue(); |
| 1058 | - if(!$page_count) |
|
| 1058 | + if (!$page_count) |
|
| 1059 | 1059 | { |
| 1060 | 1060 | $page_count = 10; |
| 1061 | 1061 | } |
| 1062 | 1062 | $page = $limit->page->getValue(); |
| 1063 | - if(!$page || $page < 1) |
|
| 1063 | + if (!$page || $page < 1) |
|
| 1064 | 1064 | { |
| 1065 | 1065 | $page = 1; |
| 1066 | 1066 | } |
| 1067 | 1067 | |
| 1068 | 1068 | // total pages |
| 1069 | - if($total_count) |
|
| 1069 | + if ($total_count) |
|
| 1070 | 1070 | { |
| 1071 | 1071 | $total_page = (int) (($total_count - 1) / $list_count) + 1; |
| 1072 | 1072 | } |
@@ -1076,7 +1076,7 @@ discard block |
||
| 1076 | 1076 | } |
| 1077 | 1077 | |
| 1078 | 1078 | // check the page variables |
| 1079 | - if($page > $total_page) |
|
| 1079 | + if ($page > $total_page) |
|
| 1080 | 1080 | { |
| 1081 | 1081 | // If requested page is bigger than total number of pages, return empty list |
| 1082 | 1082 | |
@@ -1092,9 +1092,9 @@ discard block |
||
| 1092 | 1092 | $start_count = ($page - 1) * $list_count; |
| 1093 | 1093 | |
| 1094 | 1094 | $query = $this->getSelectPageSql($queryObject, $with_values, $start_count, $list_count); |
| 1095 | - $query .= (__DEBUG_QUERY__ & 1 && $queryObject->query_id) ? sprintf(' ' . $this->comment_syntax, $this->query_id) : ''; |
|
| 1095 | + $query .= (__DEBUG_QUERY__ & 1 && $queryObject->query_id) ? sprintf(' '.$this->comment_syntax, $this->query_id) : ''; |
|
| 1096 | 1096 | $result = $this->_query($query, $connection); |
| 1097 | - if($this->isError()) |
|
| 1097 | + if ($this->isError()) |
|
| 1098 | 1098 | { |
| 1099 | 1099 | unset($this->param); |
| 1100 | 1100 | return $this->queryError($queryObject); |
@@ -1135,44 +1135,44 @@ discard block |
||
| 1135 | 1135 | { |
| 1136 | 1136 | |
| 1137 | 1137 | $select = $query->getSelectString($with_values); |
| 1138 | - if($select == '') |
|
| 1138 | + if ($select == '') |
|
| 1139 | 1139 | { |
| 1140 | 1140 | return new BaseObject(-1, "Invalid query"); |
| 1141 | 1141 | } |
| 1142 | - $select = 'SELECT ' . $select; |
|
| 1142 | + $select = 'SELECT '.$select; |
|
| 1143 | 1143 | |
| 1144 | 1144 | $from = $query->getFromString($with_values); |
| 1145 | - if($from == '') |
|
| 1145 | + if ($from == '') |
|
| 1146 | 1146 | { |
| 1147 | 1147 | return new BaseObject(-1, "Invalid query"); |
| 1148 | 1148 | } |
| 1149 | - $from = ' FROM ' . $from; |
|
| 1149 | + $from = ' FROM '.$from; |
|
| 1150 | 1150 | |
| 1151 | 1151 | $where = $query->getWhereString($with_values); |
| 1152 | - if($where != '') |
|
| 1152 | + if ($where != '') |
|
| 1153 | 1153 | { |
| 1154 | - $where = ' WHERE ' . $where; |
|
| 1154 | + $where = ' WHERE '.$where; |
|
| 1155 | 1155 | } |
| 1156 | 1156 | |
| 1157 | 1157 | $groupBy = $query->getGroupByString(); |
| 1158 | - if($groupBy != '') |
|
| 1158 | + if ($groupBy != '') |
|
| 1159 | 1159 | { |
| 1160 | - $groupBy = ' GROUP BY ' . $groupBy; |
|
| 1160 | + $groupBy = ' GROUP BY '.$groupBy; |
|
| 1161 | 1161 | } |
| 1162 | 1162 | |
| 1163 | 1163 | $orderBy = $query->getOrderByString(); |
| 1164 | - if($orderBy != '') |
|
| 1164 | + if ($orderBy != '') |
|
| 1165 | 1165 | { |
| 1166 | - $orderBy = ' ORDER BY ' . $orderBy; |
|
| 1166 | + $orderBy = ' ORDER BY '.$orderBy; |
|
| 1167 | 1167 | } |
| 1168 | 1168 | |
| 1169 | 1169 | $limit = $query->getLimitString(); |
| 1170 | - if($limit != '') |
|
| 1170 | + if ($limit != '') |
|
| 1171 | 1171 | { |
| 1172 | 1172 | $limit = sprintf(' LIMIT %d, %d', $start_count, $list_count); |
| 1173 | 1173 | } |
| 1174 | 1174 | |
| 1175 | - return $select . ' ' . $from . ' ' . $where . ' ' . $groupBy . ' ' . $orderBy . ' ' . $limit; |
|
| 1175 | + return $select.' '.$from.' '.$where.' '.$groupBy.' '.$orderBy.' '.$limit; |
|
| 1176 | 1176 | } |
| 1177 | 1177 | |
| 1178 | 1178 | } |
@@ -52,7 +52,9 @@ discard block |
||
| 52 | 52 | function DBCubrid($auto_connect = TRUE) |
| 53 | 53 | { |
| 54 | 54 | $this->_setDBInfo(); |
| 55 | - if($auto_connect) $this->_connect(); |
|
| 55 | + if($auto_connect) { |
|
| 56 | + $this->_connect(); |
|
| 57 | + } |
|
| 56 | 58 | } |
| 57 | 59 | |
| 58 | 60 | /** |
@@ -90,8 +92,9 @@ discard block |
||
| 90 | 92 | define('__CUBRID_VERSION__', $cubrid_version); |
| 91 | 93 | } |
| 92 | 94 | |
| 93 | - if(__CUBRID_VERSION__ >= '8.4.0') |
|
| 94 | - cubrid_set_autocommit($result, CUBRID_AUTOCOMMIT_TRUE); |
|
| 95 | + if(__CUBRID_VERSION__ >= '8.4.0') { |
|
| 96 | + cubrid_set_autocommit($result, CUBRID_AUTOCOMMIT_TRUE); |
|
| 97 | + } |
|
| 95 | 98 | |
| 96 | 99 | return $result; |
| 97 | 100 | } |
@@ -153,8 +156,7 @@ discard block |
||
| 153 | 156 | if(!$transactionLevel) |
| 154 | 157 | { |
| 155 | 158 | cubrid_set_autocommit($connection, CUBRID_AUTOCOMMIT_FALSE); |
| 156 | - } |
|
| 157 | - else |
|
| 159 | + } else |
|
| 158 | 160 | { |
| 159 | 161 | $this->_query("SAVEPOINT SP" . $transactionLevel, $connection); |
| 160 | 162 | } |
@@ -176,8 +178,7 @@ discard block |
||
| 176 | 178 | if($point) |
| 177 | 179 | { |
| 178 | 180 | $this->_query("ROLLBACK TO SP" . $point, $connection); |
| 179 | - } |
|
| 180 | - else |
|
| 181 | + } else |
|
| 181 | 182 | { |
| 182 | 183 | @cubrid_rollback($connection); |
| 183 | 184 | } |
@@ -251,8 +252,7 @@ discard block |
||
| 251 | 252 | return false; |
| 252 | 253 | } |
| 253 | 254 | } |
| 254 | - } |
|
| 255 | - else |
|
| 255 | + } else |
|
| 256 | 256 | { |
| 257 | 257 | $bound = @cubrid_bind($req, ++$position, $value, $bind_type); |
| 258 | 258 | if(!$bound) |
@@ -343,8 +343,7 @@ discard block |
||
| 343 | 343 | if($arrayIndexEndValue) |
| 344 | 344 | { |
| 345 | 345 | $output[$arrayIndexEndValue--] = $tmp; |
| 346 | - } |
|
| 347 | - else |
|
| 346 | + } else |
|
| 348 | 347 | { |
| 349 | 348 | $output[] = $tmp; |
| 350 | 349 | } |
@@ -395,8 +394,9 @@ discard block |
||
| 395 | 394 | */ |
| 396 | 395 | function _makeSequence() |
| 397 | 396 | { |
| 398 | - if($_GLOBALS['XE_EXISTS_SEQUENCE']) |
|
| 399 | - return; |
|
| 397 | + if($_GLOBALS['XE_EXISTS_SEQUENCE']) { |
|
| 398 | + return; |
|
| 399 | + } |
|
| 400 | 400 | |
| 401 | 401 | // check cubrid serial |
| 402 | 402 | $query = sprintf('select count(*) as "count" from "db_serial" where name=\'%ssequence\'', $this->prefix); |
@@ -421,8 +421,7 @@ discard block |
||
| 421 | 421 | if($srl < 1) |
| 422 | 422 | { |
| 423 | 423 | $start = 1; |
| 424 | - } |
|
| 425 | - else |
|
| 424 | + } else |
|
| 426 | 425 | { |
| 427 | 426 | $start = $srl + 1000000; |
| 428 | 427 | } |
@@ -445,8 +444,7 @@ discard block |
||
| 445 | 444 | if($target_name == 'sequence') |
| 446 | 445 | { |
| 447 | 446 | $query = sprintf("select \"name\" from \"db_serial\" where \"name\" = '%s%s'", $this->prefix, $target_name); |
| 448 | - } |
|
| 449 | - else |
|
| 447 | + } else |
|
| 450 | 448 | { |
| 451 | 449 | $query = sprintf("select \"class_name\" from \"db_class\" where \"class_name\" = '%s%s'", $this->prefix, $target_name); |
| 452 | 450 | } |
@@ -455,8 +453,7 @@ discard block |
||
| 455 | 453 | if(cubrid_num_rows($result) > 0) |
| 456 | 454 | { |
| 457 | 455 | $output = TRUE; |
| 458 | - } |
|
| 459 | - else |
|
| 456 | + } else |
|
| 460 | 457 | { |
| 461 | 458 | $output = FALSE; |
| 462 | 459 | } |
@@ -500,8 +497,7 @@ discard block |
||
| 500 | 497 | if($size) |
| 501 | 498 | { |
| 502 | 499 | $query .= sprintf("%s(%s) ", $type, $size); |
| 503 | - } |
|
| 504 | - else |
|
| 500 | + } else |
|
| 505 | 501 | { |
| 506 | 502 | $query .= sprintf("%s ", $type); |
| 507 | 503 | } |
@@ -511,8 +507,7 @@ discard block |
||
| 511 | 507 | if($type == 'INTEGER' || $type == 'BIGINT' || $type == 'INT') |
| 512 | 508 | { |
| 513 | 509 | $query .= sprintf("default %d ", $default); |
| 514 | - } |
|
| 515 | - else |
|
| 510 | + } else |
|
| 516 | 511 | { |
| 517 | 512 | $query .= sprintf("default '%s' ", $default); |
| 518 | 513 | } |
@@ -553,8 +548,7 @@ discard block |
||
| 553 | 548 | if(cubrid_num_rows($result) > 0) |
| 554 | 549 | { |
| 555 | 550 | $output = TRUE; |
| 556 | - } |
|
| 557 | - else |
|
| 551 | + } else |
|
| 558 | 552 | { |
| 559 | 553 | $output = FALSE; |
| 560 | 554 | } |
@@ -674,8 +668,7 @@ discard block |
||
| 674 | 668 | if(!is_array($output)) |
| 675 | 669 | { |
| 676 | 670 | $indexes_to_be_deleted = array($output); |
| 677 | - } |
|
| 678 | - else |
|
| 671 | + } else |
|
| 679 | 672 | { |
| 680 | 673 | $indexes_to_be_deleted = $output; |
| 681 | 674 | } |
@@ -758,8 +751,7 @@ discard block |
||
| 758 | 751 | if(!is_array($xml_obj->table->column)) |
| 759 | 752 | { |
| 760 | 753 | $columns[] = $xml_obj->table->column; |
| 761 | - } |
|
| 762 | - else |
|
| 754 | + } else |
|
| 763 | 755 | { |
| 764 | 756 | $columns = $xml_obj->table->column; |
| 765 | 757 | } |
@@ -799,8 +791,9 @@ discard block |
||
| 799 | 791 | |
| 800 | 792 | if($type == 'varchar' || $type == 'char') |
| 801 | 793 | { |
| 802 | - if($size) |
|
| 803 | - $size = $size * 3; |
|
| 794 | + if($size) { |
|
| 795 | + $size = $size * 3; |
|
| 796 | + } |
|
| 804 | 797 | } |
| 805 | 798 | |
| 806 | 799 | |
@@ -809,12 +802,10 @@ discard block |
||
| 809 | 802 | if($primary_key) |
| 810 | 803 | { |
| 811 | 804 | $primary_list[] = $name; |
| 812 | - } |
|
| 813 | - else if($unique) |
|
| 805 | + } else if($unique) |
|
| 814 | 806 | { |
| 815 | 807 | $unique_list[$unique][] = $name; |
| 816 | - } |
|
| 817 | - else if($index) |
|
| 808 | + } else if($index) |
|
| 818 | 809 | { |
| 819 | 810 | $index_list[$index][] = $name; |
| 820 | 811 | } |
@@ -964,8 +955,7 @@ discard block |
||
| 964 | 955 | if($limit && $limit->isPageHandler()) |
| 965 | 956 | { |
| 966 | 957 | return $this->queryPageLimit($queryObject, $connection, $with_values); |
| 967 | - } |
|
| 968 | - else |
|
| 958 | + } else |
|
| 969 | 959 | { |
| 970 | 960 | $query = $this->getSelectSql($queryObject, $with_values); |
| 971 | 961 | if(is_a($query, 'BaseObject')) |
@@ -1009,8 +999,9 @@ discard block |
||
| 1009 | 999 | $buff->data = array(); |
| 1010 | 1000 | $buff->page_navigation = new PageHandler(/* $total_count */0, /* $total_page */1, /* $page */1, /* $page_count */10); //default page handler values |
| 1011 | 1001 | return $buff; |
| 1012 | - }else |
|
| 1013 | - return; |
|
| 1002 | + } else { |
|
| 1003 | + return; |
|
| 1004 | + } |
|
| 1014 | 1005 | } |
| 1015 | 1006 | |
| 1016 | 1007 | /** |
@@ -1069,8 +1060,7 @@ discard block |
||
| 1069 | 1060 | if($total_count) |
| 1070 | 1061 | { |
| 1071 | 1062 | $total_page = (int) (($total_count - 1) / $list_count) + 1; |
| 1072 | - } |
|
| 1073 | - else |
|
| 1063 | + } else |
|
| 1074 | 1064 | { |
| 1075 | 1065 | $total_page = 1; |
| 1076 | 1066 | } |
@@ -111,7 +111,7 @@ discard block |
||
| 111 | 111 | /** |
| 112 | 112 | * DB transaction start |
| 113 | 113 | * this method is private |
| 114 | - * @return boolean |
|
| 114 | + * @return null|boolean |
|
| 115 | 115 | */ |
| 116 | 116 | function _begin($transactionLevel = 0) |
| 117 | 117 | { |
@@ -170,7 +170,7 @@ discard block |
||
| 170 | 170 | * this method is private |
| 171 | 171 | * @param string $query |
| 172 | 172 | * @param resource $connection |
| 173 | - * @return resource|boolean Returns a statement resource on success and FALSE if an error occurred. |
|
| 173 | + * @return resource Returns a statement resource on success and FALSE if an error occurred. |
|
| 174 | 174 | */ |
| 175 | 175 | function __query($query, $connection) |
| 176 | 176 | { |
@@ -375,7 +375,7 @@ discard block |
||
| 375 | 375 | * @param int $size column size |
| 376 | 376 | * @param string|int $default default value |
| 377 | 377 | * @param boolean $notnull not null status, default value is false |
| 378 | - * @return void |
|
| 378 | + * @return null|resource |
|
| 379 | 379 | */ |
| 380 | 380 | function addColumn($table_name, $column_name, $type = 'number', $size = '', $default = null, $notnull = false) |
| 381 | 381 | { |
@@ -431,7 +431,7 @@ discard block |
||
| 431 | 431 | * Check column exist status of the table |
| 432 | 432 | * @param string $table_name table name |
| 433 | 433 | * @param string $column_name column name |
| 434 | - * @return boolean |
|
| 434 | + * @return null|boolean |
|
| 435 | 435 | */ |
| 436 | 436 | function isColumnExists($table_name, $column_name) |
| 437 | 437 | { |
@@ -495,7 +495,7 @@ discard block |
||
| 495 | 495 | * Check index status of the table |
| 496 | 496 | * @param string $table_name table name |
| 497 | 497 | * @param string $index_name index name |
| 498 | - * @return boolean |
|
| 498 | + * @return null|boolean |
|
| 499 | 499 | */ |
| 500 | 500 | function isIndexExists($table_name, $index_name) |
| 501 | 501 | { |
@@ -674,7 +674,7 @@ discard block |
||
| 674 | 674 | |
| 675 | 675 | /** |
| 676 | 676 | * Return update query string |
| 677 | - * @param object $query |
|
| 677 | + * @param BaseObject $query |
|
| 678 | 678 | * @param boolean $with_values |
| 679 | 679 | * @param boolean $with_priority |
| 680 | 680 | * @return string |
@@ -726,8 +726,9 @@ discard block |
||
| 726 | 726 | |
| 727 | 727 | /** |
| 728 | 728 | * Return select query string |
| 729 | - * @param object $query |
|
| 729 | + * @param BaseObject $query |
|
| 730 | 730 | * @param boolean $with_values |
| 731 | + * @param resource $connection |
|
| 731 | 732 | * @return string |
| 732 | 733 | */ |
| 733 | 734 | function getSelectSql($query, $with_values = TRUE, $connection=NULL) |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | function DBMssql($auto_connect = TRUE) |
| 46 | 46 | { |
| 47 | 47 | $this->_setDBInfo(); |
| 48 | - if($auto_connect) $this->_connect(); |
|
| 48 | + if ($auto_connect) $this->_connect(); |
|
| 49 | 49 | } |
| 50 | 50 | |
| 51 | 51 | /** |
@@ -70,10 +70,10 @@ discard block |
||
| 70 | 70 | //sqlsrv_configure( 'LogSubsystems', SQLSRV_LOG_SYSTEM_ALL ); |
| 71 | 71 | $result = @sqlsrv_connect($connection["db_hostname"], array('Database' => $connection["db_database"], 'UID' => $connection["db_userid"], 'PWD' => $connection["db_password"])); |
| 72 | 72 | |
| 73 | - if(!$result) |
|
| 73 | + if (!$result) |
|
| 74 | 74 | { |
| 75 | 75 | $errors = print_r(sqlsrv_errors(), true); |
| 76 | - $this->setError(-1, 'database connect fail' . PHP_EOL . $errors); |
|
| 76 | + $this->setError(-1, 'database connect fail'.PHP_EOL.$errors); |
|
| 77 | 77 | return; |
| 78 | 78 | } |
| 79 | 79 | return $result; |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | */ |
| 100 | 100 | function addQuotes($string) |
| 101 | 101 | { |
| 102 | - if(version_compare(PHP_VERSION, "5.4.0", "<") && get_magic_quotes_gpc()) |
|
| 102 | + if (version_compare(PHP_VERSION, "5.4.0", "<") && get_magic_quotes_gpc()) |
|
| 103 | 103 | { |
| 104 | 104 | $string = stripslashes(str_replace("\\", "\\\\", $string)); |
| 105 | 105 | } |
@@ -117,16 +117,16 @@ discard block |
||
| 117 | 117 | { |
| 118 | 118 | $connection = $this->_getConnection('master'); |
| 119 | 119 | |
| 120 | - if(!$transactionLevel) |
|
| 120 | + if (!$transactionLevel) |
|
| 121 | 121 | { |
| 122 | - if(sqlsrv_begin_transaction($connection) === false) |
|
| 122 | + if (sqlsrv_begin_transaction($connection) === false) |
|
| 123 | 123 | { |
| 124 | 124 | return; |
| 125 | 125 | } |
| 126 | 126 | } |
| 127 | 127 | else |
| 128 | 128 | { |
| 129 | - $this->_query("SAVE TRANS SP" . $transactionLevel, $connection); |
|
| 129 | + $this->_query("SAVE TRANS SP".$transactionLevel, $connection); |
|
| 130 | 130 | } |
| 131 | 131 | return true; |
| 132 | 132 | } |
@@ -142,9 +142,9 @@ discard block |
||
| 142 | 142 | |
| 143 | 143 | $point = $transactionLevel - 1; |
| 144 | 144 | |
| 145 | - if($point) |
|
| 145 | + if ($point) |
|
| 146 | 146 | { |
| 147 | - $this->_query("ROLLBACK TRANS SP" . $point, $connection); |
|
| 147 | + $this->_query("ROLLBACK TRANS SP".$point, $connection); |
|
| 148 | 148 | } |
| 149 | 149 | else |
| 150 | 150 | { |
@@ -176,18 +176,18 @@ discard block |
||
| 176 | 176 | { |
| 177 | 177 | $_param = array(); |
| 178 | 178 | |
| 179 | - if(count($this->param)) |
|
| 179 | + if (count($this->param)) |
|
| 180 | 180 | { |
| 181 | - foreach($this->param as $k => $o) |
|
| 181 | + foreach ($this->param as $k => $o) |
|
| 182 | 182 | { |
| 183 | - if($o->isColumnName()) |
|
| 183 | + if ($o->isColumnName()) |
|
| 184 | 184 | { |
| 185 | 185 | continue; |
| 186 | 186 | } |
| 187 | - if($o->getType() == 'number') |
|
| 187 | + if ($o->getType() == 'number') |
|
| 188 | 188 | { |
| 189 | 189 | $value = $o->getUnescapedValue(); |
| 190 | - if(is_array($value)) |
|
| 190 | + if (is_array($value)) |
|
| 191 | 191 | { |
| 192 | 192 | $_param = array_merge($_param, $value); |
| 193 | 193 | } |
@@ -199,9 +199,9 @@ discard block |
||
| 199 | 199 | else |
| 200 | 200 | { |
| 201 | 201 | $value = $o->getUnescapedValue(); |
| 202 | - if(is_array($value)) |
|
| 202 | + if (is_array($value)) |
|
| 203 | 203 | { |
| 204 | - foreach($value as $v) |
|
| 204 | + foreach ($value as $v) |
|
| 205 | 205 | { |
| 206 | 206 | $_param[] = array($v, SQLSRV_PARAM_IN, SQLSRV_PHPTYPE_STRING('utf-8')); |
| 207 | 207 | } |
@@ -216,7 +216,7 @@ discard block |
||
| 216 | 216 | |
| 217 | 217 | // Run the query statement |
| 218 | 218 | $result = false; |
| 219 | - if(count($_param)) |
|
| 219 | + if (count($_param)) |
|
| 220 | 220 | { |
| 221 | 221 | $args = $this->_getParametersByReference($_param); |
| 222 | 222 | $stmt = sqlsrv_prepare($connection, $query, $args); |
@@ -226,7 +226,7 @@ discard block |
||
| 226 | 226 | $stmt = sqlsrv_prepare($connection, $query); |
| 227 | 227 | } |
| 228 | 228 | |
| 229 | - if(!$stmt) |
|
| 229 | + if (!$stmt) |
|
| 230 | 230 | { |
| 231 | 231 | $result = false; |
| 232 | 232 | } |
@@ -236,7 +236,7 @@ discard block |
||
| 236 | 236 | } |
| 237 | 237 | |
| 238 | 238 | // Error Check |
| 239 | - if(!$result) |
|
| 239 | + if (!$result) |
|
| 240 | 240 | { |
| 241 | 241 | $this->setError(print_r(sqlsrv_errors(), true)); |
| 242 | 242 | } |
@@ -259,9 +259,9 @@ discard block |
||
| 259 | 259 | $copy = array(); |
| 260 | 260 | $args = array(); |
| 261 | 261 | $i = 0; |
| 262 | - foreach($_param as $key => $value) |
|
| 262 | + foreach ($_param as $key => $value) |
|
| 263 | 263 | { |
| 264 | - if(is_array($value)) |
|
| 264 | + if (is_array($value)) |
|
| 265 | 265 | { |
| 266 | 266 | $value_copy = $value; |
| 267 | 267 | $value_arg = array(); |
@@ -288,7 +288,7 @@ discard block |
||
| 288 | 288 | function _fetch($result, $arrayIndexEndValue = NULL) |
| 289 | 289 | { |
| 290 | 290 | $output = array(); |
| 291 | - if(!$this->isConnected() || $this->isError() || !$result) |
|
| 291 | + if (!$this->isConnected() || $this->isError() || !$result) |
|
| 292 | 292 | { |
| 293 | 293 | return $output; |
| 294 | 294 | } |
@@ -296,18 +296,18 @@ discard block |
||
| 296 | 296 | $c = sqlsrv_num_fields($result); |
| 297 | 297 | $m = null; |
| 298 | 298 | |
| 299 | - while(sqlsrv_fetch($result)) |
|
| 299 | + while (sqlsrv_fetch($result)) |
|
| 300 | 300 | { |
| 301 | - if(!$m) |
|
| 301 | + if (!$m) |
|
| 302 | 302 | { |
| 303 | 303 | $m = sqlsrv_field_metadata($result); |
| 304 | 304 | } |
| 305 | 305 | unset($row); |
| 306 | - for($i = 0; $i < $c; $i++) |
|
| 306 | + for ($i = 0; $i < $c; $i++) |
|
| 307 | 307 | { |
| 308 | 308 | $row->{$m[$i]['Name']} = sqlsrv_get_field($result, $i, SQLSRV_PHPTYPE_STRING('utf-8')); |
| 309 | 309 | } |
| 310 | - if($arrayIndexEndValue) |
|
| 310 | + if ($arrayIndexEndValue) |
|
| 311 | 311 | { |
| 312 | 312 | $output[$arrayIndexEndValue--] = $row; |
| 313 | 313 | } |
@@ -317,9 +317,9 @@ discard block |
||
| 317 | 317 | } |
| 318 | 318 | } |
| 319 | 319 | |
| 320 | - if(count($output) == 1) |
|
| 320 | + if (count($output) == 1) |
|
| 321 | 321 | { |
| 322 | - if(isset($arrayIndexEndValue)) |
|
| 322 | + if (isset($arrayIndexEndValue)) |
|
| 323 | 323 | { |
| 324 | 324 | return $output; |
| 325 | 325 | } |
@@ -360,7 +360,7 @@ discard block |
||
| 360 | 360 | $result = $this->_query($query); |
| 361 | 361 | $tmp = $this->_fetch($result); |
| 362 | 362 | |
| 363 | - if(!$tmp) |
|
| 363 | + if (!$tmp) |
|
| 364 | 364 | { |
| 365 | 365 | return false; |
| 366 | 366 | } |
@@ -379,18 +379,18 @@ discard block |
||
| 379 | 379 | */ |
| 380 | 380 | function addColumn($table_name, $column_name, $type = 'number', $size = '', $default = null, $notnull = false) |
| 381 | 381 | { |
| 382 | - if($this->isColumnExists($table_name, $column_name)) |
|
| 382 | + if ($this->isColumnExists($table_name, $column_name)) |
|
| 383 | 383 | { |
| 384 | 384 | return; |
| 385 | 385 | } |
| 386 | 386 | $type = $this->column_type[$type]; |
| 387 | - if(strtoupper($type) == 'INTEGER') |
|
| 387 | + if (strtoupper($type) == 'INTEGER') |
|
| 388 | 388 | { |
| 389 | 389 | $size = ''; |
| 390 | 390 | } |
| 391 | 391 | |
| 392 | 392 | $query = sprintf("alter table %s%s add \"%s\" ", $this->prefix, $table_name, $column_name); |
| 393 | - if($size) |
|
| 393 | + if ($size) |
|
| 394 | 394 | { |
| 395 | 395 | $query .= sprintf(" %s(%s) ", $type, $size); |
| 396 | 396 | } |
@@ -399,11 +399,11 @@ discard block |
||
| 399 | 399 | $query .= sprintf(" %s ", $type); |
| 400 | 400 | } |
| 401 | 401 | |
| 402 | - if(isset($default)) |
|
| 402 | + if (isset($default)) |
|
| 403 | 403 | { |
| 404 | 404 | $query .= sprintf(" default '%s' ", $default); |
| 405 | 405 | } |
| 406 | - if($notnull) |
|
| 406 | + if ($notnull) |
|
| 407 | 407 | { |
| 408 | 408 | $query .= " not null "; |
| 409 | 409 | } |
@@ -419,7 +419,7 @@ discard block |
||
| 419 | 419 | */ |
| 420 | 420 | function dropColumn($table_name, $column_name) |
| 421 | 421 | { |
| 422 | - if(!$this->isColumnExists($table_name, $column_name)) |
|
| 422 | + if (!$this->isColumnExists($table_name, $column_name)) |
|
| 423 | 423 | { |
| 424 | 424 | return; |
| 425 | 425 | } |
@@ -437,12 +437,12 @@ discard block |
||
| 437 | 437 | { |
| 438 | 438 | $query = sprintf("select syscolumns.name as name from syscolumns, sysobjects where sysobjects.name = '%s%s' and sysobjects.id = syscolumns.id and syscolumns.name = '%s'", $this->prefix, $table_name, $column_name); |
| 439 | 439 | $result = $this->_query($query); |
| 440 | - if($this->isError()) |
|
| 440 | + if ($this->isError()) |
|
| 441 | 441 | { |
| 442 | 442 | return; |
| 443 | 443 | } |
| 444 | 444 | $tmp = $this->_fetch($result); |
| 445 | - if(!$tmp->name) |
|
| 445 | + if (!$tmp->name) |
|
| 446 | 446 | { |
| 447 | 447 | return false; |
| 448 | 448 | } |
@@ -461,11 +461,11 @@ discard block |
||
| 461 | 461 | */ |
| 462 | 462 | function addIndex($table_name, $index_name, $target_columns, $is_unique = false) |
| 463 | 463 | { |
| 464 | - if($this->isIndexExists($table_name, $index_name)) |
|
| 464 | + if ($this->isIndexExists($table_name, $index_name)) |
|
| 465 | 465 | { |
| 466 | 466 | return; |
| 467 | 467 | } |
| 468 | - if(!is_array($target_columns)) |
|
| 468 | + if (!is_array($target_columns)) |
|
| 469 | 469 | { |
| 470 | 470 | $target_columns = array($target_columns); |
| 471 | 471 | } |
@@ -483,7 +483,7 @@ discard block |
||
| 483 | 483 | */ |
| 484 | 484 | function dropIndex($table_name, $index_name, $is_unique = false) |
| 485 | 485 | { |
| 486 | - if(!$this->isIndexExists($table_name, $index_name)) |
|
| 486 | + if (!$this->isIndexExists($table_name, $index_name)) |
|
| 487 | 487 | { |
| 488 | 488 | return; |
| 489 | 489 | } |
@@ -502,13 +502,13 @@ discard block |
||
| 502 | 502 | $query = sprintf("select sysindexes.name as name from sysindexes, sysobjects where sysobjects.name = '%s%s' and sysobjects.id = sysindexes.id and sysindexes.name = '%s'", $this->prefix, $table_name, $index_name); |
| 503 | 503 | |
| 504 | 504 | $result = $this->_query($query); |
| 505 | - if($this->isError()) |
|
| 505 | + if ($this->isError()) |
|
| 506 | 506 | { |
| 507 | 507 | return; |
| 508 | 508 | } |
| 509 | 509 | $tmp = $this->_fetch($result); |
| 510 | 510 | |
| 511 | - if(!$tmp->name) |
|
| 511 | + if (!$tmp->name) |
|
| 512 | 512 | { |
| 513 | 513 | return false; |
| 514 | 514 | } |
@@ -532,7 +532,7 @@ discard block |
||
| 532 | 532 | */ |
| 533 | 533 | function createTableByXmlFile($file_name) |
| 534 | 534 | { |
| 535 | - if(!file_exists($file_name)) |
|
| 535 | + if (!file_exists($file_name)) |
|
| 536 | 536 | { |
| 537 | 537 | return; |
| 538 | 538 | } |
@@ -557,22 +557,22 @@ discard block |
||
| 557 | 557 | $xml_obj = $oXml->parse($xml_doc); |
| 558 | 558 | // Create a table schema |
| 559 | 559 | $table_name = $xml_obj->table->attrs->name; |
| 560 | - if($this->isTableExists($table_name)) |
|
| 560 | + if ($this->isTableExists($table_name)) |
|
| 561 | 561 | { |
| 562 | 562 | return; |
| 563 | 563 | } |
| 564 | 564 | |
| 565 | - if($table_name == 'sequence') |
|
| 565 | + if ($table_name == 'sequence') |
|
| 566 | 566 | { |
| 567 | - $table_name = $this->prefix . $table_name; |
|
| 567 | + $table_name = $this->prefix.$table_name; |
|
| 568 | 568 | $query = sprintf('create table %s ( sequence int identity(1,1), seq int )', $table_name); |
| 569 | 569 | return $this->_query($query); |
| 570 | 570 | } |
| 571 | 571 | else |
| 572 | 572 | { |
| 573 | - $table_name = $this->prefix . $table_name; |
|
| 573 | + $table_name = $this->prefix.$table_name; |
|
| 574 | 574 | |
| 575 | - if(!is_array($xml_obj->table->column)) |
|
| 575 | + if (!is_array($xml_obj->table->column)) |
|
| 576 | 576 | { |
| 577 | 577 | $columns[] = $xml_obj->table->column; |
| 578 | 578 | } |
@@ -586,7 +586,7 @@ discard block |
||
| 586 | 586 | $index_list = array(); |
| 587 | 587 | |
| 588 | 588 | $typeList = array('number' => 1, 'text' => 1); |
| 589 | - foreach($columns as $column) |
|
| 589 | + foreach ($columns as $column) |
|
| 590 | 590 | { |
| 591 | 591 | $name = $column->attrs->name; |
| 592 | 592 | $type = $column->attrs->type; |
@@ -598,48 +598,48 @@ discard block |
||
| 598 | 598 | $default = $column->attrs->default; |
| 599 | 599 | $auto_increment = $column->attrs->auto_increment; |
| 600 | 600 | |
| 601 | - $column_schema[] = sprintf('[%s] %s%s %s %s %s', $name, $this->column_type[$type], !isset($typeList[$type]) && $size ? '(' . $size . ')' : '', isset($default) ? "default '" . $default . "'" : '', $notnull ? 'not null' : 'null', $auto_increment ? 'identity(1,1)' : ''); |
|
| 601 | + $column_schema[] = sprintf('[%s] %s%s %s %s %s', $name, $this->column_type[$type], !isset($typeList[$type]) && $size ? '('.$size.')' : '', isset($default) ? "default '".$default."'" : '', $notnull ? 'not null' : 'null', $auto_increment ? 'identity(1,1)' : ''); |
|
| 602 | 602 | |
| 603 | - if($primary_key) |
|
| 603 | + if ($primary_key) |
|
| 604 | 604 | { |
| 605 | 605 | $primary_list[] = $name; |
| 606 | 606 | } |
| 607 | - else if($unique) |
|
| 607 | + else if ($unique) |
|
| 608 | 608 | { |
| 609 | 609 | $unique_list[$unique][] = $name; |
| 610 | 610 | } |
| 611 | - else if($index) |
|
| 611 | + else if ($index) |
|
| 612 | 612 | { |
| 613 | 613 | $index_list[$index][] = $name; |
| 614 | 614 | } |
| 615 | 615 | } |
| 616 | 616 | |
| 617 | - if(count($primary_list)) |
|
| 617 | + if (count($primary_list)) |
|
| 618 | 618 | { |
| 619 | - $column_schema[] = sprintf("primary key (%s)", '"' . implode($primary_list, '","') . '"'); |
|
| 619 | + $column_schema[] = sprintf("primary key (%s)", '"'.implode($primary_list, '","').'"'); |
|
| 620 | 620 | } |
| 621 | 621 | |
| 622 | 622 | $schema = sprintf('create table [%s] (%s%s)', $this->addQuotes($table_name), "\n", implode($column_schema, ",\n")); |
| 623 | 623 | $output = $this->_query($schema); |
| 624 | - if(!$output) |
|
| 624 | + if (!$output) |
|
| 625 | 625 | { |
| 626 | 626 | return false; |
| 627 | 627 | } |
| 628 | 628 | |
| 629 | - if(count($unique_list)) |
|
| 629 | + if (count($unique_list)) |
|
| 630 | 630 | { |
| 631 | - foreach($unique_list as $key => $val) |
|
| 631 | + foreach ($unique_list as $key => $val) |
|
| 632 | 632 | { |
| 633 | - $query = sprintf("create unique index %s on %s (%s);", $key, $table_name, '[' . implode('],[', $val) . ']'); |
|
| 633 | + $query = sprintf("create unique index %s on %s (%s);", $key, $table_name, '['.implode('],[', $val).']'); |
|
| 634 | 634 | $this->_query($query); |
| 635 | 635 | } |
| 636 | 636 | } |
| 637 | 637 | |
| 638 | - if(count($index_list)) |
|
| 638 | + if (count($index_list)) |
|
| 639 | 639 | { |
| 640 | - foreach($index_list as $key => $val) |
|
| 640 | + foreach ($index_list as $key => $val) |
|
| 641 | 641 | { |
| 642 | - $query = sprintf("create index %s on %s (%s);", $key, $table_name, '[' . implode('],[', $val) . ']'); |
|
| 642 | + $query = sprintf("create index %s on %s (%s);", $key, $table_name, '['.implode('],[', $val).']'); |
|
| 643 | 643 | $this->_query($query); |
| 644 | 644 | } |
| 645 | 645 | } |
@@ -682,34 +682,34 @@ discard block |
||
| 682 | 682 | function getUpdateSql($query, $with_values = true, $with_priority = false) |
| 683 | 683 | { |
| 684 | 684 | $columnsList = $query->getUpdateString($with_values); |
| 685 | - if($columnsList == '') |
|
| 685 | + if ($columnsList == '') |
|
| 686 | 686 | { |
| 687 | 687 | return new BaseObject(-1, "Invalid query"); |
| 688 | 688 | } |
| 689 | 689 | |
| 690 | 690 | $from = $query->getFromString($with_values); |
| 691 | - if($from == '') |
|
| 691 | + if ($from == '') |
|
| 692 | 692 | { |
| 693 | 693 | return new BaseObject(-1, "Invalid query"); |
| 694 | 694 | } |
| 695 | 695 | |
| 696 | 696 | $tables = $query->getTables(); |
| 697 | 697 | $alias_list = ''; |
| 698 | - foreach($tables as $table) |
|
| 698 | + foreach ($tables as $table) |
|
| 699 | 699 | { |
| 700 | 700 | $alias_list .= $table->getAlias(); |
| 701 | 701 | } |
| 702 | 702 | implode(',', explode(' ', $alias_list)); |
| 703 | 703 | |
| 704 | 704 | $where = $query->getWhereString($with_values); |
| 705 | - if($where != '') |
|
| 705 | + if ($where != '') |
|
| 706 | 706 | { |
| 707 | - $where = ' WHERE ' . $where; |
|
| 707 | + $where = ' WHERE '.$where; |
|
| 708 | 708 | } |
| 709 | 709 | |
| 710 | 710 | $priority = $with_priority ? $query->getPriority() : ''; |
| 711 | 711 | |
| 712 | - return "UPDATE $priority $alias_list SET $columnsList FROM " . $from . $where; |
|
| 712 | + return "UPDATE $priority $alias_list SET $columnsList FROM ".$from.$where; |
|
| 713 | 713 | } |
| 714 | 714 | |
| 715 | 715 | /** |
@@ -730,7 +730,7 @@ discard block |
||
| 730 | 730 | * @param boolean $with_values |
| 731 | 731 | * @return string |
| 732 | 732 | */ |
| 733 | - function getSelectSql($query, $with_values = TRUE, $connection=NULL) |
|
| 733 | + function getSelectSql($query, $with_values = TRUE, $connection = NULL) |
|
| 734 | 734 | { |
| 735 | 735 | $with_values = false; |
| 736 | 736 | |
@@ -740,75 +740,75 @@ discard block |
||
| 740 | 740 | $limit = ''; |
| 741 | 741 | $limitCount = ''; |
| 742 | 742 | $limitQueryPart = $query->getLimit(); |
| 743 | - if($limitQueryPart) |
|
| 743 | + if ($limitQueryPart) |
|
| 744 | 744 | { |
| 745 | 745 | $limitCount = $limitQueryPart->getLimit(); |
| 746 | 746 | } |
| 747 | - if($limitCount != '') |
|
| 747 | + if ($limitCount != '') |
|
| 748 | 748 | { |
| 749 | - $limit = 'SELECT TOP ' . $limitCount; |
|
| 749 | + $limit = 'SELECT TOP '.$limitCount; |
|
| 750 | 750 | } |
| 751 | 751 | |
| 752 | 752 | $select = $query->getSelectString($with_values); |
| 753 | - if($select == '') |
|
| 753 | + if ($select == '') |
|
| 754 | 754 | { |
| 755 | 755 | return new BaseObject(-1, "Invalid query"); |
| 756 | 756 | } |
| 757 | - if($limit != '') |
|
| 757 | + if ($limit != '') |
|
| 758 | 758 | { |
| 759 | - $select = $limit . ' ' . $select; |
|
| 759 | + $select = $limit.' '.$select; |
|
| 760 | 760 | } |
| 761 | 761 | else |
| 762 | 762 | { |
| 763 | - $select = 'SELECT ' . $select; |
|
| 763 | + $select = 'SELECT '.$select; |
|
| 764 | 764 | } |
| 765 | 765 | |
| 766 | 766 | $from = $query->getFromString($with_values); |
| 767 | - if($from == '') |
|
| 767 | + if ($from == '') |
|
| 768 | 768 | { |
| 769 | 769 | return new BaseObject(-1, "Invalid query"); |
| 770 | 770 | } |
| 771 | - $from = ' FROM ' . $from; |
|
| 771 | + $from = ' FROM '.$from; |
|
| 772 | 772 | |
| 773 | 773 | $where = $query->getWhereString($with_values); |
| 774 | - if($where != '') |
|
| 774 | + if ($where != '') |
|
| 775 | 775 | { |
| 776 | - $where = ' WHERE ' . $where; |
|
| 776 | + $where = ' WHERE '.$where; |
|
| 777 | 777 | } |
| 778 | 778 | |
| 779 | 779 | $groupBy = $query->getGroupByString(); |
| 780 | - if($groupBy != '') |
|
| 780 | + if ($groupBy != '') |
|
| 781 | 781 | { |
| 782 | - $groupBy = ' GROUP BY ' . $groupBy; |
|
| 782 | + $groupBy = ' GROUP BY '.$groupBy; |
|
| 783 | 783 | } |
| 784 | 784 | |
| 785 | 785 | $orderBy = $query->getOrderByString(); |
| 786 | - if($orderBy != '') |
|
| 786 | + if ($orderBy != '') |
|
| 787 | 787 | { |
| 788 | - $orderBy = ' ORDER BY ' . $orderBy; |
|
| 788 | + $orderBy = ' ORDER BY '.$orderBy; |
|
| 789 | 789 | } |
| 790 | 790 | |
| 791 | - if($limitCount != '' && $query->limit->start > 0) |
|
| 791 | + if ($limitCount != '' && $query->limit->start > 0) |
|
| 792 | 792 | { |
| 793 | 793 | $order = $query->getOrder(); |
| 794 | 794 | $first_columns = array(); |
| 795 | - foreach($order as $val) |
|
| 795 | + foreach ($order as $val) |
|
| 796 | 796 | { |
| 797 | 797 | $tmpColumnName = $val->getPureColumnName(); |
| 798 | - $first_columns[] = sprintf('%s(%s) as %s', $val->getPureSortOrder()=='asc'?'max':'min', $tmpColumnName, $tmpColumnName); |
|
| 798 | + $first_columns[] = sprintf('%s(%s) as %s', $val->getPureSortOrder() == 'asc' ? 'max' : 'min', $tmpColumnName, $tmpColumnName); |
|
| 799 | 799 | $first_sub_columns[] = $tmpColumnName; |
| 800 | 800 | } |
| 801 | 801 | |
| 802 | - $first_query = sprintf("select %s from (select top %d %s %s %s %s %s) xet", implode(',',$first_columns), $query->limit->start, implode(',',$first_sub_columns), $from, $where, $groupBy, $orderBy); |
|
| 802 | + $first_query = sprintf("select %s from (select top %d %s %s %s %s %s) xet", implode(',', $first_columns), $query->limit->start, implode(',', $first_sub_columns), $from, $where, $groupBy, $orderBy); |
|
| 803 | 803 | $this->param = $query->getArguments(); |
| 804 | 804 | $result = $this->__query($first_query, $connection); |
| 805 | 805 | $tmp = $this->_fetch($result); |
| 806 | 806 | |
| 807 | 807 | $sub_cond = array(); |
| 808 | - foreach($order as $k => $v) |
|
| 808 | + foreach ($order as $k => $v) |
|
| 809 | 809 | { |
| 810 | 810 | //for example... use Document |
| 811 | - if(get_class($v->sort_order) == 'SortArgument') |
|
| 811 | + if (get_class($v->sort_order) == 'SortArgument') |
|
| 812 | 812 | { |
| 813 | 813 | $sort_order = $v->sort_order->value; |
| 814 | 814 | } |
@@ -818,19 +818,19 @@ discard block |
||
| 818 | 818 | $sort_order = $v->sort_order; |
| 819 | 819 | } |
| 820 | 820 | |
| 821 | - $sub_cond[] = sprintf("%s %s '%s'", $v->getPureColumnName(), $sort_order=='asc'?'>':'<', $tmp->{$v->getPureColumnName()}); |
|
| 821 | + $sub_cond[] = sprintf("%s %s '%s'", $v->getPureColumnName(), $sort_order == 'asc' ? '>' : '<', $tmp->{$v->getPureColumnName()}); |
|
| 822 | 822 | } |
| 823 | 823 | |
| 824 | - if(!$where) |
|
| 824 | + if (!$where) |
|
| 825 | 825 | { |
| 826 | - $sub_condition = ' WHERE ( '.implode(' and ',$sub_cond).' )'; |
|
| 826 | + $sub_condition = ' WHERE ( '.implode(' and ', $sub_cond).' )'; |
|
| 827 | 827 | } |
| 828 | 828 | else |
| 829 | 829 | { |
| 830 | - $sub_condition = ' and ( '.implode(' and ',$sub_cond).' )'; |
|
| 830 | + $sub_condition = ' and ( '.implode(' and ', $sub_cond).' )'; |
|
| 831 | 831 | } |
| 832 | 832 | } |
| 833 | - return $select . ' ' . $from . ' ' . $where .$sub_condition. ' ' . $groupBy . ' ' . $orderBy; |
|
| 833 | + return $select.' '.$from.' '.$where.$sub_condition.' '.$groupBy.' '.$orderBy; |
|
| 834 | 834 | } |
| 835 | 835 | |
| 836 | 836 | /** |
@@ -845,7 +845,7 @@ discard block |
||
| 845 | 845 | { |
| 846 | 846 | $query = $this->getSelectSql($queryObject, true, $connection); |
| 847 | 847 | |
| 848 | - if(strpos($query, "substr")) |
|
| 848 | + if (strpos($query, "substr")) |
|
| 849 | 849 | { |
| 850 | 850 | $query = str_replace("substr", "substring", $query); |
| 851 | 851 | } |
@@ -853,10 +853,10 @@ discard block |
||
| 853 | 853 | // TODO Decide if we continue to pass parameters like this |
| 854 | 854 | $this->param = $queryObject->getArguments(); |
| 855 | 855 | |
| 856 | - $query .= (__DEBUG_QUERY__ & 1 && $output->query_id) ? sprintf(' ' . $this->comment_syntax, $this->query_id) : ''; |
|
| 856 | + $query .= (__DEBUG_QUERY__ & 1 && $output->query_id) ? sprintf(' '.$this->comment_syntax, $this->query_id) : ''; |
|
| 857 | 857 | $result = $this->_query($query, $connection); |
| 858 | 858 | |
| 859 | - if($this->isError()) |
|
| 859 | + if ($this->isError()) |
|
| 860 | 860 | { |
| 861 | 861 | return $this->queryError($queryObject); |
| 862 | 862 | } |
@@ -884,7 +884,7 @@ discard block |
||
| 884 | 884 | function queryError($queryObject) |
| 885 | 885 | { |
| 886 | 886 | $limit = $queryObject->getLimit(); |
| 887 | - if($limit && $limit->isPageHandler()) |
|
| 887 | + if ($limit && $limit->isPageHandler()) |
|
| 888 | 888 | { |
| 889 | 889 | $buff = new BaseObject(); |
| 890 | 890 | $buff->total_count = 0; |
@@ -910,52 +910,52 @@ discard block |
||
| 910 | 910 | function queryPageLimit($queryObject, $result, $connection) |
| 911 | 911 | { |
| 912 | 912 | $limit = $queryObject->getLimit(); |
| 913 | - if($limit && $limit->isPageHandler()) |
|
| 913 | + if ($limit && $limit->isPageHandler()) |
|
| 914 | 914 | { |
| 915 | 915 | // Total count |
| 916 | 916 | $temp_where = $queryObject->getWhereString(true, false); |
| 917 | - $count_query = sprintf('select count(*) as "count" %s %s', 'FROM ' . $queryObject->getFromString(), ($temp_where === '' ? '' : ' WHERE ' . $temp_where)); |
|
| 917 | + $count_query = sprintf('select count(*) as "count" %s %s', 'FROM '.$queryObject->getFromString(), ($temp_where === '' ? '' : ' WHERE '.$temp_where)); |
|
| 918 | 918 | |
| 919 | 919 | // Check for distinct query and if found update count query structure |
| 920 | 920 | $temp_select = $queryObject->getSelectString(true); |
| 921 | 921 | $uses_distinct = stripos($temp_select, "distinct") !== false; |
| 922 | 922 | $uses_groupby = $queryObject->getGroupByString() != ''; |
| 923 | - if($uses_distinct || $uses_groupby) |
|
| 923 | + if ($uses_distinct || $uses_groupby) |
|
| 924 | 924 | { |
| 925 | 925 | $count_query = sprintf('select %s %s %s %s' |
| 926 | 926 | , $temp_select |
| 927 | - , 'FROM ' . $queryObject->getFromString(true) |
|
| 928 | - , ($temp_where === '' ? '' : ' WHERE ' . $temp_where) |
|
| 929 | - , ($uses_groupby ? ' GROUP BY ' . $queryObject->getGroupByString() : '') |
|
| 927 | + , 'FROM '.$queryObject->getFromString(true) |
|
| 928 | + , ($temp_where === '' ? '' : ' WHERE '.$temp_where) |
|
| 929 | + , ($uses_groupby ? ' GROUP BY '.$queryObject->getGroupByString() : '') |
|
| 930 | 930 | ); |
| 931 | 931 | |
| 932 | 932 | // If query uses grouping or distinct, count from original select |
| 933 | 933 | $count_query = sprintf('select count(*) as "count" from (%s) xet', $count_query); |
| 934 | 934 | } |
| 935 | 935 | |
| 936 | - $count_query .= (__DEBUG_QUERY__ & 1 && $queryObject->queryID) ? sprintf(' ' . $this->comment_syntax, $this->query_id) : ''; |
|
| 936 | + $count_query .= (__DEBUG_QUERY__ & 1 && $queryObject->queryID) ? sprintf(' '.$this->comment_syntax, $this->query_id) : ''; |
|
| 937 | 937 | $this->param = $queryObject->getArguments(); |
| 938 | 938 | $result_count = $this->_query($count_query, $connection); |
| 939 | 939 | $count_output = $this->_fetch($result_count); |
| 940 | 940 | $total_count = (int) $count_output->count; |
| 941 | 941 | |
| 942 | 942 | $list_count = $limit->list_count->getValue(); |
| 943 | - if(!$list_count) |
|
| 943 | + if (!$list_count) |
|
| 944 | 944 | { |
| 945 | 945 | $list_count = 20; |
| 946 | 946 | } |
| 947 | 947 | $page_count = $limit->page_count->getValue(); |
| 948 | - if(!$page_count) |
|
| 948 | + if (!$page_count) |
|
| 949 | 949 | { |
| 950 | 950 | $page_count = 10; |
| 951 | 951 | } |
| 952 | 952 | $page = $limit->page->getValue(); |
| 953 | - if(!$page || $page < 1) |
|
| 953 | + if (!$page || $page < 1) |
|
| 954 | 954 | { |
| 955 | 955 | $page = 1; |
| 956 | 956 | } |
| 957 | 957 | // Total pages |
| 958 | - if($total_count) |
|
| 958 | + if ($total_count) |
|
| 959 | 959 | { |
| 960 | 960 | $total_page = (int) (($total_count - 1) / $list_count) + 1; |
| 961 | 961 | } |
@@ -965,7 +965,7 @@ discard block |
||
| 965 | 965 | } |
| 966 | 966 | |
| 967 | 967 | // check the page variables |
| 968 | - if($page > $total_page) |
|
| 968 | + if ($page > $total_page) |
|
| 969 | 969 | { |
| 970 | 970 | // If requested page is bigger than total number of pages, return empty list |
| 971 | 971 | |
@@ -977,7 +977,7 @@ discard block |
||
| 977 | 977 | $buff->page_navigation = new PageHandler($total_count, $total_page, $page, $page_count); |
| 978 | 978 | return $buff; |
| 979 | 979 | |
| 980 | - if($queryObject->usesClickCount()) |
|
| 980 | + if ($queryObject->usesClickCount()) |
|
| 981 | 981 | { |
| 982 | 982 | $update_query = $this->getClickCountQuery($queryObject); |
| 983 | 983 | $this->_executeUpdateAct($update_query); |
@@ -45,7 +45,9 @@ discard block |
||
| 45 | 45 | function DBMssql($auto_connect = TRUE) |
| 46 | 46 | { |
| 47 | 47 | $this->_setDBInfo(); |
| 48 | - if($auto_connect) $this->_connect(); |
|
| 48 | + if($auto_connect) { |
|
| 49 | + $this->_connect(); |
|
| 50 | + } |
|
| 49 | 51 | } |
| 50 | 52 | |
| 51 | 53 | /** |
@@ -123,8 +125,7 @@ discard block |
||
| 123 | 125 | { |
| 124 | 126 | return; |
| 125 | 127 | } |
| 126 | - } |
|
| 127 | - else |
|
| 128 | + } else |
|
| 128 | 129 | { |
| 129 | 130 | $this->_query("SAVE TRANS SP" . $transactionLevel, $connection); |
| 130 | 131 | } |
@@ -145,8 +146,7 @@ discard block |
||
| 145 | 146 | if($point) |
| 146 | 147 | { |
| 147 | 148 | $this->_query("ROLLBACK TRANS SP" . $point, $connection); |
| 148 | - } |
|
| 149 | - else |
|
| 149 | + } else |
|
| 150 | 150 | { |
| 151 | 151 | sqlsrv_rollback($connection); |
| 152 | 152 | } |
@@ -190,13 +190,11 @@ discard block |
||
| 190 | 190 | if(is_array($value)) |
| 191 | 191 | { |
| 192 | 192 | $_param = array_merge($_param, $value); |
| 193 | - } |
|
| 194 | - else |
|
| 193 | + } else |
|
| 195 | 194 | { |
| 196 | 195 | $_param[] = $o->getUnescapedValue(); |
| 197 | 196 | } |
| 198 | - } |
|
| 199 | - else |
|
| 197 | + } else |
|
| 200 | 198 | { |
| 201 | 199 | $value = $o->getUnescapedValue(); |
| 202 | 200 | if(is_array($value)) |
@@ -205,8 +203,7 @@ discard block |
||
| 205 | 203 | { |
| 206 | 204 | $_param[] = array($v, SQLSRV_PARAM_IN, SQLSRV_PHPTYPE_STRING('utf-8')); |
| 207 | 205 | } |
| 208 | - } |
|
| 209 | - else |
|
| 206 | + } else |
|
| 210 | 207 | { |
| 211 | 208 | $_param[] = array($value, SQLSRV_PARAM_IN, SQLSRV_PHPTYPE_STRING('utf-8')); |
| 212 | 209 | } |
@@ -220,8 +217,7 @@ discard block |
||
| 220 | 217 | { |
| 221 | 218 | $args = $this->_getParametersByReference($_param); |
| 222 | 219 | $stmt = sqlsrv_prepare($connection, $query, $args); |
| 223 | - } |
|
| 224 | - else |
|
| 220 | + } else |
|
| 225 | 221 | { |
| 226 | 222 | $stmt = sqlsrv_prepare($connection, $query); |
| 227 | 223 | } |
@@ -229,8 +225,7 @@ discard block |
||
| 229 | 225 | if(!$stmt) |
| 230 | 226 | { |
| 231 | 227 | $result = false; |
| 232 | - } |
|
| 233 | - else |
|
| 228 | + } else |
|
| 234 | 229 | { |
| 235 | 230 | $result = sqlsrv_execute($stmt); |
| 236 | 231 | } |
@@ -268,8 +263,7 @@ discard block |
||
| 268 | 263 | $value_arg[] = &$value_copy[0]; |
| 269 | 264 | $value_arg[] = $value_copy[1]; |
| 270 | 265 | $value_arg[] = $value_copy[2]; |
| 271 | - } |
|
| 272 | - else |
|
| 266 | + } else |
|
| 273 | 267 | { |
| 274 | 268 | $value_arg = $value; |
| 275 | 269 | } |
@@ -310,8 +304,7 @@ discard block |
||
| 310 | 304 | if($arrayIndexEndValue) |
| 311 | 305 | { |
| 312 | 306 | $output[$arrayIndexEndValue--] = $row; |
| 313 | - } |
|
| 314 | - else |
|
| 307 | + } else |
|
| 315 | 308 | { |
| 316 | 309 | $output[] = $row; |
| 317 | 310 | } |
@@ -322,8 +315,7 @@ discard block |
||
| 322 | 315 | if(isset($arrayIndexEndValue)) |
| 323 | 316 | { |
| 324 | 317 | return $output; |
| 325 | - } |
|
| 326 | - else |
|
| 318 | + } else |
|
| 327 | 319 | { |
| 328 | 320 | return $output[0]; |
| 329 | 321 | } |
@@ -393,8 +385,7 @@ discard block |
||
| 393 | 385 | if($size) |
| 394 | 386 | { |
| 395 | 387 | $query .= sprintf(" %s(%s) ", $type, $size); |
| 396 | - } |
|
| 397 | - else |
|
| 388 | + } else |
|
| 398 | 389 | { |
| 399 | 390 | $query .= sprintf(" %s ", $type); |
| 400 | 391 | } |
@@ -567,16 +558,14 @@ discard block |
||
| 567 | 558 | $table_name = $this->prefix . $table_name; |
| 568 | 559 | $query = sprintf('create table %s ( sequence int identity(1,1), seq int )', $table_name); |
| 569 | 560 | return $this->_query($query); |
| 570 | - } |
|
| 571 | - else |
|
| 561 | + } else |
|
| 572 | 562 | { |
| 573 | 563 | $table_name = $this->prefix . $table_name; |
| 574 | 564 | |
| 575 | 565 | if(!is_array($xml_obj->table->column)) |
| 576 | 566 | { |
| 577 | 567 | $columns[] = $xml_obj->table->column; |
| 578 | - } |
|
| 579 | - else |
|
| 568 | + } else |
|
| 580 | 569 | { |
| 581 | 570 | $columns = $xml_obj->table->column; |
| 582 | 571 | } |
@@ -603,12 +592,10 @@ discard block |
||
| 603 | 592 | if($primary_key) |
| 604 | 593 | { |
| 605 | 594 | $primary_list[] = $name; |
| 606 | - } |
|
| 607 | - else if($unique) |
|
| 595 | + } else if($unique) |
|
| 608 | 596 | { |
| 609 | 597 | $unique_list[$unique][] = $name; |
| 610 | - } |
|
| 611 | - else if($index) |
|
| 598 | + } else if($index) |
|
| 612 | 599 | { |
| 613 | 600 | $index_list[$index][] = $name; |
| 614 | 601 | } |
@@ -757,8 +744,7 @@ discard block |
||
| 757 | 744 | if($limit != '') |
| 758 | 745 | { |
| 759 | 746 | $select = $limit . ' ' . $select; |
| 760 | - } |
|
| 761 | - else |
|
| 747 | + } else |
|
| 762 | 748 | { |
| 763 | 749 | $select = 'SELECT ' . $select; |
| 764 | 750 | } |
@@ -824,8 +810,7 @@ discard block |
||
| 824 | 810 | if(!$where) |
| 825 | 811 | { |
| 826 | 812 | $sub_condition = ' WHERE ( '.implode(' and ',$sub_cond).' )'; |
| 827 | - } |
|
| 828 | - else |
|
| 813 | + } else |
|
| 829 | 814 | { |
| 830 | 815 | $sub_condition = ' and ( '.implode(' and ',$sub_cond).' )'; |
| 831 | 816 | } |
@@ -859,8 +844,7 @@ discard block |
||
| 859 | 844 | if($this->isError()) |
| 860 | 845 | { |
| 861 | 846 | return $this->queryError($queryObject); |
| 862 | - } |
|
| 863 | - else |
|
| 847 | + } else |
|
| 864 | 848 | { |
| 865 | 849 | return $this->queryPageLimit($queryObject, $result, $connection); |
| 866 | 850 | } |
@@ -893,8 +877,7 @@ discard block |
||
| 893 | 877 | $buff->data = array(); |
| 894 | 878 | $buff->page_navigation = new PageHandler(/* $total_count */0, /* $total_page */1, /* $page */1, /* $page_count */10); //default page handler values |
| 895 | 879 | return $buff; |
| 896 | - } |
|
| 897 | - else |
|
| 880 | + } else |
|
| 898 | 881 | { |
| 899 | 882 | return; |
| 900 | 883 | } |
@@ -958,8 +941,7 @@ discard block |
||
| 958 | 941 | if($total_count) |
| 959 | 942 | { |
| 960 | 943 | $total_page = (int) (($total_count - 1) / $list_count) + 1; |
| 961 | - } |
|
| 962 | - else |
|
| 944 | + } else |
|
| 963 | 945 | { |
| 964 | 946 | $total_page = 1; |
| 965 | 947 | } |
@@ -995,8 +977,7 @@ discard block |
||
| 995 | 977 | $buff->page = $page; |
| 996 | 978 | $buff->data = $data; |
| 997 | 979 | $buff->page_navigation = new PageHandler($total_count, $total_page, $page, $page_count); |
| 998 | - } |
|
| 999 | - else |
|
| 980 | + } else |
|
| 1000 | 981 | { |
| 1001 | 982 | $data = $this->_fetch($result); |
| 1002 | 983 | $buff = new BaseObject(); |
@@ -297,7 +297,7 @@ discard block |
||
| 297 | 297 | * @param int $size column size |
| 298 | 298 | * @param string|int $default default value |
| 299 | 299 | * @param boolean $notnull not null status, default value is false |
| 300 | - * @return void |
|
| 300 | + * @return resource|null |
|
| 301 | 301 | */ |
| 302 | 302 | function addColumn($table_name, $column_name, $type = 'number', $size = '', $default = null, $notnull = false) |
| 303 | 303 | { |
@@ -344,7 +344,7 @@ discard block |
||
| 344 | 344 | * Check column exist status of the table |
| 345 | 345 | * @param string $table_name table name |
| 346 | 346 | * @param string $column_name column name |
| 347 | - * @return boolean |
|
| 347 | + * @return null|boolean |
|
| 348 | 348 | */ |
| 349 | 349 | function isColumnExists($table_name, $column_name) |
| 350 | 350 | { |
@@ -408,7 +408,7 @@ discard block |
||
| 408 | 408 | * Check index status of the table |
| 409 | 409 | * @param string $table_name table name |
| 410 | 410 | * @param string $index_name index name |
| 411 | - * @return boolean |
|
| 411 | + * @return null|boolean |
|
| 412 | 412 | */ |
| 413 | 413 | function isIndexExists($table_name, $index_name) |
| 414 | 414 | { |
@@ -442,7 +442,7 @@ discard block |
||
| 442 | 442 | /** |
| 443 | 443 | * Creates a table by using xml contents |
| 444 | 444 | * @param string $xml_doc xml schema contents |
| 445 | - * @return void|object |
|
| 445 | + * @return null|false |
|
| 446 | 446 | */ |
| 447 | 447 | function createTableByXml($xml_doc) |
| 448 | 448 | { |
@@ -452,7 +452,7 @@ discard block |
||
| 452 | 452 | /** |
| 453 | 453 | * Creates a table by using xml file path |
| 454 | 454 | * @param string $file_name xml schema file path |
| 455 | - * @return void|object |
|
| 455 | + * @return null|false |
|
| 456 | 456 | */ |
| 457 | 457 | function createTableByXmlFile($file_name) |
| 458 | 458 | { |
@@ -472,7 +472,7 @@ discard block |
||
| 472 | 472 | * opt : notnull, default, size\n |
| 473 | 473 | * index : primary key, index, unique\n |
| 474 | 474 | * @param string $xml_doc xml schema contents |
| 475 | - * @return void|object |
|
| 475 | + * @return null|false |
|
| 476 | 476 | */ |
| 477 | 477 | function _createTable($xml_doc) |
| 478 | 478 | { |
@@ -824,7 +824,7 @@ discard block |
||
| 824 | 824 | |
| 825 | 825 | /** |
| 826 | 826 | * If select query execute, return paging sql |
| 827 | - * @param object $query |
|
| 827 | + * @param BaseObject $query |
|
| 828 | 828 | * @param boolean $with_values |
| 829 | 829 | * @param int $start_count |
| 830 | 830 | * @param int $list_count |
@@ -46,7 +46,7 @@ discard block |
||
| 46 | 46 | function DBMysql($auto_connect = TRUE) |
| 47 | 47 | { |
| 48 | 48 | $this->_setDBInfo(); |
| 49 | - if($auto_connect) $this->_connect(); |
|
| 49 | + if ($auto_connect) $this->_connect(); |
|
| 50 | 50 | } |
| 51 | 51 | |
| 52 | 52 | /** |
@@ -67,32 +67,32 @@ discard block |
||
| 67 | 67 | function __connect($connection) |
| 68 | 68 | { |
| 69 | 69 | // Ignore if no DB information exists |
| 70 | - if(strpos($connection["db_hostname"], ':') === false && $connection["db_port"]) |
|
| 70 | + if (strpos($connection["db_hostname"], ':') === false && $connection["db_port"]) |
|
| 71 | 71 | { |
| 72 | - $connection["db_hostname"] .= ':' . $connection["db_port"]; |
|
| 72 | + $connection["db_hostname"] .= ':'.$connection["db_port"]; |
|
| 73 | 73 | } |
| 74 | 74 | |
| 75 | 75 | // Attempt to connect |
| 76 | 76 | $result = @mysql_connect($connection["db_hostname"], $connection["db_userid"], $connection["db_password"]); |
| 77 | - if(!$result) |
|
| 77 | + if (!$result) |
|
| 78 | 78 | { |
| 79 | 79 | exit('XE cannot connect to DB.'); |
| 80 | 80 | } |
| 81 | 81 | |
| 82 | - if(mysql_error()) |
|
| 82 | + if (mysql_error()) |
|
| 83 | 83 | { |
| 84 | 84 | $this->setError(mysql_errno(), mysql_error()); |
| 85 | 85 | return; |
| 86 | 86 | } |
| 87 | 87 | // Error appears if the version is lower than 4.1 |
| 88 | - if(version_compare(mysql_get_server_info($result), '4.1', '<')) |
|
| 88 | + if (version_compare(mysql_get_server_info($result), '4.1', '<')) |
|
| 89 | 89 | { |
| 90 | - $this->setError(-1, 'XE cannot be installed under the version of mysql 4.1. Current mysql version is ' . mysql_get_server_info()); |
|
| 90 | + $this->setError(-1, 'XE cannot be installed under the version of mysql 4.1. Current mysql version is '.mysql_get_server_info()); |
|
| 91 | 91 | return; |
| 92 | 92 | } |
| 93 | 93 | // select db |
| 94 | 94 | @mysql_select_db($connection["db_database"], $result); |
| 95 | - if(mysql_error()) |
|
| 95 | + if (mysql_error()) |
|
| 96 | 96 | { |
| 97 | 97 | $this->setError(mysql_errno(), mysql_error()); |
| 98 | 98 | return; |
@@ -131,11 +131,11 @@ discard block |
||
| 131 | 131 | */ |
| 132 | 132 | function addQuotes($string) |
| 133 | 133 | { |
| 134 | - if(version_compare(PHP_VERSION, "5.4.0", "<") && get_magic_quotes_gpc()) |
|
| 134 | + if (version_compare(PHP_VERSION, "5.4.0", "<") && get_magic_quotes_gpc()) |
|
| 135 | 135 | { |
| 136 | 136 | $string = stripslashes(str_replace("\\", "\\\\", $string)); |
| 137 | 137 | } |
| 138 | - if(!is_numeric($string)) |
|
| 138 | + if (!is_numeric($string)) |
|
| 139 | 139 | { |
| 140 | 140 | $string = @mysql_real_escape_string($string); |
| 141 | 141 | } |
@@ -181,14 +181,14 @@ discard block |
||
| 181 | 181 | */ |
| 182 | 182 | function __query($query, $connection) |
| 183 | 183 | { |
| 184 | - if(!$connection) |
|
| 184 | + if (!$connection) |
|
| 185 | 185 | { |
| 186 | 186 | exit('XE cannot handle DB connection.'); |
| 187 | 187 | } |
| 188 | 188 | // Run the query statement |
| 189 | 189 | $result = mysql_query($query, $connection); |
| 190 | 190 | // Error Check |
| 191 | - if(mysql_error($connection)) |
|
| 191 | + if (mysql_error($connection)) |
|
| 192 | 192 | { |
| 193 | 193 | $this->setError(mysql_errno($connection), mysql_error($connection)); |
| 194 | 194 | } |
@@ -205,13 +205,13 @@ discard block |
||
| 205 | 205 | function _fetch($result, $arrayIndexEndValue = NULL) |
| 206 | 206 | { |
| 207 | 207 | $output = array(); |
| 208 | - if(!$this->isConnected() || $this->isError() || !$result) |
|
| 208 | + if (!$this->isConnected() || $this->isError() || !$result) |
|
| 209 | 209 | { |
| 210 | 210 | return $output; |
| 211 | 211 | } |
| 212 | - while($tmp = $this->db_fetch_object($result)) |
|
| 212 | + while ($tmp = $this->db_fetch_object($result)) |
|
| 213 | 213 | { |
| 214 | - if($arrayIndexEndValue) |
|
| 214 | + if ($arrayIndexEndValue) |
|
| 215 | 215 | { |
| 216 | 216 | $output[$arrayIndexEndValue--] = $tmp; |
| 217 | 217 | } |
@@ -220,9 +220,9 @@ discard block |
||
| 220 | 220 | $output[] = $tmp; |
| 221 | 221 | } |
| 222 | 222 | } |
| 223 | - if(count($output) == 1) |
|
| 223 | + if (count($output) == 1) |
|
| 224 | 224 | { |
| 225 | - if(isset($arrayIndexEndValue)) |
|
| 225 | + if (isset($arrayIndexEndValue)) |
|
| 226 | 226 | { |
| 227 | 227 | return $output; |
| 228 | 228 | } |
@@ -245,7 +245,7 @@ discard block |
||
| 245 | 245 | $query = sprintf("insert into `%ssequence` (seq) values ('0')", $this->prefix); |
| 246 | 246 | $this->_query($query); |
| 247 | 247 | $sequence = $this->db_insert_id(); |
| 248 | - if($sequence % 10000 == 0) |
|
| 248 | + if ($sequence % 10000 == 0) |
|
| 249 | 249 | { |
| 250 | 250 | $query = sprintf("delete from `%ssequence` where seq < %d", $this->prefix, $sequence); |
| 251 | 251 | $this->_query($query); |
@@ -265,7 +265,7 @@ discard block |
||
| 265 | 265 | $query = sprintf("select password('%s') as password, old_password('%s') as old_password", $this->addQuotes($password), $this->addQuotes($password)); |
| 266 | 266 | $result = $this->_query($query); |
| 267 | 267 | $tmp = $this->_fetch($result); |
| 268 | - if($tmp->password === $saved_password || $tmp->old_password === $saved_password) |
|
| 268 | + if ($tmp->password === $saved_password || $tmp->old_password === $saved_password) |
|
| 269 | 269 | { |
| 270 | 270 | return true; |
| 271 | 271 | } |
@@ -282,7 +282,7 @@ discard block |
||
| 282 | 282 | $query = sprintf("show tables like '%s%s'", $this->prefix, $this->addQuotes($target_name)); |
| 283 | 283 | $result = $this->_query($query); |
| 284 | 284 | $tmp = $this->_fetch($result); |
| 285 | - if(!$tmp) |
|
| 285 | + if (!$tmp) |
|
| 286 | 286 | { |
| 287 | 287 | return false; |
| 288 | 288 | } |
@@ -302,13 +302,13 @@ discard block |
||
| 302 | 302 | function addColumn($table_name, $column_name, $type = 'number', $size = '', $default = null, $notnull = false) |
| 303 | 303 | { |
| 304 | 304 | $type = $this->column_type[$type]; |
| 305 | - if(strtoupper($type) == 'INTEGER') |
|
| 305 | + if (strtoupper($type) == 'INTEGER') |
|
| 306 | 306 | { |
| 307 | 307 | $size = ''; |
| 308 | 308 | } |
| 309 | 309 | |
| 310 | 310 | $query = sprintf("alter table `%s%s` add `%s` ", $this->prefix, $table_name, $column_name); |
| 311 | - if($size) |
|
| 311 | + if ($size) |
|
| 312 | 312 | { |
| 313 | 313 | $query .= sprintf(" %s(%s) ", $type, $size); |
| 314 | 314 | } |
@@ -316,11 +316,11 @@ discard block |
||
| 316 | 316 | { |
| 317 | 317 | $query .= sprintf(" %s ", $type); |
| 318 | 318 | } |
| 319 | - if(isset($default)) |
|
| 319 | + if (isset($default)) |
|
| 320 | 320 | { |
| 321 | 321 | $query .= sprintf(" default '%s' ", $default); |
| 322 | 322 | } |
| 323 | - if($notnull) |
|
| 323 | + if ($notnull) |
|
| 324 | 324 | { |
| 325 | 325 | $query .= " not null "; |
| 326 | 326 | } |
@@ -350,18 +350,18 @@ discard block |
||
| 350 | 350 | { |
| 351 | 351 | $query = sprintf("show fields from `%s%s`", $this->prefix, $table_name); |
| 352 | 352 | $result = $this->_query($query); |
| 353 | - if($this->isError()) |
|
| 353 | + if ($this->isError()) |
|
| 354 | 354 | { |
| 355 | 355 | return; |
| 356 | 356 | } |
| 357 | 357 | $output = $this->_fetch($result); |
| 358 | - if($output) |
|
| 358 | + if ($output) |
|
| 359 | 359 | { |
| 360 | 360 | $column_name = strtolower($column_name); |
| 361 | - foreach($output as $key => $val) |
|
| 361 | + foreach ($output as $key => $val) |
|
| 362 | 362 | { |
| 363 | 363 | $name = strtolower($val->Field); |
| 364 | - if($column_name == $name) |
|
| 364 | + if ($column_name == $name) |
|
| 365 | 365 | { |
| 366 | 366 | return true; |
| 367 | 367 | } |
@@ -382,7 +382,7 @@ discard block |
||
| 382 | 382 | */ |
| 383 | 383 | function addIndex($table_name, $index_name, $target_columns, $is_unique = false) |
| 384 | 384 | { |
| 385 | - if(!is_array($target_columns)) |
|
| 385 | + if (!is_array($target_columns)) |
|
| 386 | 386 | { |
| 387 | 387 | $target_columns = array($target_columns); |
| 388 | 388 | } |
@@ -415,23 +415,23 @@ discard block |
||
| 415 | 415 | //$query = sprintf("show indexes from %s%s where key_name = '%s' ", $this->prefix, $table_name, $index_name); |
| 416 | 416 | $query = sprintf("show indexes from `%s%s`", $this->prefix, $table_name); |
| 417 | 417 | $result = $this->_query($query); |
| 418 | - if($this->isError()) |
|
| 418 | + if ($this->isError()) |
|
| 419 | 419 | { |
| 420 | 420 | return; |
| 421 | 421 | } |
| 422 | 422 | $output = $this->_fetch($result); |
| 423 | - if(!$output) |
|
| 423 | + if (!$output) |
|
| 424 | 424 | { |
| 425 | 425 | return; |
| 426 | 426 | } |
| 427 | - if(!is_array($output)) |
|
| 427 | + if (!is_array($output)) |
|
| 428 | 428 | { |
| 429 | 429 | $output = array($output); |
| 430 | 430 | } |
| 431 | 431 | |
| 432 | - for($i = 0; $i < count($output); $i++) |
|
| 432 | + for ($i = 0; $i < count($output); $i++) |
|
| 433 | 433 | { |
| 434 | - if($output[$i]->Key_name == $index_name) |
|
| 434 | + if ($output[$i]->Key_name == $index_name) |
|
| 435 | 435 | { |
| 436 | 436 | return true; |
| 437 | 437 | } |
@@ -456,7 +456,7 @@ discard block |
||
| 456 | 456 | */ |
| 457 | 457 | function createTableByXmlFile($file_name) |
| 458 | 458 | { |
| 459 | - if(!file_exists($file_name)) |
|
| 459 | + if (!file_exists($file_name)) |
|
| 460 | 460 | { |
| 461 | 461 | return; |
| 462 | 462 | } |
@@ -481,13 +481,13 @@ discard block |
||
| 481 | 481 | $xml_obj = $oXml->parse($xml_doc); |
| 482 | 482 | // Create a table schema |
| 483 | 483 | $table_name = $xml_obj->table->attrs->name; |
| 484 | - if($this->isTableExists($table_name)) |
|
| 484 | + if ($this->isTableExists($table_name)) |
|
| 485 | 485 | { |
| 486 | 486 | return; |
| 487 | 487 | } |
| 488 | - $table_name = $this->prefix . $table_name; |
|
| 488 | + $table_name = $this->prefix.$table_name; |
|
| 489 | 489 | |
| 490 | - if(!is_array($xml_obj->table->column)) |
|
| 490 | + if (!is_array($xml_obj->table->column)) |
|
| 491 | 491 | { |
| 492 | 492 | $columns[] = $xml_obj->table->column; |
| 493 | 493 | } |
@@ -500,7 +500,7 @@ discard block |
||
| 500 | 500 | $unique_list = array(); |
| 501 | 501 | $index_list = array(); |
| 502 | 502 | |
| 503 | - foreach($columns as $column) |
|
| 503 | + foreach ($columns as $column) |
|
| 504 | 504 | { |
| 505 | 505 | $name = $column->attrs->name; |
| 506 | 506 | $type = $column->attrs->type; |
@@ -512,47 +512,47 @@ discard block |
||
| 512 | 512 | $default = $column->attrs->default; |
| 513 | 513 | $auto_increment = $column->attrs->auto_increment; |
| 514 | 514 | |
| 515 | - $column_schema[] = sprintf('`%s` %s%s %s %s %s', $name, $this->column_type[$type], $size ? '(' . $size . ')' : '', isset($default) ? "default '" . $default . "'" : '', $notnull ? 'not null' : '', $auto_increment ? 'auto_increment' : ''); |
|
| 515 | + $column_schema[] = sprintf('`%s` %s%s %s %s %s', $name, $this->column_type[$type], $size ? '('.$size.')' : '', isset($default) ? "default '".$default."'" : '', $notnull ? 'not null' : '', $auto_increment ? 'auto_increment' : ''); |
|
| 516 | 516 | |
| 517 | - if($primary_key) |
|
| 517 | + if ($primary_key) |
|
| 518 | 518 | { |
| 519 | 519 | $primary_list[] = $name; |
| 520 | 520 | } |
| 521 | - else if($unique) |
|
| 521 | + else if ($unique) |
|
| 522 | 522 | { |
| 523 | 523 | $unique_list[$unique][] = $name; |
| 524 | 524 | } |
| 525 | - else if($index) |
|
| 525 | + else if ($index) |
|
| 526 | 526 | { |
| 527 | 527 | $index_list[$index][] = $name; |
| 528 | 528 | } |
| 529 | 529 | } |
| 530 | 530 | |
| 531 | - if(count($primary_list)) |
|
| 531 | + if (count($primary_list)) |
|
| 532 | 532 | { |
| 533 | - $column_schema[] = sprintf("primary key (%s)", '`' . implode($primary_list, '`,`') . '`'); |
|
| 533 | + $column_schema[] = sprintf("primary key (%s)", '`'.implode($primary_list, '`,`').'`'); |
|
| 534 | 534 | } |
| 535 | 535 | |
| 536 | - if(count($unique_list)) |
|
| 536 | + if (count($unique_list)) |
|
| 537 | 537 | { |
| 538 | - foreach($unique_list as $key => $val) |
|
| 538 | + foreach ($unique_list as $key => $val) |
|
| 539 | 539 | { |
| 540 | - $column_schema[] = sprintf("unique %s (%s)", $key, '`' . implode($val, '`,`') . '`'); |
|
| 540 | + $column_schema[] = sprintf("unique %s (%s)", $key, '`'.implode($val, '`,`').'`'); |
|
| 541 | 541 | } |
| 542 | 542 | } |
| 543 | 543 | |
| 544 | - if(count($index_list)) |
|
| 544 | + if (count($index_list)) |
|
| 545 | 545 | { |
| 546 | - foreach($index_list as $key => $val) |
|
| 546 | + foreach ($index_list as $key => $val) |
|
| 547 | 547 | { |
| 548 | - $column_schema[] = sprintf("index %s (%s)", $key, '`' . implode($val, '`,`') . '`'); |
|
| 548 | + $column_schema[] = sprintf("index %s (%s)", $key, '`'.implode($val, '`,`').'`'); |
|
| 549 | 549 | } |
| 550 | 550 | } |
| 551 | 551 | |
| 552 | 552 | $schema = sprintf('create table `%s` (%s%s) %s;', $this->addQuotes($table_name), "\n", implode($column_schema, ",\n"), "ENGINE = MYISAM CHARACTER SET utf8 COLLATE utf8_general_ci"); |
| 553 | 553 | |
| 554 | 554 | $output = $this->_query($schema); |
| 555 | - if(!$output) |
|
| 555 | + if (!$output) |
|
| 556 | 556 | return false; |
| 557 | 557 | } |
| 558 | 558 | |
@@ -565,8 +565,8 @@ discard block |
||
| 565 | 565 | function _executeInsertAct($queryObject, $with_values = true) |
| 566 | 566 | { |
| 567 | 567 | $query = $this->getInsertSql($queryObject, $with_values, true); |
| 568 | - $query .= (__DEBUG_QUERY__ & 1 && $this->query_id) ? sprintf(' ' . $this->comment_syntax, $this->query_id) : ''; |
|
| 569 | - if(is_a($query, 'BaseObject')) |
|
| 568 | + $query .= (__DEBUG_QUERY__ & 1 && $this->query_id) ? sprintf(' '.$this->comment_syntax, $this->query_id) : ''; |
|
| 569 | + if (is_a($query, 'BaseObject')) |
|
| 570 | 570 | { |
| 571 | 571 | return; |
| 572 | 572 | } |
@@ -582,13 +582,13 @@ discard block |
||
| 582 | 582 | function _executeUpdateAct($queryObject, $with_values = true) |
| 583 | 583 | { |
| 584 | 584 | $query = $this->getUpdateSql($queryObject, $with_values, true); |
| 585 | - if(is_a($query, 'BaseObject')) |
|
| 585 | + if (is_a($query, 'BaseObject')) |
|
| 586 | 586 | { |
| 587 | - if(!$query->toBool()) return $query; |
|
| 587 | + if (!$query->toBool()) return $query; |
|
| 588 | 588 | else return; |
| 589 | 589 | } |
| 590 | 590 | |
| 591 | - $query .= (__DEBUG_QUERY__ & 1 && $this->query_id) ? sprintf(' ' . $this->comment_syntax, $this->query_id) : ''; |
|
| 591 | + $query .= (__DEBUG_QUERY__ & 1 && $this->query_id) ? sprintf(' '.$this->comment_syntax, $this->query_id) : ''; |
|
| 592 | 592 | |
| 593 | 593 | |
| 594 | 594 | return $this->_query($query); |
@@ -603,8 +603,8 @@ discard block |
||
| 603 | 603 | function _executeDeleteAct($queryObject, $with_values = true) |
| 604 | 604 | { |
| 605 | 605 | $query = $this->getDeleteSql($queryObject, $with_values, true); |
| 606 | - $query .= (__DEBUG_QUERY__ & 1 && $this->query_id) ? sprintf(' ' . $this->comment_syntax, $this->query_id) : ''; |
|
| 607 | - if(is_a($query, 'BaseObject')) |
|
| 606 | + $query .= (__DEBUG_QUERY__ & 1 && $this->query_id) ? sprintf(' '.$this->comment_syntax, $this->query_id) : ''; |
|
| 607 | + if (is_a($query, 'BaseObject')) |
|
| 608 | 608 | { |
| 609 | 609 | return; |
| 610 | 610 | } |
@@ -624,21 +624,21 @@ discard block |
||
| 624 | 624 | { |
| 625 | 625 | $limit = $queryObject->getLimit(); |
| 626 | 626 | $result = NULL; |
| 627 | - if($limit && $limit->isPageHandler()) |
|
| 627 | + if ($limit && $limit->isPageHandler()) |
|
| 628 | 628 | { |
| 629 | 629 | return $this->queryPageLimit($queryObject, $result, $connection, $with_values); |
| 630 | 630 | } |
| 631 | 631 | else |
| 632 | 632 | { |
| 633 | 633 | $query = $this->getSelectSql($queryObject, $with_values); |
| 634 | - if(is_a($query, 'BaseObject')) |
|
| 634 | + if (is_a($query, 'BaseObject')) |
|
| 635 | 635 | { |
| 636 | 636 | return; |
| 637 | 637 | } |
| 638 | - $query .= (__DEBUG_QUERY__ & 1 && $queryObject->queryID) ? sprintf(' ' . $this->comment_syntax, $queryObject->queryID) : ''; |
|
| 638 | + $query .= (__DEBUG_QUERY__ & 1 && $queryObject->queryID) ? sprintf(' '.$this->comment_syntax, $queryObject->queryID) : ''; |
|
| 639 | 639 | |
| 640 | 640 | $result = $this->_query($query, $connection); |
| 641 | - if($this->isError()) |
|
| 641 | + if ($this->isError()) |
|
| 642 | 642 | { |
| 643 | 643 | return $this->queryError($queryObject); |
| 644 | 644 | } |
@@ -647,7 +647,7 @@ discard block |
||
| 647 | 647 | $buff = new BaseObject(); |
| 648 | 648 | $buff->data = $data; |
| 649 | 649 | |
| 650 | - if($queryObject->usesClickCount()) |
|
| 650 | + if ($queryObject->usesClickCount()) |
|
| 651 | 651 | { |
| 652 | 652 | $update_query = $this->getClickCountQuery($queryObject); |
| 653 | 653 | $this->_executeUpdateAct($update_query, $with_values); |
@@ -708,7 +708,7 @@ discard block |
||
| 708 | 708 | function queryError($queryObject) |
| 709 | 709 | { |
| 710 | 710 | $limit = $queryObject->getLimit(); |
| 711 | - if($limit && $limit->isPageHandler()) |
|
| 711 | + if ($limit && $limit->isPageHandler()) |
|
| 712 | 712 | { |
| 713 | 713 | $buff = new BaseObject(); |
| 714 | 714 | $buff->total_count = 0; |
@@ -737,48 +737,48 @@ discard block |
||
| 737 | 737 | $limit = $queryObject->getLimit(); |
| 738 | 738 | // Total count |
| 739 | 739 | $temp_where = $queryObject->getWhereString($with_values, false); |
| 740 | - $count_query = sprintf('select count(*) as "count" %s %s', 'FROM ' . $queryObject->getFromString($with_values), ($temp_where === '' ? '' : ' WHERE ' . $temp_where)); |
|
| 740 | + $count_query = sprintf('select count(*) as "count" %s %s', 'FROM '.$queryObject->getFromString($with_values), ($temp_where === '' ? '' : ' WHERE '.$temp_where)); |
|
| 741 | 741 | |
| 742 | 742 | // Check for distinct query and if found update count query structure |
| 743 | 743 | $temp_select = $queryObject->getSelectString($with_values); |
| 744 | 744 | $uses_distinct = stripos($temp_select, "distinct") !== false; |
| 745 | 745 | $uses_groupby = $queryObject->getGroupByString() != ''; |
| 746 | - if($uses_distinct || $uses_groupby) |
|
| 746 | + if ($uses_distinct || $uses_groupby) |
|
| 747 | 747 | { |
| 748 | 748 | $count_query = sprintf('select %s %s %s %s' |
| 749 | 749 | , $temp_select == '*' ? '1' : $temp_select |
| 750 | - , 'FROM ' . $queryObject->getFromString($with_values) |
|
| 751 | - , ($temp_where === '' ? '' : ' WHERE ' . $temp_where) |
|
| 752 | - , ($uses_groupby ? ' GROUP BY ' . $queryObject->getGroupByString() : '') |
|
| 750 | + , 'FROM '.$queryObject->getFromString($with_values) |
|
| 751 | + , ($temp_where === '' ? '' : ' WHERE '.$temp_where) |
|
| 752 | + , ($uses_groupby ? ' GROUP BY '.$queryObject->getGroupByString() : '') |
|
| 753 | 753 | ); |
| 754 | 754 | |
| 755 | 755 | // If query uses grouping or distinct, count from original select |
| 756 | 756 | $count_query = sprintf('select count(*) as "count" from (%s) xet', $count_query); |
| 757 | 757 | } |
| 758 | 758 | |
| 759 | - $count_query .= (__DEBUG_QUERY__ & 1 && $queryObject->queryID) ? sprintf(' ' . $this->comment_syntax, $queryObject->queryID) : ''; |
|
| 759 | + $count_query .= (__DEBUG_QUERY__ & 1 && $queryObject->queryID) ? sprintf(' '.$this->comment_syntax, $queryObject->queryID) : ''; |
|
| 760 | 760 | $result_count = $this->_query($count_query, $connection); |
| 761 | 761 | $count_output = $this->_fetch($result_count); |
| 762 | 762 | $total_count = (int) (isset($count_output->count) ? $count_output->count : NULL); |
| 763 | 763 | |
| 764 | 764 | $list_count = $limit->list_count->getValue(); |
| 765 | - if(!$list_count) |
|
| 765 | + if (!$list_count) |
|
| 766 | 766 | { |
| 767 | 767 | $list_count = 20; |
| 768 | 768 | } |
| 769 | 769 | $page_count = $limit->page_count->getValue(); |
| 770 | - if(!$page_count) |
|
| 770 | + if (!$page_count) |
|
| 771 | 771 | { |
| 772 | 772 | $page_count = 10; |
| 773 | 773 | } |
| 774 | 774 | $page = $limit->page->getValue(); |
| 775 | - if(!$page || $page < 1) |
|
| 775 | + if (!$page || $page < 1) |
|
| 776 | 776 | { |
| 777 | 777 | $page = 1; |
| 778 | 778 | } |
| 779 | 779 | |
| 780 | 780 | // total pages |
| 781 | - if($total_count) |
|
| 781 | + if ($total_count) |
|
| 782 | 782 | { |
| 783 | 783 | $total_page = (int) (($total_count - 1) / $list_count) + 1; |
| 784 | 784 | } |
@@ -788,7 +788,7 @@ discard block |
||
| 788 | 788 | } |
| 789 | 789 | |
| 790 | 790 | // check the page variables |
| 791 | - if($page > $total_page) |
|
| 791 | + if ($page > $total_page) |
|
| 792 | 792 | { |
| 793 | 793 | // If requested page is bigger than total number of pages, return empty list |
| 794 | 794 | $buff = new BaseObject(); |
@@ -803,9 +803,9 @@ discard block |
||
| 803 | 803 | |
| 804 | 804 | $query = $this->getSelectPageSql($queryObject, $with_values, $start_count, $list_count); |
| 805 | 805 | |
| 806 | - $query .= (__DEBUG_QUERY__ & 1 && $queryObject->query_id) ? sprintf(' ' . $this->comment_syntax, $this->query_id) : ''; |
|
| 806 | + $query .= (__DEBUG_QUERY__ & 1 && $queryObject->query_id) ? sprintf(' '.$this->comment_syntax, $this->query_id) : ''; |
|
| 807 | 807 | $result = $this->_query($query, $connection); |
| 808 | - if($this->isError()) |
|
| 808 | + if ($this->isError()) |
|
| 809 | 809 | { |
| 810 | 810 | return $this->queryError($queryObject); |
| 811 | 811 | } |
@@ -833,44 +833,44 @@ discard block |
||
| 833 | 833 | function getSelectPageSql($query, $with_values = true, $start_count = 0, $list_count = 0) |
| 834 | 834 | { |
| 835 | 835 | $select = $query->getSelectString($with_values); |
| 836 | - if($select == '') |
|
| 836 | + if ($select == '') |
|
| 837 | 837 | { |
| 838 | 838 | return new BaseObject(-1, "Invalid query"); |
| 839 | 839 | } |
| 840 | - $select = 'SELECT ' . $select; |
|
| 840 | + $select = 'SELECT '.$select; |
|
| 841 | 841 | |
| 842 | 842 | $from = $query->getFromString($with_values); |
| 843 | - if($from == '') |
|
| 843 | + if ($from == '') |
|
| 844 | 844 | { |
| 845 | 845 | return new BaseObject(-1, "Invalid query"); |
| 846 | 846 | } |
| 847 | - $from = ' FROM ' . $from; |
|
| 847 | + $from = ' FROM '.$from; |
|
| 848 | 848 | |
| 849 | 849 | $where = $query->getWhereString($with_values); |
| 850 | - if($where != '') |
|
| 850 | + if ($where != '') |
|
| 851 | 851 | { |
| 852 | - $where = ' WHERE ' . $where; |
|
| 852 | + $where = ' WHERE '.$where; |
|
| 853 | 853 | } |
| 854 | 854 | |
| 855 | 855 | $groupBy = $query->getGroupByString(); |
| 856 | - if($groupBy != '') |
|
| 856 | + if ($groupBy != '') |
|
| 857 | 857 | { |
| 858 | - $groupBy = ' GROUP BY ' . $groupBy; |
|
| 858 | + $groupBy = ' GROUP BY '.$groupBy; |
|
| 859 | 859 | } |
| 860 | 860 | |
| 861 | 861 | $orderBy = $query->getOrderByString(); |
| 862 | - if($orderBy != '') |
|
| 862 | + if ($orderBy != '') |
|
| 863 | 863 | { |
| 864 | - $orderBy = ' ORDER BY ' . $orderBy; |
|
| 864 | + $orderBy = ' ORDER BY '.$orderBy; |
|
| 865 | 865 | } |
| 866 | 866 | |
| 867 | 867 | $limit = $query->getLimitString(); |
| 868 | - if($limit != '') |
|
| 868 | + if ($limit != '') |
|
| 869 | 869 | { |
| 870 | 870 | $limit = sprintf(' LIMIT %d, %d', $start_count, $list_count); |
| 871 | 871 | } |
| 872 | 872 | |
| 873 | - return $select . ' ' . $from . ' ' . $where . ' ' . $groupBy . ' ' . $orderBy . ' ' . $limit; |
|
| 873 | + return $select.' '.$from.' '.$where.' '.$groupBy.' '.$orderBy.' '.$limit; |
|
| 874 | 874 | } |
| 875 | 875 | |
| 876 | 876 | } |
@@ -46,7 +46,9 @@ discard block |
||
| 46 | 46 | function DBMysql($auto_connect = TRUE) |
| 47 | 47 | { |
| 48 | 48 | $this->_setDBInfo(); |
| 49 | - if($auto_connect) $this->_connect(); |
|
| 49 | + if($auto_connect) { |
|
| 50 | + $this->_connect(); |
|
| 51 | + } |
|
| 50 | 52 | } |
| 51 | 53 | |
| 52 | 54 | /** |
@@ -214,8 +216,7 @@ discard block |
||
| 214 | 216 | if($arrayIndexEndValue) |
| 215 | 217 | { |
| 216 | 218 | $output[$arrayIndexEndValue--] = $tmp; |
| 217 | - } |
|
| 218 | - else |
|
| 219 | + } else |
|
| 219 | 220 | { |
| 220 | 221 | $output[] = $tmp; |
| 221 | 222 | } |
@@ -225,8 +226,7 @@ discard block |
||
| 225 | 226 | if(isset($arrayIndexEndValue)) |
| 226 | 227 | { |
| 227 | 228 | return $output; |
| 228 | - } |
|
| 229 | - else |
|
| 229 | + } else |
|
| 230 | 230 | { |
| 231 | 231 | return $output[0]; |
| 232 | 232 | } |
@@ -311,8 +311,7 @@ discard block |
||
| 311 | 311 | if($size) |
| 312 | 312 | { |
| 313 | 313 | $query .= sprintf(" %s(%s) ", $type, $size); |
| 314 | - } |
|
| 315 | - else |
|
| 314 | + } else |
|
| 316 | 315 | { |
| 317 | 316 | $query .= sprintf(" %s ", $type); |
| 318 | 317 | } |
@@ -490,8 +489,7 @@ discard block |
||
| 490 | 489 | if(!is_array($xml_obj->table->column)) |
| 491 | 490 | { |
| 492 | 491 | $columns[] = $xml_obj->table->column; |
| 493 | - } |
|
| 494 | - else |
|
| 492 | + } else |
|
| 495 | 493 | { |
| 496 | 494 | $columns = $xml_obj->table->column; |
| 497 | 495 | } |
@@ -517,12 +515,10 @@ discard block |
||
| 517 | 515 | if($primary_key) |
| 518 | 516 | { |
| 519 | 517 | $primary_list[] = $name; |
| 520 | - } |
|
| 521 | - else if($unique) |
|
| 518 | + } else if($unique) |
|
| 522 | 519 | { |
| 523 | 520 | $unique_list[$unique][] = $name; |
| 524 | - } |
|
| 525 | - else if($index) |
|
| 521 | + } else if($index) |
|
| 526 | 522 | { |
| 527 | 523 | $index_list[$index][] = $name; |
| 528 | 524 | } |
@@ -552,8 +548,9 @@ discard block |
||
| 552 | 548 | $schema = sprintf('create table `%s` (%s%s) %s;', $this->addQuotes($table_name), "\n", implode($column_schema, ",\n"), "ENGINE = MYISAM CHARACTER SET utf8 COLLATE utf8_general_ci"); |
| 553 | 549 | |
| 554 | 550 | $output = $this->_query($schema); |
| 555 | - if(!$output) |
|
| 556 | - return false; |
|
| 551 | + if(!$output) { |
|
| 552 | + return false; |
|
| 553 | + } |
|
| 557 | 554 | } |
| 558 | 555 | |
| 559 | 556 | /** |
@@ -584,8 +581,11 @@ discard block |
||
| 584 | 581 | $query = $this->getUpdateSql($queryObject, $with_values, true); |
| 585 | 582 | if(is_a($query, 'BaseObject')) |
| 586 | 583 | { |
| 587 | - if(!$query->toBool()) return $query; |
|
| 588 | - else return; |
|
| 584 | + if(!$query->toBool()) { |
|
| 585 | + return $query; |
|
| 586 | + } else { |
|
| 587 | + return; |
|
| 588 | + } |
|
| 589 | 589 | } |
| 590 | 590 | |
| 591 | 591 | $query .= (__DEBUG_QUERY__ & 1 && $this->query_id) ? sprintf(' ' . $this->comment_syntax, $this->query_id) : ''; |
@@ -627,8 +627,7 @@ discard block |
||
| 627 | 627 | if($limit && $limit->isPageHandler()) |
| 628 | 628 | { |
| 629 | 629 | return $this->queryPageLimit($queryObject, $result, $connection, $with_values); |
| 630 | - } |
|
| 631 | - else |
|
| 630 | + } else |
|
| 632 | 631 | { |
| 633 | 632 | $query = $this->getSelectSql($queryObject, $with_values); |
| 634 | 633 | if(is_a($query, 'BaseObject')) |
@@ -717,8 +716,7 @@ discard block |
||
| 717 | 716 | $buff->data = array(); |
| 718 | 717 | $buff->page_navigation = new PageHandler(/* $total_count */0, /* $total_page */1, /* $page */1, /* $page_count */10); //default page handler values |
| 719 | 718 | return $buff; |
| 720 | - } |
|
| 721 | - else |
|
| 719 | + } else |
|
| 722 | 720 | { |
| 723 | 721 | return; |
| 724 | 722 | } |
@@ -781,8 +779,7 @@ discard block |
||
| 781 | 779 | if($total_count) |
| 782 | 780 | { |
| 783 | 781 | $total_page = (int) (($total_count - 1) / $list_count) + 1; |
| 784 | - } |
|
| 785 | - else |
|
| 782 | + } else |
|
| 786 | 783 | { |
| 787 | 784 | $total_page = 1; |
| 788 | 785 | } |
@@ -131,7 +131,7 @@ |
||
| 131 | 131 | * opt : notnull, default, size\n |
| 132 | 132 | * index : primary key, index, unique\n |
| 133 | 133 | * @param string $xml_doc xml schema contents |
| 134 | - * @return void|object |
|
| 134 | + * @return null|false |
|
| 135 | 135 | */ |
| 136 | 136 | function _createTable($xml_doc) |
| 137 | 137 | { |
@@ -166,7 +166,7 @@ discard block |
||
| 166 | 166 | /** |
| 167 | 167 | * Method to retrieve an object containing a key/value pairs |
| 168 | 168 | * |
| 169 | - * @return BaseObject Returns an object containing key/value pairs |
|
| 169 | + * @return stdClass Returns an object containing key/value pairs |
|
| 170 | 170 | */ |
| 171 | 171 | function gets() |
| 172 | 172 | { |
@@ -192,7 +192,7 @@ discard block |
||
| 192 | 192 | /** |
| 193 | 193 | * Method to retrieve an object of key/value pairs |
| 194 | 194 | * |
| 195 | - * @return BaseObject |
|
| 195 | + * @return stdClass |
|
| 196 | 196 | */ |
| 197 | 197 | function getObjectVars() |
| 198 | 198 | { |
@@ -226,7 +226,7 @@ discard block |
||
| 226 | 226 | /** |
| 227 | 227 | * When the object gets serialized only include specific object members. |
| 228 | 228 | * |
| 229 | - * @return array |
|
| 229 | + * @return string[] |
|
| 230 | 230 | */ |
| 231 | 231 | public function __sleep() { |
| 232 | 232 | return array('options','objectFilters','enabled'); |
@@ -316,7 +316,7 @@ discard block |
||
| 316 | 316 | * |
| 317 | 317 | * Will throw exceptions for each php error. |
| 318 | 318 | * |
| 319 | - * @return mixed Returns a string containing the previously defined error handler (if any) |
|
| 319 | + * @return null|callable Returns a string containing the previously defined error handler (if any) |
|
| 320 | 320 | */ |
| 321 | 321 | public function registerErrorHandler($throwErrorExceptions=true) |
| 322 | 322 | { |
@@ -362,7 +362,7 @@ discard block |
||
| 362 | 362 | /** |
| 363 | 363 | * Register FirePHP as your exception handler |
| 364 | 364 | * |
| 365 | - * @return mixed Returns the name of the previously defined exception handler, |
|
| 365 | + * @return callable Returns the name of the previously defined exception handler, |
|
| 366 | 366 | * or NULL on error. |
| 367 | 367 | * If no previous handler was defined, NULL is also returned. |
| 368 | 368 | */ |
@@ -467,7 +467,7 @@ discard block |
||
| 467 | 467 | * |
| 468 | 468 | * @param string $Name |
| 469 | 469 | * @param array $Options OPTIONAL Instructions on how to log the group |
| 470 | - * @return true |
|
| 470 | + * @return boolean |
|
| 471 | 471 | * @throws Exception |
| 472 | 472 | */ |
| 473 | 473 | public function group($Name, $Options=null) { |
@@ -491,7 +491,7 @@ discard block |
||
| 491 | 491 | /** |
| 492 | 492 | * Ends a group you have started before |
| 493 | 493 | * |
| 494 | - * @return true |
|
| 494 | + * @return boolean |
|
| 495 | 495 | * @throws Exception |
| 496 | 496 | */ |
| 497 | 497 | public function groupEnd() { |
@@ -504,7 +504,7 @@ discard block |
||
| 504 | 504 | * @see FirePHP::LOG |
| 505 | 505 | * @param mixes $Object |
| 506 | 506 | * @param string $Label |
| 507 | - * @return true |
|
| 507 | + * @return boolean |
|
| 508 | 508 | * @throws Exception |
| 509 | 509 | */ |
| 510 | 510 | public function log($Object, $Label=null) { |
@@ -517,7 +517,7 @@ discard block |
||
| 517 | 517 | * @see FirePHP::INFO |
| 518 | 518 | * @param mixes $Object |
| 519 | 519 | * @param string $Label |
| 520 | - * @return true |
|
| 520 | + * @return boolean |
|
| 521 | 521 | * @throws Exception |
| 522 | 522 | */ |
| 523 | 523 | public function info($Object, $Label=null) { |
@@ -530,7 +530,7 @@ discard block |
||
| 530 | 530 | * @see FirePHP::WARN |
| 531 | 531 | * @param mixes $Object |
| 532 | 532 | * @param string $Label |
| 533 | - * @return true |
|
| 533 | + * @return boolean |
|
| 534 | 534 | * @throws Exception |
| 535 | 535 | */ |
| 536 | 536 | public function warn($Object, $Label=null) { |
@@ -543,7 +543,7 @@ discard block |
||
| 543 | 543 | * @see FirePHP::ERROR |
| 544 | 544 | * @param mixes $Object |
| 545 | 545 | * @param string $Label |
| 546 | - * @return true |
|
| 546 | + * @return boolean |
|
| 547 | 547 | * @throws Exception |
| 548 | 548 | */ |
| 549 | 549 | public function error($Object, $Label=null) { |
@@ -556,7 +556,7 @@ discard block |
||
| 556 | 556 | * @see FirePHP::DUMP |
| 557 | 557 | * @param string $Key |
| 558 | 558 | * @param mixed $Variable |
| 559 | - * @return true |
|
| 559 | + * @return boolean |
|
| 560 | 560 | * @throws Exception |
| 561 | 561 | */ |
| 562 | 562 | public function dump($Key, $Variable) { |
@@ -568,7 +568,7 @@ discard block |
||
| 568 | 568 | * |
| 569 | 569 | * @see FirePHP::TRACE |
| 570 | 570 | * @param string $Label |
| 571 | - * @return true |
|
| 571 | + * @return boolean |
|
| 572 | 572 | * @throws Exception |
| 573 | 573 | */ |
| 574 | 574 | public function trace($Label) { |
@@ -581,7 +581,7 @@ discard block |
||
| 581 | 581 | * @see FirePHP::TABLE |
| 582 | 582 | * @param string $Label |
| 583 | 583 | * @param string $Table |
| 584 | - * @return true |
|
| 584 | + * @return boolean |
|
| 585 | 585 | * @throws Exception |
| 586 | 586 | */ |
| 587 | 587 | public function table($Label, $Table) { |
@@ -607,7 +607,7 @@ discard block |
||
| 607 | 607 | * |
| 608 | 608 | * @see http://www.firephp.org/Wiki/Reference/Fb |
| 609 | 609 | * @param mixed $Object The variable to be logged |
| 610 | - * @return true Return TRUE if message was added to headers, FALSE otherwise |
|
| 610 | + * @return boolean Return TRUE if message was added to headers, FALSE otherwise |
|
| 611 | 611 | * @throws Exception |
| 612 | 612 | */ |
| 613 | 613 | public function fb($Object) { |
@@ -1005,7 +1005,6 @@ discard block |
||
| 1005 | 1005 | * protected and private visibility |
| 1006 | 1006 | * |
| 1007 | 1007 | * @param BaseObject $Object The object to be encoded |
| 1008 | - * @param int $Depth The current traversal depth |
|
| 1009 | 1008 | * @return array All members of the object |
| 1010 | 1009 | */ |
| 1011 | 1010 | protected function encodeObject($Object, $ObjectDepth = 1, $ArrayDepth = 1) |
@@ -145,7 +145,7 @@ |
||
| 145 | 145 | * Save setup |
| 146 | 146 | * |
| 147 | 147 | * @param string $addon Addon name |
| 148 | - * @param object $extra_vars Extra variables |
|
| 148 | + * @param BaseObject $extra_vars Extra variables |
|
| 149 | 149 | * @param int $site_srl Site srl |
| 150 | 150 | * @param string $gtype site or global |
| 151 | 151 | * @return BaseObject |