function getAddParameter() { if (isset($this->property_info['value']['add_parameter'])) { return SJB_DB::quote($this->property_info['value']['add_parameter']); } return ''; }
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; }
function isDataValid(&$errors) { $errors = array(); if ($this->name == '') { $errors['Zip Code'] = 'EMPTY_VALUE'; } $count = SJB_DB::queryValue("SELECT count(*) FROM `locations` WHERE `name` = ?s AND `country_sid` = ?s AND `state` = ?s AND `city` = ?s AND sid <> ?n ", $this->name, $this->country_sid, $this->state, $this->city, $this->sid); if ($count) { $errors['Zip Code'] = 'NOT_UNIQUE_VALUE'; } if ($this->longitude == '') { $errors['Longitude'] = 'EMPTY_VALUE'; } elseif (!is_numeric($this->longitude)) { $errors['Longitude'] = 'NOT_FLOAT_VALUE'; } if ($this->latitude == '') { $errors['Latitude'] = 'EMPTY_VALUE'; } elseif (!is_numeric($this->latitude)) { $errors['Latitude'] = 'NOT_FLOAT_VALUE'; } if ($this->country_sid == '') { $errors['Country'] = 'EMPTY_VALUE'; } return count($errors) == 0; }
function _getWhatPart() { if (is_array($this->order_info['property'])) { foreach ($this->order_info['property'] as $orderInfoProperty) { $property[] = $orderInfoProperty; } } else { $property = $this->order_info['property']; } if (is_array($property)) { foreach ($property as $propertyItem) { if ($propertyItem->isSystem()) { return "`{$this->table_prefix}`.sid"; } } } elseif ($property->isSystem()) { if ($this->orderRelevance) { $value = SJB_DB::quote($this->orderRelevance['value']['value']); return "`{$this->table_prefix}`.sid, MATCH(`{$this->orderRelevance['value']['field']}`) AGAINST ('{$value}') as relevance"; } else { return "`{$this->table_prefix}`.sid"; } } elseif ($property->getType() != 'tree') { $id = $property->getID(); $sql_type = $property->getSQLType(); if ($sql_type == 'DECIMAL') { // DECIMAL type is available in MYSQL 5.0.8 or higher return "{$this->table_prefix}.*, {$id}.value + 0.0 AS {$id}"; } return "{$this->table_prefix}.*, CAST({$id}.value AS {$sql_type}) AS {$id}"; } $tree_browser = new SJB_TreeBrowser($property->getID()); return "{$this->table_prefix}.*, " . $tree_browser->getWhatPart(); }
public static function isAdminExist($username, $password) { $username = SJB_DB::quote($username); $password = md5(SJB_DB::quote($password)); $value = SJB_DB::queryValue("SELECT * FROM `administrator` WHERE `username` = ?s AND `password` = '?w'", $username, $password); return !empty($value); }
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() { ini_set('max_execution_time', 0); $tp = SJB_System::getTemplateProcessor(); $userGroupID = SJB_Request::getVar('user_group_id', 0); $user = SJB_UsersExportController::createUser($userGroupID); $searchFormBuilder = new SJB_SearchFormBuilder($user); $criteria = $searchFormBuilder->extractCriteriaFromRequestData($_REQUEST, $user); $searchFormBuilder->registerTags($tp); $searchFormBuilder->setCriteria($criteria); if ($_SERVER['REQUEST_METHOD'] == 'POST') { $exportProperties = SJB_Request::getVar('export_properties', array()); if (empty($exportProperties)) { SJB_FlashMessages::getInstance()->addWarning('EMPTY_EXPORT_PROPERTIES'); } else { $innerJoin = false; if (isset($_REQUEST['product']['multi_like']) && $_REQUEST['product']['multi_like'] != '') { $products = $_REQUEST['product']['multi_like']; if (is_array($products)) { $products = implode(',', $products); } $whereParam = implode(',', explode(',', SJB_DB::quote($products))); $innerJoin = array('contracts' => array('join_field' => 'user_sid', 'join_field2' => 'sid', 'join' => 'INNER JOIN', 'where' => "AND FIND_IN_SET(`contracts`.`product_sid`, '{$whereParam}')")); unset($criteria['system']['product']); } $searcher = new SJB_UserSearcher(false, 'parent_sid', 'ASC', $innerJoin); $searchAliases = SJB_UsersExportController::getSearchPropertyAliases(); $foundUsersSid = $searcher->getObjectsSIDsByCriteria($criteria, $searchAliases); if (!empty($foundUsersSid)) { $result = SJB_UsersExportController::createExportDirectories(); if ($result === true) { $exportProperties['extUserID'] = 1; $exportProperties['parent_sid'] = 1; $exportAliases = SJB_UsersExportController::getExportPropertyAliases(); $exportData = SJB_UsersExportController::getExportData($foundUsersSid, $exportProperties, $exportAliases); $fileName = 'users.xls'; SJB_UsersExportController::makeExportFile($exportData, $fileName); if (!file_exists(SJB_System::getSystemSettings('EXPORT_FILES_DIRECTORY') . "/{$fileName}")) { SJB_FlashMessages::getInstance()->addWarning('CANT_CREATE_EXPORT_FILES'); } else { SJB_HelperFunctions::redirect(SJB_System::getSystemSettings("SITE_URL") . "/users/archive-and-send-export-data/"); } } } else { SJB_FlashMessages::getInstance()->addWarning('EMPTY_EXPORT_DATA'); } } } $userSystemProperties = SJB_UserManager::getAllUserSystemProperties(); $userGroups = SJB_UserGroupManager::getAllUserGroupsInfo(); $userCommonProperties = array(); foreach ($userGroups as $userGroup) { $userGroupProperties = SJB_UserProfileFieldManager::getFieldsInfoByUserGroupSID($userGroup['sid']); $userCommonProperties[$userGroup['id']] = $userGroupProperties; } $tp->assign('userSystemProperties', $userSystemProperties); $tp->assign('userCommonProperties', $userCommonProperties); $tp->assign('selected_user_group_id', $userGroupID); $tp->display('export_users.tpl'); }
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 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 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/"); }
public static function getAdminDetailsByUsername($username) { if (!empty($username)) { return SJB_DB::query("SELECT * FROM `administrator` WHERE `username` = ?s", $username); } else { return false; } }
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; }
function getSQLValue() { $fileId = $this->property_info['id'] . '_' . $this->object_sid; $this->property_info['value'] = $fileId; SJB_DB::queryExec("UPDATE uploaded_files SET id = ?s WHERE id = ?s LIMIT 1", $fileId, $this->property_info['id'] . '_tmp'); if (SJB_UploadFileManager::doesFileExistByID($fileId)) { return $fileId; } return ''; }
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; }
public function getItemsFromDB($uri, $decorate = false) { $items = SJB_DB::queryValue("SELECT `data` FROM `browse` WHERE `page_uri` = ?s", $uri); $items = unserialize($items); if ($decorate) { $searcherFactory = $this->searcherFactory; $categorySearcher = $searcherFactory->getCategorySearcher($this->_getField()); $items = $categorySearcher->decorateItems($this->requestdata, $items); } return $items; }
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(); } }
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; }
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 static function parse($expression, $returnAsArray = false, $field = '') { $expr = array(); $oprs = array(); preg_match_all('/".*?"|\\)|\\(|\\s+|[^"\\)\\(\\s]+/', $expression, $matches); $chunks = array(); foreach ($matches[0] as $match) { $chunk = trim($match, "\" \t\r\n\v"); if (!empty($chunk)) { $chunks[] = $chunk; } } foreach ($chunks as $char) { switch (strtolower($char)) { case "(": $oprs[] = $char; $expr[] = $char; break; case "not": case "or": case "and": $oprs[] = strtolower($char); break; case ")": SJB_BooleanEvaluator::evaluate($oprs, $expr, true, $returnAsArray); SJB_BooleanEvaluator::evaluate($oprs, $expr, false, $returnAsArray); break; default: $char = SJB_DB::quote($char); if ($returnAsArray) { $expr[] = $char; } else { $expr[] = "{$field} like '%{$char}%'"; } SJB_BooleanEvaluator::evaluate($oprs, $expr, false, $returnAsArray); break; } } SJB_BooleanEvaluator::evaluate($oprs, $expr, false, $returnAsArray); if (count($expr) > 0) { $val = array_shift($expr); return !in_array($val, array('not', 'or', 'and', '(', ')')) ? $val : null; } return null; }
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); }
function isValid() { if (!preg_match("/^[a-zA-Z0-9\\._-]+@[a-zA-Z0-9\\._-]+\\.[a-zA-Z]{2,}\$/", $this->property_info['value']['original'])) { return 'NOT_VALID_EMAIL_FORMAT'; } if ($this->email_confirmation == 1 && $this->property_info['value']['original'] != $this->property_info['value']['confirmed']) { return 'NOT_CONFIRMED'; } if ($this->property_info['is_system']) { $count = SJB_DB::queryValue("SELECT count(*) FROM ?w WHERE ?w = ?s AND sid <> ?n", $this->property_info['table_name'], $this->property_info['id'], $this->property_info['value']['original'], $this->object_sid); } else { $count = SJB_DB::queryValue("SELECT COUNT(*) FROM ?w WHERE id = ?s AND value = ?s AND object_sid <> ?n", $this->property_info['table_name'] . "_properties", $this->property_info['id'], $this->property_info['value']['original'], $this->object_sid); } if ($count) { return 'NOT_UNIQUE_VALUE'; } return true; }
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); }