当前位置: 首页>>代码示例>>PHP>>正文


PHP json::resp方法代码示例

本文整理汇总了PHP中json::resp方法的典型用法代码示例。如果您正苦于以下问题:PHP json::resp方法的具体用法?PHP json::resp怎么用?PHP json::resp使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在json的用法示例。


在下文中一共展示了json::resp方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: get_member_list

 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));
 }
开发者ID:TheDoxMedia,项目名称:pgs,代码行数:30,代码来源:attendance.worker.php

示例2: del_file

 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!'));
     }
 }
开发者ID:TheDoxMedia,项目名称:pgs,代码行数:19,代码来源:filemanager.worker.php

示例3: admin_update

 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));
             }
         }
     }
 }
开发者ID:TheDoxMedia,项目名称:pgs,代码行数:20,代码来源:user.worker.php

示例4: updateRaidPro

 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..'));
         }
     }
 }
开发者ID:TheDoxMedia,项目名称:pgs,代码行数:22,代码来源:ajax.progression.php

示例5: new_post

 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!'));
     }
 }
开发者ID:TheDoxMedia,项目名称:pgs,代码行数:14,代码来源:news.worker.php

示例6: char_status_role

 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));
     }
 }
开发者ID:TheDoxMedia,项目名称:pgs,代码行数:7,代码来源:roster.worker.php

示例7: watch_cat

 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));
         }
     }
 }
开发者ID:TheDoxMedia,项目名称:pgs,代码行数:27,代码来源:forum.worker.php

示例8: update

 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));
     }
 }
开发者ID:TheDoxMedia,项目名称:pgs,代码行数:84,代码来源:admin.worker.php


注:本文中的json::resp方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。