本文整理汇总了PHP中Ajax::outputError方法的典型用法代码示例。如果您正苦于以下问题:PHP Ajax::outputError方法的具体用法?PHP Ajax::outputError怎么用?PHP Ajax::outputError使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Ajax
的用法示例。
在下文中一共展示了Ajax::outputError方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: foreach
}
}
} else {
foreach ($templateData as $k => $i){
$newTemplateData[$k] = $templateData[$k];
}
}
*/
if (!($update = $saved->update_JSON($template, $templateData))) {
Ajax::outputError('JSON file couldn\'t be updated');
}
//!copy original messages
$savedJSON = $saved->getJSONContent();
$savedData = json_decode($savedJSON, true);
$savedData['configs']['notify'] = $initialData['configs']['notify'];
$savedData['configs']['displayRulesFlag'] = $initialData['configs']['displayRulesFlag'];
$savedData['display_rules'] = $initialData['display_rules'];
//$savedData['configs']['notify']['message'] = $initialData['configs']['notify']['message'];
if (!$saved->updateJSON_Data($savedData)) {
Ajax::outputError('JSON file couldn\'t be updated');
}
//!end
$notif = Notify::getByHash($hash);
if (!($reload = $notif->getJSONContent())) {
Ajax::output('Can\'t reload json data!');
}
if ($xmlTemplate) {
Ajax::output($customize->getHtml($xmlTemplate, $reload));
} else {
Ajax::outputError('Internal server error. Try again later');
}
示例2: isset
Ajax::requireLoggedIn();
$quizHash = isset($_GET['quiz']) ? $_GET['quiz'] : null;
$quiz = Quiz::getByHash($quizHash);
if (empty($quiz->id) || !$quiz->hasAccess()) {
Ajax::outputError('You don\'t have access to this quiz');
}
$filter = new Filter();
$saveType = 'insert';
if (isset($_GET['filter_id']) && !empty($_GET['filter_id'])) {
$filter->readId($_GET['filter_id']);
if (empty($filter->id)) {
Ajax::outputError('Invalid filter');
}
if ($filter->quiz_id != $quiz->id) {
Ajax::outputError('Invalid filter');
}
$saveType = 'update';
}
$data = new stdClass();
$data->question = isset($_GET['question']) ? $_GET['question'] : null;
$data->answer = isset($_GET['answer']) ? $_GET['answer'] : null;
if (!empty($_GET['name'])) {
$filter->name = $_GET['name'];
}
$filter->setData($data);
$filter->quiz_id = $quiz->id;
$filter->save();
$out = new stdClass();
$out->name = $filter->name;
$out->id = $filter->id;
示例3: isset
<?php
$filterId = isset($_GET['filter']) ? intval($_GET['filter']) : null;
$filter = new Filter($filterId);
if (empty($filter->id)) {
Ajax::outputError('Invalid report');
}
$quiz = new Quiz($filter->quiz_id);
if (!$quiz->hasAccess()) {
Ajax::outputError('Invalid report');
}
$filter->delete();
Ajax::output($filterId);
示例4: isset
<?php
Ajax::requireLoggedIn();
$hash = isset($_POST['hash']) ? $_POST['hash'] : $_GET['hash'];
$notify = Notify::getByHash($hash);
if (empty($notify->id) || !$notify->hasAccess()) {
Ajax::outputError('You don\'t have access to this notification!');
}
Ajax::output($notify->name);
示例5: isset
<?php
Ajax::requireLoggedIn();
$id = isset($_GET['id']) ? $_GET['id'] : null;
$color = isset($_GET['color']) ? $_GET['color'] : Quiz::DEFAULT_CUSTOMIZE_BGCOLOR;
$quiz = new Quiz($id);
$match = '/^[a-f0-9]{6}$/i';
if (!preg_match($match, $color)) {
Ajax::outputError('Invalid color');
}
if (empty($quiz->id) || !$quiz->hasAccess()) {
Ajax::outputError('You don\'t have access to this quiz');
}
$quiz->customize_bgcolor = $color;
$quiz->save();
示例6: Notify
<?php
$notify = new Notify($_GET['id']);
if (empty($notify->id)) {
Ajax::outputError('Invalid notification');
}
$notify->delete();
示例7: session_start
<?php
require_once "../init.php";
session_start();
#get the page::
$page = isset($_GET['page']) ? safeFileName($_GET['page']) : null;
if (empty($page) && isset($_POST['page'])) {
$page = safeFileName($_POST['page']);
}
$controller = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'pages' . DIRECTORY_SEPARATOR . $page . '.php';
$req = isset($_POST) ? $_POST : $_GET;
if (file_exists($controller)) {
require_once $controller;
Ajax::output('Success');
} else {
Ajax::outputError('Bad Request');
}
示例8: elseif
if (empty($data['email'])) {
$data['email'] = 'anonymous';
} elseif (!valid_email($data['email'])) {
Ajax::outputError('Please enter a valid email address.');
}
if (empty($data['comment'])) {
Ajax::outputError('Please enter your comment.');
}
if (isset($_SESSION['time_between_albums'])) {
if ($_SESSION['time_between_albums'] + QuizComment::TIME_BETWEEN_COMMENTS > time()) {
Ajax::outputError('You are posting comments too quickly. Slow down.');
}
}
$quiz = new Quiz($data['quiz_id']);
if (empty($quiz->id)) {
Ajax::outputError('Internal error');
}
$comment = new QuizComment();
$comment->quiz_id = $data['quiz_id'];
$comment->name = $data['name'];
$comment->email = $data['email'];
$comment->website = $data['website'];
$comment->comment = $data['comment'];
$comment->ip = $_SERVER['REMOTE_ADDR'];
$comment->date = $comment->now();
if (User::isLogged()) {
if (User::getLogged()->id == $quiz->user_id) {
$comment->owner = 1;
}
}
$comment->save();
示例9: isset
<?php
Ajax::requireLoggedIn();
$request = isset($_POST) ? $_POST : $_GET;
$quizId = isset($request['quiz']) ? $request['quiz'] : null;
$quiz = new Quiz($quizId);
if (empty($quiz->id) || !$quiz->hasAccess()) {
Ajax::outputError('You don\'t have access to this quiz');
}
if (!isset($request['data']) || empty($request['data'])) {
Ajax::outputError('Invalid data');
}
ignore_user_abort(true);
set_time_limit(120);
parse_str($request['data'], $data);
#$quiz->customize($data);
$template = new Templates($quiz->template_id);
$xmlTemplate = gzdecode(file_get_contents($template->getXmlLink()));
if (empty($xmlTemplate)) {
Ajax::outputError('Internal error: Cannot load template xml');
}
$customize = new Customize($quiz);
$xmlTemplate = $customize->parsePost($xmlTemplate, $data);
if ($quiz->actualizeParams($xmlTemplate)) {
Ajax::output($quiz);
} else {
Ajax::outputError('Internal server error: Cannot save your quiz');
}
示例10: isset
<?php
Ajax::requireLoggedIn();
$message = isset($_GET['message']) ? $_GET['message'] : '';
if (!isset($message) || empty($message)) {
Ajax::outputError("Empty message!");
}
$hash = isset($_GET['hash']) ? $_GET['hash'] : '';
if (!isset($hash) || empty($hash)) {
Ajax::outputError("Empty hash!");
}
$user = User::getLogged();
$notification = Notify::getByHash($hash);
$feedback = new UserFeedback();
$feedback->user_id = $user->id;
$feedback->message = $message;
$feedback->date_added = getDateMysql();
$feedback->ip = $_SERVER['REMOTE_ADDR'];
$feedback->notification_id = $notification->id;
$feedback->save();
$message = '<p>' . nl2br(str_replace(' ', ' ', $message)) . '</p><hr/>';
$message .= '<br/><h4>User info</h4>';
$message .= '<span>Screen name: ' . $user->screenname . '</span>';
$message .= '<br/><span>User email: ' . $user->email . '</span>';
$message .= '<br/><span>Account id: ' . $user->id . '</span>';
$message .= '<br/><span>Notification ID: ' . $notification->id . '</span>';
$message .= '<br/><span>Notification hash: ' . $notification->hash . '</span>';
$message .= '<br/><span>Notification name: ' . $notification->name . '</span>';
$message .= '<br/><span>Notification parent hash: ' . $notification->parent_hash . '</span>';
$mail = new PHPMailer();
$mail->CharSet = "UTF-8";
示例11: Notify
<?php
Ajax::requireLoggedIn();
$notify = new Notify($_GET['item']);
if (empty($notify->id) || !$notify->hasAccess()) {
Ajax::outputError('You don\'t have access to this notification');
}
$notifyName = trim($_GET['name']);
if (empty($notifyName)) {
Ajax::outputError('Notification name can\'t be empty');
}
/*if ($notifyName != $notify->name) {
if ($notify->notificationNameExists($notifyName)){
Ajax::outputError('Notification name already exists');
}
}*/
$notify->changeName($notifyName);
$out['id'] = $notify->id;
$out['name'] = $notify->name;
/*
$out = new stdClass();
$out->id = $notify->id;
$out->name = $notify->name;
*/
Ajax::output($out);
示例12: ignore_user_abort
<?php
ignore_user_abort(true);
set_time_limit(90);
$id = isset($_GET['id']) ? $_GET['id'] : null;
$state = isset($_GET['state']) ? $_GET['state'] : null;
$notify = new Notify($id);
if (!$notify->hasAccess()) {
Ajax::outputError('You don\'t have access to this notification');
}
if (!($json = $notify->getJSONContent())) {
Ajax::output('Could not generate default json params!');
}
//doar pe ON se mai poate pune
$params = json_decode($json, true);
$params['configs']['state'] = 'ON';
if (!$notify->updateJSON_Data($params)) {
Ajax::outputError('Could not update json params.');
}
//doar pe ON se mai poate pune
$notify->id = $id;
$notify->state = $state == 'ON';
$notify->save();
示例13: isset
Ajax::requireLoggedIn();
$id = isset($_GET['item']) ? $_GET['item'] : null;
$notify = new Notify($id);
if (!$notify->hasAccess()) {
Ajax::outputError('You don\'t have access to this notification');
}
if ($notify->isPremium()) {
//Ajax::outputMyError('This notification is premium already');
}
$premiumInfo = $config->premium['others'];
$request = new SnacktoolsRequest('remove_points');
$request->addParam('user_id', User::getLogged()->id);
$request->addParam('points', $premiumInfo['points']);
$request->addParam('description', $premiumInfo['description']);
$request->addParam('service_id', $premiumInfo['id']);
$request->addParam('item_type', $premiumInfo['itemType']);
$request->addParam('item_id', $notify->id);
$response = $request->request();
if ($response->areErrors()) {
Ajax::outputError($response->error);
}
$notify->setFlag(Notify::FLAG_PREMIUM, true);
$notify->premium_type = $response->data['buy_type'];
$notify->activatePremium($response->data['buy_type']);
$notify->actualize('no');
$out = new stdClass();
$out->id = $notify->id;
$out->flags = $notify->flags;
$out->premium_type = $notify->premium_type;
$out->date_premium = $notify->date_premium;
Ajax::output($out);