コード例 #1
0
ファイル: promotions.php プロジェクト: Maxlander/shixi
 public function search()
 {
     $action = SJB_Request::getVar('action');
     $period = SJB_Request::getVar('period', array());
     $sorting_field = SJB_Request::getVar('sorting_field', 'usageCount');
     $sorting_order = SJB_Request::getVar('sorting_order', 'DESC');
     $i18n = SJB_I18N::getInstance();
     $statistics = array();
     if ($action) {
         if (!empty($period['from']) && !empty($period['to'])) {
             $from = $i18n->getInput('date', $period['from']);
             $to = $i18n->getInput('date', $period['to']);
             if (strtotime($from) > strtotime($to)) {
                 throw new Exception('SELECTED_PERIOD_IS_INCORRECT');
             }
         }
         $statistics = SJB_Statistics::getPromotionsStatistics($period, $sorting_field, $sorting_order);
     }
     $periodView = array();
     foreach ($period as $key => $value) {
         $periodView[$key] = $i18n->getInput('date', $period[$key]);
     }
     $this->tp->assign('currency', SJB_CurrencyManager::getDefaultCurrency());
     $this->tp->assign('action', $action);
     $this->tp->assign('period', $period);
     $this->tp->assign('periodView', $periodView);
     $this->tp->assign('statistics', $statistics);
     $this->tp->assign('countResult', count($statistics));
     $this->tp->assign('sorting_field', $sorting_field);
     $this->tp->assign('sorting_order', $sorting_order);
 }
コード例 #2
0
ファイル: social_plugins.php プロジェクト: Maxlander/shixi
 private function showErrorsIfExist()
 {
     if (!empty($GLOBALS[SJB_SocialPlugin::SOCIAL_LOGIN_ERROR])) {
         $this->tp->assign('errors', $GLOBALS[SJB_SocialPlugin::SOCIAL_LOGIN_ERROR]);
         $this->tp->display('../users/errors.tpl');
     }
     if (!empty($GLOBALS[SJB_SocialPlugin::SOCIAL_ACCESS_ERROR])) {
         $this->tp->assign('errors', $GLOBALS[SJB_SocialPlugin::SOCIAL_ACCESS_ERROR]);
         $this->tp->assign('socialNetwork', SJB_SocialPlugin::getNetwork());
         $this->tp->display('../users/errors.tpl');
     }
 }
コード例 #3
0
ファイル: payment_log.php プロジェクト: Maxlander/shixi
 private function assignParametersAndDisplayLog($foundPayments)
 {
     $this->templateProcessor->assign('paginationInfo', $this->paginator->getPaginationInfo());
     $this->templateProcessor->assign("found_payments", $foundPayments);
     $this->templateProcessor->assign("searchFields", $this->getFields());
     $this->templateProcessor->display('payment_log.tpl');
 }
コード例 #4
0
ファイル: Captcha.php プロジェクト: Maxlander/shixi
 /**
  * Display
  */
 public function display()
 {
     if ($this->isCaptcha) {
         $this->tp->assign('displayMode', SJB_Request::getVar('displayMode', 'label'));
         $this->tp->assign('captcha', array_pop($this->captchaForm->form_fields));
         $this->tp->display('captchaHandle.tpl');
     }
 }
コード例 #5
0
ファイル: PageConstructor.php プロジェクト: Maxlander/shixi
 /**
  * 
  * @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);
 }
コード例 #6
0
 /**
  * @param int $feedSID
  */
 public function run_manually_check($feedSID)
 {
     $feed = SJB_SocialMedia::getFeedInfoByNetworkIdAndSID($this->networkID, $feedSID);
     $feedManager = SJB_SocialMediaPostingsPublisher::getPublisher($feed, $this->networkID);
     $listingSIDs = $feedManager->getListingsSIDsToPostByFeed();
     $postedToday = $feedManager->getPostedTodayByFeed();
     $this->tp->assign('foundListingsToPost', count($listingSIDs));
     $this->tp->assign('postedToday', $postedToday);
     $this->displayResult($feedManager);
 }
コード例 #7
0
ファイル: create.php プロジェクト: Maxlander/shixi
 /**
  * @param SJB_GuestAlert $guestAlert
  * @param SJB_TemplateProcessor $tp
  */
 public function saveNewGuestAlert(SJB_GuestAlert $guestAlert, SJB_TemplateProcessor $tp)
 {
     $guestAlert->addDataProperty(serialize($this->criteriaData));
     $guestAlert->addListingTypeIDProperty($this->listingTypeID);
     $guestAlert->save();
     $listingTypeSID = SJB_ListingTypeManager::getListingTypeSIDByID($this->listingTypeID);
     SJB_GuestAlertStatistics::saveEventSubscribed($listingTypeSID, $guestAlert->getSID());
     SJB_Notifications::sendConfirmationEmailForGuest($guestAlert);
     $tp->assign('email', $guestAlert->getAlertEmail());
     $this->template = 'alert_created.tpl';
 }
