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


PHP SJB_UserManager::getCurrentUserInfo方法代码示例

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


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

示例1: add_comment

 private function add_comment()
 {
     if (!SJB_UserManager::isUserLoggedIn()) {
         exit;
     }
     $last = 1;
     $message = SJB_Request::getVar('message', '', SJB_Request::METHOD_POST);
     $listing_id = SJB_Request::getInt('listing', 0, SJB_Request::METHOD_POST);
     $template_processor = SJB_System::getTemplateProcessor();
     $user_info = SJB_UserManager::getCurrentUserInfo();
     $comment = new SJB_Comment(array_merge(array('message' => $message), array('user_id' => $user_info['sid'])), $listing_id);
     /** @var SJB_ObjectProperty $property */
     foreach ($comment->getProperties() as $property) {
         $validation = $property->isValid();
         if (true !== $validation) {
             $validation = 'COMMENT_' . $validation;
             $template_processor->assign('ERRORS', array($validation => true));
             $template_processor->display('../classifieds/error.tpl');
             exit;
         }
     }
     SJB_CommentManager::saveComment($comment);
     $comment_array = array('id' => $comment->getSID(), 'message' => htmlentities($message, ENT_QUOTES, "UTF-8"), 'user' => array('email' => $user_info['email'], 'username' => $user_info['username']), 'added' => date('d.m.Y H:M'));
     $template_processor->assign('iteration_last', $last);
     $template_processor->assign('comment', $comment_array);
     $template_processor->display('../classifieds/listing_comments_item.tpl');
 }
开发者ID:Maxlander,项目名称:shixi,代码行数:27,代码来源:ajax.php

示例2: canRate

 public static function canRate($listing_sid, $title = false)
 {
     if (SJB_UserManager::isUserLoggedIn()) {
         $user_info = SJB_UserManager::getCurrentUserInfo();
         $user_id = $user_info['sid'];
     } else {
         if ($title) {
             self::$title = 3;
         }
         //'Please sign in to vote ';
         return false;
     }
     $result = SJB_DB::query("SELECT vote FROM `rating` WHERE `user_id` = {$user_id} AND listing_id = ?n ", $listing_sid);
     if (count($result) == 0) {
         if ($title) {
             self::$title = 1;
         }
         //'Please, Vote!';
         return true;
     }
     if ($title) {
         self::$title = 2;
     }
     //"You've already voted";
     return false;
 }
开发者ID:Maxlander,项目名称:shixi,代码行数:26,代码来源:Rating.php

示例3: execute

 public function execute()
 {
     $tp = SJB_System::getTemplateProcessor();
     $errors = array();
     $listingSID = SJB_Request::getVar('listing_id', false);
     if ($listingSID == false) {
         $errors['UNDEFINED_LISTING_ID'] = 1;
     } else {
         $queryParams = '';
         $userInfo = SJB_UserManager::getCurrentUserInfo();
         // if logged user
         if (!empty($userInfo)) {
             $firstName = !empty($userInfo['FirstName']) ? $userInfo['FirstName'] : false;
             $lastName = !empty($userInfo['LastName']) ? $userInfo['LastName'] : false;
             $town = !empty($userInfo['City']) ? $userInfo['City'] : false;
             $postCode = !empty($userInfo['ZipCode']) ? $userInfo['ZipCode'] : false;
             $email = !empty($userInfo['email']) ? $userInfo['email'] : false;
             $phone = !empty($userInfo['PhoneNumber']) ? $userInfo['PhoneNumber'] : false;
             // Optional prefilled params for apply for JogG8
             //	  * Title
             //    * FirstName
             //    * LastName
             //    * Town
             //    * PostCode
             //    * HomeTelephone
             //    * WorkTelephone
             //    * Mobile
             //    * Email
             //    * ContactedPreviously
             if ($firstName) {
                 $queryParams .= '&FirstName=' . urlencode($firstName);
             }
             if ($lastName) {
                 $queryParams .= '&LastName=' . urlencode($lastName);
             }
             if ($town) {
                 $queryParams .= '&Town=' . urlencode($town);
             }
             if ($postCode) {
                 $queryParams .= '&PostCode=' . urlencode($postCode);
             }
             if ($phone) {
                 $queryParams .= '&Mobile=' . urlencode($phone);
             }
             if ($email) {
                 $queryParams .= '&Email=' . urlencode($email);
             }
         }
         $listing = SJB_ListingManager::getObjectBySID($listingSID);
         if (!$listing) {
             $errors['WRONG_LISTING_ID_SPECIFIED'] = 1;
         } else {
             $applicationSettings = $listing->getPropertyValue('ApplicationSettings');
             $tp->assign('applicationURL', $applicationSettings['value'] . $queryParams);
         }
     }
     $tp->assign('errors', $errors);
     $tp->display("apply_now_jobg8.tpl");
 }
开发者ID:Maxlander,项目名称:shixi,代码行数:59,代码来源:apply_now_jobg8.php

示例4: execute

 public function execute()
 {
     $user_info = SJB_UserManager::getCurrentUserInfo();
     $field_id = isset($_REQUEST['field_id']) ? $_REQUEST['field_id'] : null;
     if (is_null($field_id)) {
         $errors['PARAMETERS_MISSED'] = 1;
     } elseif (!isset($user_info[$field_id])) {
         $errors['WRONG_PARAMETERS_SPECIFIED'] = 1;
     } else {
         $uploaded_file_id = $user_info[$field_id];
         SJB_UploadFileManager::deleteUploadedFileByID($uploaded_file_id);
         $user_info[$field_id] = "";
         $user_info['email'] = array('original' => $user_info['email']);
         $user = new SJB_User($user_info, $user_info['user_group_sid']);
         $user->deleteProperty("active");
         $user->deleteProperty('password');
         $user->setSID(SJB_UserManager::getCurrentUserSID());
         SJB_UserManager::saveUser($user);
     }
     $template_processor = SJB_System::getTemplateProcessor();
     $template_processor->assign("errors", isset($errors) ? $errors : null);
     $template_processor->display("delete_uploaded_file.tpl");
 }
