コード例 #1
0
ファイル: NarroLogger.class.php プロジェクト: Jobava/narro
 private static function Log($strMessage, $intPriority, $intProjectId = null, $intLanguageId = null, $intUserId = null)
 {
     if (SERVER_INSTANCE != 'dev' && $intPriority == NarroLog::PRIORITY_DEBUG) {
         return true;
     }
     $objLogEntry = new NarroLog();
     $objLogEntry->Date = QDateTime::Now();
     $objLogEntry->Priority = $intPriority;
     $objLogEntry->Message = $strMessage;
     $objLogEntry->ProjectId = is_null($intProjectId) ? is_null(self::$intProjectId) ? null : self::$intProjectId : $intProjectId;
     $objLogEntry->LanguageId = is_null($intLanguageId) ? is_null(self::$intLanguageId) ? null : self::$intLanguageId : $intLanguageId;
     $objLogEntry->UserId = is_null($intUserId) ? is_null(self::$intUserId) ? null : self::$intUserId : $intUserId;
     try {
         $objLogEntry->Save();
     } catch (Exception $objEx) {
         error_log($objEx->getMessage() . $objEx->getTraceAsString());
     }
     if (QFirebug::getEnabled()) {
         switch ($intPriority) {
             case NarroLog::PRIORITY_INFO:
                 QFirebug::info($objLogEntry->Message . ' / ' . $objLogEntry->UserId . ' / ' . $objLogEntry->ProjectId . ' / ' . $objLogEntry->LanguageId);
                 break;
             case NarroLog::PRIORITY_WARN:
                 QFirebug::warn($objLogEntry->Message . ' / ' . $objLogEntry->UserId . ' / ' . $objLogEntry->ProjectId . ' / ' . $objLogEntry->LanguageId);
                 break;
             case NarroLog::PRIORITY_ERROR:
                 QFirebug::error($objLogEntry->Message . ' / ' . $objLogEntry->UserId . ' / ' . $objLogEntry->ProjectId . ' / ' . $objLogEntry->LanguageId);
                 break;
             default:
                 QFirebug::log($objLogEntry->Message . ' / ' . $objLogEntry->UserId . ' / ' . $objLogEntry->ProjectId . ' / ' . $objLogEntry->LanguageId);
         }
     }
 }
コード例 #2
0
ファイル: footer.inc.php プロジェクト: Jobava/narro
 *
 * You should have received a copy of the GNU General Public License along with this program; if not, write to the
 * Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 */
?>
    </div>
<?php 
if (class_exists('QApplication')) {
    if (QApplication::$Database[1]->EnableProfiling) {
        QApplication::$Database[1]->OutputProfiling();
    }
    if (SERVER_INSTANCE == 'dev') {
        QFirebug::table('Queries', @$GLOBALS['arrQueries']);
        QFirebug::info(sprintf('%d queries in total', count(@$GLOBALS['arrQueries'])));
        QFirebug::table('Cache', @$GLOBALS['arrCacheQueries']);
        QFirebug::info(sprintf('%d cache queries in total, %s seconds spent on them', count(@$GLOBALS['arrCacheQueries']), intval(@$GLOBALS['arrCacheQueriesSpent'])));
    }
}
/**
 * Yes, you are free to remove this footer
 */
?>
    <p align="center" style="font-size:small">
        <a target="_blank" href="http://code.google.com/p/narro/wiki/About">
            <?php 
echo sprintf(function_exists('t') ? t('%s, version %s') : '%s, version %s', 'Narro', NARRO_VERSION);
?>
        </a>
    </p>
    </body>
</html>