예제 #1
0
    public function doBackup()
    {
        $settings = SJB_Settings::getSettings();
        if ($settings['autobackup'] && !SJB_System::getSystemSettings('isDemo') && !SJB_System::getIfTrialModeIsOn()) {
            $dirSeparator = DIRECTORY_SEPARATOR;
            $scriptPath = explode(SJB_System::getSystemSettings('SYSTEM_URL_BASE'), __FILE__);
            $scriptPath = array_shift($scriptPath);
            $path = $scriptPath . 'backup' . $dirSeparator;
            $identifier = time();
            $backupsArr = $this->getAllBackups($path);
            $this->deleteBackupAfterExpired($backupsArr);
            if ($this->isAutobackup()) {
                SessionStorage::destroy('backup_' . $identifier);
                SessionStorage::write('backup_' . $identifier, serialize(array('last_time' => time())));
                SJB_Session::unsetValue('restore');
                SJB_Session::unsetValue('error');
                $backupDir = $scriptPath . 'backup' . $dirSeparator;
                if (!is_dir($backupDir)) {
                    mkdir($backupDir);
                }
                if (!file_exists($backupDir . '.htaccess')) {
                    $handle = fopen($backupDir . '.htaccess', 'a');
                    $text = '# Apache 2.4
<IfModule mod_authz_core.c>
	<FilesMatch ".*">
		Require all denied
	</FilesMatch>
</IfModule>

# Apache 2.2
<IfModule !mod_authz_core.c>
	<FilesMatch ".*">
		Order Allow,Deny
		Deny from all
	</FilesMatch>
</IfModule>';
                    fwrite($handle, $text);
                    fclose($handle);
                }
                $backupType = SJB_System::getSettingByName('backup_type');
                switch ($backupType) {
                    case 'full':
                        $this->makeFullBackup($identifier, $scriptPath, $dirSeparator);
                        break;
                    case 'database':
                        $this->makeDatabaseBackup($identifier, $dirSeparator, $scriptPath);
                        break;
                    case 'files':
                        $this->makeFilesBackup($identifier, $scriptPath, $dirSeparator);
                        break;
                }
                SJB_Settings::updateSetting('last_autobackup', date("Y-m-d H:i:s"));
            }
        }
    }
예제 #2
0
 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);
 }
예제 #3
0
파일: filters.php 프로젝트: Maxlander/shixi
 public function execute()
 {
     $tp = SJB_System::getTemplateProcessor();
     $action = SJB_Request::getVar('action', '');
     $htmltags = SJB_Settings::getSettingByName('htmltags');
     $htmltags = array_keys(unserialize($htmltags));
     if ($action == 'Save') {
         $tags = SJB_Request::getVar('tags', false);
         $filter = '';
         if ($tags) {
             foreach ($tags as $key => $val) {
                 if ($key == 'br') {
                     $filter .= "<{$key}>,<{$key}/>,<{$key} />,";
                 } else {
                     $filter .= "<" . $key . '>,';
                 }
             }
             if ($filter != '') {
                 $filter = substr($filter, 0, -1);
             }
         }
         SJB_Settings::updateSetting("htmlFilter", $filter);
     }
     $savedFilters = SJB_Settings::getSettingByName('htmlFilter');
     $savedFilters = $savedFilters ? explode(',', $savedFilters) : $savedFilters;
     $savedFilters = !empty($savedFilters) ? str_replace('<', '', str_replace('>', '', $savedFilters)) : array();
     $savedFiltersArray = array();
     $checkStyle = !empty($savedFilters) ? "checked = checked" : "";
     foreach ($savedFilters as $val) {
         $savedFiltersArray[$val] = 'checked';
     }
     $tp->assign('htmltags', $htmltags);
     $tp->assign('checkStyle', $checkStyle);
     $tp->assign('rowsInColumn', round(count($htmltags) / 2) + 1);
     $tp->assign('savedFilters', $savedFiltersArray);
     $tp->display('filters.tpl');
 }
예제 #4
0
 public function execute()
 {
     $tp = SJB_System::getTemplateProcessor();
     $theme = SJB_Settings::getValue('TEMPLATE_USER_THEME', 'default');
     $tp->assign('theme', $theme);
     $errors = array();
     $message = '';
     $alternativeText = SJB_Request::getVar('logoAlternativeText', '');
     switch (SJB_Request::getVar('action', '')) {
         case 'save':
             if (isset($_FILES['logo']['error'])) {
                 if ($_FILES['logo']['error'] == UPLOAD_ERR_OK) {
                     if (SJB_System::getSystemSettings('isDemo')) {
                         $errors[] = 'NOT_ALLOWED_IN_DEMO';
                     } else {
                         $themePath = SJB_TemplatePathManager::getAbsoluteThemePath($theme);
                         if (move_uploaded_file($_FILES['logo']['tmp_name'], "{$themePath}main/images/logo.png")) {
                             $message = 'Logo has been uploaded successfully';
                         }
                     }
                 } else {
                     switch ($_FILES['logo']['error']) {
                         case UPLOAD_ERR_INI_SIZE:
                             $errors[] = 'File size exceeds system limit. Please check the file size limits on your hosting or upload another file.';
                             break;
                         case UPLOAD_ERR_FORM_SIZE:
                             $errors[] = 'The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form';
                             break;
                         case UPLOAD_ERR_PARTIAL:
                             $errors[] = 'The uploaded file was only partially uploaded';
                             break;
                         case UPLOAD_ERR_NO_FILE:
                             // Разрешим изменять текст без аплоада лого
                             break;
                         case UPLOAD_ERR_NO_TMP_DIR:
                             $errors[] = 'Missing a temporary folder';
                             break;
                         case UPLOAD_ERR_CANT_WRITE:
                             $errors[] = 'Failed to write file to disk';
                             break;
                         default:
                             $errors[] = 'File upload error';
                     }
                     if ($alternativeText == SJB_Settings::getSettingByName('logoAlternativeText')) {
                         $errors[] = 'Upload a logo or enter alternative text';
                     }
                 }
             }
             if (SJB_Settings::getSettingByName('logoAlternativeText') === false) {
                 SJB_Settings::addSetting('logoAlternativeText', $alternativeText);
             } else {
                 if ($alternativeText != SJB_Settings::getSettingByName('logoAlternativeText')) {
                     SJB_Settings::updateSetting('logoAlternativeText', $alternativeText);
                     if (!$message) {
                         $message = 'Alternative text has been updated successfully';
                     } else {
                         $message = 'Logo and Alternative text has been uploaded successfully';
                     }
                 }
             }
             break;
     }
     $tp->assign('errors', $errors);
     $tp->assign('message', $message);
     $tp->assign('uploadMaxFilesize', SJB_UploadFileManager::getIniUploadMaxFilesize());
     $tp->assign('logoAlternativeText', SJB_Request::getVar('logoAlternativeText', SJB_Settings::getSettingByName('logoAlternativeText')));
     $tp->display('upload_logo.tpl');
 }
예제 #5
0
파일: states.php 프로젝트: Maxlander/shixi
 public function execute()
 {
     $tp = SJB_System::getTemplateProcessor();
     $action = SJB_Request::getVar('action', 'list');
     $countrySID = SJB_Request::getVar('country_sid', false);
     $errors = array();
     $template = 'states.tpl';
     $countries = SJB_CountriesManager::getAllCountries();
     $paginator = new SJB_StatesPagination();
     switch ($action) {
         case 'move_state':
         case 'save_order':
             $template = 'move_state.tpl';
             $itemSIDs = SJB_Request::getVar('item_order', array());
             try {
                 SJB_StatesManager::saveItemsOrder($paginator->currentPage, $paginator->itemsPerPage, $itemSIDs);
                 $tp->assign('action', $action);
             } catch (Exception $e) {
                 $errors['SAVING_ORDER'] = $e->getMessage();
             }
             $states = SJB_StatesManager::getAllStates($countrySID);
             $tp->assign('states', $states);
             break;
         case 'activate':
             $statesSIDs = array_keys(SJB_Request::getVar('states', array()));
             foreach ($statesSIDs as $stateSID) {
                 SJB_StatesManager::activateStateBySID($stateSID);
             }
             $action = 'list';
             break;
         case 'deactivate':
             $statesSIDs = array_keys(SJB_Request::getVar('states', array()));
             foreach ($statesSIDs as $stateSID) {
                 SJB_StatesManager::deactivateStateBySID($stateSID);
             }
             $action = 'list';
             break;
         case 'delete':
             $statesSIDs = array_keys(SJB_Request::getVar('states', array()));
             foreach ($statesSIDs as $stateSID) {
                 SJB_StatesManager::deleteStateBySID($stateSID);
             }
             $action = 'list';
             break;
         case 'add_state':
             $template = 'add_state.tpl';
             $formSubmitted = SJB_Request::getVar('action_add', false);
             $state = new SJB_State($_REQUEST);
             $addStateForm = new SJB_Form($state);
             $addStateForm->registerTags($tp);
             $addValidParam = array('field' => 'country_sid', 'value' => $countrySID);
             if ($formSubmitted && $addStateForm->isDataValid($errors, $addValidParam)) {
                 $state->addProperty(array('id' => 'country_sid', 'type' => 'list', 'value' => $countrySID, 'is_required' => true, 'is_system' => true));
                 SJB_StatesManager::saveState($state);
                 SJB_HelperFunctions::redirect(SJB_System::getSystemSettings('SITE_URL') . "/states/?country_sid=" . $countrySID);
             } else {
                 $formFields = $addStateForm->getFormFieldsInfo();
                 $tp->assign('form_fields', $formFields);
             }
             break;
         case 'edit_state':
             $template = 'edit_state.tpl';
             $stateSID = SJB_Request::getVar('state_id', false);
             $formSubmitted = SJB_Request::getVar('action_add', false);
             $stateInfo = SJB_StatesManager::getStateInfoBySID($stateSID);
             if ($stateInfo) {
                 $stateInfo = array_merge($stateInfo, $_REQUEST);
                 $state = new SJB_State($stateInfo);
                 $addStateForm = new SJB_Form($state);
                 $addStateForm->registerTags($tp);
                 $state->setSID($stateSID);
                 $addValidParam = array('field' => 'country_sid', 'value' => $stateInfo['country_sid']);
                 if ($formSubmitted && $addStateForm->isDataValid($errors, $addValidParam)) {
                     SJB_StatesManager::saveState($state);
                     SJB_HelperFunctions::redirect(SJB_System::getSystemSettings('SITE_URL') . "/states/?country_sid=" . $stateInfo['country_sid']);
                 } else {
                     $formFields = $addStateForm->getFormFieldsInfo();
                     $tp->assign('form_fields', $formFields);
                     $tp->assign('state_id', $stateSID);
                 }
             } else {
                 $tp->assign('action', 'edit');
                 $errors['WRONG_STATE_ID_SPECIFIED'] = 'WRONG_STATE_ID_SPECIFIED';
                 $template = 'state_errors.tpl';
             }
             break;
         case 'import_states':
             $template = 'import_states.tpl';
             $fileInfo = isset($_FILES['import_file']) ? $_FILES['import_file'] : null;
             $tp->assign("uploadMaxFilesize", SJB_UploadFileManager::getIniUploadMaxFilesize());
             if ($fileInfo['error']) {
                 $errors[] = SJB_UploadFileManager::getErrorId($fileInfo['error']);
             } elseif ($fileInfo) {
                 $fileFormats = array('csv', 'xls', 'xlsx');
                 $pathInfo = pathinfo($fileInfo['name']);
                 $fileExtension = isset($pathInfo['extension']) ? strtolower($pathInfo['extension']) : '';
                 if (!in_array(strtolower($fileExtension), $fileFormats)) {
                     $errors[] = 'Please choose Excel or csv file';
                 } else {
                     $importFile = new SJB_ImportFileXLS($fileInfo);
                     $importFile->parse();
                     $importedData = $importFile->getData();
                     $state = new SJB_State();
                     $count = 0;
                     foreach ($importedData as $key => $importedColumn) {
                         if ($key == 1) {
                             $data = array_merge(array(array('state_code', 'state_name')), array($importedColumn));
                             $importedProcessor = new SJB_ImportedStateProcessor($data, $state);
                         }
                         if (!$importedColumn) {
                             continue;
                         }
                         $stateInfo = $importedProcessor->getData($importedColumn);
                         if (!empty($stateInfo['state_code']) && !empty($stateInfo['state_name'])) {
                             $state = new SJB_State($stateInfo);
                             $state->addProperty(array('id' => 'country_sid', 'type' => 'list', 'value' => $countrySID, 'is_required' => true, 'is_system' => true));
                             $state->setPropertyValue('active', 1);
                             $stateSID = SJB_StatesManager::getStateSIDByStateCode($stateInfo['state_code'], $countrySID);
                             if ($stateSID) {
                                 $state->setSID($stateSID);
                             } else {
                                 $count++;
                             }
                             SJB_StatesManager::saveState($state);
                         }
                     }
                     $tp->assign('imported_states_count', $count);
                     $template = 'import_states_result.tpl';
                 }
             }
             break;
     }
     if ($action == 'list') {
         $countryCode = SJB_Settings::getSettingByName('default_country_code');
         if (!$countrySID) {
             $countrySID = SJB_CountriesManager::getCountrySIDByCountryCode($countryCode);
         }
         if (!$countrySID) {
             $allCountries = SJB_CountriesManager::getAllCountries();
             foreach ($allCountries as $country) {
                 $countrySID = $country['sid'];
                 break;
             }
         }
         $countryInfo = SJB_CountriesManager::getCountryInfoBySID($countrySID);
         if ($countryInfo && $countryInfo['country_code'] != $countryCode) {
             SJB_Settings::updateSetting('default_country_code', $countryInfo['country_code']);
         }
         $states = SJB_StatesManager::getAllStates($countrySID, ($paginator->currentPage - 1) * $paginator->itemsPerPage, $paginator->itemsPerPage);
         $paginator->setItemsCount(SJB_StatesManager::countStates($countrySID));
         $tp->assign('states', $states);
         $tp->assign('paginationInfo', $paginator->getPaginationInfo());
     }
     $tp->assign("countries", $countries);
     $tp->assign("country_sid", $countrySID);
     $tp->assign("errors", $errors);
     $tp->display($template);
 }
예제 #6
0
 private function unlockPatchDatabaseOnlyUsingSJB()
 {
     SJB_Settings::updateSetting('patchDatabaseOnlyUsingSJB', '0');
 }
예제 #7
0
    private function runTaskScheduler()
    {
        // Deactivate Expired Listings & Send Notifications
        $listingsExpiredID = SJB_ListingManager::getExpiredListingsSID();
        foreach ($listingsExpiredID as $listingExpiredID) {
            SJB_ListingManager::deactivateListingBySID($listingExpiredID, true);
            $listing = SJB_ListingManager::getObjectBySID($listingExpiredID);
            $listingInfo = SJB_ListingManager::createTemplateStructureForListing($listing);
            if (SJB_UserNotificationsManager::isUserNotifiedOnListingExpiration($listing->getUserSID())) {
                SJB_Notifications::sendUserListingExpiredLetter($listingInfo);
            }
            // notify admin
            SJB_AdminNotifications::sendAdminListingExpiredLetter($listingInfo);
        }
        $listingsDeactivatedID = array();
        if (SJB_Settings::getSettingByName('automatically_delete_expired_listings')) {
            $listingsDeactivatedID = SJB_ListingManager::getDeactivatedListingsSID();
            foreach ($listingsDeactivatedID as $listingID) {
                SJB_ListingManager::deleteListingBySID($listingID);
            }
        }
        SJB_ListingManager::unFeaturedListings();
        SJB_ListingManager::unPriorityListings();
        SJB_Cache::getInstance()->clean('matchingAnyTag', array(SJB_Cache::TAG_LISTINGS));
        /////////////////////////// Send remind notifications about expiration of LISTINGS
        // 1. get user sids and days count of 'remind listing notification' setting = 1 from user_notifications table
        // 2. foreach user:
        //   - get listings with that expiration remind date
        //   - check every listing sid in DB table of sended. If sended - remove from send list
        //   - send notification with listings to user
        //   - write listings sid in DB table of sended notifications
        $notificationData = SJB_UserNotificationsManager::getUsersAndDaysOnListingExpirationRemind();
        foreach ($notificationData as $elem) {
            $userSID = $elem['user_sid'];
            $days = $elem['days'];
            $listingSIDs = SJB_ListingManager::getListingsIDByDaysLeftToExpired($userSID, $days);
            if (empty($listingSIDs)) {
                continue;
            }
            $listingsInfo = array();
            // check listings remind sended
            foreach ($listingSIDs as $key => $sid) {
                if (SJB_ListingManager::isListingNotificationSended($sid)) {
                    unset($listingSIDs[$key]);
                    continue;
                }
                $info = SJB_ListingManager::getListingInfoBySID($sid);
                $listingsInfo[$sid] = $info;
            }
            if (!empty($listingsInfo)) {
                // now only unsended listings we have in array
                // send listing notification
                foreach ($listingSIDs as $sid) {
                    SJB_Notifications::sendRemindListingExpirationLetter($userSID, $sid, $days);
                }
                // write listing id in DB table of sended notifications
                SJB_ListingManager::saveListingIDAsSendedNotificationsTable($listingSIDs);
            }
        }
        // Send Notifications for Expired Contracts
        $contractsExpiredID = SJB_ContractManager::getExpiredContractsID();
        foreach ($contractsExpiredID as $contractExpiredID) {
            $contractInfo = SJB_ContractManager::getInfo($contractExpiredID);
            $productInfo = SJB_ProductsManager::getProductInfoBySID($contractInfo['product_sid']);
            $userInfo = SJB_UserManager::getUserInfoBySID($contractInfo['user_sid']);
            $serializedExtraInfo = unserialize($contractInfo['serialized_extra_info']);
            if (!empty($serializedExtraInfo['featured_profile']) && !empty($userInfo['featured'])) {
                $contracts = SJB_ContractManager::getAllContractsInfoByUserSID($userInfo['sid']);
                $isFeatured = 0;
                foreach ($contracts as $contract) {
                    if ($contract['id'] != $contractExpiredID) {
                        $serializedExtraInfo = unserialize($contract['serialized_extra_info']);
                        if (!empty($serializedExtraInfo['featured'])) {
                            $isFeatured = 1;
                        }
                    }
                }
                if (!$isFeatured) {
                    SJB_UserManager::removeFromFeaturedBySID($userInfo['sid']);
                }
            }
            if (SJB_UserNotificationsManager::isUserNotifiedOnContractExpiration($contractInfo['user_sid'])) {
                SJB_Notifications::sendUserContractExpiredLetter($userInfo, $contractInfo, $productInfo);
            }
            // notify admin
            SJB_AdminNotifications::sendAdminUserContractExpiredLetter($userInfo['sid'], $contractInfo, $productInfo);
            SJB_ContractManager::deleteContract($contractExpiredID, $contractInfo['user_sid']);
        }
        //////////////////////// Send remind notifications about expiration of contracts
        // 1. get user sids and days count of 'remind subscription notification' setting = 1 from user_notifications table
        // 2. foreach user:
        //   - get contracts with that expiration remind date
        //   - check every contract sid in DB table of sended. If sended - remove from send list
        //   - send notification with contracts to user
        //   - write contract sid in DB table of sended contract notifications
        $notificationData = SJB_UserNotificationsManager::getUsersAndDaysOnSubscriptionExpirationRemind();
        foreach ($notificationData as $elem) {
            $userSID = $elem['user_sid'];
            $days = $elem['days'];
            $contractSIDs = SJB_ContractManager::getContractsIDByDaysLeftToExpired($userSID, $days);
            if (empty($contractSIDs)) {
                continue;
            }
            $contractsInfo = array();
            // check contracts sended
            foreach ($contractSIDs as $key => $sid) {
                if (SJB_ContractManager::isContractNotificationSended($sid)) {
                    unset($contractSIDs[$key]);
                    continue;
                }
                $info = SJB_ContractManager::getInfo($sid);
                $info['extra_info'] = !empty($info['serialized_extra_info']) ? unserialize($info['serialized_extra_info']) : '';
                $contractsInfo[$sid] = $info;
            }
            if (!empty($contractsInfo)) {
                // now only unsended contracts we have in array
                // send contract notification
                foreach ($contractSIDs as $sid) {
                    SJB_Notifications::sendRemindSubscriptionExpirationLetter($userSID, $contractsInfo[$sid], $days);
                }
                // write contract id in DB table of sended contract notifications
                SJB_ContractManager::saveContractIDAsSendedNotificationsTable($contractSIDs);
            }
        }
        // delete applications with no employer and job seeker
        $emptyApplications = SJB_DB::query('SELECT `id` FROM `applications` WHERE `show_js` = 0 AND `show_emp` = 0');
        foreach ($emptyApplications as $application) {
            SJB_Applications::remove($application['id']);
        }
        // NEWS
        $expiredNews = SJB_NewsManager::getExpiredNews();
        foreach ($expiredNews as $article) {
            SJB_NewsManager::deactivateItemBySID($article['sid']);
        }
        // LISTING XML IMPORT
        SJB_XmlImport::runImport();
        // UPDATE PAGES WITH FUNCTION EQUAL BROWSE(e.g. /browse-by-city/)
        SJB_BrowseDBManager::rebuildBrowses();
        //-------------------sitemap generator--------------------//
        SJB_System::executeFunction('miscellaneous', 'sitemap_generator');
        // CLEAR `error_log` TABLE
        $errorLogLifetime = SJB_System::getSettingByName('error_log_lifetime');
        $lifeTime = strtotime("-{$errorLogLifetime} days");
        if ($lifeTime > 0) {
            SJB_DB::query('DELETE FROM `error_log` WHERE `date` < ?t', $lifeTime);
        }
        SJB_Settings::updateSetting('task_scheduler_last_executed_date', $this->currentDate);
        $this->tp->assign('expired_listings_id', $listingsExpiredID);
        $this->tp->assign('deactivated_listings_id', $listingsDeactivatedID);
        $this->tp->assign('expired_contracts_id', $contractsExpiredID);
        $this->tp->assign('notified_saved_searches_id', $this->notifiedSavedSearchesSID);
        $schedulerLog = $this->tp->fetch('task_scheduler_log.tpl');
        SJB_HelperFunctions::writeCronLogFile('task_scheduler.log', $schedulerLog);
        SJB_DB::query('INSERT INTO `task_scheduler_log`
			(`last_executed_date`, `notifieds_sent`, `expired_listings`, `expired_contracts`, `log_text`)
			VALUES ( NOW(), ?n, ?n, ?n, ?s)', count($this->notifiedSavedSearchesSID), count($listingsExpiredID), count($contractsExpiredID), $schedulerLog);
        SJB_System::getModuleManager()->executeFunction('social', 'linkedin');
        SJB_System::getModuleManager()->executeFunction('social', 'facebook');
        SJB_System::getModuleManager()->executeFunction('classifieds', 'linkedin');
        SJB_System::getModuleManager()->executeFunction('classifieds', 'facebook');
        SJB_System::getModuleManager()->executeFunction('classifieds', 'twitter');
        SJB_Event::dispatch('task_scheduler_run');
    }
예제 #8
0
 public function execute()
 {
     $tp = SJB_System::getTemplateProcessor();
     $action = SJB_Request::getVar('action', false);
     $template = 'manage_taxes.tpl';
     $formSubmitted = SJB_Request::getVar('event', false);
     $field_errors = array();
     switch ($action) {
         case 'add':
             $taxInfo = $_REQUEST;
             $template = 'add_tax.tpl';
             $country = SJB_Request::getVar('Country', false);
             $state = SJB_Request::getVar('State', false);
             if (!isset($taxInfo['active'])) {
                 $taxInfo['active'] = 1;
             }
             $tax = new SJB_Taxes($taxInfo);
             $addTaxForm = new SJB_Form($tax);
             $addTaxForm->registerTags($tp);
             if ($formSubmitted) {
                 $addTaxForm->isDataValid($field_errors);
                 if (SJB_TaxesManager::isTaxExistByCountryAndState($country, $state)) {
                     $field_errors[] = 'NOT_UNIQUE_COUNTRY_AND_STATE';
                 }
                 if (!$field_errors) {
                     SJB_TaxesManager::saveTax($tax);
                     SJB_HelperFunctions::redirect(SJB_System::getSystemSettings('SITE_URL') . "/manage-taxes/");
                 }
             }
             $formFields = $addTaxForm->getFormFieldsInfo();
             $tp->assign("state_sid", intval($state));
             $tp->assign("form_fields", $formFields);
             $metaDataProvider = SJB_ObjectMother::getMetaDataProvider();
             $tp->assign("METADATA", array("form_fields" => $metaDataProvider->getFormFieldsMetadata($formFields)));
             break;
         case 'edit':
             $template = 'edit_tax.tpl';
             $taxSID = SJB_Request::getVar('sid', false);
             $taxInfo = SJB_TaxesManager::getTaxInfoBySID($taxSID);
             if ($taxInfo) {
                 $taxInfo = array_merge($taxInfo, $_REQUEST);
                 $country = $taxInfo['Country'];
                 $state = $taxInfo['State'];
                 $tax = new SJB_Taxes($taxInfo);
                 $editTaxForm = new SJB_Form($tax);
                 $editTaxForm->registerTags($tp);
                 $tax->setSID($taxSID);
                 if ($formSubmitted) {
                     $editTaxForm->isDataValid($field_errors);
                     if (SJB_TaxesManager::isTaxExistByCountryAndState($country, $state, $taxSID)) {
                         $field_errors[] = 'NOT_UNIQUE_COUNTRY_AND_STATE';
                     }
                     if (!$field_errors) {
                         SJB_TaxesManager::saveTax($tax);
                         if ($formSubmitted == 'save') {
                             SJB_HelperFunctions::redirect(SJB_System::getSystemSettings('SITE_URL') . "/manage-taxes/");
                         } else {
                             $tax->setFloatNumbersIntoValidFormat();
                         }
                     }
                 }
                 $formFields = $editTaxForm->getFormFieldsInfo();
                 $tp->assign("form_fields", $formFields);
                 $tp->assign("sid", $taxSID);
                 $tp->assign("state_sid", intval($state));
                 $metaDataProvider = SJB_ObjectMother::getMetaDataProvider();
                 $tp->assign("METADATA", array("form_fields" => $metaDataProvider->getFormFieldsMetadata($formFields)));
             } else {
                 $tp->assign('action', 'edit');
                 $field_errors[] = 'WRONG_TAX_ID_SPECIFIED';
                 $template = 'errors.tpl';
             }
             break;
         case 'delete':
             $taxSID = SJB_Request::getVar('sid', 0);
             SJB_TaxesManager::deleteTaxBySID($taxSID);
             SJB_HelperFunctions::redirect(SJB_System::getSystemSettings('SITE_URL') . "/manage-taxes/");
             break;
         case 'deactivate':
             $taxSID = SJB_Request::getVar('sid', 0);
             SJB_TaxesManager::deactivateTaxBySID($taxSID);
             SJB_HelperFunctions::redirect(SJB_System::getSystemSettings('SITE_URL') . "/manage-taxes/");
             break;
         case 'setting':
             $enableTaxes = SJB_Request::getVar('enable_taxes', 0);
             SJB_Settings::updateSetting('enable_taxes', $enableTaxes);
             SJB_HelperFunctions::redirect(SJB_System::getSystemSettings('SITE_URL') . "/manage-taxes/");
             break;
         case 'activate':
             $taxSID = SJB_Request::getVar('sid', 0);
             SJB_TaxesManager::activateTaxBySID($taxSID);
             SJB_HelperFunctions::redirect(SJB_System::getSystemSettings('SITE_URL') . "/manage-taxes/");
             break;
         default:
             $taxes_structure = array();
             $taxes = SJB_TaxesManager::getAllTaxesInfo();
             foreach ($taxes as $tax_info) {
                 $taxes_structure[$tax_info['sid']] = SJB_TaxesManager::createTemplateStructureForTax($tax_info);
             }
             $tp->assign('taxes', $taxes_structure);
             break;
     }
     $tp->assign('errors', $field_errors);
     $tp->display($template);
 }
예제 #9
0
 function setDefaultLang($lang_id)
 {
     return $this->settings->updateSetting('i18n_default_language', $lang_id);
 }
예제 #10
0
 public function execute()
 {
     $tp = SJB_System::getTemplateProcessor();
     $template_editor = new SJB_TemplateEditor();
     $module_name = SJB_Request::getVar('module_name', '', 'GET');
     // if set simple_view - not shown navigation to user
     $simple_view = SJB_Request::getVar('simple_view', false);
     if (!$template_editor->doesModuleExists($module_name)) {
         $module_name = '';
     }
     $template_name = SJB_Request::getVar('template_name', '', 'GET');
     if (!$template_editor->doesModuleTemplateExists($module_name, $template_name)) {
         $template_name = '';
     }
     $modules = $template_editor->getModuleWithTemplatesList();
     global $error;
     $error = array();
     $result = '';
     $highlight_setting = SJB_Request::getVar('highlight_templates');
     if (!is_null($highlight_setting)) {
         if (SJB_System::getSystemSettings("isDemo")) {
             $error[] = 'NOT_ALLOWED_IN_DEMO';
         } else {
             SJB_Settings::updateSetting('highlight_templates', $highlight_setting);
         }
     }
     $tp->assign('highlight_templates', SJB_Settings::getSettingByName('highlight_templates'));
     $action = SJB_Request::getVar('action', '');
     $form_submitted = SJB_Request::getVar('submit');
     //Clear Smarty Cache
     $clear_smarty_cache = SJB_Request::getVar('clear_cache_submit');
     if ($clear_smarty_cache) {
         $compiled_templates_dir = SJB_System::getSystemSettings('COMPILED_TEMPLATES_DIR');
         $admin_theme = ThemeManager::getCurrentTheme();
         $themes_list['user'] = $template_editor->getThemeList();
         $themes_list['admin'][] = $admin_theme;
         foreach ($themes_list as $access_type => $themes) {
             foreach ($themes as $theme) {
                 $destination = $compiled_templates_dir . $access_type . "/" . $theme;
                 $result = $tp->deleteCacheBySpecifiedPath($destination);
                 if (is_array($result)) {
                     $error = $result;
                 }
             }
         }
     }
     // actions
     if (!empty($action)) {
         $theme = SJB_Settings::getValue('TEMPLATE_USER_THEME', 'default');
         // TODO: !!!!если редактируется с юзерской части , то проверить есть ли тэмплэйт в теме , если нет , брать с _system
         switch ($action) {
             case 'delete':
                 $template_editor->deleteTemplate($template_name, $module_name, $theme);
                 SJB_HelperFunctions::redirect(SJB_System::getSystemSettings('SITE_URL') . '/edit-templates/?module_name=' . $module_name);
                 break;
             case 'edit':
             case 'add':
                 if (SJB_Request::getVar('templ_module') && SJB_Request::getVar('templ_name')) {
                     $newTemplName = trim(SJB_Request::getVar('templ_name'));
                     $newModuleName = SJB_Request::getVar('templ_module');
                     if (!$template_editor->isTemplateNameValid($newTemplName)) {
                         $error[] = 'NOT_VALID_FILENAME_FORMAT';
                     }
                     if (!$template_editor->doesModuleExists($newModuleName)) {
                         $error[] = 'MODULE_ERROR';
                     }
                     if (empty($error)) {
                         if ('edit' == $action) {
                             if ($template_editor->moveTemplate(SJB_Request::getVar('templ_name_or'), SJB_Request::getVar('templ_module_or'), $theme, $newModuleName, $newTemplName)) {
                                 if ($form_submitted == 'save_template') {
                                     SJB_HelperFunctions::redirect(SJB_System::getSystemSettings('SITE_URL') . '/edit-templates/?module_name=' . $newModuleName);
                                 }
                                 SJB_HelperFunctions::redirect(SJB_System::getSystemSettings('SITE_URL') . '/edit-templates/?module_name=' . $newModuleName . '&template_name=' . $newTemplName);
                                 exit;
                             } else {
                                 $error[] = 'CANT_MOVE_FILE';
                             }
                         } else {
                             if ($template_editor->createTemplate($theme, $newModuleName, $newTemplName, $error)) {
                                 SJB_HelperFunctions::redirect(SJB_System::getSystemSettings('SITE_URL') . '/edit-templates/?module_name=' . $newModuleName . '&template_name=' . $newTemplName);
                             }
                             $error[] = 'CANT_CREATE_FILE';
                         }
                     }
                 }
                 break;
             default:
                 break;
         }
     }
     // не работало в юзерской
     if (empty($template_name)) {
         $template_name = SJB_Request::getVar('template_name', '');
     }
     if (empty($module_name)) {
         $module_name = SJB_Request::getVar('module_name', '');
     }
     // edittemplate
     if (!empty($template_name) && !empty($module_name)) {
         $menu_path = array(array('reference' => '?', 'name' => 'Edit Templates'), array('reference' => "?module_name={$module_name}", 'name' => $modules[$module_name]['display_name']), array('name' => $template_name, 'reference' => ''));
         $tp->assign('navigation', $menu_path);
         $tp->assign('errors', $error);
         $tp->assign('title', 'Edit Templates: ' . $modules[$module_name]['display_name'] . ' / Template: ' . $template_name);
         $tp->assign('show_clear_cache_setting', false);
         $tp->assign('show_highlight_setting', false);
         if (!$simple_view) {
             $tp->display('navigation_menu.tpl');
         }
         echo SJB_System::executeFunction('template_manager', 'edit_template');
     } else {
         if (!empty($module_name)) {
             $menu_path = array(array('reference' => '?', 'name' => 'Edit Templates'), array('reference' => '', 'name' => $modules[$module_name]['display_name']));
             $tp->assign('navigation', $menu_path);
             $tp->assign('title', 'Edit Templates');
             $tp->assign('errors', $error);
             $tp->assign('show_clear_cache_setting', false);
             $tp->assign('show_highlight_setting', false);
             if (!$simple_view) {
                 $tp->display('navigation_menu.tpl');
             }
             echo SJB_System::executeFunction('template_manager', 'template_list');
         } else {
             $menu_path = array(array('reference' => '', 'name' => 'Edit Templates'));
             $tp->assign('navigation', $menu_path);
             $tp->assign('title', 'Edit Templates');
             $tp->assign('show_clear_cache_setting', true);
             $tp->assign('show_highlight_setting', true);
             $tp->assign('result', $result);
             $tp->assign('errors', $error);
             if (!$simple_view) {
                 $tp->display('navigation_menu.tpl');
             }
             echo SJB_System::executeFunction('template_manager', 'add_template');
             echo SJB_System::executeFunction('template_manager', 'module_list');
         }
     }
 }
예제 #11
0
 public function execute()
 {
     $tp = SJB_System::getTemplateProcessor();
     $action = SJB_Request::getVar('action', false);
     $template = 'manage_promotions.tpl';
     $errors = array();
     switch ($action) {
         case 'add':
             $promotionCodeInfo = $_REQUEST;
             $formSubmitted = SJB_Request::getVar('event', false);
             $formSubmitted = $formSubmitted == 'save_code' ? true : false;
             $template = 'add_promotion.tpl';
             if (!isset($promotionCodeInfo['active'])) {
                 $promotionCodeInfo['active'] = 1;
             }
             $promotionCode = new SJB_Promotions($promotionCodeInfo);
             $addCodeForm = new SJB_Form($promotionCode);
             $addCodeForm->registerTags($tp);
             if ($formSubmitted && $addCodeForm->isDataValid($errors)) {
                 SJB_PromotionsManager::savePromotionCode($promotionCode);
                 SJB_HelperFunctions::redirect(SJB_System::getSystemSettings('SITE_URL') . "/promotions/");
             }
             $formFields = $addCodeForm->getFormFieldsInfo();
             $tp->assign("form_fields", $formFields);
             $metaDataProvider = SJB_ObjectMother::getMetaDataProvider();
             $tp->assign("METADATA", array("form_fields" => $metaDataProvider->getFormFieldsMetadata($formFields)));
             break;
         case 'edit':
             $template = 'edit_promotion.tpl';
             $promotionSID = SJB_Request::getVar('sid', false);
             $formSubmitted = SJB_Request::getVar('event', false);
             $formSubmitted = $formSubmitted == 'save_code' ? true : false;
             $promotionCodeInfo = SJB_PromotionsManager::getCodeInfoBySID($promotionSID);
             if ($promotionCodeInfo) {
                 $promotionCodeInfo = array_merge($promotionCodeInfo, $_REQUEST);
                 $promotionCode = new SJB_Promotions($promotionCodeInfo);
                 $addCodeForm = new SJB_Form($promotionCode);
                 $addCodeForm->registerTags($tp);
                 $promotionCode->setSID($promotionCodeInfo['sid']);
                 $i18n = SJB_I18N::getInstance();
                 $endDate = !empty($promotionCodeInfo['end_date']) ? $i18n->getInput('date', $promotionCodeInfo['end_date']) : '';
                 if ($formSubmitted && $addCodeForm->isDataValid($errors) && (empty($endDate) || $endDate >= date('Y-m-d') || !$promotionCodeInfo['active'])) {
                     SJB_PromotionsManager::savePromotionCode($promotionCode);
                     SJB_HelperFunctions::redirect(SJB_System::getSystemSettings('SITE_URL') . "/promotions/");
                 } elseif ($formSubmitted && $promotionCodeInfo['active'] == 1 && $endDate < date('Y-m-d')) {
                     $errors["'Active'"] = 'Please change the expiration date first';
                 }
                 $formFields = $addCodeForm->getFormFieldsInfo();
                 $tp->assign("form_fields", $formFields);
                 $tp->assign("sid", $promotionSID);
                 $metaDataProvider = SJB_ObjectMother::getMetaDataProvider();
                 $tp->assign("METADATA", array("form_fields" => $metaDataProvider->getFormFieldsMetadata($formFields)));
             } else {
                 SJB_HelperFunctions::redirect(SJB_System::getSystemSettings('SITE_URL') . "/promotions/");
             }
             break;
         case 'delete':
             $promotionSID = SJB_Request::getVar('sid', 0);
             SJB_PromotionsManager::deleteCodeBySID($promotionSID);
             SJB_HelperFunctions::redirect(SJB_System::getSystemSettings('SITE_URL') . "/promotions/");
             break;
         case 'deactivate':
             $promotionSID = SJB_Request::getVar('sid', false);
             SJB_PromotionsManager::deactivateCodeBySID($promotionSID);
             SJB_HelperFunctions::redirect(SJB_System::getSystemSettings('SITE_URL') . "/promotions/");
             break;
         case 'setting':
             $enablePromotionCodes = SJB_Request::getVar('enable_promotion_codes', 0);
             SJB_Settings::updateSetting('enable_promotion_codes', $enablePromotionCodes);
             SJB_HelperFunctions::redirect(SJB_System::getSystemSettings('SITE_URL') . "/promotions/");
             break;
         case 'activate':
             $promotionSID = SJB_Request::getVar('sid', false);
             $promotionCodeInfo = SJB_PromotionsManager::getCodeInfoBySID($promotionSID);
             if (empty($promotionCodeInfo['end_date']) || $promotionCodeInfo['end_date'] > date('Y-m-d')) {
                 $currentUses = SJB_PromotionsManager::getUsesCodeBySID($promotionSID);
                 $maxUses = $promotionCodeInfo['maximum_uses'];
                 if (!$maxUses || $maxUses > $currentUses) {
                     SJB_PromotionsManager::activateCodeBySID($promotionSID);
                     SJB_HelperFunctions::redirect(SJB_System::getSystemSettings('SITE_URL') . "/promotions/");
                 } else {
                     $errors['MAX_USES_ACHIEVED'] = true;
                 }
             } else {
                 $errors['DATE_IS_NOT_VALID'] = true;
                 $tp->assign('errors', $errors);
             }
         default:
             $promotions = SJB_PromotionsManager::getAllPromotionsInfo();
             foreach ($promotions as $key => $promotion) {
                 $promotions[$key]['uses'] = SJB_PromotionsManager::getUsesCodeBySID($promotion['sid']);
                 if ($promotions[$key]['uses'] >= $promotions[$key]['maximum_uses'] && $promotions[$key]['maximum_uses'] != 0) {
                     $promotions[$key]['active'] = 'used';
                 }
             }
             $currency = SJB_CurrencyManager::getDefaultCurrency();
             $tp->assign('currency', $currency);
             $tp->assign('promotions', $promotions);
             break;
     }
     $tp->assign('errors', $errors);
     $tp->display($template);
 }
예제 #12
0
파일: index.php 프로젝트: Maxlander/shixi
SJB_Event::handle('listingDeactivated', array('SJB_Notifications', 'notifyOnUserListingDeactivated'));
SJB_Event::handle('beforeListingDelete', array('SJB_Notifications', 'notifyOnUserListingDeleted'));
//bind send notification emails if user deactivated/deleted
SJB_Event::handle('onBeforeUserDelete', array('SJB_Notifications', 'notifyOnUserDeleted'));
SJB_Event::handle('onBeforeUserDeactivate', array('SJB_Notifications', 'notifyOnUserDeactivated'));
// bind session clear to task scheduler event
SJB_Event::handle('task_scheduler_run', array('SJB_Session', 'clearTemporaryData'));
SJB_Request::getInstance()->execute();
SJB_Statistics::addStatistics('siteView', '', 0, true);
$isPseudoCronEnabled = intval(SJB_Settings::getSettingByName('isPseudoCronEnabled')) === 1;
if ($isPseudoCronEnabled) {
    $isEmailSchedulerEnabled = intval(SJB_Settings::getSettingByName('email_scheduling')) === 1;
    $isOncePerHourCondition = SJB_Settings::getSettingByName('emailSchedule_lastTimeExecuted') < strtotime('1 hour ago');
    if ($isEmailSchedulerEnabled && $isOncePerHourCondition) {
        SJB_Settings::updateSetting('emailSchedule_lastTimeExecuted', time());
        SJB_System::getModuleManager()->executeFunction('miscellaneous', 'email_scheduling');
    }
    $numberOfPageViewsSinceLastTime = SJB_Settings::getValue('pseudoCron_numberOfPageViewsSinceLastTime');
    $isPageViewCondition = intval(SJB_Settings::getValue('pseudoCron_numberOfPageViewsSinceLastTime')) > SJB_Settings::getSettingByName('numberOfPageViewsToExecCronIfExceeded');
    if ($isPageViewCondition) {
        SJB_Settings::updateSetting('pseudoCron_numberOfPageViewsSinceLastTime', 0);
        list($month, $day, $year) = explode('.', SJB_Settings::getSettingByName('task_scheduler_last_executed_date'));
        $isOnceADayCondition = strtotime("{$year}-{$month}-{$day}") < strtotime('today');
        if ($isOnceADayCondition) {
            SJB_HelperFunctions::runScriptByCurl(SJB_System::getSystemSettings('SITE_URL') . '/system/miscellaneous/task_scheduler/');
        }
    } else {
        SJB_Settings::updateSetting('pseudoCron_numberOfPageViewsSinceLastTime', $numberOfPageViewsSinceLastTime + 1);
    }
}
SJB_HelperFunctions::debugInfoPrint();
예제 #13
0
 public function execute()
 {
     $tp = SJB_System::getTemplateProcessor();
     $action = SJB_Request::getVar('action');
     $field_id = SJB_Request::getVar('field_id', false);
     if ($field_id || $action == 'save_setting') {
         switch ($action) {
             case 'save':
                 $listing_type_sid = SJB_Request::getVar('listing_type_sid', false);
                 $userField = 0;
                 if ($listing_type_sid) {
                     if (strstr($field_id, 'user_')) {
                         $field_id = str_replace('user_', '', $field_id);
                         $userField = 1;
                     }
                     if (!SJB_RefineSearch::getFieldByFieldSIDListingTypeSID($field_id, $listing_type_sid, $userField)) {
                         SJB_RefineSearch::addField($field_id, $listing_type_sid, $userField);
                     }
                 }
                 break;
             case 'save_setting':
                 $listing_type_id = SJB_Request::getVar('listing_type_id', false);
                 $refine_search_items_limit = SJB_Request::getVar('refine_search_items_limit', false);
                 if ($listing_type_id) {
                     $settingValue = SJB_Request::getVar('turn_on_refine_search_' . $listing_type_id, 0);
                     if (SJB_Settings::getSettingByName('turn_on_refine_search_' . $listing_type_id) === false) {
                         SJB_Settings::addSetting('turn_on_refine_search_' . $listing_type_id, $settingValue);
                     } else {
                         SJB_Settings::updateSetting('turn_on_refine_search_' . $listing_type_id, $settingValue);
                     }
                 } elseif ($refine_search_items_limit) {
                     if (SJB_Settings::getSettingByName('refine_search_items_limit') === false) {
                         SJB_Settings::addSetting('refine_search_items_limit', $refine_search_items_limit);
                     } else {
                         SJB_Settings::updateSetting('refine_search_items_limit', $refine_search_items_limit);
                     }
                 }
                 break;
             case 'delete':
                 SJB_RefineSearch::removeField($field_id);
                 break;
             case 'move_up':
                 $listing_type_sid = SJB_Request::getVar('listing_type_sid', false);
                 if ($listing_type_sid) {
                     SJB_RefineSearch::moveUpFieldBySID($field_id, $listing_type_sid);
                 }
                 break;
             case 'move_down':
                 $listing_type_sid = SJB_Request::getVar('listing_type_sid', false);
                 if ($listing_type_sid) {
                     SJB_RefineSearch::moveDownFieldBySID($field_id, $listing_type_sid);
                 }
                 break;
         }
     }
     $listingTypes = SJB_ListingTypeManager::getAllListingTypesInfo();
     foreach ($listingTypes as $key => $listingType) {
         $fields = array_merge(SJB_ListingFieldManager::getCommonListingFieldsInfo(), SJB_ListingFieldManager::getListingFieldsInfoByListingType($listingType['sid']));
         foreach ($fields as $field_key => $field) {
             if ($field['type'] == 'location') {
                 if (is_array($field['fields'])) {
                     $fields = array_merge($fields, $field['fields']);
                 }
             }
             if (!in_array($field['type'], array('list', 'multilist', 'string', 'boolean', 'tree')) || in_array($field['id'], array('ApplicationSettings', 'access_type', 'anonymous', 'screening_questionnaire'))) {
                 foreach ($fields as $fieldKey => $searchField) {
                     if ($searchField['id'] == $field['id']) {
                         unset($fields[$fieldKey]);
                     }
                 }
             }
         }
         $listingTypes[$key]['fields'] = $fields;
         if ($key == 'Job') {
             $userFieldSID = SJB_DB::queryValue("SELECT `sid` FROM `user_profile_fields` WHERE `id` = 'CompanyName'");
             if (!empty($userFieldSID)) {
                 $listingTypes[$key]['user_fields'] = SJB_UserProfileFieldManager::getFieldInfoBySID($userFieldSID);
             }
         }
         $listingTypes[$key]['saved_fields'] = SJB_RefineSearch::getFieldsByListingTypeSID($listingType['sid']);
         $listingTypes[$key]['setting'] = SJB_Settings::getSettingByName('turn_on_refine_search_' . $listingType['id']);
     }
     $tp->assign('refine_search_items_limit', SJB_Settings::getSettingByName('refine_search_items_limit'));
     $tp->assign('listingTypes', $listingTypes);
     $tp->display('refine_search.tpl');
 }