开发者ID:Maxlander,项目名称:shixi,代码行数:23,代码来源:delete_uploaded_file.php

示例5: execute

 public function execute()
 {
     $tp = SJB_System::getTemplateProcessor();
     $errors = array();
     $gatewayId = SJB_Request::getVar('gatewayId', 'cash_gateway');
     $gateway = SJB_PaymentGatewayManager::getObjectByID($gatewayId);
     if (isset($gateway) && in_array($gatewayId, array('cash_gateway', 'wire_transfer'))) {
         $invoiceSid = SJB_Request::getVar('invoice_sid');
         $invoice = SJB_InvoiceManager::getObjectBySID($invoiceSid);
         if (isset($invoice)) {
             $currentUser = SJB_UserManager::getCurrentUserInfo();
             if ($currentUser['sid'] == $invoice->getPropertyValue('user_sid')) {
                 if ($invoice->getStatus() == SJB_Invoice::INVOICE_STATUS_UNPAID) {
                     $tp->assign('invoice_sid', $invoiceSid);
                     $tp->assign('item_name', $invoice->getProductNames());
                     $tp->assign('amount', $invoice->getPropertyValue('total'));
                     $tp->assign('user', $currentUser);
                     SJB_InvoiceManager::saveInvoice($invoice);
                     SJB_ShoppingCart::deleteItemsFromCartByUserSID($currentUser['sid']);
                 } else {
                     $errors['INVOICE_IS_NOT_UNPAID'] = true;
                 }
             } else {
                 $errors['NOT_OWNER'] = true;
             }
         } else {
             $errors['INVALID_INVOICE_ID'] = true;
         }
         $template = $gateway->getTemplate();
         $tp->assign('errors', $errors);
     } else {
         $errors['INVALID_GATEWAY'] = true;
         $tp->assign('ERRORS', $errors);
         $template = 'errors.tpl';
     }
     $tp->display($template);
 }
开发者ID:Maxlander,项目名称:shixi,代码行数:37,代码来源:cash_payment_page.php

