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


PHP system::isAjax方法代码示例

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


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

示例1: addAction

 public function addAction()
 {
     if (user::isGuest() && reg::getKey('/comments/only_reg')) {
         system::stop();
     }
     if (user::isGuest() && !system::validCapcha('random_image')) {
         system::json(array('error' => 1, 'data' => lang::get('FEEDBACK_ERROR1')));
     }
     // Добавляем новый комментарий
     $comment = new comment();
     $comment->setParentId(system::POST('parent_id'));
     $comment->setObjId(system::POST('obj_id'));
     $comment->setUserName(system::POST('username'));
     $comment->setEmail(system::POST('email'));
     $comment->setText(system::POST('text'));
     $comment->setSendEmail(system::POST('send_email'));
     $obj_id = $comment->save();
     if ($obj_id) {
         page::assign('current_url', system::POST('back_url'));
         $html = page::macros('comments')->view($comment->id());
         system::json(array('error' => 0, 'data' => $html));
     } else {
         system::json(array('error' => 2, 'data' => $comment->getErrorListText(' ')));
     }
     if (!empty($_POST['back_url']) && !system::isAjax()) {
         system::redirect($_POST['back_url'] . '#comment' . $obj_id, true);
     } else {
         system::stop();
     }
 }
开发者ID:sunfun,项目名称:Bagira.CMS,代码行数:30,代码来源:controller.php

示例2: subscribeAction

 public function subscribeAction()
 {
     $email = system::POST('email', isEmail);
     if (empty($email)) {
         $answer = array('error' => 1, 'msg' => lang::get('SUBSCRIPTION_EMPTY_EMAIL'));
     } else {
         if (empty($_POST['subscribes'])) {
             $answer = array('error' => 2, 'msg' => lang::get('SUBSCRIPTION_EMPTY_LIST'));
         } else {
             $sid = mailingProcess::addEmail($email, $_POST['subscribes'], true);
             if ($sid) {
                 $answer = array('error' => 0, 'msg' => lang::get('SUBSCRIPTION_MSG'));
             } else {
                 $answer = array('error' => 3, 'msg' => lang::get('SUBSCRIPTION_ERROR'));
             }
         }
     }
     if (!system::isAjax()) {
         if (!empty($answer['error'])) {
             system::saveErrorToSession('subscription', $answer);
             if (!empty($_POST['back_url'])) {
                 system::redirect($_POST['back_url'], true);
             }
         } else {
             system::redirect('/subscription/ok');
         }
     } else {
         system::json($answer);
     }
 }
开发者ID:sunfun,项目名称:Bagira.CMS,代码行数:30,代码来源:controller.php

示例3: doAction

 public function doAction()
 {
     $answers = system::POST('answers');
     $error = 2;
     $msg = '';
     if (count($answers) > 0) {
         if ($vote = ormPages::get(system::POST('vote_id'), 'vote')) {
             if (!$vote->close) {
                 $sel = new ormSelect('answer');
                 $sel->fields('name, count');
                 $sel->where('parents', '=', $vote->id);
                 while ($answ = $sel->getObject()) {
                     if (in_array($answ->id, $answers)) {
                         $answ->count = $answ->count + 1;
                         $answ->save();
                         if (!$vote->multiselect) {
                             break;
                         }
                     }
                 }
                 cache::delete('vote' . $vote->id . '1');
                 cache::delete('vote' . $vote->id . '0');
                 $_SESSION['voting_' . $vote->id] = 1;
                 $error = 0;
             } else {
                 // Голосование закрыто
                 $msg = lang::get('VOTING_MSG_CLOSE');
                 $error = 1;
             }
         } else {
             $msg = lang::get('VOTING_MSG_NOT_FOUND');
         }
     } else {
         $msg = lang::get('VOTING_MSG_CHOSE_VAR');
     }
     if (system::isAjax()) {
         if ($error < 2 && $vote instanceof ormPage) {
             $data = page::macros('voting')->objView($vote->id);
         }
         system::json(array('error' => 0, 'html' => $data, 'msg' => $msg));
     } else {
         if (!empty($_POST['back_url'])) {
             system::redirect($_POST['back_url'], true);
         } else {
             system::redirect('/');
         }
     }
 }
