• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP json_die函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中json_die函数的典型用法代码示例。如果您正苦于以下问题:PHP json_die函数的具体用法?PHP json_die怎么用?PHP json_die使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: TorrentSearch

if (empty($_GET['order_by']) || !isset(TorrentSearch::$SortOrders[$_GET['order_by']])) {
    $OrderBy = 'time';
} else {
    $OrderBy = $_GET['order_by'];
}
$GroupResults = !isset($_GET['group_results']) || $_GET['group_results'] != '0';
$Page = !empty($_GET['page']) ? (int) $_GET['page'] : 1;
$Search = new TorrentSearch($GroupResults, $OrderBy, $OrderWay, $Page, TORRENTS_PER_PAGE);
$Results = $Search->query($_GET);
$Groups = $Search->get_groups();
$NumResults = $Search->record_count();
if ($Results === false) {
    json_die('error', 'Search returned an error. Make sure all parameters are valid and of the expected types.');
}
if ($NumResults == 0) {
    json_die('success', array('results' => array(), 'youMightLike' => array()));
}
$Bookmarks = Bookmarks::all_bookmarks('torrent');
$JsonGroups = array();
foreach ($Results as $Key => $GroupID) {
    $GroupInfo = $Groups[$GroupID];
    if (empty($GroupInfo['Torrents'])) {
        continue;
    }
    $CategoryID = $GroupInfo['CategoryID'];
    $GroupYear = $GroupInfo['Year'];
    $ExtendedArtists = $GroupInfo['ExtendedArtists'];
    $GroupCatalogueNumber = $GroupInfo['CatalogueNumber'];
    $GroupName = $GroupInfo['Name'];
    $GroupRecordLabel = $GroupInfo['RecordLabel'];
    $ReleaseType = $GroupInfo['ReleaseType'];
开发者ID:Kufirc,项目名称:Gazelle,代码行数:31,代码来源:browse.php


示例2: foreach

    $Artists = Artists::get_artists($DB->collect('ID'));
    foreach ($RecentSnatches as $Key => $SnatchInfo) {
        $RecentSnatches[$Key]['artists'][] = $Artists[$SnatchInfo['ID']];
        $RecentSnatches[$Key]['ID'] = (int) $RecentSnatches[$Key]['ID'];
    }
    $Results['snatches'] = $RecentSnatches;
} else {
    $Results['snatches'] = "hidden";
}
if (check_paranoia_here('uploads')) {
    $DB->query("\n\t\tSELECT\n\t\t\tg.ID,\n\t\t\tg.Name,\n\t\t\tg.WikiImage\n\t\tFROM torrents_group AS g\n\t\t\tINNER JOIN torrents AS t ON t.GroupID = g.ID\n\t\tWHERE t.UserID = '{$UserID}'\n\t\t\tAND g.CategoryID = '1'\n\t\t\tAND g.WikiImage != ''\n\t\tGROUP BY g.ID\n\t\tORDER BY t.Time DESC\n\t\tLIMIT {$Limit}");
    $RecentUploads = $DB->to_array(false, MYSQLI_ASSOC);
    $Artists = Artists::get_artists($DB->collect('ID'));
    foreach ($RecentUploads as $Key => $UploadInfo) {
        $RecentUploads[$Key]['artists'][] = $Artists[$UploadInfo['ID']];
        $RecentUploads[$Key]['ID'] = (int) $RecentUploads[$Key]['ID'];
    }
    $Results['uploads'] = $RecentUploads;
} else {
    $Results['uploads'] = "hidden";
}
json_die("success", $Results);
function check_paranoia_here($Setting)
{
    global $Paranoia, $Class, $UserID, $Preview;
    if ($Preview == 1) {
        return check_paranoia($Setting, $Paranoia, $Class);
    } else {
        return check_paranoia($Setting, $Paranoia, $Class, $UserID);
    }
}
开发者ID:karamanolev,项目名称:Gazelle,代码行数:31,代码来源:user_recents.php


示例3: array

<?php

$Skip = array();
$Skip[] = db_string($_GET['skip']);
$NotificationsManager = new NotificationsManager($LoggedUser['ID'], $Skip);
json_die("success", $NotificationsManager->get_notifications());
//echo '{"status":"success","response":[[{"message":"1st notification","url":"https:\/\/www.google.com\/","importance":"alert","AutoExpire":false},{"message":"2nd notification","url":"","importance":"alert","AutoExpire":true}]]}';
开发者ID:Kufirc,项目名称:Gazelle,代码行数:7,代码来源:get_user_notifications.php


示例4: array