示例6: execute

 public function execute()
 {
     $errors = array();
     $field_errors = array();
     $tp = SJB_System::getTemplateProcessor();
     $loggedIn = SJB_UserManager::isUserLoggedIn();
     $current_user_sid = SJB_UserManager::getCurrentUserSID();
     $controller = new SJB_SendListingInfoController($_REQUEST);
     $isDataSubmitted = false;
     $jobInfo = SJB_ListingManager::getListingInfoBySID($controller->getListingID());
     if ($controller->isListingSpecified()) {
         if ($controller->isDataSubmitted()) {
             if (SJB_Captcha::getInstance($tp, $_REQUEST)->isValid($errors)) {
                 // получим уникальный id для файла в uploaded_files
                 $file_id_current = 'application_' . md5(microtime());
                 $upload_manager = new SJB_UploadFileManager();
                 $upload_manager->setFileGroup('files');
                 $upload_manager->setUploadedFileID($file_id_current);
                 $file_name = $upload_manager->uploadFile('file_tmp');
                 $id_file = $upload_manager->fileId;
                 $post = $controller->getData();
                 $listingId = 0;
                 $post['submitted_data']['questionnaire'] = '';
                 if (isset($post['submitted_data']['id_resume'])) {
                     $listingId = $post['submitted_data']['id_resume'];
                 }
                 $mimeType = isset($_FILES['file_tmp']['type']) ? $_FILES['file_tmp']['type'] : '';
                 if (isset($_FILES['file_tmp']['size']) && $file_name != '' && $_FILES['file_tmp']['size'] == 0) {
                     $errors['FILE_IS_EMPTY'] = 'The uploaded file should not be blank';
                 }
                 if (!empty($_FILES['file_tmp']['name'])) {
                     $fileFormats = explode(',', SJB_System::getSettingByName('file_valid_types'));
                     $fileInfo = pathinfo($_FILES['file_tmp']['name']);
                     if (!isset($fileInfo['extension']) || !in_array(strtolower($fileInfo['extension']), $fileFormats)) {
                         $errors['NOT_SUPPORTED_FILE_FORMAT'] = strtolower($fileInfo['extension']) . ' ' . SJB_I18N::getInstance()->gettext(null, 'is not in an acceptable file format');
                     }
                 }
                 if ($file_name == '' && $listingId == 0) {
                     $canAppplyWithoutResume = false;
                     SJB_Event::dispatch('CanApplyWithoutResume', $canAppplyWithoutResume);
                     if (!$canAppplyWithoutResume) {
                         $errors['APPLY_INPUT_ERROR'] = 'Please select file or resume';
                     }
                 } else {
                     if (SJB_Applications::isApplied($post['submitted_data']['listing_id'], $current_user_sid) && !is_null($current_user_sid)) {
                         $errors['APPLY_APPLIED_ERROR'] = 'You already applied';
                     }
                 }
                 $res = false;
                 $listing_info = '';
                 $notRegisterUserData = $_POST;
                 $score = 0;
                 // для зарегестрированного пользователя получим поля email и name
                 // для незарегестрированных - поля name и email приходят с формы
                 if ($loggedIn === true) {
                     $userData = SJB_UserManager::getCurrentUserInfo();
                     $post['submitted_data']['username'] = isset($userData['username']) ? $userData['username'] : '';
                     $post['submitted_data']['LastName'] = isset($userData['LastName']) ? $userData['LastName'] : '';
                     $post['submitted_data']['FirstName'] = isset($userData['FirstName']) ? $userData['FirstName'] : '';
                     $post['submitted_data']['name'] = $post['submitted_data']['FirstName'] . ' ' . $post['submitted_data']['LastName'];
                     $post['submitted_data']['email'] = $userData['email'];
                 }
                 if (!empty($jobInfo['screening_questionnaire'])) {
                     $questions = new SJB_Questions($_REQUEST, $jobInfo['screening_questionnaire']);
                     $add_form = new SJB_Form($questions);
                     $add_form->registerTags($tp);
                     $add_form->isDataValid($field_errors);
                     $tp->assign('field_errors', $field_errors);
                     if (!$field_errors) {
                         $result = array();
                         $properties = $questions->getProperties();
                         $countAnswers = 0;
                         foreach ($properties as $key => $val) {
                             if ($val->type->property_info['type'] == 'boolean') {
                                 switch ($val->value) {
                                     case 0:
                                         $val->value = 'No';
                                         break;
                                     case 1:
                                         $val->value = 'Yes';
                                         break;
                                 }
                             }
                             $result[$val->caption] = $val->value;
                             if (isset($val->type->property_info['list_values'])) {
                                 foreach ($val->type->property_info['list_values'] as $list_values) {
                                     if (is_array($val->value)) {
                                         foreach ($val->value as $value) {
                                             if ($value == $list_values['id'] && $list_values['score'] != 'no') {
                                                 $score += $list_values['score'];
                                                 $countAnswers++;
                                             }
                                         }
                                     } else {
                                         if ($val->value == $list_values['id'] && $list_values['score'] != 'no') {
                                             $score += $list_values['score'];
                                             $countAnswers++;
                                         }
                                     }
                                 }
//.........这里部分代码省略.........
开发者ID:Maxlander,项目名称:shixi,代码行数:101,代码来源:apply_now.php

示例7: 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

示例8: isCurrentUserJustRegistered

 /**
  * Checks if current user registered in 1 hour period ago
  * @static
  * @return bool
  */
 public static function isCurrentUserJustRegistered()
 {
     $userInfo = SJB_UserManager::getCurrentUserInfo();
     if (empty($userInfo)) {
         return false;
     }
     $userRegistrationTime = !empty($userInfo['registration_date']) ? $userInfo['registration_date'] : '';
     if ($userRegistrationTime) {
         $userRegistrationTime = new DateTime($userRegistrationTime);
         $currentTime = new DateTime(date('Y-m-d H:i:s'));
         $userRegistrationTime->format('Y-m-d H:i:s');
         $currentTime->format('Y-m-d H:i:s');
         $interval = $userRegistrationTime->diff($currentTime);
         $interval = $interval->format('%h');
         if ($interval > 0) {
             return false;
         } else {
             return true;
         }
     }
     return false;
 }
开发者ID:Maxlander,项目名称:shixi,代码行数:27,代码来源:UserManager.php

示例9: execute


//.........这里部分代码省略.........
     if ($orderInfo['sorting_field'] == 'applications') {
         $innerJoin['applications'] = array('count' => 'count(`applications`.id) as appCount', 'join' => 'LEFT JOIN', 'join_field' => 'listing_id', 'join_field2' => 'sid', 'main_table' => 'listings');
         $sortingFields['appCount'] = $orderInfo['sorting_order'];
         $searcher->setGroupByField(array('listings' => 'sid'));
     } else {
         if ($orderInfo['sorting_field'] == 'id') {
             $sortingFields['sid'] = $orderInfo['sorting_order'];
         } else {
             if ($orderInfo['sorting_field'] == 'subuser_sid') {
                 $innerJoin['users'] = array('join' => 'LEFT JOIN', 'join_field' => 'sid', 'join_field2' => 'subuser_sid', 'main_table' => 'listings');
                 $sortingFields['username'] = $orderInfo['sorting_order'];
             } else {
                 $property = $listing->getProperty($sortingField);
                 if (!empty($property) && $property->isSystem()) {
                     $sortingFields[$orderInfo['sorting_field']] = $orderInfo['sorting_order'];
                 } else {
                     $sortingFields['activation_date'] = 'DESC';
                 }
             }
         }
     }
     $this->requestCriteria['sorting_field'] = $orderInfo['sorting_field'];
     $this->requestCriteria['sorting_order'] = $orderInfo['sorting_order'];
     $criteria = SJB_SearchFormBuilder::extractCriteriaFromRequestData(array_merge($_REQUEST, $this->requestCriteria), $listing);
     $aliases = new SJB_PropertyAliases();
     $aliases->addAlias($idAliasInfo);
     $aliases->addAlias($listingTypeIdAliasInfo);
     $foundListingsSIDs = $searcher->getObjectsSIDsByCriteria($criteria, $aliases, $sortingFields, $innerJoin);
     $searchFormBuilder = new SJB_SearchFormBuilder($listing);
     $searchFormBuilder->registerTags($tp);
     $searchFormBuilder->setCriteria($criteria);
     // получим информацию о имеющихся листингах
     $listingsInfo = array();
     $currentUserInfo = SJB_UserManager::getCurrentUserInfo();
     $contractInfo['extra_info']['listing_amount'] = 0;
     if ($acl->isAllowed('post_' . $this->listingTypeID)) {
         $permissionParam = $acl->getPermissionParams('post_' . $this->listingTypeID);
         if (empty($permissionParam)) {
             $contractInfo['extra_info']['listing_amount'] = 'unlimited';
         } else {
             $contractInfo['extra_info']['listing_amount'] = $permissionParam;
         }
     }
     $currentUser = SJB_UserManager::getCurrentUser();
     $contractsSIDs = $currentUser->getContractID();
     $listingsInfo['listingsNum'] = SJB_ContractManager::getListingsNumberByContractSIDsListingType($contractsSIDs, $this->listingTypeID);
     $listingsInfo['listingsMax'] = $contractInfo['extra_info']['listing_amount'];
     if ($listingsInfo['listingsMax'] === 'unlimited') {
         $listingsInfo['listingsLeft'] = 'unlimited';
     } else {
         $listingsInfo['listingsLeft'] = $listingsInfo['listingsMax'] - $listingsInfo['listingsNum'];
         $listingsInfo['listingsLeft'] = $listingsInfo['listingsLeft'] < 0 ? 0 : $listingsInfo['listingsLeft'];
     }
     $tp->assign('listingTypeID', $this->listingTypeID);
     $tp->assign('listingTypeName', SJB_ListingTypeManager::getListingTypeNameBySID($this->listingTypeSID));
     $tp->assign('listingsInfo', $listingsInfo);
     $tp->display('my_listings_form.tpl');
     $page = SJB_Request::getVar('page', 1);
     $listingsPerPage = $criteriaSaver->getListingsPerPage();
     //save 'listings per page' in the session
     if (empty($listingsPerPage)) {
         $listingsPerPage = 10;
     }
     $listingsPerPage = SJB_Request::getVar('listings_per_page', $listingsPerPage);
     $criteriaSaver->setSessionForListingsPerPage($listingsPerPage);
     $criteriaSaver->setSessionForCurrentPage($page);
开发者ID:Maxlander,项目名称:shixi,代码行数:67,代码来源:my_listings.php

示例10: execute

 public function execute()
 {
     /***************************************************
      * Integration of JobSource Jobg8 script
      *
      * This script integrate P4P of JobG8
      ***************************************************/
     /*
     For example in SJB there is a user "emp", с user_id = 8, emal = emp@emp.com, username = EMPjob
     Are we correct to assume that the encryption parameters will be as follows:
     
     ADHOC is ON:
     ?cid=810388&a=ADHOC&email=emp@emp.com&adv=EMPjob
     
     ADHOC is OFF:
     ?cid=810388&a=8&email=emp@emp.com&adv=EMPjob
     */
     $tp = SJB_System::getTemplateProcessor();
     if (SJB_UserManager::isUserLoggedIn()) {
         $currentUser = SJB_UserManager::getCurrentUserInfo();
         $currentUsername = $currentUser['username'];
         $userEmail = $currentUser['email'];
         $username = $currentUser['CompanyName'];
         if (empty($username)) {
             $username = $currentUser['username'];
         }
         // our jobg8 Job Board ID
         $jobboardID = SJB_Settings::getSettingByName('jobg8_jobboard_id_p4p');
         $jobg8_p4p_url = SJB_Settings::getSettingByName('jobg8_p4p_url');
         $cid = SJB_Settings::getSettingByName('jobg8_cid');
         $markup = '';
         $mode = '';
         // check current user for individual markup value
         $result = SJB_DB::query("SELECT * FROM `users_markup` WHERE `user_sid` = ?n", $currentUser['sid']);
         if (!empty($result)) {
             $markup = $result[0]['markup'];
         }
         // check individual adhoc mode
         if ($currentUser['jobg8_adhoc'] == 1) {
             $adhoc_mode = true;
         } else {
             $adhoc_mode = false;
         }
         // look jobg8 p4p-integration doc (parameter 'a')
         if ($adhoc_mode) {
             $mode = 'ADHOC';
         } else {
             $mode = $currentUser['sid'];
         }
         //////////////////////////////////
         // set region field for P4P
         // check tax countries and states list
         //////////////////////////////////
         $taxRegions = array('Canada' => array("Alberta" => "AB", "British Columbia" => "BC", "Manitoba" => "MB", "New Brunswick" => "NB", "Newfoundland and Labrador" => "NL", "Nova Scotia" => "NS", "Northwest Territories" => "NT", "Nunavut" => "NU", "Ontario" => "ON", "Prince Edward Island" => "PE", "Quebec" => "QC", "Saskatchewan" => "SK", "Yukon" => "YT"), 'Germany' => 'DEU', 'Spain' => 'ESP', 'Ireland' => 'IRL');
         // check country
         $taxRegionCode = '';
         $userCountry = $currentUser['Country'];
         $userState = $currentUser['State'];
         if (!empty($userCountry) && !empty($userState) && array_key_exists($userCountry, $taxRegions)) {
             if (isset($taxRegions[$userCountry]) && is_string($taxRegions[$userCountry])) {
                 $taxRegionCode = $taxRegions[$userCountry];
             } elseif (isset($taxRegions[$userCountry]) && is_array($taxRegions[$userCountry]) && array_key_exists($userState, $taxRegions[$userCountry])) {
                 // check region
                 $taxRegionCode = $taxRegions[$userCountry][$userState];
             }
         }
         if ($markup == '' || !is_numeric($markup)) {
             if ($mode == 'ADHOC') {
                 $message = "?cid={$cid}&a={$mode}&email={$userEmail}&adv={$username}&region={$taxRegionCode}";
             } else {
                 $message = "?cid={$cid}&a={$mode}&region={$taxRegionCode}";
             }
         } else {
             if ($mode == 'ADHOC') {
                 $message = "?cid={$cid}&a={$mode}&email={$userEmail}&adv={$username}&m={$markup}&region={$taxRegionCode}";
             } else {
                 $message = "?cid={$cid}&a={$mode}&m={$markup}&region={$taxRegionCode}";
             }
         }
         // use RSA library for crypt
         $sshKey = JobG8IntegrationPlugin::getRsaKey();
         $keyArray = explode(' ', $sshKey, 3);
         $keyLength = $keyArray[0];
         $exponent = $keyArray[1];
         $modulus = $keyArray[2];
         // Encrypt the message
         $encryptedData = rsa_encrypt($message, $exponent, $modulus, $keyLength);
         // Base64 encode the encrypted data
         $output = urlencode(base64_encode($encryptedData));
         $tp->assign('jobg8_p4p_url', $jobg8_p4p_url);
         $tp->assign('jobboardID', $jobboardID);
         $tp->assign('encoded_data', $output);
         $tp->display('jobg8_p4p.tpl');
     } else {
         $tp->assign("return_url", base64_encode(SJB_Navigator::getURIThis()));
         //$tp->assign("ajaxRelocate", true);
         $tp->display("../users/login.tpl");
     }
 }
开发者ID:Maxlander,项目名称:shixi,代码行数:99,代码来源:jobg8_p4p.php

示例11: execute


//.........这里部分代码省略.........
                 $_REQUEST['listing_type_id'] = $this->listingTypeID;
             }
         }
         if (empty($listingInfo)) {
             $listingSID = null;
             SJB_Session::unsetValue('preview_listing_sid_for_add');
         }
     } else {
         $listingSID = null;
         SJB_Session::unsetValue('preview_listing_sid_for_add');
     }
     /*
      * <<<<< for listing preview
      */
     // 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) {
         $listing_id = SJB_Request::getVar('listing_id', '', 'default', 'int');
         $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;
         $listing_id = SJB_Request::getVar('listing_id', null, 'GET', 'int');
         $this->tp->assign('post_max_size', $post_max_size_orig);
     }
     $tmpListingIDFromRequest = SJB_Request::getVar('listing_id', false, 'default', 'int');
     if (!empty($tmpListingIDFromRequest)) {
         $tmpListingSID = $tmpListingIDFromRequest;
     } elseif (!$tmpListingIDFromRequest) {
         $tmpListingSID = time();
     }
     $this->buttonPressedPostToProceed = SJB_Request::getVar('proceed_to_posting');
     if (SJB_UserManager::isUserLoggedIn()) {
         SJB_Session::unsetValue('proceed_to_posting');
         SJB_Session::unsetValue('productSID');
         SJB_Session::unsetValue('listing_type_id');
         if (!is_null($this->buttonPressedPostToProceed)) {
             $productSID = SJB_Request::getVar('productSID', false, 'default', 'int');
             $productInfo = SJB_ProductsManager::getProductInfoBySID($productSID);
             $userInfo = SJB_UserManager::getCurrentUserInfo();
             if ($userInfo['user_group_sid'] == $productInfo['user_group_sid']) {
                 $this->tp->assign('productSID', $productSID);
                 $this->tp->assign('proceed_to_posting', $productSID);
                 $this->tp->assign("listing_id", $tmpListingSID);
                 $this->addListing($listingSID, 0, $productSID);
             } else {
                 $this->displayErrorTpl('DO_NOT_MATCH_POST_THIS_TYPE_LISTING');
             }
         } else {
             if ($productsInfo = SJB_ListingManager::canCurrentUserAddListing($error, $this->listingTypeID)) {
                 if ($contractID = SJB_Request::getVar('contract_id', false, 'POST')) {
                     $this->tp->assign("listing_id", $tmpListingSID);
                     $this->addListing($listingSID, $contractID, false);
                 } elseif (count($productsInfo) == 1) {
                     $productInfo = array_pop($productsInfo);
                     $contractID = $productInfo['contract_id'];
                     $this->tp->assign("listing_id", $tmpListingSID);
                     $this->addListing($listingSID, $contractID, false);
                 } else {
                     $this->tp->assign('listing_id', $tmpListingSID);
                     $this->tp->assign('products_info', $productsInfo);
                     $this->tp->assign('listingTypeID', $this->listingTypeID);
                     $this->tp->display('listing_product_choice.tpl');
                 }
             } else {
                 if ($error == 'NO_CONTRACT') {
                     SJB_HelperFunctions::redirect(SJB_System::getSystemSettings('SITE_URL') . '/products/?postingProductsOnly=1&page=');
                 }
                 $this->displayErrorTpl($error);
             }
         }
     } else {
         if ($this->buttonPressedPostToProceed != false) {
             SJB_Session::setValue('proceed_to_posting', true);
             SJB_Session::setValue('productSID', SJB_Request::getVar('productSID', '', 'default', 'int'));
             SJB_Session::setValue('listing_type_id', $this->listingTypeID);
         }
         $this->displayErrorTpl('NOT_LOGGED_IN');
     }
 }
开发者ID:Maxlander,项目名称:shixi,代码行数:101,代码来源:add_listing.php

示例12: execute

 public function execute()
 {
     $tp = SJB_System::getTemplateProcessor();
     $isAlert = $enableNotify = isset($_REQUEST["alert"]);
     $tp->assign('is_alert', $isAlert);
     if (SJB_UserManager::isUserLoggedIn()) {
         $cu = SJB_UserManager::getCurrentUser();
         if ($cu->isSubuser()) {
             $current_user_info = $cu->getSubuserInfo();
         } else {
             $current_user_info = SJB_UserManager::getCurrentUserInfo();
         }
         $criteria_saver = new SJB_ListingCriteriaSaver(SJB_Request::getVar("searchId", ""));
         $requested_data = $criteria_saver->getCriteria();
         if (isset($requested_data['listing_type'])) {
             $current_listing_type = array_pop($requested_data['listing_type']);
         } else {
             $current_listing_type = '';
             if (isset($requested_data['listing_type_sid'])) {
                 $listing_type_sid = array_pop($requested_data['listing_type_sid']);
                 $current_listing_type = SJB_ListingTypeManager::getListingTypeIDBySID($listing_type_sid);
             }
         }
         $errors = array();
         if (!$isAlert && !SJB_Acl::getInstance()->isAllowed('save_searches')) {
             $errors[] = "DENIED_SAVE_JOB_SEARCH";
         } elseif ($isAlert && !SJB_Acl::getInstance()->isAllowed('use_' . trim($current_listing_type) . '_alerts')) {
             $errors[] = "DENIED_SAVE_JOB_SEARCH";
         }
         switch (SJB_Request::getVar("action")) {
             case 'edit':
                 unset($_GET['action']);
                 if (isset($_GET['id_saved'])) {
                     $id_saved = $_GET['id_saved'];
                     unset($_GET['id_saved']);
                     $errors = array();
                     SJB_SavedSearches::updateSearchOnDB($_GET, $id_saved, $current_user_info['sid'], 0);
                     if (!empty($errors)) {
                         $tp->assign("errors", $errors);
                         $tp->display("save_search_failed.tpl");
                     } else {
                         $url = SJB_System::getSystemSettings('SITE_URL') . "/saved-searches/";
                         if ($isAlert) {
                             $url = SJB_System::getSystemSettings('SITE_URL') . "/job-alerts/";
                         }
                         $tp->assign("url", $url);
                         $tp->display("save_search_success.tpl");
                     }
                 }
                 break;
             case 'save':
                 $search_name = SJB_Request::getVar("search_name");
                 $errors = array();
                 $criteria_saver = new SJB_ListingCriteriaSaver(SJB_Request::getVar("searchId", ""));
                 $requested_data = $criteria_saver->getCriteria();
                 if (is_array($criteria_saver->order_info)) {
                     $requested_data = array_merge($requested_data, $criteria_saver->order_info);
                 }
                 $requested_data['listings_per_page'] = $criteria_saver->listings_per_page;
                 $emailFrequency = SJB_Request::getVar("email_frequency", 'daily');
                 SJB_SavedSearches::saveSearchOnDB($requested_data, $search_name, $current_user_info['sid'], $enableNotify, $isAlert, $emailFrequency);
                 if (!empty($errors)) {
                     $tp->assign("errors", $errors);
                     $tp->display("save_search_failed.tpl");
                 } else {
                     if (isset($_REQUEST['url'])) {
                         SJB_HelperFunctions::redirect(SJB_System::getSystemSettings('SITE_URL') . $_REQUEST['url'] . "?alert=added");
                     }
                     $tp->display("save_search_success.tpl");
                 }
                 break;
             default:
                 if (!empty($errors)) {
                     $tp->assign("errors", $errors);
                     $tp->display("save_search_failed.tpl");
                 } else {
                     $tp->assign("searchId", SJB_Request::getVar("searchId", ""));
                     $tp->assign("listing_type_id", SJB_Session::getValue('listing_type_id'));
                     $tp->display("save_search_form.tpl");
                 }
                 break;
         }
     } else {
         $tp->assign("return_url", base64_encode(SJB_Navigator::getURIThis()));
         $tp->assign("ajaxRelocate", true);
         $tp->display("../users/login.tpl");
     }
 }
开发者ID:Maxlander,项目名称:shixi,代码行数:88,代码来源:save_search.php

示例13: isAllowed

 /**
  * Можно ли?
  * @param $resource
  * @param $roleId
  */
 public function isAllowed($resource, $roleId = null, $type = 'user', $returnParams = false, $returnMessage = false)
 {
     $resource = strtolower($resource);
     $userInfo = array();
     if (null === $roleId) {
         // если не задан пользователь, то попробуем использовать текущего
         $userInfo = SJB_UserManager::getCurrentUserInfo();
         if (!empty($userInfo)) {
             $roleId = $userInfo['sid'];
         }
         if (null === $roleId) {
             if (SJB_Admin::admin_authed() && SJB_System::getSystemSettings('SYSTEM_ACCESS_TYPE') == 'admin') {
                 if ($returnParams) {
                     return '';
                 }
                 if ($returnMessage) {
                     return '';
                 }
                 return true;
             }
             $roleId = 'guest';
         }
     } else {
         $cacheId = 'SJB_Acl::SJB_UserManager::getUserInfoBySID' . $roleId;
         if (SJB_MemoryCache::has($cacheId)) {
             $userInfo = SJB_MemoryCache::get($cacheId);
         } else {
             $userInfo = SJB_UserManager::getUserInfoBySID($roleId);
             SJB_MemoryCache::set($cacheId, $userInfo);
         }
     }
     $role = $type . '_' . $roleId;
     if ($resource == 'use_screening_questionnaires' && intval($userInfo['parent_sid']) > 0) {
         if ($this->isAllowed($resource, $userInfo['parent_sid'])) {
             return $this->isAllowed('subuser_use_screening_questionnaires', $userInfo['sid']);
         }
         return false;
     }
     if (!isset($this->permissions[$role])) {
         switch ($type) {
             case 'user':
             case 'guest':
                 if ($roleId == 'guest' || $type == 'guest') {
                     $role = 'user_guest';
                     if (empty($this->permissions[$role])) {
                         $this->permissions[$role] = $this->getPermissions('guest', 'guest');
                     }
                 } else {
                     $permissions = $this->getPermissions('user', $roleId);
                     $groupPermissions = $this->getPermissions('group', $userInfo['user_group_sid']);
                     $this->permissions['group_' . $userInfo['user_group_sid']] = $groupPermissions;
                     $contracts = SJB_ContractManager::getAllContractsSIDsByUserSID($roleId);
                     if (!empty($contracts)) {
                         foreach ($contracts as $contract) {
                             $contractPermissions = $this->mergePermissionsWithGroup($this->getPermissions('contract', $contract), $groupPermissions);
                             $this->permissions['contract_' . $contract] = $contractPermissions;
                             $permissions = $this->mergePermissions($contractPermissions, $permissions);
                         }
                     } else {
                         $permissions = $this->mergePermissionsWithGroup($permissions, $groupPermissions);
                     }
                     $this->permissions[$role] = $permissions;
                 }
                 break;
             case 'group':
                 $this->permissions[$role] = $this->getPermissions($type, $roleId);
                 break;
             case 'product':
                 $productInfo = SJB_ProductsManager::getProductInfoBySID($roleId);
                 if (!empty($productInfo['user_group_sid'])) {
                     $groupRole = 'group_' . $productInfo['user_group_sid'];
                     if (empty($this->permissions[$groupRole])) {
                         $this->permissions[$groupRole] = $this->getPermissions('group', $productInfo['user_group_sid']);
                     }
                     $this->permissions[$role] = $this->mergePermissionsWithGroup($this->getPermissions('product', $roleId), $this->permissions[$groupRole]);
                 } else {
                     $this->permissions[$role] = $this->getPermissions('product', $roleId);
                 }
                 break;
             case 'contract':
                 $this->permissions[$role] = $this->getPermissions('contract', $roleId);
                 break;
         }
     }
     if (!isset($userInfo)) {
         $userInfo = SJB_UserManager::getCurrentUserInfo();
     }
     $is_display_resume = !preg_match_all("/.*\\/(?:display_resume|display_job)\\/(\\d*)/i", $_SERVER['REQUEST_URI'], $match) ? isset($_SERVER['REDIRECT_URL']) ? preg_match_all("/.*\\/(?:display_resume|display_job)\\/(\\d*)/i", $_SERVER['REDIRECT_URL'], $match) : false : true;
     // Allow access to Resume/Job Details page if an employer has an application linked to the resume
     if (isset($userInfo) && $is_display_resume) {
         $apps = SJB_DB::query("SELECT `a`.resume FROM `applications` `a`\n\t\t\t\t\t\t            INNER JOIN `listings` l ON\n\t\t\t\t\t\t                  `l`.`sid` = `a`.`listing_id`\n\t\t\t\t\t\t            WHERE `l`.`user_sid` = ?n AND `a`.`show_emp` = 1  ORDER BY a.`date` DESC", $userInfo['sid']);
         if (isset($match[1]) && in_array(array("resume" => array_pop($match[1])), $apps)) {
             $this->permissions[$role][$resource]['value'] = 'allow';
             $this->permissions[$role][$resource]['params'] = '';
         }
//.........这里部分代码省略.........
开发者ID:Maxlander,项目名称:shixi,代码行数:101,代码来源:Acl.php

示例14: execute

 public function execute()
 {
     $tp = SJB_System::getTemplateProcessor();
     if (SJB_UserManager::isUserLoggedIn()) {
         $current_user = SJB_UserManager::getCurrentUser();
         if ($current_user->isSubuser()) {
             // У саб-юзера должны быть свои алерты
             $current_user = $current_user->getSubuserInfo();
         } else {
             $current_user = SJB_UserManager::getCurrentUserInfo();
         }
         $listing_type_id = '';
         /************************************************************/
         $tp = SJB_System::getTemplateProcessor();
         $tp->assign('action', 'list');
         $errors = array();
         $redirectUri = '/saved-searches/';
         if (isset($_REQUEST['is_alert'])) {
             if (isset($_REQUEST['listing_type_id'])) {
                 $listing_type_id = $_REQUEST['listing_type_id'];
                 SJB_Session::setValue('listing_type_id', $listing_type_id);
             } elseif (isset($_REQUEST['restore'])) {
                 $listing_type_id = SJB_Session::getValue('listing_type_id');
             } else {
                 SJB_Session::setValue('listing_type_id', null);
             }
             if (!SJB_Acl::getInstance()->isAllowed("use_{$listing_type_id}_alerts")) {
                 $errors = array('NOT_SUBSCRIBE' => true);
                 $tp->assign('ERRORS', $errors);
                 $tp->display('error.tpl');
                 return;
             } else {
                 $redirectUri = '/' . strtolower($listing_type_id) . '-alerts/';
             }
         } else {
             if (isset($_REQUEST['listing_type_id'])) {
                 $listing_type_id = $_REQUEST['listing_type_id'];
             }
             if (!SJB_Acl::getInstance()->isAllowed('save_searches')) {
                 $errors = array('NOT_SUBSCRIBE' => true);
                 $tp->assign('ERRORS', $errors);
                 $tp->display('error.tpl');
                 return;
             }
         }
         $isSubmittedForm = SJB_Request::getVar('submit', false);
         $listing_type_sid = !empty($listing_type_id) ? SJB_ListingTypeManager::getListingTypeSIDByID($listing_type_id) : 0;
         if (!isset($_REQUEST['listing_type']['equal']) && isset($listing_type_id)) {
             $_REQUEST['listing_type']['equal'] = $listing_type_id;
         }
         $action = SJB_Request::getVar('action', 'list');
         switch ($action) {
             case 'save':
                 if ($isSubmittedForm) {
                     $search_name = SJB_Request::getVar('name');
                     $emailFrequency = SJB_Request::getVar('email_frequency');
                     if (empty($search_name['equal'])) {
                         $errors['EMPTY_VALUE'] = 1;
                         $tp->assign('action', 'save');
                     } else {
                         unset($_REQUEST['name']);
                         unset($_REQUEST['email_frequency']);
                         if ($emailFrequency) {
                             $emailFrequency = array_pop($emailFrequency);
                             $emailFrequency = '&email_frequency=' . array_pop($emailFrequency);
                         } else {
                             $emailFrequency = '';
                         }
                         $search_name = $search_name['equal'];
                         $searchResultsTP = new SJB_SearchResultsTP($_REQUEST, $listing_type_id);
                         $tp = $searchResultsTP->getChargedTemplateProcessor();
                         SJB_HelperFunctions::redirect(SJB_System::getSystemSettings('SITE_URL') . '/save-search/?alert=true&url=' . $redirectUri . '&action=save&search_name=' . $search_name . '&searchId=' . $searchResultsTP->searchId . $emailFrequency);
                     }
                 } else {
                     $tp->assign('action', 'save');
                 }
                 break;
             case 'edit':
                 if (isset($_REQUEST['id_saved'])) {
                     if ($isSubmittedForm) {
                         $id_saved = $_REQUEST['id_saved'];
                         $name = $_REQUEST['name'];
                         $search_name = SJB_Request::getVar('name');
                         $emailFrequency = SJB_Request::getVar('email_frequency');
                         if (empty($search_name['equal'])) {
                             $errors['EMPTY_VALUE'] = 1;
                         } else {
                             unset($_REQUEST['name']);
                             unset($_REQUEST['email_frequency']);
                             if ($emailFrequency) {
                                 $emailFrequency = array_pop($emailFrequency);
                                 $emailFrequency = array_pop($emailFrequency);
                             } else {
                                 $emailFrequency = 'daily';
                             }
                             $searchResultsTP = new SJB_SearchResultsTP($_REQUEST, $listing_type_id);
                             $tp = $searchResultsTP->getChargedTemplateProcessor();
                             $criteria_saver = new SJB_ListingCriteriaSaver($searchResultsTP->searchId);
                             $requested_data = $criteria_saver->getCriteria();
                             SJB_SavedSearches::updateSearchOnDB($requested_data, $id_saved, $current_user['sid'], $name['equal'], $emailFrequency);
//.........这里部分代码省略.........
开发者ID:Maxlander,项目名称:shixi,代码行数:101,代码来源:saved_searches.php

示例15: execute

 public function execute()
 {
     $tp = SJB_System::getTemplateProcessor();
     $current_user = SJB_UserManager::getCurrentUser();
     $currentUserInfo = SJB_UserManager::getCurrentUserInfo();
     $tp->assign('current_user', $currentUserInfo);
     $errors = array();
     $error = '';
     $listing_id = SJB_Request::getVar('listing_id', null, 'default', 'int');
     if (SJB_UserGroupManager::getUserGroupIDBySID($current_user->user_group_sid) == 'Employer') {
         $template = SJB_Request::getVar('input_template', 'copy_listing.tpl');
     } else {
         SJB_HelperFunctions::redirect(SJB_System::getSystemSettings('SITE_URL') . '/my-listings/Job/');
     }
     //getting $tmp_listing_id from request
     $tmp_listing_id_from_request = SJB_Request::getVar('tmp_listing_id', false, 'default', 'int');
     $listing_info = SJB_ListingManager::getListingInfoBySID($listing_id);
     $listing_type_id = SJB_ListingTypeManager::getListingTypeIDBySID($listing_info['listing_type_sid']);
     if ($productsInfo = $this->canCurrentUserAddListing($error, $listing_type_id)) {
         $pages = SJB_PostingPagesManager::getPagesByListingTypeSID($listing_info['listing_type_sid']);
         if (!empty($tmp_listing_id_from_request)) {
             $tmp_listing_sid = $tmp_listing_id_from_request;
         } elseif (!$tmp_listing_id_from_request) {
             $tmp_listing_sid = time();
         }
         $gallery = new SJB_ListingGallery();
         $gallery->setListingSID($listing_info['sid']);
         $pictures_info = $gallery->getPicturesInfo();
         $gallery->setListingSID($tmp_listing_sid);
         $pictures_info_new = $gallery->getPicturesInfo();
         //reuploading pictures
         if (!$pictures_info_new) {
             foreach ($pictures_info as $v) {
                 if (!$gallery->uploadImage($v['picture_url'], $v['caption'])) {
                     $field_errors['Picture'] = $gallery->getError();
                 }
             }
         }
         $contractID = SJB_Request::getVar('contract_id', false, 'default', 'int');
         if ($contractID) {
             $contract = new SJB_Contract(array('contract_id' => $contractID));
         } elseif (count($productsInfo) == 1) {
             $productInfo = array_pop($productsInfo);
             $contractID = $productInfo['contract_id'];
             $contract = new SJB_Contract(array('contract_id' => $contractID));
         } else {
             $tp->assign('listing_id', $listing_id);
             $tp->assign("products_info", $productsInfo);
             $tp->assign("listing_type_id", $listing_type_id);
             $tp->display("listing_product_choice.tpl");
         }
         if ($contractID) {
             $tp->assign('tmp_listing_id', $tmp_listing_sid);
             $extraInfo = $contract->extra_info;
             $numberOfPictures = isset($extraInfo['number_of_pictures']) ? $extraInfo['number_of_pictures'] : 0;
             $tp->assign("pic_limit", $numberOfPictures);
             $tp->assign('contractID', $contractID);
             if ($listing_info['user_sid'] != SJB_UserManager::getCurrentUserSID()) {
                 $errors['NOT_OWNER_OF_LISTING'] = $listing_id;
             } elseif (!is_null($listing_info)) {
                 $listing_info = array_merge($listing_info, $_REQUEST);
                 $listing = new SJB_Listing($listing_info, $listing_info['listing_type_sid']);
                 $listing->deleteProperty('featured');
                 $listing->deleteProperty('priority');
                 $listing->deleteProperty('status');
                 $listing->deleteProperty('reject_reason');
                 $listing->setSID($listing_id);
                 $screening_questionnaires = SJB_ScreeningQuestionnaires::getList($current_user->getSID());
                 if (SJB_Acl::getInstance()->isAllowed('use_screening_questionnaires') && $screening_questionnaires) {
                     $issetQuestionnairyField = $listing->getProperty('screening_questionnaire');
                     if ($issetQuestionnairyField) {
                         $value = SJB_Request::getVar('screening_questionnaire');
                         $value = $value ? $value : isset($listing_info['screening_questionnaire']) ? $listing_info['screening_questionnaire'] : '';
                         $listing->addProperty(array('id' => 'screening_questionnaire', 'type' => 'list', 'caption' => 'Screening Questionnaire', 'value' => $value, 'list_values' => SJB_ScreeningQuestionnaires::getListSIDsAndCaptions($current_user->getSID()), 'is_system' => true));
                     }
                 } else {
                     $listing->deleteProperty('screening_questionnaire');
                 }
                 $listing_edit_form = new SJB_Form($listing);
                 $listing_edit_form->registerTags($tp);
                 $extraInfo = $listing_info['product_info'];
                 if ($extraInfo) {
                     $extraInfo = unserialize($extraInfo);
                     $numberOfPictures = isset($extraInfo['number_of_pictures']) ? $extraInfo['number_of_pictures'] : 0;
                     $tp->assign("pic_limit", $numberOfPictures);
                 }
                 $form_is_submitted = isset($_REQUEST['action']) && $_REQUEST['action'] == 'save_info' || isset($_REQUEST['action']) && $_REQUEST['action'] == 'add';
                 $listing->addProperty(array('id' => 'contract_id', 'type' => 'id', 'value' => $contractID, 'is_system' => true));
                 $delete = SJB_Request::getVar('action', '') == 'delete';
                 $field_errors = null;
                 if ($delete && isset($_REQUEST['field_id'])) {
                     $field_id = $_REQUEST['field_id'];
                     $listing->details->properties[$field_id]->type->property_info['value'] = null;
                 } elseif ($form_is_submitted && $listing_edit_form->isDataValid($field_errors)) {
                     $listing->addProperty(array('id' => 'complete', 'type' => 'integer', 'value' => 1, 'is_system' => true));
                     $listing->setUserSID($current_user->getSID());
                     $extraInfo = $contract->extra_info;
                     $listing->setProductInfo($extraInfo);
                     $listing->sid = null;
                     if (!empty($listing_info['subuser_sid'])) {
//.........这里部分代码省略.........
开发者ID:Maxlander,项目名称:shixi,代码行数:101,代码来源:copy_listing.php


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