예제 #1
0
 private function get_member_list()
 {
     // Call site settings for stored roster & member ranks to track
     $siteSettings = site::setting();
     // Decode JSON from stored roster data
     $roster = json_decode($siteSettings[0]['fullRoster'], true);
     $data = array();
     // Decode JSON from stored roster ranks
     $ranks = json_decode($siteSettings[0]['rosterRanks'], true);
     $filterRanks = array();
     // Ranks to track
     foreach ($ranks as $key => $value) {
         try {
             // echo $key . ' == ' . $value['track'] . '<br/>';
             if ($value['track']) {
                 $filterRanks[] = $key;
             }
         } catch (Exception $e) {
             //
         }
     }
     foreach ($roster['members'] as $key => $character) {
         // echo var_dump($character['character']);
         // echo $character['character']['name'];
         if (in_array($character['rank'], $filterRanks)) {
             $data[] = $character['character']['name'];
         }
     }
     json::resp(array('success' => true, 'data' => $data));
 }
예제 #2
0
 private function del_file()
 {
     $folder_name = $_POST['folder'];
     $file_name = $_POST['file'];
     // Lookup file first for the ext
     $file = self::get_fileDetails($file_name);
     // Delete actual file (thumbnail)
     @unlink('../../uploads/' . $folder_name . '/' . $file_name . '_thumb' . $file['fileExt']);
     // Delete actual file (full)
     if (unlink('../../uploads/' . $folder_name . '/' . $file_name . $file['fileExt'])) {
         // Delete DB record for file
         $resp = self::delete_item($folder_name, $file_name);
     }
     if ($resp) {
         json::resp(array('success' => $resp, 'msg' => 'File \'' . $folder_name . '/' . $file_name . $file['fileExt'] . '\' Deleted!'));
     } else {
         json::resp(array('success' => $resp, 'msg' => 'File delete error!'));
     }
 }
예제 #3
0
 private function admin_update($data)
 {
     require_once '../config/backbone.php';
     $this->user = user::get(@$_SESSION['user_id'])->data;
     if ($this->user['SiteRank'] >= 5) {
         if ($data['toUpdate'] == 'rank') {
             if (user_db::update_user_rank($data)) {
                 json::resp(array('success' => true));
             } else {
                 json::resp(array('success' => false));
             }
         } elseif ($data['toUpdate'] == 'ban') {
             if (user_db::update_user_ban($data)) {
                 json::resp(array('success' => true));
             } else {
                 json::resp(array('success' => false));
             }
         }
     }
 }
예제 #4
0
 function updateRaidPro()
 {
     global $usrInfo;
     // Call DB Connector
     $callDB = new PGSdb();
     $callDB->connDB();
     if (user::rank() >= 4) {
         $raidProUpdate = $_POST['raidProUpdate'];
         $nraidProUpdate = $_POST['nraidProUpdate'];
         $hraidProUpdate = $_POST['hraidProUpdate'];
         $mraidProUpdate = $_POST['mraidProUpdate'];
         //Prepare
         $proUpdate = $callDB->db->prepare("UPDATE progress SET reg = :regPro, heroic = :heroicPro, mythic = :mythicPro WHERE raid = :raid");
         //Execute
         $result = $proUpdate->execute(array('regPro' => $nraidProUpdate, 'heroicPro' => $hraidProUpdate, 'mythicPro' => $mraidProUpdate, 'raid' => $raidProUpdate));
         if ($result) {
             json::resp(array('success' => true, 'msg' => $raidProUpdate . ' Progress updated!'));
         } else {
             json::resp(array('success' => false, 'error' => $raidProUpdate . ' Progress update failed..'));
         }
     }
 }
예제 #5
0
 private function new_post($data)
 {
     // If site admin
     if ($this->user['SiteRank'] >= 4) {
         $result = news_db::new_post(array('title' => $data['title'], 'content' => $data['content'], 'img' => $data['img'], 'tags' => $data['tags'], 'author' => $this->user['Username'], 'date' => time()));
         if ($result) {
             json::resp(array('success' => true, 'msg' => 'New post created!'));
         } else {
             json::resp(array('success' => false, 'msg' => 'Error making the new post!'));
         }
     } else {
         json::resp(array('success' => false, 'msg' => 'Insufficient permissions!'));
     }
 }
예제 #6
0
 function char_status_role($character_data)
 {
     if ($this->user['SiteRank'] >= 4) {
         $charData = @roster_db::role_status($character_data['character'], $character_data['server']);
         json::resp(array('success' => 'true', 'data' => $charData));
     }
 }
