本文整理汇总了PHP中SJB_DB::query方法的典型用法代码示例。如果您正苦于以下问题:PHP SJB_DB::query方法的具体用法?PHP SJB_DB::query怎么用?PHP SJB_DB::query使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SJB_DB
的用法示例。
在下文中一共展示了SJB_DB::query方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getObjectInfo
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;
}
示例2: login
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;
}
示例3: execute
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);
}
示例4: savePermissions
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);
}
}
示例5: execute
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);
}
示例6: execute
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');
}
}
示例7: getAdminDetailsByUsername
public static function getAdminDetailsByUsername($username)
{
if (!empty($username)) {
return SJB_DB::query("SELECT * FROM `administrator` WHERE `username` = ?s", $username);
} else {
return false;
}
}
示例8: getUserSessionBySessionId
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;
}
示例9: getEmailTemplateInfoBySID
/**
* 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;
}
示例10: execute
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/");
}
示例11: _getDetailIDs
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;
}
示例12: setAdminInfo
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;
}
示例13: getProfileSocialInfo
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;
}
示例14: getHashedListItemsByFieldSIDForApply
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;
}
示例15: _get_Captions_with_Counts_Grouped_by_Captions
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;
}