当前位置: 首页>>代码示例>>PHP>>正文


PHP SJB_DB::quote方法代码示例

本文整理汇总了PHP中SJB_DB::quote方法的典型用法代码示例。如果您正苦于以下问题:PHP SJB_DB::quote方法的具体用法?PHP SJB_DB::quote怎么用?PHP SJB_DB::quote使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SJB_DB的用法示例。


在下文中一共展示了SJB_DB::quote方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getAddParameter

 function getAddParameter()
 {
     if (isset($this->property_info['value']['add_parameter'])) {
         return SJB_DB::quote($this->property_info['value']['add_parameter']);
     }
     return '';
 }
开发者ID:Maxlander,项目名称:shixi,代码行数:7,代码来源:MonetaryType.php

示例2: _getWhatPart

 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();
 }
开发者ID:Maxlander,项目名称:shixi,代码行数:34,代码来源:ListingRequestCreator.php

示例3: execute

 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');
 }
开发者ID:Maxlander,项目名称:shixi,代码行数:60,代码来源:export_users.php

示例4: isAdminExist

 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);
 }
开发者ID:Maxlander,项目名称:shixi,代码行数:7,代码来源:admin.php

示例5: admin_login

 /**
  * logging into system as administrator
  * Function logs administrator into system.
  * If operation succeded it registers session variables 'username' and 'usertype'
  * @param string $username user's name
  * @param string $password user's password
  * @return bool 'true' if operation succeeded or 'false' otherwise
  */
 public static function admin_login($username)
 {
     $username = SJB_DB::quote($username);
     SJB_SubAdmin::setAdminInfo($username);
     SJB_Session::setValue('adminLoginCounter', 1);
     SJB_Session::setValue('username', $username);
     SJB_Session::setValue('usertype', "subadmin");
     setcookie("admin_mode", 'on', null, '/');
     return true;
 }
开发者ID:Maxlander,项目名称:shixi,代码行数:18,代码来源:subadmin.php

示例6: parse

 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;
 }
开发者ID:Maxlander,项目名称:shixi,代码行数:45,代码来源:BooleanEvaluator.php

示例7: getFlagsNumberByListingTypeSID

 /**
  * Get total flags number by listing type SID
  * 
  * Count and return total numbers of flag
  *
  * @param integer $listingTypeSID
  * @param array   $filters
  * @param boolean $groupByListing
  * @return integer
  */
 public static function getFlagsNumberByListingTypeSID($listingTypeSID, $filters = null, $groupByListing = false)
 {
     $filterFlag = '';
     $filterUser = '';
     $filterTitle = '';
     if ($filters !== null) {
         $filterFlag = isset($filters['flag_reason']) ? $filters['flag_reason'] : '';
         $filterUser = isset($filters['username']) ? $filters['username'] : '';
         $filterTitle = isset($filters['title']) ? $filters['title'] : '';
     }
     $joinUsers = '';
     if (!empty($filterFlag)) {
         $filterFlag = SJB_DB::quote($filterFlag);
         $filterFlag = " AND fl.flag_reason LIKE '%{$filterFlag}%' ";
     }
     if (!empty($filterUser)) {
         $filterUser = SJB_DB::quote($filterUser);
         $joinUsers = " LEFT JOIN `users` u ON (u.sid = l.user_sid) ";
         $filterUser = " AND u.username LIKE '%{$filterUser}%' ";
     }
     if (!empty($filterTitle)) {
         $filterTitle = SJB_DB::quote($filterTitle);
         $filterTitle = " AND l.`Title` LIKE '%{$filterTitle}%' ";
     }
     // SET GROUP PARAM
     $groupOption = '';
     if ($groupByListing) {
         $groupOption = " GROUP BY fl.listing_sid";
     }
     // SET LISTING TYPE FILTER
     if (empty($listingTypeSID)) {
         $listingTypeFilter = ' fl.`listing_type_sid` <> 0 ';
     } elseif (is_numeric($listingTypeSID)) {
         $listingTypeFilter = " fl.`listing_type_sid` = {$listingTypeSID} ";
     }
     $listingsNum = SJB_DB::query("\n\t\t\tSELECT count(*) count \n\t\t\t\tFROM `flagged_listings` fl \n\t\t\tLEFT JOIN `listings` l ON (l.sid = fl.listing_sid) \n\t\t\t{$joinUsers}\n\t\t\tWHERE {$listingTypeFilter} {$filterFlag} {$filterUser} {$filterTitle}\n\t\t\t{$groupOption}");
     // if group option - get number of flagged LISTINGs
     if ($groupByListing) {
         return count($listingsNum);
     }
     // if no group option - return number of flags
     return $listingsNum[0]['count'];
 }
