예제 #1
0
 public static function fire($value)
 {
     $dbgs = array_shift(debug_backtrace());
     $msg = date('[ Y-m-d H:i:s ]' . "\n");
     $msg .= 'file: ' . $dbgs['file'] . "\n";
     $msg .= 'line: ' . $dbgs['line'] . "\n\n";
     FB::warn($msg);
     FB::error($value);
 }
예제 #2
0
 private function __construct()
 {
     // Handles debugging. If TRUE, displays all errors and enables FirePHP logging
     if (ACTIVATE_DEBUG_MODE === TRUE) {
         ini_set("display_errors", 1);
         ERROR_REPORTING(E_ALL);
         FB::setEnabled(TRUE);
         FB::warn("FirePHP logging is enabled! Sensitive data may be exposed.");
         ChromePhp::warn("ChromePHP logging is enabled! Sensitive data may be exposed.");
     } else {
         ini_set("display_errors", 0);
         error_reporting(0);
         FB::setEnabled(FALSE);
     }
 }
예제 #3
0
 public function &get($key = null)
 {
     if (is_array($key)) {
         $ret = array();
         foreach ($key as $k => $v) {
             $ret[$k] =& self::get($v);
         }
         return $ret;
     }
     $start = microtime(true);
     $data = shm_get_var(self::$SHMhandle, self::getVarKey($key));
     if (!is_null($data)) {
         if (time() <= $data['expire']) {
             return $data['data'];
         } else {
             @shm_remove_var(self::$SHMhandle, self::getVarKey($key));
         }
     }
     FB::warn("Cache Miss {$key}: " . (microtime(true) - $start));
     return null;
 }
예제 #4
0
 public function actionIndex()
 {
     // logging an INFO message
     Yii::log('This is an info message.', CLogger::LEVEL_INFO);
     // logging a WARNING message
     Yii::log("You didn't setup a profile, are you really a person?", CLogger::LEVEL_WARNING);
     // logging with a CATEGORY (categories are displayed as "labels" in FirePHP -- just an additional info text)
     Yii::log('Profile successfully created', CLogger::LEVEL_INFO, 'application.user.profiles');
     // tracing simple text
     Yii::trace('Loading application.user.profiles.ninja', 'application.user.profiles');
     // logging an ERROR
     Yii::log('We have successfully determined that you are not a person', CLogger::LEVEL_ERROR, 'Any category/label will work');
     // If you need to log an array, you can use FirePHP's core methods
     FB::warn(array('a' => 'b', 'c' => 'd'), 'an.array.warning');
     // Profiling
     Yii::beginProfile('rendering');
     for ($i = 0; $i < 30; $i++) {
         $this->runProfilingSampleLoop();
     }
     $this->render('index');
     Yii::endProfile('rendering');
 }
예제 #5
0
 /**
  * (non-PHPdoc)
  * @see debugObject::msg()
  */
 public function msg($msg, $level = DEBUG_LOG)
 {
     if (!empty($msg) && $this->_level & $level) {
         if (DEBUG_INFO & $level) {
             if (is_array($msg)) {
                 FB::group(current($msg), array('Collapsed' => true));
                 FB::info($msg);
                 FB::groupEnd();
             } else {
                 FB::info($msg);
             }
         } elseif (DEBUG_ERROR & $level || DEBUG_STRICT & $level) {
             if (is_array($msg)) {
                 FB::group(current($msg), array('Collapsed' => true, 'Color' => '#FF0000'));
                 FB::error($msg);
                 FB::groupEnd();
             } else {
                 FB::error($msg);
             }
         } elseif (DEBUG_WARNING & $level) {
             if (is_array($msg)) {
                 FB::group(current($msg), array('Collapsed' => true, 'Color' => '#FF0000'));
                 FB::warn($msg);
                 FB::groupEnd();
             } else {
                 FB::warn($msg);
             }
         } else {
             if (is_array($msg)) {
                 FB::group(current($msg), array('Collapsed' => true));
                 FB::log($msg);
                 FB::groupEnd();
             } else {
                 FB::log($msg);
             }
         }
     }
 }
예제 #6
0
 /**
  * Legge il quiz da file XML.
  * Cerca il file in  "$content_path/$itemid/$itemid.xml".
  * 
  * @param int $itemid ID del contenuto di cui si vogliono i jumper. 
  * @param string $content_path Percorso dove cercare il file XML.
  * @return array 
  */
 public function getQuizXML($path)
 {
     try {
         $path .= '/quiz.xml';
         $filepath = JPATH_BASE . "/" . $path;
         if (!file_exists($filepath)) {
             FB::warn("Il file QUIZ.XML non esiste, ma nessun problema, procedo senza di lui!");
             return array();
         }
         $domande = array();
         $risposte = array();
         $xml = new DOMDocument();
         $xml->load($path);
         $quiz = $xml->getElementsByTagName('quiz');
         $i = 0;
         foreach ($quiz as $point) {
             foreach ($point->childNodes as $node) {
                 $domande[$i]['id'] = $i;
                 if ('Time' == $node->nodeName) {
                     $domande[$i]['time'] = $node->nodeValue;
                 } elseif ('domanda' == $node->nodeName) {
                     $domande[$i]['domanda'] = $node->nodeValue;
                 } elseif ('corretta' == $node->nodeName) {
                     $corretta = $node->nodeValue;
                 } elseif ('risposta1' == $node->nodeName) {
                     $domande[$i]['risposte'][1]['r'] = $node->nodeValue;
                     $domande[$i]['risposte'][1]['c'] = 1 == $corretta ? r : w;
                 } elseif ('risposta2' == $node->nodeName) {
                     $domande[$i]['risposte'][2]['r'] = $node->nodeValue;
                     $domande[$i]['risposte'][2]['c'] = 2 == $corretta ? r : w;
                 } elseif ('risposta3' == $node->nodeName) {
                     $domande[$i]['risposte'][3]['r'] = $node->nodeValue;
                     $domande[$i]['risposte'][3]['c'] = 3 == $corretta ? r : w;
                 }
                 shuffle($domande[$i]['risposte']);
             }
             $i++;
         }
         unset($xml);
         unset($quiz);
         return $domande;
     } catch (Exception $e) {
         FB::error($e);
     }
     return 0;
 }
