本文整理汇总了PHP中eZHTTPTool::postVariable方法的典型用法代码示例。如果您正苦于以下问题:PHP eZHTTPTool::postVariable方法的具体用法?PHP eZHTTPTool::postVariable怎么用?PHP eZHTTPTool::postVariable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类eZHTTPTool
的用法示例。
在下文中一共展示了eZHTTPTool::postVariable方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: modifySelection
/**
* Aggiorna la selezione delle tematiche da sincronizzare
* @param eZHTTPTool $http
*/
public function modifySelection($http)
{
if ($http->hasPostVariable('BrowseActionName') && $http->postVariable('BrowseActionName') == 'SelectDestinationNodeID') {
// Scelta del nodo di destinazione
$nodeIDArray = $http->postVariable('SelectedNodeIDArray');
$this->object->setAttribute('destination_node_id', $nodeIDArray[0]);
$this->object->store();
} else {
// Abilitazione e disabilitazione delle tematiche
$tematicheChanged = false;
foreach ($http->attribute('post') as $key => $value) {
$action = explode('_', $key);
if ($action[0] == 'DisableTag') {
if (($_key = array_search($value, $this->getTematiche())) !== false) {
$_tematiche = $this->getTematiche();
unset($_tematiche[$_key]);
$this->object->setAttribute('tags', implode(';', $_tematiche));
}
$tematicheChanged = true;
} else {
if ($action[0] == 'EnableTag') {
$_tematiche = $this->getTematiche();
$_tematiche[] = $value;
$this->object->setAttribute('tags', implode(';', $_tematiche));
$tematicheChanged = true;
}
}
}
if ($tematicheChanged) {
$this->object->store();
}
}
}
示例2: getDateConditions
public static function getDateConditions(eZHTTPTool $http)
{
$start = false;
$end = false;
$days = false;
$condition = null;
$cieINI = eZINI::instance('cie.ini');
$exportUsingDaysCalcualation = $cieINI->variable('CieSettings', 'ExportUsingDaysCalcualation') == 'enabled' ? true : false;
if ($http->hasPostVariable("start_year") && $http->postVariable("start_year") != '') {
$start = mktime(0, 0, 0, (int) $http->postVariable("start_month"), (int) $http->postVariable("start_day"), (int) $http->postVariable("start_year"));
}
if ($http->hasPostVariable("end_year") && $http->postVariable("end_year") != '') {
$end = mktime(23, 59, 59, (int) $http->postVariable("end_month"), (int) $http->postVariable("end_day"), (int) $http->postVariable("end_year"));
}
if ($exportUsingDaysCalcualation && ($start !== false and $end !== false)) {
$days = round(abs($start - $end) / 86400);
}
if ($start !== false and $end !== false) {
$condition = array(false, array($start, $end));
} elseif ($start !== false and $end === false) {
$condition = array('>', $start);
} elseif ($start === false and $end !== false) {
$condition = array('<', $end);
}
return array('conditions' => $condition, 'days' => $days);
}
示例3: validateConfirmation
protected static function validateConfirmation(eZHTTPTool $http, $base, eZContentObjectAttribute $attribute, $isCollection = false)
{
$field = $attributeName = $base . '_attributeconfirmation_' . $attribute->attribute('id');
$value = $http->postVariable($field, null);
if (empty($value)) {
if ((bool) $attribute->attribute('is_required')) {
$attribute->setValidationError(ezpI18n::tr('extension/attributeconfirmation', 'Input required.'));
return eZInputValidator::STATE_INVALID;
} else {
return eZInputValidator::STATE_ACCEPTED;
}
}
$attributeToConfirm = $attribute->attribute('contentclass_attribute')->attribute(self::FIELD_ATTRIBUTE);
$attributeToConfirmValue = null;
$version = $attribute->attribute('object_version');
$dataMap = $version->attribute('data_map');
if ($isCollection) {
if (isset($dataMap[$attributeToConfirm])) {
$attributeID = $dataMap[$attributeToConfirm]->attribute('id');
$fields = array_keys($_POST);
foreach ($fields as $field) {
if (preg_match('/^' . $base . '.*' . $attributeID . '$/i', $field) === 1) {
$attributeToConfirmValue = $http->postVariable($field, null);
break;
}
}
}
} else {
if (isset($dataMap[$attributeToConfirm])) {
$attributeToConfirmValue = $dataMap[$attributeToConfirm]->attribute('content');
}
}
if (empty($attributeToConfirmValue)) {
return eZInputValidator::STATE_ACCEPTED;
}
if ($attributeToConfirmValue != $value) {
$attribute->setValidationError(ezpI18n::tr('extension/attributeconfirmation', 'Input does not match.'));
return eZInputValidator::STATE_INVALID;
}
return eZInputValidator::STATE_ACCEPTED;
}
示例4: fetchObjectAttributeHTTPInput
/**
* Fetches the HTTP POST input and stores it in the data instance
*
* @param eZHTTPTool $http
* @param string $base
* @param eZContentObjectAttribute $contentObjectAttribute
*
* @return bool
*/
function fetchObjectAttributeHTTPInput($http, $base, $contentObjectAttribute)
{
$classList = $http->postVariable($base . self::CLASS_LIST_VARIABLE . $contentObjectAttribute->attribute("id"), array());
$classList = !is_array($classList) ? array() : $classList;
$validClassIdentifiers = array();
foreach ($classList as $classIdentifier) {
if (eZContentClass::exists($classIdentifier, eZContentClass::VERSION_STATUS_DEFINED, false, true)) {
$validClassIdentifiers[] = $classIdentifier;
}
}
if (!empty($validClassIdentifiers)) {
$contentObjectAttribute->setAttribute(self::CLASS_LIST_FIELD, implode(",", $validClassIdentifiers));
} else {
$contentObjectAttribute->setAttribute(self::CLASS_LIST_FIELD, "");
}
return true;
}
示例5: hasPostValue
/**
* Checks if a post variable exitst and has a value
*
* @param eZHTTPTool $http
* @param string $key
* @return bool
*/
protected static function hasPostValue(eZHTTPTool $http, $key, $falseValue = '')
{
return $http->hasPostVariable($key) && $http->postVariable($key) !== $falseValue;
}
示例6: customObjectAttributeHTTPAction
/**
* Executes a custom action for an object attribute which was defined on the web page.
*
* @param eZHTTPTool $http
* @param string $action
* @param eZContentObjectAttribute $contentObjectAttribute
* @param array $parameters
*/
function customObjectAttributeHTTPAction($http, $action, $contentObjectAttribute, $parameters)
{
$params = explode('-', $action);
switch ($params[0]) {
case 'new_zone_layout':
if ($http->hasPostVariable('ContentObjectAttribute_ezpage_zone_allowed_type_' . $contentObjectAttribute->attribute('id'))) {
$zoneMap = array();
if ($http->hasPostVariable('ContentObjectAttribute_ezpage_zone_map')) {
$zoneMap = $http->postVariable('ContentObjectAttribute_ezpage_zone_map');
}
$zoneINI = eZINI::instance('zone.ini');
$page = $contentObjectAttribute->content();
$zoneAllowedType = $http->postVariable('ContentObjectAttribute_ezpage_zone_allowed_type_' . $contentObjectAttribute->attribute('id'));
if ($zoneAllowedType == $page->attribute('zone_layout')) {
return false;
}
$allowedZones = $zoneINI->variable($zoneAllowedType, 'Zones');
$allowedZonesCount = count($allowedZones);
$page->setAttribute('zone_layout', $zoneAllowedType);
$existingZoneCount = $page->getZoneCount();
$zoneCountDiff = 0;
if ($allowedZonesCount < $existingZoneCount) {
$zoneCountDiff = $existingZoneCount - $allowedZonesCount;
}
if (count($zoneMap) > 0) {
foreach ($page->attribute('zones') as $zoneIndex => $zone) {
$zoneMapKey = array_search($zone->attribute('zone_identifier'), $zoneMap);
if ($zoneMapKey) {
$zone->setAttribute('action', 'modify');
$zone->setAttribute('zone_identifier', $zoneMapKey);
} else {
if ($zone->toBeAdded()) {
$page->removeZone($zoneIndex);
} else {
$zone->setAttribute('action', 'remove');
}
}
}
} else {
foreach ($allowedZones as $index => $zoneIdentifier) {
$existingZone = $page->getZone($index);
if ($existingZone instanceof eZPageZone) {
$existingZone->setAttribute('action', 'modify');
$existingZone->setAttribute('zone_identifier', $zoneIdentifier);
} else {
$newZone = $page->addZone(new eZPageZone());
$newZone->setAttribute('id', md5(mt_rand() . microtime() . $page->getZoneCount()));
$newZone->setAttribute('zone_identifier', $zoneIdentifier);
$newZone->setAttribute('action', 'add');
}
}
if ($zoneCountDiff > 0) {
while ($zoneCountDiff != 0) {
$existingZoneIndex = $existingZoneCount - $zoneCountDiff;
$existingZone = $page->getZone($existingZoneIndex);
if ($existingZone->toBeAdded()) {
$page->removeZone($existingZoneIndex);
} else {
$existingZone->setAttribute('action', 'remove');
}
$zoneCountDiff -= 1;
}
}
}
$page->sortZones();
}
break;
case 'set_rotation':
$page = $contentObjectAttribute->content();
$zone = $page->getZone($params[1]);
$block = $zone->getBlock($params[2]);
$rotationValue = $http->postVariable('RotationValue_' . $params[2]);
$rotationUnit = $http->postVariable('RotationUnit_' . $params[2]);
$rotationSuffle = $http->postVariable('RotationShuffle_' . $params[2]);
if ($rotationValue == '') {
$block->setAttribute('rotation', array('interval' => 0, 'type' => 0, 'value' => '', 'unit' => ''));
} else {
switch ($rotationUnit) {
case '2':
$rotationInterval = $rotationValue * 60;
break;
case '3':
$rotationInterval = $rotationValue * 3600;
break;
case '4':
$rotationInterval = $rotationValue * 86400;
default:
break;
}
$rotationType = 1;
if ($rotationSuffle) {
$rotationType = 2;
//.........这里部分代码省略.........
示例7: isDeletingFile
/**
* Checks if current HTTP request is asking for current binary file deletion
* @param eZHTTPTool $http
* @param eZContentObjectAttribute $contentObjectAttribute
* @return bool
*/
private function isDeletingFile( eZHTTPTool $http, eZContentObjectAttribute $contentObjectAttribute )
{
$isDeletingFile = false;
if ( $http->hasPostVariable( 'CustomActionButton' ) )
{
$customActionArray = $http->postVariable( 'CustomActionButton' );
$attributeID = $contentObjectAttribute->attribute( 'id' );
if ( isset( $customActionArray[$attributeID . '_delete_binary'] ) )
{
$isDeletingFile = true;
}
}
return $isDeletingFile;
}
示例8: splitSelected
/**
* Loops over the HTTP post variables with $base_name as the base.
* It examines the HTTP post variable $base_name "_" $cond "_checked"
* which should contain an array of ids. The ids are then matched against
* the objects attribute $cond. If they match the object is moved to the
* $rejects array otherwise the $keepers array.
*
* @param string $base_name
* @param object[] $objects
* @param eZHTTPTool $http
* @param $cond
* @param $keepers
* @param $rejects
* @return boolean
*/
static function splitSelected( $base_name, $objects, eZHTTPTool $http, $cond, &$keepers, &$rejects )
{
$keepers = array();
$rejects = array();
$post_var = $base_name . "_" . $cond . "_checked";
if ( $http->hasPostVariable( $post_var ) )
{
$checks = $http->postVariable( $post_var );
}
else
{
return false;
}
foreach( $objects as $object )
{
if ( $object->hasAttribute( $cond ) )
{
$val = $object->attribute( $cond );
if ( in_array( $val, $checks ) )
{
$rejects[] = $object;
}
else
{
$keepers[] = $object;
}
}
else
{
$keepers[] = $object;
}
}
return true;
}
示例9: fetchCollectionAttributeHTTPInput
/**
* Fetches the HTTP POST input and stores it in the data instance
*
* @param eZInformationCollection $collection
* @param eZInformationCollectionAttribute $collectionAttribute
* @param eZHTTPTool $http
* @param string $base
* @param eZContentObjectAttribute $contentObjectAttribute
*
* @return bool
*/
function fetchCollectionAttributeHTTPInput($collection, $collectionAttribute, $http, $base, $contentObjectAttribute)
{
if ($http->hasPostVariable($base . self::OIB_VARIABLE . $contentObjectAttribute->attribute("id"))) {
$data = trim($http->postVariable($base . self::OIB_VARIABLE . $contentObjectAttribute->attribute("id")));
$collectionAttribute->setAttribute(self::OIB_FIELD, $data);
return true;
}
return false;
}
示例10: fetchClassAttributeHTTPInput
/**
* Fetches class attribute HTTP input and stores it
*
* @param eZHTTPTool $http
* @param string $base
* @param eZContentClassAttribute $attribute
*
* @return bool
*/
public function fetchClassAttributeHTTPInput($http, $base, $attribute)
{
$classAttributeID = $attribute->attribute('id');
$subTreeLimit = (int) $http->postVariable($base . self::SUBTREE_LIMIT_VARIABLE . $classAttributeID, -1);
$maxTags = (int) trim($http->postVariable($base . self::MAX_TAGS_VARIABLE . $classAttributeID, -1));
if ($subTreeLimit < 0 || $maxTags < 0) {
return false;
}
$showDropdown = (int) $http->hasPostVariable($base . self::SHOW_DROPDOWN_VARIABLE . $classAttributeID);
$hideRootTag = (int) $http->hasPostVariable($base . self::HIDE_ROOT_TAG_VARIABLE . $classAttributeID);
$attribute->setAttribute(self::SUBTREE_LIMIT_FIELD, $subTreeLimit);
$attribute->setAttribute(self::SHOW_DROPDOWN_FIELD, $showDropdown);
$attribute->setAttribute(self::HIDE_ROOT_TAG_FIELD, $hideRootTag);
$attribute->setAttribute(self::MAX_TAGS_FIELD, $maxTags);
return true;
}
示例11: validateHTTPInput
/**
* @param eZHTTPTool $http
* @param $base
* @param eZWorkflowEvent $workflowEvent
* @param $validation
*
* @return bool|int
*/
function validateHTTPInput($http, $base, $workflowEvent, &$validation)
{
$returnState = eZInputValidator::STATE_ACCEPTED;
$reason = array();
if (!$http->hasSessionVariable('BrowseParameters')) {
// No validation when deleting to avoid blocking deletion of invalid items
if ($http->hasPostVariable('DeleteApproveUserIDArray_' . $workflowEvent->attribute('id')) || $http->hasPostVariable('DeleteApproveGroupIDArray_' . $workflowEvent->attribute('id'))) {
return eZInputValidator::STATE_ACCEPTED;
}
// check approve-users
$approversIDs = array_unique($this->attributeDecoder($workflowEvent, 'approve_users'));
if (is_array($approversIDs) and count($approversIDs) > 0) {
$returnState = eZApproveType::validateUserIDList($approversIDs, $reason);
} else {
$returnState = false;
}
if ($returnState != eZInputValidator::STATE_INVALID) {
// check approve-groups
$userGroupIDList = array_unique($this->attributeDecoder($workflowEvent, 'approve_groups'));
if (is_array($userGroupIDList) and count($userGroupIDList) > 0) {
$returnState = eZApproveType::validateGroupIDList($userGroupIDList, $reason);
} else {
if ($returnState === false) {
// if no one user or user-group was passed as approvers
$returnState = eZInputValidator::STATE_INVALID;
$reason['text'] = "There must be passed at least one valid user or user group who approves content for the event.";
}
}
// check excluded-users
/*
if ( $returnState != eZInputValidator::STATE_INVALID )
{
// TODO:
// ....
}
*/
// check excluded-groups
if ($returnState != eZInputValidator::STATE_INVALID) {
$userGroupIDList = array_unique($this->attributeDecoder($workflowEvent, 'selected_usergroups'));
if (is_array($userGroupIDList) and count($userGroupIDList) > 0) {
$returnState = eZApproveType::validateGroupIDList($userGroupIDList, $reason);
}
}
}
} else {
$browseParameters = $http->sessionVariable('BrowseParameters');
if (isset($browseParameters['custom_action_data'])) {
$customData = $browseParameters['custom_action_data'];
if (isset($customData['event_id']) and $customData['event_id'] == $workflowEvent->attribute('id')) {
if (!$http->hasPostVariable('BrowseCancelButton') and $http->hasPostVariable('SelectedObjectIDArray')) {
$objectIDArray = $http->postVariable('SelectedObjectIDArray');
if (is_array($objectIDArray) and count($objectIDArray) > 0) {
switch ($customData['browse_action']) {
case "AddApproveUsers":
$returnState = eZApproveType::validateUserIDList($objectIDArray, $reason);
break;
case 'AddApproveGroups':
case 'AddExcludeUser':
$returnState = eZApproveType::validateGroupIDList($objectIDArray, $reason);
break;
case 'AddExcludedGroups':
// TODO:
// .....
break;
}
}
}
}
}
}
if ($returnState == eZInputValidator::STATE_INVALID) {
$validation['processed'] = true;
$validation['events'][] = array('id' => $workflowEvent->attribute('id'), 'placement' => $workflowEvent->attribute('placement'), 'workflow_type' => &$this, 'reason' => $reason);
}
return $returnState;
}
示例12: array
<?php
$Module = $Params['Module'];
$NodeID = $Params['NodeID'];
$node = false;
$tpl = eZTemplate::factory();
$errors = array();
/// @todo send more errors in case node/object does not exist, etc...
if ($node = eZContentObjectTreeNode::fetch($NodeID)) {
if ($Module->currentAction() == 'UpdateRemoteID') {
// test values
$inputObjectName = 'jcremoteid_object';
$inputNodeListName = 'jcremoteid_node_list';
$http = new eZHTTPTool();
$object = $node->attribute('object');
if ($http->hasPostVariable($inputObjectName) && jcRemoteID::isValidObjectRemoteID($http->postVariable($inputObjectName), $object->attribute('id'), $errors)) {
$object->setAttribute('remote_id', $http->postVariable($inputObjectName));
$object->store();
}
if ($http->hasPostVariable($inputNodeListName) && is_array($http->postVariable($inputNodeListName))) {
$remoteIDNodeList = $http->postVariable($inputNodeListName);
foreach ($object->attribute('assigned_nodes') as $node_item) {
$node_item_id = $node_item->attribute('node_id');
if (isset($remoteIDNodeList[$node_item_id]) && jcRemoteID::isValidNodeRemoteID($remoteIDNodeList[$node_item_id], $node_item_id, $errors)) {
$node_item->setAttribute('remote_id', $remoteIDNodeList[$node_item_id]);
$node_item->store();
if ($node_item_id == $NodeID) {
//update $node for template if errors
$node = $node_item;
}
}
示例13: fetchClassAttributeHTTPInput
/**
* Fetches class attribute HTTP input and stores it
*
* @param eZHTTPTool $http
* @param string $base
* @param eZContentClassAttribute $attribute
* @return bool
*/
function fetchClassAttributeHTTPInput($http, $base, $attribute)
{
$maxTagsName = $base . self::MAX_TAGS_VARIABLE . $attribute->attribute('id');
if (!$http->hasPostVariable($maxTagsName) || !is_numeric($http->postVariable($maxTagsName)) && trim($http->postVariable($maxTagsName)) != '') {
return false;
}
$subTreeLimitName = $base . self::SUBTREE_LIMIT_VARIABLE . $attribute->attribute('id');
if (!$http->hasPostVariable($subTreeLimitName) || (int) $http->postVariable($subTreeLimitName) < 0) {
return false;
}
$data = (int) $http->postVariable($subTreeLimitName);
$data2 = 0;
if ($http->hasPostVariable($base . self::SHOW_DROPDOWN_VARIABLE . $attribute->attribute('id'))) {
$data2 = 1;
}
$data3 = 0;
if ($http->hasPostVariable($base . self::HIDE_ROOT_TAG_VARIABLE . $attribute->attribute('id'))) {
$data3 = 1;
}
$data4 = (int) trim($http->postVariable($maxTagsName));
$attribute->setAttribute(self::SUBTREE_LIMIT_FIELD, $data);
$attribute->setAttribute(self::SHOW_DROPDOWN_FIELD, $data2);
$attribute->setAttribute(self::HIDE_ROOT_TAG_FIELD, $data3);
$attribute->setAttribute(self::MAX_TAGS_FIELD, $data4 < 0 ? 0 : $data4);
return true;
}
示例14: fetchHttpInput
/**
* @param eZHTTPTool $http
* @param eZModule $module
* @return void
*/
function fetchHttpInput($http, $module)
{
if ($http->hasPostVariable('RemoveRule_' . self::NOTIFICATION_HANDLER_ID)) {
$user = eZUser::currentUser();
$listID = array();
$userList = ITNewsletterNotificationRule::fetchList($user->attribute('contentobject_id'), false);
foreach ($userList as $userRow) {
$listID[] = $userRow['id'];
}
$ruleIDList = $http->postVariable('RemoveRule_' . self::NOTIFICATION_HANDLER_ID);
foreach ($ruleIDList as $ruleID) {
if (in_array($ruleID, $listID)) {
eZPersistentObject::removeObject(ITNewsletterNotificationRule::definition(), array('id' => $ruleID));
}
}
} else {
if ($http->hasPostVariable('SaveRule_' . self::NOTIFICATION_HANDLER_ID)) {
$tagID = $http->postVariable('SaveRule_' . self::NOTIFICATION_HANDLER_ID);
$user = eZUser::currentUser();
$existingTags = ITNewsletterNotificationRule::fetchTagsForUserID($user->attribute('contentobject_id'), false);
if (!in_array($tagID, $existingTags)) {
$rule = ITNewsletterNotificationRule::create($tagID, $user->attribute('contentobject_id'));
$rule->store();
}
}
}
}
示例15: fetchClassAttributeHTTPInput
/**
* Fetches class attribute HTTP input and stores it
*
* @param eZHTTPTool $http
* @param string $base
* @param eZContentClassAttribute $attribute
*
* @return bool
*/
function fetchClassAttributeHTTPInput($http, $base, $attribute)
{
$base;
// Just for phpcs
if ($http->hasPostVariable("ContentClass_novaseometas_keyvalue_{$attribute->attribute('id')}")) {
$metasKv = $http->postVariable("ContentClass_novaseometas_keyvalue_{$attribute->attribute('id')}");
$attribute->setContent($metasKv);
}
return true;
}