开发者ID:Maxlander,项目名称:shixi,代码行数:53,代码来源:ListingManager.php

示例8: execute

 public function execute()
 {
     $errors = array();
     if (SJB_Request::isAjax()) {
         $response = null;
         $user_type = SJB_Request::getVar('user_type');
         $user_name = SJB_Request::getVar('parser_user');
         $products = SJB_XmlImport::getProducts($user_type, $user_name, $errors);
         $response = array('products' => empty($products) ? '' : SJB_XmlImport::translateProductsName($products), 'error' => empty($errors) ? '' : array_pop($errors));
         die(json_encode($response));
     }
     $tp = SJB_System::getTemplateProcessor();
     $add_level = SJB_Request::getVar('add_level', 1);
     // check for errors
     if ($add_level == '3') {
         $selectUserType = SJB_Request::getVar('selectUserType');
         $addNewUser = 0;
         if ($selectUserType == 'username') {
             $usr_name = isset($_REQUEST['parser_user']) ? SJB_DB::quote($_REQUEST['parser_user']) : '';
             $usr_id = SJB_UserManager::getUserSIDbyUsername($usr_name);
             if (empty($usr_name)) {
                 $errors[] = 'Please enter user name of existing user to the "User Name" field';
                 $usr_name = '';
             } else {
                 $user_sid_exists = SJB_UserManager::getUserSIDbyUsername($usr_name);
                 if (empty($user_sid_exists)) {
                     $errors[] = 'User "' . $usr_name . '" not exists. Please enter user name of existing user to the "User Name" field';
                     $usr_name = '';
                 }
             }
         } elseif ($selectUserType == 'group') {
             $userGroupSid = isset($_REQUEST['parser_user']) ? $_REQUEST['parser_user'] : 0;
             $usr_id = $userGroupSid;
             $usr_name = SJB_UserGroupManager::getUserGroupIDBySID($usr_id);
             $addNewUser = 1;
         }
         if ($errors) {
             $add_level = 2;
         }
     }
     $listings_type = SJB_ListingTypeManager::getAllListingTypesInfo();
     $types = array();
     foreach ($listings_type as $one) {
         $types[$one['sid']] = $one['id'];
     }
     $tp->assign('types', $types);
     $selected_logo_options = null;
     switch ($add_level) {
         case '1':
             $template = 'add_step_one.tpl';
             /*
             $types = array();
             foreach ( $listings_type as $one ) {
             					  $types[$one['sid']] = $one['id'];
             }
             $tp->assign('types', $types);
             */
             $tp->display('add_step_one.tpl');
             break;
         case '2':
             $template = 'add_step_two.tpl';
             $original_xml = SJB_Request::getVar('xml');
             $xml = $original_xml;
             $tree = '';
             $listing_fields = array();
             $logo_options_array = array('not_logo' => 'Do Not Import Logo', 'import_logo' => 'Import Logo with Listings', 'upload_logo' => 'Upload Logo for Imported Listings');
             $parsing_name = SJB_Request::getVar('parser_name');
             $usr_name = SJB_Request::getVar('parser_user');
             $pars_url = SJB_Request::getVar('parser_url');
             $form_description = SJB_Request::getVar('form_description', '', 'POST');
             $type_id = SJB_Request::getVar('type_id', '', 'POST');
             $selectedLogoOption = SJB_Request::getVar('logo_options');
             $selectedLogoField = SJB_Request::getVar('import_logo_field');
             $selectedProduct = SJB_Request::getVar('postUnderProduct');
             $id = SJB_Request::getVar('id', 0, 'GET');
             $selected = array();
             $a_selected = array();
             if (!empty($_REQUEST['xml']) || $id > 0) {
                 // step 2 OR edit exist
                 if ($id > 0) {
                     // load exist parser
                     $parser_from_id = SJB_XmlImport::getSystemParsers($id);
                     if (isset($parser_from_id[0]['name'])) {
                         $parser_from_id = $parser_from_id[0];
                     }
                     $parsing_name = $parser_from_id['name'];
                     $usr_id = $parser_from_id['usr_id'];
                     $usr_name = $parser_from_id['usr_name'];
                     $form_description = $parser_from_id['description'];
                     $pars_url = $parser_from_id['url'];
                     $type_id = $parser_from_id['type_id'];
                     $selected_logo_options = unserialize($parser_from_id['logo_options']);
                     $selectedLogoOption = $selected_logo_options['option'];
                     $selectedLogoField = $selected_logo_options['field'];
                     $selectedProduct = $parser_from_id['product_sid'];
                     $xml = $parser_from_id['xml'];
                     $xml = SJB_XmlImport::cleanXmlFromImport($xml);
                     $map = unserialize($parser_from_id['maper']);
                     $selected = array_values($map);
                     $a_selected = array_keys($map);
//.........这里部分代码省略.........
开发者ID:Maxlander,项目名称:shixi,代码行数:101,代码来源:add_import.php

示例9: _getSelectRelevanceStatement

 function _getSelectRelevanceStatement($criteria)
 {
     $value = SJB_DB::quote($criteria['value']);
     if (SJB_DB::table_exists($this->object_table_prefix . '_properties')) {
         if ($this->object_table_prefix == 'listings' && $this->isComplex) {
             return "SELECT `{$this->object_table_prefix}`.`sid` as `object_sid`, if( COUNT( `complex_enum` ) >0, COUNT( DISTINCT `id` ), COUNT( *  ) ) `count`,  MATCH(`{$criteria['field']}`) AGAINST ('{$value}') as relevance ";
         } else {
             return "SELECT `{$this->object_table_prefix}`.`sid` as `object_sid`, COUNT(*) as `count` ";
         }
     }
     return "SELECT `{$this->object_table_prefix}`.`sid` as `object_sid`,  MATCH`(`{$criteria['field']}`) AGAINST ('{$value}') as relevance";
 }
开发者ID:Maxlander,项目名称:shixi,代码行数:12,代码来源:SearchSqlTranslator.php

示例10: getAddParameter

 function getAddParameter()
 {
     if (isset($this->property_info['value']['add_parameter']) && $this->property_info['id'] == 'ApplicationSettings') {
         return SJB_DB::quote($this->property_info['value']['add_parameter']);
     }
     return '';
 }
开发者ID:Maxlander,项目名称:shixi,代码行数:7,代码来源:StringType.php

示例11: execute

 public function execute()
 {
     header('Content-Type: text/html; charset=utf-8');
     $requestUri = $_SERVER['REQUEST_URI'];
     preg_match('(.*/autocomplete/([a-zA-Z0-9:_]*)/?)', $requestUri, $fieldParam);
     $field = !empty($fieldParam[1]) ? $fieldParam[1] : '';
     preg_match("(.*/autocomplete/{$field}/([a-zA-Z]*)/?)", $requestUri, $fieldType);
     $fieldType = !empty($fieldType[1]) ? $fieldType[1] : '';
     preg_match("(.*/autocomplete/{$field}/{$fieldType}/([a-zA-Z]*)/?)", $requestUri, $tablePrefix);
     $tablePrefix = SJB_DB::quote(!empty($tablePrefix[1]) ? $tablePrefix[1] : '');
     preg_match("(.*/autocomplete/{$field}/{$fieldType}/{$tablePrefix}/([a-zA-Z]*)/?)", $requestUri, $viewType);
     $viewType = SJB_DB::quote(!empty($viewType[1]) ? $viewType[1] : '');
     preg_match("(.*/autocomplete/{$field}/{$fieldType}/{$tablePrefix}/{$viewType}/([a-zA-Z]*)/?)", $requestUri, $listingTypeID);
     $listingTypeID = SJB_DB::quote(!empty($listingTypeID[1]) ? $listingTypeID[1] : '');
     $query = SJB_Request::getVar('q', false);
     if (!empty($query) && $field && $fieldType && $tablePrefix && $viewType && $listingTypeID) {
         $queryCriterion = $query . '%';
         if ($fieldType == 'text' && $field == 'keywords') {
             $result = SJB_DB::query('SELECT `keywords` as `value`, COUNT(*) `count` FROM `listings_keywords` WHERE `keywords` LIKE ?s AND `active` = 1 GROUP BY `keywords` ORDER BY `count` DESC LIMIT 0 , 5', $queryCriterion);
         } elseif ($fieldType == 'geo') {
             $result = SJB_DB::query('SELECT DISTINCT `name` as `value`, COUNT(*) `count` FROM `locations` WHERE `name` <> \'\' AND `name` LIKE ?s GROUP BY `value` LIMIT 0 , 100', $queryCriterion);
         } elseif ($fieldType == 'location') {
             if (preg_match('/[a-z\\d]+\\d+/i', $query)) {
                 $result = SJB_DB::query('SELECT DISTINCT `name` as `value`, `city`, `state_code`, COUNT(*) `count` FROM `locations` WHERE `name` <> \'\' AND `name` LIKE ?s GROUP BY `value`, `country_sid` LIMIT 0 , 10', $queryCriterion);
             } else {
                 $country = SJB_DB::query("SELECT `country_name` as `value` FROM `countries` WHERE `country_code` = ?s AND `active` = 1", $query);
                 $countries = SJB_DB::query("SELECT `country_name` as `value` FROM `countries` WHERE `country_name` LIKE ?s AND `country_code` != ?s AND `active` = 1", $queryCriterion, $query);
                 $countries = array_merge($country, $countries);
                 $states = SJB_DB::query("SELECT `state_name` as `value` FROM `states` INNER JOIN `countries` ON `states`.`country_sid` = `countries`.`sid` WHERE `countries`.`active` = 1 AND `states`.`state_name` LIKE ?s AND `states`.`active` = 1", $queryCriterion);
                 foreach ($states as $key => $state) {
                     $state = trim(preg_replace('/(\\s+|[^\'"_\\w\\dÀ-ÿ])/ui', '', strip_tags($state['value'])));
                     $states[$state] = $states[$key];
                     unset($states[$key]);
                 }
                 $cities = SJB_DB::query("\n\t\t\t\t\t\tSELECT\n\t\t\t\t\t\t\t`locations`.`state_code`, `city` as `value`\n\t\t\t\t\t\tFROM\n\t\t\t\t\t\t\t`locations`\n\t\t\t\t\t\tINNER JOIN\n\t\t\t\t\t\t\t`countries` ON `locations`.`country_sid` = `countries`.`sid`\n\t\t\t\t\t\tLEFT JOIN\n\t\t\t\t\t\t\t`states` ON `locations`.`state_code` = `states`.`state_code`\n\t\t\t\t\t\tWHERE\n\t\t\t\t\t\t\t`countries`.`active` = 1 AND\n\t\t\t\t\t\t\t`locations`.`city` LIKE ?s AND\n\t\t\t\t\t\t\t(`states`.`active` = 1 OR\n\t\t\t\t\t\t\tLENGTH(`locations`.`state_code`) = 0)", $queryCriterion);
                 foreach ($cities as $key => $city) {
                     $state = trim(preg_replace('/(\\s+|[^\'"_\\w\\dÀ-ÿ])/ui', '', strip_tags($city['state_code'])));
                     $city = trim(preg_replace('/(\\s+|[^\'"_\\w\\dÀ-ÿ])/ui', '', strip_tags($city['value'])));
                     $cities[$city][$state] = $cities[$key];
                     unset($cities[$key]);
                 }
                 $result = array();
                 $i = 0;
                 foreach ($states as $key => $state) {
                     $result[$i] = $state;
                     $i++;
                     if (isset($cities[$key])) {
                         $result[$i] = $cities[$key];
                         unset($cities[$key]);
                         $i++;
                     }
                 }
                 $result = array_merge($countries, $result);
                 $result = array_merge($result, $cities);
             }
         } elseif ($fieldType == 'string') {
             $additionalCondition = '';
             $fieldParents = explode('_', $field);
             $fieldName = array_pop($fieldParents);
             if ($fieldName == 'City') {
                 if ($viewType == 'input') {
                     $tablePrefix = 'locations';
                     $field = 'City';
                 } elseif ($viewType == 'search' && $tablePrefix == 'listings') {
                     $listingTypeSid = SJB_ListingTypeManager::getListingTypeSIDByID($listingTypeID);
                     $additionalCondition = '`listing_type_sid` = ' . $listingTypeSid . ' AND';
                 }
             }
             $result = SJB_DB::query("SELECT DISTINCT `{$field}` as `value`, COUNT(*) `count` FROM `{$tablePrefix}` WHERE " . $additionalCondition . " `{$field}` LIKE ?s GROUP BY `{$field}` ORDER BY `count` DESC LIMIT 0 , 5", $queryCriterion);
         }
         if (!empty($result)) {
             foreach ($result as $rowBase) {
                 if (empty($rowBase['value']) && is_array($rowBase)) {
                     foreach ($rowBase as $rowBase) {
                         $res = strpos(strtolower($rowBase['value']), strtolower($query));
                         if ($res !== false || $fieldType == 'location') {
                             $rowBase['value'] = trim($rowBase['value']);
                             if (isset($rowBase['city']) && isset($rowBase['state_code'])) {
                                 print $rowBase['value'] . ', ' . $rowBase['city'] . ', ' . $rowBase['state_code'] . "\n";
                             } elseif (!empty($rowBase['state_code'])) {
                                 print $rowBase['value'] . ', ' . $rowBase['state_code'] . "\n";
                             } elseif (!isset($rowBase['count'])) {
                                 print $rowBase['value'] . "\n";
                             } else {
                                 print $rowBase['value'] . '|' . $rowBase['count'] . "\n";
                             }
                         }
                     }
                 } else {
                     $res = strpos(strtolower($rowBase['value']), strtolower($query));
                     if ($res !== false || $fieldType == 'location') {
                         $rowBase['value'] = trim($rowBase['value']);
                         if (isset($rowBase['city']) && isset($rowBase['state_code'])) {
                             print $rowBase['value'] . ', ' . $rowBase['city'] . ', ' . $rowBase['state_code'] . "\n";
                         } elseif (!empty($rowBase['state_code'])) {
                             print $rowBase['value'] . ', ' . $rowBase['state_code'] . "\n";
                         } elseif (!isset($rowBase['count'])) {
                             print $rowBase['value'] . "\n";
                         } else {
                             print $rowBase['value'] . '|' . $rowBase['count'] . "\n";
//.........这里部分代码省略.........
开发者ID:Maxlander,项目名称:shixi,代码行数:101,代码来源:autocomplete.php

示例12: sqlProfileCallback

 private static function sqlProfileCallback($m)
 {
     global $sqlProfileArgs;
     @($arg = array_shift($sqlProfileArgs));
     switch ($m[0]) {
         case '?n':
             // number
             return intval($arg);
         case '?s':
             // string
             return "'" . SJB_DB::quote($arg) . "'";
         case '?b':
             // binary (0x462347238)
             return '0x' . bin2hex($arg);
         case '?f':
             // float
             return floatval(str_replace(',', '.', $arg));
         case '?w':
             // without
             return $arg;
         case '?t':
             // time
             return "'" . date("Y-m-d H:i:s", $arg) . "'";
         case '?l':
             // list
             $str = '';
             if (is_array($arg)) {
                 foreach ($arg as $value) {
                     $str .= (empty($str) ? "'" : ", '") . SJB_DB::quote($value) . "'";
                 }
                 return $str;
             }
             return "'" . SJB_DB::quote($arg) . "'";
         default:
             return $m[0];
             break;
     }
 }
开发者ID:Maxlander,项目名称:shixi,代码行数:38,代码来源:DB.php

示例13: execute


//.........这里部分代码省略.........
                 $applications = SJB_Request::getVar('applications', '');
                 if (!empty($applications)) {
                     if (is_array($applications)) {
                         foreach ($applications as $key => $value) {
                             $this->approveApplication($key);
                         }
                     } else {
                         $this->approveApplication($applications);
                     }
                 }
                 break;
             case "reject":
                 $applications = SJB_Request::getVar('applications', '');
                 if (!empty($applications)) {
                     if (is_array($applications)) {
                         foreach ($applications as $key => $value) {
                             $this->rejectApplication($key);
                         }
                     } else {
                         $this->rejectApplication($applications);
                     }
                 }
                 break;
             case "delete":
                 if (isset($_POST["applications"])) {
                     foreach ($_POST["applications"] as $key => $value) {
                         SJB_Applications::hideEmp($key);
                     }
                 }
                 break;
         }
         $whereSubuser = '';
         if (!empty($subuser)) {
             $whereSubuser = ' and `subuser_sid` = ' . SJB_DB::quote($subuser);
         }
         $jobs = SJB_DB::query('select `Title` as `title`, `sid` as `id` from `listings` where `user_sid` = ?n' . $whereSubuser, $currentUser->sid);
         $listingTitle = null;
         foreach ($jobs as $job) {
             if ($job['id'] == $appJobId) {
                 $listingTitle = $job['title'];
             }
         }
         $apps = $this->executeApplicationsForEmployer($appsPerPage, $appJobId, $currentUser, $score, $orderInfo, $listingTitle);
         if (empty($apps) && $this->currentPage > 1) {
             $this->currentPage = 1;
             $apps = $this->executeApplicationsForEmployer($appsPerPage, $appJobId, $currentUser, $score, $orderInfo, $listingTitle);
         }
         foreach ($apps as $i => $app) {
             $apps[$i]["job"] = SJB_ListingManager::getListingInfoBySID($apps[$i]["listing_id"]);
             if (!empty($apps[$i]["job"]['screening_questionnaire'])) {
                 $screening_questionnaire = SJB_ScreeningQuestionnaires::getInfoBySID($apps[$i]["job"]['screening_questionnaire']);
                 $passing_score = 0;
                 switch ($screening_questionnaire['passing_score']) {
                     case 'acceptable':
                         $passing_score = 1;
                         break;
                     case 'good':
                         $passing_score = 2;
                         break;
                     case 'very_good':
                         $passing_score = 3;
                         break;
                     case 'excellent':
                         $passing_score = 4;
                         break;
                 }
开发者ID:Maxlander,项目名称:shixi,代码行数:67,代码来源:view.php

示例14: getQueryForZipCodesByRadius

 /**
  * @param array $findZipCodes
  * @param string $city
  * @return string
  */
 private function getQueryForZipCodesByRadius(array $findZipCodes, $city)
 {
     $geoLocation = new SJB_GeoLocation();
     $radiusSearchUnit = SJB_System::getSettingByName('radius_search_unit');
     if ($city) {
         $minLatitude = $maxLatitude = $findZipCodes[0]['latitude'];
         $minLongitude = $maxLongitude = $findZipCodes[0]['longitude'];
         $stateCode = $findZipCodes[0]['state_code'];
         $countrySid = $findZipCodes[0]['country_sid'];
         foreach ($findZipCodes as $zipCode) {
             if ($stateCode != $zipCode['state_code'] || $countrySid != $zipCode['country_sid']) {
                 return '';
             } else {
                 $zipLatitude = $zipCode['latitude'];
                 $zipLongitude = $zipCode['longitude'];
                 if ($zipLatitude < $minLatitude) {
                     $minLatitude = $zipLatitude;
                 } else {
                     if ($zipLatitude > $maxLatitude) {
                         $maxLatitude = $zipLatitude;
                     }
                 }
                 if ($zipLongitude < $minLongitude) {
                     $minLongitude = $zipLongitude;
                 } else {
                     if ($zipLongitude > $maxLongitude) {
                         $maxLongitude = $zipLongitude;
                     }
                 }
             }
         }
         $distance = SJB_LocationManager::getDistanceBetweenPointsInKm($minLatitude, $minLongitude, $maxLatitude, $maxLongitude);
         $distance /= 2;
         $distance += $radiusSearchUnit == 'kilometers' ? $this->value['radius'] : $this->value['radius'] * 1.60934;
         $centralLatitude = ($minLatitude + $maxLatitude) / 2;
         $centralLongitude = ($minLongitude + $maxLongitude) / 2;
         $centralLocation = $geoLocation->fromDegrees($centralLatitude, $centralLongitude);
         $query = SJB_LocationManager::findPlacesWithinDistance($centralLocation, $distance);
         $query .= " AND (`city` != '" . SJB_DB::quote($city) . "')";
     } else {
         $query = array();
         $distance = $radiusSearchUnit == 'kilometers' ? $this->value['radius'] : $this->value['radius'] * 1.60934;
         foreach ($findZipCodes as $zipCode) {
             $myLocation = $geoLocation->fromDegrees($zipCode['latitude'], $zipCode['longitude']);
             $query[] = SJB_LocationManager::findPlacesWithinDistance($myLocation, $distance);
         }
         $query = implode(' OR ', $query);
     }
     return "SELECT `name` FROM `locations` WHERE {$query}";
 }
开发者ID:Maxlander,项目名称:shixi,代码行数:55,代码来源:SearchCriterion.php

示例15: getCountApplicationsByEmployer

 public static function getCountApplicationsByEmployer($userSID, $score = false, $subuser = false)
 {
     $subuserFilter = '';
     if ($subuser !== false) {
         $subuserFilter = ' and `l`.`subuser_sid` = ' . SJB_DB::quote($subuser);
     }
     $scoreFilter['case'] = '';
     $scoreFilter['inner_join'] = '';
     $scoreFilter['score'] = '';
     if (!empty($score)) {
         $scoreFilter = self::getScoredApplications($score);
     }
     $appsCount = SJB_DB::queryValue("\n\t\t\tSELECT COUNT(`a`.`listing_id`)\n\t\t\t\t{$scoreFilter['case']}\n\t\t\tFROM\n\t\t\t\t`applications` `a`\n\t\t\tINNER JOIN `listings` l ON\n\t\t\t\t`l`.`sid` = `a`.`listing_id`\n\t\t\t\t{$scoreFilter['inner_join']}\n\t\t\tWHERE `l`.`user_sid` = ?s AND `a`.`show_emp` = 1 {$scoreFilter['score']}{$subuserFilter} ", $userSID);
     return $appsCount;
 }
开发者ID:Maxlander,项目名称:shixi,代码行数:15,代码来源:Applications.php


注:本文中的SJB_DB::quote方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。