$JsonNotifications = array();
$NumNew = 0;
$FilterGroups = array();
while ($Result = $DB->next_record(MYSQLI_ASSOC)) {
    if (!$Result['FilterID']) {
        $Result['FilterID'] = 0;
    }
    if (!isset($FilterGroups[$Result['FilterID']])) {
        $FilterGroups[$Result['FilterID']] = array();
        $FilterGroups[$Result['FilterID']]['FilterLabel'] = $Result['Label'] ? $Result['Label'] : false;
    }
    array_push($FilterGroups[$Result['FilterID']], $Result);
}
unset($Result);
foreach ($FilterGroups as $FilterID => $FilterResults) {
    unset($FilterResults['FilterLabel']);
    foreach ($FilterResults as $Result) {
        $TorrentID = $Result['TorrentID'];
        //		$GroupID = $Result['GroupID'];
        $GroupInfo = $TorrentGroups[$Result['GroupID']];
        extract(Torrents::array_group($GroupInfo));
        // all group data
        $TorrentInfo = $GroupInfo['Torrents'][$TorrentID];
        if ($Result['UnRead'] == 1) {
            $NumNew++;
        }
        $JsonNotifications[] = array('torrentId' => (int) $TorrentID, 'groupId' => (int) $GroupID, 'groupName' => $GroupName, 'groupCategoryId' => (int) $GroupCategoryID, 'wikiImage' => $WikiImage, 'torrentTags' => $TagList, 'size' => (double) $TorrentInfo['Size'], 'fileCount' => (int) $TorrentInfo['FileCount'], 'format' => $TorrentInfo['Format'], 'encoding' => $TorrentInfo['Encoding'], 'media' => $TorrentInfo['Media'], 'scene' => $TorrentInfo['Scene'] == 1, 'groupYear' => (int) $GroupYear, 'remasterYear' => (int) $TorrentInfo['RemasterYear'], 'remasterTitle' => $TorrentInfo['RemasterTitle'], 'snatched' => (int) $TorrentInfo['Snatched'], 'seeders' => (int) $TorrentInfo['Seeders'], 'leechers' => (int) $TorrentInfo['Leechers'], 'notificationTime' => $TorrentInfo['Time'], 'hasLog' => $TorrentInfo['HasLog'] == 1, 'hasCue' => $TorrentInfo['HasCue'] == 1, 'logScore' => (double) $TorrentInfo['LogScore'], 'freeTorrent' => $TorrentInfo['FreeTorrent'] == 1, 'logInDb' => $TorrentInfo['HasLog'] == 1, 'unread' => $Result['UnRead'] == 1);
    }
}
json_die("success", array('currentPages' => intval($Page), 'pages' => ceil($TorrentCount / NOTIFICATIONS_PER_PAGE), 'numNew' => $NumNew, 'results' => $JsonNotifications));
开发者ID:karamanolev,项目名称:Gazelle,代码行数:30,代码来源:notifications.php


