Example #1
0
 private function attendance_admin()
 {
     if ($this->user['SiteRank'] >= 4) {
         // Array for end page
         $data = array();
         // Offer some dates for selection when setting the attendance data
         $data['dates'] = array();
         for ($i = 0; $i < 14; $i++) {
             $a = date('d-m-Y', strtotime("-" . $i . "days"));
             $data['dates'][] = array('humanTime' => $a, 'unixTime' => strtotime("-" . $i . "days"));
         }
         build::page($data, 'attendance/admin');
     }
 }
Example #2
0
 private function get_all()
 {
     $data = array();
     $data['posts'] = array();
     // If site admin
     if ($this->user['SiteRank'] >= 4) {
         $data['admin'] = true;
     } else {
         $data['admin'] = false;
     }
     foreach (news_db::get_limit(5) as $post) {
         $post['postDate'] = date('M d Y', $post['postDate']);
         $data['posts'][] = $post;
     }
     build::page($data, 'news/all');
 }
Example #3
0
 private function all()
 {
     // Call DB Connector
     $callDB = new PGSdb();
     $callDB->connDB();
     $data = array();
     //Prepare
     $getMainRaidRosterPrep = $callDB->db->prepare("SELECT * FROM wowchardata WHERE GuildStatus='Raider' OR GuildStatus='Sub' OR GuildStatus='Trial' ORDER BY GMRole ASC");
     //Execute
     $getMainRaidRosterPrep->execute();
     $getMainRaidRoster = $getMainRaidRosterPrep->fetchAll(PDO::FETCH_ASSOC);
     // echo var_dump($getMainRaidRoster);
     foreach ($getMainRaidRoster as $character) {
         $data['character'][] = $character;
     }
     build::page($data, 'roster/all');
 }
Example #4
0
 private function user_overlay()
 {
     require_once '../config/backbone.php';
     require_once '../pg_builder.php';
     // Current user data
     $this->user = user::get(@$_SESSION['user_id'])->data;
     $this->user['Admin'] = false;
     // False unless updated in next section
     // Admin
     if ($this->user['SiteRank'] >= 5) {
         $this->user['Admin'] = true;
     }
     if ($this->user != null) {
         // Decode rank
         $this->user['SiteRank_Name'] = self::rankName($this->user['SiteRank']);
         build::page($this->user, 'user/userOverlay');
     } else {
         self::errorHTML('User lookup error!');
     }
 }
