From 1cd487248fcf3a5e67ae9a4e00d1334124607277 Mon Sep 17 00:00:00 2001 From: flashwave Date: Sat, 23 May 2015 03:31:42 +0000 Subject: [PATCH] Yeah --- _sakura/changelog.json | 24 +++- _sakura/components/Forum.php | 27 +++++ _sakura/components/Main.php | 44 +++++++ _sakura/sakura.php | 2 +- .../templates/broomcloset/global/header.tpl | 10 +- _sakura/templates/yuuno/forum/index.tpl | 6 +- _sakura/templates/yuuno/global/header.tpl | 2 + forum/.htaccess | 1 - forum/favicon.ico | Bin 370070 -> 0 bytes main/.htaccess | 60 ++++++---- {forum => main/forum}/index.php | 2 +- {forum => main/forum}/posting.php | 2 +- {forum => main/forum}/viewforum.php | 2 +- {forum => main/forum}/viewtopic.php | 2 +- manage/index.php => main/manage.php | 0 main/news.php | 109 ++++++++++++++---- manage/.htaccess | 18 --- manage/404.php | 13 --- manage/favicon.ico | Bin 370070 -> 0 bytes 19 files changed, 232 insertions(+), 92 deletions(-) delete mode 100644 forum/.htaccess delete mode 100644 forum/favicon.ico rename {forum => main/forum}/index.php (91%) rename {forum => main/forum}/posting.php (51%) rename {forum => main/forum}/viewforum.php (52%) rename {forum => main/forum}/viewtopic.php (53%) rename manage/index.php => main/manage.php (100%) delete mode 100644 manage/.htaccess delete mode 100644 manage/404.php delete mode 100644 manage/favicon.ico 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 @@