function actRemove() { global $ST, $post; $field_name = $post->get('field_name'); $ST->delete('sc_enum', "field_name='{$field_name}'"); exit(printJSON(array('msg' => 'Удалено'))); }
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; }
function actReset() { global $ST; $ST->update('sc_news', array('view' => 0), "id=" . intval($_POST['id'])); echo printJSON(array("id" => intval($_POST['id']))); exit; }
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; }
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; }
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; }
function actExec() { global $ST, $post; $q = str_replace('`', '', $post->get('query')); $res = $ST->exec($q); echo printJSON(array('msg' => print_r($res, true))); exit; }
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; }
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; }
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; }
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; }
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; }
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; }
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; } }
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; }
function actSave() { global $ST, $post; $id = $post->getInt('c_id'); if (!trim($post->get('c_name'))) { echo printJSON(array('err' => 'Введите название')); exit; } $rs = $ST->select("SELECT * FROM sc_content WHERE c_name='" . SQL::slashes($post->get('c_name')) . "' AND c_id<>{$id}"); if ($rs->next()) { echo printJSON(array('err' => 'Содержимое с таким названием СУЩЕСТВУЕТ')); exit; } $data = array('c_name' => $post->get('c_name'), 'c_text' => $post->get('c_text')); if ($id) { $ST->update('sc_content', $data, 'c_id=' . $id); } else { $id = $ST->insert('sc_content', $data, 'c_id'); } echo printJSON(array('msg' => 'Сохранено', 'c_id' => $id)); exit; }
public function displaySearchControl() { $this->searchControlBuilder = new PanelSearchControl($this->searchControllerId, $this->tName, $this->searchClauseObj, $this); $defaultValue = $this->pSet->getDefaultValue($this->ctrlField); $ctrlBlockArr = $this->searchControlBuilder->buildSearchCtrlBlockArr($this->id, $this->ctrlField, 0, '', false, true, $defaultValue, ''); // build array for encode $resArr = array(); $resArr['control1'] = trim($this->xt->call_func($ctrlBlockArr['searchcontrol'])); $resArr['control2'] = trim($this->xt->call_func($ctrlBlockArr['searchcontrol1'])); $resArr['comboHtml'] = trim($ctrlBlockArr['searchtype']); $resArr['delButt'] = trim($ctrlBlockArr['delCtrlButt']); $resArr['delButtId'] = trim($this->searchControlBuilder->getDelButtonId($this->ctrlField, $this->id)); $resArr['divInd'] = trim($this->id); $resArr['fLabel'] = GetFieldLabel(GoodFieldName($this->tName), GoodFieldName($this->ctrlField)); $resArr['ctrlMap'] = $this->controlsMap['controls']; if (postvalue('isNeedSettings') == 'true') { $this->fillSettings(); $resArr['settings'] = $this->jsSettings; } // return JSON echo printJSON($resArr); exit; }
public function showPage() { if ($this->eventsObject->exists("BeforeShowChart")) { $this->eventsObject->BeforeShowChart($this->xt, $this->templatefile, $this); } if ($this->mode == CHART_DETAILS || $this->mode == CHART_DASHBOARD || $this->mode == CHART_DASHDETAILS) { $this->addControlsJSAndCSS(); $this->fillSetCntrlMaps(); $this->xt->unassign("header"); $this->xt->unassign("footer"); $this->body["begin"] = ""; $this->body["end"] = ""; $this->xt->assign("body", $this->body); $bricksExcept = array("chart"); $this->xt->hideAllBricksExcept($bricksExcept); if ($this->show_message_block) { $this->xt->assign("message_block", true); } $this->displayAJAX($this->templatefile, $this->id + 1); exit; } if ($this->mode == CHART_POPUPDETAILS) { $bricksExcept = array("grid", "pagination"); $this->xt->unassign('header'); $this->xt->unassign('footer'); $this->body["begin"] = ''; $this->body["end"] = ''; $this->xt->hideAllBricksExcept($bricksExcept); $this->xt->prepare_template($this->templatefile); $respArr = array(); $respArr['success'] = true; $respArr['body'] = $this->xt->fetch_loaded("body"); $respArr['counter'] = postvalue('counter'); $this->xt->assign("container_master", false); echo printJSON($respArr); exit; } $this->display($this->templatefile); }
</div> </td> <?php /*tr> <th>Статус</th> <td> <?foreach($status as $key=>$desc){?> <input type="radio" class="radio" name="state" id="<?=$key?>" value="<?=$key?>" <?=($state == $key)?'checked="checked"':''?>/> <label for="<?=$key?>"><?=$desc?></label><br /> <?}?> </td> </tr*/ ?> </table> <hr/> <input type="submit" name="save" class="button save" value="Сохранить"/> <input name="close" type="submit" class="button" value="Закрыть"/> </form> <script type="text/javascript"> var IMAGES=<?php echo printJSON($data['images']); ?> ; </script> <script type="text/javascript" src="/tiny_mce/jquery.tinymce.js"></script> <script type="text/javascript" src="/tiny_mce/jquery.tiny.js"></script> <script type="text/javascript" src="/modules/gallery/admin_gallery_edit.js"></script>
<?php include 'autocomplete.php'; include '../core/function.php'; if (!empty($_GET['term'])) { $term = iconv('utf-8', 'cp1251', $_GET['term']); $q = "SELECT DISTINCT value FROM sc_shop_prop_val WHERE value LIKE '{$term}%'"; if (!empty($_GET['prop'])) { $prop = iconv('utf-8', 'cp1251', $_GET['prop']); $q = "SELECT DISTINCT v.value FROM sc_shop_prop_val v,sc_shop_prop p WHERE v.prop_id=p.id AND p.name='{$prop}' AND v.value LIKE '{$term}%'"; } $rs = $ST->select($q); $out = array(); while ($rs->next()) { $out[] = array('label' => $rs->get('value')); } echo printJSON($out); }
if (strlen(GetLWWhere($f, $pageType, $strTableName))) { $hasWhere = true; } break; } $lookupIndexes = GetLookupFieldsIndexes($gSettings, $lookupField); $linkFieldIndex = $lookupIndexes["linkFieldIndex"]; $displayFieldIndex = $lookupIndexes["displayFieldIndex"]; if ($lookupConnection) { $qResult = $lookupConnection->query($LookupSQL); while ($data = $qResult->fetchNumeric()) { if ($LookupType == LT_QUERY && $gSettings->isLookupUnique($lookupField)) { if (!isset($uniqueArray)) { $uniqueArray = array(); } if (in_array($data[$displayFieldIndex], $uniqueArray)) { continue; } $uniqueArray[] = $data[$displayFieldIndex]; } $data[$linkFieldIndex] = $cipherer->DecryptField($lookupField, $data[$linkFieldIndex]); if ($LookupType == LT_QUERY) { $data[$displayFieldIndex] = $cipherer->DecryptField($displayFieldName, $data[$displayFieldIndex]); } $response[] = $data[$linkFieldIndex]; $response[] = $data[$displayFieldIndex]; } } $respObj = array('success' => true, 'data' => array_slice($response, 0, 40)); echo printJSON($respObj); exit;
/** * Display blocks after loaded template of page */ function showPageAjax() { $lookupSearchControls = $this->xt->fetch_loaded('searchform_text') . $this->xt->fetch_loaded('searchform_search') . $this->xt->fetch_loaded('searchform_showall'); $this->xt->assign("lookupSearchControls", $lookupSearchControls); $this->addControlsJSAndCSS(); $this->fillSetCntrlMaps(); $returnJSON = array(); $returnJSON['controlsMap'] = $this->controlsHTMLMap; $returnJSON['viewControlsMap'] = $this->viewControlsHTMLMap; $returnJSON['settings'] = $this->jsSettings; $this->xt->assign("header", false); $this->xt->assign("footer", false); $returnJSON["html"] = $this->xt->fetch_loaded("body"); $returnJSON['idStartFrom'] = $this->flyId; $returnJSON['success'] = true; $returnJSON["additionalJS"] = $this->grabAllJsFiles(); $returnJSON["CSSFiles"] = $this->grabAllCSSFiles(); echo printJSON($returnJSON); }
function actSaveAddr() { global $ST, $post; $id = $post->getInt('id'); if ($id) { $ST->update('sc_contacts_points', $_POST, "id=" . $id); } else { $id = $ST->insert('sc_contacts_points', $post->get()); } echo printJSON(array('msg' => 'Сохранено', 'id' => $id)); exit; }
/** * Show the page. * It's supposed to be displayed in resonce on an ajax-like request */ public function showPage() { $this->BeforeShowList(); $this->prepareTemplate(); $contents = $this->xt->fetch_loaded("body"); $this->addControlsJSAndCSS(); $this->fillSetCntrlMaps(); $responce = array(); $responce['settings'] = $this->jsSettings; $responce['controlsMap'] = $this->controlsHTMLMap; $responce['viewControlsMap'] = $this->viewControlsHTMLMap; $responce['html'] = $contents; $responce['success'] = true; $responce['id'] = $this->id; $responce['idStartFrom'] = $this->flyId; $responce['delRecs'] = $this->recordsDeleted; if ($this->deleteMessage != '') { $responce['delMess'] = true; } $responce["additionalJS"] = $this->grabAllJsFiles(); $responce["additionalCSS"] = $this->grabAllCSSFiles(); echo printJSON($responce); }
/** * Display the add page basing on its mode */ protected function displayAddPage() { $templatefile = $this->templatefile; if ($this->eventsObject->exists("BeforeShowAdd")) { $this->eventsObject->BeforeShowAdd($this->xt, $templatefile, $this); } if ($this->mode == ADD_SIMPLE) { $this->display($templatefile); return; } if ($this->mode == ADD_ONTHEFLY || $this->mode == ADD_POPUP || $this->mode == ADD_DASHBOARD) { $this->displayAJAX($templatefile, $this->id + 1); exit; } if ($this->mode == ADD_INLINE) { $returnJSON = array(); $returnJSON['settings'] = $this->jsSettings; $returnJSON['controlsMap'] = $this->controlsHTMLMap; $returnJSON['viewControlsMap'] = $this->viewControlsHTMLMap; $this->xt->load_template($templatefile); $returnJSON["html"] = array(); foreach ($this->addFields as $fName) { $returnJSON["html"][$fName] = $this->xt->fetchVar(GoodFieldName($fName) . "_editcontrol"); } $returnJSON["additionalJS"] = $this->grabAllJsFiles(); $returnJSON["additionalCSS"] = $this->grabAllCSSFiles(); echo printJSON($returnJSON); exit; } }
function actChangeCity() { global $post; if ($city = $post->get('city')) { Cookie::set('city', $city); } echo printJSON(array('city' => $city)); exit; }
/** * Display the inline report preview in responce on an ajax-like request */ protected function showDpAjax() { $this->xt->unassign("cross_controls"); $bricksExcept = array("grid", "pagination", "details_found", "page_of"); $this->xt->hideAllBricksExcept($bricksExcept); $this->xt->prepare_template($this->templatefile); $this->addControlsJSAndCSS(); $this->fillSetCntrlMaps(); $responce = array(); $responce['settings'] = $this->jsSettings; $responce['controlsMap'] = $this->controlsHTMLMap; $responce['viewControlsMap'] = $this->viewControlsHTMLMap; $responce['html'] = $this->xt->fetch_loaded("body"); $responce['success'] = true; $responce['id'] = $this->id; $responce['idStartFrom'] = $this->flyId; $responce["additionalJS"] = $this->grabAllJsFiles(); $responce["additionalCSS"] = $this->grabAllCSSFiles(); echo printJSON($responce); }
while (($row = $qResult->fetchNumeric()) && count($response) < $numberOfSuggests) { $val = $cipherer->DecryptField($f, $row[0]); if (IsGuid($fType)) { $val = substr($val, 1, -1); } // "_" is added to conver number type to string $fieldControl->suggestValue("_" . $val, $searchFor, $response, $row); } } $_connection->close(); ksort($response, SORT_STRING); foreach ($response as $value => $realValue) { if (count($result) > $numberOfSuggests) { break; } $strValue = $value[0] == '_' ? substr($value, 1) : $value; // .net compatibility issue $strRealValue = $realValue[0] == '_' ? substr($realValue, 1) : $realValue; $pos = my_stripos($strValue, $searchFor, 0); if ($pos === FALSE) { $result[] = array("value" => runner_htmlspecialchars($strValue), "realValue" => $strRealValue); } else { $highlightedValue = runner_htmlspecialchars(substr($strValue, 0, $pos)) . "<b>" . runner_htmlspecialchars(substr($strValue, $pos, strlen($searchFor))) . "</b>" . runner_htmlspecialchars(substr($strValue, $pos + strlen($searchFor))); $result[] = array("value" => $highlightedValue, "realValue" => $strRealValue); } } $returnJSON = array(); $returnJSON['success'] = true; $returnJSON['result'] = $result; echo printJSON($returnJSON); exit;
public static function sendPermissionError() { echo printJSON(array("success" => false, "message" => "You don't have permissions to access this table")); exit; }
$logFilePath = $_SESSION[$pageObject->sessionPrefix . "_tempImportLogFilePath"]; if (!myfile_exists($logFilePath)) { $data = array("success" => false); echo printJSON($data); exit; } header("Content-Type: text/plain"); header("Content-Disposition: attachment;Filename=importLog.txt"); header("Cache-Control: private"); printfile($logFilePath); exit; } if ($action == "downloadUnprocessed") { $dataFilePath = $_SESSION[$pageObject->sessionPrefix . "_tempDataFilePath"]; if (!myfile_exists($dataFilePath)) { $data = array("success" => false); echo printJSON($data); exit; } header("Content-Type: application/csv"); header("Content-Disposition: attachment;Filename=unpocessedData.csv"); printfile($dataFilePath); exit; } // add button events if exist $pageObject->addButtonHandlers(); $pageObject->addCommonJs(); $pageObject->addCommonHtml(); $hiddenBricks = array("import_rawtext_control", "import_preview", "import_process", "import_results", "error_message"); $xt->displayBricksHidden($hiddenBricks); $pageObject->display($pageObject->templatefile);