From: x2003bruneau Date: Tue, 10 Apr 2007 08:29:17 +0000 (+0000) Subject: Fixes and improvements X-Git-Tag: xorg/0.9.14~113 X-Git-Url: http://git.polytechnique.org/?a=commitdiff_plain;h=9e1b43206453894a404ca1c0458423ece6811043;p=platal.git Fixes and improvements git-svn-id: svn+ssh://murphy/home/svn/platal/trunk@1676 839d8a87-29fc-0310-9880-83ba4fa771e5 --- diff --git a/classes/plbacktrace.php b/classes/plbacktrace.php index 89703aa..2f18f7a 100644 --- a/classes/plbacktrace.php +++ b/classes/plbacktrace.php @@ -37,10 +37,15 @@ class PlBacktrace } } + 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']; @@ -58,14 +63,14 @@ class PlBacktrace 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()) diff --git a/classes/plupload.php b/classes/plupload.php index ea84ca1..ce143a6 100644 --- a/classes/plupload.php +++ b/classes/plupload.php @@ -199,7 +199,14 @@ class PlUpload { 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]]; diff --git a/classes/session.php b/classes/session.php index c52e239..28a02d2 100644 --- a/classes/session.php +++ b/classes/session.php @@ -27,7 +27,7 @@ class Session 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(); } }