diff --git a/inc/cache.php b/inc/cache.php index 0bb73589..2d376b70 100644 --- a/inc/cache.php +++ b/inc/cache.php @@ -20,7 +20,7 @@ class Cache { self::$cache->addServers($config['cache']['memcached']); break; case 'php': - self::$cache = Array(); + self::$cache = array(); break; } } @@ -112,7 +112,7 @@ class Cache { case 'apc': return apc_clear_cache('user'); case 'php': - self::$cache[$key] = Array(); + self::$cache[$key] = array(); break; } diff --git a/inc/database.php b/inc/database.php index 6f68e7e4..50b4754d 100644 --- a/inc/database.php +++ b/inc/database.php @@ -30,7 +30,7 @@ class PreparedQueryDebug { if ($config['debug'] && $function == 'execute') { $time = round((microtime(true) - $start) * 1000, 2) . 'ms'; - $debug['sql'][] = Array( + $debug['sql'][] = array( 'query' => $this->query->queryString, 'rows' => $this->query->rowCount(), 'time' => '~' . $time @@ -91,7 +91,7 @@ function query($query) { if (!$query) return false; $time = round((microtime(true) - $start) * 1000, 2) . 'ms'; - $debug['sql'][] = Array( + $debug['sql'][] = array( 'query' => $query->queryString, 'rows' => $query->rowCount(), 'time' => '~' . $time diff --git a/inc/display.php b/inc/display.php index 1be066c2..706905b0 100644 --- a/inc/display.php +++ b/inc/display.php @@ -42,7 +42,7 @@ function doBoardListPart($list, $root) { function createBoardlist($mod=false) { global $config; - if (!isset($config['boards'])) return Array('top'=>'','bottom'=>''); + if (!isset($config['boards'])) return array('top'=>'','bottom'=>''); $body = doBoardListPart($config['boards'], $mod?'?/':$config['root']); if (!preg_match('/\] $/', $body)) @@ -50,7 +50,7 @@ function createBoardlist($mod=false) { $body = trim($body); - return Array( + return array( 'top' => '
' . $body . '
', 'bottom' => '
' . $body . '
' ); @@ -69,7 +69,7 @@ function error($message, $priority = true) { die('Error: ' . $message . "\n"); } - die(Element('page.html', Array( + die(Element('page.html', array( 'config'=>$config, 'title'=>'Error', 'subtitle'=>'An error has occured.', @@ -130,7 +130,7 @@ function capcode($cap) { if (!$cap) return false; - $capcode = Array(); + $capcode = array(); if (isset($config['custom_capcode'][$cap])) { if (is_array($config['custom_capcode'][$cap])) { $capcode['cap'] = sprintf($config['custom_capcode'][$cap][0], $cap); @@ -174,7 +174,7 @@ function truncate($body, $url, $max_lines = false, $max_chars = false) { // Open tags if (preg_match_all('/<([\w]+)[^>]*>/', $body, $open_tags)) { - $tags = Array(); + $tags = array(); for ($x=0;$x$/', $open_tags[0][$x])) $tags[] = $open_tags[1][$x]; @@ -300,7 +300,7 @@ class Post { public function build($index=false) { global $board, $config; - return Element('post_reply.html', Array('config' => $config, 'board' => $board, 'post' => &$this, 'index' => $index)); + return Element('post_reply.html', array('config' => $config, 'board' => $board, 'post' => &$this, 'index' => $index)); } }; @@ -328,7 +328,7 @@ class Thread { $this->filename = $filename; $this->omitted = 0; $this->omitted_images = 0; - $this->posts = Array(); + $this->posts = array(); $this->ip = $ip; $this->sticky = $sticky; $this->locked = $locked; @@ -425,7 +425,7 @@ class Thread { public function build($index=false) { global $board, $config, $debug; - $built = Element('post_thread.html', Array('config' => $config, 'board' => $board, 'post' => &$this, 'index' => $index)); + $built = Element('post_thread.html', array('config' => $config, 'board' => $board, 'post' => &$this, 'index' => $index)); if (!$this->mod && $index && $config['cache']['enabled']) { cache::set($this->cache_key($index), $built); diff --git a/inc/events.php b/inc/events.php index 5360a6a9..b825b570 100644 --- a/inc/events.php +++ b/inc/events.php @@ -35,7 +35,7 @@ function event_handler($event, $callback) { global $events; if (!isset($events[$event])) - $events[$event] = Array(); + $events[$event] = array(); $events[$event][] = $callback; } @@ -43,6 +43,6 @@ function event_handler($event, $callback) { function reset_events() { global $events; - $events = Array(); + $events = array(); } diff --git a/inc/image.php b/inc/image.php index 28242946..860dd4d8 100644 --- a/inc/image.php +++ b/inc/image.php @@ -34,7 +34,7 @@ class Image { error($config['error']['invalidimg']); } - $this->size = (object)Array('width' => $this->image->_width(), 'height' => $this->image->_height()); + $this->size = (object)array('width' => $this->image->_width(), 'height' => $this->image->_height()); if ($this->size->width < 1 || $this->size->height < 1) { $this->delete(); error($config['error']['invalidimg']); @@ -187,7 +187,7 @@ class ImageImagick extends ImageBase { $this->image = new Imagick(); $this->image->setFormat('gif'); - $keep_frames = Array(); + $keep_frames = array(); for ($i = 0; $i < $this->original->getNumberImages(); $i += floor($this->original->getNumberImages() / $config['thumb_keep_animation_frames'])) $keep_frames[] = $i; diff --git a/inc/mod-old.php b/inc/mod-old.php deleted file mode 100644 index 9065bb82..00000000 --- a/inc/mod-old.php +++ /dev/null @@ -1,287 +0,0 @@ -bindValue(':username', $username); - $query->bindValue(':password', $password); - $query->execute() or error(db_error($query)); - - if ($user = $query->fetch()) { - return $mod = Array( - 'id' => $user['id'], - 'type' => $user['type'], - 'username' => $username, - 'hash' => mkhash($username, $password), - 'boards' => explode(',', $user['boards']) - ); - } else return false; -} - -function setCookies() { - global $mod, $config; - if (!$mod) - error('setCookies() was called for a non-moderator!'); - - setcookie($config['cookies']['mod'], - $mod['username'] . // username - ':' . - $mod['hash'][0] . // password - ':' . - $mod['hash'][1], // salt - time() + $config['cookies']['expire'], $config['cookies']['jail'] ? $config['cookies']['path'] : '/', null, false, true); -} - -function destroyCookies() { - global $config; - // Delete the cookies - setcookie($config['cookies']['mod'], 'deleted', time() - $config['cookies']['expire'], $config['cookies']['jail']?$config['cookies']['path'] : '/', null, false, true); -} - -function create_pm_header() { - global $mod; - $query = prepare("SELECT `id` FROM `pms` WHERE `to` = :id AND `unread` = 1"); - $query->bindValue(':id', $mod['id'], PDO::PARAM_INT); - $query->execute() or error(db_error($query)); - - if ($pm = $query->fetch()) { - return Array('id' => $pm['id'], 'waiting' => $query->rowCount() - 1); - } - - return false; -} - -function modLog($action, $_board=null) { - global $mod, $board, $config; - $query = prepare("INSERT INTO `modlogs` VALUES (:id, :ip, :board, :time, :text)"); - $query->bindValue(':id', $mod['id'], PDO::PARAM_INT); - $query->bindValue(':ip', $_SERVER['REMOTE_ADDR']); - $query->bindValue(':time', time(), PDO::PARAM_INT); - $query->bindValue(':text', $action); - if (isset($_board)) - $query->bindValue(':board', $_board); - elseif (isset($board)) - $query->bindValue(':board', $board['uri']); - else - $query->bindValue(':board', null, PDO::PARAM_NULL); - $query->execute() or error(db_error($query)); - - if ($config['syslog']) - _syslog(LOG_INFO, '[mod/' . $mod['username'] . ']: ' . $action); -} - -// Generates a