コード例 #8
0
ファイル: manage.php プロジェクト: Maxlander/shixi
 public function showResults()
 {
     if (SJB_Request::getVar('action', '') == 'search') {
         $_REQUEST['restore'] = 1;
     }
     $paginator = new SJB_GuestAlertsManagePagination();
     $limit = array('limit' => ($paginator->currentPage - 1) * $paginator->itemsPerPage, 'num_rows' => $paginator->itemsPerPage);
     $searcher = new SJB_GuestAlertSearcher($limit, $paginator->sortingField, $paginator->sortingOrder);
     $foundGuestAlerts = $searcher->getObjectsSIDsByCriteria($this->criteria);
     $this->criteriaSaver->setSession($_REQUEST, $searcher->getFoundObjectSIDs());
     foreach ($foundGuestAlerts as $id => $guestAlertSID) {
         $foundGuestAlerts[$id] = SJB_GuestAlertManager::getGuestAlertInfoBySID($guestAlertSID);
     }
     $paginator->setItemsCount($searcher->getAffectedRows());
     $this->tp->assign('paginationInfo', $paginator->getPaginationInfo());
     $this->tp->assign('searchFields', $this->getSearchFieldsForTemplate());
     $this->tp->assign('errors', $this->errors);
     $this->tp->assign('guestAlerts', $foundGuestAlerts);
     $this->tp->display('manage.tpl');
 }
コード例 #9
0
 private function prepareTplVarsForUser($onlyUserGroupID = false)
 {
     $userGroups = SJB_UserGroupManager::getAllUserGroupsIDsAndCaptions();
     foreach ($userGroups as $key => &$userGroupInfo) {
         if ($onlyUserGroupID && $userGroupInfo['key'] != $onlyUserGroupID) {
             unset($userGroups[$key]);
             continue;
         }
         $user = SJB_ObjectMother::createUser(array(), $userGroupInfo['id']);
         $fields = SJB_UserManager::createTemplateStructureForUser($user);
         unset($fields['METADATA']);
         unset($fields['password']);
         $userGroupInfo['fields'] = $this->echoVars($fields);
     }
     $this->tp->assign('userGroups', $userGroups);
 }
コード例 #10
0
ファイル: FacebookFields.php プロジェクト: Maxlander/shixi
 /**
  * @param array $aPositions
  * @return bool|mixed|string
  */
 protected function getWorkDisplayPart($aPositions)
 {
     $this->tp->assign('positions', $aPositions);
     $value = $this->tp->fetch('../social/experience.tpl');
     return $value;
 }
