本文整理汇总了PHP中PersistenceContext::get_querier方法的典型用法代码示例。如果您正苦于以下问题:PHP PersistenceContext::get_querier方法的具体用法?PHP PersistenceContext::get_querier怎么用?PHP PersistenceContext::get_querier使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PersistenceContext
的用法示例。
在下文中一共展示了PersistenceContext::get_querier方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __static
public static function __static()
{
self::$db_utils = PersistenceContext::get_dbms_utils();
self::$db_querier = PersistenceContext::get_querier();
self::$comments_table = PREFIX . 'comments';
self::$comments_topic_table = PREFIX . 'comments_topic';
self::$note_table = PREFIX . 'note';
self::$average_notes_table = PREFIX . 'average_notes';
self::$visit_counter_table = PREFIX . 'visit_counter';
self::$configs_table = PREFIX . 'configs';
self::$events_table = PREFIX . 'events';
self::$errors_404_table = PREFIX . 'errors_404';
self::$group_table = PREFIX . 'group';
self::$keywords_table = PREFIX . 'keywords';
self::$keywords_relations_table = PREFIX . 'keywords_relations';
self::$member_table = PREFIX . 'member';
self::$member_extended_fields_table = PREFIX . 'member_extended_fields';
self::$member_extended_fields_list = PREFIX . 'member_extended_fields_list';
self::$menus_table = PREFIX . 'menus';
self::$pm_msg_table = PREFIX . 'pm_msg';
self::$pm_topic_table = PREFIX . 'pm_topic';
self::$sessions_table = PREFIX . 'sessions';
self::$internal_authentication_table = PREFIX . 'internal_authentication';
self::$internal_authentication_failures_table = PREFIX . 'internal_authentication_failures';
self::$authentication_method_table = PREFIX . 'authentication_method';
self::$smileys_table = PREFIX . 'smileys';
self::$upload_table = PREFIX . 'upload';
self::$upload_cat_table = PREFIX . 'upload_cat';
}
示例2: get_page_authorizations
private function get_page_authorizations()
{
$columns = 'auth';
$condition = 'WHERE id = :id_in_module';
$parameters = array('id_in_module' => $this->get_id_in_module());
return PersistenceContext::get_querier()->get_column_value(PREFIX . 'pages', $columns, $condition, $parameters);
}
示例3: build_view
private function build_view($group_id)
{
if (!empty($group_id)) {
$group = $this->groups_cache->get_group($group_id);
$this->view->put_all(array('C_ADMIN' => AppContext::get_current_user()->check_level(User::ADMIN_LEVEL), 'U_ADMIN_GROUPS' => TPL_PATH_TO_ROOT . '/admin/admin_groups.php?id=' . $group_id, 'GROUP_NAME' => $group['name']));
} else {
$this->view->put_all(array('GROUP_NAME' => $this->lang['groups']));
}
$user_accounts_config = UserAccountsConfig::load();
$number_member = 0;
foreach ($this->get_members_group($group_id) as $user_id) {
if (!empty($user_id)) {
$user = PersistenceContext::get_querier()->select('SELECT
member.display_name, member.level, member.groups, member.warning_percentage, member.delay_banned, ext_field.user_avatar
FROM ' . DB_TABLE_MEMBER . ' member
LEFT JOIN ' . DB_TABLE_MEMBER_EXTENDED_FIELDS . ' ext_field ON ext_field.user_id = member.user_id
WHERE member.user_id = :user_id
', array('user_id' => $user_id))->fetch();
if (!empty($user)) {
//Avatar
$user_avatar = !empty($user['user_avatar']) ? Url::to_rel($user['user_avatar']) : ($user_accounts_config->is_default_avatar_enabled() ? Url::to_rel('/templates/' . AppContext::get_current_user()->get_theme() . '/images/' . $user_accounts_config->get_default_avatar_name()) : '');
$group_color = User::get_group_color($user['groups'], $user['level']);
$this->view->assign_block_vars('members_list', array('C_AVATAR' => $user['user_avatar'] || $user_accounts_config->is_default_avatar_enabled(), 'C_GROUP_COLOR' => !empty($group_color), 'PSEUDO' => $user['display_name'], 'LEVEL' => $user['warning_percentage'] < '100' || time() - $user['delay_banned'] < 0 ? UserService::get_level_lang($user['level']) : $this->lang['banned'], 'LEVEL_CLASS' => UserService::get_level_class($user['level']), 'GROUP_COLOR' => $group_color, 'U_PROFILE' => UserUrlBuilder::profile($user_id)->rel(), 'U_AVATAR' => $user_avatar));
$number_member++;
}
}
}
$this->view->put_all(array('C_NOT_MEMBERS' => $number_member == 0, 'SELECT_GROUP' => $this->build_form($group_id)->display()));
}
示例4: build_view
public function build_view(HTTPRequestCustom $request)
{
$authorized_categories = FaqService::get_authorized_categories(Category::ROOT_CATEGORY);
$mode = $request->get_getstring('sort', FaqUrlBuilder::DEFAULT_SORT_MODE);
$field = $request->get_getstring('field', FaqUrlBuilder::DEFAULT_SORT_FIELD);
$sort_mode = $mode == 'asc' ? 'ASC' : 'DESC';
switch ($field) {
case 'question':
$sort_field = FaqQuestion::SORT_ALPHABETIC;
break;
default:
$sort_field = FaqQuestion::SORT_DATE;
break;
}
$result = PersistenceContext::get_querier()->select('SELECT *
FROM ' . FaqSetup::$faq_table . ' faq
LEFT JOIN ' . DB_TABLE_MEMBER . ' member ON member.user_id = faq.author_user_id
WHERE approved = 0
AND faq.id_category IN :authorized_categories
' . (!FaqAuthorizationsService::check_authorizations()->moderation() ? ' AND faq.author_user_id = :user_id' : '') . '
ORDER BY ' . $sort_field . ' ' . $sort_mode, array('authorized_categories' => $authorized_categories, 'user_id' => AppContext::get_current_user()->get_id()));
$this->tpl->put_all(array('C_QUESTIONS' => $result->get_rows_count() > 0, 'C_PENDING' => true, 'C_MORE_THAN_ONE_QUESTION' => $result->get_rows_count() > 1, 'C_DISPLAY_TYPE_ANSWERS_HIDDEN' => FaqConfig::load()->is_display_type_answers_hidden(), 'QUESTIONS_NUMBER' => $result->get_rows_count()));
while ($row = $result->fetch()) {
$faq_question = new FaqQuestion();
$faq_question->set_properties($row);
$this->tpl->assign_block_vars('questions', $faq_question->get_array_tpl_vars());
}
$result->dispose();
$this->build_sorting_form($field, $mode);
}
示例5: execute
public function execute(HTTPRequestCustom $request)
{
$id = $request->get_getint('id', 0);
if (!empty($id) && AppContext::get_current_user()->check_level(User::MEMBER_LEVEL)) {
try {
$this->downloadfile = DownloadService::get_downloadfile('WHERE download.id = :id', array('id' => $id));
} catch (RowNotFoundException $e) {
$error_controller = PHPBoostErrors::unexisting_page();
DispatchManager::redirect($error_controller);
}
}
if ($this->downloadfile !== null && $this->downloadfile->is_visible()) {
if (!PersistenceContext::get_querier()->row_exists(PREFIX . 'events', 'WHERE id_in_module=:id_in_module AND module=\'download\' AND current_status = 0', array('id_in_module' => $this->downloadfile->get_id()))) {
$contribution = new Contribution();
$contribution->set_id_in_module($this->downloadfile->get_id());
$contribution->set_entitled(StringVars::replace_vars(LangLoader::get_message('contribution.deadlink', 'common'), array('link_name' => $this->downloadfile->get_name())));
$contribution->set_fixing_url(DownloadUrlBuilder::edit($this->downloadfile->get_id())->relative());
$contribution->set_description(LangLoader::get_message('contribution.deadlink_explain', 'common'));
$contribution->set_poster_id(AppContext::get_current_user()->get_id());
$contribution->set_module('download');
$contribution->set_type('alert');
$contribution->set_auth(Authorizations::capture_and_shift_bit_auth(DownloadService::get_categories_manager()->get_heritated_authorizations($this->downloadfile->get_id_category(), Category::MODERATION_AUTHORIZATIONS, Authorizations::AUTH_CHILD_PRIORITY), Category::MODERATION_AUTHORIZATIONS, Contribution::CONTRIBUTION_AUTH_BIT));
ContributionService::save_contribution($contribution);
}
DispatchManager::redirect(new UserContributionSuccessController());
} else {
$error_controller = PHPBoostErrors::unexisting_page();
DispatchManager::redirect($error_controller);
}
}
示例6: update_position
private function update_position($request)
{
$fields_list = json_decode(TextHelper::html_entity_decode($request->get_value('tree')));
foreach ($fields_list as $position => $tree) {
PersistenceContext::get_querier()->inject("UPDATE " . DB_TABLE_MEMBER_EXTENDED_FIELDS_LIST . " SET \r\n\t\t\t\tposition = :position\r\n\t\t\t\tWHERE id = :id", array('position' => $position, 'id' => $tree->id));
}
}
示例7: synchronize
public function synchronize()
{
$this->bugs_number = array('total' => 0);
$db_querier = PersistenceContext::get_querier();
$config = BugtrackerConfig::load();
$versions = $config->get_versions();
$result = $db_querier->select("SELECT status, COUNT(*) as bugs_number\r\n\t\tFROM " . BugtrackerSetup::$bugtracker_table . "\r\n\t\tGROUP BY status\r\n\t\tORDER BY status ASC");
foreach ($result as $row) {
$this->bugs_number[$row['status']] = $row['bugs_number'];
$this->bugs_number['total'] += $row['bugs_number'];
}
$result->dispose();
$result = $db_querier->select("SELECT @fixed_in:=fixed_in AS fixed_in, \r\n\t\tCOUNT(*) as bugs_number, \r\n\t\t(SELECT COUNT(*) FROM " . BugtrackerSetup::$bugtracker_table . " WHERE fixed_in = @fixed_in AND status = '" . Bug::FIXED . "') as fixed_bugs_number, \r\n\t\t(SELECT COUNT(*) FROM " . BugtrackerSetup::$bugtracker_table . " WHERE fixed_in = @fixed_in AND (status = '" . Bug::IN_PROGRESS . "' OR status = '" . Bug::REOPEN . "')) as in_progress_bugs_number\r\n\t\tFROM " . BugtrackerSetup::$bugtracker_table . "\r\n\t\tGROUP BY fixed_in\r\n\t\tORDER BY fixed_in ASC");
foreach ($result as $row) {
if (!empty($row['fixed_in']) && isset($versions[$row['fixed_in']])) {
$this->bugs_number_per_version[$row['fixed_in']] = array('all' => $row['bugs_number'], Bug::FIXED => $row['fixed_bugs_number'], Bug::IN_PROGRESS => $row['in_progress_bugs_number']);
}
}
$result->dispose();
$result = $db_querier->select("SELECT member.*, COUNT(*) as bugs_number\r\n\t\tFROM " . BugtrackerSetup::$bugtracker_table . " bugtracker\r\n\t\tJOIN " . DB_TABLE_MEMBER . " member ON member.user_id = bugtracker.author_id\r\n\t\tWHERE status <> '" . Bug::REJECTED . "'\r\n\t\tGROUP BY author_id\r\n\t\tORDER BY bugs_number DESC\r\n\t\tLIMIT " . $config->get_stats_top_posters_number());
$i = 1;
foreach ($result as $row) {
$author = new User();
if (!empty($row['user_id'])) {
$author->set_properties($row);
} else {
$author->init_visitor_user();
}
$this->top_posters[$i] = array('user' => $author, 'bugs_number' => $row['bugs_number']);
$i++;
}
$result->dispose();
}
示例8: on_changeday
/**
* {@inheritDoc}
*/
public function on_changeday(Date $yesterday, Date $today)
{
$config = ShoutboxConfig::load();
if ($config->is_max_messages_number_enabled()) {
PersistenceContext::get_querier()->delete(ShoutboxSetup::$shoutbox_table, 'WHERE id NOT IN (SELECT * FROM (SELECT id FROM ' . ShoutboxSetup::$shoutbox_table . ' ORDER BY id DESC LIMIT ' . $config->get_max_messages_number() . ') AS temp)');
}
}
示例9: execute
public function execute(HTTPRequestCustom $request)
{
$lang = LangLoader::get('common');
$is_admin = AppContext::get_current_user()->check_level(User::ADMIN_LEVEL);
$number_admins = UserService::count_admin_members();
$suggestions = array();
try {
$result = PersistenceContext::get_querier()->select("SELECT user_id, display_name, level, groups FROM " . DB_TABLE_MEMBER . " WHERE display_name LIKE '" . str_replace('*', '%', $request->get_value('value', '')) . "%'");
while ($row = $result->fetch()) {
$user_group_color = User::get_group_color($row['groups'], $row['level']);
$suggestion = '';
if ($is_admin) {
$edit_link = new LinkHTMLElement(UserUrlBuilder::edit_profile($row['user_id']), '', array('title' => $lang['edit']), 'fa fa-edit');
if ($row['level'] != User::ADMIN_LEVEL || $row['level'] == User::ADMIN_LEVEL && $number_admins > 1) {
$delete_link = new LinkHTMLElement(AdminMembersUrlBuilder::delete($row['user_id']), '', array('title' => $lang['delete'], 'data-confirmation' => 'delete-element'), 'fa fa-delete');
} else {
$delete_link = new LinkHTMLElement('', '', array('title' => $lang['delete'], 'onclick' => 'return false;'), 'fa fa-delete icon-disabled');
}
$suggestion .= $edit_link->display() . ' ' . $delete_link->display() . ' ';
}
$profile_link = new LinkHTMLElement(UserUrlBuilder::profile($row['user_id'])->rel(), $row['display_name'], array('style' => !empty($user_group_color) ? 'color:' . $user_group_color : ''), UserService::get_level_class($row['level']));
$suggestion .= $profile_link->display();
$suggestions[] = $suggestion;
}
$result->dispose();
} catch (Exception $e) {
}
return new JSONResponse(array('suggestions' => $suggestions));
}
示例10: insert_data
private function insert_data()
{
$lang = LangLoader::get('install', 'bugtracker');
PersistenceContext::get_querier()->insert(self::$bugtracker_table, array('id' => 1, 'title' => $lang['bug.1.title'], 'contents' => $lang['bug.1.contents'], 'author_id' => 1, 'submit_date' => time(), 'fix_date' => 0, 'status' => Bug::NEW_BUG, 'severity' => 1, 'priority' => 3, 'type' => 1, 'category' => 1, 'reproductible' => 1, 'reproduction_method' => '', 'detected_in' => 0, 'fixed_in' => 0, 'assigned_to_id' => 0));
PersistenceContext::get_querier()->insert(self::$bugtracker_table, array('id' => 2, 'title' => $lang['bug.2.title'], 'contents' => $lang['bug.2.contents'], 'author_id' => 1, 'submit_date' => time() - 1000, 'fix_date' => time(), 'status' => Bug::FIXED, 'severity' => 2, 'priority' => 4, 'type' => 1, 'category' => 2, 'reproductible' => 1, 'reproduction_method' => '', 'detected_in' => 0, 'fixed_in' => 0, 'assigned_to_id' => 0));
PersistenceContext::get_querier()->insert(self::$bugtracker_table, array('id' => 3, 'title' => $lang['bug.3.title'], 'contents' => $lang['bug.3.contents'], 'author_id' => 1, 'submit_date' => time(), 'fix_date' => 0, 'status' => Bug::REOPEN, 'severity' => 3, 'priority' => 5, 'type' => 1, 'category' => 3, 'reproductible' => 1, 'reproduction_method' => '', 'detected_in' => 0, 'fixed_in' => 0, 'assigned_to_id' => 0));
}
示例11: user_exists
public function user_exists(FormField $field)
{
if ($field->get_value()) {
return PersistenceContext::get_querier()->row_exists(DB_TABLE_MEMBER, 'WHERE display_name=:display_name', array('display_name' => $field->get_value()));
}
return false;
}
示例12: delete_question
private function delete_question(FaqQuestion $question)
{
FaqService::delete('WHERE id=:id', array('id' => $question->get_id()));
PersistenceContext::get_querier()->delete(DB_TABLE_EVENTS, 'WHERE module=:module AND id_in_module=:id', array('module' => 'faq', 'id' => $question->get_id()));
Feed::clear_cache('faq');
FaqCache::invalidate();
}
示例13: get_search_request
public function get_search_request($args)
{
$search = $args['search'];
$weight = isset($args['weight']) && is_numeric($args['weight']) ? $args['weight'] : 1;
require_once PATH_TO_ROOT . '/pages/pages_defines.php';
$categories = PagesCategoriesCache::load()->get_categories();
$unauth_cats = '';
if (!AppContext::get_current_user()->check_auth(PagesConfig::load()->get_authorizations(), READ_PAGE)) {
$unauth_cats .= '0,';
}
foreach ($categories as $id => $cat) {
if (!AppContext::get_current_user()->check_auth($cat['auth'], READ_PAGE)) {
$unauth_cats .= $id . ',';
}
}
$unauth_cats = !empty($unauth_cats) ? " AND p.id_cat NOT IN (" . trim($unauth_cats, ',') . ")" : '';
$results = array();
$result = PersistenceContext::get_querier()->select("SELECT " . $args['id_search'] . " AS `id_search`,\r\n\t\tp.id AS `id_content`,\r\n\t\tp.title AS `title`,\r\n\t\t( 2 * FT_SEARCH_RELEVANCE(p.title, '" . $args['search'] . "') + FT_SEARCH_RELEVANCE(p.contents, '" . $args['search'] . "') ) / 3 * " . $weight . " AS `relevance`,\r\n\t\tCONCAT('" . PATH_TO_ROOT . "/pages/pages.php?title=',p.encoded_title) AS `link`,\r\n\t\tp.auth AS `auth`\r\n\t\tFROM " . PREFIX . "pages p\r\n\t\tWHERE ( FT_SEARCH(title, '" . $args['search'] . "') OR FT_SEARCH(contents, '" . $args['search'] . "') )" . $unauth_cats . "\r\n\t\tLIMIT 100 OFFSET 0");
while ($row = $result->fetch()) {
if (!empty($row['auth'])) {
$auth = unserialize($row['auth']);
if (!AppContext::get_current_user()->check_auth($auth, READ_PAGE)) {
unset($row['auth']);
array_push($results, $row);
}
} else {
unset($row['auth']);
array_push($results, $row);
}
}
$result->dispose();
return $results;
}
示例14: execute
function execute(HTTPRequestCustom $request)
{
session_start();
$data = PersistenceContext::get_querier()->select_single_row(PREFIX . 'member', array('user_id'), 'WHERE login=:user_login', array('user_login' => $_SESSION['wpimport']['default_author']));
$_SESSION['wpimport']['wppath'] = substr($_SESSION['wpimport']['wppath'], -1) != '/' ? $_SESSION['wpimport']['wppath'] . '/' : $_SESSION['wpimport']['wppath'];
$_SESSION['wpimport']['phpboostpath'] = substr($_SESSION['wpimport']['phpboostpath'], -1) != '/' ? $_SESSION['wpimport']['phpboostpath'] . '/' : $_SESSION['wpimport']['phpboostpath'];
define('WP_PATH', $_SESSION['wpimport']['wppath']);
define('PBOOST_PATH', $_SESSION['wpimport']['phpboostpath']);
define('IMPORTER_LIST', $_SESSION['wpimport']['importer']);
define('PHPBOOST_CAT_IMAGE', $_SESSION['wpimport']['default_cat_image']);
define('FILESYSTEM_IMPORT_LOCATION', $_SESSION['wpimport']['import_location']);
define('DEFAULT_AUTHOR_ID', $data['user_id']);
ini_set('max_execution_time', 0);
if (function_exists('xdebug_disable')) {
xdebug_disable();
}
ob_start();
echo 'Start import : ' . date('H:i:s') . PHP_EOL;
echo '-----' . PHP_EOL . PHP_EOL;
$success = (require_once __DIR__ . '/../WP2PhpBoost/wp2phpboost.php');
echo 'Clean cache...' . PHP_EOL;
AppContext::get_cache_service()->clear_cache();
echo PHP_EOL . PHP_EOL;
echo '-----' . PHP_EOL;
echo 'End import : ' . date('H:i:s');
$logs = ob_get_clean();
return new JSONResponse(array('success' => $success, 'logs' => utf8_decode($logs)));
}
示例15: synchronize
/**
* {@inheritdoc}
*/
public function synchronize()
{
$this->comments = array();
$result = PersistenceContext::get_querier()->select("\n\t\t\tSELECT comments.*, topic.*, member.*\n\t\t\tFROM " . DB_TABLE_COMMENTS . " comments\n\t\t\tLEFT JOIN " . DB_TABLE_COMMENTS_TOPIC . " topic ON comments.id_topic = topic.id_topic\n\t\t\tLEFT JOIN " . DB_TABLE_MEMBER . " member ON member.user_id = comments.user_id\n\t\t\tORDER BY comments.timestamp " . CommentsConfig::load()->get_order_display_comments());
while ($row = $result->fetch()) {
$this->comments[$row['id']] = array('id' => $row['id'], 'id_topic' => $row['id_topic'], 'module_id' => $row['module_id'], 'id_in_module' => $row['id_in_module'], 'topic_identifier' => $row['topic_identifier'], 'message' => $row['message'], 'note' => $row['note'], 'timestamp' => $row['timestamp'], 'path' => $row['path'], 'user_id' => $row['user_id']);
}
}