开发者ID:sunfun,项目名称:Bagira.CMS,代码行数:48,代码来源:controller.php

示例4: proc

 public function proc()
 {
     if (system::isAjax() && system::issetUrl(2)) {
         if (system::url(2) == 'start') {
             searchIndex::clear();
             reg::setKey(ormPages::getPrefix('search') . '/index_date', date('d.m.Y'));
             $sel = new ormSelect();
             $sel->fields('name');
             $sel->findInPages();
             $sel->where('active', '=', 1);
             $sel->where('in_search', '=', 1);
             echo $sel->getCount();
         } else {
             if (system::url(2) == 'info') {
                 $data = reg::getKey(ormPages::getPrefix('search') . '/index_date');
                 if (empty($data)) {
                     $data = '-';
                 }
                 system::json(array('pages' => searchIndex::getCountPages(), 'words' => searchIndex::getCountWords(), 'data' => $data));
             } else {
                 $sel = new ormSelect();
                 $sel->findInPages();
                 $sel->where('active', '=', 1);
                 $sel->where('in_search', '=', 1);
                 $sel->limit(system::url(2), 1);
                 searchIndex::indexPage($sel->getObject());
                 echo 'ok';
             }
         }
         system::stop();
     }
     if (system::POST('parram') == 'clear') {
         searchIndex::clear();
     }
     system::redirect('/search/index');
 }
开发者ID:sunfun,项目名称:Bagira.CMS,代码行数:36,代码来源:__index.php

示例5: send_messageAction


//.........这里部分代码省略.........
             $obj->in_search = 1;
             $obj->in_index = 1;
             $obj->is_home_page = 0;
             if ($obj->name != '') {
                 $obj->h1 = $obj->name;
                 $obj->title = $obj->name;
             }
             $obj->pseudo_url = rand(1000, 9999);
             $obj->template_id = ($sect = ormPages::get($form_obj->section)) ? $sect->template_id : 1;
             $obj->form_id = $form_obj->id;
             $obj->setRightForAll(2);
             $obj_id = $obj->save();
             if ($obj_id) {
                 $obj->pseudo_url = $obj_id;
                 $obj->save();
                 $obj = new ormPage($obj_id);
             } else {
                 $issetErrors = true;
                 $f = $obj->getErrorFields();
                 $answer = array('field' => $f['focus'], 'msg' => $obj->getErrorListText(' '));
             }
         }
         if (!$issetErrors) {
             // Отправка нужных писем
             page::assign('site_name', domains::curDomain()->getSiteName());
             page::assign('site_url', domains::curDomain()->getName());
             page::assign('base_email', domains::curDomain()->getEmail());
             while (list($key, $val) = each($_POST)) {
                 page::assign($key, system::checkVar($val, isText));
             }
             if (isset($obj)) {
                 $fields = $obj->getClass()->loadFields();
                 foreach ($fields as $field) {
                     if (in_array($field['f_type'], array(70, 75, 80, 85))) {
                         $fsname = $field['f_sname'];
                         $fvalue = $obj->{$fsname};
                         if ($fvalue != '') {
                             page::assign($fsname, $fvalue);
                         }
                     }
                 }
             }
             // Если указан список адресатов, отправляем письма
             if ($form_obj->mailing_list != '') {
                 $mail = new phpmailer();
                 $mail->From = $this->parse($form_obj->admin_sender_address);
                 $mail->FromName = $this->parse($form_obj->admin_sender_name);
                 /*
                                   if (!empty($this->files))
                 for($i = 0; $i < count($this->files); $i++)
                    $mail->AddAttachment($this->files[$i][0], $this->files[$i][1]);
                 */
                 $mail->AddAddress($form_obj->mailing_list);
                 $mail->WordWrap = 50;
                 $mail->IsHTML(true);
                 $mail->Subject = $this->parse($form_obj->admin_subject);
                 $mail->Body = $this->parse($form_obj->admin_template);
                 $mail->Send();
             }
             // Если нужно, отправляем уведомление пользователю
             if ($form_obj->send_notice && !$issetErrors) {
                 $mail = new phpmailer();
                 $mail->From = $this->parse($form_obj->notice_sender_address);
                 $mail->FromName = $this->parse($form_obj->notice_sender_name);
                 $mail->AddAddress(system::POST('email'));
                 $mail->WordWrap = 50;
                 $mail->IsHTML(true);
                 $mail->Subject = $this->parse($form_obj->notice_subject);
                 $mail->Body = $this->parse($form_obj->notice_template);
                 $mail->Send();
             }
             // Показываем результат
             if (system::isAjax()) {
                 if ($form_obj->msg != '') {
                     $text = $form_obj->msg;
                 } else {
                     $text = lang::get('FEEDBACK_MSG_1');
                 }
                 system::json(array('field' => 0, 'msg' => strip_tags($text)));
             } else {
                 system::redirect('/feedback/ok/' . $form_obj->id);
             }
         } else {
             // Произошли ошибки
             if (system::isAjax()) {
                 system::json($answer);
             } else {
                 system::savePostToSession();
                 system::saveErrorToSession('feedback', $answer);
                 if (empty($_POST['back_url'])) {
                     $_POST['back_url'] = '/structure/map';
                 }
                 system::redirect($_POST['back_url'], true);
             }
         }
         system::stop();
     } else {
         system::stop();
     }
 }