Example #5
0
    private function get_posts($data)
    {
        if (isset($data['cat']) && isset($data['thread']) && isset($data['page'])) {
            // Set variables
            $category_id = $data['cat'];
            $thread_id = $data['thread'];
            $page_num = @$data['page'];
            $pageQueue = 0;
            // Check category's access permissions
            $category = category::get($category_id);
            if ($this->user['SiteRank'] >= $category['rankRead'] || $category['rankRead'] == 0) {
                // Fetch thread data
                $thread = thread::get($thread_id);
                if ($thread != null) {
                    // Page manager
                    $num_rows = $thread['noreplys'];
                    $bottomNav = '';
                    $num_pages = floor($num_rows / 10 + 1);
                    if ($page_num == 0) {
                        // If not set by url then default to the first page
                        $page_num = 1;
                        // default first page
                        if ($num_rows > 10) {
                            // if there are more than 10 rows
                            $nextPageNumber = 2;
                            // default next page if not defined in the url
                            if ($pageQueue + 10 > $num_rows) {
                            } else {
                                $bottomNav = '<a href="' . site_url . '#/forum/' . $category_id . '/' . $thread_id . '/pg' . $nextPageNumber . '" class="forum-link pagination">Next >></a><br/>';
                            }
                        }
                    } else {
                        $nextPageNumber = $page_num + 1;
                        $previousPage = $page_num - 1;
                        if ($num_rows > 10) {
                            if ($page_num == 1) {
                                $pageQueue = 0;
                            } else {
                                $pageQueue = $page_num * 10 - 10;
                            }
                            if ($pageQueue + 10 > $num_rows) {
                                $bottomNav = '<a href="' . site_url . '#/forum/' . $category_id . '/' . $thread_id . '/pg' . $previousPage . '" class="forum-link pagination"><< Back</a> ' . 'Page #' . $page_num . '/' . $num_pages;
                            } else {
                                if ($page_num < 2) {
                                    $bottomNav = 'Page #' . $page_num . '/' . $num_pages . '<a href="' . site_url . '#/forum/' . $category_id . '/' . $thread_id . '/pg' . $nextPageNumber . '" class="forum-link pagination" data-page="' . $nextPageNumber . '">Next >></a><br/>';
                                } else {
                                    $bottomNav = '<a href="' . site_url . '#/forum/' . $category_id . '/' . $thread_id . '/pg' . $previousPage . '" class="forum-link pagination"><< Back</a> 
									<span>Page #' . $page_num . ' / ' . $num_pages . '</span><a href="' . site_url . '#/forum/' . $category_id . '/' . $thread_id . '/pg' . $nextPageNumber . '" class="forum-link pagination" data-page="' . $nextPageNumber . '">Next >></a><br/>';
                                }
                            }
                        }
                    }
                    // Fetch thread posts
                    $posts = post::get_all($data['cat'], $data['thread'], $pageQueue);
                    $templateData = array();
                    $templateData['category'] = $category;
                    $templateData['thread'] = $thread;
                    $templateData['thread']['permissions'] = array('write' => $this->user['SiteRank'] >= $category['rankPost'] ? true : false);
                    $templateData['thread']['locked'] = (bool) $templateData['thread']['locked'];
                    $templateData['user'] = $this->user;
                    $templateData['user']['moderator'] = $this->user['SiteRank'] >= 4 ? true : false;
                    $templateData['user']['BanStatus'] = @(bool) $templateData['user']['BanStatus'] || false;
                    $templateData['bottomNav'] = $bottomNav;
                    foreach ($posts->rows as $post) {
                        // Some vars
                        $postAuthorData = user::get($post['author'])->data;
                        // $postid = $post['id'];
                        $userPage = site_url . '#/user/' . $post['author'];
                        //author url
                        if ($postAuthorData['SiteRank'] == 5) {
                            $postrRank = 'Admin';
                        } elseif ($postAuthorData['SiteRank'] >= 1) {
                            $postrRank = 'Guildie';
                        } elseif ($postAuthorData['SiteRank'] == 0) {
                            $postrRank = 'New';
                        } else {
                            $postrRank = 'New';
                        }
                        // Check to see if post has been edited
                        if ($post['timeedited'] != 0) {
                            $postEdited = '<div class="postEdited">Last Edited ' . date('h:i:a d/m/Y', $post['timeedited']) . ' by ' . $post['lasteditedby'] . '</div>';
                        } else {
                            $postEdited = '';
                        }
                        $templateData['posts'][] = array('threadLink' => site_url . '#/forum/' . $post['category'] . '/' . $post['thread'], 'editLink' => site_url . '#/forum/' . $post['category'] . '/' . $post['thread'] . '/edit' . $post['id'], 'unixTOhuman' => date('h:i:s A | D, d M Y', $post['timeposted']), 'post' => $post['post'], 'firstPost' => $post['postorderid'] == 0 ? true : false, 'author' => $postAuthorData, 'postAuthor' => $postAuthorData['Username'] == $this->user['Username'] ? true : false, 'postrRank' => strtolower($postrRank), 'postEdited' => $postEdited);
                    }
                    build::page($templateData, 'forum/posts');
                    // Update Thread View Counter
                    thread::update_thread_views($thread_id);
                } else {
                    self::errorHTML('Uh oh, I cannot find the thread you\'re looking for :/');
                }
            } else {
                self::errorHTML('Your account level needs to be upgraded! (This is to prevent spam on the forums!), if you are a guild member without access then request to have your account upgraded in game by a site admin.');
            }
        }
    }
Example #6
0
 private function panel()
 {
     $callDB = new PGSdb();
     $callDB->connDB();
     // Set empty array variable
     $dbData = array();
     // Lookup news data
     $newsArticles = $this->get_newsArticles();
     // Get DB data for site
     $adminPanelDBfetch = $callDB->db->prepare("SELECT * FROM sitesettings WHERE guildName = :guild");
     $adminPanelDBfetch->execute(array('guild' => guild_name));
     $dbData['site'] = $adminPanelDBfetch->fetch(PDO::FETCH_ASSOC);
     // Get featured article title and build array for news posts to select as featured article
     foreach ($newsArticles as $newsPost) {
         $dbData['news'][] = $newsPost;
         // Get title for article thats featured
         if ($newsPost['id'] == $dbData['site']['featuredArticle']) {
             $dbData['site']['featuredArticleTitle'] = $newsPost['postTitle'];
         }
     }
     // Data Reloads
     //	Last Update to human time
     $dbData['site']['fullRosterDate'] = date('h:ia, M d Y', $dbData['site']['fullRosterDate']);
     $dbData['site']['wcLogsZonesDate'] = date('h:ia, M d Y', $dbData['site']['wcLogsZonesDate']);
     // 	For each user in roster array
     $dbData['site']['rosterSize'] = 0;
     $decodedForCount = json_decode($dbData['site']['fullRoster'], true);
     try {
         foreach ($decodedForCount['members'] as $key => $character) {
             $dbData['site']['rosterSize']++;
         }
     } catch (Exception $e) {
         //
     }
     // Roster settings
     $dbData['site']['rosterRanksData'] = json_decode($dbData['site']['rosterRanks'], true);
     // foreach ($decodedForRanks as $key => $value) {
     // 	$dbData['site']['rosterRanksData'][$key] = $value;
     // }
     build::page($dbData, 'admin/admin');
 }