}
}
+ private function fixCharset($action)
+ {
+ return is_utf8($action) ? $action : utf8_encode($action);
+ }
+
private function add(array &$entry, $sizef = 'rows', $timef = 'exectime', $errorf = 'error')
{
$trace = array();
- $trace['action'] = $entry['action'];
+ $trace['action'] = $this->fixCharset($entry['action']);
unset($entry['action']);
$trace['exectime'] = @$entry[$timef];
$this->totaltime += $trace['exectime'];
public function newEvent($action, $rows = 0, $error = null, array $userdata = array())
{
- $trace = array('action' => $action, 'time' => 0);
+ $trace = array('action' => $this->fixCharset($action), 'time' => 0);
$this->traces[] =& $trace;
$this->update($rows, $error, $userdata);
}
public function start($action)
{
- $this->traces[] = array('action' => $action, 'starttime' => microtime(true));;
+ $this->traces[] = array('action' => $this->fixCharset($action), 'starttime' => microtime(true));;
}
public function stop($rows = 0, $error = null, array $userdata = array())
{
static $map;
if (!isset($map)) {
- $map = array (1 => 'gif', 2 => 'jpeg', 3 => 'png');
+ $tmpmap = array (IMG_GIF => 'gif', IMG_JPG => 'jpeg', IMG_PNG => 'png', IMG_WBMP => 'bmp', IMG_XPM => 'xpm');
+ $map = array();
+ $supported = imagetypes();
+ foreach ($tmpmap as $type=>$mime) {
+ if ($supported & $type) {
+ $map[$type] = $mime;
+ }
+ }
}
$array = getimagesize($this->filename);
$array[2] = @$map[$array[2]];
if (empty($_SESSION['challenge'])) {
$_SESSION['challenge'] = sha1(uniqid(rand(), true));
}
- if (!isset($_SESSION['perms'])) {
+ if (!isset($_SESSION['perms']) || !($_SESSION['perms'] instanceof FlagSet)) {
$_SESSION['perms'] = new FlagSet();
}
}