本文整理汇总了PHP中SJB_System::getURI方法的典型用法代码示例。如果您正苦于以下问题:PHP SJB_System::getURI方法的具体用法?PHP SJB_System::getURI怎么用?PHP SJB_System::getURI使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SJB_System
的用法示例。
在下文中一共展示了SJB_System::getURI方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: execute
public function execute()
{
$tp = SJB_System::getTemplateProcessor();
$errors = array();
$listingTypeID = SJB_Request::getVar('listing_type_id', '');
if (SJB_UserManager::isUserLoggedIn()) {
if (!SJB_Acl::getInstance()->isAllowed('save_' . trim($listingTypeID))) {
$errors[] = 'DENIED_VIEW_SAVED_LISTING';
}
if (!$errors) {
$userSid = SJB_UserManager::getCurrentUserSID();
if (SJB_Request::getVar('action', '') == 'delete') {
$listing_id = SJB_Request::getVar('listing_id', null);
if (!is_null($listing_id)) {
foreach ($listing_id as $key => $value) {
SJB_SavedListings::deleteListingFromDBBySID($key, $userSid);
}
SJB_HelperFunctions::redirect(SJB_System::getSystemSettings("SITE_URL") . SJB_Navigator::getURI());
}
}
$saved_listings_id = SJB_SavedListings::getSavedListingsFromDB($userSid);
$listings_structure = array();
$listing_structure_meta_data = array();
foreach ($saved_listings_id as $saved_listing) {
$saved_listing_id = $saved_listing['listing_sid'];
$listing = SJB_ListingManager::getObjectBySID($saved_listing_id);
if (is_null($listing)) {
continue;
}
$listing->addPicturesProperty();
$listing_structure = SJB_ListingManager::createTemplateStructureForListing($listing);
$listings_structure[$listing->getID()] = $listing_structure;
$listings_structure[$listing->getID()]['saved_listing'] = $saved_listing;
if (isset($listing_structure['METADATA'])) {
$listing_structure_meta_data = array_merge($listing_structure_meta_data, $listing_structure['METADATA']);
}
}
$metaDataProvider = SJB_ObjectMother::getMetaDataProvider();
$tp->assign("METADATA", array("listing" => $metaDataProvider->getMetaData($listing_structure_meta_data)));
$tp->assign("listings", $listings_structure);
$tp->assign("listing_type_id", $listingTypeID);
$tp->display("saved_listings.tpl");
} else {
$tp->assign("errors", $errors);
$tp->display("save_search_failed.tpl");
}
} else {
$url = base64_encode(SJB_System::getSystemSettings("SITE_URL") . "/system/classifieds" . SJB_System::getURI());
switch ($listingTypeID) {
case 'job':
$url = base64_encode(SJB_System::getSystemSettings("SITE_URL") . "/saved-jobs/");
break;
case 'resume':
$url = base64_encode(SJB_System::getSystemSettings("SITE_URL") . "/saved-resumes/");
break;
}
$tp->assign("return_url", $url);
$tp->display("../users/login.tpl");
}
}
示例2: processingMobileVersion
private function processingMobileVersion($tp)
{
if (!SJB_Session::getValue('cookiePreferencesAlreadyShown')) {
$_COOKIE['cookiePreferences'] = 'Advertising';
setcookie('cookiePreferences', 'Advertising', time() + 30 * 24 * 3600, '/');
}
$refererUri = SJB_Request::getVar('HTTP_REFERER', null, 'SERVER');
if ($refererUri) {
$refererUri = parse_url($refererUri);
}
if ($refererUri && SJB_System::getURI() != '/' . basename($refererUri['path']) . '/') {
SJB_Session::setValue('cookiePreferencesMobileReferer', SJB_Request::getVar('HTTP_REFERER', SJB_System::getSystemSettings('SITE_URL'), 'SERVER'));
}
if (SJB_Request::getVar('cookiePreferencesSave', false, 'POST')) {
if (!SJB_Request::getVar('Functional', false, 'POST')) {
$_COOKIE['cookiePreferences'] = 'System';
setcookie('cookiePreferences', 'System', time() + 30 * 24 * 3600, '/');
} else {
if (!SJB_Request::getVar('Advertising', false, 'POST')) {
$_COOKIE['cookiePreferences'] = 'Functional';
setcookie('cookiePreferences', 'Functional', time() + 30 * 24 * 3600, '/');
} else {
$_COOKIE['cookiePreferences'] = 'Advertising';
setcookie('cookiePreferences', 'Advertising', time() + 30 * 24 * 3600, '/');
}
}
}
$tp->assign('mobileVersion', true);
}
示例3: getDetails
public static function getDetails($user_group_sid, $referenceUid = false)
{
$details = array(array('id' => 'featured', 'caption' => 'Featured', 'type' => 'boolean', 'length' => '20', 'is_required' => false, 'is_system' => true, 'order' => null), array('id' => 'active', 'caption' => 'Status', 'type' => 'list', 'list_values' => array(array('id' => '1', 'caption' => 'Active'), array('id' => '0', 'caption' => 'Not active')), 'length' => '10', 'is_required' => false, 'is_system' => true), array('id' => 'sendmail', 'caption' => "Don't send mailings", 'type' => 'boolean', 'length' => '1', 'is_required' => false, 'is_system' => true));
$user_group_info = SJB_UserGroupManager::getUserGroupInfoBySID($user_group_sid);
$email_confirmation = false;
if (isset($user_group_info['email_confirmation'])) {
$email_confirmation = $user_group_info['email_confirmation'];
}
if (SJB_UserGroupManager::isUserEmailAsUsernameInUserGroup($user_group_sid) || class_exists('SJB_SocialPlugin') && $referenceUid) {
$userFields = array(array('id' => 'username', 'caption' => 'User name', 'type' => 'string', 'table_name' => 'users', 'length' => '20', 'is_required' => true, 'is_system' => true, 'order' => 0), array('id' => 'password', 'caption' => 'Password', 'type' => 'password', 'length' => '20', 'is_required' => true, 'is_system' => true, 'order' => 2), array('id' => 'email', 'caption' => 'Email', 'type' => 'unique_email', 'table_name' => 'users', 'length' => '20', 'is_required' => true, 'is_system' => true, 'order' => 1, 'email_confirmation' => $email_confirmation));
} else {
$userFields = array(array('id' => 'username', 'caption' => 'User name', 'type' => 'unique_string', 'table_name' => 'users', 'length' => '20', 'validators' => array('SJB_IdValidator', 'SJB_UniqueSystemValidator'), 'is_required' => true, 'is_system' => true, 'order' => 0), array('id' => 'password', 'caption' => 'Password', 'type' => 'password', 'length' => '20', 'is_required' => true, 'is_system' => true, 'order' => 1), array('id' => 'email', 'caption' => 'Email', 'type' => 'unique_email', 'table_name' => 'users', 'length' => '20', 'is_required' => true, 'is_system' => true, 'order' => 2, 'email_confirmation' => $email_confirmation));
}
$details = array_merge($userFields, $details);
$extra_details = SJB_UserProfileFieldManager::getFieldsInfoByUserGroupSID($user_group_sid);
foreach ($extra_details as $key => $extra_detail) {
if ($extra_detail['type'] == 'monetary' || $extra_detail['type'] == 'complex') {
$extra_details[$key]['is_system'] = false;
} else {
$extra_details[$key]['is_system'] = true;
}
}
$details = array_merge($details, $extra_details);
if (SJB_PluginManager::isPluginActive('CaptchaPlugin') && SJB_System::getSettingByName('registrationCaptcha') == 1 && SJB_System::getURI() == '/registration/') {
$details_captcha = array(array('id' => 'captcha', 'caption' => 'Enter code from image', 'type' => 'captcha', 'length' => '20', 'is_required' => true, 'is_system' => false));
$details = array_merge($details, $details_captcha);
}
return $details;
}
示例4: getDetails
public static function getDetails($listing_type_sid, $pageID = 0)
{
$system_details = array(array('id' => 'featured', 'caption' => 'Featured', 'type' => 'boolean', 'length' => '20', 'is_required' => false, 'is_system' => true, 'order' => null), array('id' => 'priority', 'caption' => 'Priority Listing', 'type' => 'boolean', 'length' => '20', 'is_required' => false, 'is_system' => true, 'order' => null));
$listing_field_manager = new SJB_ListingFieldManager();
$common_details = $listing_field_manager->getCommonListingFieldsInfo($pageID);
$extra_details = $listing_field_manager->getListingFieldsInfoByListingType($listing_type_sid, $pageID);
$details = array_merge($common_details, $extra_details);
foreach ($details as $key => $detail) {
$details[$key]['is_system'] = true;
if ($detail['type'] == 'complex' || $detail['id'] == 'ApplicationSettings') {
$details[$key]['is_system'] = false;
} elseif ($detail['id'] == 'access_type') {
$details[$key]['is_system'] = true;
$details[$key]['list_values'] = array(array('id' => 'everyone', 'caption' => 'Everyone'), array('id' => 'no_one', 'caption' => 'No one'), array('id' => 'only', 'caption' => 'Only selected employers'), array('id' => 'except', 'caption' => 'Everyone except selected employers'));
}
}
$details = array_merge($system_details, $details);
$isPageLast = SJB_PostingPagesManager::isLastPageByID($pageID, $listing_type_sid);
if ($isPageLast) {
$status_details = array(array('id' => 'status', 'caption' => 'Approve Status', 'type' => 'list', 'list_values' => array(array('id' => 'pending', 'caption' => 'Pending'), array('id' => 'approved', 'caption' => 'Approved'), array('id' => 'rejected', 'caption' => 'Rejected')), 'is_required' => false, 'is_system' => true, 'order' => 1000000));
$details = array_merge($details, $status_details);
$rejectReasonDetails = array(array('id' => 'reject_reason', 'caption' => 'Reject Reason', 'type' => 'text', 'is_required' => false, 'is_system' => true, 'order' => 1000000));
$details = array_merge($details, $rejectReasonDetails);
if (SJB_PluginManager::isPluginActive('CaptchaPlugin') && SJB_System::getSettingByName('postJobCaptcha') && strpos(SJB_System::getURI(), '/add-listing/') === 0) {
$details_captcha = array(array('id' => 'captcha', 'caption' => 'Enter code from image', 'type' => 'captcha', 'length' => '20', 'is_required' => true, 'is_system' => true, 'order' => 10000000));
$details = array_merge($details, $details_captcha);
}
}
return $details;
}
示例5: execute
//.........这里部分代码省略.........
if (preg_match("^[a-z0-9\\._-]+@[a-z0-9\\._-]+\\.[a-z]{2,}\$^iu", $listing_info['ApplicationSettings'])) {
$listing_info['ApplicationSettings'] = array('value' => $listing_info['ApplicationSettings'], 'add_parameter' => 1);
} elseif (preg_match("^(https?:\\/\\/)^iu", $listing_info['ApplicationSettings'])) {
$listing_info['ApplicationSettings'] = array('value' => $listing_info['ApplicationSettings'], 'add_parameter' => 2);
} else {
$listing_info['ApplicationSettings'] = array('value' => '', 'add_parameter' => '');
}
$listing->details->properties[$property->id]->type->property_info['value'] = $listing_info['ApplicationSettings'];
} elseif ($property->getType() == 'complex' && is_array($property->value)) {
$childFields = SJB_ListingComplexFieldManager::getListingFieldsInfoByParentSID($property->sid);
$complexChildValues = $property->value;
foreach ($childFields as $childField) {
if ($childField['type'] == 'complexfile' && !empty($complexChildValues[$childField['id']])) {
$field_info = SJB_ListingComplexFieldManager::getFieldInfoBySID($childField['sid']);
if (isset($listing_info[$property->id][$field_info['id']]) && file_exists($listing_info[$property->id][$field_info['id']])) {
SJB_UploadFileManager::fileImport($listing_info, $field_info, $property->id);
}
}
}
}
// The import of files at import of listings
if (in_array($property->getType(), array('file', 'logo', 'picture', 'video')) && $property->value !== '') {
$field_info = SJB_ListingFieldDBManager::getListingFieldInfoByID($property->id);
if (isset($listing_info[$field_info['id']]) && file_exists($listing_info[$field_info['id']])) {
SJB_UploadFileManager::fileImport($listing_info, $field_info);
}
}
}
$listing->deleteProperty('featured');
$listing->deleteProperty('priority');
$listing->deleteProperty('status');
$listing->deleteProperty('reject_reason');
$listing->addProperty(array('id' => 'contract_id', 'type' => 'id', 'value' => $contract->getID(), 'is_system' => true));
$extraInfo = $contract->extra_info;
$listing->setProductInfo($extraInfo);
$listing->setPropertyValue('access_type', 'everyone');
$listing->setUserSID($current_user->sid);
if ($current_user->isSubuser()) {
$subuserInfo = $current_user->getSubuserInfo();
$listing->addSubuserProperty($subuserInfo['sid']);
}
SJB_ListingManager::saveListing($listing);
SJB_Statistics::addStatistics('addListing', $listing->getListingTypeSID(), $listing->getSID(), false, $extraInfo['featured'], $extraInfo['priority']);
$contract->incrementPostingsNumber();
SJB_ProductsManager::incrementPostingsNumber($contract->product_sid);
if (!empty($extraInfo['featured'])) {
SJB_ListingManager::makeFeaturedBySID($listing->getSID());
}
if (!empty($extraInfo['priority'])) {
SJB_ListingManager::makePriorityBySID($listing->getSID());
}
$this->FillGallery($listing, $listing_info);
$listingSIDs[] = $listing->getSID();
}
SJB_ListingManager::activateListingBySID($listingSIDs);
$tp->assign('listingsNum', count($listingSIDs));
$tp->display('job_import_complete.tpl');
} else {
$tp->assign('charSets', SJB_HelperFunctions::getCharSets());
$error = 'LISTINGS_NUMBER_LIMIT_EXCEEDED';
$tp->assign('listing_type_id', $listing_type_id);
$tp->assign('error', $error);
$tp->display('job_import.tpl');
}
} else {
$tp->assign('charSets', SJB_HelperFunctions::getCharSets());
$tp->assign('warning', $warning);
$tp->assign('contract_id', $contractID);
$tp->assign('listing_type_id', $listing_type_id);
$tp->display('job_import.tpl');
}
}
} else {
$error = $acl->getPermissionMessage('bulk_job_import');
if (empty($error)) {
$error = 'This action is not allowed within your current product';
}
$tp->assign('error', $error);
$tp->assign('charSets', SJB_HelperFunctions::getCharSets());
$tp->assign('listing_type_id', $listing_type_id);
$tp->display('job_import.tpl');
}
} else {
if ($error == 'NO_CONTRACT') {
if ($_GET) {
$getParam = '?';
foreach ($_GET as $key => $val) {
$getParam .= $key . '=' . $val . '&';
}
$getParam = substr($getParam, 0, -1);
}
$page = base64_encode(SJB_System::getURI() . $getParam);
SJB_HelperFunctions::redirect(SJB_System::getSystemSettings('SITE_URL') . '/my-products/?page=' . $page);
}
$tp->assign('charSets', SJB_HelperFunctions::getCharSets());
$tp->assign('listing_type_id', $listing_type_id);
$tp->assign('error', $error);
$tp->display('job_import.tpl');
}
}
示例6: registerGlobalVariables
function registerGlobalVariables()
{
$variables = SJB_System::getGlobalTemplateVariables();
foreach ($variables as $name => $value) {
$this->assign($name, $value);
}
parse_str($_SERVER['QUERY_STRING'], $queryString);
$params = array();
$uri = SJB_System::getURI();
if (!empty($_POST) && !in_array($uri, array('/paypal-pro-fill-payment-card/', '/add-invoice/', '/edit-invoice/', '/edit-product/', '/add-product/'))) {
$queryString = array_merge($queryString, $_POST);
}
foreach ($queryString as $key => $val) {
if (!in_array($key, array('lang', 'theme'))) {
$params[$key] = $val;
}
}
$this->assign('url', $uri);
$this->assign('acl', SJB_Acl::getInstance());
$this->assign('params', http_build_query($params, '', '&'));
$this->assign('isDemo', SJB_System::getSystemSettings("isDemo"));
}
示例7: execute
public function execute()
{
$logged_in = false;
$tp = SJB_System::getTemplateProcessor();
$shoppingCart = SJB_Request::getVar('shopping_cart', false);
$proceedToPosting = SJB_Request::getVar('proceed_to_posting', false);
$productSID = SJB_Request::getVar('productSID', false);
$listingTypeID = SJB_Request::getVar('listing_type_id', false);
$errors = array();
if (SJB_Authorization::isUserLoggedIn() && !isset($_REQUEST['as_user'])) {
$tp->display('already_logged_in.tpl');
} else {
$template = SJB_Request::getVar('template', 'login.tpl');
$page_config = SJB_System::getPageConfig(SJB_System::getURI());
if (SJB_Request::getVar('action', false) == 'login') {
$username = SJB_Request::getVar('username');
$password = SJB_Request::getVar('password');
$keep_signed = SJB_Request::getVar('keep', false);
$login_as_user = false;
if (isset($_REQUEST['as_user'])) {
$login_as_user = true;
if (SJB_UserManager::getCurrentUserSID()) {
SJB_Authorization::logout();
}
}
// redirect user to the home page if it's login page or to the same page otherwise
if (SJB_Request::getVar('return_url', false) != false) {
$redirect_url = base64_decode(SJB_Request::getVar('return_url'));
if (!empty($proceedToPosting)) {
$redirect_url .= '&proceed_to_posting=1&productSID=' . $productSID;
}
} else {
if ($page_config->module == 'users' && $page_config->function == 'login') {
$redirect_url = SJB_System::getSystemSettings("SITE_URL") . "/my-account/";
} else {
$redirect_url = SJB_System::getSystemSettings("SITE_URL") . SJB_System::getURI();
}
}
if (SJB_UserManager::getCurrentUserSID()) {
$logged_in = true;
} else {
SJB_UserManager::login($username, $password, $errors, false, $login_as_user);
if ($errors) {
if (is_null(SJB_Session::getValue('userLoginCounter'))) {
SJB_Session::setValue('userLoginCounter', 1);
} else {
SJB_Session::setValue('userLoginCounter', SJB_Session::getValue('userLoginCounter') + 1);
}
}
if (SJB_Captcha::getInstance($tp, $_REQUEST)->isValid($errors) && empty($errors)) {
$logged_in = SJB_Authorization::login($username, $password, $keep_signed, $errors, $login_as_user);
}
}
if ($logged_in && !$shoppingCart) {
SJB_HelperFunctions::redirect($redirect_url);
}
$tp->assign('logged_in', $logged_in);
}
$return_url = SJB_Request::getVar('return_url', $page_config->function != 'login' && $page_config->function != 'search_form' ? base64_encode(SJB_Navigator::getURIThis()) : false);
if (!filter_var(SJB_System::getSystemSettings("SITE_URL") . base64_decode($return_url), FILTER_VALIDATE_URL, FILTER_FLAG_PATH_REQUIRED)) {
$return_url = '';
}
$tp->assign('shopping_cart', $shoppingCart);
$tp->assign('proceedToPosting', $proceedToPosting);
$tp->assign('productSID', $productSID);
$tp->assign('listingTypeID', $listingTypeID);
$tp->assign('return_url', $return_url);
$tp->assign('ajaxRelocate', SJB_Request::getVar('ajaxRelocate', false));
$tp->assign('errors', $errors);
$tp->assign('adminEmail', SJB_System::getSettingByName('system_email'));
$tp->display($template);
}
}
示例8: execute
//.........这里部分代码省略.........
if ($isComplex) {
list($parentField, $subField, $complexStep) = explode(':', $fieldId);
$parentProp = $listing->getProperty($parentField);
$parentValue = $parentProp->getValue();
// look for complex property with current $fieldID and set it to new value of property
if (!empty($parentValue)) {
foreach ($parentValue as $id => $value) {
if ($id == $subField) {
$parentValue[$id][$complexStep] = $newFileId;
}
}
$listing->setPropertyValue($parentField, $parentValue);
}
} else {
$listing->setPropertyValue($fieldId, $newFileId);
}
// clean temporary field storage
$sessionFileStorage = SJB_Array::unsetValueByPath($sessionFileStorage, "{$formToken}/{$fieldId}");
}
//and remove token key from temporary storage
$sessionFileStorage = SJB_Array::unsetValueByPath($sessionFileStorage, "{$formToken}");
// clear temporary data in session storage
SJB_Session::setValue('tmp_uploads_storage', $sessionFileStorage);
$listingSidsForCopy = array('filesFrom' => $listing_id, 'picturesFrom' => $listing_id);
SJB_ListingManager::saveListing($listing, $listingSidsForCopy);
}
// <<< SJB-1197
SJB_Statistics::addStatistics('addListing', $listing->getListingTypeSID(), $listing->getSID(), false, $extraInfo['featured'], $extraInfo['priority']);
$contract->incrementPostingsNumber();
SJB_ProductsManager::incrementPostingsNumber($contract->product_sid);
// is listing featured by default
if ($extraInfo['featured']) {
SJB_ListingManager::makeFeaturedBySID($listing->getSID());
}
if ($extraInfo['priority']) {
SJB_ListingManager::makePriorityBySID($listing->getSID());
}
SJB_ListingManager::activateListingBySID($listing->getSID());
SJB_AdminNotifications::sendAdminListingAddedLetter($listing);
SJB_HelperFunctions::redirect(SJB_System::getSystemSettings('SITE_URL') . '/manage-' . strtolower($listing_type_id) . '/?listing_id=' . $listing->getSID());
} elseif ($form_is_submitted) {
$field_id = 'video';
if (!isset($_REQUEST['video_hidden']) && $listing->getPropertyValue($field_id)) {
$listing->details->properties[$field_id]->type->property_info['value'] = null;
}
}
$listing_structure = SJB_ListingManager::createTemplateStructureForListing($listing);
$form_fields = $listing_edit_form->getFormFieldsInfo();
$listing_fields_by_page = array();
$countPages = count($pages);
$i = 1;
foreach ($pages as $page) {
$listing_fields_by_page[$page['page_name']] = SJB_PostingPagesManager::getAllFieldsByPageSIDForForm($page['sid']);
if ($i == $countPages && isset($form_fields['screening_questionnaire'])) {
$listing_fields_by_page[$page['page_name']]['screening_questionnaire'] = $form_fields['screening_questionnaire'];
}
foreach (array_keys($listing_fields_by_page[$page['page_name']]) as $field) {
if (!$listing->propertyIsSet($field)) {
unset($listing_fields_by_page[$page['page_name']][$field]);
}
}
$i++;
}
$metaDataProvider = SJB_ObjectMother::getMetaDataProvider();
$tp->assign('METADATA', array('listing' => $metaDataProvider->getMetaData($listing_structure['METADATA']), 'form_fields' => $metaDataProvider->getFormFieldsMetadata($form_fields)));
$contract_id = $listing_info['contract_id'];
$contract = new SJB_Contract(array('contract_id' => $contract_id));
$tp->assign('contract_id', $contract_id);
$tp->assign('contract', $contract->extra_info);
$tp->assign('countPages', count($listing_fields_by_page));
$tp->assign('copy_listing', 1);
$tp->assign('tmp_listing_id', $tmp_listing_sid);
$tp->assign('listing_id', $listing_id);
$tp->assign('contractID', $contractID);
$tp->assign('listing', $listing_structure);
$tp->assign('pages', $listing_fields_by_page);
$tp->assign('field_errors', $field_errors);
}
$tp->assign('errors', $errors);
$tp->display($template);
}
} else {
$listing_type_id = isset($listing_info['listing_type_sid']) ? $listing_info['listing_type_sid'] : false;
if ($error == 'NO_CONTRACT') {
if ($_GET) {
$getParam = '?';
foreach ($_GET as $key => $val) {
$getParam .= $key . '=' . $val . '&';
}
$getParam = substr($getParam, 0, -1);
}
$page = base64_encode(SJB_System::getURI() . $getParam);
SJB_HelperFunctions::redirect(SJB_System::getSystemSettings('SITE_URL') . '/my-products/?page=' . $page);
}
$tp->assign('clone_job', 1);
$tp->assign('listing_type_id', $listing_type_id);
$tp->assign('error', $error);
$tp->display('add_listing_error.tpl');
}
}
示例9: execute
public function execute()
{
$tp = SJB_System::getTemplateProcessor();
$display_form = new SJB_Form();
$display_form->registerTags($tp);
$current_user = SJB_UserManager::getCurrentUser();
$errors = array();
$template = SJB_Request::getVar('display_template', 'display_listing.tpl');
$tcpdfError = SJB_Request::getVar('error', false);
$action = substr($template, 0, -4);
$listing_id = SJB_Request::getVar("listing_id");
if (isset($_REQUEST['passed_parameters_via_uri'])) {
$passed_parameters_via_uri = SJB_UrlParamProvider::getParams();
$listing_id = isset($passed_parameters_via_uri[0]) ? $passed_parameters_via_uri[0] : null;
}
if (is_null($listing_id) && SJB_FormBuilderManager::getIfBuilderModeIsSet()) {
$listing_type_id = SJB_Request::getVar('listing_type_id');
$listing_id = SJB_ListingManager::getListingIDByListingTypeID($listing_type_id);
}
if (is_null($listing_id)) {
$errors['UNDEFINED_LISTING_ID'] = true;
} elseif (is_null($listing = SJB_ListingManager::getObjectBySID($listing_id)) || !SJB_ListingManager::isListingAccessableByUser($listing_id, SJB_UserManager::getCurrentUserSID())) {
$errors['WRONG_LISTING_ID_SPECIFIED'] = true;
} elseif (!$listing->isActive() && $listing->getUserSID() != SJB_UserManager::getCurrentUserSID()) {
$errors['LISTING_IS_NOT_ACTIVE'] = true;
} elseif (($listingStatus = SJB_ListingManager::getListingApprovalStatusBySID($listing_id)) != 'approved' && SJB_ListingTypeManager::getWaitApproveSettingByListingType($listing->listing_type_sid) == 1 && $listing->getUserSID() != SJB_UserManager::getCurrentUserSID()) {
$errors['LISTING_IS_NOT_APPROVED'] = true;
} elseif (SJB_ListingTypeManager::getListingTypeIDBySID($listing->listing_type_sid) == 'Resume' && ($template == 'display_job.tpl' or SJB_System::getURI() == '/print-job/') || SJB_ListingTypeManager::getListingTypeIDBySID($listing->listing_type_sid) == 'Job' && ($template == 'display_resume.tpl' or SJB_System::getURI() == '/print-resume/')) {
$errors['WRONG_DISPLAY_TEMPLATE'] = true;
} else {
$listing_type_id = SJB_ListingTypeManager::getListingTypeIDBySID($listing->listing_type_sid);
if (SJB_System::getURI() == '/print-listing/') {
SJB_HelperFunctions::redirect(SJB_System::getSystemSettings('SITE_URL') . '/print-' . strtolower($listing_type_id) . '/?listing_id=' . $listing_id);
exit;
}
$listing->addPicturesProperty();
$display_form = new SJB_Form($listing);
$display_form->registerTags($tp);
$form_fields = $display_form->getFormFieldsInfo();
$listingOwner = SJB_UserManager::getObjectBySID($listing->user_sid);
if ($action !== 'print_listing') {
SJB_ListingManager::incrementViewsCounterForListing($listing_id, $listing);
}
$listing_structure = SJB_ListingManager::createTemplateStructureForListing($listing, array('comments', 'ratings'));
$filename = SJB_Request::getVar('filename', false);
if ($filename) {
$file = SJB_UploadFileManager::openFile($filename, $listing_id);
$errors['NO_SUCH_FILE'] = true;
}
$metaDataProvider = SJB_ObjectMother::getMetaDataProvider();
$tp->assign("METADATA", array("listing" => $metaDataProvider->getMetaData($listing_structure['METADATA']), "form_fields" => $metaDataProvider->getFormFieldsMetadata($form_fields)));
$comments = array();
$comments_total = '';
if (SJB_Settings::getSettingByName('show_comments') == '1') {
$comments = SJB_CommentManager::getEnabledCommentsToListing($listing_id);
$comments_total = count($comments);
}
$searchId = SJB_Request::getVar("searchId", "");
$page = SJB_Request::getVar("page", "");
$criteria_saver = new SJB_ListingCriteriaSaver($searchId);
$searchCriteria = $criteria_saver->getCriteria();
$keywordsHighlight = '';
if (isset($searchCriteria['keywords']) && SJB_System::getSettingByName('use_highlight_for_keywords')) {
foreach ($searchCriteria['keywords'] as $type => $keywords) {
switch ($type) {
case 'like':
case 'exact_phrase':
$keywordsHighlight = json_encode($keywords);
break;
case 'all_words':
case 'any_words':
$keywordsHighlight = json_encode(explode(' ', $keywords));
break;
case 'boolean':
$keywordsHighlight = json_encode(SJB_BooleanEvaluator::parse($keywords, true));
break;
}
}
}
$prevNextIds = $criteria_saver->getPreviousAndNextObjectID($listing_id);
$search_criteria_structure = $criteria_saver->createTemplateStructureForCriteria();
//permissions contact info
$acl = SJB_Acl::getInstance();
$permission = 'view_' . $listing_type_id . '_contact_info';
$allowViewContactInfo = false;
if (SJB_UserManager::isUserLoggedIn()) {
if (SJB_ContractManager::isPageViewed($current_user->getSID(), $permission, $listing_id) || $acl->isAllowed($permission) && in_array($acl->getPermissionParams($permission), array('', '0'))) {
$allowViewContactInfo = true;
} elseif ($acl->isAllowed($permission)) {
$viewContactInfo['count_views'] = 0;
$contractIDs = $current_user->getContractID();
$numberOfContactViewed = SJB_ContractManager::getNumbeOfPagesViewed($current_user->getSID(), $contractIDs, $permission);
foreach ($contractIDs as $contractID) {
if ($acl->getPermissionParams($permission, $contractID, 'contract')) {
$params = $acl->getPermissionParams($permission, $contractID, 'contract');
$viewsLeft = SJB_ContractManager::getNumbeOfPagesViewed($current_user->getSID(), array($contractID), $permission);
if (isset($viewContactInfo['count_views']) && is_numeric($params)) {
$viewContactInfo['count_views'] += $params;
if ($params > $viewsLeft) {
$viewContactInfo['contract_id'] = $contractID;
//.........这里部分代码省略.........