示例5: SUM

            // Get a list of all torrent ids that match the search query
            $SphQLTor->where('id', $TorrentIDs)->limit(0, $TorrentCount, $TorrentCount);
            $SphQLResultTor = $SphQLTor->query();
            $TorrentIDs = $SphQLResultTor->to_pair('id', 'id');
            // Because isset() is faster than in_array()
        }
    }
}
/** End run search query and collect results **/
if ($NumResults == 0) {
    $DB->query("\n\tSELECT\n\t\ttags.Name,\n\t\t((COUNT(tags.Name) - 2) * (SUM(tt.PositiveVotes) - SUM(tt.NegativeVotes))) / (tags.Uses * 0.8) AS Score\n\tFROM xbt_snatched AS s\n\t\tINNER JOIN torrents AS t ON t.ID = s.fid\n\t\tINNER JOIN torrents_group AS g ON t.GroupID = g.ID\n\t\tINNER JOIN torrents_tags AS tt ON tt.GroupID = g.ID\n\t\tINNER JOIN tags ON tags.ID = tt.TagID\n\tWHERE s.uid = '{$LoggedUser['ID']}'\n\t\tAND tt.TagID != '13679'\n\t\tAND tt.TagID != '4820'\n\t\tAND tt.TagID != '2838'\n\t\tAND g.CategoryID = '1'\n\t\tAND tags.Uses > '10'\n\tGROUP BY tt.TagID\n\tORDER BY Score DESC\n\tLIMIT 8");
    $JsonYouMightLike = array();
    while (list($Tag) = $DB->next_record()) {
        $JsonYouMightLike[] = $Tag;
    }
    json_die("success", array('results' => array(), 'youMightLike' => $JsonYouMightLike));
}
$Bookmarks = Bookmarks::all_bookmarks('torrent');
$JsonGroups = array();
foreach ($Results as $Result) {
    $GroupID = $Result['groupid'];
    $GroupInfo = $Groups[$GroupID];
    if (empty($GroupInfo['Torrents'])) {
        continue;
    }
    $CategoryID = $Result['categoryid'];
    $GroupYear = $GroupInfo['Year'];
    $ExtendedArtists = $GroupInfo['ExtendedArtists'];
    $GroupCatalogueNumber = $GroupInfo['CatalogueNumber'];
    $GroupName = $GroupInfo['Name'];
    $GroupRecordLabel = $GroupInfo['RecordLabel'];
开发者ID:karamanolev,项目名称:Gazelle,代码行数:31,代码来源:browse.php


示例6: error

<?php

require SERVER_ROOT . '/sections/torrents/functions.php';
$GroupID = (int) $_GET['id'];
if ($GroupID === 0) {
    error('bad id parameter', true);
}
$TorrentDetails = get_group_info($GroupID, true, 0, false);
$TorrentDetails = $TorrentDetails[0];
$Image = $TorrentDetails['WikiImage'];
if (!$Image) {
    // handle no artwork
    $Image = STATIC_SERVER . 'common/noartwork/' . $CategoryIcons[$TorrentDetails['CategoryID'] - 1];
}
json_die("success", array('wikiImage' => $Image));
开发者ID:Kufirc,项目名称:Gazelle,代码行数:15,代码来源:torrentgroupalbumart.php


示例7: torrenthash_to_torrentid

        $TorrentID = (int) torrenthash_to_torrentid($TorrentHash);
        if (!$TorrentID) {
            json_die("failure", "bad hash parameter");
        }
    }
}
if ($TorrentID <= 0) {
    json_die("failure", "bad id parameter");
}
$TorrentCache = get_torrent_info($TorrentID, true, 0, true, true);
if (!$TorrentCache) {
    json_die("failure", "bad id parameter");
}
list($TorrentDetails, $TorrentList) = $TorrentCache;
if (!isset($TorrentList[$TorrentID])) {
    json_die("failure", "bad id parameter");
}
$GroupID = $TorrentDetails['ID'];
$ArtistForm = Artists::get_artist($GroupID);
if ($TorrentDetails['CategoryID'] == 0) {
    $CategoryName = "Unknown";
} else {
    $CategoryName = $Categories[$TorrentDetails['CategoryID'] - 1];
}
$JsonMusicInfo = array();
if ($CategoryName == "Music") {
    $JsonMusicInfo = array('composers' => $ArtistForm[4] == null ? array() : pullmediainfo($ArtistForm[4]), 'dj' => $ArtistForm[6] == null ? array() : pullmediainfo($ArtistForm[6]), 'artists' => $ArtistForm[1] == null ? array() : pullmediainfo($ArtistForm[1]), 'with' => $ArtistForm[2] == null ? array() : pullmediainfo($ArtistForm[2]), 'conductor' => $ArtistForm[5] == null ? array() : pullmediainfo($ArtistForm[5]), 'remixedBy' => $ArtistForm[3] == null ? array() : pullmediainfo($ArtistForm[3]), 'producer' => $ArtistForm[7] == null ? array() : pullmediainfo($ArtistForm[7]));
} else {
    $JsonMusicInfo = null;
}
$TagList = explode('|', $TorrentDetails['GROUP_CONCAT(DISTINCT tags.Name SEPARATOR \'|\')']);
开发者ID:Kufirc,项目名称:Gazelle,代码行数:31,代码来源:torrent.php


示例8: json_die

<?php

$PostID = (int) $_POST['postid'];
if (empty($PostID)) {
    json_die("error", "empty postid");
}
$DB->query("\n\tSELECT t.ForumID, p.Body\n\tFROM forums_posts AS p\n\t\tJOIN forums_topics AS t ON p.TopicID = t.ID\n\tWHERE p.ID = '{$PostID}'");
if (!$DB->has_results()) {
    json_die("error", "no results");
}
list($ForumID, $Body) = $DB->next_record();
if (!Forums::check_forumperm($ForumID)) {
    json_die("error", "assholes");
}
json_die("success", array("body" => nl2br($Body)));
开发者ID:Kufirc,项目名称:Gazelle,代码行数:15,代码来源:raw_bbcode.php


示例9: elseif

<?php

