本文整理汇总了PHP中SJB_System::getSettingByName方法的典型用法代码示例。如果您正苦于以下问题:PHP SJB_System::getSettingByName方法的具体用法?PHP SJB_System::getSettingByName怎么用?PHP SJB_System::getSettingByName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SJB_System
的用法示例。
在下文中一共展示了SJB_System::getSettingByName方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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;
}
示例2: 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;
}
示例3: init
public static function init()
{
if (SJB_System::getSettingByName('google_TrackingID') != '') {
$page_head = '<script type="text/javascript">' . 'var _gaq = _gaq || [];' . '_gaq.push(["_setAccount", "' . SJB_System::getSettingByName('google_TrackingID') . '"]);' . '_gaq.push(["_addOrganic", "images.yandex.ru", "text"]);' . '_gaq.push(["_addOrganic", "images.google.ru", "q"]);' . '_gaq.push(["_addOrganic", "go.mail.ru", "q"]);' . '_gaq.push(["_addOrganic", "gogo.ru", "q"]);' . '_gaq.push(["_addOrganic", "nova.rambler.ru", "query"]);' . '_gaq.push(["_addOrganic", "rambler.ru", "words"]);' . '_gaq.push(["_addOrganic", "google.com.ua", "q"]);' . '_gaq.push(["_addOrganic", "search.ua", "q"]);' . '_gaq.push(["_setDomainName", "none"]);' . '_gaq.push(["_setAllowLinker", true]);' . '_gaq.push(["_trackPageview"]);' . '(function() {' . 'var ga = document.createElement("script"); ga.type = "text/javascript"; ga.async = true;' . 'ga.src = ("https:" == document.location.protocol ? "https://ssl" : "http://www") + ".google-analytics.com/ga.js";' . 'var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(ga, s);' . '})();' . '</script>';
$head = SJB_System::getPageHead();
SJB_System::setPageHead($head . ' ' . $page_head);
}
}
示例4: initialize
public function initialize()
{
self::$object = new Google_Client();
self::$object->setApplicationName('Google+ PHP SJB Application');
self::$object->setClientId(SJB_System::getSettingByName('oauth2_client_id'));
self::$object->setClientSecret(SJB_System::getSettingByName('client_secret'));
self::$object->setRedirectUri(SJB_System::getSystemSettings('SITE_URL') . '/social/?network=google_plus');
self::$object->setDeveloperKey(SJB_System::getSettingByName('developer_key'));
self::$object->setScopes($this->scopes);
return $this->getProfileInformation();
}
示例5: execute
public function execute()
{
if (class_exists('SJB_SocialPlugin') && in_array('linkedin', SJB_SocialPlugin::getAvailablePlugins()) && SJB_Settings::getSettingByName('li_allowShareJobs')) {
if (SJB_SocialPlugin::getProfileObject()) {
$listing = SJB_Request::getVar('listing');
$tp = SJB_System::getTemplateProcessor();
$tp->assign('articleUrl', urlencode(SJB_System::getSystemSettings('SITE_URL') . '/display-job/' . $listing['id'] . '/'));
$tp->assign('articleTitle', urlencode($listing['Title']));
$tp->assign('articleSummary', urlencode($listing['JobDescription']));
$tp->assign('articleSource', urlencode(SJB_System::getSettingByName('site_title')));
$tp->display('linkedin_share_button.tpl');
}
}
}
示例6: getPage
/**
*
* @param SJB_PageConfig $page_config
*/
public static function getPage($page_config)
{
SJB_System::setPageTitle($page_config->getPageTitle());
SJB_System::setGlobalTemplateVariable('user_page_uri', $page_config->getPageUri());
SJB_System::setPageKeywords($page_config->getPageKeywords());
SJB_System::setPageDescription($page_config->getPageDescription());
if ($page_config->getMainContentFunction() == 'add_listing') {
$passed_parameters_via_uri = SJB_Request::getVar('passed_parameters_via_uri', false);
if ($passed_parameters_via_uri) {
$passed_parameters_via_uri = SJB_UrlParamProvider::getParams();
if (isset($passed_parameters_via_uri[2])) {
$page_config->setMainContentFunction('add_listing_step');
}
}
}
$maincontent = SJB_System::executeFunction($page_config->getMainContentModule(), $page_config->getMainContentFunction(), $page_config->getParameters(), $page_config->getPageUri());
if ($page_config->hasRawOutput()) {
return $maincontent;
}
$page_templates_set_name = SJB_System::getSystemSettings('PAGE_TEMPLATES_MODULE_NAME');
$template_supplier = new SJB_TemplateSupplier($page_templates_set_name);
$tp = new SJB_TemplateProcessor($template_supplier);
// assign 'highlight_templates' variable to main or index template
if (SJB_Settings::getSettingByName('highlight_templates') == 1 && SJB_Request::getVar('admin_mode', false, 'COOKIE')) {
$tp->assign('highlight_templates', true);
}
if ($errors = SJB_Error::getErrorContent()) {
SJB_FlashMessages::getInstance()->addWarning($errors);
}
$tp->assign('MAIN_CONTENT', $maincontent);
$tp->registerGlobalVariables();
$tp->assign('sjb_version', SJB_System::getSystemSettings('SJB_VERSION'));
$template = $page_config->getPageTemplate();
$template_supplier->addContainerTemplate($template);
if (SJB_Request::isAjax()) {
$template = SJB_System::getSettingByName('default_page_template_by_http');
} elseif (SJB_FormBuilderManager::getIfBuilderModeIsSet()) {
$template = 'index_b.tpl';
} else {
if (empty($template)) {
$template = SJB_Settings::getSettingByName('DEFAULT_PAGE_TEMPLATE');
}
}
return $tp->fetch($template);
}
示例7: displayBlogContent
public static function displayBlogContent()
{
if (SJB_System::getSettingByName('display_blog_on_homepage') && SJB_System::getSettingByName('rss_url_for_wordpress') !== '') {
$url = SJB_System::getSettingByName('rss_url_for_wordpress');
try {
$feed = Zend_Feed::import($url);
} catch (Exception $ex) {
$feed = array();
}
$i18n = SJB_I18N::getInstance();
$items = array();
foreach ($feed as $feedItem) {
$date = new Zend_Date($feedItem->pubDate(), DATE_RSS, 'en_US');
$item = array('date' => $feedItem->pubDate() ? $i18n->getDate($date->toString()) : '', 'title' => $feedItem->title(), 'description' => $feedItem->description(), 'link' => $feedItem->link());
$items[] = $item;
}
return $items;
}
}
示例8: execute
public function execute()
{
$tp = SJB_System::getTemplateProcessor();
$action = SJB_Request::getVar('action');
$template = 'task_scheduler_settings.tpl';
$isPseudoCronEnabled = intval(SJB_Settings::getSettingByName('isPseudoCronEnabled')) == 1;
if (SJB_Request::getVar('command', null, 'post') == 'manage-pseudo-cron') {
SJB_Settings::updateSetting('isPseudoCronEnabled', SJB_Request::getVar('isEnabled', 'off', 'post') == 'on' ? '1' : '0');
SJB_Settings::updateSetting('numberOfPageViewsToExecCronIfExceeded', SJB_Request::getVar('numberOfPageViewsToExecCronIfExceeded', null, 'post'));
SJB_HelperFunctions::redirect(SJB_System::getSystemSettings('SITE_URL') . '/task-scheduler-settings');
}
$tp->assign('isPseudoCronEnabled', $isPseudoCronEnabled);
$numberOfPageViewsToExecCronIfExceeded = intval(SJB_Settings::getSettingByName('numberOfPageViewsToExecCronIfExceeded'));
$tp->assign('cronPath', SJB_BASE_DIR . 'cron/index.php');
$tp->assign('numberOfPageViewsToExecCronIfExceeded', $numberOfPageViewsToExecCronIfExceeded);
if ($action != 'log_view') {
$last_executed_date = SJB_System::getSettingByName('task_scheduler_last_executed_date');
$expired_listings_id = SJB_ListingManager::getExpiredListingsSID();
$count_expired_listings = count($expired_listings_id);
$expired_contracts_id = SJB_ContractManager::getExpiredContractsID();
$count_expired_contracts = count($expired_contracts_id);
$res = SJB_DB::query("SELECT * FROM `task_scheduler_log` ORDER BY `sid` DESC LIMIT 1");
$tp->assign('last_executed_date', $last_executed_date);
$tp->assign('task_scheduler_log', array_pop($res));
} else {
$log_file = array();
$res = SJB_DB::query("SELECT `log_text` FROM `task_scheduler_log` ORDER BY `sid` DESC LIMIT 30");
foreach ($res as $record) {
$text = $record['log_text'];
if ($text) {
$log_file[] = $text;
}
}
$tp->assign('log_content', $log_file);
$template = 'task_scheduler_log_view.tpl';
}
$tp->display($template);
}
示例9: execute
public function execute()
{
$page_id = SJB_Request::getVar('pageid', null);
if ($page_id) {
$tp = SJB_System::getTemplateProcessor();
$i18n = SJB_I18N::getInstance();
$lang = SJB_Request::getVar('lang', $i18n->getCurrentLanguage());
$staticContent = SJB_StaticContent::getStaticContentByIDAndLang($page_id, $lang);
if (empty($staticContent)) {
$def_lang = SJB_System::getSettingByName('i18n_default_language');
$staticContent = SJB_StaticContent::getStaticContentByIDAndLang($page_id, $def_lang);
}
if (!empty($staticContent)) {
if ($page_id == '404') {
$isLoggedIn = SJB_Authorization::isUserLoggedIn();
if ($isLoggedIn) {
$listingTypesInfo = SJB_ListingTypeManager::getAllListingTypesInfo();
$currentUserInfo = SJB_Authorization::getCurrentUserInfo();
$userGroupinfo = SJB_UserGroupManager::getUserGroupInfoBySID($currentUserInfo['user_group_sid']);
$acl = SJB_Acl::getInstance();
$tp->assign('acl', $acl);
$tp->assign('listingTypesInfo', $listingTypesInfo);
$tp->assign('userGroupInfo', $userGroupinfo);
}
$staticContent['content'] = htmlspecialchars_decode($staticContent['content']);
$tp->assign('isLoggedIn', $isLoggedIn);
}
if (empty($staticContent['content'])) {
// Null создаёт ошибку в smarty
$staticContent['content'] = '';
}
$tp->assign('staticContent', $staticContent['content']);
$tp->display('static_content.tpl');
}
}
}
示例10: getResolvedUserGroupsByNetwork
public static function getResolvedUserGroupsByNetwork($socNetwork = null)
{
if (!$socNetwork) {
$socNetwork = self::getNetwork();
}
return explode(',', SJB_System::getSettingByName($socNetwork . '_userGroup'));
}
示例11: isCaptchaEnable
/**
* @return bool
*/
private function isCaptchaEnable()
{
$isCaptcha = false;
if (SJB_PluginManager::isPluginActive('CaptchaPlugin') && SJB_Session::getValue('CURRENT_THEME') != 'mobile') {
$userType = SJB_System::getSystemSettings('SYSTEM_ACCESS_TYPE') != SJB_System::getSystemSettings('ADMIN_ACCESS_TYPE') ? 'user' : 'admin';
$captchaSettingName = '';
if (!($currentFunction = SJB_Request::getVar('currentFunction'))) {
$currentFunction = SJB_Array::get(SJB_System::getModuleManager()->getCurrentFunction(), 1);
}
switch ($currentFunction) {
case 'apply_now':
$captchaSettingName = 'contactUserCaptcha';
break;
case 'flag_listing':
$captchaSettingName = 'flagListingCaptcha';
break;
case 'tell_friend':
$captchaSettingName = 'tellFriendCaptcha';
break;
case 'contact_form':
$captchaSettingName = 'contactUsCaptcha';
break;
default:
if (SJB_System::getSettingByName('captcha_max_allowed_auth_attempts') != 0) {
if (SJB_Session::getValue($userType . 'LoginCounter') >= SJB_System::getSettingByName('captcha_max_allowed_auth_attempts')) {
$isCaptcha = true;
if (SJB_Session::getValue($userType . 'LoginCounter') == SJB_System::getSettingByName('captcha_max_allowed_auth_attempts')) {
SJB_Session::setValue($userType . 'LoginCounter', SJB_Session::getValue($userType . 'LoginCounter') + 1);
$this->isNotValidate = true;
}
}
}
}
if (!$isCaptcha) {
$isCaptcha = SJB_System::getSettingByName($captchaSettingName) == 1;
}
}
return $isCaptcha;
}
示例12: uploadImage
function uploadImage($image_file_name, $image_caption)
{
$image_info = getimagesize($image_file_name);
// $image_info['2'] = 1 {GIF}, 2 {JPG}, 3 {PNG}, 4 {SWF}, 5 {PSD}, 6 {BMP}, 7 {TIFF}, 8 {TIFF}, 9 {JPC}, 10 {JP2}, 11 {JPX}
if ($image_info['2'] >= 1 && $image_info['2'] <= 3) {
if ($image_info['2'] == 1) {
$image_resource = imagecreatefromgif($image_file_name);
} elseif ($image_info['2'] == 2) {
$image_resource = imagecreatefromjpeg($image_file_name);
} else {
$image_resource = imagecreatefrompng($image_file_name);
}
$picture_max_size['width'] = SJB_System::getSettingByName('listing_picture_width');
$picture_max_size['height'] = SJB_System::getSettingByName('listing_picture_height');
$picture_resource = $this->getResizedImageResource($image_resource, $picture_max_size);
$thumb_max_size['width'] = SJB_System::getSettingByName('listing_thumbnail_width');
$thumb_max_size['height'] = SJB_System::getSettingByName('listing_thumbnail_height');
$thumb_resource = $this->getResizedImageResource($image_resource, $thumb_max_size);
$max_order = SJB_DB::queryValue("SELECT MAX(`order`) FROM listings_pictures WHERE `listing_sid` = ?n", $this->listing_sid);
$max_order = empty($max_order) ? 0 : $max_order;
$order = $max_order + 1;
$upload_file_directory = SJB_System::getSystemSettings('UPLOAD_FILES_DIRECTORY');
$picture_sid = SJB_DB::query("INSERT INTO listings_pictures" . " SET `listing_sid` = ?n, `caption` = ?s, `order` = ?n", $this->listing_sid, mb_substr($image_caption, 0, 255), $order);
$picture_file_basename = 'picture_' . $picture_sid . '.jpg';
$thumb_file_basename = 'thumb_' . $picture_sid . '.jpg';
$picture_name = $upload_file_directory . "/pictures/" . $picture_file_basename;
$thumb_name = $upload_file_directory . "/pictures/" . $thumb_file_basename;
imagejpeg($picture_resource, $picture_name);
imagejpeg($thumb_resource, $thumb_name);
SJB_DB::query("UPDATE listings_pictures SET `picture_saved_name` = ?s, `thumb_saved_name` = ?s WHERE sid = ?n", $picture_file_basename, $thumb_file_basename, $picture_sid);
$this->setListingPictureAmount($this->getPicturesAmount());
} else {
$this->error = 'NOT_SUPPORTED_IMAGE_FORMAT';
return false;
}
}
示例13: execute
public function execute()
{
$tp = SJB_System::getTemplateProcessor();
$tp->assign('terms_of_use_check', SJB_System::getSettingByName('terms_of_use_check'));
$user_group_id = SJB_Request::getVar('user_group_id', null);
$form_submitted = isset($_REQUEST['action']) && $_REQUEST['action'] == 'register';
if (!is_null($user_group_id)) {
$user_group_sid = SJB_UserGroupManager::getUserGroupSIDByID($user_group_id);
/**
* check if registration is allowed for this UserGroup
*/
if (!SJB_SocialPlugin::ifRegistrationIsAllowedByUserGroupSID($user_group_sid)) {
return null;
}
$user_group_info = SJB_UserGroupManager::getUserGroupInfoBySID($user_group_sid);
$user = SJB_ObjectMother::createUser($_REQUEST, $user_group_sid);
$user->deleteProperty('active');
$user->deleteProperty('featured');
$errors = array();
// social plugin
if ($form_submitted) {
SJB_Event::dispatch('SocialPlugin_AddListingFieldsIntoRegistration', $user, true);
SJB_Event::dispatch('MakeRegistrationFieldsNotRequired_SocialPlugin', $user, true);
} else {
SJB_Event::dispatch('PrepareRegistrationFields_SocialPlugin', $user, true);
SJB_Event::dispatch('SocialPlugin_AddListingFieldsIntoRegistration', $user, true);
SJB_Event::dispatch('FillRegistrationData_Plugin', $user, true);
}
$registration_form = SJB_ObjectMother::createForm($user);
$registration_form->registerTags($tp);
if ($form_submitted && $registration_form->isDataValid($errors)) {
SJB_Event::dispatch('FillRegistrationData_Plugin', $user, true);
SJB_Event::dispatch('AddReferencePluginDetails', $user, true);
$user->deleteProperty('captcha');
$user->deleteProperty('active');
$user->deleteProperty('featured');
SJB_UserManager::saveUser($user);
SJB_Statistics::addStatistics('addUser', $user->getUserGroupSID(), $user->getSID(), false, 0, 0, false, 0, SJB_SocialPlugin::getNetwork());
SJB_Statistics::addStatistics('addUser' . SJB_SocialPlugin::getNetwork(), $user->getUserGroupSID(), $user->getSID(), false, 0, 0, false, 0, SJB_SocialPlugin::getNetwork());
// subscribe user on default product
$defaultProduct = SJB_UserGroupManager::getDefaultProduct($user_group_sid);
$availableProductIDs = SJB_ProductsManager::getProductsIDsByUserGroupSID($user_group_sid);
if ($defaultProduct && in_array($defaultProduct, $availableProductIDs)) {
$contract = new SJB_Contract(array('product_sid' => $defaultProduct));
$contract->setUserSID($user->getSID());
$contract->saveInDB();
}
SJB_SocialPlugin::sendUserSocialRegistrationLetter($user);
// notify administrator
SJB_AdminNotifications::sendAdminUserRegistrationLetter($user);
// Activation
$isSendActivationEmail = SJB_UserGroupManager::isSendActivationEmail($user_group_sid);
$isApproveByAdmin = SJB_UserGroupManager::isApproveByAdmin($user_group_sid);
if ($isApproveByAdmin) {
SJB_UserManager::setApprovalStatusByUserName($user->getUserName(), 'Pending');
}
if ($isSendActivationEmail) {
$isSent = SJB_Notifications::sendUserActivationLetter($user->getSID());
if ($isSent) {
$tp->display('../users/registration_confirm.tpl');
} else {
$tp->display('../users/registration_failed_to_send_activation_email.tpl');
}
} else {
if (!$isSendActivationEmail && $isApproveByAdmin) {
SJB_UserManager::setApprovalStatusByUserName($user->getUserName(), 'Pending');
$tp->display('../users/registration_pending.tpl');
} else {
SJB_UserManager::activateUserByUserName($user->getUserName());
$errors = array();
SJB_Authorization::login($user->getUserName(), $user->getPropertyValue('password'), false, $errors, false);
// save access token, profile info for synchronization
SJB_SocialPlugin::postRegistration();
$tp->assign('socialNetwork', SJB_SocialPlugin::getNetwork());
$pageId = !empty($user_group_info['after_registration_redirect_to']) ? $user_group_info['after_registration_redirect_to'] : '';
$redirectUrl = SJB_UserGroupManager::getRedirectUrlByPageID($pageId);
SJB_HelperFunctions::redirect($redirectUrl);
}
}
} else {
// social plugin
SJB_Event::dispatch('PrepareRegistrationFields_SocialPlugin', $user, true);
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);
$registration_form_template = '../users/registration_form.tpl';
if (isset($_REQUEST['reg_form_template'])) {
$registration_form_template = $_REQUEST['reg_form_template'];
} elseif (!empty($user_group_info['reg_form_template'])) {
$registration_form_template = $user_group_info['reg_form_template'];
}
$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);
//.........这里部分代码省略.........
示例14: execute
public function execute()
{
$this->redirectToListingByKeywords();
// SEO friendly URL for company profile
$m = array();
$isCompanyProfilePage = false;
if (preg_match('#/company/([0-9]+)/.*#', SJB_Navigator::getURI(), $m)) {
$isCompanyProfilePage = true;
$params = SJB_FixedUrlParamProvider::getParams($_REQUEST);
if (!empty($params)) {
$aliasUsername = SJB_UserManager::getUserNameByUserSID($m[1]);
if (!empty($aliasUsername)) {
$_REQUEST['username']['equal'] = $aliasUsername;
$_REQUEST['anonymous']['equal'] = 0;
}
}
}
if (!empty($_REQUEST['username']['equal']) && is_int($_REQUEST['username']['equal'])) {
$aliasUsername = SJB_UserManager::getUserNameByUserSID(intval($_REQUEST['username']['equal']));
if (!empty($aliasUsername)) {
$_REQUEST['username']['equal'] = $aliasUsername;
}
}
$listingTypeId = SJB_Request::getVar('listing_type_id', 0);
if (!$listingTypeId) {
$listingTypeId = isset($_REQUEST['listing_type']['equal']) ? $_REQUEST['listing_type']['equal'] : SJB_Session::getValue('listing_type_id');
}
if ($listingTypeId) {
$_REQUEST['listing_type']['equal'] = $listingTypeId;
}
$action = SJB_Request::getVar('action', 'search');
//XSS defense
$searchId = SJB_Request::getVar('searchId', false);
if ($searchId && !is_numeric($searchId)) {
$_REQUEST['searchId'] = false;
}
$request = $_REQUEST;
if (SJB_System::getSettingByName('turn_on_refine_search_' . $listingTypeId)) {
switch ($action) {
case 'refine':
$searchID = SJB_Request::getVar('searchId', false);
unset($request['searchId']);
$criteria_saver = new SJB_ListingCriteriaSaver($searchID);
$request = SJB_RefineSearch::mergeCriteria($criteria_saver->getCriteria(), $request);
break;
case 'undo':
$param = SJB_Request::getVar('param', false);
$field_type = SJB_Request::getVar('type', false);
$value = SJB_Request::getVar('value', false);
if ($param && $field_type && $value) {
$searchID = SJB_Request::getVar('searchId', false);
unset($request['searchId']);
$criteria_saver = new SJB_ListingCriteriaSaver($searchID);
$criteria = $criteria_saver->criteria;
if (isset($criteria[$param][$field_type])) {
switch ($field_type) {
case 'geo':
if ($criteria[$param][$field_type]['location'] == $value) {
unset($criteria[$param]);
}
break;
case 'monetary':
if ($criteria[$param][$field_type]['not_less'] == $value) {
$criteria[$param][$field_type]['not_less'] = "";
}
if ($criteria[$param][$field_type]['not_more'] == $value) {
$criteria[$param][$field_type]['not_more'] = "";
}
break;
case 'tree':
// search params incoming as string, where params separated by ','
// we need to undo one of them
$params = explode(',', $criteria[$param][$field_type]);
$params = array_flip($params);
unset($params[$value]);
$params = array_flip($params);
$criteria[$param][$field_type] = implode(',', $params);
break;
default:
if (is_array($criteria[$param][$field_type])) {
foreach ($criteria[$param][$field_type] as $key => $val) {
if ($val == $value) {
unset($criteria[$param][$field_type][$key]);
}
}
} else {
unset($criteria[$param]);
}
break;
}
}
$criteria['default_sorting_field'] = $request['default_sorting_field'];
$criteria['default_sorting_order'] = $request['default_sorting_order'];
$criteria['default_listings_per_page'] = $request['default_listings_per_page'];
$criteria['results_template'] = $request['results_template'];
$request = array_merge($criteria, $request);
}
break;
}
}
//.........这里部分代码省略.........
示例15: _getChargedTemplateProcessor
function _getChargedTemplateProcessor(&$listings_structure)
{
$tp = SJB_System::getTemplateProcessor();
$searchCriteria = $this->criteria_saver->getCriteria();
$listing_type_info = SJB_ListingTypeManager::getListingTypeInfoBySID($this->listing_type_sid);
if (!empty($listing_type_info['show_brief_or_detailed'])) {
$is_show_brief_or_detailed = $listing_type_info['show_brief_or_detailed'];
$show_brief_or_detailed = $this->criteria_saver->getBriefOrDetailedSearch();
$tp->assign("is_show_brief_or_detailed", $is_show_brief_or_detailed);
$tp->assign("show_brief_or_detailed", $show_brief_or_detailed);
}
$keywordsHighlight = '';
if (isset($searchCriteria['keywords']) && SJB_System::getSettingByName('use_highlight_for_keywords')) {
foreach ($searchCriteria['keywords'] as $type => $keywords) {
$keywordsTrim = trim($keywords);
if (!empty($keywordsTrim)) {
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;
}
}
}
}
$view = !empty($this->requested_data['view']) ? $this->requested_data['view'] : 'list';
$tp->assign("keywordsHighlight", $keywordsHighlight);
$tp->assign("sorting_field", $this->listing_search_structure['sorting_field']);
$tp->assign("sorting_order", $this->listing_search_structure['sorting_order']);
$tp->assign("listing_search", $this->listing_search_structure);
$tp->assign("listings", $listings_structure);
$tp->assign("searchId", $this->searchId);
$tp->assign("view_on_map", SJB_System::getSettingByName('view_on_map'));
$tp->assign("view", $view);
$listing = new SJB_Listing(array(), $this->listing_type_sid);
$user = new SJB_User(array());
$listing_structure_meta_data = SJB_ListingManager::createMetadataForListing($listing, $user);
if (isset($searchCriteria['username']['equal'])) {
$userSID = SJB_UserManager::getUserSIDbyUsername($searchCriteria['username']['equal']);
$user = SJB_UserManager::getObjectBySID($userSID);
$userInfo = !empty($user) ? SJB_UserManager::createTemplateStructureForUser($user) : null;
$tp->assign("userInfo", $userInfo);
}
if (isset($searchCriteria['listing_type']['equal']) && SJB_System::getSettingByName('turn_on_refine_search_' . $searchCriteria['listing_type']['equal']) && $this->useRefine) {
$tp->assign("refineSearch", true);
}
$metaDataProvider = SJB_ObjectMother::getMetaDataProvider();
$metadata = array("listing" => $metaDataProvider->getMetaData($listing_structure_meta_data));
$tp->assign("METADATA", $metadata);
return $tp;
}