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


PHP SJB_Request::get方法代码示例

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


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

示例1: execute

 public function execute()
 {
     $tp = SJB_System::getTemplateProcessor();
     $oSubAdmin = SJB_ObjectMother::createSubAdmin($_REQUEST);
     $registration_form = SJB_ObjectMother::createForm($oSubAdmin);
     $registration_form->registerTags($tp);
     $form_submitted = SJB_Request::getVar('action', '') == 'add';
     $errors = array();
     $acl = SJB_SubAdminAcl::getInstance();
     $type = 'subadmin';
     $resources = $acl->getResources();
     SJB_SubAdminAcl::mergePermissionsWithResources($resources);
     switch (SJB_Request::getVar('action')) {
         case 'save':
             if ($registration_form->isDataValid($errors)) {
                 SJB_SubAdminManager::saveSubAdmin($oSubAdmin);
                 $role = $oSubAdmin->getSID();
                 SJB_Acl::clearPermissions($type, $role);
                 foreach ($resources as $name => $resource) {
                     SJB_SubAdminAcl::allow($name, $type, $role, SJB_SubAdminAcl::definePermission($name), SJB_Request::getVar($name . '_params'));
                 }
                 // get new defined permissions for notification letter
                 $permissions = SJB_SubAdminAcl::getAllPermissions($type, $role);
                 $resources = $acl->getResources();
                 SJB_SubAdminAcl::mergePermissionsWithResources($resources, $permissions);
                 SJB_Notifications::sendSubAdminRegistrationLetter($oSubAdmin, SJB_Request::get(), $resources);
                 SJB_HelperFunctions::redirect(SJB_System::getSystemSettings('SITE_URL') . '/manage-subadmins/');
             }
             break;
         case 'delete':
             $subadmins = SJB_Request::getVar('subadmin', array());
             foreach ($subadmins as $subadmin_sid) {
                 $username = SJB_SubAdminManager::getUserNameBySubAdminSID($subadmin_sid);
                 SJB_SubAdminManager::deleteSubAdminByUserName($username);
             }
             SJB_HelperFunctions::redirect(SJB_System::getSystemSettings('SITE_URL') . '/manage-subadmins/');
             break;
         default:
             break;
     }
     $tp->assign('errors', $errors);
     $tp->assign('form_fields', $registration_form->getFormFieldsInfo());
     $aPermissionGroups = SJB_SubAdminAcl::getPermissionGroups();
     if ('save' == SJB_Request::getVar('action', '')) {
         SJB_SubAdminAcl::mergePermissionsWithRequest($resources);
     }
     SJB_SubAdminAcl::prepareSubPermissions($resources);
     $tp->assign('groups', $aPermissionGroups);
     $tp->assign('resources', $resources);
     $tp->assign('type', $type);
     $tp->assign('role', 0);
     $tp->display('add_subadmin.tpl');
 }
开发者ID:Maxlander,项目名称:shixi,代码行数:53,代码来源:add_subadmin.php

示例2: getVar

 public static function getVar($name, $default = null, $hash = 'default', $type = 'none')
 {
     $input = SJB_Request::get($hash);
     if (isset($input[$name])) {
         $var = $input[$name];
         if ($type !== 'none') {
             settype($var, $type);
         }
         return $var;
     }
     return $default;
 }
开发者ID:Maxlander,项目名称:shixi,代码行数:12,代码来源:Request.php

