本文整理汇总了PHP中printJSON函数的典型用法代码示例。如果您正苦于以下问题:PHP printJSON函数的具体用法?PHP printJSON怎么用?PHP printJSON使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了printJSON函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actRemove
function actRemove()
{
global $ST, $post;
$field_name = $post->get('field_name');
$ST->delete('sc_enum', "field_name='{$field_name}'");
exit(printJSON(array('msg' => 'Удалено')));
}
示例2: actSend
function actSend()
{
global $post;
$error = array();
if (!$this->getUserId()) {
$error['userid'] = 'Ќеобходимо выпонить вход, или зарегистрироватьс¤';
}
if (!trim($post->get('description'))) {
$error['description'] = '¬ведите описание';
}
if (!trim($post->get('text'))) {
$error['text'] = '¬ведите текст';
}
if (empty($error)) {
$data = array('userid' => $this->getUserId(), 'text' => $post->get('text'), 'description' => $post->get('description'), 'category' => $post->getInt('category'), 'time' => now(), 'date_to' => dte($post->get('date_to'), DTE_FORMAT_SQL), 'status' => 0);
DB::insert('sc_shop_board', $data);
$this->sendTemplateMail($this->cfg('MAIL'), 'notice_board', $data);
// $this->noticeICQ($this->cfg('ICQ'),'Ќовое объ¤вление на сайте на сайте');
} else {
echo printJSON(array('err' => $error));
exit;
}
echo printJSON(array('msg' => 'ok'));
exit;
}
示例3: actReset
function actReset()
{
global $ST;
$ST->update('sc_news', array('view' => 0), "id=" . intval($_POST['id']));
echo printJSON(array("id" => intval($_POST['id'])));
exit;
}
示例4: actSend
function actSend()
{
global $ST, $post;
$error = array();
if (!trim($post->get('name'))) {
$error['name'] = 'Введите ФИО';
}
if (!trim($post->get('question'))) {
$error['question'] = 'Введите вопрос';
}
if (!$this->checkCapture($post->get('capture'), $this->getType())) {
$error['capture'] = "Введите правильный код!";
}
if (empty($error)) {
$data = array('mail' => $post->get('mail'), 'phone' => $post->get('phone'), 'name' => $post->get('name'), 'question' => $post->get('question'), 'ip' => $_SERVER['REMOTE_ADDR'], 'browser' => $_SERVER['HTTP_USER_AGENT'], 'state' => 'edit');
$data['type'] = $this->getType();
if ($post->exists('theme')) {
$data['theme'] = $post->get('theme');
}
$ST->insert('sc_faq', $data);
$mail_contacts = $this->enum('mail_contacts', $this->getRegion());
$this->sendTemplateMail($this->cfg('MAIL_FAQ') . '; ' . $mail_contacts, 'notice_faq', $data);
$this->noticeICQ($this->cfg('ICQ'), 'Новое сообщение на сайте');
}
echo printJSON(array('err' => $error));
exit;
}
示例5: actSave
function actSave()
{
global $ST, $post;
$config_arr = $post->getArray('config');
$text_arr = $post->getArray('text');
$description_arr = $post->getArray('description');
foreach ($description_arr as $name => $d) {
$data = array('description' => $d, 'text' => $text_arr[$name]);
$class = "PS" . ucfirst($name);
include_once "ps/{$class}.class.php";
$ps = new $class();
$config = array();
foreach ($ps->config as $c) {
$config[$c] = @$config_arr[$name][$c];
}
$data['config'] = serialize($config);
$rs = $ST->select("SELECT * FROM sc_pay_system WHERE name='{$name}'");
if ($rs->next()) {
$ST->update('sc_pay_system', $data, "name='{$name}'");
} else {
$data['name'] = $name;
$ST->insert('sc_pay_system', $data);
}
}
if ($paysystem = $post->get('default')) {
$rs = $ST->select("SELECT * FROM sc_config WHERE name='PAYSYSTEM'");
if ($rs->next()) {
$ST->update('sc_config', array('value' => $paysystem), "name='PAYSYSTEM'");
} else {
$ST->insert('sc_config', array('value' => $paysystem, 'name' => 'PAYSYSTEM', 'description' => 'Платёжная система'));
}
}
echo printJSON(array('msg' => 'Сохранено!'));
exit;
}
示例6: actReset
function actReset()
{
global $ST;
$ST->update('sc_vote_item', array('result' => 0), "voteid=" . intval($_POST['id']));
$ST->delete('sc_vote_det', "itemid IN(SELECT id FROM sc_vote_item WHERE voteid=" . intval($_POST['id']) . ")");
echo printJSON(array("id" => intval($_POST['id'])));
exit;
}
示例7: actExec
function actExec()
{
global $ST, $post;
$q = str_replace('`', '', $post->get('query'));
$res = $ST->exec($q);
echo printJSON(array('msg' => print_r($res, true)));
exit;
}
示例8: actRemove
function actRemove()
{
global $ST;
$q = "DELETE FROM sc_guestbook WHERE id=" . intval($_POST['id']);
$ST->executeDelete($q);
echo printJSON(array("id" => intval($_POST['id'])));
exit;
}
示例9: actGetPos
function actGetPos()
{
global $ST, $post;
$d = '';
$rs = $ST->select("SELECT u.district FROM sc_shop_order o,sc_users u WHERE o.driver=u.u_id AND o.order_status=2 AND o.id={$post->getInt('order_num')}");
if ($rs->next()) {
$d = $rs->get('district');
}
echo printJSON(array('point' => $d));
exit;
}
示例10: actSave
function actSave()
{
global $ST, $post;
$data = array('comment' => $post->get('comment'), 'answer' => $post->get('answer'), 'time_answer' => date('Y-m-d H:i:s'), 'status' => $post->getInt('status'));
if ($id = $post->getInt('id')) {
$ST->update('sc_comment', $data, "id={$id}");
} else {
$id = $ST->insert("sc_comment", $data);
}
echo printJSON(array('id' => $id, 'msg' => 'Сохранено!'));
exit;
}
示例11: actGetText
function actGetText()
{
global $ST, $post;
$data = array('rule' => '', 'text' => '', 'url' => $post->get('url'), 'exists' => false);
$rs = $ST->select("SELECT text,url,rule FROM sc_ceo_text\r\n\t\t\t WHERE\r\n\t\t\t \tplace='{$post->get('place')}' \r\n\t\t\t \tAND ((url='" . SQL::slashes($post->get('url')) . "' AND rule='=') \r\n\t\t\t \tOR ('" . SQL::slashes($post->get('url')) . "' LIKE CONCAT(url,'%') AND rule!='=' ))\r\n\t\t\t ORDER BY LENGTH(url) DESC LIMIT 1");
if ($rs->next()) {
$data = $rs->getRow();
$data['exists'] = true;
}
$data['place'] = $post->get('place');
echo printJSON($data);
exit;
}
示例12: actSave
function actSave()
{
global $ST, $post;
$id = $post->getInt('id');
$data = array('name' => $post->get('name'), 'theme' => $post->get('theme'), 'body' => $post->get('body'), 'description' => $post->get('description'));
if ($id) {
$ST->update('sc_letter_template', $data, 'id=' . $id);
} else {
$id = $ST->insert('sc_letter_template', $data);
}
echo printJSON(array('msg' => '—охранено', 'id' => $id));
exit;
}
示例13: actSend
function actSend()
{
global $ST, $post;
$error = array();
// if($this->checkCapture($post->get('capture'))){
// $error['capture']="Введите правильный код!";
// }
$form = trim($this->mod_alias, '/');
if (empty($error)) {
$data = array('data' => serialize($post->get()), 'form' => $form);
$ST->insert('sc_forms', $data);
$data['html'] = $data['data'];
unset($data['data']);
$data['html'] = $this->render(unserialize($data['html']), dirname(__FILE__) . '/' . $data['form'] . '_view.tpl.php');
$this->sendTemplateMail($this->cfg('MAIL_CONTACTS'), 'forms_' . $form, $data);
// $this->noticeICQ($this->cfg('ICQ'),'Новое сообщение на сайте');
}
echo printJSON(array('err' => $error));
exit;
}
示例14: actSendComment
function actSendComment()
{
global $ST, $post;
if ($this->checkCapture($post->get('capture'), 'gfb')) {
$d = array('itemid' => $post->getInt('itemid'), 'comment' => $post->get('comment'), 'name' => $post->get('name') ? $post->get('name') : $this->getUser('name'), 'mail' => $post->get('mail') ? $post->get('mail') : $this->getUser('mail'), 'time' => date('Y-m-d H:i:s'), 'ip' => $_SERVER['REMOTE_ADDR'], 'status' => 1, 'type' => $post->get('type') ? $post->get('type') : 'goods');
$id = $ST->insert("sc_comment", $d, 'id');
$d['fullurl'] = "{$_SERVER['HTTP_HOST']}" . $this->getURI();
// $mail_contacts=$this->enum('mail_contacts',$this->getRegion());
$this->sendTemplateMail($this->cfg('MAIL_CONTACTS'), 'notice_goods_comment', $d);
$rait = $post->getArray('rait');
foreach ($rait as $k => $v) {
$d = array('commentid' => (int) $id, 'raitid' => (int) $k, 'rating' => (int) $v);
$ST->insert('sc_comment_rait', $d, 'raitid');
}
echo printJSON(array('res' => 'ok'));
exit;
} else {
echo printJSON(array('err' => 'Введите правильный код'));
exit;
}
}
示例15: actSend
function actSend()
{
global $ST, $post;
$error = array();
if (!trim($post->get('name'))) {
$error['name'] = 'Введите ФИО';
}
if (!trim($post->get('comment'))) {
$error['comment'] = 'Введите сообщение';
}
if (defined('IMG_SECURITY') && (!isset($_SESSION[IMG_SECURITY]) || $post->get('capture') != $_SESSION[IMG_SECURITY])) {
$error['capture'] = "Введите правильный код!";
}
if (empty($error)) {
$data = array('mail' => $post->get('mail'), 'phone' => $post->get('phone'), 'name' => $post->get('name'), 'theme' => $post->get('theme'), 'comment' => $post->get('comment'), 'ip' => $_SERVER['REMOTE_ADDR'], 'browser' => $_SERVER['HTTP_USER_AGENT'], 'order_num' => $post->get('order_num'), 'score' => $post->get('score'));
$ST->insert('sc_guestbook', $data);
$this->sendTemplateMail($this->cfg('mail'), 'notice_guestbook', $data);
$this->noticeICQ($this->cfg('ICQ'), 'Новое сообщение на сайте в разделе ' . $this->mod_name);
}
echo printJSON(array('err' => $error));
exit;
}