예제 #7
0
    function __construct()
    {
        ob_start();
        // Display time it took to create the entire page in the footer
        jimport('joomla.error.profiler');
        $__kstarttime = JProfiler::getmicrotime();
        $kunena_config = KunenaFactory::getConfig();
        kimport('error');
        KunenaError::initialize();
        // First of all take a profiling information snapshot for JFirePHP
        if (JDEBUG) {
            require_once JPATH_COMPONENT . '/lib/kunena.profiler.php';
            $__profiler = KProfiler::GetInstance();
            $__profiler->mark('Start');
        }
        $func = JString::strtolower(JRequest::getCmd('func', JRequest::getCmd('view', '')));
        $do = JRequest::getCmd('do', '');
        $task = JRequest::getCmd('task', '');
        $format = JRequest::getCmd('format', 'html');
        JRequest::setVar('func', $func);
        // Workaround for Joomla 1.7.3 login bug, see: https://github.com/joomla/joomla-platform/pull/740
        if ($func == 'profile' && ($task == 'login' || $task == 'logout')) {
            require_once KUNENA_PATH_FUNCS . '/profile.php';
            $page = new CKunenaProfile(JFactory::getUser()->id, $task);
        }
        require_once KUNENA_PATH . '/router.php';
        if ($func && !isset(KunenaRouter::$functions[$func])) {
            // If func is not legal, raise joomla error
            return JError::raiseError(404, 'Kunena function "' . $func . '" not found');
        }
        $kunena_app = JFactory::getApplication();
        if (empty($_POST) && $format == 'html') {
            $me = KunenaFactory::getUser();
            $menu = JSite::getMenu();
            $active = $menu->getActive();
            // Joomla 1.6+ multi-language support
            if (isset($active->language) && $active->language != '*') {
                $language = JFactory::getDocument()->getLanguage();
                if (strtolower($active->language) != strtolower($language)) {
                    $this->redirect(KunenaRoute::_(null, false));
                }
            }
            // Legacy menu item and Itemid=0 support with redirect and notice
            if (empty($active->query['view'])) {
                $new = $menu->getItem(KunenaRoute::getItemID());
                if ($new) {
                    if ($active) {
                        if ($active->route == $new->route) {
                            KunenaError::warning(JText::sprintf('COM_KUNENA_WARNING_MENU_CONFLICT', $active->route, $active->id, $new->id), 'menu');
                            $menu->setActive($new->id);
                            $active = $new;
                        } else {
                            KunenaError::warning(JText::sprintf('COM_KUNENA_WARNING_MENU_LEGACY', $active->route, $active->id, $new->route, $new->id), 'menu');
                            $this->redirect(KunenaRoute::_(null, false));
                        }
                    } else {
                        KunenaError::warning(JText::sprintf('COM_KUNENA_WARNING_MENU_NO_ITEM_REDIRECT', $new->route, $new->id));
                        $this->redirect(KunenaRoute::_(null, false));
                    }
                } elseif (!$active) {
                    KunenaError::warning(JText::sprintf('COM_KUNENA_WARNING_MENU_NO_ITEM'));
                }
            }
            if (!$func || $func == 'entrypage') {
                // If we are currently in entry page, we need to show and highlight default menu item
                if (!empty($active->query['defaultmenu'])) {
                    $defaultitem = $active->query['defaultmenu'];
                    if ($defaultitem > 0) {
                        $newitem = $menu->getItem($defaultitem);
                        if (!$newitem) {
                            KunenaError::warning(JText::sprintf('COM_KUNENA_WARNING_MENU_NOT_EXISTS'), 'menu');
                        } elseif (empty($newitem->component) || $newitem->component != 'com_kunena') {
                            KunenaError::warning(JText::sprintf('COM_KUNENA_WARNING_MENU_NOT_KUNENA'), 'menu');
                        } elseif ($active->route == $newitem->route) {
                            // Special case: we are using Entry Page instead of menu alias and we have identical menu alias
                            if ($active->id != $newitem->id) {
                                $defaultitem = !empty($newitem->query['defaultmenu']) ? $newitem->query['defaultmenu'] : $newitem->id;
                                $newitem2 = $menu->getItem($defaultitem);
                                if (empty($newitem2->component) || $newitem2->component != 'com_kunena') {
                                    $defaultitem = $newitem->id;
                                }
                                if ($defaultitem) {
                                    $menu->setActive($defaultitem);
                                    $active = $menu->getActive();
                                }
                            }
                        } else {
                            $oldlocation = KunenaRoute::getCurrentMenu();
                            $menu->setActive($defaultitem);
                            $active = $menu->getActive();
                            $newlocation = KunenaRoute::getCurrentMenu();
                            if (!$oldlocation || $oldlocation->id != $newlocation->id) {
                                // Follow Default Menu Item if it's not in the same menu
                                $this->redirect(KunenaRoute::_($defaultitem, false));
                            }
                        }
                        if (is_object($active)) {
                            foreach ($active->query as $var => $value) {
                                if ($var == 'view') {
                                    $var = 'func';
                                }
                                if ($var == 'func' && $value == 'entrypage') {
                                    $value = $func;
                                }
                                JRequest::setVar($var, $value);
                            }
                            $func = JRequest::getCmd('func');
                        }
                    }
                }
            }
            $newItemid = KunenaRoute::getItemid();
            if ($active && $newItemid && !KunenaRoute::getCurrentMenu() && $active->id != $newItemid) {
                $newroute = KunenaRoute::_($newItemid, false);
                if (strpos('/' . $active->route, $newroute) === 0) {
                    $menu->setActive($newItemid);
                    $active = $menu->getActive();
                } else {
                    $this->redirect(KunenaRoute::_(null, false));
                }
            }
        }
        global $message;
        global $kunena_this_cat;
        // Get all the variables we need and strip them in case
        $action = JRequest::getCmd('action', '');
        $catid = JRequest::getInt('catid', 0);
        $contentURL = JRequest::getVar('contentURL', '');
        $email = JRequest::getVar('email', '');
        $favoriteMe = JRequest::getVar('favoriteMe', '');
        $fb_authorname = JRequest::getVar('fb_authorname', '');
        $fb_thread = JRequest::getInt('fb_thread', 0);
        $id = JRequest::getInt('id', 0);
        $mesid = JRequest::getInt('mesid', 0);
        $limit = JRequest::getInt('limit', 0);
        $limitstart = JRequest::getInt('limitstart', 0);
        $markaction = JRequest::getVar('markaction', '');
        $message = JRequest::getVar('message', '');
        $page = JRequest::getInt('page', 0);
        $parentid = JRequest::getInt('parentid', 0);
        $pid = JRequest::getInt('pid', 0);
        $replyto = JRequest::getInt('replyto', 0);
        $resubject = JRequest::getVar('resubject', '');
        $rowid = JRequest::getInt('rowid', 0);
        $rowItemid = JRequest::getInt('rowItemid', 0);
        $subject = JRequest::getVar('subject', '');
        $subscribeMe = JRequest::getVar('subscribeMe', '');
        $thread = JRequest::getInt('thread', 0);
        $topic_emoticon = JRequest::getVar('topic_emoticon', '');
        $userid = JRequest::getInt('userid', 0);
        $no_html = JRequest::getBool('no_html', 0);
        // If JFirePHP is installed and enabled, leave a trace of the Kunena startup
        if (JDEBUG == 1 && defined('JFIREPHP')) {
            // FB::trace("Kunena Startup");
        }
        // Redirect Forum Jump
        if (isset($_POST['func']) && $func == "showcat") {
            header("HTTP/1.1 303 See Other");
            header("Location: " . KunenaRoute::_('index.php?option=com_kunena&func=showcat&catid=' . $catid, false));
            $kunena_app->close();
        }
        $kunena_my =& JFactory::getUser();
        $kunena_db =& JFactory::getDBO();
        $document = JFactory::getDocument();
        $document->addScriptDeclaration('// <![CDATA[
var kunena_toggler_close = "' . JText::_('COM_KUNENA_TOGGLER_COLLAPSE') . '";
var kunena_toggler_open = "' . JText::_('COM_KUNENA_TOGGLER_EXPAND') . '";
// ]]>');
        global $lang, $topic_emoticons;
        // Class structure should be used after this and all the common task should be moved to this class
        require_once JPATH_COMPONENT . '/class.kunena.php';
        // Central Location for all internal links
        require_once JPATH_COMPONENT . '/lib/kunena.link.class.php';
        require_once JPATH_COMPONENT . '/lib/kunena.smile.class.php';
        // Redirect profile (menu item) to the right component
        if ($func == 'profile' && !$do && empty($_POST)) {
            $redirect = 1;
            if (!empty($active)) {
                $params = new JParameter($active->params);
                $redirect = $params->get('integration', 1);
            }
            if ($redirect) {
                $profileIntegration = KunenaFactory::getProfile();
                if (!$profileIntegration instanceof KunenaProfileKunena) {
                    $url = CKunenaLink::GetProfileURL($kunena_my->id, false);
                    if ($url) {
                        $this->redirect($url);
                    }
                }
            }
        }
        // Check for JSON request
        if ($func == "json") {
            if (JDEBUG == 1 && defined('JFIREPHP')) {
                FB::log('Kunena JSON request');
            }
            // URL format for JSON requests: e.g: index.php?option=com_kunena&func=json&action=autocomplete&do=getcat
            require_once JPATH_COMPONENT . '/lib/kunena.ajax.helper.php';
            $ajaxHelper =& CKunenaAjaxHelper::getInstance();
            // Get the document object.
            $document =& JFactory::getDocument();
            // Set the MIME type for JSON output.
            $document->setMimeEncoding('application/json');
            // Change the suggested filename.
            if ($action != 'uploadfile') {
                JResponse::setHeader('Content-Disposition', 'attachment; filename="kunena.json"');
            }
            $value = JRequest::getVar('value', '');
            JResponse::sendHeaders();
            if ($kunena_config->board_offline && !CKunenaTools::isAdmin()) {
                // when the forum is offline, we don't entertain json requests
                json_encode(array('status' => '0', 'error' => @sprintf(_KUNENA_FORUM_OFFLINE)));
            } else {
                // Generate reponse
                echo $ajaxHelper->generateJsonResponse($action, $do, $value);
            }
            $kunena_app->close();
        }
        if ($kunena_config->board_offline && !CKunenaTools::isAdmin()) {
            // if the board is offline
            echo $kunena_config->offline_message;
        } else {
            if ($kunena_config->regonly && !$kunena_my->id) {
                // if we only allow registered users
                if (file_exists(KUNENA_JTEMPLATEPATH . '/css/kunena.forum-min.css')) {
                    CKunenaTools::addStyleSheet(KUNENA_JTEMPLATEURL . '/css/kunena.forum-min.css');
                } else {
                    CKunenaTools::addStyleSheet(KUNENA_TMPLTCSSURL);
                }
                echo '<div id="Kunena">';
                $this->header = JText::_('COM_KUNENA_LOGIN_NOTIFICATION');
                $this->body = JText::_('COM_KUNENA_LOGIN_FORUM');
                CKunenaTools::loadTemplate('/login.php');
                echo '</div>';
            } else {
                // =======================================================================================
                // Forum is online:
                //intercept the RSS request; we should stop afterwards
                if ($func == 'rss') {
                    require_once JPATH_COMPONENT . '/funcs/rss.php';
                    $feed = new CKunenaRSSView($catid);
                    $feed->display();
                    $kunena_app->close();
                }
                if ($func == 'fb_pdf' || $func == 'pdf') {
                    $httpReferer = JRequest::getVar('HTTP_REFERER', JURI::base(true), 'server');
                    if (KUNENA_JOOMLA_COMPAT == '1.5') {
                        include JPATH_COMPONENT . '/lib/kunena.pdf.php';
                        $kunena_app->close();
                    }
                }
                $format = JRequest::getCmd('format', 'html');
                if ($format != 'html') {
                    echo "Kunena: Unsupported output format {$format}, please use only format=html or .html";
                    $kunena_app->close();
                }
                $integration = KunenaFactory::getProfile();
                $integration->open();
                //time format
                include_once JPATH_COMPONENT . '/lib/kunena.timeformat.class.php';
                $document =& JFactory::getDocument();
                if (file_exists(KUNENA_ABSTMPLTPATH . '/initialize.php')) {
                    require_once KUNENA_ABSTMPLTPATH . '/initialize.php';
                } else {
                    require_once KPATH_SITE . '/template/default/initialize.php';
                }
                // Insert WhoIsOnlineDatas
                require_once KUNENA_PATH_LIB . '/kunena.who.class.php';
                $who =& CKunenaWhoIsOnline::getInstance();
                $who->insertOnlineDatas();
                // include required libraries
                jimport('joomla.template.template');
                // Kunena Current Template Icons Pack
                if (file_exists(KUNENA_ABSTMPLTPATH . '/icons.php')) {
                    include KUNENA_ABSTMPLTPATH . '/icons.php';
                } else {
                    include KUNENA_PATH_TEMPLATE_DEFAULT . '/icons.php';
                }
                if (JDEBUG) {
                    $__profiler->mark('Session Start');
                }
                // We only save session for registered users
                $kunena_session = KunenaFactory::getSession(true);
                if ($kunena_my->id > 0) {
                    // new indicator handling
                    if ($markaction == "allread") {
                        if (!JRequest::checkToken()) {
                            $kunena_app->enqueueMessage(JText::_('COM_KUNENA_ERROR_TOKEN'), 'error');
                            while (@ob_end_clean()) {
                            }
                            $kunena_app->redirect(CKunenaLink::GetCategoryURL('listcat', $catid, false));
                        }
                        $kunena_session->markAllCategoriesRead();
                    }
                    if (!$kunena_session->save()) {
                        $kunena_app->enqueueMessage(JText::_('COM_KUNENA_ERROR_SESSION_SAVE_FAILED'), 'error');
                    }
                    if ($markaction == "allread") {
                        while (@ob_end_clean()) {
                        }
                        $kunena_app->redirect(CKunenaLink::GetCategoryURL('listcat', $catid, false), JText::_('COM_KUNENA_GEN_ALL_MARKED'));
                    }
                    $userprofile = KunenaFactory::getUser();
                    if (!$userprofile->exists()) {
                        $userprofile->save();
                    }
                    // Assign previous visit without user offset to variable for templates to decide
                    $this->prevCheck = $kunena_session->lasttime;
                } else {
                    // For guests we don't show new posts
                    $this->prevCheck = CKunenaTimeformat::internalTime() + 60;
                }
                if (JDEBUG) {
                    $__profiler->mark('Session End');
                }
                //Get the topics this user has already read this session from #__kunena_sessions
                $this->read_topics = explode(',', $kunena_session->readtopics);
                /*       _\|/_
                             (o o)
                     +----oOO-{_}-OOo--------------------------------+
                     |    Until this section we have included the    |
                     |   necessary files and gathered the required   |
                     |     variables. Now let's start processing     |
                     |                     them                      |
                     +----------------------------------------------*/
                //Check if the catid requested is a parent category, because if it is
                //the only thing we can do with it is 'listcat' and nothing else
                if ($func == "showcat") {
                    if ($catid != 0) {
                        $kunena_db->setQuery("SELECT parent FROM #__kunena_categories WHERE id='{$catid}'");
                        $catParent = intval($kunena_db->loadResult());
                        if (KunenaError::checkDatabaseError()) {
                            return;
                        }
                    }
                    if ($catid == 0 || $catParent == 0) {
                        $this->redirect(CKunenaLink::GetCategoryURL('listcat', $catid, false));
                    }
                }
                $kunena_app->setUserState('com_kunena.redirect', null);
                ?>

<div id="Kunena"><?php 
                if ($kunena_config->board_offline) {
                    ?>
<span id="fbOffline"><?php 
                    echo JText::_('COM_KUNENA_FORUM_IS_OFFLINE');
                    ?>
</span> <?php 
                }
                ?>
 <?php 
                if (JDEBUG) {
                    $__profiler->mark('Profilebox Start');
                }
                CKunenaTools::loadTemplate('/menu.php');
                CKunenaTools::displayLoginBox();
                if (JDEBUG) {
                    $__profiler->mark('Profilebox End');
                }
                // Handle help / rules menuitems
                if ($func == 'article') {
                    $func = $do;
                }
                if (JDEBUG) {
                    $__profiler->mark('$func Start');
                }
                switch ($func) {
                    case 'who':
                        require_once KUNENA_PATH_LIB . '/kunena.who.class.php';
                        $online =& CKunenaWhoIsOnline::getInstance();
                        $online->displayWho();
                        break;
                    case 'announcement':
                        require_once KUNENA_PATH_LIB . '/kunena.announcement.class.php';
                        $ann = CKunenaAnnouncement::getInstance();
                        $ann->display();
                        break;
                    case 'poll':
                        require_once KUNENA_PATH_LIB . '/kunena.poll.class.php';
                        $kunena_polls =& CKunenaPolls::getInstance();
                        $kunena_polls->display();
                        break;
                    case 'polls':
                        require_once KUNENA_PATH_LIB . '/kunena.poll.class.php';
                        $kunena_polls =& CKunenaPolls::getInstance();
                        $kunena_polls->polldo();
                        break;
                    case 'stats':
                        require_once KUNENA_PATH_LIB . '/kunena.stats.class.php';
                        $kunena_stats = new CKunenaStats();
                        $kunena_stats->showStats();
                        break;
                    case 'myprofile':
                    case 'userprofile':
                    case 'fbprofile':
                    case 'profile':
                    case 'moderateuser':
                        require_once KUNENA_PATH_FUNCS . '/profile.php';
                        $page = new CKunenaProfile($userid, $task ? $task : $do);
                        $page->display();
                        break;
                    case 'userlist':
                        require_once KUNENA_PATH_FUNCS . '/userlist.php';
                        $page = new CKunenaUserlist();
                        $page->display();
                        break;
                    case 'post':
                        require_once KUNENA_PATH_FUNCS . '/post.php';
                        $page = new CKunenaPost();
                        $page->display();
                        break;
                    case 'view':
                        require_once KUNENA_PATH_FUNCS . '/view.php';
                        $layout = $kunena_app->getUserStateFromRequest("com_kunena.view_layout", 'layout', 'view');
                        $page = new CKunenaView($layout, $catid, $id, $limitstart, $limit, $mesid);
                        $page->display(true, true);
                        break;
                    case 'showcat':
                        require_once KUNENA_PATH_FUNCS . '/showcat.php';
                        $page = new CKunenaShowcat($catid, $page);
                        $page->display();
                        break;
                    case 'listcat':
                        require_once KUNENA_PATH_FUNCS . '/listcat.php';
                        $page = new CKunenaListcat($catid);
                        $page->display();
                        break;
                    case 'review':
                        require_once KUNENA_PATH_LIB . '/kunena.review.php';
                        $review = new CKunenaReview($catid);
                        $review->display();
                        break;
                    case 'rules':
                    case 'help':
                        CKunenaTools::loadTemplate('/' . $func . '.php');
                        break;
                    case 'report':
                        require_once KUNENA_PATH_LIB . '/kunena.report.class.php';
                        $report = new CKunenaReport();
                        $report->display();
                        break;
                    case 'latest':
                    case 'mylatest':
                    case 'noreplies':
                    case 'subscriptions':
                    case 'favorites':
                    case 'userposts':
                    case 'unapproved':
                    case 'deleted':
                        require_once KUNENA_PATH_FUNCS . '/latestx.php';
                        if ($do) {
                            $func = $do;
                        }
                        $page = new CKunenaLatestX($func, $page);
                        $page->display();
                        break;
                    case 'search':
                    case 'advsearch':
                        require_once JPATH_COMPONENT . '/lib/kunena.search.class.php';
                        $kunenaSearch = new CKunenaSearch();
                        $kunenaSearch->show();
                        break;
                    case 'markthisread':
                        if (!JRequest::checkToken('get')) {
                            $kunena_app->enqueueMessage(JText::_('COM_KUNENA_ERROR_TOKEN'), 'error');
                            while (@ob_end_clean()) {
                            }
                            $kunena_app->redirect(CKunenaLink::GetCategoryURL('showcat', $catid, false), JText::_('COM_KUNENA_GEN_FORUM_MARKED'));
                        }
                        // Mark all unread topics in the category to read
                        $readTopics = $kunena_session->readtopics;
                        $kunena_db->setQuery("SELECT thread FROM #__kunena_messages WHERE catid='{$catid}' AND parent=0 AND thread NOT IN ({$readTopics})");
                        $readForum = $kunena_db->loadResultArray();
                        if (KunenaError::checkDatabaseError()) {
                            return;
                        }
                        $readTopics = implode(',', array_merge(explode(',', $readTopics), $readForum));
                        $kunena_db->setQuery("UPDATE #__kunena_sessions set readtopics='{$readTopics}' WHERE userid={$kunena_my->id}");
                        $kunena_db->query();
                        if (KunenaError::checkDatabaseError()) {
                            return;
                        }
                        while (@ob_end_clean()) {
                        }
                        $kunena_app->redirect(CKunenaLink::GetCategoryURL('showcat', $catid, false), JText::_('COM_KUNENA_GEN_FORUM_MARKED'));
                        break;
                    case 'subscribecat':
                        if (!JRequest::checkToken('get')) {
                            $kunena_app->enqueueMessage(JText::_('COM_KUNENA_ERROR_TOKEN'), 'error');
                            if ($userid == 0) {
                                while (@ob_end_clean()) {
                                }
                                $kunena_app->redirect(CKunenaLink::GetCategoryURL('showcat', $catid, false));
                            } else {
                                while (@ob_end_clean()) {
                                }
                                $kunena_app->redirect(CKunenaLink::GetProfileURL($userid, false));
                            }
                        }
                        $success_msg = '';
                        if ($catid && $kunena_my->id) {
                            $query = "INSERT INTO #__kunena_subscriptions_categories (catid, userid) VALUES ('{$catid}','{$kunena_my->id}')";
                            $kunena_db->setQuery($query);
                            if (@$kunena_db->query() && $kunena_db->getAffectedRows() == 1) {
                                $success_msg = JText::_('COM_KUNENA_GEN_CATEGORY_SUBCRIBED');
                            }
                            KunenaError::checkDatabaseError();
                        }
                        while (@ob_end_clean()) {
                        }
                        $kunena_app->redirect(CKunenaLink::GetCategoryURL('showcat', $catid, false), $success_msg);
                        break;
                    case 'unsubscribecat':
                        if (!JRequest::checkToken('get')) {
                            $kunena_app->enqueueMessage(JText::_('COM_KUNENA_ERROR_TOKEN'), 'error');
                            if ($userid == 0) {
                                while (@ob_end_clean()) {
                                }
                                $kunena_app->redirect(CKunenaLink::GetCategoryURL('showcat', $catid, false), $success_msg);
                            } else {
                                while (@ob_end_clean()) {
                                }
                                $kunena_app->redirect(CKunenaLink::GetProfileURL($userid, false), $success_msg);
                            }
                        }
                        $success_msg = '';
                        if ($catid && $kunena_my->id) {
                            $query = "DELETE FROM #__kunena_subscriptions_categories WHERE catid={$catid} AND userid={$kunena_my->id}";
                            $kunena_db->setQuery($query);
                            if ($kunena_db->query() && $kunena_db->getAffectedRows() == 1) {
                                $success_msg = JText::_('COM_KUNENA_GEN_CATEGORY_UNSUBCRIBED');
                            }
                            KunenaError::checkDatabaseError();
                        }
                        if ($userid == 0) {
                            while (@ob_end_clean()) {
                            }
                            $kunena_app->redirect(CKunenaLink::GetCategoryURL('showcat', $catid, false), $success_msg);
                        } else {
                            while (@ob_end_clean()) {
                            }
                            $kunena_app->redirect(CKunenaLink::GetProfileURL($userid, false), $success_msg);
                        }
                        break;
                    case 'karma':
                        include JPATH_COMPONENT . '/lib/kunena.karma.php';
                        break;
                    case 'thankyou':
                        require_once JPATH_COMPONENT . '/lib/kunena.thankyou.php';
                        $thankyou = new CKunenaThankyou();
                        $thankyou->setThankyou();
                        break;
                    case 'bulkactions':
                        switch ($do) {
                            case "bulkDel":
                                CKunenaTools::KDeletePosts();
                                break;
                            case "bulkMove":
                                CKunenaTools::KMovePosts($catid);
                                break;
                            case "bulkFavorite":
                                if (!JRequest::checkToken()) {
                                    $kunena_app->enqueueMessage(JText::_('COM_KUNENA_ERROR_TOKEN'), 'error');
                                    while (@ob_end_clean()) {
                                    }
                                    $kunena_app->redirect(CKunenaLink::GetProfileURL($kunena_my->id, false));
                                }
                                require_once JPATH_ROOT . '/administrator/components/com_kunena/libraries/api.php';
                                $KunenaUserAPI = new KunenaUserAPI();
                                $cb = KGetArrayReverseInts("cb");
                                $result = $KunenaUserAPI->unfavoriteThreads($kunena_my->id, $cb);
                                if ($result) {
                                    $message = JText::_('COM_KUNENA_USER_UNFAVORITE_YES');
                                } else {
                                    $message = JText::_('COM_KUNENA_POST_UNFAVORITED_TOPIC');
                                }
                                while (@ob_end_clean()) {
                                }
                                $kunena_app->redirect(CKunenaLink::GetProfileURL($kunena_my->id, false), $message);
                                break;
                            case "bulkSub":
                                if (!JRequest::checkToken()) {
                                    $kunena_app->enqueueMessage(JText::_('COM_KUNENA_ERROR_TOKEN'), 'error');
                                    while (@ob_end_clean()) {
                                    }
                                    $kunena_app->redirect(CKunenaLink::GetProfileURL($kunena_my->id, false));
                                }
                                require_once JPATH_ROOT . '/administrator/components/com_kunena/libraries/api.php';
                                $KunenaUserAPI = new KunenaUserAPI();
                                $cb = KGetArrayReverseInts("cb");
                                $result = $KunenaUserAPI->unsubscribeThreads($kunena_my->id, $cb);
                                if ($result) {
                                    $message = JText::_('COM_KUNENA_USER_UNSUBSCRIBE_YES');
                                } else {
                                    $message = JText::_('COM_KUNENA_POST_NO_UNSUBSCRIBED_TOPIC');
                                }
                                while (@ob_end_clean()) {
                                }
                                $kunena_app->redirect(CKunenaLink::GetProfileURL($kunena_my->id, false), $message);
                                break;
                            case "bulkDelPerm":
                                CKunenaTools::KDeletePerm();
                                break;
                            case "bulkRestore":
                                CKunenaTools::KUndelete();
                                break;
                        }
                        break;
                    case 'template':
                        jimport('joomla.filesystem.path');
                        $name = JRequest::getString('name', JRequest::getString('kunena_template', '', 'COOKIE'));
                        while (@ob_end_clean()) {
                        }
                        if ($name) {
                            $name = JPath::clean($name);
                            if (!is_readable(KPATH_SITE . "/template/{$name}/template.xml")) {
                                $name = 'default';
                            }
                            setcookie('kunena_template', $name, 0, JURI::root(true) . '/');
                        } else {
                            setcookie('kunena_template', null, time() - 3600, JURI::root(true) . '/');
                        }
                        $kunena_app->redirect(CKunenaLink::GetKunenaURL(false));
                        break;
                    case 'credits':
                        include JPATH_COMPONENT . '/lib/kunena.credits.php';
                        break;
                    default:
                        require_once KUNENA_PATH_FUNCS . '/listcat.php';
                        $page = new CKunenaListcat($catid);
                        $page->display();
                        break;
                }
                if (JDEBUG) {
                    $__profiler->mark('$func End');
                }
                // Bottom Module
                CKunenaTools::showModulePosition('kunena_bottom');
                // PDF and RSS
                if ($kunena_config->enablerss || $kunena_config->enablepdf) {
                    if ($catid > 0) {
                        kimport('category');
                        $category = KunenaCategory::getInstance($catid);
                        if ($category->pub_access == 0 && $category->parent) {
                            $rss_params = '&amp;catid=' . (int) $catid;
                        }
                    } else {
                        $rss_params = '';
                    }
                    if (isset($rss_params) || $kunena_config->enablepdf) {
                        echo '<div class="krss-block">';
                        if ($kunena_config->enablepdf && $func == 'view' && KUNENA_JOOMLA_COMPAT == '1.5') {
                            // FIXME: add better translation:
                            echo CKunenaLink::GetPDFLink($catid, $limit, $limitstart, $id, CKunenaTools::showIcon('kpdf', JText::_('PDF')), 'nofollow', '', JText::_('PDF'));
                        }
                        if ($kunena_config->enablerss && isset($rss_params)) {
                            if ($kunena_config->rss_specification == 'atom1.0') {
                                $rss_specification = 'application/atom+xml';
                            } else {
                                $rss_specification = 'application/rss+xml';
                            }
                            $document->addCustomTag('<link rel="alternate" type="' . $rss_specification . '" title="' . JText::_('COM_KUNENA_LISTCAT_RSS') . '" href="' . CKunenaLink::GetRSSURL($rss_params) . '" />');
                            echo CKunenaLink::GetRSSLink(CKunenaTools::showIcon('krss', JText::_('COM_KUNENA_LISTCAT_RSS')), 'follow', $rss_params);
                        }
                        echo '</div>';
                    }
                }
                $template = KunenaFactory::getTemplate();
                $this->params = $template->params;
                // Credits
                echo '<div class="kcredits kms"> ' . CKunenaLink::GetTeamCreditsLink($catid, JText::_('COM_KUNENA_POWEREDBY')) . ' ' . CKunenaLink::GetCreditsLink();
                if ($this->params->get('templatebyText') != '') {
                    echo ' :: <a href ="' . $this->params->get('templatebyLink') . '" rel="follow">' . $this->params->get('templatebyText');
                    if ($this->params->get('templatebyName')) {
                        echo ' ' . $this->params->get('templatebyName') . '</a>';
                    } else {
                        echo '</a>';
                    }
                }
                echo '</div>';
                // display footer
                // Show total time it took to create the page
                $__ktime = JProfiler::getmicrotime() - $__kstarttime;
                ?>
	<div class="kfooter">
		<span class="kfooter-time"><?php 
                echo JText::_('COM_KUNENA_FOOTER_TIME_TO_CREATE') . '&nbsp;' . sprintf('%0.2f', $__ktime) . '&nbsp;' . JText::_('COM_KUNENA_FOOTER_TIME_SECONDS');
                ?>
</span>
	</div>
</div>
<!-- closes Kunena div -->
<?php 
                $document->addHeadLink(KunenaRoute::_(), 'canonical', 'rel', '');
                $integration = KunenaFactory::getProfile();
                $integration->close();
                //$params = JComponentHelper::getParams( 'com_kunena' );
                //if ($params->get( 'show_page_title' )) $document->setTitle ( $params->get( 'page_title' ) );
                if (empty($_POST) && $format == 'html') {
                    $default = KunenaRoute::getDefault();
                    if ($default) {
                        $menu->setActive($default->id);
                    }
                }
            }
        }
        // end of online
        if (JDEBUG == 1) {
            $__profiler->mark('Done');
            $__queries = $__profiler->getQueryCount();
            if (defined('JFIREPHP')) {
                FB::log($__profiler->getBuffer(), 'Kunena Profiler');
                if ($__queries > 50) {
                    FB::error($__queries, 'Kunena Queries');
                } else {
                    if ($__queries > 35) {
                        FB::warn($__queries, 'Kunena Queries');
                    } else {
                        FB::log($__queries, 'Kunena Queries');
                    }
                }
            }
        }
        ob_end_flush();
    }
예제 #8
0
파일: PDO.php 프로젝트: b091/mkphp-1
 /**
  * Zrzucenie SQL-a i jego parametrów do okna firebuga
  *
  * @param String $dumpName - nazwa wyświetlanej operacji
  * @param String $sql - zapytanie SQL
  * @param Array  $params - parametry zapytania (dane)
  * @param int    $execTime
  */
 public function fireBugSqlDump($dumpName, $sql = "", array $params = array(), $execTime = 0)
 {
     // Odczytanie klasy i metody, w której wyświetlony zostanie komunikat
     $className = get_class($this);
     $methodName = '';
     $filePath = '';
     $lineNumber = '';
     $traceList = debug_backtrace();
     $traceArr = array();
     foreach ($traceList as $trace) {
         if (!isset($trace['class']) || in_array($trace['class'], $this->sqlIgnoreClass)) {
             continue;
         }
         if (count($traceArr) == 0) {
             $className = $trace['class'];
             $methodName = isset($trace['function']) ? $trace['function'] : '';
             $filePath = isset($trace['file']) ? str_replace(APP_PATH, '', $trace['file']) : '';
             $lineNumber = isset($trace['line']) ? $trace['line'] : -1;
         }
         if (isset($trace['object'])) {
             unset($trace['object']);
         }
         $traceArr[] = $trace;
     }
     // Czas generowania SQL-a
     $sqlTime = microtime(true);
     $sqlTimeDiff = round($sqlTime - (isset($_SESSION['sql_last_time']) ? $_SESSION['sql_last_time'] : 0), 4);
     $execTime = round($execTime, 4);
     // Wyświetlenie komunikatu debug-a
     if (empty($sql)) {
         // Debugowanie dodatkowych informacji (utworzenie połączenia, otwarcie/zamknięcie transakcji)
         if (DB_DEBUG) {
             FB::info((object) array('OPERATION' => $dumpName, 'BACKTRACE' => $traceArr), "INFO ({$sqlTime} [+{$sqlTimeDiff}]) :: {$filePath}:{$lineNumber} :: {$className}->{$methodName}");
         }
     } else {
         FB::warn((object) array('OPERATION' => $dumpName, 'SQL+PARAMS' => $this->_sqlFormat($this->_prepareFullQuery($sql, $params)), 'SQL' => "\n" . $sql . "\n", 'PARAMS' => $params, 'BACKTRACE' => $traceArr), "SQL ({$sqlTime} [+{$sqlTimeDiff}ms] {{$execTime}ms}) :: {$filePath}:{$lineNumber} :: {$className}->{$methodName}");
     }
 }
예제 #9
0
 /**
  * Intefacet to FirePHP warn, just to make things easier
  *
  * @param       $data
  * @param		$label
  */
 public static function warn($data, $label)
 {
     FB::warn($data, $label);
 }
예제 #10
0
    public function __construct()
    {
        if (isset($_SESSION['carte_prefs']) && $_SESSION['carte_prefs'] != '') {
            $this->load_prefs($_SESSION['carte_prefs']);
        } else {
            $this->load_prefs('1;1;1;1;0;600;1;1;1');
        }
        $this->parcours = '';
        if (IS_IMG) {
            //            $this->inactif		= $_SESSION['inactif'];
            $this->IN = $_SESSION['IN'];
            $this->OUT = $_SESSION['OUT'];
            $this->loadfleet = isset($_SESSION['loadfleet']) ? $_SESSION['loadfleet'] : '';
            $this->parcours = $_SESSION['parcours'];
        } else {
            if (isset($_POST['coorin'])) {
                $this->IN = intval($_POST['coorin']);
            } else {
                $this->IN = 0;
            }
            if (isset($_POST['coorout'])) {
                $this->OUT = intval($_POST['coorout']);
            } else {
                $this->OUT = 0;
            }
            if ($this->IN < 1 || $this->IN > 10000) {
                $this->IN = '';
            }
            if ($this->OUT < 1 || $this->OUT > 10000) {
                $this->OUT = '';
            }
            $this->loadfleet = (isset($_REQUEST['loadfleet']) and intval($_REQUEST['loadfleet']) > 0) ? intval($_REQUEST['loadfleet']) : 0;
            $this->method = (isset($_REQUEST['method']) and intval($_REQUEST['method']) > 0) ? intval($_REQUEST['method']) : 2;
            //            $this->inactif		= ( isset($_POST['inactif']) 	&& $_POST['inactif'] > 0 ) 	? true: false;
            $this->nointrass = isset($_POST['nointrass']) && $_POST['nointrass'] > 0 ? true : false;
            $this->update_session();
            FB::warn($this->method, 'method');
        }
        // mise en variable, plus rapide que 36 call function
        if (($this->empire = trim(DataEngine::config_key('config', 'MyEmpire'))) == '') {
            $mysql_result = DataEngine::sql('Select g.`Grade` from
		`SQL_PREFIX_Membres` as m, `SQL_PREFIX_Grade` as g WHERE
		`Joueur`=\'' . sqlesc($_SESSION['_login']) . '\' AND (m.`Grade`=g.`GradeId`)');
            $ligne = mysql_fetch_assoc($mysql_result);
            $grade = $ligne['Grade'];
            $this->empire = $ligne['Grade'];
        }
        $this->cxx_empires = Members::CheckPerms('CARTE_SHOWEMPIRE');
        $this->lng = language::getinstance()->GetLngBlock('carte');
        $this->itineraire = $this->IN != '' && $this->OUT != '' && $this->IN != $this->OUT;
    }
예제 #11
0
include_once CMS_PATH . 'core/class.page.inc.php';
// FirePHP class for debugging (requires Firefox)
include_once CMS_PATH . 'debug/fb.php';
// Define site-wide constants
foreach ($_CONSTANTS as $key => $value) {
    define($key, $value);
}
/*
 * Handles debugging. If set to TRUE, displays all errors and enables logging 
 * through FirePHP.
 */
if (ACTIVATE_DEBUG_MODE === TRUE) {
    ini_set("display_errors", 1);
    ERROR_REPORTING(E_ALL);
    FB::setEnabled(TRUE);
    FB::warn("FirePHP logging enabled.");
} else {
    ini_set("display_errors", 0);
    error_reporting(0);
    FB::setEnabled(FALSE);
}
// URL Parsing - Read the URL and break it apart for processing
$url_array = Utilities::readUrl();
if (!is_array($url_array) && file_exists($url_array)) {
    require_once $url_array;
}
// Creates a database object
$dbo = new mysqli(DB_HOST, DB_USER, DB_PASS, DB_NAME);
// Creates the database tables if set to true
if (CREATE_DB === TRUE) {
    AdminUtilities::buildDB($menuPages);
예제 #12
0
 public function OnWarning($msg,$label=null)
 {
     \FB::warn($msg, $label);
 }
예제 #13
0
파일: kunena.php 프로젝트: kaantunc/MYK-BOR
        // Credits
        echo '<div class="fb_credits"> ' . CKunenaLink::GetTeamCreditsLink($catid, _KUNENA_POWEREDBY) . ' ' . CKunenaLink::GetCreditsLink();
        if ($fbConfig->enablerss) {
            $document->addCustomTag('<link rel="alternate" type="application/rss+xml" title="' . _LISTCAT_RSS . '" href="' . JRoute::_(KUNENA_LIVEURLREL . '&amp;func=fb_rss&amp;no_html=1') . '" />');
            echo CKunenaLink::GetRSSLink('<img class="rsslink" src="' . KUNENA_URLEMOTIONSPATH . 'rss.gif" border="0" alt="' . _LISTCAT_RSS . '" title="' . _LISTCAT_RSS . '" />');
        }
        echo '</div>';
        // display footer
        $KunenaTemplate->displayParsedTemplate('kunena-footer');
    }
}
//else
if (is_object($kunenaProfile)) {
    $kunenaProfile->close();
}
if (JDEBUG == 1) {
    $__profiler->mark('Done');
    $__queries = $__profiler->getQueryCount();
    if (defined('JFIREPHP')) {
        FB::log($__profiler->getBuffer(), 'Kunena Profiler');
        if ($__queries > 50) {
            FB::error($__queries, 'Kunena Queries');
        } else {
            if ($__queries > 35) {
                FB::warn($__queries, 'Kunena Queries');
            } else {
                FB::log($__queries, 'Kunena Queries');
            }
        }
    }
}
예제 #14
0
파일: index.php 프로젝트: sudhir9026/demo
<?php

