/** * @access private * @param $dir */ private function cacheDir($dir) { $makefile = new magixcjquery_files_makefiles(); $pathDir = $this->pathCacheDir($dir); if (file_exists($pathDir)) { $scandir = $makefile->scanDir($pathDir, array('.htaccess', '.gitignore')); $clean = ''; if ($scandir != null) { foreach ($scandir as $file) { $clean .= $makefile->removeFile($pathDir, $file); } } } else { $magixfire = new magixcjquery_debug_magixfire(); $magixfire->magixFireError(new Exception('Error: var is not exist')); } }
/** * Smarty {widget_product_gallery} function plugin * * Type: function * Name: microgalery * Date: January 11 2013 * Update: March 20 2014 * Purpose: * Output: * @author Gerits Aurelien * @author Sire Sam (sire-sam.be) * @link http://www.magix-cms.com * @version 1.0 * @param array * @param Smarty * @return string * */ function smarty_function_widget_product_gallery($params, $template) { $ModelSystem = new magixglobal_model_system(); $ModelConstructor = new magixglobal_model_constructor(); $ModelCatalog = new frontend_model_catalog(); // Set and load data $current = $ModelSystem->setCurrentId(); $conf = array('context' => 'product-gallery'); $data = $ModelCatalog->getData($conf, $current); $html = null; if ($data != null) { $pattern['default'] = patternMicroGallery(); $pattern['custom'] = null; if ($params['pattern']) { $pattern['custom'] = is_array($params['pattern']) ? $params['pattern'] : patternMicroGallery($params['pattern']); } $pattern['global'] = $ModelConstructor->mergeHtmlPattern($pattern['default'], $pattern['custom']); magixcjquery_debug_magixfire::magixFireTable('pattern', $pattern); magixcjquery_debug_magixfire::magixFireTable('pattern global', $pattern['global']); $i = 0; $items['html'] = null; foreach ($data as $row) { $i++; // *** Construit donées de l'item en array avec clée nominative unifiée ('name' => 'monname,'descr' => '<p>ma descr</p>,...) $item['data'] = $ModelCatalog->setItemData($row, $current); // Configuration de la structure HTML de l'item $pattern['item'] = $ModelConstructor->setItemPattern($pattern['global'], $i); if ($pattern['item']['img']['classLink'] != '') { $pattern['item']['img']['classLink'] = ' class="' . $pattern['item']['img']['classLink'] . '"'; } // remise à zero du compteur si élément est le dernier de la ligne if ($pattern['item']['is_last'] == 1) { $i = 0; } $items['html'] .= $pattern['item']['item']['before']; $items['html'] .= '<a href="' . $item['data']['imgSrc']['medium'] . '" rel="productGallery" title="Agrandir"' . $pattern['item']['img']['classLink'] . '>'; $items['html'] .= '<img src="' . $item['data']['imgSrc']['small'] . '" alt="Galery" />'; $items['html'] .= '</a>'; $items['html'] .= $pattern['item']['item']['after']; } } // *** ouput if ($items['html'] != null) { $html = isset($params['title']) ? $params['title'] : ''; $html .= $pattern['global']['container']['before']; $html .= isset($params['htmlPrepend']) ? $params['htmlPrepend'] : null; $html .= $items['html']; $html .= isset($params['htmlAppend']) ? $params['htmlAppend'] : null; $html .= $pattern['global']['container']['after']; } return $html; }
/** * Chargement du fichier SQL pour la lecture du fichier * @param $sqlfile * @throws Exception * @return array|bool */ protected function load_sql_file($sqlfile) { if (!file_exists($sqlfile)) { throw new Exception("Error : Not File exist .sql"); } else { $db_structure = preg_split("/;\\s*[\r\n]+/", file_get_contents($sqlfile)); if ($db_structure != null) { $tables = $db_structure; return $tables; } else { magixcjquery_debug_magixfire::magixFireError('Error : SQL File is empty: ' . $sqlfile); return false; } } }
/** * @access public * Affiche le debug pour les sessions */ public function debug() { if (M_FIREPHP) { $firebug = new magixcjquery_debug_magixfire(); $firebug->magixFireGroup('Magix Session'); //$firebug->magixFireLog($_SESSION); $firebug->magixFireDump('session run', $_SESSION); $firebug->magixFireGroupEnd(); } else { var_dump($_SESSION); } }
/** * Ajoute un ou plusieurs dossier de configuration et charge les fichiers associés ainsi que les variables * @access public * @param array $addConfigDir * @param array $load_files * @param bool $debug * @throws Exception */ public static function addConfigFile(array $addConfigDir, array $load_files, $debug = false) { if (is_array($addConfigDir)) { frontend_model_smarty::getInstance()->addConfigDir($addConfigDir); } else { throw new Exception('Error: addConfigDir is not array'); } if (is_array($load_files)) { foreach ($load_files as $row => $val) { if (is_string($row)) { if (array_key_exists($row, $load_files)) { frontend_model_smarty::getInstance()->configLoad(self::pathConfigLoad($row), $val); } } else { frontend_model_smarty::getInstance()->configLoad(self::pathConfigLoad($load_files[$row])); } } } else { throw new Exception('Error: load_files is not array'); } if ($debug != false) { $config_dir = frontend_model_smarty::getInstance()->getConfigDir(); $firebug = new magixcjquery_debug_magixfire(); $firebug->magixFireDump('Config Dir', $config_dir); $firebug->magixFireDump('Load Files in configdir', $load_files); $firebug->magixFireDump('Config vars', frontend_model_smarty::getInstance()->getConfigVars()); } }
/** * Chargement d'un plugin dans l'administration * @access private */ private function setplugin($debug = false) { try { plugins_Autoloader::register(); //Si le fichier admin.php existe dans le plugin if (file_exists($this->directory_plugins() . $this->nameplugin() . DIRECTORY_SEPARATOR . 'admin.php')) { //Si la classe exist on recherche la fonction run() if (class_exists('plugins_' . $this->nameplugin() . '_admin')) { $load = $this->execute_plugins('plugins_' . $this->nameplugin() . '_admin'); //Si la méthode existe on ajoute le plugin dans le register et execute la fonction run() if (method_exists($load, 'run')) { $role = new backend_model_role(); $role_data = explode(',', $role->sql_arg()); $access = (string) $this->allow_access_config($this->nameplugin()); if ($debug) { $firebug = new magixcjquery_debug_magixfire(); $firebug->magixFireLog($this->nameplugin() . ': ' . $access); $firebug->magixFireLog($this->path_dir_i18n()); $firebug->magixFireLog($role_data); } $this->configLoad(); if ($access != null or $access != '') { if (array_key_exists($access, $role_data)) { $load->run(); } elseif ($access == '*') { $load->run(); } } else { $load->run(); } } } else { throw new Exception('Class ' . $this->nameplugin() . ' is not found'); } } } catch (Exception $e) { magixglobal_model_system::magixlog('An error has occured :', $e); } }
/** * Stop Current Unix timestamp with microseconds * @access protected */ protected static function timeStop() { if (self::getIniInstance()) { self::$timerEnd = microtime(); } }
/** * Insertion d'une image dans la galerie spécifique à un produit * @param $img * @param $imgcatalog * @param bool $debug * @return string * @throws Exception */ private function insert_image_galery($img, $imgcatalog, $debug = false) { if (isset($this->{$img})) { try { //Supprime le fichier original pour gagner en espace $makeFiles = new magixcjquery_files_makefiles(); // Charge la classe de traitement des images $initImg = new backend_model_image(); /** * Envoi une image dans le dossier "racine" catalogimg */ $initImg->upload_img('imgcatalog', 'upload' . DIRECTORY_SEPARATOR . 'catalogimg' . DIRECTORY_SEPARATOR . 'galery' . DIRECTORY_SEPARATOR, $debug); /** * Analyze l'extension du fichier en traitement * @var $fileextends */ $fileextends = $initImg->image_analyze(self::dirImgProductGalery() . $this->{$img}); if ($initImg->imgSizeMin(self::dirImgProductGalery() . $this->{$img}, 25, 25)) { // Charge la classe pour renommer le fichier $makeFiles = new magixcjquery_files_makefiles(); /* * Renomme le fichier */ $makeFiles->renameFiles(self::dirImgProductGalery(), self::dirImgProductGalery() . $this->{$img}, self::dirImgProductGalery() . $imgcatalog . $fileextends); /** * Initialisation de la classe phpthumb * @var void */ $thumb = PhpThumbFactory::create(self::dirImgProductGalery() . $imgcatalog . $fileextends); //Charge la taille des images des galeries du catalogue $firebug = new magixcjquery_debug_magixfire(); /** * Création des images et miniatures utile. * 2 tailles !!! */ $imgsizelarge = $initImg->dataImgSize('catalog', 'galery', 'large'); $imgsizesmall = $initImg->dataImgSize('catalog', 'galery', 'small'); if ($debug) { $firebug->magixFireGroup('Setting image'); } switch ($imgsizelarge['img_resizing']) { case 'basic': if ($debug) { $firebug->magixFireGroup($imgsizelarge['config_size_attr'] . ' => ' . $imgsizelarge['type']); $firebug->magixFireLog($imgsizelarge['img_resizing'], 'Type'); $firebug->magixFireLog($imgsizelarge['width'], 'Width'); $firebug->magixFireLog($imgsizelarge['height'], 'Height'); $firebug->magixFireGroupEnd(); } $thumb->resize($imgsizelarge['width'], $imgsizelarge['height'])->save(self::dirImgProductGalery() . 'maxi' . DIRECTORY_SEPARATOR . $imgcatalog . $fileextends); break; case 'adaptive': if ($debug) { $firebug->magixFireGroup($imgsizelarge['config_size_attr'] . ' => ' . $imgsizelarge['type']); $firebug->magixFireLog($imgsizelarge['img_resizing'], 'Type'); $firebug->magixFireLog($imgsizelarge['width'], 'Width'); $firebug->magixFireLog($imgsizelarge['height'], 'Height'); $firebug->magixFireGroupEnd(); } $thumb->adaptiveResize($imgsizelarge['width'], $imgsizelarge['height'])->save(self::dirImgProductGalery() . 'maxi' . DIRECTORY_SEPARATOR . $imgcatalog . $fileextends); break; } switch ($imgsizesmall['img_resizing']) { case 'basic': if ($debug) { $firebug->magixFireGroup($imgsizesmall['config_size_attr'] . ' => ' . $imgsizesmall['type']); $firebug->magixFireLog($imgsizesmall['img_resizing'], 'Type'); $firebug->magixFireLog($imgsizesmall['width'], 'Width'); $firebug->magixFireLog($imgsizesmall['height'], 'Height'); $firebug->magixFireGroupEnd(); } $thumb->resize($imgsizesmall['width'], $imgsizesmall['height'])->save(self::dirImgProductGalery() . 'mini' . DIRECTORY_SEPARATOR . $imgcatalog . $fileextends); break; case 'adaptive': if ($debug) { $firebug->magixFireGroup($imgsizesmall['config_size_attr'] . ' => ' . $imgsizesmall['type']); $firebug->magixFireLog($imgsizesmall['img_resizing'], 'Type'); $firebug->magixFireLog($imgsizesmall['width'], 'Width'); $firebug->magixFireLog($imgsizesmall['height'], 'Height'); $firebug->magixFireGroupEnd(); } $thumb->adaptiveResize($imgsizesmall['width'], $imgsizesmall['height'])->save(self::dirImgProductGalery() . 'mini' . DIRECTORY_SEPARATOR . $imgcatalog . $fileextends); break; } if ($debug) { $firebug->magixFireGroupEnd(); } if (file_exists(self::dirImgProductGalery() . $imgcatalog . $fileextends)) { $makeFiles->removeFile(self::dirImgProductGalery(), $imgcatalog . $fileextends); } return $imgcatalog . $fileextends; } else { if (file_exists(self::dirImgProductGalery() . $this->{$img})) { $makeFiles->removeFile(self::dirImgProductGalery(), $this->{$img}); } else { throw new Exception('file: ' . $this->{$img} . ' is not found'); } } } catch (Exception $e) { magixglobal_model_system::magixlog('An error has occured :', $e); } } }
/** * * Retourne * @param unknown_type $debug */ public function insight_header($debug = false) { header('x-insight: inspect'); if ($debug == true) { magixcjquery_debug_magixfire::magixFireLog("Headers:", headers_list()); } }
/** * Envoi du message avec la méthode batch send * @param void $mailer * @param string $message * @param void $failed * @param string $logger */ public function batch_send_mail($message, $failures = false, $log = false) { if (!$this->_mailer->send($message)) { magixcjquery_debug_magixfire::magixFireDump("Failures: ", $failures); } if ($log) { $echologger = new Swift_Plugins_Loggers_EchoLogger(); $this->_mailer->registerPlugin(new Swift_Plugins_LoggerPlugin($echologger)); magixcjquery_debug_magixfire::magixFireDump("Failures: ", $echologger->dump()); } }
/** * Ajoute un ou plusieurs dossier de configuration et charge les fichiers associés ainsi que les variables * @access public * @param array $addConfigDir * @param array $load_files * @param bool $debug * @throws Exception * @example: backend_controller_template::addConfigFile(array( 'test' ),array('test_'),true); * backend_controller_template::addConfigFile(array( 'test' ),array('test_'=>'montest'),true); OR backend_controller_template::addConfigFile(array( 'test', autre' ),array('test_'=>array('montest'),'truc_'),true); */ public static function addConfigFile(array $addConfigDir, array $load_files, $debug = false) { $firebug = new magixcjquery_debug_magixfire(); if (is_array($addConfigDir)) { if (class_exists('backend_controller_template')) { $configDir = array_map(array('backend_controller_template', 'basePathConfig'), $addConfigDir); self::addConfigDir($configDir); } } else { throw new Exception('Error: addConfigDir is not array'); } if (is_array($load_files)) { foreach ($load_files as $key => $val) { if (is_string($key)) { if (array_key_exists($key, $load_files)) { self::configLoad(self::pathConfigLoad($key), $val); } } else { self::configLoad(self::pathConfigLoad($load_files[$key])); } } } else { throw new Exception('Error: load_files is not array'); } //Debug if ($debug != false) { $firebug->magixFireDump('Config Dir', $configDir); if (self::getConfigDir() != '') { $firebug->magixFireDump('Get Config Dir', self::getConfigDir()); } $firebug->magixFireDump('Load Files in configdir', $load_files); $firebug->magixFireDump('Config vars', self::getConfigVars()); } }
/** * Création du fichier de configuration * @throws Exception */ private function create_config_file() { if (isset($this->M_DBHOST) && isset($this->M_DBUSER) && isset($this->M_DBPASSWORD) && isset($this->M_DBNAME)) { if (!is_writable(dirname(self::$configfile))) { throw new Exception(sprintf('Cannot write %s file.', self::$configfile)); } self::config_file_exist(); try { # Creates config.php file $full_conf = file_get_contents(self::$config_in); $writeconst = new magixcjquery_files_makefiles(); /** * create constante define in config file */ $writeconst->writeConstValue('M_DBDRIVER', $this->M_DBDRIVER, $full_conf); $writeconst->writeConstValue('M_DBHOST', $this->M_DBHOST, $full_conf); $writeconst->writeConstValue('M_DBUSER', $this->M_DBUSER, $full_conf); $writeconst->writeConstValue('M_DBPASSWORD', $this->M_DBPASSWORD, $full_conf); $writeconst->writeConstValue('M_DBNAME', $this->M_DBNAME, $full_conf); switch ($this->M_LOG) { case 'debug': $writeconst->writeConstValue('M_LOG', $this->M_LOG, $full_conf); break; case 'log': $writeconst->writeConstValue('M_LOG', $this->M_LOG, $full_conf); break; case 'false': $writeconst->writeConstValue('M_LOG', $this->M_LOG, $full_conf, false); } $writeconst->writeConstValue('M_TMP_DIR', magixglobal_model_system::base_path() . 'var' . DIRECTORY_SEPARATOR . 'tmp' . DIRECTORY_SEPARATOR . 'errors.log', $full_conf); $writeconst->writeConstValue('M_FIREPHP', $this->M_FIREPHP, $full_conf, false); $fp = fopen(self::$configfile, 'wb'); if ($fp === false) { throw new Exception(sprintf('Cannot write %s file.', self::$configfile)); } fwrite($fp, $full_conf); fclose($fp); //chmod(self::$configfile, 0666); app_model_smarty::getInstance()->display('config/request/success_add.tpl'); } catch (Exception $e) { magixcjquery_debug_magixfire::magixFireError($e); } } }
/** * Upload une image * @param files $img * @param dir $path * @param bool $debug * @return null|string */ public static function upload_img($img, $path, $debug = false) { $error = null; $firebug = new magixcjquery_debug_magixfire(); if (isset($_FILES[$img])) { if ($_FILES[$img]['error'] == UPLOAD_ERR_OK) { if (self::image_valid($_FILES[$img]['tmp_name']) === false) { $error .= 'Mauvais format d\'image (gif,png,jpeg uniquement)'; } else { if (!is_readable($_FILES[$img]["tmp_name"])) { $tmp_img = chmod($_FILES[$img]["tmp_name"], 0777); } else { $tmp_img = $_FILES[$img]["tmp_name"]; } //if(chmod($_FILES[$img]["tmp_name"],0777)){ if (is_uploaded_file($_FILES[$img]["tmp_name"])) { $source = $tmp_img; $cible = magixglobal_model_system::base_path() . $path . magixcjquery_url_clean::rplMagixString($_FILES[$img]["name"]); if (self::imgSizeMax($source, 2500, 2500) == false) { $error .= 'La taille maximum excéde'; } elseif (self::imgSizeMin($source, 5, 5) == false) { $error .= 'Le fichier est trop petit'; } else { if (!move_uploaded_file($source, $cible)) { $error .= 'Erreur de fichier temporaire'; } else { if ($debug != false) { $firebug->magixFireGroup('Upload image infos'); $firebug->magixFireLog('Success', 'Status'); $firebug->magixFireLog($source, 'Source'); $firebug->magixFireLog($cible, 'Cible'); $firebug->magixFireGroupEnd(); } } } } else { $error .= 'Erreur d\'écriture du disque'; } //} } } elseif (UPLOAD_ERR_INI_SIZE == true) { $error .= 'Le fichier est trop grand'; } elseif (UPLOAD_ERR_CANT_WRITE == true) { $error .= 'Erreur d\'écriture du disque'; } elseif (UPLOAD_ERR_FORM_SIZE == true) { $error .= 'Le fichier est trop grand: Taille maximum 2000x2000'; } } elseif (UPLOAD_ERR_NO_FILE == true) { $error .= 'Aucun fichier'; } else { $error .= 'Erreur d\'écriture du disque'; } if ($error != null) { $n = $firebug->magixFireGroup('Upload image analyse'); $n .= $firebug->magixFireLog($error); $n .= $firebug->magixFireGroupEnd(); } else { $n = NULL; } return $n; }
/** * @access private * Vérification de la session pour accèder à l'administration * @param bool $debug */ private function authSession($debug = false) { //Language model init class $language = new backend_model_language(); $language->run(); $token = isset($_SESSION['mc_auth_token']) ? $_SESSION['mc_auth_token'] : magixglobal_model_cryptrsa::tokenId(); $tokentools = $this->hashPassCreate($token); backend_controller_template::assign('hashpass', $tokentools); if (isset($this->email_admin) and isset($this->passwd_admin) and isset($this->hashtoken)) { if (strcasecmp($this->hashtoken, $tokentools) == 0) { if ($debug == true) { $firebug = new magixcjquery_debug_magixfire(); $firebug->magixFireGroup('tokentest'); if ($this->hashtoken) { if (strcasecmp($this->hashtoken, $tokentools) == 0) { $firebug->magixFireLog('session compatible'); } else { $firebug->magixFireError('session incompatible'); } } $firebug->magixFireLog($_SESSION); $firebug->magixFireGroupEnd(); } $auth_exist = parent::s_auth_exist($this->email_admin, $this->passwd_admin); if (count($auth_exist['id_admin']) == true) { $session = new backend_model_sessions(); $lang = new backend_model_language(); $string = $_SERVER['HTTP_USER_AGENT']; $string .= 'SHIFLETT'; /* Add any other data that is consistent */ $fingerprint = md5($string); //Fermeture de la première session, ses données sont sauvegardées. session_write_close(); $this->start_session(); $data = parent::s_data_session($auth_exist['keyuniqid_admin']); if (!isset($_SESSION['email_admin']) and !isset($_SESSION['keyuniqid_admin'])) { $lang = new backend_model_language(); $session->openSession($data['id_admin'], session_regenerate_id(true), $data['keyuniqid_admin']); //session_regenerate_id(true); $_SESSION['id_admin'] = $data['id_admin']; $_SESSION['email_admin'] = $data['email_admin']; $_SESSION['keyuniqid_admin'] = $data['keyuniqid_admin']; $_SESSION['adminLanguage'] = $lang->run(); if ($debug == true) { $firebug = new magixcjquery_debug_magixfire(); $firebug->magixFireGroup('adminsession'); $firebug->magixFireDump('User session', $_SESSION); $firebug->magixFireGroupEnd(); } magixglobal_model_redirect::backend_redirect_login(false); } else { $session->openSession($data['id_admin'], null, $data['keyuniqid_admin']); $_SESSION['id_admin'] = $data['id_admin']; $_SESSION['email_admin'] = $data['email_admin']; $_SESSION['keyuniqid_admin'] = $data['keyuniqid_admin']; $_SESSION['adminLanguage'] = $lang->run(); if ($debug == true) { $firebug = new magixcjquery_debug_magixfire(); $firebug->magixFireGroup('adminsession'); $firebug->magixFireDump('User session', $_SESSION); $firebug->magixFireGroupEnd(); } magixglobal_model_redirect::backend_redirect_login(false); } } else { $this->message->getNotify('error_login', array('method' => 'fetch', 'assignFetch' => 'login_message')); } } else { $this->message->getNotify('error_hash', array('method' => 'fetch', 'assignFetch' => 'login_message')); } } }
/** * erase Recursive file in multi dir * @param string $directory */ public function removeRecursiveFile($directory, $debug = false) { $objects = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($directory), RecursiveIteratorIterator::SELF_FIRST); $dir = null; foreach ($objects as $name => $object) { if ($object->isDir($name)) { continue; } if ($debug == true) { $dir[] .= $name; magixcjquery_debug_magixfire::magixFireInfo($dir); } else { $dir[] .= @unlink($name); } } return $dir; }
public function tabs_json_encode($params, $arg = array('item' => '', 'action' => ''), $debug = false) { /*if(is_array($params)){ $result = array(); foreach ($params as $key){ if($debug!=false){ $firebug = new magixcjquery_debug_magixfire(); $firebug->magixFireDump('Dump json encode', $params); } if($exclude != ''){ $tabs = $this->array_delete_key($key, $exclude,$debug); }else{ $tabs = $key; } $result[]= json_encode($tabs); } $this->stack_error(); return $result; }*/ if (is_array($params)) { $firebug = new magixcjquery_debug_magixfire(); if ($debug != false) { $firebug->magixFireDump('Dump json encode', $params); } foreach ($params as $key => $val) { if ($arg['action'] != '') { switch ($arg['action']) { case 'delete': if (isset($val[$arg['item']])) { unset($params[$key][$arg['item']]); } break; /*case 'replace': if (isset($val[$arg['item']])) { if($params[$key][$arg['item']] != null){ $params[$key][$arg['item']] = $arg['replace'][0]; }else{ $params[$key][$arg['item']] = $arg['replace'][1]; } } break;*/ } /*if (isset($val[$exclude])) { if($params[$key][$exclude] != null){ $params[$key][$exclude] = '1'; }else{ $params[$key][$exclude] = '0'; } }*/ } $tabs = $params[$key]; $result[] = json_encode($tabs); } $this->stack_error(); return $result; } else { throw new Exception('tabs json is not array :' . $params); } }
/** * Initialise le système de LOG du CMS * @param string $str * @param void $e (paramètre Exception) */ public static function magixlog($str, $e) { //Systeme de log + firephp $log = magixcjquery_error_log::getLog(); $log->logfile = M_TMP_DIR; $log->write($str . $e->getMessage(), __FILE__, $e->getLine()); magixcjquery_debug_magixfire::magixFireError($e); }
exit; } $phpthumb = dirname(__FILE__) . '/phpthumb/ThumbLib.inc.php'; if (file_exists($phpthumb)) { require $phpthumb; } else { print 'Error thumbnail Config'; exit; } /** * Include smarty3 */ $smarty = dirname(__FILE__) . '/smarty3/Smarty.class.php'; if (file_exists($smarty)) { require $smarty; } else { print 'Error Smarty Config'; exit; } /* * Chargement automatique des classes plugins */ $loadplugin = dirname(__FILE__) . '/../plugins/autoload.php'; if (file_exists($loadplugin)) { require $loadplugin; } if (defined('M_FIREPHP')) { if (M_FIREPHP) { magixcjquery_debug_magixfire::configErrorHandler(); } }
/** * function debug pagination * * @param void $page * @param void $num_pages * @param int $limit * @param void $getpage */ private function debugPager($page, $num_pages, $limit, $getpage) { /*debug*/ if (defined('M_LOG')) { if (M_LOG == 'debug' and M_FIREPHP == true) { $FirePHPOpt = array('Collapsed' => false, 'Color' => '#FF772F'); magixcjquery_debug_magixfire::magixFireGroup('Test pagination', $FirePHPOpt); magixcjquery_debug_magixfire::magixFireLog($page, 'Page'); magixcjquery_debug_magixfire::magixFireLog($num_pages, 'Page number'); magixcjquery_debug_magixfire::magixFireLog($limit, 'Limit'); magixcjquery_debug_magixfire::magixFireGroupEnd(); $page = max($getpage, 1); magixcjquery_debug_magixfire::magixFireGroup('Test pagination', $FirePHPOpt); magixcjquery_debug_magixfire::magixFireLog($page, 'Page'); magixcjquery_debug_magixfire::magixFireLog($num_pages, 'Page number'); magixcjquery_debug_magixfire::magixFireLog($limit, 'Limit'); magixcjquery_debug_magixfire::magixFireGroupEnd(); $page = min($getpage, $num_pages); magixcjquery_debug_magixfire::magixFireGroup('Test pagination', $FirePHPOpt); magixcjquery_debug_magixfire::magixFireLog($page, 'Page'); magixcjquery_debug_magixfire::magixFireLog($num_pages, 'Page number'); magixcjquery_debug_magixfire::magixFireLog($limit, 'Limit'); magixcjquery_debug_magixfire::magixFireGroupEnd(); if ($getpage > $limit || $getpage <= 0) { $page = 1; } magixcjquery_debug_magixfire::magixFireGroup('Test pagination', $FirePHPOpt); magixcjquery_debug_magixfire::magixFireLog($page, 'Page'); magixcjquery_debug_magixfire::magixFireLog($num_pages, 'Page number'); magixcjquery_debug_magixfire::magixFireLog($limit, 'Limit'); magixcjquery_debug_magixfire::magixFireGroupEnd(); } } else { print 'Page : ' . $page . '<br />Num_Pages : ' . $num_pages . '<br />Limit : ' . $limit . '##########<br />'; $page = max($getpage, 1); print 'Page : ' . $page . '<br />Num_Pages : ' . $num_pages . '<br />Limit : ' . $limit . '##########<br />'; $page = min($getpage, $num_pages); print 'Page : ' . $page . '<br />Num_Pages : ' . $num_pages . '<br />Limit : ' . $limit . '##########<br />'; if ($getpage > $limit || $getpage <= 0) { $page = 1; } print 'Page : ' . $page . '<br />Num_Pages : ' . $num_pages . '<br />Limit : ' . $limit . '##########<br />'; } }