コード例 #11
0
ファイル: Form.php プロジェクト: Maxlander/shixi
 function assignTemplateVariables($params)
 {
     global $variables_to_assign;
     $variables_to_assign = array();
     if ($this->objectHasProperty($params['property'])) {
         $object_property = $this->getObjectProperty($params['property']);
         $variables_to_assign = $object_property->getPropertyVariablesToAssign();
     }
     if (!empty($params['complexParent'])) {
         $complexParent = $params['complexParent'];
         $object = $this->object_properties[$complexParent]->type->complex;
         $object_properties = $object->getProperties();
         if (isset($object_properties[$params['property']])) {
             $variables_to_assign = $object_properties[$params['property']]->getPropertyVariablesToAssign();
         }
         if (isset($params['complexStep']) && !empty($this->object_properties[$complexParent]->value)) {
             if (is_string($this->object_properties[$complexParent]->value)) {
                 $complexValue = unserialize($this->object_properties[$complexParent]->value);
             } else {
                 $complexValue = $this->object_properties[$complexParent]->value;
             }
             //exception for monetary type
             if (!isset($variables_to_assign['list_currency'])) {
                 $variables_to_assign['value'] = '';
             }
             if (isset($complexValue[$params['property']]) && isset($complexValue[$params['property']][$params['complexStep']])) {
                 if ($object_properties[$params['property']]->getType() === 'date' && $object_properties[$params['property']]->type->getConvertToDBDate()) {
                     $field = $object_properties[$params['property']];
                     $field->type->property_info['value'] = $complexValue[$params['property']][$params['complexStep']];
                     if ($field->isValid() !== true) {
                         $complexValue[$params['property']][$params['complexStep']] = '';
                     }
                     $variables_to_assign['value'] = SJB_I18N::getInstance()->getInput('date', $complexValue[$params['property']][$params['complexStep']]);
                 } elseif ($object_properties[$params['property']]->getType() == 'monetary') {
                     if (isset($complexValue[$params['property']][$params['complexStep']]['value'])) {
                         $variables_to_assign['value']['value'] = htmlentities($complexValue[$params['property']][$params['complexStep']]['value'], ENT_QUOTES, "UTF-8");
                     } else {
                         $variables_to_assign['value'] = htmlentities($complexValue[$params['property']][$params['complexStep']], ENT_QUOTES, "UTF-8");
                     }
                 } elseif ($object_properties[$params['property']]->getType() == 'multilist') {
                     $value = $complexValue[$params['property']][$params['complexStep']];
                     if (!is_array($value) && strpos($value, ',')) {
                         $variables_to_assign['value'] = explode(',', $value);
                     } else {
                         $variables_to_assign['value'] = $value;
                     }
                 } elseif ($object_properties[$params['property']]->getType() !== 'text') {
                     $variables_to_assign['value'] = htmlentities($complexValue[$params['property']][$params['complexStep']], ENT_QUOTES, "UTF-8");
                 } else {
                     $variables_to_assign['value'] = $complexValue[$params['property']][$params['complexStep']];
                 }
             }
         }
     }
     if (!empty($params['parent'])) {
         $parent = $params['parent'];
         $object = $this->object_properties[$parent]->type->child;
         $object_properties = $object->getProperties();
         if (isset($object_properties[$params['property']])) {
             $variables_to_assign = $object_properties[$params['property']]->getPropertyVariablesToAssign();
         } elseif (strpos($params['property'], '.Code')) {
             $params['property'] = str_replace('.Code', '', $params['property']);
             if (!isset($object_properties[$params['property']])) {
                 return false;
             }
             $variables_to_assign = $object_properties[$params['property']]->getPropertyVariablesToAssign();
             if ($params['property'] == 'State') {
                 $country = !empty($params['country']) ? $params['country'] : false;
                 $variables_to_assign['list_values'] = SJB_StatesManager::getStatesNamesByCountry($country, true, 'state_code');
             }
             $variables_to_assign['displayAS'] = 'Code';
         } else {
             $params['property'] = str_replace('.Name', '', $params['property']);
             if (!isset($object_properties[$params['property']])) {
                 return false;
             }
             $variables_to_assign = $object_properties[$params['property']]->getPropertyVariablesToAssign();
             if ($params['property'] == 'State') {
                 $country = !empty($params['country']) ? $params['country'] : false;
                 $variables_to_assign['list_values'] = SJB_StatesManager::getStatesNamesByCountry($country, true, 'state_name');
             }
             $variables_to_assign['displayAS'] = 'Name';
         }
     }
     if (isset($params['fields'])) {
         $fields = $params['fields'];
         $object_property = $this->getObjectProperty($params['property']);
         $fieldProperties = $object_property->type->child->getProperties();
         foreach ($fieldProperties as $key => $property) {
             if (!array_key_exists($property->getSID(), $fields)) {
                 $object_property->type->child->deleteProperty($key);
             }
         }
         foreach ($fields as $key => $field) {
             $object_property->type->child->addProperty($field);
         }
         $variables_to_assign = $object_property->getPropertyVariablesToAssign();
     }
     if (isset($params['complexStep'])) {
         $variables_to_assign['complexStep'] = $params['complexStep'];
     }
     if (isset($params['parameters'])) {
         $variables_to_assign = array_merge($variables_to_assign, array('parameters' => $params['parameters']));
     }
     // made for FormBuilders Complex Fields. so admin could define custom html code
     if (isset($params['customHtml']) && !empty($params['customHtml'])) {
         $variables_to_assign['customHtml'] = trim($params['customHtml']);
     }
     $variables_to_assign = array_merge($variables_to_assign, $this->getVariablesToAssign($params));
     $varToAssignValueIsEmpty = $this->isEmptyVariablesToAssignValue($variables_to_assign);
     if (($this->useDefaultValues || !$this->object->getSID()) && $varToAssignValueIsEmpty && $this->errors === false) {
         if ($variables_to_assign['default_value'] != '') {
             if (is_array($variables_to_assign['default_value'])) {
                 $variables_to_assign['default_value']['currency'] = $variables_to_assign['default_value']['add_parameter'];
             }
             $variables_to_assign['value'] = $variables_to_assign['default_value'];
         } else {
             if ($variables_to_assign['profile_field_as_dv'] != '') {
                 $variables_to_assign['value'] = htmlentities($variables_to_assign['profile_field_as_dv'], ENT_QUOTES, 'UTF-8');
             }
         }
     }
     // заглушка для email - когда в value попадает массив из одного элемента [original]
     if ($variables_to_assign['id'] == 'email') {
         if (is_array($variables_to_assign['value'])) {
             $variables_to_assign['value'] = array_pop($variables_to_assign['value']);
         }
     }
     $variables_to_assign['defaultCountry'] = SJB_Settings::getSettingByName('default_country');
     if (isset($params['searchWithin'])) {
         $variables_to_assign['searchWithin'] = $params['searchWithin'];
     }
     if (!isset($variables_to_assign['displayAS'])) {
         $variables_to_assign['displayAS'] = false;
     }
     if ($variables_to_assign['id'] == 'default_value' && in_array($this->object->getProperty('default_value')->getType(), array('list', 'multilist'))) {
         $variables_to_assign['sort_by_alphabet'] = $this->object->getPropertyValue('sort_by_alphabet');
     }
     foreach ($variables_to_assign as $variable_name => $variable_value) {
         $this->template_processor->assign($variable_name, $variable_value);
     }
     return true;
 }
