diff --git a/_sakura/changelog.json b/_sakura/changelog.json index 1ef7e42..82c4a4a 100644 --- a/_sakura/changelog.json +++ b/_sakura/changelog.json @@ -11,7 +11,8 @@ "20150508", "20150509", "20150509.1", - "20150512" + "20150512", + "20150523" ] @@ -1037,6 +1038,27 @@ { "type": "FIX", "change": "Fix {{ sakura.currentpage }} redirecting to the php file that's being used without the right attributes." + }, + { + "type": "UPD", + "change": "Rebuilt news XML to be more modular as opposed to a pile of prints." + } + + ], + + "20150523": [ + + { + "type": "UPD", + "change": "Move Manage and Forum to a subdirectory instead of a subdomain." + }, + { + "type": "ADD", + "change": "Add links to forum and management pages." + }, + { + "type": "FIX", + "change": "Fixed broken links because of the domainset changes." } ] diff --git a/_sakura/components/Forum.php b/_sakura/components/Forum.php index 2e73566..aedcdf7 100644 --- a/_sakura/components/Forum.php +++ b/_sakura/components/Forum.php @@ -56,4 +56,31 @@ class Forum { } + // Creating a new post + public static function createPost($subject, $text, $enableMD, $enableSig, $forum, $topic = 0, $type = 0, $status = 0) { + + // Check if this post is OP + if(!$topic) { + + // If so create a new topic + Database::insert('topics', [ + 'forum_id' => $forum, + 'topic_hidden' => 0, + 'topic_title' => $subject, + 'topic_time' => time(), + 'topic_time_limit' => 0, + 'topic_last_reply' => 0, + 'topic_views' => 0, + 'topic_replies' => 0, + 'topic_status' => $status, + 'topic_status_change' => 0, + 'topic_type' => $type, + 'topic_first_post_id' => 0, + 'topic_first_poster_id' => Session::$userId + ]); + + } + + } + } diff --git a/_sakura/components/Main.php b/_sakura/components/Main.php index 0dc4129..874dab1 100644 --- a/_sakura/components/Main.php +++ b/_sakura/components/Main.php @@ -511,4 +511,48 @@ class Main { } + // Get log type string + public static function getLogStringFromType($type) { + + // Query the database + $return = Database::fetch('logtypes', false, ['id' => [$type, '=']]); + + // Check if type exists and else return a unformattable string + if(count($return) < 2) + return 'Unknown action.'; + + // Return the string + return $return['string']; + + } + + // Get formatted logs + public static function getUserLogs($uid = 0) { + + // Check if a user is specified + $conditions = ($uid ? ['uid' => [$uid, '=']] : null); + + // Get data from database + $logsDB = Database::fetch('logs', true, $conditions, ['id', true]); + + // Storage array + $logs = array(); + + // Iterate over entries + foreach($logsDB as $log) { + + // Store usable data + $logs[$log['id']] = [ + 'user' => $_USER = Users::getUser($log['uid']), + 'rank' => Users::getRank($_USER['rank_main']), + 'string' => vsprintf(self::getLogStringFromType($log['action']), json_decode($log['attribs'], true)) + ]; + + } + + // Return new logs + return $logs; + + } + } diff --git a/_sakura/sakura.php b/_sakura/sakura.php index 4085309..233bad6 100644 --- a/_sakura/sakura.php +++ b/_sakura/sakura.php @@ -8,7 +8,7 @@ namespace Sakura; // Define Sakura version -define('SAKURA_VERSION', '20150512'); +define('SAKURA_VERSION', '20150523'); define('SAKURA_VLABEL', 'Eminence'); define('SAKURA_VTYPE', 'Development'); define('SAKURA_COLOUR', '#6C3082'); diff --git a/_sakura/templates/broomcloset/global/header.tpl b/_sakura/templates/broomcloset/global/header.tpl index 116cfb4..765c5a6 100644 --- a/_sakura/templates/broomcloset/global/header.tpl +++ b/_sakura/templates/broomcloset/global/header.tpl @@ -20,9 +20,9 @@