if (!empty($_GET['id']) && is_number($_GET['id'])) {
    //Visiting article via ID
    $ArticleID = $_GET['id'];
} elseif ($_GET['name'] != '') {
    //Retrieve article ID via alias.
    $ArticleID = Wiki::alias_to_id($_GET['name']);
} else {
    json_die("failure");
}
if (!$ArticleID) {
    //No article found
    json_die("failure", "article not found");
}
$Article = Wiki::get_article($ArticleID, false);
if (!$Article) {
    json_die("failure", "article not found");
}
list($Revision, $Title, $Body, $Read, $Edit, $Date, $AuthorID, $AuthorName, $Aliases, $UserIDs) = array_shift($Article);
if ($Read > $LoggedUser['EffectiveClass']) {
    json_die("failure", "higher user class required to view article");
}
Text::$TOC = true;
$TextBody = Text::full_format($Body, false);
json_die("success", array('title' => $Title, 'bbBody' => $Body, 'body' => $TextBody, 'aliases' => $Aliases, 'authorID' => (int) $AuthorID, 'authorName' => $AuthorName, 'date' => $Date, 'revision' => (int) $Revision));
开发者ID:karamanolev,项目名称:Gazelle,代码行数:26,代码来源:wiki.php


示例10: elseif

<?php

if (!empty($_GET['id']) && is_number($_GET['id'])) {
    //Visiting article via ID
    $ArticleID = $_GET['id'];
} elseif ($_GET['name'] != '') {
    //Retrieve article ID via alias.
    $ArticleID = Wiki::alias_to_id($_GET['name']);
} else {
    json_die("failure");
}
if (!$ArticleID) {
    //No article found
    json_die("failure", "article not found");
}
$Article = Wiki::get_article($ArticleID, false);
if (!$Article) {
    json_die("failure", "article not found");
}
list($Revision, $Title, $Body, $Read, $Edit, $Date, $AuthorID, $AuthorName, $Aliases, $UserIDs) = array_shift($Article);
if ($Read > $LoggedUser['EffectiveClass']) {
    json_die("failure", "higher user class required to view article");
}
Text::$TOC = true;
$TextBody = Text::full_format($Body, false);
json_print("success", array('title' => $Title, 'bbBody' => $Body, 'body' => $TextBody, 'aliases' => $Aliases, 'authorID' => (int) $AuthorID, 'authorName' => $AuthorName, 'date' => $Date, 'revision' => (int) $Revision));
开发者ID:Kufirc,项目名称:Gazelle,代码行数:26,代码来源:wiki.php


示例11: removeCellFormat

<?php

if (isset($_REQUEST['click_to_call']) && $_REQUEST['click_to_call'] == 1) {
    $fields['deal_id'] = $_REQUEST['dealId'];
    $fields['agent_phone'] = removeCellFormat($_REQUEST['agent_phone']);
    $fields['agent_name'] = $_REQUEST['agent_name'];
    $fields['customer_phone'] = removeCellFormat($_REQUEST['customer_phone']);
    $click_to_call_id = qi("click_to_call", $fields);
    $callWebhook = new callWebhook();
    $sid = $callWebhook->click_to_call($click_to_call_id);
    $data = array("id" => $click_to_call_id, "sid" => $sid);
    json_die(true, $data);
}
$dealId = $_REQUEST['dealId'];
$phone_count = $_REQUEST['phone_count'];
$contact_list = array();
$is_cust_number = 0;
for ($index = 1; $index <= $phone_count; $index++) {
    $is_cust_number = 1;
    $contact_list[] = removeCellFormat($_REQUEST['phone_' . $index]);
}
$conversation_list = q("select * from text_conversation where deal_id='{$dealId}' order by messageTime asc");
$agent_name = $_REQUEST['agent_name'];
$agent = qs("select * from pd_users where name='{$agent_name}'");
if (empty($agent) || $agent['phone'] == '' && $agent['cell'] == '') {
    $is_agent_number = 0;
} else {
    $is_agent_number = 1;
    $agent_no = $agent['phone'] == '' ? $agent['cell'] : $agent['phone'];
    $agent_no = formatCellDash($agent_no);
}
开发者ID:dave-jay,项目名称:twilio-call-text,代码行数:31,代码来源:click_to_call.inc.php


示例12: array