예제 #7
0
 private function watch_cat($data)
 {
     if ($this->user['SiteRank'] >= 4) {
         if (isset($data['cat'])) {
             $watchingStatus = false;
             $key = 0;
             $watchersCSV = '';
             // Get category data
             $category = category::get($data['cat']);
             // Parse watching
             $watchers = explode(',', $category['watching']);
             // Check array
             if (($key = array_search($this->user['Username'], $watchers)) !== false) {
                 unset($watchers[$key]);
                 $watchersCSV = implode(',', $watchers);
             } else {
                 // Add user to watching
                 $watchingStatus = true;
                 array_push($watchers, $this->user['Username']);
                 $watchersCSV = implode(',', $watchers);
             }
             // Update DB
             category::watch($category['id'], $watchersCSV);
             json::resp(array('success' => true, 'watching' => $watchingStatus));
         }
     }
 }
예제 #8
0
 private function update($data)
 {
     $callDB = new PGSdb();
     $callDB->connDB();
     $additionalReturns = array();
     if ($data['update'] == 'featured_news') {
         $updateDBsql = "UPDATE sitesettings SET featuredArticle = :newVal WHERE guildName = :guildName";
     } elseif ($data['update'] == 'footer_html') {
         $updateDBsql = "UPDATE sitesettings SET footerHTML = :newVal WHERE guildName = :guildName";
     } elseif ($data['update'] == 'wclogs_zones') {
         // Statement for updating table
         $updateDBsql = "UPDATE sitesettings SET wcLogsZonesDate = :newVal WHERE guildName = :guildName";
         // Load Roster Worker
         require '../roster/roster.worker.php';
         if (roster::refresh_zones()) {
             $additionalReturns['dayHuman'] = date('h:ia, M d Y', time());
         }
         $data['value'] = time();
     } elseif ($data['update'] == 'roster_data') {
         // Statement for updating table
         $updateDBsql = "UPDATE sitesettings SET fullRosterDate = :newVal WHERE guildName = :guildName";
         // Load Roster Worker
         require '../roster/roster.worker.php';
         if (roster::refresh_guild_roster()) {
             $additionalReturns['dayHuman'] = date('h:ia, M d Y', time());
         }
         // 	For each user in roster array
         $dbData = $this->get_roster();
         $decodedForCount = json_decode($dbData[0]['fullRoster'], true);
         $additionalReturns['refreshCount'] = 0;
         foreach ($decodedForCount['members'] as $key => $character) {
             $additionalReturns['refreshCount']++;
         }
         $data['value'] = time();
     } elseif ($data['update'] == 'toggle_rank') {
         $updateDBsql = "UPDATE sitesettings SET rosterRanks = :newVal WHERE guildName = :guildName";
         // First get the current data
         $currentRanksJSON = $this->get_roster_ranks();
         // Data value
         $rankSent = $data['value']['rank'];
         $rankTrack = $data['value']['track'];
         if ($currentRanksJSON[0]['rosterRanks']) {
             $currentRanksDecoded = json_decode($currentRanksJSON[0]['rosterRanks'], true);
             // Select -or- set by array key of given toggle
             $currentRanksDecoded[$rankSent]['track'] = $rankTrack;
             // Update data value for sending to db
             $data['value'] = json_encode($currentRanksDecoded);
         } else {
             $ranksDataNEW = array();
             // Set by array key of given toggle
             $ranksDataNEW[$rankSent] = array('track' => $rankTrack);
             // Update data value for sending to db
             $data['value'] = json_encode($ranksDataNEW);
         }
     } elseif ($data['update'] == 'roster_rank_name_update') {
         $updateDBsql = "UPDATE sitesettings SET rosterRanks = :newVal WHERE guildName = :guildName";
         // First get the current data
         $currentRanksJSON = $this->get_roster_ranks();
         // Data value
         $rankSent = $data['value']['rank'];
         $rankName = $data['value']['name'];
         if ($currentRanksJSON[0]['rosterRanks']) {
             $currentRanksDecoded = json_decode($currentRanksJSON[0]['rosterRanks'], true);
             // Select -or- set by array key of given toggle
             $currentRanksDecoded[$rankSent]['name'] = $rankName;
             // Update data value for sending to db
             $data['value'] = json_encode($currentRanksDecoded);
         } else {
             $ranksDataNEW = array();
             // Set by array key of given toggle
             $ranksDataNEW[$rankSent] = array('name' => $rankName);
             // Update data value for sending to db
             $data['value'] = json_encode($ranksDataNEW);
         }
     }
     // Run query to update
     $updateSiteSettings = $callDB->db->prepare($updateDBsql);
     $updateStatus = $updateSiteSettings->execute(array('newVal' => $data['value'], 'guildName' => guild_name));
     if ($updateStatus) {
         json::resp(array('success' => true, 'data' => $additionalReturns));
     } else {
         json::resp(array('success' => false, 'data' => $additionalReturns));
     }
 }