本文整理汇总了PHP中ajax::sdgJSONencode方法的典型用法代码示例。如果您正苦于以下问题:PHP ajax::sdgJSONencode方法的具体用法?PHP ajax::sdgJSONencode怎么用?PHP ajax::sdgJSONencode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ajax
的用法示例。
在下文中一共展示了ajax::sdgJSONencode方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: elseif
echo ajax::sdgJSONencode(array('error' => MESSAGE_COMMENTS_COMPLAINT_NOT_SEND));
}
} else {
echo ajax::sdgJSONencode(array('error' => MESSAGE_COMMENTS_COMPLAINT_NOT_SEND));
}
} else {
echo ajax::sdgJSONencode(array('error' => MESSAGE_COMMENTS_COMPLAINT_NOT_SEND));
}
} elseif (isset($_POST['deleteCommentA']) && !empty($_POST['articleId'])) {
if (!empty($_POST['deleteCommentA'])) {
$articles = new articles();
$aComments = new articlesComments();
if ($arrData = $articles->getPublishedArticle("id=" . secure::escQuoteData($_POST['articleId']))) {
if (!empty($_SESSION['sd_user']['data']['id']) && $_SESSION['sd_user']['data']['id'] == $arrData['id_user']) {
if ($aComments->deleteRecords("id=" . secure::escQuoteData($_POST['deleteCommentA']))) {
echo ajax::sdgJSONencode(array('success' => true));
} else {
echo ajax::sdgJSONencode(array('error' => MESSAGE_COMMENTS_NOT_DELETE));
}
} else {
echo ajax::sdgJSONencode(array('error' => MESSAGE_COMMENTS_NOT_DELETE));
}
} else {
echo ajax::sdgJSONencode(array('error' => MESSAGE_COMMENTS_NOT_DELETE));
}
} else {
echo ajax::sdgJSONencode(array('error' => MESSAGE_COMMENTS_NOT_DELETE));
}
} else {
echo 'Error AJAX-Query!';
}
示例2: mdsDoImportDB
/**
* Функция выполнения импорта
*
* @return (string) - JSON-строка с описанием текущего состояния процесса импорта
*/
static function mdsDoImportDB()
{
if ($arrData = filesys::getSerializedData('core/data/mdsImport.mda')) {
foreach ($arrData as $table => &$arrDataTable) {
$arrQueryData = array_shift($arrDataTable);
$oldId =& $arrQueryData['old_id'];
unset($arrQueryData['old_id']);
$newId = db::dbInsertTable($table, secure::escQuoteData($arrQueryData));
switch ($table) {
case USR_PREFIX . 'city':
$arrUpdateQuerys[DB_PREFIX . 'subscription'][] = array('arrData' => array('id_city' => $newId, 'token' => 'reserved'), 'strWhere' => "id_city IN ('{$oldId}') AND token IN ('active')");
$arrUpdateQuerys[DB_PREFIX . 'subscription'][] = array('arrData' => array('id_city' => $newId, 'token' => 'deleted'), 'strWhere' => "id_city IN ('{$oldId}') AND token IN ('archived')");
$arrUpdateQuerys[DB_PREFIX . 'vacancy'][] = array('arrData' => array('id_city' => $newId, 'token' => 'reserved'), 'strWhere' => "id_city IN ('{$oldId}') AND token IN ('active')");
$arrUpdateQuerys[DB_PREFIX . 'vacancy'][] = array('arrData' => array('id_city' => $newId, 'token' => 'deleted'), 'strWhere' => "id_city IN ('{$oldId}') AND token IN ('archived')");
$arrUpdateQuerys[DB_PREFIX . 'resume'][] = array('arrData' => array('id_city' => $newId, 'token' => 'reserved'), 'strWhere' => "id_city IN ('{$oldId}') AND token IN ('active')");
$arrUpdateQuerys[DB_PREFIX . 'resume'][] = array('arrData' => array('id_city' => $newId, 'token' => 'deleted'), 'strWhere' => "id_city IN ('{$oldId}') AND token IN ('archived')");
break;
case USR_PREFIX . 'region':
$arrUpdateQuerys[USR_PREFIX . 'city'][] = array('arrData' => array('parent_id' => $newId, 'token' => 'reserved'), 'strWhere' => "parent_id IN ('{$oldId}') AND token IN ('active')");
$arrUpdateQuerys[DB_PREFIX . 'subscription'][] = array('arrData' => array('id_region' => $newId, 'token' => 'reserved'), 'strWhere' => "id_region IN ('{$oldId}') AND token IN ('active')");
$arrUpdateQuerys[DB_PREFIX . 'subscription'][] = array('arrData' => array('id_region' => $newId, 'token' => 'deleted'), 'strWhere' => "id_region IN ('{$oldId}') AND token IN ('archived')");
$arrUpdateQuerys[DB_PREFIX . 'vacancy'][] = array('arrData' => array('id_region' => $newId, 'token' => 'reserved'), 'strWhere' => "id_region IN ('{$oldId}') AND token IN ('active')");
$arrUpdateQuerys[DB_PREFIX . 'vacancy'][] = array('arrData' => array('id_region' => $newId, 'token' => 'deleted'), 'strWhere' => "id_region IN ('{$oldId}') AND token IN ('archived')");
$arrUpdateQuerys[DB_PREFIX . 'resume'][] = array('arrData' => array('id_region' => $newId, 'token' => 'reserved'), 'strWhere' => "id_region IN ('{$oldId}') AND token IN ('active')");
$arrUpdateQuerys[DB_PREFIX . 'resume'][] = array('arrData' => array('id_region' => $newId, 'token' => 'deleted'), 'strWhere' => "id_region IN ('{$oldId}') AND token IN ('archived')");
break;
case DB_PREFIX . 'profession':
$arrUpdateQuerys[DB_PREFIX . 'subscription'][] = array('arrData' => array('id_profession' => $newId, 'token' => 'reserved'), 'strWhere' => "id_profession IN ('{$oldId}') AND token IN ('active')");
$arrUpdateQuerys[DB_PREFIX . 'subscription'][] = array('arrData' => array('id_profession' => $newId, 'token' => 'deleted'), 'strWhere' => "id_profession IN ('{$oldId}') AND token IN ('archived')");
$arrUpdateQuerys[DB_PREFIX . 'vacancy'][] = array('arrData' => array('id_profession' => $newId, 'token' => 'reserved'), 'strWhere' => "id_profession IN ('{$oldId}') AND token IN ('active')");
$arrUpdateQuerys[DB_PREFIX . 'vacancy'][] = array('arrData' => array('id_profession' => $newId, 'token' => 'deleted'), 'strWhere' => "id_profession IN ('{$oldId}') AND token IN ('archived')");
$arrUpdateQuerys[DB_PREFIX . 'resume'][] = array('arrData' => array('id_profession' => $newId, 'token' => 'reserved'), 'strWhere' => "id_profession IN ('{$oldId}') AND token IN ('active')");
$arrUpdateQuerys[DB_PREFIX . 'resume'][] = array('arrData' => array('id_profession' => $newId, 'token' => 'deleted'), 'strWhere' => "id_profession IN ('{$oldId}') AND token IN ('archived')");
break;
case DB_PREFIX . 'section':
$arrUpdateQuerys[DB_PREFIX . 'profession'][] = array('arrData' => array('parent_id' => $newId, 'token' => 'reserved'), 'strWhere' => "parent_id IN ('{$oldId}') AND token IN ('active')");
$arrUpdateQuerys[DB_PREFIX . 'subscription'][] = array('arrData' => array('id_section' => $newId, 'token' => 'reserved'), 'strWhere' => "id_section IN ('{$oldId}') AND token IN ('active')");
$arrUpdateQuerys[DB_PREFIX . 'subscription'][] = array('arrData' => array('id_section' => $newId, 'token' => 'deleted'), 'strWhere' => "id_section IN ('{$oldId}') AND token IN ('archived')");
$arrUpdateQuerys[DB_PREFIX . 'vacancy'][] = array('arrData' => array('id_section' => $newId, 'token' => 'reserved'), 'strWhere' => "id_section IN ('{$oldId}') AND token IN ('active')");
$arrUpdateQuerys[DB_PREFIX . 'vacancy'][] = array('arrData' => array('id_section' => $newId, 'token' => 'deleted'), 'strWhere' => "id_section IN ('{$oldId}') AND token IN ('archived')");
$arrUpdateQuerys[DB_PREFIX . 'resume'][] = array('arrData' => array('id_section' => $newId, 'token' => 'reserved'), 'strWhere' => "id_section IN ('{$oldId}') AND token IN ('active')");
$arrUpdateQuerys[DB_PREFIX . 'resume'][] = array('arrData' => array('id_section' => $newId, 'token' => 'deleted'), 'strWhere' => "id_section IN ('{$oldId}') AND token IN ('archived')");
break;
case DB_PREFIX . 'vacancy':
$arrUpdateQuerys[DB_PREFIX . 'subscription'][] = array('arrData' => array('id_announce' => $newId, 'token' => 'reserved'), 'strWhere' => "id_announce IN ('{$oldId}') AND token IN ('active')");
$arrUpdateQuerys[DB_PREFIX . 'subscription'][] = array('arrData' => array('id_announce' => $newId, 'token' => 'deleted'), 'strWhere' => "id_announce IN ('{$oldId}') AND token IN ('archived')");
break;
case DB_PREFIX . 'resume':
$arrUpdateQuerys[DB_PREFIX . 'subscription'][] = array('arrData' => array('id_announce' => $newId, 'token' => 'reserved'), 'strWhere' => "id_announce IN ('{$oldId}') AND token IN ('active')");
$arrUpdateQuerys[DB_PREFIX . 'subscription'][] = array('arrData' => array('id_announce' => $newId, 'token' => 'deleted'), 'strWhere' => "id_announce IN ('{$oldId}') AND token IN ('archived')");
break;
case USR_PREFIX . 'users':
$arrData[DB_PREFIX . 'conf_users'][$oldId]['id'] = $newId;
$arrUpdateQuerys[DB_PREFIX . 'subscription'][] = array('arrData' => array('id_user' => $newId, 'token' => 'reserved'), 'strWhere' => "id_user IN ('{$oldId}') AND token IN ('active')");
$arrUpdateQuerys[DB_PREFIX . 'subscription'][] = array('arrData' => array('id_user' => $newId, 'token' => 'deleted'), 'strWhere' => "id_user IN ('{$oldId}') AND token IN ('archived')");
$arrUpdateQuerys[DB_PREFIX . 'vacancy'][] = array('arrData' => array('id_user' => $newId, 'token' => 'reserved'), 'strWhere' => "id_user IN ('{$oldId}') AND token IN ('active')");
$arrUpdateQuerys[DB_PREFIX . 'vacancy'][] = array('arrData' => array('id_user' => $newId, 'token' => 'deleted'), 'strWhere' => "id_user IN ('{$oldId}') AND token IN ('archived')");
$arrUpdateQuerys[DB_PREFIX . 'resume'][] = array('arrData' => array('id_user' => $newId, 'token' => 'reserved'), 'strWhere' => "id_user IN ('{$oldId}') AND token IN ('active')");
$arrUpdateQuerys[DB_PREFIX . 'resume'][] = array('arrData' => array('id_user' => $newId, 'token' => 'deleted'), 'strWhere' => "id_user IN ('{$oldId}') AND token IN ('archived')");
break;
case DB_PREFIX . 'conf_users':
'competitor' !== $arrQueryData['user_type'] ? $arrUpdateQuerys[DB_PREFIX . 'vacancy'][] = array('arrData' => array('user_type' => $arrQueryData['user_type']), 'strWhere' => "id_user IN ('" . $arrQueryData['id'] . "')") : null;
break;
default:
break;
}
if (!empty($arrUpdateQuerys)) {
foreach ($arrUpdateQuerys as $keyT => &$valueT) {
foreach ($valueT as &$arrUpdData) {
db::dbUpdateTable($keyT, secure::escQuoteData($arrUpdData['arrData']), $arrUpdData['strWhere']);
}
db::dbUpdateTable($keyT, secure::escQuoteData(array('token' => 'active')), "token IN ('reserved')");
db::dbUpdateTable($keyT, secure::escQuoteData(array('token' => 'archived')), "token IN ('deleted')");
}
}
if (empty($arrDataTable)) {
unset($arrData[$table]);
}
DB_PREFIX . 'conf_users' == $table ? $table = USR_PREFIX . 'users' : null;
if (!empty($arrData)) {
filesys::putSerializedData('core/data/mdsImport.mda', $arrData);
$result = array('onProgress' => true, 'table' => &$table);
} else {
@unlink('core/data/mdsImport.mda');
caching::dropCache();
$result = array('onProgress' => false, 'table' => &$table);
}
return ajax::sdgJSONencode($result);
}
} else {
caching::dropCache();
return ajax::sdgJSONencode(array('onProgress' => false));
}
}
示例3: array
$arrData[$nameConst] = $_POST['valueConst'];
$arrNewData = array();
foreach ($arrData as $constName => &$constValue) {
$arrNewData[] = "define('" . strtoupper($constName) . "', '" . (!empty($constValue) ? $constValue : strtoupper($constName)) . "');";
}
$data = "<?php\n\n" . "(!defined('SDG')) ? die ('Triple protection!') : null;\n\n" . implode("\n\n", $arrNewData) . "\n";
echo file_put_contents($langFile, $data) ? 'success' : 'errConstAdding';
} else {
echo 'errConstLangCustomExsists';
}
} elseif ('delConstLang_custom' == $_GET['do'] && !empty($_POST['nameConst']) && !empty($_POST['currLocaliz'])) {
$langFile = 'core/mods/payments/' . $_GET['modId'] . '/lang/' . $_POST['currLocaliz'] . '/lang._custom.php';
$arrData = localiz::getConstForParsingFile($langFile);
if (isset($arrData[$_POST['nameConst']])) {
unset($arrData[$_POST['nameConst']]);
$arrNewData = array();
foreach ($arrData as $constName => &$constValue) {
$arrNewData[] = "define('" . strtoupper($constName) . "', '" . (!empty($constValue) ? $constValue : strtoupper($constName)) . "');";
}
$data = "<?php\n\n" . "(!defined('SDG')) ? die ('Triple protection!') : null;\n\n" . implode("\n\n", $arrNewData) . "\n";
echo file_put_contents($langFile, $data) ? 'success' : 'errConstDeleting';
} else {
echo 'errConstLangCustomNoExsists';
}
} else {
echo ajax::sdgJSONencode(array('error' => ERROR_FATAL_UNCORRECT_PARAMS));
}
} else {
echo 'Error AJAX-Query!';
}
}
示例4: array
$arrNamePage = array(array('name' => MENU_ADMIN_MAIN, 'link' => CONF_ADMIN_FILE), array('name' => MENU_SYSTEM, 'link' => false), array('name' => MENU_SYSTEM_IMPORT, 'link' => false));
if (!empty($arrActions['mds'])) {
// инициируем "Наименование страницы" отображаемое в форме
$arrNamePage[] = array('name' => MENU_SYSTEM_IMPORT_MDS, 'link' => false);
if (file_exists('core/data/mdsImport.mda')) {
$arrData = filesys::getSerializedData('core/data/mdsImport.mda');
foreach ($arrData as $table => &$arrDataTable) {
if (empty($arrData[USR_PREFIX . 'users']) && DB_PREFIX . 'conf_users' === $table) {
$table = USR_PREFIX . 'users';
} elseif (DB_PREFIX . 'conf_users' === $table) {
continue;
}
$arrResult[] = array('table' => $table, 'size' => USR_PREFIX . 'users' === $table ? count($arrDataTable) * 2 : count($arrDataTable));
}
// передаем данные для отображения прогресса импорта
$smarty->assign('importData', ajax::sdgJSONencode($arrResult));
// включаем страницу отображения прогресса импорта
$smarty->assign('importContinueProgress', true);
// включаем предупреждение
$arrWarnings[] = FORM_SYSTEM_IMPORT_WARNING;
$smarty->assign('warnings', $arrWarnings);
} elseif (isset($_POST['execute'])) {
!validate::postDataNotEmpty() ? $arrErrors[] = ERROR_EMPTY_FORM_FIELDS : null;
//(!import::dbConnect($_POST['dbhost'], $_POST['dbname'], $_POST['dbuser'], '')) ? $arrErrors[] = ERROR_CONNECT_DB : null;
!import::dbConnect($_POST['dbhost'], $_POST['dbname'], $_POST['dbuser'], $_POST['dbpassword']) ? $arrErrors[] = ERROR_CONNECT_DB : null;
if (empty($arrErrors)) {
$arrTables = array('subscription' => &$_POST['table_subscription'], 'vacancy' => &$_POST['table_vacancy'], 'resume' => &$_POST['table_resume'], 'city' => &$_POST['table_city'], 'region' => &$_POST['table_region'], 'profession' => &$_POST['table_profession'], 'section' => &$_POST['table_section'], 'users' => &$_POST['table_users'], 'news' => &$_POST['table_news']);
// передаем данные для отображения прогресса импорта
$smarty->assign('importData', import::mdsImportDB($arrTables));
// включаем страницу отображения прогресса импорта
$smarty->assign('importShowProgress', true);