$ArtistForm = Artists::get_artist($GroupID);
if ($TorrentDetails['CategoryID'] == 0) {
    $CategoryName = "Unknown";
} else {
    $CategoryName = $Categories[$TorrentDetails['CategoryID'] - 1];
}
$JsonMusicInfo = array();
if ($CategoryName == "Music") {
    $JsonMusicInfo = array('composers' => $ArtistForm[4] == null ? array() : pullmediainfo($ArtistForm[4]), 'dj' => $ArtistForm[6] == null ? array() : pullmediainfo($ArtistForm[6]), 'artists' => $ArtistForm[1] == null ? array() : pullmediainfo($ArtistForm[1]), 'with' => $ArtistForm[2] == null ? array() : pullmediainfo($ArtistForm[2]), 'conductor' => $ArtistForm[5] == null ? array() : pullmediainfo($ArtistForm[5]), 'remixedBy' => $ArtistForm[3] == null ? array() : pullmediainfo($ArtistForm[3]), 'producer' => $ArtistForm[7] == null ? array() : pullmediainfo($ArtistForm[7]));
} else {
    $JsonMusicInfo = null;
}
$JsonTorrentDetails = array('wikiBody' => Text::full_format($TorrentDetails['WikiBody']), 'wikiImage' => $TorrentDetails['WikiImage'], 'id' => (int) $TorrentDetails['ID'], 'name' => $TorrentDetails['Name'], 'year' => (int) $TorrentDetails['Year'], 'recordLabel' => $TorrentDetails['RecordLabel'], 'catalogueNumber' => $TorrentDetails['CatalogueNumber'], 'releaseType' => (int) $TorrentDetails['ReleaseType'], 'categoryId' => (int) $TorrentDetails['CategoryID'], 'categoryName' => $CategoryName, 'time' => $TorrentDetails['Time'], 'vanityHouse' => $TorrentDetails['VanityHouse'] == 1, 'isBookmarked' => Bookmarks::has_bookmarked('torrent', $GroupID), 'musicInfo' => $JsonMusicInfo);
$Torrent = $TorrentList[$TorrentID];
$Reports = Torrents::get_reports($TorrentID);
if (count($Reports) > 0) {
    $Torrent['Reported'] = true;
} else {
    $Torrent['Reported'] = false;
}
// Convert file list back to the old format
$FileList = explode("\n", $Torrent['FileList']);
foreach ($FileList as &$File) {
    $File = Torrents::filelist_old_format($File);
}
unset($File);
$FileList = implode('|||', $FileList);
$Userinfo = Users::user_info($Torrent['UserID']);
$JsonTorrentList[] = array('id' => (int) $Torrent['ID'], 'infoHash' => $Torrent['InfoHash'], 'media' => $Torrent['Media'], 'format' => $Torrent['Format'], 'encoding' => $Torrent['Encoding'], 'remastered' => $Torrent['Remastered'] == 1, 'remasterYear' => (int) $Torrent['RemasterYear'], 'remasterTitle' => $Torrent['RemasterTitle'], 'remasterRecordLabel' => $Torrent['RemasterRecordLabel'], 'remasterCatalogueNumber' => $Torrent['RemasterCatalogueNumber'], 'scene' => $Torrent['Scene'] == 1, 'hasLog' => $Torrent['HasLog'] == 1, 'hasCue' => $Torrent['HasCue'] == 1, 'logScore' => (int) $Torrent['LogScore'], 'fileCount' => (int) $Torrent['FileCount'], 'size' => (int) $Torrent['Size'], 'seeders' => (int) $Torrent['Seeders'], 'leechers' => (int) $Torrent['Leechers'], 'snatched' => (int) $Torrent['Snatched'], 'freeTorrent' => $Torrent['FreeTorrent'] == 1, 'reported' => $Torrent['Reported'], 'time' => $Torrent['Time'], 'description' => $Torrent['Description'], 'fileList' => $FileList, 'filePath' => $Torrent['FilePath'], 'userId' => (int) $Torrent['UserID'], 'username' => $Userinfo['Username']);
json_die("success", array('group' => $JsonTorrentDetails, 'torrent' => array_pop($JsonTorrentList)));
开发者ID:karamanolev,项目名称:Gazelle,代码行数:30,代码来源:torrent.php


示例13: array

if ($LoggedUser['LastReadNews'] != $News[0][0]) {
    $Cache->begin_transaction("user_info_heavy_{$UserID}");
    $Cache->update_row(false, array('LastReadNews' => $News[0][0]));
    $Cache->commit_transaction(0);
    $DB->query("\n\t\tUPDATE users_info\n\t\tSET LastReadNews = '" . $News[0][0] . "'\n\t\tWHERE UserID = {$UserID}");
    $LoggedUser['LastReadNews'] = $News[0][0];
}
if (($Blog = $Cache->get_value('blog')) === false) {
    $DB->query("\n\t\tSELECT\n\t\t\tb.ID,\n\t\t\tum.Username,\n\t\t\tb.UserID,\n\t\t\tb.Title,\n\t\t\tb.Body,\n\t\t\tb.Time,\n\t\t\tb.ThreadID\n\t\tFROM blog AS b\n\t\t\tLEFT JOIN users_main AS um ON b.UserID = um.ID\n\t\tORDER BY Time DESC\n\t\tLIMIT 20");
    $Blog = $DB->to_array();
    $Cache->cache_value('blog', $Blog, 1209600);
}
$JsonBlog = array();
for ($i = 0; $i < 5; $i++) {
    list($BlogID, $Author, $AuthorID, $Title, $Body, $BlogTime, $ThreadID) = $Blog[$i];
    $JsonBlog[] = array('blogId' => (int) $BlogID, 'author' => $Author, 'title' => $Title, 'bbBody' => $Body, 'body' => Text::full_format($Body), 'blogTime' => $BlogTime, 'threadId' => (int) $ThreadID);
}
$JsonAnnouncements = array();
$Count = 0;
foreach ($News as $NewsItem) {
    list($NewsID, $Title, $Body, $NewsTime) = $NewsItem;
    if (strtotime($NewsTime) > time()) {
        continue;
    }
    $JsonAnnouncements[] = array('newsId' => (int) $NewsID, 'title' => $Title, 'bbBody' => $Body, 'body' => Text::full_format($Body), 'newsTime' => $NewsTime);
    if (++$Count > 4) {
        break;
    }
}
json_die("success", array('announcements' => $JsonAnnouncements, 'blogPosts' => $JsonBlog));
开发者ID:karamanolev,项目名称:Gazelle,代码行数:30,代码来源:announcements.php