示例3: execute

 public function execute()
 {
     $tp = SJB_System::getTemplateProcessor();
     $errors = array();
     $fatal_errors = array();
     $isDataSubmitted = false;
     try {
         $controller = new SJB_SendListingInfoController($_REQUEST);
     } catch (Exception $e) {
         $controller = false;
     }
     if (empty($controller)) {
         $fatal_errors['LISTING_ID_IS_NOT_NUMERIC'] = $e->getMessage();
     } elseif ($controller->isListingSpecified()) {
         if ($controller->isDataSubmitted()) {
             SJB_Captcha::getInstance($tp, $_REQUEST)->isValid($errors);
             if (!preg_match('^[a-zA-Z0-9\\._-]+@[a-zA-Z0-9\\._-]+\\.[a-zA-Z]{2,}$^', $_REQUEST['friend_email'])) {
                 $errors['NOT_VALID_EMAIL_FORMAT'] = true;
             }
             if (empty($errors)) {
                 $data_to_send = $controller->getData();
                 if (!SJB_Notifications::sendTellFriendLetter($data_to_send)) {
                     $errors['SEND_ERROR'] = true;
                 }
                 $isDataSubmitted = true;
             }
         }
         $tp->assign('listing_info', SJB_ListingManager::createTemplateStructureForListing(SJB_ListingManager::getObjectBySID($controller->getListingID())));
     } else {
         $fatal_errors['UNDEFINED_LISTING_ID'] = true;
     }
     $tp->assign('fatal_errors', $fatal_errors);
     $tp->assign('errors', $errors);
     $tp->assign('info', SJB_Request::get());
     $tp->assign('is_data_submitted', $isDataSubmitted);
     $tp->display('tell_friend.tpl');
 }
开发者ID:Maxlander,项目名称:shixi,代码行数:37,代码来源:tell_friend.php

