本文整理汇总了PHP中iaUtil::checkPostParam方法的典型用法代码示例。如果您正苦于以下问题:PHP iaUtil::checkPostParam方法的具体用法?PHP iaUtil::checkPostParam怎么用?PHP iaUtil::checkPostParam使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类iaUtil
的用法示例。
在下文中一共展示了iaUtil::checkPostParam方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _preSaveEntry
protected function _preSaveEntry(array &$entry, array $data, $action)
{
$entry = array('name' => iaUtil::checkPostParam('name'), 'item' => iaUtil::checkPostParam('item'), 'collapsible' => iaUtil::checkPostParam('collapsible'), 'collapsed' => iaUtil::checkPostParam('collapsed'), 'tabview' => iaUtil::checkPostParam('tabview'), 'tabcontainer' => iaUtil::checkPostParam('tabcontainer'));
iaUtil::loadUTF8Functions('ascii', 'bad', 'validation');
if (iaCore::ACTION_ADD == $action) {
if (!utf8_is_ascii($entry['name'])) {
$this->addMessage('ascii_required');
} else {
$entry['name'] = strtolower($entry['name']);
}
if (!$this->getMessages() && !preg_match('/^[a-z0-9\\-_]{2,50}$/', $entry['name'])) {
$this->addMessage('name_is_incorrect');
}
if (empty($data['item'])) {
$this->addMessage('at_least_one_item_should_be_checked');
}
$entry['order'] = $this->_iaDb->getMaxOrder(iaField::getTableGroups()) + 1;
}
foreach ($this->_iaCore->languages as $code => $language) {
if ($data['titles'][$code]) {
if (!utf8_is_valid($data['titles'][$code])) {
$data['titles'][$code] = utf8_bad_replace($data['titles'][$code]);
}
} else {
$this->addMessage($language['title'] . ': ' . iaLanguage::get('title_incorrect'), false);
}
if ($data['description'][$code]) {
if (!utf8_is_valid($data['description'][$code])) {
$data['description'][$code] = utf8_bad_replace($data['description'][$code]);
}
}
}
return !$this->getMessages();
}
示例2: isset
$itemData[iaPlan::SPONSORED_PLAN_ID] = (int) $_POST['plan_id'];
}
if (isset($_POST['username'])) {
if ($iaDb->exists('`username` = :value', array('value' => $_POST['username']), iaUsers::getTable())) {
$error = true;
$messages[] = iaLanguage::get('username_already_exists');
}
}
if (isset($_POST['email'])) {
if ($iaDb->exists('`email` = :value', array('value' => $_POST['email']), iaUsers::getTable())) {
$error = true;
$messages[] = iaLanguage::get('error_duplicate_email');
}
}
if (!$error) {
$itemData['password'] = iaUtil::checkPostParam('password');
$itemData['disable_fields'] = isset($_POST['disable_fields']) ? (int) $_POST['disable_fields'] : 0;
// check password
if (!$itemData['disable_fields']) {
if (!$itemData['password']) {
$error = true;
$messages[] = iaLanguage::get('error_password_empty');
} else {
if ($_POST['password'] != $_POST['password2']) {
$error = true;
$messages[] = iaLanguage::get('error_password_match');
}
}
} else {
$itemData['password'] = '';
}
示例3: _resetPage
private function _resetPage(&$iaView)
{
if (isset($_POST['reset'])) {
if ($options = iaUtil::checkPostParam('options', array())) {
if (in_array(iaUsers::getItemName(), $options)) {
$iaUsers = $this->_iaCore->factory('users');
$currentMember = $this->_iaDb->row(iaDb::ALL_COLUMNS_SELECTION, iaDb::convertIds(iaUsers::getIdentity()->id), iaUsers::getTable());
$this->getHelper()->truncate(iaUsers::getTable());
$this->_iaDb->insert($currentMember, null, iaUsers::getTable());
$options = array_diff($options, array($iaUsers->getItemName()));
}
foreach ($options as $option) {
$this->_iaCore->startHook('phpDbControlBeforeReset', array('option' => $option));
}
$this->addMessage('reset_success');
} else {
$this->_error = true;
$this->addMessage('reset_choose_table');
}
} else {
$iaView->setMessages(iaLanguage::get('reset_backup_alert'), iaView::ALERT);
}
$resetOptions = array('members' => iaLanguage::get('reset') . ' ' . iaLanguage::get('members'));
$this->_iaCore->startHook('phpAdminDatabaseBeforeAll', array('reset_options' => &$resetOptions));
$iaView->assign('options', $resetOptions);
}
示例4: array
// process mandatory hook
$iaCore->startHook('editItemSetSystemDefaults', array('item' => &$ad));
if (isset($_POST['save'])) {
$error = false;
$messages = array();
$errorFields = array();
iaCore::util();
if (!defined('IA_NOUTF')) {
iaUtf8::loadUTF8Core();
iaUtf8::loadUTF8Util('ascii', 'validation', 'bad', 'utf8_to_ascii');
}
$fields = $iaFields->getAllFields(true, '', $iaAd->getItemName());
if ($fields) {
list($data, $error, $messages, $errorFields) = iaField::parsePost($fields, $ad, true);
}
$data['status'] = iaUtil::checkPostParam('status', iaCore::STATUS_ACTIVE);
if (!$error) {
if (iaCore::ACTION_ADD == $pageAction) {
$data['id'] = $iaAd->insert($data);
$messages[] = iaLanguage::get('ad_added');
} else {
$data['id'] = $ad['id'];
$iaAd->update($data);
$messages[] = iaLanguage::get('saved');
}
$ad = $iaAd->getById($data['id']);
$iaView->setMessages($messages, $error ? iaView::ERROR : iaView::SUCCESS);
$goto = array('add' => $baseUrl . 'add/', 'list' => $baseUrl, 'stay' => $baseUrl . 'edit/?id=' . $data['id']);
iaUtil::post_goto($goto);
}
$iaView->setMessages($messages, $error ? iaView::ERROR : iaView::SUCCESS);
示例5: _preSaveEntry
protected function _preSaveEntry(array &$entry, array $data, $action)
{
$entry = array('name' => iaSanitize::alias(iaUtil::checkPostParam('name')), 'item' => iaUtil::checkPostParam('item'), 'default' => iaUtil::checkPostParam('default'), 'lang_values' => iaUtil::checkPostParam('lang_values'), 'text_default' => iaSanitize::html(iaUtil::checkPostParam('text_default')), 'type' => iaUtil::checkPostParam('type'), 'annotation' => iaUtil::checkPostParam('annotation'), 'fieldgroup_id' => (int) iaUtil::checkPostParam('fieldgroup_id'), 'text_length' => (int) iaUtil::checkPostParam('text_length', 255), 'length' => iaUtil::checkPostParam('length', false), 'title' => iaUtil::checkPostParam('title'), 'pages' => iaUtil::checkPostParam('pages', array()), 'required' => iaUtil::checkPostParam('required'), 'use_editor' => (int) iaUtil::checkPostParam('use_editor'), 'empty_field' => iaSanitize::html(iaUtil::checkPostParam('empty_field')), 'url_nofollow' => (int) iaUtil::checkPostParam('url_nofollow'), 'groups' => iaUtil::checkPostParam('groups'), 'searchable' => (int) iaUtil::checkPostParam('searchable'), 'adminonly' => (int) iaUtil::checkPostParam('adminonly'), 'for_plan' => (int) iaUtil::checkPostParam('for_plan'), 'required_checks' => iaUtil::checkPostParam('required_checks'), 'extra_actions' => iaUtil::checkPostParam('extra_actions'), 'link_to' => (int) iaUtil::checkPostParam('link_to'), 'values' => '', 'relation' => iaUtil::checkPostParam('relation', iaField::RELATION_REGULAR), 'parents' => isset($data['parents']) && is_array($data['parents']) ? $data['parents'] : array(), 'children' => isset($data['children']) && is_array($data['children']) ? $data['children'] : array(), 'status' => iaUtil::checkPostParam('status', iaCore::STATUS_ACTIVE));
iaUtil::loadUTF8Functions('ascii', 'validation', 'bad');
if (!$this->_iaDb->exists(iaDb::convertIds($entry['fieldgroup_id']), null, iaField::getTableGroups())) {
$entry['fieldgroup_id'] = 0;
}
foreach ($this->_iaCore->languages as $code => $language) {
if (!empty($entry['annotation'][$code])) {
if (!utf8_is_valid($entry['annotation'][$code])) {
$entry['annotation'][$code] = utf8_bad_replace($entry['annotation'][$code]);
}
}
if (!empty($entry['title'][$code])) {
if (!utf8_is_valid($entry['title'][$code])) {
$entry['title'][$code] = utf8_bad_replace($entry['title'][$code]);
}
} else {
$this->addMessage(iaLanguage::getf('field_is_empty', array('field' => $language['title'] . ' ' . iaLanguage::get('title'))), false);
break;
}
}
if (iaCore::ACTION_ADD == $action) {
$entry['name'] = trim(strtolower(iaSanitize::paranoid($entry['name'])));
if (empty($entry['name'])) {
$this->addMessage('field_name_incorrect');
}
} else {
unset($entry['name']);
}
$fieldTypes = $this->_iaDb->getEnumValues(iaField::getTable(), 'type');
if ($fieldTypes['values'] && !in_array($entry['type'], $fieldTypes['values'])) {
$this->addMessage('field_type_invalid');
} else {
if (!$entry['length']) {
$entry['length'] = iaField::DEFAULT_LENGTH;
}
switch ($entry['type']) {
case iaField::TEXT:
if (empty($entry['text_length'])) {
$entry['text_length'] = 255;
}
$entry['length'] = min(255, max(1, $entry['text_length']));
$entry['default'] = $entry['text_default'];
break;
case iaField::TEXTAREA:
$entry['default'] = '';
break;
case iaField::COMBO:
case iaField::RADIO:
case iaField::CHECKBOX:
if (!empty($data['values']) && is_array($data['values'])) {
$keys = array();
$lang_values = array();
$multiDefault = explode('|', iaUtil::checkPostParam('multiple_default'));
$_keys = iaUtil::checkPostParam('keys');
$_values = iaUtil::checkPostParam('values');
$_langValues = iaUtil::checkPostParam('lang_values');
foreach ($_keys as $index => $key) {
if (trim($key) == '') {
$key = $index + 1;
$_keys[$index] = $key;
}
if (isset($_values[$index]) && trim($_values[$index]) != '') {
$values[$key] = $_values[$index];
$keys[$key] = $key;
} else {
unset($_keys[$index], $_values[$index]);
}
if ($_langValues) {
foreach ($this->_iaCore->languages as $code => $language) {
if ($code != $this->_iaCore->iaView->language) {
if (!isset($_values[$index])) {
unset($_langValues[$code][$index]);
} elseif (!isset($_langValues[$code][$index]) || trim($_langValues[$code][$index]) == '') {
$lang_values[$code][$key] = $values[$key];
} else {
$lang_values[$code][$key] = $_langValues[$code][$index];
}
}
}
}
}
// delete default values if not exists in values
foreach ($multiDefault as $index => $default) {
if (!in_array($default, $values)) {
unset($multiDefault[$index]);
} else {
$k = array_search($default, $values);
$multiDefault[$index] = $k;
}
}
$multiDefault = array_values($multiDefault);
if (iaField::CHECKBOX == $entry['type']) {
$multiDefault = implode(',', $multiDefault);
} elseif (isset($multiDefault[0])) {
// multiple default is available for checkboxes only
$_POST['multiple_default'] = $multiDefault = $multiDefault[0];
} else {
$_POST['multiple_default'] = $multiDefault = '';
//.........这里部分代码省略.........
示例6: array
}*/
}
$iaView->assign($output);
}
if (iaView::REQUEST_HTML == $iaView->getRequestType()) {
if (iaCore::ACTION_EDIT == $pageAction && isset($iaCore->requestPath[0])) {
if (iaCore::ACTION_EDIT == $pageAction && !isset($iaCore->requestPath[0])) {
return iaView::errorPage(iaView::ERROR_NOT_FOUND);
}
iaBreadcrumb::replaceEnd(iaLanguage::get('edit'));
$guestbook = array('status' => iaCore::STATUS_ACTIVE);
if (iaCore::ACTION_EDIT == $pageAction) {
$id = (int) $iaCore->requestPath[0];
$guestbook = $iaDb->row(iaDb::ALL_COLUMNS_SELECTION, iaDb::convertIds($id));
}
$guestbook = array('id' => isset($id) ? $id : 0, 'author_name' => iaUtil::checkPostParam('author_name', $guestbook), 'email' => iaUtil::checkPostParam('email', $guestbook), 'member_id' => iaUtil::checkPostParam('member_id', $guestbook), 'author_url' => iaUtil::checkPostParam('author_url', $guestbook), 'body' => iaUtil::checkPostParam('body', $guestbook), 'status' => iaUtil::checkPostParam('status', $guestbook), 'avatar' => iaUtil::checkPostParam('avatar', $guestbook), 'date' => iaUtil::checkPostParam('date', $guestbook));
if (isset($_POST['save'])) {
iaUtil::loadUTF8Functions('ascii', 'validation', 'bad');
$error = false;
$messages = array();
$guestbook['avatar'] = iaSanitize::html($guestbook['avatar']);
if (utf8_is_valid($guestbook['author_name'])) {
$guestbook['author_name'] = utf8_bad_replace($guestbook['author_name']);
}
if (isset($_FILES['image']['tmp_name']) && $_FILES['image']['tmp_name']) {
$iaPicture = $iaCore->factory('picture');
$info = array('image_width' => 500, 'image_height' => 500, 'thumb_width' => 150, 'thumb_height' => 150, 'resize_mode' => iaPicture::CROP);
if ($image = $iaPicture->processImage($_FILES['image'], '', iaUtil::generateToken(), $info)) {
empty($guestbook['avatar']) || $iaPicture->delete($guestbook['avatar']);
// already has an assigned image
$guestbook['avatar'] = $image;