示例14: json_die

<?php

//Don't allow bigger queries than specified below regardless of called function
$SizeLimit = 10;
$Count = (int) $_GET['count'];
$Offset = (int) $_GET['offset'];
if (!isset($_GET['count']) || !isset($_GET['offset']) || $Count <= 0 || $Offset < 0 || $Count > $SizeLimit) {
    json_die('failure');
}
Text::$TOC = true;
global $DB;
$DB->query("\n\t\tSELECT\n\t\t\tID,\n\t\t\tTitle,\n\t\t\tBody,\n\t\t\tTime\n\t\tFROM news\n\t\tORDER BY Time DESC\n\t\tLIMIT {$Offset}, {$Count}");
$News = $DB->to_array(false, MYSQLI_NUM, false);
$NewsResponse = array();
foreach ($News as $NewsItem) {
    list($NewsID, $Title, $Body, $NewsTime) = $NewsItem;
    array_push($NewsResponse, array($NewsID, Text::full_format($Title), time_diff($NewsTime), Text::full_format($Body)));
}
json_die('success', json_encode($NewsResponse));
开发者ID:karamanolev,项目名称:Gazelle,代码行数:19,代码来源:news_ajax.php


示例15: json_die

<?php

/**********************************************************************
 *>>>>>>>>>>>>>>>>>>>>>>>>>>> User search <<<<<<<<<<<<<<<<<<<<<<<<<<<<*
 **********************************************************************/
if (empty($_GET['search'])) {
    json_die("failure", "no search terms");
} else {
    $_GET['username'] = $_GET['search'];
}
define('USERS_PER_PAGE', 30);
if (isset($_GET['username'])) {
    $_GET['username'] = trim($_GET['username']);
    list($Page, $Limit) = Format::page_limit(USERS_PER_PAGE);
    $DB->query("\n\t\tSELECT\n\t\t\tSQL_CALC_FOUND_ROWS\n\t\t\tID,\n\t\t\tUsername,\n\t\t\tEnabled,\n\t\t\tPermissionID,\n\t\t\tDonor,\n\t\t\tWarned,\n\t\t\tAvatar\n\t\tFROM users_main AS um\n\t\t\tJOIN users_info AS ui ON ui.UserID = um.ID\n\t\tWHERE Username LIKE '%" . db_string($_GET['username']) . "%'\n\t\tORDER BY Username\n\t\tLIMIT {$Limit}");
    $Results = $DB->to_array();
    $DB->query('SELECT FOUND_ROWS();');
    list($NumResults) = $DB->next_record();
}
$JsonUsers = array();
foreach ($Results as $Result) {
    list($UserID, $Username, $Enabled, $PermissionID, $Donor, $Warned, $Avatar) = $Result;
    $JsonUsers[] = array('userId' => (int) $UserID, 'username' => $Username, 'donor' => $Donor == 1, 'warned' => $Warned != '0000-00-00 00:00:00', 'enabled' => $Enabled == 2 ? false : true, 'class' => Users::make_class_string($PermissionID), 'avatar' => $Avatar);
}
json_print("success", array('currentPage' => (int) $Page, 'pages' => ceil($NumResults / USERS_PER_PAGE), 'results' => $JsonUsers));
开发者ID:Kufirc,项目名称:Gazelle,代码行数:25,代码来源:usersearch.php


示例16: json_die

<?php