开发者ID:sunfun,项目名称:Bagira.CMS,代码行数:101,代码来源:controller.php

示例6: getHTML


//.........这里部分代码省略.........
                     page::assign('sh_text', lang::get('TABLE_SEARCH_MAX'));
                 }
                 page::fParse('filters_link', $TEMPLATE['filters_link']);
             } else {
                 page::assign('filters_link', '');
             }
             page::fParse('filters', $TEMPLATE['filters']);
             if ($show_filter && $this->filter->getCount() > 0 && !$this->show_search) {
                 page::assign('filters_link', '');
                 $up_line .= page::parse($TEMPLATE['without_search']);
             }
         } else {
             page::assign('filters', '');
         }
         page::assign('up_line', $up_line);
         // Кнопка "версия для печати"
         if ($this->print) {
             $up_line .= page::parse($TEMPLATE['print_link']);
         }
         // Дополнительные параметры запросов
         $str_param = '';
         while (list($key, $param) = each($this->moreParam)) {
             $str_param .= '/' . $param;
         }
         page::assign('parram', $str_param);
         // Вывод сообщения "Таблица пустая"
         $count = $this->isSelection ? $this->select->getCount() : count($this->data);
         if ($count <= 0) {
             if ($this->inSearch || $this->isSelection && $this->filter->isActive()) {
                 $message = lang::get('TABLE_NOT_FOUND') . '<br /><span onClick="stopSearch()">' . lang::get('TABLE_NOT_FOUND2') . '</span>';
             } else {
                 $message = empty($this->empty_text) ? lang::get('TABLE_EMPTY') : $this->empty_text;
             }
             page::assign('message', $message);
             if (system::isAjax()) {
                 echo page::parse($TEMPLATE['empty_frame']);
                 system::stop();
             } else {
                 page::fParse('content', $TEMPLATE['empty_frame']);
                 return page::parse($TEMPLATE['main']);
             }
         }
         // Постраничная навигация
         $this->navigation(5, $TEMPLATE);
         // Вывод прав
         $this->rights($TEMPLATE);
         // Определяем модуль для права по умолчанию
         $pos = strpos($this->def_right, '.');
         if (!empty($pos)) {
             $module = substr($this->def_right, 0, $pos);
             $this->def_right = substr($this->def_right, $pos + 1, strlen($this->def_right));
         } else {
             $module = system::url(0);
         }
         if (user::issetRight($this->def_right, $module)) {
             $this->def_right = system::au() . '/' . $module . '/' . $this->def_right . '/';
         } else {
             $this->def_right = '';
         }
         $this->count = $this->isSelection ? $this->select->getObjectCount() : count($this->data);
         if ($this->count == 0 && $_SESSION['table_' . $this->prefix]['page_num'] != 1) {
             $_SESSION['table_' . $this->prefix]['page_num'] -= 1;
         }
         page::assign('table_parent_id', 0);
         // Вывод строчек
         if ($this->isSelection) {
             $this->selItems($TEMPLATE);
         } else {
             $this->masItems($TEMPLATE);
         }
         // Вывод столбцов
         $this->columns($TEMPLATE);
         // Текст сообщения об удалении элементов
         if (empty($this->del_title) || empty($this->del_text)) {
             $this->del_title = lang::get('TABLE_DROP_TITLE');
             $this->del_text = lang::get('TABLE_DROP_TEXT');
         }
         if (empty($this->del_title_multi) || empty($this->del_text_multi)) {
             $this->del_title_multi = lang::get('TABLE_DROP_TITLE_MULTI');
             $this->del_text_multi = lang::get('TABLE_DROP_TEXT_MULTI');
         }
         page::assign('del_title', $this->del_title);
         page::assign('del_text', $this->del_text);
         page::assign('del_title_multi', $this->del_title_multi);
         page::assign('del_text_multi', $this->del_text_multi);
         page::assign('select_checkbox', lang::get('TABLE_SEL_CHECKBOX'));
         // Версия для печати (НУЖНО ДОДЕЛАТЬ)
         if (system::getCurrentNavVal() == 'print') {
             echo page::parse($TEMPLATE['frame']);
             system::stop();
         }
         if (system::isAjax()) {
             echo page::parse($TEMPLATE['frame']);
             system::stop();
         } else {
             page::fParse('content', $TEMPLATE['frame']);
             return page::parse($TEMPLATE['main']);
         }
     }
 }
