function getObjectInfo($sorting_fields, $inner_join = false, $relevance = false) { $SearchSqlTranslator = new SJB_GuestAlertSearchSQLTranslator($this->table_prefix); $sql_string = $SearchSqlTranslator->buildSqlQuery($this->criteria, $this->valid_criterion_number, $sorting_fields, $this->inner_join); if ($this->sorting_field !== false && $this->sorting_order !== false) { $sql_string .= ' ORDER BY ' . $this->sorting_field . ' ' . $this->sorting_order . ' '; } SJB_DB::queryExec($sql_string); $affectedRows = SJB_DB::getAffectedRows(); if ($this->limit !== false) { if (isset($this->limit['limit'])) { $sql_string .= 'limit ' . $this->limit['limit'] . ', ' . $this->limit['num_rows']; } else { $sql_string .= 'limit ' . $this->limit . ', 100'; } } $sql_results = SJB_DB::query($sql_string); $result = array(); foreach ($sql_results as $sql_result) { if ($this->valid_criterion_number == 0 || $sql_result['countRows'] == $this->valid_criterion_number) { $result[]['object_sid'] = $sql_result['object_sid']; } } $this->affectedRows = $affectedRows - (SJB_DB::getAffectedRows() - count($result)); return $result; }
public static function login($username, $password, $keep_signed, &$errors, $login_as_user = false, $autoriseByUsername = false) { $login = SJB_UserManager::login($username, $password, $errors, $autoriseByUsername, $login_as_user); if ($login) { if (SJB_UserManager::checkBan($errors)) { return false; } $userInfo = SJB_UserManager::getUserInfoByUserName($username); if (!$userInfo['active']) { $errors['USER_NOT_ACTIVE'] = 1; return false; } // if "Approve Users by Admin" option is turned on $userGroupInfo = SJB_UserGroupManager::getUserGroupInfoBySID($userInfo['user_group_sid']); if (!empty($userGroupInfo['approve_user_by_admin']) && 'Approved' != $userInfo['approval']) { $errors['USER_NOT_APPROVED'] = 1; return false; } $loginParams = array('username' => $username, 'password' => $password); SJB_Event::dispatch('Login', $loginParams); if ($keep_signed) { SJB_Authorization::keepUserSignedIn($userInfo); } SJB_DB::query('update `users` set `ip` = ?s where `sid` = ?n', $_SERVER['REMOTE_ADDR'], $userInfo['sid']); if (!empty($userInfo['parent_sid'])) { $subuserInfo = $userInfo; $userInfo = SJB_UserManager::getUserInfoBySID($userInfo['parent_sid']); $userInfo['subuser'] = $subuserInfo; } SJB_Authorization::setSessionForUser($userInfo); return true; } return false; }
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); }
public function savePermissions($request, $product) { $acl = SJB_Acl::getInstance(); $resources = $acl->getResources(); $type = 'product'; $role = $product->getSID(); SJB_Acl::clearPermissions($type, $role); $userGroupSID = $product->getPropertyValue('user_group_sid'); $groupPermissions = SJB_DB::query('select * from `permissions` where `type` = ?s and `role` = ?s', 'group', $userGroupSID); foreach ($groupPermissions as $key => $groupPermission) { $groupPermissions[$groupPermission['name']] = $groupPermission; unset($groupPermissions[$key]); } foreach ($resources as $name => $resource) { $params = isset($request[$name . '_params']) ? $request[$name . '_params'] : ''; $params1 = isset($request[$name . '_params1']) ? $request[$name . '_params1'] : ''; $value = isset($request[$name]) ? $request[$name] : ''; $message = isset($request[$name . '_message']) ? $request[$name . '_message'] : ''; if (empty($value) && isset($groupPermissions[$name])) { $value = 'inherit'; $message = $groupPermissions[$name]['message']; $params = $groupPermissions[$name]['params']; } elseif ($value == 'deny' && $params1) { $params = $params1; } SJB_Acl::allow($name, $type, $role, $value, $params, $message); } }
public function execute() { $template = SJB_Request::getVar('template', 'featured_listings.tpl'); $listingType = SJB_Request::getVar('listing_type', 'Job'); $searches['data']['listing_type']['equal'] = $listingType; $searches['data']['featured']['equal'] = 1; $searches['data']['default_listings_per_page'] = SJB_Request::getVar('items_count', 1); $searches['data']['sorting_field'] = 'featured_last_showed'; $searches['data']['default_sorting_field'] = 'featured_last_showed'; $searches['data']['default_sorting_order'] = 'ASC'; $searches['data']['sorting_order'] = 'ASC'; // фичерные листинги кешировать не будем $cache = SJB_Cache::getInstance(); $caching = $cache->getOption('caching'); $cache->setOption('caching', false); $searchResultsTP = new SJB_SearchResultsTP($searches['data'], $listingType); $searchResultsTP->setLimit(SJB_Request::getVar('items_count', 1)); $tp = $searchResultsTP->getChargedTemplateProcessor(); $featuredListingSIDs = $searchResultsTP->getListingSidCollectionForCurrentPage(); if ($featuredListingSIDs) { SJB_DB::query('UPDATE `listings` SET `featured_last_showed` = NOW() WHERE `sid` in (?w)', implode(',', $featuredListingSIDs)); SJB_Statistics::addSearchStatistics($featuredListingSIDs, $listingType); } $cache->setOption('caching', $caching); $tp->assign('number_of_cols', SJB_Request::getVar('number_of_cols', 1)); $tp->display($template); }
public function execute() { $listing_id = SJB_Request::getVar('listing_id', null); $tp = SJB_System::getTemplateProcessor(); if (isset($_REQUEST['action'])) { $action = strtolower($_REQUEST['action']); $comment_id = SJB_Request::getVar('comment_id', null); if (is_null($listing_id) && !is_null($comment_id)) { $listing_id = SJB_CommentManager::getListingSIDByCommentSID($comment_id); } $comment_ids = array(); if (isset($_REQUEST['comment']) && is_array($_REQUEST['comment'])) { $comment_ids = array_keys($_REQUEST['comment']); } else { $comment_ids = array($comment_id); } switch ($action) { case 'delete': foreach ($comment_ids as $comment_id) { SJB_CommentManager::deleteComment($comment_id); } break; case 'disable': foreach ($comment_ids as $comment_id) { SJB_CommentManager::disableComment($comment_id); } break; case 'enable': foreach ($comment_ids as $comment_id) { SJB_CommentManager::enableComment($comment_id); } break; case 'edit': if ($_SERVER['REQUEST_METHOD'] == 'POST') { SJB_DB::query("UPDATE `comments` SET `message` = ?s WHERE `sid` = ?n", $_REQUEST['message'], $comment_id); } else { $listingInfo = SJB_ListingManager::getListingInfoBySID($listing_id); $listingTypeInfo = SJB_ListingTypeManager::getListingTypeInfoBySID($listingInfo['listing_type_sid']); $tp->assign('listingType', SJB_ListingTypeManager::createTemplateStructure($listingTypeInfo)); $tp->assign('comment', SJB_CommentManager::getObjectInfoBySID('comments', $comment_id)); $tp->display('edit_comment.tpl'); return; } break; } header('Location: ' . SJB_System::getSystemSettings('SITE_URL') . '/listing-comments/?listing_id=' . $listing_id); exit; } if (!is_null($listing_id)) { $comments = SJB_CommentManager::getCommentsToListing($listing_id); $listingInfo = SJB_ListingManager::getListingInfoBySID($listing_id); $listingTypeInfo = SJB_ListingTypeManager::getListingTypeInfoBySID($listingInfo['listing_type_sid']); $tp->assign('comments', $comments); $tp->assign('comments_num', count($comments)); $tp->assign('listing_id', $listing_id); $tp->assign('listingType', SJB_ListingTypeManager::createTemplateStructure($listingTypeInfo)); $tp->display('listing_comments.tpl'); } }
public static function getAdminDetailsByUsername($username) { if (!empty($username)) { return SJB_DB::query("SELECT * FROM `administrator` WHERE `username` = ?s", $username); } else { return false; } }
public static function getUserSessionBySessionId($sessionId) { $userSession = SJB_DB::query('SELECT * FROM `session` WHERE `session_id` = ?s', $sessionId); if ($userSession) { return array_pop($userSession); } return null; }
/** * retrieve email template info by sid * @static * @param int $sid * @return bool|mixed */ public static function getEmailTemplateInfoBySID($sid) { $result = SJB_DB::query('SELECT * FROM `email_templates` WHERE `sid` = ?n', $sid); if (!empty($result)) { return array_pop($result); } return false; }
public function execute() { $id = SJB_Request::getVar('id', false); if ($id) { SJB_DB::query("DELETE FROM `parsers` WHERE id = ?n", $id); } SJB_HelperFunctions::redirect(SJB_System::getSystemSettings("SITE_URL") . "/show-import/"); }
function _getDetailIDs() { $property_id_collection = SJB_DB::query("SELECT DISTINCT id FROM {$this->table_prefix}_properties"); foreach ($property_id_collection as $key => $value) { $property_id_collection[$key] = $value['id']; } $this->property_collection = $property_id_collection; }
public static function setAdminInfo($username) { $result = SJB_DB::query('SELECT * FROM `subadmins` WHERE `username` = ?s ', $username); if (!empty($result)) { self::$subAdminInfo = $result[0]; return true; } return false; }
private function getProfileSocialInfo() { $this->profileSocialInfo = SJB_DB::query('SELECT * FROM `facebook` WHERE `facebook_id` = ?s', $this->socialID); if (!empty($this->profileSocialInfo)) { $this->profileSocialInfo = array_shift($this->profileSocialInfo); return true; } return null; }
public function getHashedListItemsByFieldSIDForApply($listing_field_sid) { $items = SJB_DB::query("SELECT * FROM `" . $this->table_prefix . "_field_list` WHERE `field_sid` = ?n ORDER BY `order`", $listing_field_sid); $list_items = array(); foreach ($items as $item) { $list_items[$item['sid']]['value'] = $item['value']; $list_items[$item['sid']]['score'] = $item['score']; } return $list_items; }
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; }
/** * @param int $feedSID * @param string $accountId * @param string $accountName */ public function updateAccessToken($feedSID, $accountId = '', $accountName = '') { $accessToken = $this->getAccessToken(); $expirationDate = date('Y-m-d', time() + 60 * 24 * 60 * 60); if (!empty($accountId) && !empty($accountName)) { SJB_DB::query("UPDATE `facebook_feeds` SET `access_token` = ?s, expiration_date = ?s, `account_id` = ?s, `account_name` = ?s\n\t\t\t\t\t\tWHERE `sid` = ?n", $accessToken, $expirationDate, $accountId, $accountName, $feedSID); } else { SJB_DB::query("UPDATE `facebook_feeds` SET `access_token` = ?s, expiration_date = ?s\n\t\t\t\t\t\tWHERE `sid` = ?n", $accessToken, $expirationDate, $feedSID); } }
public static function getSystemObjectInfo($object) { $object_system_info = SJB_DB::query("SELECT * FROM `?w` WHERE `sid` = ?n", $object->db_table_name, $object->getSID()); if (!empty($object_system_info)) { return array_pop($object_system_info); } else { $system_properties = SJB_DB::query("SHOW COLUMNS FROM `?w`", $object->db_table_name); foreach ($system_properties as $property) { $object_system_info[$property['Field']] = null; } } return $object_system_info; }
function isValid() { $this->fieldID = $this->property_info['id']; if (!isset($_FILES[$this->fieldID]['name']) || $_FILES[$this->fieldID]['name'] == '') { return true; } $file_id = $this->fieldID . "_tmp"; SJB_DB::query('DELETE FROM uploaded_files WHERE id=?s', $file_id); $this->property_info['value'] = $file_id; $upload_manager = new SJB_UploadFileManager(); $upload_manager->setFileGroup("video"); $upload_manager->setUploadedFileID($file_id); // CHECK FILE BEFORE UPLOAD if (!empty($this->property_info['max_file_size'])) { $upload_manager->setMaxFileSize($this->property_info['max_file_size']); } if (!$upload_manager->isValidUploadedVideoFile($this->fieldID)) { return $upload_manager->getError(); } $saved_file_name = $upload_manager->uploadFile($this->fieldID); if ($saved_file_name === false) { return $upload_manager->getError(); } $filename = SJB_BASE_DIR . '/files/video/' . $saved_file_name; $base_name = substr($saved_file_name, 0, strrpos($saved_file_name, ".")); $ext = substr($saved_file_name, 1 + strrpos($saved_file_name, ".")); if ($ext == 'flv') { $t_outfile = SJB_BASE_DIR . '/files/video/' . $base_name . '.flv_'; $outfile = SJB_BASE_DIR . '/files/video/' . $base_name . '.flv'; $this->convert_media($filename, $t_outfile, 640, 480, 32, 22050); if (!$upload_manager->fileExists($base_name . '.flv_', true)) { $upload_manager->deleteUploadedFileByID($file_id); return $upload_manager->getError(); } $upload_manager->deleteUploadedFileByID($file_id); rename($t_outfile, $outfile); } else { $outfile = SJB_BASE_DIR . '/files/video/' . $base_name . '.flv'; $this->convert_media($filename, $outfile, 640, 480, 32, 22050); if (!$upload_manager->fileExists($base_name . '.flv', true)) { $upload_manager->deleteUploadedFileByID($file_id); return $upload_manager->getError(); } $upload_manager->deleteUploadedFileByID($file_id); } $filename = SJB_BASE_DIR . '/files/video/' . $base_name . '.flv'; $img = SJB_BASE_DIR . '/files/video/' . $base_name . '.png'; $this->grab_image($filename, $img, "00:00:03", 'png', 640, 480); $upload_manager->registNewFile($file_id, $base_name . '.flv'); return true; }
public static function getSubAdminSIDsLikeSubAdminname($username) { if (empty($username)) { return null; } $subadmins_info = SJB_DB::query("SELECT `sid` FROM `subadmins` WHERE `username` LIKE '%?w%'", $username); if (!empty($subadmins_info)) { foreach ($subadmins_info as $user_info) { $subadmins_sids[$user_info['sid']] = $user_info['sid']; } return $subadmins_sids; } return null; }
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(); } }
function getObjectInfo($sorting_fields, $inner_join = false, $relevance = false) { $searchSqlTranslator = new SJB_SearchSqlTranslator($this->table_prefix); $sql_string = $searchSqlTranslator->buildSqlQuery($this->criteria, $this->valid_criterion_number, array($this->sorting_field => $this->sorting_order), $this->inner_join); SJB_DB::query($sql_string); $this->affectedRows = SJB_DB::getAffectedRows(); if ($this->limit !== false) { if (isset($this->limit['limit'])) { $sql_string .= " limit " . $this->limit['limit'] . ", " . $this->limit['num_rows']; } else { $sql_string .= " limit " . $this->limit . ", 100"; } } return SJB_DB::query($sql_string); }
public function execute() { $tp = SJB_System::getTemplateProcessor(); $listingSID = SJB_Request::getVar('listing_id'); $template = 'flag_listing.tpl'; $errors = array(); if ($listingSID) { // Flag listing $reason = SJB_Request::getVar('reason'); $comment = SJB_Request::getVar('comment'); $formSubmitted = SJB_Request::getVar('action'); if ($formSubmitted) { SJB_Captcha::getInstance($tp, $_REQUEST)->isValid($errors); } $listing = SJB_ListingManager::getObjectBySID($listingSID); if (!empty($listing)) { $listingInfo = SJB_ListingManager::createTemplateStructureForListing($listing); } else { $errors['WRONG_LISTING_ID_SPECIFIED'] = 'Listing does not exist'; } if ($formSubmitted == 'flag' && empty($errors)) { SJB_ListingManager::flagListingBySID($listingSID, $reason, $comment); // notify admin SJB_AdminNotifications::sendAdminListingFlaggedLetter($listing); $template = 'flag_listing_sended.tpl'; } elseif (!empty($listing)) { // Show form to reason $reasons = array(); if (is_numeric($listingSID) && is_numeric($listing->getListingTypeSID())) { $reasons = SJB_DB::query("SELECT * FROM `flag_listing_settings` WHERE FIND_IN_SET(?n, `listing_type_sid`)", $listing->getListingTypeSID()); } $tp->assign('flag_types', $reasons); } $tp->assign('listing_id', $listingSID); if (!empty($listingInfo)) { $tp->assign('listing_type_id', strtolower($listingInfo['type']['id'])); } if (!empty($errors)) { $tp->assign('errors', $errors); $tp->assign('reason', $reason); $tp->assign('comment', $comment); } } $tp->display($template); }
/** * @param $feedSID * @param string $accountId * @return array|null */ public function saveAccountInfo($feedSID, $accountId) { self::$object = new SJB_LinkedIn($this->createCallbackUrl()); $accessToken = self::$object->_getAccessToken(); $liveTime = isset($accessToken->_params['oauth_expires_in']) ? $accessToken->_params['oauth_expires_in'] : 60 * 24 * 60 * 60; $expirationDate = date('Y-m-d', time() + $liveTime); $accessToken = serialize($accessToken); if (!empty($accountId)) { $result = SJB_DB::query('UPDATE `linkedin_feeds` SET `access_token` = ?s, expiration_date = ?s, `account_id` = ?s WHERE `sid` = ?n OR `access_token` = ?s', $accessToken, $expirationDate, $accountId, $feedSID, $accessToken); } else { $result = SJB_DB::query('UPDATE `linkedin_feeds` SET `access_token` = ?s, expiration_date = ?s WHERE `sid` = ?n OR `access_token` = ?s', $accessToken, $expirationDate, $feedSID, $accessToken); } if ($result) { self::$object->setAccessToken(null); SJB_Session::unsetValue(self::NETWORK_ID); } return $result; }
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); foreach ($res as $key => $value) { if (strpos($key, ',')) { unset($res[$key]); $newKeys = explode(',', $key); foreach ($newKeys as $newKey) { $res[$newKey] = isset($res[$newKey]) ? $res[$newKey] + $value : $value; } } } } else { $sql = "select `value` as caption from `listing_field_list` where `field_sid`=?n"; $res = SJB_DB::query($sql, $this->field['sid']); } return $res; }
function getObjectInfo($sorting_fields, $inner_join = false, $relevance = false) { $searchSqlTranslator = new SJB_InvoiceSearchSQLTranslator($this->table_prefix); $sqlString = $searchSqlTranslator->buildSqlQuery($this->criteria, $this->valid_criterion_number, $sorting_fields, $this->inner_join); $where = ''; if ($this->sorting_field !== false && $this->sorting_order !== false) { $sqlString .= $where . "ORDER BY " . $this->sorting_field . " " . $this->sorting_order . " "; } SJB_DB::queryExec($sqlString); $this->affectedRows = SJB_DB::getAffectedRows(); if ($this->limit !== false) { if (isset($this->limit['limit'])) { $sqlString .= "limit " . $this->limit['limit'] . ", " . $this->limit['num_rows']; } else { $sqlString .= "limit " . $this->limit . ", 100"; } } return SJB_DB::query($sqlString); }
public function savePermissions($request, $product) { $acl = SJB_Acl::getInstance(); $resources = $acl->getResources(); $type = 'product'; $role = $product->getSID(); $serialized_extra_info = unserialize($product->getPropertyValue('serialized_extra_info')); $pricingType = $serialized_extra_info['pricing_type']; $listingTypeSid = $serialized_extra_info['listing_type_sid']; $listingTypeId = strtolower(SJB_ListingTypeManager::getListingTypeIDBySID($listingTypeSid)); $userGroupSID = $product->getPropertyValue('user_group_sid'); $groupPermissions = SJB_DB::query('select * from `permissions` where `type` = ?s and `role` = ?s', 'group', $userGroupSID); SJB_Acl::clearPermissions($type, $role); foreach ($groupPermissions as $key => $groupPermission) { $groupPermissions[$groupPermission['name']] = $groupPermission; unset($groupPermissions[$key]); } foreach ($resources as $name => $resource) { $params = isset($request[$name . '_params']) ? $request[$name . '_params'] : ''; $params1 = isset($request[$name . '_params1']) ? $request[$name . '_params1'] : ''; $value = isset($request[$name]) ? $request[$name] : ''; $message = isset($request[$name . '_message']) ? $request[$name . '_message'] : ''; if ($name == 'post_' . $listingTypeId) { $value = 'allow'; if ($pricingType == 'fixed') { $params = $product->getPropertyValue('number_of_listings'); } } elseif ($name == 'add_featured_listings' && (!empty($serialized_extra_info['featured']) || !empty($serialized_extra_info['upgrade_to_featured_listing_price']))) { $value = 'allow'; } elseif ($name == 'add_priority_listings' && (!empty($serialized_extra_info['priority']) || !empty($serialized_extra_info['upgrade_to_priority_listing_price']))) { $value = 'allow'; } if (empty($value) && isset($groupPermissions[$name])) { $value = 'inherit'; $message = $groupPermissions[$name]['message']; $params = $groupPermissions[$name]['params']; } elseif ($value == 'deny' && $params1) { $params = $params1; } SJB_Acl::allow($name, $type, $role, $value, $params, $message); } }
public function execute() { $tp = SJB_System::getTemplateProcessor(); $action = SJB_Request::getVar('action', '', SJB_Request::METHOD_GET); $mess_id = intval(SJB_Request::getVar('mess', 0, SJB_Request::METHOD_GET)); $return_to = SJB_Request::getVar('from', 'in', SJB_Request::METHOD_GET); $page = intval(SJB_Request::getVar('page', 1, SJB_Request::METHOD_GET)); $user = SJB_UserManager::getUserInfoBySID(SJB_Request::getVar('user_sid')); $user_id = $user['sid']; if ($action == 'delete') { SJB_DB::query("DELETE FROM `private_message` WHERE `id` = '{$mess_id}'"); $per_page = 10; if ($return_to == 'in') { $total = SJB_PrivateMessage::getTotalInbox($user_id); } else { $total = SJB_PrivateMessage::getTotalOutbox($user_id); } $max_pages = ceil($total / $per_page); if ($max_pages == 0) { $max_pages = 1; } if ($max_pages < $page) { $page = $max_pages; } $site_url = SJB_System::getSystemSettings('SITE_URL'); SJB_HelperFunctions::redirect($site_url . '/private-messages/pm-' . ($return_to == 'in' ? 'inbox' : 'outbox') . "/?user_sid={$user_id}&page={$page}"); } $message = SJB_PrivateMessage::ReadMessage($mess_id, true); $userGroupInfo = SJB_UserGroupManager::getUserGroupInfoBySID($user['user_group_sid']); SJB_System::setGlobalTemplateVariable('wikiExtraParam', $userGroupInfo['id']); $tp->assign("user_group_info", $userGroupInfo); $tp->assign('returt_to', $return_to); $tp->assign('username', $user['username']); $tp->assign('user_sid', $user_id); $tp->assign('message', $message); $tp->assign('page', $page); $tp->display('pm_read.tpl'); }
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); }
protected function _get_Captions_with_Counts_Grouped_by_Captions($request_data, array $listingSids = array()) { $columns = '?w as caption'; if (SJB_Settings::getValue('enableBrowseByCounter')) { $columns .= ', count(*) as count'; } $criteria = SJB_SearchFormBuilder::extractCriteriaFromRequestData($request_data); $sqlTranslator = new SJB_SearchSqlTranslator('listings'); $whereStatement = $sqlTranslator->_getWhereStatement($criteria); if (!empty($listingSids)) { $whereStatement .= 'AND `listings`.`sid` IN (' . implode(',', $listingSids) . ')'; } $res = SJB_DB::query("select {$columns} from listings {$whereStatement} and ?w != '' group by ?w", $this->field['field'], $this->field['field'], $this->field['field']); $result = array(); foreach ($res as $value) { if (SJB_Settings::getValue('enableBrowseByCounter')) { $result[$value['caption']] = $value['count']; } else { $result[$value['caption']] = ''; } } return $result; }
/** * @param $userSID * @param $productSID * @param $limitCheckoutedListingsToDelete */ public function deleteCheckoutedListingsByProduct($userSID, $productSID, $limitCheckoutedListingsToDelete) { $serializedProductSID = SJB_ProductsManager::generateQueryBySID($productSID); $listingsToDelete = SJB_DB::query("SELECT `sid` FROM `listings` WHERE `checkouted` = 0 AND `complete` = 1 AND `contract_id` = 0 AND `user_sid` = ?n AND `product_info` REGEXP '({$serializedProductSID})' ORDER BY `sid` DESC LIMIT ?n", $userSID, $limitCheckoutedListingsToDelete); $criteriaSaver = new SJB_ListingCriteriaSaver('MyListings'); $foundListingsSIDs = $criteriaSaver->getObjectSIDs(); foreach ($listingsToDelete as $listing) { SJB_ListingManager::deleteListingBySID($listing['sid']); if ($foundListingsSIDs != null) { $key = array_search($listing['sid'], $foundListingsSIDs); unset($foundListingsSIDs[$key]); } } if ($foundListingsSIDs != null) { $criteriaSaver->setSessionForObjectSIDs($foundListingsSIDs); } }