/*
User topic subscription page
*/
if (!empty($LoggedUser['DisableForums'])) {
    json_die('failure');
}
if (isset($LoggedUser['PostsPerPage'])) {
    $PerPage = $LoggedUser['PostsPerPage'];
} else {
    $PerPage = POSTS_PER_PAGE;
}
list($Page, $Limit) = Format::page_limit($PerPage);
$ShowUnread = !isset($_GET['showunread']) && !isset($HeavyInfo['SubscriptionsUnread']) || isset($HeavyInfo['SubscriptionsUnread']) && !!$HeavyInfo['SubscriptionsUnread'] || isset($_GET['showunread']) && !!$_GET['showunread'];
$ShowCollapsed = !isset($_GET['collapse']) && !isset($HeavyInfo['SubscriptionsCollapse']) || isset($HeavyInfo['SubscriptionsCollapse']) && !!$HeavyInfo['SubscriptionsCollapse'] || isset($_GET['collapse']) && !!$_GET['collapse'];
$sql = '
	SELECT
		SQL_CALC_FOUND_ROWS
		MAX(p.ID) AS ID
	FROM forums_posts AS p
		LEFT JOIN forums_topics AS t ON t.ID = p.TopicID
		JOIN users_subscriptions AS s ON s.TopicID = t.ID
		LEFT JOIN forums AS f ON f.ID = t.ForumID
		LEFT JOIN forums_last_read_topics AS l ON p.TopicID = l.TopicID AND l.UserID = s.UserID
	WHERE s.UserID = ' . $LoggedUser['ID'] . '
		AND p.ID <= IFNULL(l.PostID, t.LastPostID)
		AND ' . Forums::user_forums_sql();