开发者ID:sunfun,项目名称:Bagira.CMS,代码行数:101,代码来源:uiTable.php

示例7: proc_send

 public function proc_send()
 {
     if (system::isAjax() && system::issetUrl(2)) {
         if (system::url(3) == 'start') {
             echo mailingProcess::start(system::url(2), system::POST('subject'), system::POST('part'));
         } else {
             if (system::url(3) == 'stop') {
                 mailingProcess::stop(system::url(2));
             } else {
                 mailingProcess::sendNextBlock(system::url(2), system::url(3));
             }
         }
     }
     system::stop();
 }
开发者ID:sunfun,项目名称:Bagira.CMS,代码行数:15,代码来源:__msg.php

示例8: getHTML

 function getHTML($templ_name = 'orm_tree')
 {
     if (file_exists(MODUL_DIR . '/mpanel/template/' . $templ_name . '.tpl')) {
         include MODUL_DIR . '/mpanel/template/' . $templ_name . '.tpl';
         $main_url = system::au() . '/' . system::url(0) . '/';
         page::assign('main_url', $main_url);
         page::assign('plus_table', $this->plus_table);
         // Помечаем веточку закрытой
         if (system::isAjax() && (system::url(2) == 'close' || system::url(2) == 'open') && system::issetUrl(3)) {
             if (system::url(2) == 'open' && is_numeric(system::url(3))) {
                 $_SESSION['TREE_OPEN_NODES'][system::url(3)] = 1;
             } else {
                 if (isset($_SESSION['TREE_OPEN_NODES'][system::url(3)])) {
                     unset($_SESSION['TREE_OPEN_NODES'][system::url(3)]);
                 }
             }
             system::stop();
         } else {
             // По POST запросу формируем ветку дерева
             if (isset($_POST['id'])) {
                 if (!empty($_POST['id'])) {
                     //system::log($_POST['id']);
                     $_POST['id'] = str_replace('phtml_', '', $_POST['id']);
                     $pos = strpos($_POST['id'], '_');
                     $_POST['id'] = substr($_POST['id'], 0, strlen($_POST['id']) - (strlen($_POST['id']) - $pos));
                     //system::log($_POST['id']);
                 }
                 $_SESSION['TREE_OPEN_NODES'][$_POST['id']] = 1;
                 ormPages::init(array($_POST['id'] => 1));
                 // Строим одни уровень дерева
                 $tmp = $this->build_menu($_POST['id'], $TEMPLATE, false);
                 //echo str_replace('`%`', '%', $tmp);
                 echo $tmp;
                 system::stop();
             }
         }
         // Парсим дерево разделов
         if (isset($_SESSION['TREE_OPEN_NODES'])) {
             ormPages::init($_SESSION['TREE_OPEN_NODES']);
         }
         $subm = $this->build_menu($this->root_id, $TEMPLATE);
         page::assign('sub_items', $subm);
         page::assign('item.id', $this->root_id);
         page::assign('item.parent_id', '');
         page::assign('item.url', $this->root_url);
         page::assign('item.active', 1);
         page::assign('item.name', $this->root_title);
         page::assign('item.notice', '');
         page::assign('obj.ico', '/css_mpanel/tree/images/classes/core.png');
         page::assign('obj.url', '');
         page::assign('close', empty($subm) ? '' : ' open');
         page::fParse('items', $TEMPLATE['items']);
         page::fParse('frame_items', $TEMPLATE['frame_items']);
         // Выводим список прав для веточек
         $item = '';
         $zagl_width = 0;
         while (list($key, $right) = each($this->rights)) {
             if ($right['java'] == 1) {
                 $zagl_width += 20;
             }
             if ($right == 'empty' || !user::issetRight($right['name']) && $right['name'] != 'getUrl()') {
                 $item .= $right != 'empty' ? '' : page::parse($TEMPLATE['item_right_null']);
             } else {
                 page::assign('title', $right['title']);
                 page::assign('image_style', $right['class']);
                 page::assign('url', $main_url . $right['name'] . '/');
                 page::assign('hide_in_root', $right['show_in_root'] ? '' : ' hide_in_root');
                 if ($right['name'] == 'getUrl()') {
                     $templ = 'item_right_url';
                 } else {
                     $templ = $right['java'] == 1 ? 'item_right_del' : 'item_right';
                 }
                 if (!empty($right['list'])) {
                     $templ = 'item_right_list';
                     page::assign('list_id', $right['list']);
                     page::assign('list_html', $right['list_html']);
                     page::fParse('tree_list', $TEMPLATE['tree_list']);
                 }
                 $item .= page::parse($TEMPLATE[$templ]);
             }
         }
         page::assign('rights', $item);
         page::assign('act_link', $this->rightActive);
         page::assign('remove_link', $this->rightRemove);
         page::assign('load_link', $this->ajaxLink);
         page::assign('root_id', $this->root_id);
         page::assign('zagl_width', $zagl_width);
         // Текст сообщения об удалении элементов
         if (empty($this->del_title) || empty($this->del_text)) {
             $this->del_title = lang::get('TABLE_DROP_TITLE');
             $this->del_text = lang::get('TABLE_DROP_TEXT');
         }
         page::assign('del_title', $this->del_title);
         page::assign('del_text', $this->del_text);
         page::assign('width', $this->width);
         page::assign('width2', $this->width2);
         page::assign('left', $this->width - $this->width2);
         page::assign('style_prefix', $this->miniStyle ? '_mini' : '');
         page::assign('isEditable', $this->rightEdit ? 1 : 0);
         page::assign('isChangeActive', $this->rightActive ? 1 : 0);
//.........这里部分代码省略.........
开发者ID:sunfun,项目名称:Bagira.CMS,代码行数:101,代码来源:ormTree.php

示例9: change_password_procAction

 public function change_password_procAction()
 {
     if (user::isGuest()) {
         system::redirect('/users/add');
     }
     $cur_password = system::POST('current_password', isPassword);
     $new_passw = system::POST('password', isPassword);
     $new_passw2 = system::POST('password2', isPassword);
     if ($cur_password == user::get('password')) {
         if ($new_passw && $new_passw == $new_passw2) {
             if ($user = user::getObject()) {
                 $user->password = system::POST('password');
                 if ($user->save()) {
                     if (system::isAjax()) {
                         system::json(array('ok' => 1));
                     } else {
                         system::redirect('/users/change_password/ok');
                     }
                 }
             }
         }
     } else {
         $answer = array('msg' => lang::get('USERS_CHANGE_PSW_MSG'), 'field' => 'current_password');
         if (!system::isAjax()) {
             system::saveErrorToSession('change_password', $answer);
             system::redirect('/users/change_password');
         } else {
             system::json($answer);
         }
     }
     system::redirect('/users/change_password');
 }
开发者ID:sunfun,项目名称:Bagira.CMS,代码行数:32,代码来源:controller.php


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