コード例 #12
0
ファイル: guest_alerts.php プロジェクト: Maxlander/shixi
 public function search()
 {
     $search = SJB_Request::getVar('search', false);
     $period = SJB_Request::getVar('period', array());
     $filter = SJB_Request::getVar('filter', false);
     $listingTypeID = SJB_Request::getVar('listingTypeID', false);
     $sorting_field = SJB_Request::getVar('sorting_field', 'total');
     $sorting_order = SJB_Request::getVar('sorting_order', 'DESC');
     $i18n = SJB_I18N::getInstance();
     $statistics = array();
     if ($search) {
         $from = $i18n->getInput('date', $period['from']);
         $to = $i18n->getInput('date', $period['to']);
         if (!empty($period['from']) && !empty($period['to']) && strtotime($from) > strtotime($to)) {
             throw new Exception('SELECTED_PERIOD_IS_INCORRECT');
         }
         if (empty($filter)) {
             throw new Exception('EMPTY_PARAMETER');
         }
         $listingTypeSID = SJB_ListingTypeManager::getListingTypeSIDByID($listingTypeID);
         $statistics = SJB_Statistics::getGuestAlertsStatistics($period, $listingTypeSID, $filter, $sorting_field, $sorting_order);
     }
     $columnTitle = $i18n->gettext('Backend', 'Guest Email');
     $periodView = array();
     foreach ($period as $key => $value) {
         $periodView[$key] = $i18n->getInput('date', $period[$key]);
     }
     $this->tp->assign('filter', $filter);
     $this->tp->assign('search', $search);
     $this->tp->assign('columnTitle', $columnTitle);
     $this->tp->assign('listingTypeID', $listingTypeID);
     $this->tp->assign('period', $period);
     $this->tp->assign('periodView', $periodView);
     $this->tp->assign('statistics', $statistics);
     $this->tp->assign('countResult', count($statistics));
     $this->tp->assign('sorting_field', $sorting_field);
     $this->tp->assign('sorting_order', $sorting_order);
 }
コード例 #13
0
ファイル: task_scheduler.php プロジェクト: Maxlander/shixi
    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');
    }
コード例 #14
0
 /**
  * @param SJB_TemplateProcessor $tp
  */
 public function setChargedTemplateProcessor($tp)
 {
     $tp->assign('display_layout', $this->getDisplayLayout($this->listingTypeID));
     parent::setChargedTemplateProcessor($tp);
 }
コード例 #15
0
ファイル: social_media.php プロジェクト: Maxlander/shixi
 /**
  * @param SJB_TemplateProcessor $tp
  * @param $networkSocialMedia
  * @param array $errors
  * @param array $feedInfo
  * @param string $network
  * @param int $sid
  */
 private function checkToken(SJB_TemplateProcessor $tp, $networkSocialMedia, array &$errors, array $feedInfo, $network, $sid)
 {
     if ($networkSocialMedia->approveAccount()) {
         if (empty($feedInfo)) {
             $feedInfo = SJB_SocialMedia::getFeedInfoByNetworkIdAndSID($network, $sid);
         }
         if (!empty($feedInfo)) {
             if (SJB_SocialMedia::isFeedExpired($feedInfo)) {
                 $errors[] = 'TOKEN_EXPIRED';
                 $tp->assign('expired', true);
             } else {
                 $errors[] = 'APPROVE_ACCOUNT';
                 $tp->assign('approveAccount', true);
             }
         }
     }
 }