header("Content-type: text/html; charset=utf-8");
require_once 'fb.php';
FB::log('Log message');
FB::info('info message');
FB::warn('warn message');
FB::error('error message');
$var = array('abc');
fb($var, FirePHP::TRACE);
//End_php
예제 #15
0
파일: index.php 프로젝트: hxf829/Ironcms
<?php

session_start();
$_DEBUG = true;
//调试模式
include_once 'conn.php';
include_once 'library/basefunction.php';
include_once 'lang/envinit.php';
include_once 'templatefunction/Iron.article.php';
include_once 'templatefunction/Iron.column.php';
include_once 'templatefunction/Iron.label.php';
loadlibrary("library/third/FirePHPCore/fb.php");
FB::log('Log message');
FB::info('Info message');
FB::warn('Warn message');
FB::error('Error message');
readcache();
$siteconfig = getresult("SELECT * FROM I_siteconfig LIMIT 0 , 1");
//如果没有网站配置项
if (getresultNumrows($siteconfig) < 1) {
    die("<script type='text/javascript'>window.location='error.html'</script>");
}
$templateid = getresultData($siteconfig, 0, "indextemplate");
$templateinfo = getresult("select * from I_template where id={$templateid} limit 0,1");
if (getresultNumrows($templateinfo) < 1) {
    die("<script type='text/javascript'>window.location='error.html'</script>");
}
$templatepath = getresultData($templateinfo, 0, "path");
$templatefile = getroot() . "/templates/" . $templatepath;
//echo $templatefile;
if (!file_exists($templatefile)) {
예제 #16
0
<?php

FB::group('Test Group');
FB::send('Hello World');
FB::groupEnd();
FB::log('Log Message');
FB::info('Info Message');
FB::warn('Info Message');
FB::error('Info Message');
FB::trace('Trace to here');
FB::send('Trace to here', FirePHP::TRACE);
FB::table('2 SQL queries took 0.06 seconds', array(array('SQL Statement', 'Time', 'Result'), array('SELECT * FROM Foo', '0.02', array('row1', 'row2')), array('SELECT * FROM Bar', '0.04', array('row1', 'row2'))));
FB::dump('PHP Version', phpversion());
예제 #17
0
require_once CMS_PATH . 'core/images/class.imagecontrol.inc.php';
// FirePHP class for debugging (requires Firefox)
require_once CMS_PATH . 'core/debug/fb.php';
/*******************************************************************************
* Application settings — constants are defined, debug mode set, session checked
*******************************************************************************/
// Define site-wide constants
foreach ($_CONSTANTS as $key => $value) {
    define($key, $value);
}
// Handles debugging. If TRUE, displays all errors and enables FirePHP logging
if (ACTIVATE_DEBUG_MODE === TRUE) {
    ini_set("display_errors", 1);
    ERROR_REPORTING(E_ALL);
    FB::setEnabled(TRUE);
    FB::warn("FirePHP logging is enabled! Sensitive data may be exposed.");
} else {
    ini_set("display_errors", 0);
    error_reporting(0);
    FB::setEnabled(FALSE);
}
// Creates the database tables if set to true
if (BUILD_DATABASE === TRUE) {
    DB_Actions::build_database();
}
// Check for a valid session
AdminUtilities::check_session();
/*******************************************************************************
* Break apart the URL and determine what data needs to be loaded
*******************************************************************************/
// URL Parsing - Read the URL and break it apart for processing
예제 #18
0
define('FIREPHP_INFO', false);
define('FIREPHP_WARN', false);
define('FIREPHP_ERROR', false);
define('FIREPHP_TRACE', true);
require_once '../../Grace/FirePHPCore/fb.php';
FB::log('Hello World !');
// 常规记录
\FB::group('Test Group A', ['Collapsed' => true]);
// 记录分组
// 以下为按照不同类别或者类型进行信息记录
FB::log('Plain Message');
FB::info('Info Message');
FB::warn('Warn Message');
FB::error('Error Message');
FB::log('Message', 'Optional Label');
FB::info([1, 2, 3, 5, 56], "All Turtles");
FB::groupEnd();
FB::group('Test Group B');
FB::log('Hello World B');
FB::log('Plain Message');
FB::info('Info Message');
FB::warn('Warn Message');
FB::error('Error Message');
FB::log('Message', 'Optional Label');
FB::groupEnd();
$table[] = array('Col 1 Heading', 'Col 2 Heading', 'Col 2 Heading');
$table[] = array('Row 1 Col 1', 'Row 1 Col 2', 'Row 1 Col 2');
$table[] = array('Row 2 Col 1', 'Row 2 Col 2');
$table[] = array('Row 3 Col 1', 'Row 3 Col 2');
FB::table('Table Label', $table);
FB::trace('123', [1, 23, 4]);
예제 #19
0
 /**
  * use of FirePHP::warn() if allowed
  *
  * @param mixed $obj
  * @param string $label
  * @return void
  */
 public static function warn($obj, $label = '')
 {
     if (PS_USE_FIREPHP) {
         FB::warn($obj, $label);
     }
 }
예제 #20
0
파일: Message.php 프로젝트: phpburn/phpburn
 /**
  * Main function of Messaging System. It outputs a message based on the mode defined.
  * 
  * @param String $originalMessage
  * @param String $type
  * @return String
  * @return Boolean
  */
 public static function output($originalMessage, $type = self::NOTICE, $priority = self::NORMAL)
 {
     if (self::$mode == null) {
         self::setMode(self::CONSOLE);
     }
     if ($type == null) {
         $type = self::NOTICE;
     }
     //Searching if Views is loaded
     if (array_search('PhpBURN_Views', get_declared_classes()) == true) {
         $messageClass = 'PhpBURN_Views';
     } else {
         $messageClass = __CLASS__;
     }
     //Now time
     $time = mktime(date('H'), date('i'), date('s'), date('m'), date('d'), date('Y'));
     $time = strftime(SYS_USE_DATEFORMAT, $time);
     //Usage
     $usage = number_format(memory_get_usage() / 1048576, 2, ',', ' ');
     //  		$timing = getrusage();
     //Setup the message
     $message = sprintf("%s: [%s (%s MB)] ", $type, $time, $usage);
     $message .= var_export($originalMessage, true);
     $message .= "\r\n\r\n";
     //The breaklines
     //Sending the message
     switch (self::$mode) {
         case self::BROWSER:
         case self::CONSOLE:
             print $message = call_user_func(array($messageClass, 'lazyTranslate'), $message);
             break;
         case self::FIREBUG:
             $message = call_user_func(array($messageClass, 'lazyTranslate'), $message);
             switch ($type) {
                 case self::LOG:
                     FB::log($message);
                     break;
                 case self::WARNING:
                     FB::warn($message);
                     break;
                 case self::NOTICE:
                     FB::info($message);
                     break;
                 case self::ERROR:
                     FB::error($message);
                     break;
                 default:
                     FB::info($message);
                     break;
             }
             break;
         case self::FILE:
             $fileName = self::$fileName == null || !isset(self::$fileName) ? 'phpburn.log' : $this->fileName;
             $fileName = SYS_BASE_PATH . $fileName;
             $fp = fopen($fileName, 'a+');
             fwrite($fp, call_user_func(array($messageClass, 'lazyTranslate'), $message));
             fclose($fp);
             //@chmod($fileName, 0755);
             break;
         default:
             break;
     }
     if ($type == self::EXCEPTION) {
         throw new Exception($message);
     }
     unset($time, $usage, $message, $translatedType);
 }
예제 #21
0
 /**
  * Checks for the existence of a cached file with the ID passed
  *
  * @param string $cache_id  A string by which the cache is identified
  * @return mixed            The cached data if saved, else boolean FALSE
  */
 public static function check_cache($cache_id)
 {
     $cache_filepath = self::_generate_cache_filepath($cache_id);
     /*
      * If the cached file exists and is within the time limit defined in
      * CACHE_EXPIRES, load the cached data. Does not apply if the user is
      * logged in
      */
     if (file_exists($cache_filepath) && time() - filemtime($cache_filepath) <= CACHE_EXPIRES && !AdminUtilities::check_clearance(1)) {
         $cache = file_get_contents($cache_filepath);
         FB::warn("Data loaded from cache ({$cache_filepath})");
         return unserialize($cache);
     }
     return FALSE;
 }