if ($ShowUnread) {
    $sql .= '
		AND IF(l.PostID IS NULL OR (t.IsLocked = \'1\' && t.IsSticky = \'0\'), t.LastPostID, l.PostID) < t.LastPostID';
开发者ID:Kufirc,项目名称:Gazelle,代码行数:31,代码来源:subscriptions.php


示例17: _cg

 * 
 */
$urlArgs = _cg("url_vars");
if (isset($_REQUEST['edit_agent']) && trim($_REQUEST['edit_agent']) == '1') {
    $deal_nm_arr = array();
    $deal_nm = '';
    $deal_nm_arr = qs("SELECT * FROM pd_sources WHERE id = '" . $_REQUEST["deal_id"] . "'");
    $deal_nm = $deal_nm_arr["source_name"];
    $res_arr = array();
    $res_arr['deal_nm'] = $deal_nm;
    ob_start();
    include 'call_distribution_select_agent_ui.inc.php';
    $selection_content = ob_get_contents();
    ob_end_clean();
    $res_arr['selection_content'] = $selection_content;
    json_die(true, $res_arr);
    die;
}
if (isset($_REQUEST['update_call']) && $_REQUEST['update_call'] == 1) {
    //$user_list_update = Call_distribution::AllLeadSorceNull(); //First Null the Call List
    $json_user_list = '';
    $user_list = array();
    if (isset($_REQUEST["user_list"]) && $_REQUEST["user_list"] != '') {
        $user_list = $_REQUEST["user_list"];
    }
    // Conver array to json format //
    if (!empty($user_list) && count($user_list) > 0) {
        $json_user_list = json_encode($user_list);
    }
    $source_pk_id = '';
    $source_pk_id = trim($_REQUEST["source_pk_id"]);
开发者ID:dave-jay,项目名称:twilio-call-text,代码行数:31,代码来源:call_distribution.inc.php


示例18: COUNT

        $DB->query("\n\t\t\tSELECT COUNT(ID)\n\t\t\tFROM forums_topics\n\t\t\tWHERE ForumID = '{$ForumID}'\n\t\t\t\tAND IsSticky = '1'");
        list($Stickies) = $DB->next_record();
        $Cache->cache_value("forums_{$ForumID}", array($Forum, '', 0, $Stickies), 0);
    }
}
if (!isset($Forums[$ForumID])) {
    json_die("failure");
}
// Make sure they're allowed to look at the page
if (!check_perms('site_moderate_forums')) {
    if (isset($LoggedUser['CustomForums'][$ForumID]) && $LoggedUser['CustomForums'][$ForumID] === 0) {
        json_die("failure", "insufficient permissions to view page");
    }
}
if ($LoggedUser['CustomForums'][$ForumID] != 1 && $Forums[$ForumID]['MinClassRead'] > $LoggedUser['Class']) {
    json_die("failure", "insufficient permissions to view page");
}
$ForumName = display_str($Forums[$ForumID]['Name']);
$JsonSpecificRules = array();
foreach ($Forums[$ForumID]['SpecificRules'] as $ThreadIDs) {
    $Thread = Forums::get_thread_info($ThreadIDs);
    $JsonSpecificRules[] = array('threadId' => (int) $ThreadIDs, 'thread' => display_str($Thread['Title']));
}
$Pages = Format::get_pages($Page, $Forums[$ForumID]['NumTopics'], TOPICS_PER_PAGE, 9);
if (count($Forum) === 0) {
    print json_encode(array('status' => 'success', 'forumName' => $ForumName, 'threads' => array()));
} else {
    // forums_last_read_topics is a record of the last post a user read in a topic, and what page that was on
    $DB->query("\n\t\tSELECT\n\t\t\tl.TopicID,\n\t\t\tl.PostID,\n\t\t\tCEIL(\n\t\t\t\t(\n\t\t\t\t\tSELECT COUNT(p.ID)\n\t\t\t\t\tFROM forums_posts AS p\n\t\t\t\t\tWHERE p.TopicID = l.TopicID\n\t\t\t\t\t\tAND p.ID <= l.PostID\n\t\t\t\t) / {$PerPage}\n\t\t\t) AS Page\n\t\tFROM forums_last_read_topics AS l\n\t\tWHERE l.TopicID IN(" . implode(', ', array_keys($Forum)) . ')
			AND l.UserID = \'' . $LoggedUser['ID'] . '\'');
    // Turns the result set into a multi-dimensional array, with
开发者ID:Kufirc,项目名称:Gazelle,代码行数:31,代码来源:forum.php


示例19: die

    die(json_encode(array("error" => "you are not in this group")));
}
$body = trim($_POST['body']);
if ($body === "") {
    json_die(400, "empty post");
}
$stmt = $db->prepare("INSERT INTO group_posts (group_id, user_id, body) VALUES (:group_id, :user_id, :body)");
$stmt->bindValue(":group_id", $group['id'], PDO::PARAM_INT);
$stmt->bindValue(":user_id", $user['id'], PDO::PARAM_INT);
$stmt->bindValue(":body", $body);
$stmt->execute();
$post_id = $db->lastInsertId();
// If successful, return the rendered post
$stmt = $db->prepare("SELECT body, created_at FROM group_posts WHERE id = :post_id");
$stmt->bindValue(":post_id", $post_id);
$stmt->execute();
$post = $stmt->fetch();
if ($post === false) {
    // shouldn't happen
    json_die(500, "couldn't fetch post");
}
$date = new DateTime($post['created_at']);
$body = "";
$body .= '<article id="post-' . $post_id . '">';
$body .= '<b>' . htmlspecialchars($user['name']);
$body .= ' on ' . htmlspecialchars($date->format("M j"));
$body .= ' at ' . htmlspecialchars($date->format("H:i"));
$body .= '</b>';
$body .= '<p>' . htmlspecialchars($post['body']) . '</p>';
$body .= '</article>';
echo json_encode(array("id" => $post_id, "post" => $body));
开发者ID:magical,项目名称:cs290-project,代码行数:31,代码来源:post_ajax.php


示例20: json_die

<?php

/**********************************************************************
 *>>>>>>>>>>>>>>>>>>>>>>>>>>> User search <<<<<<<<<<<<<<<<<<<<<<<<<<<<*
 **********************************************************************/
if (empty($_GET['search'])) {
    json_die("failure", "no search terms");
} else {
    $_GET['username'] = $_GET['search'];
}
define('USERS_PER_PAGE', 30);
if (isset($_GET['username'])) {
    $_GET['username'] = trim($_GET['username']);
    list($Page, $Limit) = Format::page_limit(USERS_PER_PAGE);
    $DB->query("\n\t\tSELECT\n\t\t\tSQL_CALC_FOUND_ROWS\n\t\t\tID,\n\t\t\tUsername,\n\t\t\tEnabled,\n\t\t\tPermissionID,\n\t\t\tDonor,\n\t\t\tWarned,\n\t\t\tAvatar\n\t\tFROM users_main AS um\n\t\t\tJOIN users_info AS ui ON ui.UserID = um.ID\n\t\tWHERE Username LIKE '%" . db_string($_GET['username']) . "%'\n\t\tORDER BY Username\n\t\tLIMIT {$Limit}");
    $Results = $DB->to_array();
    $DB->query('SELECT FOUND_ROWS();');
    list($NumResults) = $DB->next_record();
}
$JsonUsers = array();
foreach ($Results as $Result) {
    list($UserID, $Username, $Enabled, $PermissionID, $Donor, $Warned, $Avatar) = $Result;
    $JsonUsers[] = array('userId' => (int) $UserID, 'username' => $Username, 'donor' => $Donor == 1, 'warned' => $Warned != '0000-00-00 00:00:00', 'enabled' => $Enabled == 2 ? false : true, 'class' => Users::make_class_string($PermissionID), 'avatar' => $Avatar);
}
json_die("success", array('currentPage' => (int) $Page, 'pages' => ceil($NumResults / USERS_PER_PAGE), 'results' => $JsonUsers));
开发者ID:karamanolev,项目名称:Gazelle,代码行数:25,代码来源:usersearch.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP json_encode函数代码示例发布时间:2022-05-15
下一篇:
PHP json_decode_plus函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap