Ejemplo n.º 1
0
 public static function logout()
 {
     $blogPath = SJB_Settings::getSettingByName('blog_path');
     if (empty($blogPath)) {
         return;
     }
     $url = SJB_System::getSystemSettings('SITE_URL') . $blogPath . '/';
     $client = new Zend_Http_Client($url, array('useragent' => SJB_Request::getUserAgent(), 'maxredirects' => 0));
     if (isset($_SESSION['wp_cookie_jar'])) {
         $client->setCookieJar(@unserialize($_SESSION['wp_cookie_jar']));
     }
     try {
         $response = $client->request();
         $matches = array();
         if (preg_match('/_wpnonce=([\\w\\d]+)"/', $response->getBody(), $matches)) {
             $wpnonce = $matches[1];
             $url = $url . 'wp-login.php?action=logout&_wpnonce=' . $wpnonce . '&noSJB=1';
             $client->setUri($url);
             $response = $client->request();
             foreach ($response->getHeaders() as $key => $header) {
                 if ('set-cookie' == strtolower($key)) {
                     if (is_array($header)) {
                         foreach ($header as $val) {
                             header("Set-Cookie: " . $val, false);
                         }
                     } else {
                         header("Set-Cookie: " . $header, false);
                     }
                 }
             }
         }
     } catch (Exception $ex) {
     }
 }
Ejemplo n.º 2
0
 public static function updateDatabasePerPatch()
 {
     if (!($patchList = self::getPatchList())) {
         return false;
     }
     ini_set('memory_limit', -1);
     $originalMaxExecutionTime = ini_get('max_execution_time');
     ini_set('max_execution_time', 0);
     SJB_DB::hideMysqlErrors();
     SJB_DB::cleanMysqlErrors();
     $patchList = (include SJB_BASE_DIR . self::UPDATE_DB_FILE);
     $patchFound = false;
     $patchCode = '';
     foreach ($patchList as $patch) {
         if (!$patchCode) {
             $patchCode = $patch;
         } else {
             $patched = SJB_Settings::getValue('db-patch-' . $patchCode);
             if (empty($patched)) {
                 $patch();
                 if (SJB_DB::isErrorExist()) {
                     self::logMysqlErrors($patchCode);
                     $patchFound = 'Can\'t install patch ' . $patchCode;
                 } else {
                     SJB_Settings::addSetting('db-patch-' . $patchCode, 'patched');
                     $patchFound = true;
                 }
                 break;
             }
             $patchCode = '';
         }
     }
     ini_set('max_execution_time', $originalMaxExecutionTime);
     return $patchFound;
 }
Ejemplo n.º 3
0
 public function execute()
 {
     set_time_limit(0);
     $notifiedEmails = array();
     $emailScheduling = SJB_Settings::getSettingByName('email_scheduling');
     $numberEmails = SJB_Settings::getSettingByName('number_emails');
     $emailsSend = SJB_Settings::getSettingByName('send_emails');
     $limit = $numberEmails - $emailsSend;
     $limit = $limit > 0 ? $limit : 20;
     $letters = SJB_DB::query('SELECT * FROM `email_scheduling` ORDER BY `id` ASC LIMIT 0, ?n', $limit);
     if ($emailScheduling && $numberEmails || count($letters)) {
         foreach ($letters as $letter) {
             $params = $letter;
             unset($params['id']);
             $email = new SJB_Email($params['email']);
             $email->setSubject($params['subject']);
             $email->setText($params['text']);
             $email->setFile($params['file']);
             if ($email->send(true)) {
                 SJB_DB::query('DELETE FROM `email_scheduling` WHERE `id` = ?n', $letter['id']);
                 array_push($notifiedEmails, $params['email']);
             }
         }
     }
     $tp = SJB_System::getTemplateProcessor();
     $tp->assign('notified_emails', $notifiedEmails);
     $schedulerLog = $tp->fetch('email_scheduler_log.tpl');
     SJB_HelperFunctions::writeCronLogFile('email_scheduler.log', $schedulerLog);
 }
Ejemplo n.º 4
0
 public function execute()
 {
     $tp = SJB_System::getTemplateProcessor();
     $action = SJB_Request::getVar('action');
     $api = SJB_Request::getVar('api', false);
     $request = $_REQUEST;
     unset($request['action']);
     switch ($action) {
         case 'header':
             $test = $tp->fetch("header.tpl");
             echo $test;
             exit;
             break;
         case 'simplyHired':
             SJB_Statistics::addStatistics('partneringSites');
             break;
         default:
             $isIPhone = false;
             if (class_exists('MobilePlugin')) {
                 $isIPhone = MobilePlugin::isPhone();
             }
             $url = SJB_Request::getVar('url');
             $url = $url ? base64_decode($url) : '';
             if (str_replace('www.', '', $_SERVER['HTTP_HOST']) === SJB_Settings::getValue('mobile_url') || SJB_Settings::getValue('detect_iphone') && $isIPhone) {
                 $url = str_replace('viewjob', 'm/viewjob', $url);
             }
             SJB_Statistics::addStatistics('partneringSites');
             if ($api && $api == 'indeed') {
                 SJB_HelperFunctions::redirect($url);
             }
             $tp->assign('url', $url);
             $tp->display("partnersite.tpl");
             break;
     }
 }
Ejemplo n.º 5
0
 static function logout()
 {
     SessionStorage::destroy(SJB_Session::getSessionId());
     $forumPath = SJB_Settings::getSettingByName('forum_path');
     if (empty($forumPath)) {
         return;
     }
     $url = SJB_System::getSystemSettings('SITE_URL') . $forumPath . '/';
     $client = new Zend_Http_Client($url, array('useragent' => SJB_Request::getUserAgent()));
     $client->setCookie($_COOKIE);
     $client->setCookieJar();
     try {
         $response = $client->request();
         $matches = array();
         if (preg_match('/\\.\\/ucp.php\\?mode=logout\\&sid=([\\w\\d]+)"/', $response->getBody(), $matches)) {
             $sid = $matches[1];
             $client->setUri($url . 'ucp.php?mode=logout&sid=' . $sid);
             $response = $client->request();
             foreach ($response->getHeaders() as $key => $header) {
                 if ('set-cookie' == strtolower($key)) {
                     if (is_array($header)) {
                         foreach ($header as $val) {
                             header("Set-Cookie: " . $val, false);
                         }
                     } else {
                         header("Set-Cookie: " . $header, false);
                     }
                 }
             }
         }
     } catch (Exception $ex) {
     }
 }
Ejemplo n.º 6
0
    public function execute()
    {
        if (!class_exists('SJB_SocialPlugin') || !in_array('facebook', SJB_SocialPlugin::getAvailablePlugins()) || !SJB_Settings::getSettingByName('facebook_resumeAutoFillSync')) {
            echo 'facebook synchronization function is turned off';
            return null;
        }
        /**
         * get all listings where synchronization is set
         */
        $listingsSIDs = SJB_DB::query('SELECT `reference_uid`, `listings`.`sid` as `listingSID`, `listings`.`user_sid` FROM `listings`
				INNER JOIN `users` ON `listings`.`user_sid` = `users`.`sid`
				WHERE `facebook_sync` = 1 AND `users`.`reference_uid` IS NOT NULL ORDER BY `user_sid`');
        if (!empty($listingsSIDs)) {
            $oFacebookSync = new FacebookSync();
            foreach ($listingsSIDs as $rUid) {
                try {
                    if ($oFacebookSync->init($rUid['reference_uid'], $rUid['listingSID'])) {
                        $oFacebookSync->sync();
                    } else {
                        throw new Exception('cant connect to facebook  :: ' . $oFacebookSync->getSocialID());
                    }
                } catch (Exception $e) {
                    echo $e->getMessage();
                }
            }
        }
    }
Ejemplo n.º 7
0
 public function execute()
 {
     $uri = parse_url($_SERVER['REQUEST_URI']);
     if (!preg_match("/\\/\$/", $uri['path'])) {
         $uri = parse_url($_SERVER['REQUEST_URI']);
         $query = isset($uri['query']) ? '?' . $uri['query'] : '';
         SJB_HelperFunctions::redirect($uri['path'] . '/' . $query);
     } else {
         $uri = SJB_Request::getVar('browseUrl', $this->getUri());
     }
     $listingTypeId = SJB_Request::getVar('listing_type_id', '');
     $browseManager = SJB_ObjectMother::createBrowseManager($listingTypeId, $this->parameters);
     $browseItems = array();
     if ($browseManager->canBrowse()) {
         if (SJB_Settings::getValue('enableBrowseByCounter')) {
             $browseItems = $browseManager->getItemsFromDB($uri, true);
         } else {
             $browseItems = $browseManager->getItems($this->parameters, true);
         }
     }
     $tp = $this->getTemplateProcessor($browseManager, $listingTypeId);
     $tp->assign('browseItems', $browseItems);
     $tp->assign('recordsNumToDisplay', SJB_Request::getVar('recordsNumToDisplay', 20));
     $tp->assign('user_page_uri', $uri);
     $tp->assign('sitePageUri', SJB_HelperFunctions::getSiteUrl() . $this->getUri());
     $tp->assign('browse_level', $browseManager->getLevel() + 1);
     $tp->assign('browse_navigation_elements', $browseManager->getNavigationElements($uri));
     $tp->display(SJB_Request::getVar('browse_template', 'browse_items_and_results.tpl'));
 }
Ejemplo n.º 8
0
 public static function loadSettings()
 {
     self::$settings = array();
     $settingsInfo = SJB_DB::query("SELECT * FROM `settings`");
     foreach ($settingsInfo as $settingInfo) {
         self::$settings[$settingInfo['name']] = $settingInfo['value'];
     }
 }
Ejemplo n.º 9
0
 /**
  * retrieve display layout property for builder
  * returns from $_GET array if value exists
  * else returns saved value from system
  *
  * @return bool|mixed|null
  */
 public function getDisplayLayout()
 {
     $layoutID = SJB_Request::getVar('builder-layout', null, 'GET');
     if ($layoutID) {
         return $layoutID;
     }
     return SJB_Settings::getSettingByName(SJB_DisplayFormFieldsBuilder::getDisplayLayoutNamePart($this->listingTypeID));
 }
Ejemplo n.º 10
0
 protected function _get_Captions_with_Counts_Grouped_by_Captions($request_data, array $listingSids = array())
 {
     if (SJB_Settings::getValue('enableBrowseByCounter')) {
         $res = parent::_get_Captions_with_Counts_Grouped_by_Captions($request_data, $listingSids);
     } else {
         $sql = "select `value` as caption from `listing_field_list` where `field_sid`=?n";
         $res = SJB_DB::query($sql, $this->field['sid']);
     }
     return $res;
 }
Ejemplo n.º 11
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"));
            }
        }
    }
 public function execute()
 {
     if (class_exists('SJB_SocialPlugin') && in_array('linkedin', SJB_SocialPlugin::getAvailablePlugins()) && SJB_Settings::getSettingByName('li_allowPeopleSearch')) {
         $liSearch = SJB_Request::getVar('li_search', false);
         $oLinkedin = SJB_SocialPlugin::getActiveSocialPlugin();
         if ('Resume' == $_REQUEST['listing_type']['equal'] && $liSearch && $oLinkedin instanceof LinkedinSocialPlugin) {
             SJB_Session::setValue('linkedinPeopleSearch', true);
             $request =& $_REQUEST;
             /*
              * keywords=[space delimited keywords]
              * sort=[connections|recommenders|distance|relevance]
              * postal-code=[postal code]
              * start=[number]& count=[1-25]&  facet=[facet code, values]& facets=[facet
              *
              * info:
              * http://developer.linkedin.com/docs/DOC-1191
              */
             $sKeywords = '';
             $sZip = !empty($request['ZipCode']['geo']['location']) ? $request['ZipCode']['geo']['location'] : '';
             $aIndustry = !empty($request['JobCategory']['multi_like']) ? $request['JobCategory']['multi_like'] : array();
             $sIndustry = '';
             $sCount = !empty($request['count']) ? (int) $request['count'] : 10;
             if (!empty($request['keywords']) && is_array($request['keywords'])) {
                 foreach ($request['keywords'] as $keywords) {
                     $sKeywords = $keywords;
                 }
             }
             $aFields = array('keywords' => $sKeywords, 'postal-code' => $sZip, 'count' => $sCount);
             foreach ($aIndustry as $industryName) {
                 if ($industryKey = SJB_LinkedinFields::getIndustryCodeByIndustryName($industryName)) {
                     $sIndustry .= ',' . $industryKey;
                 }
             }
             if (!empty($sIndustry)) {
                 $aFields['facets'] = 'industry';
                 $aFields['facet'] = 'industry' . $sIndustry;
             }
             $liResults = $oLinkedin->peopleSearch($aFields);
             if (isset($liResults->{'num-results'}) && (int) $liResults->{'num-results'} >= 0) {
                 $tp = SJB_System::getTemplateProcessor();
                 if (empty($sKeywords)) {
                     $tp->assign('liKeywordEmpty', true);
                 }
                 $tp->assign('liResults', $oLinkedin->preparePeopleStructure($liResults));
                 $tp->assign('liNumResults', (int) $liResults->{'num-results'});
                 $tp->assign('linkedinSearchIsAllowed', true);
                 $linkedinPeopleSearch = SJB_Session::getValue('linkedinPeopleSearch');
                 $tp->assign('linkedinSearch', !empty($linkedinPeopleSearch) && 'no' === $linkedinPeopleSearch && !empty($_GET['searchId']) ? 'notChecked' : 'no');
                 $tp->display('linkedin_people_search_results.tpl');
             }
         } else {
             SJB_Session::setValue('linkedinPeopleSearch', 'no');
         }
     }
 }
Ejemplo n.º 13
0
 public function execute()
 {
     if (class_exists('SJB_SocialPlugin') && in_array('linkedin', SJB_SocialPlugin::getAvailablePlugins()) && SJB_Settings::getSettingByName('li_companyProfileWidget')) {
         $companyName = SJB_Request::getVar('companyName');
         if ($companyName) {
             $tp = SJB_System::getTemplateProcessor();
             $tp->assign('companyName', $companyName);
             $tp->display('linkedin_profile_widget.tpl');
         }
     }
 }
Ejemplo n.º 14
0
 public function execute()
 {
     if (class_exists('SJB_SocialPlugin') && in_array('linkedin', SJB_SocialPlugin::getAvailablePlugins()) && SJB_Settings::getSettingByName('li_allowPeopleSearch')) {
         if ('Resume' == $_REQUEST['listing_type_id'] && SJB_SocialPlugin::getNetwork() == 'linkedin') {
             $tp = SJB_System::getTemplateProcessor();
             $tp->assign('linkedinSearchIsAllowed', true);
             $tp->assign('linkedinSearch', !empty($_SESSION['linkedinPeopleSearch']) && 'no' === $_SESSION['linkedinPeopleSearch'] && !empty($_GET['searchId']) ? 'notChecked' : 'no');
             $tp->display('linkedin_people_search_form.tpl');
         }
     }
 }
Ejemplo n.º 15
0
 private static function identificationUserSign()
 {
     if (SJB_Settings::getValue('sessionBindIP')) {
         $userIdentity = md5(SJB_Request::getvar('HTTP_USER_AGENT', '', 'SERVER') . SJB_Request::getvar('REMOTE_ADDR', '', 'SERVER'));
         if (self::getValue('userSign') !== $userIdentity) {
             session_unset();
             Zend_Session::regenerateId();
             self::setValue('userSign', $userIdentity);
         }
     }
 }
Ejemplo n.º 16
0
 public function execute()
 {
     $tp = SJB_System::getTemplateProcessor();
     $template_editor = new SJB_TemplateEditor();
     $setNewTheme = SJB_Request::getVar('theme', false);
     $theme = SJB_Request::getVar('theme', SJB_Settings::getValue('TEMPLATE_USER_THEME', 'default'));
     if ($setNewTheme) {
         if (SJB_System::getSystemSettings("isDemo")) {
             $tp->assign('ERROR', 'ACCESS_DENIED');
         } else {
             SJB_Settings::setValue('TEMPLATE_USER_THEME', $theme);
             SJB_Settings::setValue('CURRENT_THEME', $theme);
         }
     }
     if (!$template_editor->doesThemeExists(SJB_Settings::getValue('TEMPLATE_USER_THEME', 'default'))) {
         SJB_Settings::setValue('CURRENT_THEME', 'default');
         SJB_Settings::setValue('TEMPLATE_USER_THEME', 'default');
         $theme = 'default';
     } else {
         if ($setNewTheme && !SJB_System::getSystemSettings("isDemo")) {
             SJB_HelperFunctions::redirect(SJB_System::getSystemSettings("SITE_URL") . '/edit-themes/');
         }
     }
     $tp->assign('theme_list', $template_editor->getThemeList());
     $tp->assign('theme', $theme);
     if (isset($_REQUEST['action'])) {
         if (SJB_System::getSystemSettings("isDemo")) {
             $tp->assign('ERROR', 'ACCESS_DENIED');
         } else {
             switch (SJB_Request::getVar("action")) {
                 case "copy_theme":
                     if (isset($_REQUEST['copy_from_theme'], $_REQUEST['new_theme']) && $template_editor->doesThemeExists($_REQUEST['copy_from_theme']) && !$template_editor->doesThemeExists($_REQUEST['new_theme']) && !empty($_REQUEST['new_theme'])) {
                         $template_editor->copyEntireTheme($_REQUEST['copy_from_theme'], $_REQUEST['new_theme']);
                         SJB_HelperFunctions::redirect("?theme=" . $_REQUEST['new_theme']);
                     } else {
                         if ($template_editor->doesThemeExists(SJB_Request::getVar('new_theme', ''))) {
                             $tp->assign('ERROR', 'ALREADY_EXISTS');
                         }
                         if (empty($_REQUEST['new_theme'])) {
                             $tp->assign('ERROR', 'EMPTY_NAME');
                         }
                     }
                     break;
                 case "delete_theme":
                     if (isset($_REQUEST['theme_name']) && $template_editor->doesThemeExists($_REQUEST['theme_name'])) {
                         $template_editor->deleteEntireTheme($_REQUEST['theme_name']);
                         SJB_HelperFunctions::redirect(SJB_System::getSystemSettings("SITE_URL") . '/edit-themes/');
                     }
                     break;
             }
         }
     }
     $tp->display('theme_editor.tpl');
 }
 public function execute()
 {
     if (class_exists('SJB_SocialPlugin') && in_array('linkedin', SJB_SocialPlugin::getAvailablePlugins()) && SJB_Settings::getSettingByName('li_companyInsiderWidget')) {
         $companyName = str_replace(" ", "-", SJB_Request::getVar('companyName', ''));
         if (!empty($companyName)) {
             $tp = SJB_System::getTemplateProcessor();
             $tp->assign('companyName', $companyName);
             $tp->display('company_insider_widget.tpl');
         }
     }
 }
 public function execute()
 {
     if (class_exists('SJB_SocialPlugin') && in_array('linkedin', SJB_SocialPlugin::getAvailablePlugins()) && SJB_Settings::getSettingByName('li_memberProfileWidget')) {
         $userSID = SJB_Request::getInt('profileSID', '');
         if ($userSID && ($profilePublicUrl = SJB_SocialPlugin::getProfilePublicUrlByProfileID($userSID))) {
             $tp = SJB_System::getTemplateProcessor();
             $tp->assign('inPublicUrl', $profilePublicUrl);
             $tp->display('linkedin_member_profile_widget.tpl');
         }
     }
 }
Ejemplo n.º 19
0
 private function setAllowed()
 {
     $ips = explode(',', SJB_Settings::getValue('maintenance_mode_ip'));
     foreach ($ips as $ip) {
         $ip = trim($ip);
         $this->allowedIP = $ip;
         $this->checkIfSiteIsAvailable();
         if ($this->allowed) {
             break;
         }
     }
 }
Ejemplo n.º 20
0
 public function execute()
 {
     $formBuilder = SJB_FormBuilderManager::getFormBuilder();
     if ($formBuilder instanceof SJB_FormBuilder) {
         $tp = $formBuilder->getChargedTemplateProcessor();
         $tp->assign('fields_inactive', $formBuilder->getInactiveFields());
         $tp->assign('defaultCountry', SJB_Settings::getSettingByName('default_country'));
         $tp->assign('listingTypeID', $formBuilder->getListingTypeID());
         $tp->assign('mode', $formBuilder->getBuilderType());
         $tp->display('form_builder_in.tpl');
     }
 }
Ejemplo n.º 21
0
 public static function getTaxInfoByCountryAndState($countrySID, $stateSID)
 {
     if (SJB_Settings::getSettingByName('enable_taxes')) {
         $tax_info = SJB_DB::query("SELECT `sid` ,`tax_name` ,`price_includes_tax` , `tax_rate`,\n\t\t\t\tIF(`Country`= ?s and `State`= ?s and `Country` is not null and `State` is not null, 1,\n\t\t\t\t\tIF(`Country`= ?s and `Country` is not null and `State` = '', 2,\n\t\t\t\t\t\tIF(`Country`= '' and `State` = '', 3, 4))) as `param`\n\t\t\t    FROM `taxes` WHERE `active` = 1 and (`Country`= ?s and `State`= ?s and `Country` is not null and `State` is not null\n\t\t\t    or `Country`= ?s and `Country` is not null and `State` = '' or `Country`= '' and `State` = '')\n\t\t\t    ORDER BY `param` LIMIT 1;", $countrySID, $stateSID, $countrySID, $countrySID, $stateSID, $countrySID);
         $tax_info = array_pop($tax_info);
         if (count($tax_info)) {
             return $tax_info;
         } else {
             return array();
         }
     } else {
         return array();
     }
 }
Ejemplo n.º 22
0
 public function execute()
 {
     $type = 'subadmin';
     $role = SJB_SubAdmin::getSubAdminSID();
     // get new defined permissions for notification letter
     $acl = SJB_SubAdminAcl::getInstance();
     $permissions = SJB_SubAdminAcl::getAllPermissions($type, $role);
     $resources = $acl->getResources();
     SJB_SubAdminAcl::mergePermissionsWithResources($resources, $permissions);
     $tp = SJB_System::getTemplateProcessor();
     $tp->assign('permissions', $resources);
     $tp->assign('admin_email', SJB_Settings::getSettingByName('notification_email'));
     $tp->display('../miscellaneous/subadmin-error.tpl');
 }
Ejemplo n.º 23
0
 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');
         }
     }
 }
Ejemplo n.º 24
0
 /**
  * Constructor explains our requirements to Smarty
  *
  * @param SJB_TemplateSupplier $templatesupplier instatance of SJB_TemplateSupplier class
  * @return SJB_TemplateProcessor
  */
 function __construct($templatesupplier)
 {
     $this->htmlTagConverter = SJB_ObjectMother::createHTMLTagConverterInArray();
     $this->compile_check = true;
     $this->module_name = $templatesupplier->getModuleName();
     parent::__construct();
     $this->error_reporting = E_ALL ^ E_NOTICE;
     $this->setCompileDir(SJB_System::getSystemSettings('COMPILED_TEMPLATES_DIR') . SJB_System::getSystemSettings('SYSTEM_ACCESS_TYPE') . '/' . $templatesupplier->getTheme());
     if (!@is_dir($this->getCompileDir())) {
         @mkdir($this->getCompileDir(), 0777, true);
     }
     $this->setCacheDir(SJB_System::getSystemSettings('COMPILED_TEMPLATES_DIR') . '/smarty_cache');
     if (!@is_dir($this->getCacheDir())) {
         @mkdir($this->getCacheDir(), 0777, true);
     }
     /**
      * Check for 'cache_control_file.cache' in compile dir. If exists - clear compile dir.
      * Then if 'highlight_templates' mode is ON, and user is 'admin' - create 'cache_control_file'.
      */
     $cacheControlFile = $this->compile_dir . '/cache_control_file.cache';
     if (file_exists($cacheControlFile)) {
         $this->clearAllCache();
         $this->clearCompiledTemplate();
     }
     if (SJB_Settings::getSettingByName('highlight_templates') == 1 && SJB_Request::getVar('admin_mode', false, 'COOKIE')) {
         $fp = fopen($cacheControlFile, 'w');
         fclose($fp);
     }
     /////////////////////////
     $this->registerPlugin('function', 'module', array(&$this, 'module'));
     $this->registerPlugin('function', 'hidden_form_fields', array(&$this, 'hidden_form_fields'));
     $this->registerPlugin('function', 'url', array(&$this, 'get_module_function_url'));
     $this->registerPlugin('function', 'event', array(&$this, 'dispatch_event'));
     $currencyFormatter = new SJB_CurrencyFormatter();
     $this->registerPlugin('function', 'currencyFormat', array($currencyFormatter, 'currencyFormat'));
     $this->registerPlugin('function', 'locationFormat', 'SJB_LocationManager::locationFormat');
     /////////////////////////
     $this->registerPlugin('block', 'title', array(&$this, '_tpl_title'));
     $this->registerPlugin('block', 'keywords', array(&$this, '_tpl_keywords'));
     $this->registerPlugin('block', 'description', array(&$this, '_tpl_description'));
     $this->registerPlugin('block', 'head', array(&$this, '_tpl_head'));
     $this->registerPlugin('block', 'breadcrumbs', array(&$this, '_tpl_breadcrumbs'));
     $this->registerFilter('pre', array(&$this, '_replace_translation_alias'));
     $this->registerPlugin('block', 'tr', array(&$this, 'translate'));
     $templatesupplier->registerResources($this);
     $this->templateSupplier = $templatesupplier;
     $this->registerPlugin('function', 'set_token_field', array(&$this, 'tpl_set_token_field'));
     $this->registerGlobalVariables();
 }
Ejemplo n.º 25
0
 public static function writeToLog($payment, $result = false)
 {
     if (SJB_Settings::getSettingByName('notification_payment') != $payment->recipient_payment) {
         $username = SJB_UserManager::getUserSIDbyPayment($payment->recipient_payment);
     }
     if (!$username) {
         $admin = SJB_SubAdminManager::getUserSIDbyPayment($payment->recipient_payment);
         $admin = $admin ? $admin : 'admin';
     }
     $status = 'Delivered';
     if (!$result) {
         $status = 'Undelivered';
     }
     SJB_DB::query("INSERT INTO `payment_log` (`date`, `gateway`, `message`, `status`) VALUES (NOW(), ?s, ?s, ?s, ?s, ?s, ?s)", $payment->gateway, $payment->text, $status);
 }
Ejemplo n.º 26
0
 /**
  * @param  string $network
  * @param  int    $listingSID
  * @return bool
  */
 private static function isNetworkAllowed($network, $listingSID)
 {
     $allowed = false;
     if (SJB_Settings::getSettingByName("enable_job_sharing_for_users_{$network}")) {
         $permission = SJB_ListingDBManager::getPermissionByListingSid('post_jobs_on_social_networks', $listingSID);
         if ($permission == 'deny') {
             $allowed = false;
         } else {
             if ($permission == 'allow' || SJB_Acl::getInstance()->isAllowed('post_jobs_on_social_networks')) {
                 $allowed = true;
             }
         }
     }
     return $allowed;
 }
Ejemplo n.º 27
0
 public function execute()
 {
     $ou = SJB_UserManager::getOnlineUsers();
     $onlineUsers = array();
     $totalOnlineUsers = 0;
     $userGroups = SJB_UserGroupManager::createTemplateStructureForUserGroups();
     foreach ($userGroups as $userGroup) {
         $onlineUsers[$userGroup["id"]]["count"] = 0;
         $onlineUsers[$userGroup["id"]]["caption"] = $userGroup["caption"];
     }
     foreach ($ou as $value) {
         $onlineUsers[$value["type"]]["count"]++;
         $totalOnlineUsers++;
     }
     $theme = SJB_Settings::getValue('TEMPLATE_USER_THEME', 'default');
     $themePath = SJB_TemplatePathManager::getAbsoluteThemePath($theme);
     // FLAGGED LISTINGS
     $allListingTypes = SJB_ListingTypeManager::getAllListingTypesInfo();
     $totalFlagsNum = array();
     foreach ($allListingTypes as $type) {
         $totalFlagsNum[$type['id']] = SJB_ListingManager::getFlagsNumberByListingTypeSID($type['sid'], $filter = null, $groupByListingSID = true);
     }
     $files = $this->getCssFiles($themePath);
     $tp = SJB_System::getTemplateProcessor();
     $tp->assign('totalFlagsNum', $totalFlagsNum);
     $tp->assign('usersInfo', SJB_UserManager::getUsersInfo());
     $tp->assign('groupsInfo', SJB_UserManager::getGroupsInfo());
     $tp->assign('listingsInfo', SJB_ListingManager::getListingsInfo());
     $tp->assign('listingTypesInfo', SJB_ListingTypeManager::getAllListingTypesInfo());
     $tp->assign('invoicesInfo', SJB_InvoiceManager::getInvoicesInfo());
     $tp->assign('unpaidInvoices', SJB_InvoiceManager::getTotalUnpaidInvoices());
     $tp->assign('totalInvoices', SJB_InvoiceManager::getTotalInvoices());
     $i18n = SJB_I18N::getInstance();
     $lang = $i18n->getLanguageData($i18n->getCurrentLanguage());
     $tp->assign("today", strftime($lang['date_format'], time()));
     // ранее были данные за период: месяц (последние 30 дней), неделя (последние 7 дней)
     // теперь - текущий месяц и текущая неделя
     $currMonth = strftime($lang['date_format'], mktime(0, 0, 0, date("m"), 1, date("Y")));
     $currWeek = strftime($lang['date_format'], mktime(0, 0, 0, date("m"), date("d") - date("N") + 1, date("Y")));
     $tp->assign("weekAgo", $currWeek);
     $tp->assign("monthAgo", $currMonth);
     $tp->assign('onlineUsers', $onlineUsers);
     $tp->assign('totalOnlineUsers', $totalOnlineUsers);
     if (count($files) > 0) {
         $tp->assign("file", $files[0]);
     }
     $tp->display("index.tpl");
 }
Ejemplo n.º 28
0
 /**
  * 
  * @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);
 }
Ejemplo n.º 29
0
 public function execute()
 {
     $tp = SJB_System::getTemplateProcessor();
     $errors = array();
     $formSubmitted = SJB_Request::getVar('action');
     $bitlyInfo = new SJB_Bitly($_REQUEST);
     $bitlyForm = new SJB_Form($bitlyInfo);
     if ($formSubmitted == 'saveSettings') {
         $bitlyForm->isDataValid($errors);
         if (!$errors) {
             SJB_Settings::updateSettings($_REQUEST);
             SJB_HelperFunctions::redirect(SJB_System::getSystemSettings('SITE_URL') . "/social-media/bitly/");
         }
     }
     $tp->assign("settings", SJB_Settings::getSettings());
     $tp->assign("errors", $errors);
     $tp->display("bitly.tpl");
 }
Ejemplo n.º 30
0
 public static function writeToLog($email, $result = false, $error_msg = false)
 {
     $username = '';
     $admin = '';
     if (SJB_Settings::getSettingByName('notification_email') != $email->recipient_email) {
         $username = SJB_UserManager::getUserSIDbyEmail($email->recipient_email);
     }
     if (!$username) {
         $admin = SJB_SubAdminManager::getUserSIDbyEmail($email->recipient_email);
         $admin = $admin ? $admin : 'admin';
     }
     $status = 'Delivered';
     if (!$result) {
         $status = 'Undelivered';
     } elseif ('Not Sent' === $result) {
         $status = $result;
     }
     SJB_DB::query("INSERT INTO `email_log` (`date`, `subject`, `email`, `message`, `username`, `admin`, `status`, `error_msg`) VALUES (NOW(), ?s, ?s, ?s, ?s, ?s, ?s, ?s)", $email->subject, $email->recipient_email, $email->text, $username, $admin, $status, $error_msg);
 }