示例4: execute

 public function execute()
 {
     $tp = SJB_System::getTemplateProcessor();
     $errors = array();
     $template = 'sub_accounts.tpl';
     $currentUserInfo = SJB_UserManager::getCurrentUserInfo();
     $listSubusers = false;
     if (!empty($currentUserInfo['subuser']) && SJB_Request::getVar('action_name') != 'edit' && SJB_Request::getVar('user_id', 0) != $currentUserInfo['subuser']['sid']) {
         $errors['ACCESS_DENIED'] = 'ACCESS_DENIED';
     }
     switch (SJB_Request::getVar('action_name')) {
         case 'new':
             $form_submitted = SJB_Request::getMethod() === SJB_Request::METHOD_POST;
             $user_group_sid = $currentUserInfo['user_group_sid'];
             $user_group_info = SJB_UserGroupManager::getUserGroupInfoBySID($user_group_sid);
             $_REQUEST['user_group_id'] = $user_group_info['id'];
             $user = SJB_ObjectMother::createUser($_REQUEST, $user_group_sid);
             $props = $user->getProperties();
             $allowedProperties = array('username', 'email', 'password');
             foreach ($props as $prop) {
                 if (!in_array($prop->getID(), $allowedProperties)) {
                     $user->deleteProperty($prop->getID());
                 }
             }
             $registration_form = SJB_ObjectMother::createForm($user);
             $registration_form->registerTags($tp);
             if (SJB_UserGroupManager::isUserEmailAsUsernameInUserGroup($user_group_sid) && $form_submitted) {
                 $email = $user->getPropertyValue('email');
                 if (is_array($email)) {
                     $email = $email['original'];
                 }
                 $user->setPropertyValue('username', $email);
             }
             $registration_form = SJB_ObjectMother::createForm($user);
             if ($form_submitted && $registration_form->isDataValid($errors)) {
                 $user->addParentProperty($currentUserInfo['sid']);
                 $subuserPermissions = array('subuser_add_listings' => array('title' => 'Add new listings', 'value' => 'deny'), 'subuser_manage_listings' => array('title' => 'Manage listings and applications of other sub users', 'value' => 'deny'), 'subuser_manage_subscription' => array('title' => 'View and update subscription', 'value' => 'deny'), 'subuser_use_screening_questionnaires' => array('title' => 'Manage Questionnaries', 'value' => 'deny'));
                 SJB_UserManager::saveUser($user);
                 SJB_Statistics::addStatistics('addSubAccount', $user->getUserGroupSID(), $user->getSID());
                 SJB_Acl::clearPermissions('user', $user->getSID());
                 foreach ($subuserPermissions as $permissionID => $permission) {
                     $allowDeny = SJB_Request::getVar($permissionID, 'deny');
                     $subuserPermissions[$permissionID]['value'] = $allowDeny;
                     SJB_Acl::allow($permissionID, 'user', $user->getSID(), $allowDeny);
                 }
                 SJB_UserManager::activateUserByUserName($user->getUserName());
                 SJB_Notifications::sendSubuserRegistrationLetter($user, SJB_Request::get(), $subuserPermissions);
                 $tp->assign('isSubuserRegistered', true);
                 $listSubusers = true;
             } else {
                 if (SJB_UserGroupManager::isUserEmailAsUsernameInUserGroup($user_group_sid)) {
                     $user->deleteProperty("username");
                 }
                 $registration_form = SJB_ObjectMother::createForm($user);
                 if ($form_submitted) {
                     $registration_form->isDataValid($errors);
                 }
                 $registration_form->registerTags($tp);
                 $form_fields = $registration_form->getFormFieldsInfo();
                 $user_group_info = SJB_UserGroupManager::getUserGroupInfoBySID($user_group_sid);
                 $tp->assign("user_group_info", $user_group_info);
                 $tp->assign("errors", $errors);
                 $tp->assign("form_fields", $form_fields);
                 $metaDataProvider = SJB_ObjectMother::getMetaDataProvider();
                 $tp->assign("METADATA", array("form_fields" => $metaDataProvider->getFormFieldsMetadata($form_fields)));
                 $tp->display('subuser_registration_form.tpl');
             }
             break;
         case 'edit':
             $userInfo = SJB_UserManager::getUserInfoBySID(SJB_Request::getVar('user_id', 0));
             if (!empty($userInfo) && $userInfo['parent_sid'] === $currentUserInfo['sid']) {
                 $userInfo = array_merge($userInfo, $_REQUEST);
                 $user_group_info = SJB_UserGroupManager::getUserGroupInfoBySID($currentUserInfo['user_group_sid']);
                 $user = new SJB_User($userInfo, $userInfo['user_group_sid']);
                 $user->setSID($userInfo['sid']);
                 $user->addParentProperty($currentUserInfo['sid']);
                 $props = $user->getProperties();
                 $allowedProperties = array('username', 'email', 'password');
                 foreach ($props as $prop) {
                     if (!in_array($prop->getID(), $allowedProperties)) {
                         $user->deleteProperty($prop->getID());
                     }
                 }
                 $user->makePropertyNotRequired("password");
                 $edit_profile_form = SJB_ObjectMother::createForm($user);
                 $edit_profile_form->registerTags($tp);
                 $edit_profile_form->makeDisabled("username");
                 $form_submitted = SJB_Request::getMethod() == SJB_Request::METHOD_POST;
                 if (empty($errors) && $form_submitted && $edit_profile_form->isDataValid($errors)) {
                     $password_value = $user->getPropertyValue('password');
                     if (empty($password_value['original'])) {
                         $user->deleteProperty('password');
                     }
                     $currentUser = SJB_UserManager::getCurrentUser();
                     if (!$currentUser->isSubuser()) {
                         $subuserPermissions = array('subuser_add_listings', 'subuser_manage_listings', 'subuser_manage_subscription', 'subuser_use_screening_questionnaires');
                         SJB_Acl::clearPermissions('user', $user->getSID());
                         foreach ($subuserPermissions as $permission) {
                             SJB_Acl::allow($permission, 'user', $user->getSID(), SJB_Request::getVar($permission, 'deny'));
                         }
//.........这里部分代码省略.........
开发者ID:Maxlander,项目名称:shixi,代码行数:101,代码来源:sub_accounts.php

示例5: execute

 public function execute()
 {
     $tp = SJB_System::getTemplateProcessor();
     $template = SJB_Request::getVar('input_template', 'input_form.tpl');
     $error = null;
     $listingTypeID = SJB_Request::getVar('listing_type_id', false);
     $passed_parameters_via_uri = SJB_Request::getVar('passed_parameters_via_uri', false);
     $pageID = false;
     if ($passed_parameters_via_uri) {
         $passed_parameters_via_uri = SJB_UrlParamProvider::getParams();
         $listingTypeID = isset($passed_parameters_via_uri[0]) ? $passed_parameters_via_uri[0] : $listingTypeID;
         $pageID = isset($passed_parameters_via_uri[1]) ? $passed_parameters_via_uri[1] : false;
         $listing_id = isset($passed_parameters_via_uri[2]) ? $passed_parameters_via_uri[2] : false;
     }
     if (SJB_UserManager::isUserLoggedIn()) {
         $post_max_size_orig = ini_get('post_max_size');
         $server_content_length = isset($_SERVER['CONTENT_LENGTH']) ? $_SERVER['CONTENT_LENGTH'] : null;
         $fromPreview = SJB_Request::getVar('from-preview', false);
         // get post_max_size in bytes
         $val = trim($post_max_size_orig);
         $tmp = substr($val, strlen($val) - 1);
         $tmp = strtolower($tmp);
         /* if ini value is K - then multiply to 1024
          * if ini value is M - then multiply twice: in case 'm', and case 'k'
          * if ini value is G - then multiply tree times: in 'g', 'm', 'k'
          * out value - in bytes!
          */
         switch ($tmp) {
             case 'g':
                 $val *= 1024;
             case 'm':
                 $val *= 1024;
             case 'k':
                 $val *= 1024;
         }
         $post_max_size = $val;
         $filename = SJB_Request::getVar('filename', false);
         if ($filename) {
             $file = SJB_UploadFileManager::openFile($filename, $listing_id);
             $errors['NO_SUCH_FILE'] = true;
         }
         if (empty($_POST) && $server_content_length > $post_max_size) {
             $errors['MAX_FILE_SIZE_EXCEEDED'] = 1;
             $tp->assign('post_max_size', $post_max_size_orig);
         }
         $listingInfo = SJB_ListingManager::getListingInfoBySID($listing_id);
         $currentUser = SJB_UserManager::getCurrentUser();
         $contractID = $listingInfo['contract_id'];
         if ($contractID == 0) {
             $extraInfo = unserialize($listingInfo['product_info']);
             $productSID = $extraInfo['product_sid'];
         } else {
             $contract = new SJB_Contract(array('contract_id' => $contractID));
             $extraInfo = $contract->extra_info;
         }
         if ($listingInfo['user_sid'] != SJB_UserManager::getCurrentUserSID()) {
             $errors['NOT_OWNER_OF_LISTING'] = $listing_id;
         } else {
             $listing_type_sid = SJB_ListingTypeManager::getListingTypeSIDByID($listingTypeID);
             $pages = SJB_PostingPagesManager::getPagesByListingTypeSID($listing_type_sid);
             if (!$pageID) {
                 $pageID = $pages[0]['page_id'];
             }
             $pageSID = SJB_PostingPagesManager::getPostingPageSIDByID($pageID, $listing_type_sid);
             $isPageLast = SJB_PostingPagesManager::isLastPageByID($pageSID, $listing_type_sid);
             // preview listing
             $isPreviewListingRequested = SJB_Request::getVar('preview_listing', false, 'POST');
             $form_submitted = isset($_REQUEST['action_add']) || isset($_REQUEST['action_add_pictures']) || $isPreviewListingRequested;
             // fill listing from an array of social data if allowed
             $aAutoFillData = array('formSubmitted' => &$form_submitted, 'listingTypeID' => &$listingTypeID);
             SJB_Event::dispatch('SocialSynchronization', $aAutoFillData);
             $listingInfo = array_merge($listingInfo, $_REQUEST);
             $listing = new SJB_Listing($listingInfo, $listing_type_sid, $pageSID);
             if ($fromPreview) {
                 if ($form_submitted) {
                     $properties = $listing->getProperties();
                     foreach ($properties as $fieldID => $property) {
                         switch ($property->getType()) {
                             case 'date':
                                 if (!empty($listing_info[$fieldID])) {
                                     $listingInfo[$fieldID] = SJB_I18N::getInstance()->getDate($listingInfo[$fieldID]);
                                 }
                                 break;
                             case 'complex':
                                 $complex = $property->type->complex;
                                 $complexProperties = $complex->getProperties();
                                 foreach ($complexProperties as $complexfieldID => $complexProperty) {
                                     if ($complexProperty->getType() == 'date') {
                                         $values = $complexProperty->getValue();
                                         foreach ($values as $index => $value) {
                                             if (!empty($listingInfo[$fieldID][$complexfieldID][$index])) {
                                                 $listingInfo[$fieldID][$complexfieldID][$index] = SJB_I18N::getInstance()->getDate($listingInfo[$fieldID][$complexfieldID][$index]);
                                             }
                                         }
                                     }
                                 }
                                 break;
                         }
                     }
                     $listing = new SJB_Listing($listingInfo, $listing_type_sid, $pageSID);
//.........这里部分代码省略.........
开发者ID:Maxlander,项目名称:shixi,代码行数:101,代码来源:add_listing_step.php


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