Exemple #1
0
	public static function debug($message, $tags = 'debug') {
		if(self::$instance) {
			$event = new PhpConsoleEvent();
			$event->message = $message;
			$event->tags = $tags;
			$event->type = $tags;
			self::$instance->handle($event);
		}
	}
 /**
  * Processes log messages and sends them to specific destination.	 *
  * @param array list of messages.	Each array elements represents one message
  * with the following structure:
  * array(
  *	 [0] => message (string)
  *	 [1] => level (string)
  *	 [2] => category (string)
  *	 [3] => timestamp (float, obtained by microtime(true));
  */
 protected function processLogs($logs)
 {
     foreach ($logs as $log) {
         if (is_scalar($log[0])) {
             if ($log[1] == 'info') {
                 PhpConsole::debug($log[0], $log[2]);
             } elseif ($log[1] == 'warning' || $log[1] == 'error') {
                 PhpConsole::debug($log[0], 'error,' . $log[2]);
             }
         }
     }
     return true;
 }
<?php

require_once __DIR__ . '/../../src/PhpConsole/__autoload.php';
\PhpConsole\OldVersionAdapter::register();
// register PhpConsole class emulator
// Call old PhpConsole v1 methods as is
PhpConsole::start(true, true, $_SERVER['DOCUMENT_ROOT']);
PhpConsole::debug('Debug using old method PhpConsole::debug()', 'some,tags');
debug('Debug using old function debug()', 'some,tags');
echo $undefinedVar;
PhpConsole::getInstance()->handleException(new Exception('test'));
// Call new PhpConsole methods, if you need :)
\PhpConsole\Connector::getInstance()->setServerEncoding('cp1251');
\PhpConsole\Helper::register();
PC::debug('Debug using new methods');
echo 'So there is an easy way to migrate from PhpConsole v1.x to v3.x without any code changes';
<?php

require_once 'sensitive_data.php';
require_once 'PhpConsole.php';
PhpConsole::start();
/** Clean cookies mm cookies **/
if (get_magic_quotes_gpc() == true) {
    foreach ($_COOKIE as $key => $value) {
        $_COOKIE[$key] = stripslashes($value);
    }
}
$champId = $_COOKIE['champId'];
$name = $_COOKIE['summoner_name'];
$mysqli = new mysqli($host, $username, $password);
$mysqli->select_db($database);
$query = 'SELECT win,lose FROM games';
$query .= " WHERE summonerName='{$name}' ";
$winrate = 0;
$gamesPlayed = 0;
$trend_arr = array();
$trendLength = 10;
// how many games is a 'trend'
$wins = 0;
$losses = 0;
$ret_arr = array();
$result = $mysqli->query($query);
if ($_POST['trendy']) {
    // if getting the trendy winrate
    if ($result) {
        while ($row = $result->fetch_assoc()) {
            $wins += $row['win'];
Exemple #5
0
 public function showJson()
 {
     header('Content-Type: application/json');
     if (isset($_GET["PhpConsoleLastId"])) {
         $lastId = (int) $_GET["PhpConsoleLastId"];
         $res = PhpConsole::get()->getAllMoreThan($lastId);
         echo json_encode($res);
         return;
     }
 }
Exemple #6
0
function run() {
    session_start();
    
    config();
    
    include cfg('admin_dir').'controllers.php';
    include cfg('lib_dir').'/phpconsole/PhpConsole.php';

    PhpConsole::start();


    router();
}
Exemple #7
0
 * @link         https://pl.nlm.nih.gov/about
 * @link         http://sahanafoundation.org
 * @license     http://www.gnu.org/licenses/lgpl-2.1.html GNU Lesser General Public License (LGPL)
 * @lastModified 2013.0120
 */

// define global $global['approot'] for convenience and efficiency;
$global['approot'] = realpath(dirname(__FILE__)) . '/../';
$global['previous'] = false;
$global['setup'] = false;


// load the debugger if enabled in conf
if (isset($conf['enable_debugger']) && $conf['enable_debugger'] === true) {
    require_once('../3rd/php-console/PhpConsole.php');
    PhpConsole::start(true, true, dirname(__FILE__));
}

// uncomment to handle redirection for different browsers/device
//shn_main_redirect();

// include the base libraries
require_once($global['approot'] . 'inc/lib_config.inc');
require_once($global['approot'] . 'inc/lib_modules.inc');
require_once($global['approot'] . 'inc/lib_errors.inc');

// include the main libraries the system depends on
require_once($global['approot'] . 'inc/lib_security/lib_crypt.inc');

//require_once($global['approot'].'inc/lib_security/handler_openid.inc'); // replacing openID lib soon....
require_once($global['approot'] . 'inc/lib_exception.inc');