php 5.5 related adjustments

This commit is contained in:
Latif Khalifa
2014-04-28 18:41:50 +02:00
parent 95602b2597
commit 0fb8c80b0b
8 changed files with 22 additions and 21 deletions

View File

@@ -74,7 +74,7 @@ if ($nr)
{ {
Memc::flush(); Memc::flush();
$rp = $nr != 1 ? "reports" : "report"; $rp = $nr != 1 ? "reports" : "report";
IRCNotify::send("#SingularityViewer", "[CrashProcessor] $nr new $rp. http://crash.singularityviewer.org/"); //IRCNotify::send("#SingularityViewer", "[CrashProcessor] $nr new $rp. http://crash.singularityviewer.org/");
} }
Session::GC(); Session::GC();

View File

@@ -2,14 +2,14 @@
class Comments class Comments
{ {
function updateCommentCount($id) static function updateCommentCount($id)
{ {
$q = kl_str_sql("update signature set has_comments=(select count(*) as count from comment where signature_id=!i) where id=!i", $id, $id); $q = kl_str_sql("update signature set has_comments=(select count(*) as count from comment where signature_id=!i) where id=!i", $id, $id);
DBH::$db->query($q); DBH::$db->query($q);
Memc::flush(); Memc::flush();
} }
function addSignatureComment($id, $text) static function addSignatureComment($id, $text)
{ {
global $S; global $S;
$q = kl_str_sql("insert into comment (signature_id, user_id, comment) values (!i, !i, !s)", $id, $S->user_id, $text); $q = kl_str_sql("insert into comment (signature_id, user_id, comment) values (!i, !i, !s)", $id, $S->user_id, $text);
@@ -17,7 +17,7 @@ class Comments
self::updateCommentCount($id); self::updateCommentCount($id);
} }
function getSignatureComments($id) static function getSignatureComments($id)
{ {
$ret = array(); $ret = array();
$q = kl_str_sql("select c.*, u.name, u.email from comment c join users u on c.user_id = u.user_id where signature_id=!i order by id asc;", $id); $q = kl_str_sql("select c.*, u.name, u.email from comment c join users u on c.user_id = u.user_id where signature_id=!i order by id asc;", $id);
@@ -33,14 +33,14 @@ class Comments
return $ret; return $ret;
} }
function delSignatureComment($id, $del_id) static function delSignatureComment($id, $del_id)
{ {
$q = kl_str_sql("delete from comment where id=!i", $del_id); $q = kl_str_sql("delete from comment where id=!i", $del_id);
DBH::$db->query($q); DBH::$db->query($q);
self::updateCommentCount($id); self::updateCommentCount($id);
} }
function renderComments($id) static function renderComments($id)
{ {
global $S; global $S;
$comments = self::getSignatureComments($id); $comments = self::getSignatureComments($id);
@@ -78,7 +78,7 @@ class Comments
function renderCommentPanel($id) static function renderCommentPanel($id)
{ {

View File

@@ -28,7 +28,7 @@ class CrashReport
public static $all_signatures; public static $all_signatures;
function htmlFrame($f, $chan, $version) static function htmlFrame($f, $chan, $version)
{ {
$urlBase = "https://github.com/singularity-viewer/SingularityViewer/blob/" . self::getHash($chan, $version); $urlBase = "https://github.com/singularity-viewer/SingularityViewer/blob/" . self::getHash($chan, $version);
@@ -67,7 +67,8 @@ class CrashReport
} }
return $ret; return $ret;
} }
function getTotal($filter)
static function getTotal($filter)
{ {
$where = $filter->getWhere(); $where = $filter->getWhere();
$q = "select count(id) as total from reports $where"; $q = "select count(id) as total from reports $where";
@@ -84,7 +85,7 @@ class CrashReport
} }
} }
function getReports($filter, $fields = "id, reported, client_version, client_channel, client_arch, os, gpu, grid, region, signature_id") static function getReports($filter, $fields = "id, reported, client_version, client_channel, client_arch, os, gpu, grid, region, signature_id")
{ {
$ret = array(); $ret = array();
$q = "select $fields from reports " . $filter->getWhere() . kl_str_sql(" order by id desc limit !i offset !i", $filter->limit, $filter->offset); $q = "select $fields from reports " . $filter->getWhere() . kl_str_sql(" order by id desc limit !i offset !i", $filter->limit, $filter->offset);
@@ -106,7 +107,7 @@ class CrashReport
return $ret; return $ret;
} }
function getReport($id) static function getReport($id)
{ {
$ret = array(); $ret = array();
if (!$res = DBH::$db->query(kl_str_sql("select * from reports where id=!i", $id))) if (!$res = DBH::$db->query(kl_str_sql("select * from reports where id=!i", $id)))

View File

@@ -34,7 +34,7 @@ class DBH
@fwrite($f, "[".date('Y-m-d H:i')."] ".$line."\n"); @fwrite($f, "[".date('Y-m-d H:i')."] ".$line."\n");
} }
function getInstance() static function getInstance()
{ {
if (self::$db === null) if (self::$db === null)
{ {

View File

@@ -32,7 +32,7 @@
class Layout class Layout
{ {
function getLoginGateway() static function getLoginGateway()
{ {
$assoc_handle_expires = (int)Option::get('assoc_handle_expires'); $assoc_handle_expires = (int)Option::get('assoc_handle_expires');
$now = time(); $now = time();
@@ -53,7 +53,7 @@ class Layout
return GoogleOpenID::createRequest(URL_ROOT . "/process_login.php", $handle, true); return GoogleOpenID::createRequest(URL_ROOT . "/process_login.php", $handle, true);
} }
function since($since) static function since($since)
{ {
$since = time() - $since; $since = time() - $since;
$chunks = array( $chunks = array(
@@ -175,7 +175,7 @@ class Layout
<?php <?php
} }
function footer() static function footer()
{ {
{ ?> { ?>
<div style="margin-top:10px; padding: 5px;" class="ui-widget-header ui-corner-all"> <div style="margin-top:10px; padding: 5px;" class="ui-widget-header ui-corner-all">

View File

@@ -5,7 +5,7 @@ class Memc
static $active = false; static $active = false;
static $expire = 7200; static $expire = 7200;
function init() static function init()
{ {
if (!class_exists("Memcached", false)) return; if (!class_exists("Memcached", false)) return;
@@ -24,7 +24,7 @@ class Memc
self::$active = true; self::$active = true;
} }
function getq($q) static function getq($q)
{ {
if (!self::$active) return false; if (!self::$active) return false;
@@ -32,7 +32,7 @@ class Memc
return self::$mem->get($key); return self::$mem->get($key);
} }
function setq($q, $data) static function setq($q, $data)
{ {
if (!self::$active) return false; if (!self::$active) return false;
@@ -40,7 +40,7 @@ class Memc
return self::$mem->set($key, $data, self::$expire); return self::$mem->set($key, $data, self::$expire);
} }
function flush() static function flush()
{ {
if (!self::$active) return false; if (!self::$active) return false;
self::$mem->flush(); self::$mem->flush();

View File

@@ -35,7 +35,7 @@ class ReportParser
{ {
static $extracted = array(); static $extracted = array();
function parse($id) static function parse($id)
{ {
$q = kl_str_sql("select * from raw_reports where report_id=!i", $id); $q = kl_str_sql("select * from raw_reports where report_id=!i", $id);
if (!$res = DBH::$db->query($q) OR !$row = DBH::$db->fetchRow($res)) if (!$res = DBH::$db->query($q) OR !$row = DBH::$db->fetchRow($res))

View File

@@ -3,7 +3,7 @@ if (!defined('SITE_ROOT')) {
exit(1); exit(1);
} }
error_reporting(E_ALL ^ E_NOTICE); error_reporting(E_ALL & ~(E_NOTICE | E_STRICT));
ini_set('display_errors',1); ini_set('display_errors',1);
if (!extension_loaded('kl')) { if (!extension_loaded('kl')) {