本文整理汇总了PHP中Url::encode_rewrite方法的典型用法代码示例。如果您正苦于以下问题:PHP Url::encode_rewrite方法的具体用法?PHP Url::encode_rewrite怎么用?PHP Url::encode_rewrite使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Url
的用法示例。
在下文中一共展示了Url::encode_rewrite方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: update_cats_table
private function update_cats_table()
{
$this->querier->inject('RENAME TABLE ' . PREFIX . 'media_cat' . ' TO ' . PREFIX . 'media_cats');
$columns = $this->db_utils->desc_table(PREFIX . 'media_cats');
$this->querier->inject('ALTER TABLE ' . PREFIX . 'media_cats CHANGE mime_type content_type INT(11)');
if (isset($columns['visible'])) {
$this->db_utils->drop_column(PREFIX . 'media_cats', 'visible');
}
if (isset($columns['active'])) {
$this->db_utils->drop_column(PREFIX . 'media_cats', 'active');
}
if (isset($columns['num_media'])) {
$this->db_utils->drop_column(PREFIX . 'media_cats', 'num_media');
}
if (!isset($columns['rewrited_name'])) {
$this->db_utils->add_column(PREFIX . 'media_cats', 'rewrited_name', array('type' => 'string', 'length' => 250, 'default' => "''"));
}
if (!isset($columns['special_authorizations'])) {
$this->db_utils->add_column(PREFIX . 'media_cats', 'special_authorizations', array('type' => 'boolean', 'notnull' => 1, 'default' => 0));
}
$result = $this->querier->select_rows(PREFIX . 'media_cats', array('id', 'name', 'auth'));
while ($row = $result->fetch()) {
$this->querier->update(PREFIX . 'media_cats', array('rewrited_name' => Url::encode_rewrite($row['name']), 'special_authorizations' => (int) (!empty($row['auth']))), 'WHERE id = :id', array('id' => $row['id']));
}
$result->dispose();
}
示例2: build_view
private function build_view($request)
{
$config = BugtrackerConfig::load();
$versions = $config->get_versions();
$display_versions = count($versions);
$stats_cache = BugtrackerStatsCache::load();
$bugs_number_per_version = $stats_cache->get_bugs_number_per_version_list();
$top_posters = $stats_cache->get_top_posters_list();
$this->view->put_all(array('C_BUGS' => $stats_cache->get_bugs_number('total'), 'C_FIXED_BUGS' => !empty($bugs_number_per_version), 'C_POSTERS' => !empty($top_posters), 'C_DISPLAY_VERSIONS' => $display_versions, 'C_DISPLAY_TOP_POSTERS' => $config->are_stats_top_posters_enabled(), 'C_ROADMAP_ENABLED' => $config->is_roadmap_enabled()));
foreach ($stats_cache->get_bugs_number_list() as $status => $bugs_number) {
if ($status != 'total') {
$this->view->assign_block_vars('status', array('NAME' => $this->lang['status.' . $status], 'NUMBER' => $bugs_number));
}
}
foreach ($bugs_number_per_version as $version_id => $bugs_number) {
$release_date = !empty($versions[$version_id]['release_date']) && is_numeric($versions[$version_id]['release_date']) ? new Date($versions[$version_id]['release_date'], Timezone::SERVER_TIMEZONE) : null;
$this->view->assign_block_vars('fixed_version', array('NAME' => stripslashes($versions[$version_id]['name']), 'RELEASE_DATE' => !empty($release_date) ? $release_date->format(Date::FORMAT_DAY_MONTH_YEAR) : $this->lang['notice.not_defined_e_date'], 'LINK_VERSION_ROADMAP' => BugtrackerUrlBuilder::roadmap($version_id, Url::encode_rewrite($versions[$version_id]['name']))->rel(), 'NUMBER' => $bugs_number['all']));
}
foreach ($top_posters as $id => $poster) {
if (isset($poster['user'])) {
$author_group_color = User::get_group_color($poster['user']->get_groups(), $poster['user']->get_level(), true);
$this->view->assign_block_vars('top_poster', array('C_AUTHOR_GROUP_COLOR' => !empty($author_group_color), 'ID' => $id, 'AUTHOR' => $poster['user']->get_display_name(), 'AUTHOR_LEVEL_CLASS' => UserService::get_level_class($poster['user']->get_level()), 'AUTHOR_GROUP_COLOR' => $author_group_color, 'LINK_AUTHOR_PROFILE' => UserUrlBuilder::profile($poster['user']->get_id())->rel(), 'USER_BUGS' => $poster['bugs_number']));
}
}
return $this->view;
}
示例3: get_feed_data_struct
function get_feed_data_struct($idcat = 0, $name = '')
{
if (MediaService::get_categories_manager()->get_categories_cache()->category_exists($idcat)) {
require_once PATH_TO_ROOT . '/media/media_constant.php';
$category = MediaService::get_categories_manager()->get_categories_cache()->get_category($idcat);
$site_name = GeneralConfig::load()->get_site_name();
$site_name = $idcat != Category::ROOT_CATEGORY ? $site_name . ' : ' . $category->get_name() : $site_name;
$feed_module_name = LangLoader::get_message('module_title', 'common', 'media');
$data = new FeedData();
$data->set_title($feed_module_name . ' - ' . $site_name);
$data->set_date(new Date());
$data->set_link(SyndicationUrlBuilder::rss('media', $idcat));
$data->set_host(HOST);
$data->set_desc($feed_module_name . ' - ' . $site_name);
$data->set_lang(LangLoader::get_message('xml_lang', 'main'));
$data->set_auth_bit(Category::READ_AUTHORIZATIONS);
$categories = MediaService::get_categories_manager()->get_childrens($idcat, new SearchCategoryChildrensOptions(), true);
$ids_categories = array_keys($categories);
$results = PersistenceContext::get_querier()->select('SELECT media.*, cat.image
FROM ' . MediaSetup::$media_table . ' media
LEFT JOIN ' . MediaSetup::$media_cats_table . ' cat ON cat.id = media.idcat
WHERE media.idcat IN :ids_categories
AND infos = :status_approved
ORDER BY timestamp DESC', array('ids_categories' => $ids_categories, 'status_approved' => MEDIA_STATUS_APROBED));
foreach ($results as $row) {
// Rewriting
$link = new Url('/media/media' . url('.php?id=' . $row['id'], '-' . $row['id'] . '+' . Url::encode_rewrite($row['name']) . '.php'));
$item = new FeedItem();
$item->set_title($row['name']);
$item->set_link($link);
$item->set_guid($link);
$item->set_desc(FormatingHelper::second_parse($row['contents']));
$item->set_date(new Date($row['timestamp'], Timezone::SERVER_TIMEZONE));
$item->set_image_url($row['image']);
$item->set_auth(MediaService::get_categories_manager()->get_heritated_authorizations($row['idcat'], Category::READ_AUTHORIZATIONS, Authorizations::AUTH_PARENT_PRIORITY));
$enclosure = new FeedItemEnclosure();
$enclosure->set_lenght(@filesize($row['url']));
$enclosure->set_type($row['mime_type']);
$enclosure->set_url($row['url']);
$item->set_enclosure($enclosure);
$data->add_item($item);
}
$results->dispose();
return $data;
}
}
示例4: get_feed_data_struct
public function get_feed_data_struct($idcat = 0, $name = '')
{
$config = ForumConfig::load();
$category = ForumService::get_categories_manager()->get_categories_cache()->get_category($idcat);
$data = new FeedData();
$data->set_title(LangLoader::get_message('xml_forum_desc', 'common', 'forum'));
$data->set_date(new Date());
$data->set_link(DispatchManager::get_url('/syndication', '/rss/forum/' . $idcat . '/'));
$data->set_host(HOST);
$data->set_desc(LangLoader::get_message('xml_forum_desc', 'common', 'forum'));
$data->set_lang(LangLoader::get_message('xml_lang', 'main'));
$data->set_auth_bit(Category::READ_AUTHORIZATIONS);
$categories = ForumService::get_categories_manager()->get_childrens($idcat, new SearchCategoryChildrensOptions(), true);
$ids_categories = array_keys($categories);
$results = PersistenceContext::get_querier()->select('SELECT t.id, t.idcat, t.title, t.last_timestamp, t.last_msg_id, t.display_msg, t.nbr_msg AS t_nbr_msg, msg.id mid, msg.contents
FROM ' . PREFIX . 'forum_topics t
LEFT JOIN ' . PREFIX . 'forum_msg msg ON msg.id = t.last_msg_id
WHERE t.idcat IN :ids_categories
ORDER BY t.last_timestamp DESC LIMIT :limit OFFSET 0', array('ids_categories' => $ids_categories, 'limit' => 2 * $config->get_number_messages_per_page()));
foreach ($results as $row) {
$item = new FeedItem();
//Link
$last_page = ceil($row['t_nbr_msg'] / $config->get_number_messages_per_page());
$last_page_rewrite = $last_page > 1 ? '-' . $last_page : '';
$last_page = $last_page > 1 ? 'pt=' . $last_page . '&' : '';
$link = new Url('/forum/topic' . url('.php?' . $last_page . 'id=' . $row['id'], '-' . $row['id'] . $last_page_rewrite . '+' . Url::encode_rewrite($row['title']) . '.php') . '#m' . $row['last_msg_id']);
$item->set_title(($config->is_message_before_topic_title_displayed() && !empty($row['display_msg']) ? TextHelper::html_entity_decode($config->get_message_before_topic_title(), ENT_NOQUOTES) . ' ' : '') . stripslashes($row['title']));
$item->set_link($link);
$item->set_guid($link);
$item->set_desc(FormatingHelper::second_parse($row['contents']));
$item->set_date(new Date($row['last_timestamp'], Timezone::SERVER_TIMEZONE));
$item->set_auth(ForumService::get_categories_manager()->get_heritated_authorizations($row['idcat'], Category::READ_AUTHORIZATIONS, Authorizations::AUTH_PARENT_PRIORITY));
$data->add_item($item);
}
$results->dispose();
return $data;
}
示例5: create_module_map_sections
private function create_module_map_sections($id_cat, $auth_mode)
{
global $LANG;
$pages_config = PagesConfig::load();
$categories_cache = PagesCategoriesCache::load();
$categories = $categories_cache->get_categories();
//Configuration des authorisations
$config_authorizations = $pages_config->get_authorizations();
$this_category = new SitemapLink($categories[$id_cat]['title'], new Url('/pages/' . url('pages.php?title=' . Url::encode_rewrite($categories[$id_cat]['title']), Url::encode_rewrite($categories[$id_cat]['title']))));
$category = new SitemapSection($this_category);
$i = 0;
$keys = array_keys($categories);
$num_cats = $categories_cache->get_number_categories();
$properties = array();
for ($j = 0; $j < $num_cats; $j++) {
$id = $keys[$j];
$properties = $categories[$id];
if ($auth_mode == Sitemap::AUTH_PUBLIC) {
$this_auth = is_array($properties['auth']) ? Authorizations::check_auth(RANK_TYPE, User::VISITOR_LEVEL, $properties['auth'], READ_PAGE) : Authorizations::check_auth(RANK_TYPE, User::VISITOR_LEVEL, $config_authorizations, READ_PAGE);
} elseif ($auth_mode == Sitemap::AUTH_USER) {
if (AppContext::get_current_user()->get_level() == User::ADMIN_LEVEL) {
$this_auth = true;
} else {
$this_auth = is_array($properties['auth']) ? Authorizations::check_auth(RANK_TYPE, AppContext::get_current_user()->get_level(), $properties['auth'], READ_PAGE) : Authorizations::check_auth(RANK_TYPE, AppContext::get_current_user()->get_level(), $config_authorizations, READ_PAGE);
}
}
if ($this_auth && $id != 0 && $properties['id_parent'] == $id_cat) {
$category->add($this->create_module_map_sections($id, $auth_mode));
$i++;
}
}
if ($i == 0) {
$category = $this_category;
}
return $category;
}
示例6: elseif
$error_controller = PHPBoostErrors::user_not_authorized();
DispatchManager::redirect($error_controller);
} elseif (!$is_cat && !AppContext::get_current_user()->check_auth($config->get_authorizations(), WIKI_CREATE_ARTICLE)) {
$error_controller = PHPBoostErrors::user_not_authorized();
DispatchManager::redirect($error_controller);
} elseif (!$captcha->is_valid() && !AppContext::get_current_user()->check_level(User::MEMBER_LEVEL)) {
$error_controller = new UserErrorController(LangLoader::get_message('error', 'status-messages-common'), LangLoader::get_message('captcha.validation_error', 'status-messages-common'), UserErrorController::NOTICE);
DispatchManager::redirect($error_controller);
}
//On vérifie que le titre n'existe pas
$article_exists = PersistenceContext::get_querier()->count(PREFIX . "wiki_articles", 'WHERE encoded_title = :encoded_title', array('encoded_title' => Url::encode_rewrite($title)));
//Si il existe: message d'erreur
if ($article_exists > 0) {
$errstr = $LANG['wiki_title_already_exists'];
} else {
$result = PersistenceContext::get_querier()->insert(PREFIX . "wiki_articles", array('title' => $title, 'encoded_title' => Url::encode_rewrite($title), 'id_cat' => $new_id_cat, 'is_cat' => $is_cat, 'undefined_status' => '', 'auth' => ''));
//On récupère le numéro de l'article créé
$id_article = $result->get_last_inserted_id();
//On insère le contenu
$result = PersistenceContext::get_querier()->insert(PREFIX . "wiki_contents", array('id_article' => $id_article, 'menu' => $menu, 'content' => $contents, 'activ' => 1, 'user_id' => AppContext::get_current_user()->get_id(), 'user_ip' => AppContext::get_request()->get_ip_address(), 'timestamp' => time()));
//On met à jour le numéro du contenu dans la table articles
$id_contents = $result->get_last_inserted_id();
if ($is_cat == 1) {
$result = PersistenceContext::get_querier()->insert(PREFIX . "wiki_cats", array('id_parent' => $new_id_cat, 'article_id' => $id_article));
//on récupère l'id de la dernière catégorie créée
$id_created_cat = $result->get_last_inserted_id();
PersistenceContext::get_querier()->update(PREFIX . "wiki_articles", array('id_contents' => $id_contents, 'id_cat' => $id_created_cat), 'WHERE id = :id', array('id' => $id_article));
//On régénère le cache
WikiCategoriesCache::invalidate();
} else {
PersistenceContext::get_querier()->update(PREFIX . "wiki_articles", array('id_contents' => $id_contents), 'WHERE id = :id', array('id' => $id_article));
示例7: save
private function save()
{
$weblink = $this->get_weblink();
$weblink->set_name($this->form->get_value('name'));
$weblink->set_rewrited_name(Url::encode_rewrite($weblink->get_name()));
$weblink->set_id_category($this->form->get_value('id_category')->get_raw_value());
$weblink->set_url(new Url($this->form->get_value('url')));
$weblink->set_contents($this->form->get_value('contents'));
$weblink->set_short_contents($this->form->get_value('short_contents_enabled') ? $this->form->get_value('short_contents') : '');
$weblink->set_partner($this->form->get_value('partner'));
$weblink->set_partner_picture(new Url($this->form->get_value('partner_picture')));
$weblink->set_privileged_partner($this->form->get_value('privileged_partner'));
if ($this->is_contributor_member()) {
if ($weblink->get_id() === null) {
$weblink->set_creation_date(new Date());
}
$weblink->set_approbation_type(WebLink::NOT_APPROVAL);
$weblink->clean_start_and_end_date();
} else {
$weblink->set_creation_date($this->form->get_value('creation_date'));
$weblink->set_approbation_type($this->form->get_value('approbation_type')->get_raw_value());
if ($weblink->get_approbation_type() == WebLink::APPROVAL_DATE) {
$weblink->set_start_date($this->form->get_value('start_date'));
if ($this->form->get_value('end_date_enable')) {
$weblink->set_end_date($this->form->get_value('end_date'));
} else {
$weblink->clean_end_date();
}
} else {
$weblink->clean_start_and_end_date();
}
}
if ($weblink->get_id() === null) {
$id = WebService::add($weblink);
} else {
$id = $weblink->get_id();
WebService::update($weblink);
}
$this->contribution_actions($weblink, $id);
WebService::get_keywords_manager()->put_relations($id, $this->form->get_value('keywords'));
Feed::clear_cache('web');
WebCache::invalidate();
}
示例8: insert_gallery_cats_data
private function insert_gallery_cats_data()
{
PersistenceContext::get_querier()->insert(self::$gallery_cats_table, array('id' => 1, 'id_parent' => 0, 'c_order' => 1, 'auth' => '', 'rewrited_name' => Url::encode_rewrite($this->messages['default.cat.name']), 'name' => $this->messages['default.cat.name'], 'description' => $this->messages['default.cat.description'], 'image' => '/gallery/gallery.png'));
}
示例9: set_properties
public function set_properties(array $properties)
{
$this->id = $properties['id'];
$this->id_category = $properties['id_category'];
$this->q_order = $properties['q_order'];
$this->question = $properties['question'];
$this->rewrited_question = Url::encode_rewrite($properties['question']);
$this->answer = $properties['answer'];
$this->creation_date = new Date($properties['creation_date'], Timezone::SERVER_TIMEZONE);
$this->approved = (bool) $properties['approved'];
$user = new User();
if (!empty($properties['user_id'])) {
$user->set_properties($properties);
} else {
$user->init_visitor_user();
}
$this->set_author_user($user);
}
示例10: COUNT
$row = PersistenceContext::get_querier()->select_single_row_query("SELECT COUNT(*) as nbr_msg\n\tFROM " . PREFIX . "forum_msg msg\n\tLEFT JOIN " . PREFIX . "forum_topics t ON msg.idtopic = t.id\n\tWHERE msg.user_id = :user_id AND t.idcat IN :authorized_categories", array('authorized_categories' => $authorized_categories, 'user_id' => $view_msg));
$nbr_msg = $row['nbr_msg'];
$page = AppContext::get_request()->get_getint('p', 1);
$pagination = new ModulePagination($page, $nbr_msg, $_NBR_ELEMENTS_PER_PAGE, Pagination::LIGHT_PAGINATION);
$pagination->set_url(new Url('/forum/membermsg.php?id=' . $view_msg . '&p=%d'));
if ($pagination->current_page_is_empty() && $page > 1) {
$error_controller = PHPBoostErrors::unexisting_page();
DispatchManager::redirect($error_controller);
}
$tpl->put_all(array('C_PAGINATION' => $pagination->has_several_pages(), 'FORUM_NAME' => $config->get_forum_name() . ' : ' . $LANG['show_member_msg'], 'PAGINATION' => $pagination->display(), 'L_BACK' => $LANG['back'], 'L_VIEW_MSG_USER' => $LANG['show_member_msg'], 'L_FORUM_INDEX' => $LANG['forum_index'], 'U_FORUM_VIEW_MSG' => url('.php?id=' . $view_msg)));
$result = PersistenceContext::get_querier()->select("SELECT msg.id, msg.user_id, msg.idtopic, msg.timestamp, msg.timestamp_edit, m.groups, t.title, t.status, t.idcat, c.name, m.display_name, m.level, m.email, m.show_email, m.registration_date AS registered, m.posted_msg, m.warning_percentage, m.delay_banned, s.user_id AS connect, msg.contents, ext_field.user_avatar, m.posted_msg, ext_field.user_sign, " . $extended_fields_to_recover_list . "m.warning_percentage, m.delay_readonly, m.delay_banned \n\tFROM " . PREFIX . "forum_msg msg\n\tLEFT JOIN " . PREFIX . "forum_topics t ON msg.idtopic = t.id\n\tLEFT JOIN " . ForumSetup::$forum_cats_table . " c ON c.id = t.idcat\n\tLEFT JOIN " . DB_TABLE_MEMBER . " m ON m.user_id = :user_id\n\tLEFT JOIN " . DB_TABLE_MEMBER_EXTENDED_FIELDS . " ext_field ON ext_field.user_id = msg.user_id\n\tLEFT JOIN " . DB_TABLE_SESSIONS . " s ON s.user_id = msg.user_id AND s.timestamp > :timestamp\n\tWHERE msg.user_id = :id AND t.idcat IN :authorized_categories\n\tORDER BY msg.id DESC\n\tLIMIT :number_items_per_page OFFSET :display_from", array('id' => $view_msg, 'user_id' => $view_msg, 'timestamp' => time() - SessionsConfig::load()->get_active_session_duration(), 'authorized_categories' => $authorized_categories, 'number_items_per_page' => $pagination->get_number_items_per_page(), 'display_from' => $pagination->get_display_from()));
while ($row = $result->fetch()) {
//On encode l'url pour un éventuel rewriting, c'est une opération assez gourmande
$rewrited_cat_title = ServerEnvironmentConfig::load()->is_url_rewriting_enabled() ? '+' . Url::encode_rewrite($row['name']) : '';
//On encode l'url pour un éventuel rewriting, c'est une opération assez gourmande
$rewrited_title = ServerEnvironmentConfig::load()->is_url_rewriting_enabled() ? '+' . Url::encode_rewrite($row['title']) : '';
//Ajout du marqueur d'édition si activé.
$edit_mark = $row['timestamp_edit'] > 0 && $config->is_edit_mark_enabled() ? '<span class="edit-pseudo">' . $LANG['edit_by'] . ' <a href="' . UserUrlBuilder::profile($row['user_id_edit'])->rel() . '">' . $row['login_edit'] . '</a> ' . $LANG['on'] . ' ' . Date::to_format($row['timestamp_edit'], Date::FORMAT_DAY_MONTH_YEAR_HOUR_MINUTE) . '</span><br />' : '';
$group_color = User::get_group_color($row['groups'], $row['level']);
//Rang de l'utilisateur.
$user_rank = $row['level'] === '0' ? $LANG['member'] : $LANG['guest'];
$user_group = $user_rank;
$user_rank_icon = '';
if ($row['level'] === '2') {
$user_rank = $ranks_cache[-2]['name'];
$user_group = $user_rank;
$user_rank_icon = $ranks_cache[-2]['icon'];
} elseif ($row['level'] === '1') {
$user_rank = $ranks_cache[-1]['name'];
$user_group = $user_rank;
$user_rank_icon = $ranks_cache[-1]['icon'];
示例11: bread_crumb
bread_crumb($media['idcat']);
$Bread_crumb->add($media['name'], url('media.php?id=' . $id_media, 'media-' . $id_media . '-' . $media['idcat'] . '+' . Url::encode_rewrite($media['name']) . '.php'));
define('TITLE', $media['name']);
require_once '../kernel/header.php';
//MAJ du compteur.
PersistenceContext::get_querier()->inject("UPDATE " . PREFIX . "media SET counter = counter + 1 WHERE id = :id", array('id' => $id_media));
$notation = new Notation();
$notation->set_module_name('media');
$notation->set_notation_scale($config->get_notation_scale());
$notation->set_id_in_module($id_media);
$notation->set_number_notes($media['number_notes']);
$notation->set_average_notes($media['average_notes']);
$notation->set_user_already_noted(!empty($media['note']));
$nbr_notes = $media['number_notes'];
$group_color = User::get_group_color($media['groups'], $media['level']);
$tpl->put_all(array('ID' => $id_media, 'C_DISPLAY_MEDIA' => true, 'C_ROOT_CATEGORY' => $media['idcat'] == Category::ROOT_CATEGORY, 'C_MODO' => MediaAuthorizationsService::check_authorizations($media['idcat'])->moderation(), 'C_DISPLAY_NOTATION' => $config->is_notation_enabled(), 'C_DISPLAY_COMMENTS' => $config->are_comments_enabled(), 'ID_MEDIA' => $id_media, 'NAME' => $media['name'], 'CONTENTS' => stripslashes(FormatingHelper::second_parse($media['contents'])), 'COUNT' => $media['counter'], 'KERNEL_NOTATION' => NotationService::display_active_image($notation), 'HITS' => (int) $media['counter'] + 1 > 1 ? sprintf($MEDIA_LANG['n_times'], (int) $media['counter'] + 1) : sprintf($MEDIA_LANG['n_time'], (int) $media['counter'] + 1), 'U_COM' => PATH_TO_ROOT . '/media/media' . url('.php?id=' . $id_media . '&com=0', '-' . $id_media . '-' . $media['idcat'] . '+' . Url::encode_rewrite($media['name']) . '.php?com=0') . '#comments-list', 'L_COM' => CommentsService::get_number_and_lang_comments('media', $id_media), 'L_DATE' => LangLoader::get_message('date', 'date-common'), 'L_SIZE' => $LANG['size'], 'L_MEDIA_INFOS' => $MEDIA_LANG['media_infos'], 'DATE' => Date::to_format($media['timestamp'], Date::FORMAT_DAY_MONTH_YEAR_HOUR_MINUTE), 'L_MODO_PANEL' => $LANG['modo_panel'], 'L_UNAPROBED' => $MEDIA_LANG['unaprobed_media_short'], 'HEIGHT_P' => $media['height'] + 50, 'L_VIEWED' => $LANG['view'], 'L_BY' => $LANG['by'], 'BY' => !empty($media['display_name']) ? '<a href="' . UserUrlBuilder::profile($media['iduser'])->rel() . '" class="' . UserService::get_level_class($media['level']) . '"' . (!empty($group_color) ? ' style="color:' . $group_color . '"' : '') . '>' . $media['display_name'] . '</a>' : $LANG['guest'], 'U_UNVISIBLE_MEDIA' => url('media_action.php?unvisible=' . $id_media . '&token=' . AppContext::get_session()->get_token()), 'U_EDIT_MEDIA' => url('media_action.php?edit=' . $id_media), 'U_DELETE_MEDIA' => url('media_action.php?del=' . $id_media . '&token=' . AppContext::get_session()->get_token()), 'U_POPUP_MEDIA' => url('media_popup.php?id=' . $id_media), 'CATEGORY_NAME' => $media['idcat'] == Category::ROOT_CATEGORY ? LangLoader::get_message('module_title', 'common', 'media') : MediaService::get_categories_manager()->get_categories_cache()->get_category($media['idcat'])->get_name(), 'U_EDIT_CATEGORY' => $media['idcat'] == Category::ROOT_CATEGORY ? MediaUrlBuilder::configuration()->rel() : MediaUrlBuilder::edit_category($media['idcat'])->rel()));
if (empty($mime_type_tpl[$media['mime_type']])) {
$media_tpl = new FileTemplate('media/format/media_other.tpl');
} else {
$media_tpl = new FileTemplate('media/' . $mime_type_tpl[$media['mime_type']]);
}
$media_tpl->put_all(array('URL' => $media['url'], 'MIME' => $media['mime_type'], 'WIDTH' => $media['width'], 'HEIGHT' => $media['height']));
$tpl->put('media_format', $media_tpl);
//Affichage commentaires.
if (AppContext::get_request()->get_getint('com', 0) == 0) {
$comments_topic = new MediaCommentsTopic();
$comments_topic->set_id_in_module($id_media);
$comments_topic->set_url(new Url('/media/media.php?id=' . $id_media . '&com=0'));
$tpl->put_all(array('COMMENTS' => CommentsService::display($comments_topic)->render()));
}
$tpl->display();
示例12: rewrite_field_name
public static function rewrite_field_name($field_name)
{
$field = strtolower($field_name);
$field = Url::encode_rewrite($field);
$field = str_replace('-', '_', $field);
return 'f_' . $field;
}
示例13: insert_news_data
private function insert_news_data()
{
PersistenceContext::get_querier()->insert(self::$news_table, array('id' => 1, 'id_category' => 1, 'name' => $this->messages['news.title'], 'rewrited_name' => Url::encode_rewrite($this->messages['news.title']), 'contents' => $this->messages['news.content'], 'short_contents' => '', 'creation_date' => time(), 'updated_date' => 0, 'approbation_type' => News::APPROVAL_NOW, 'start_date' => 0, 'end_date' => 0, 'top_list_enabled' => 0, 'picture_url' => '', 'author_user_id' => 1, 'sources' => serialize(array())));
}
示例14: array
$db_querier->delete(PREFIX . 'wiki_contents', 'WHERE id_article=:id', array('id' => $row['id']));
CommentsService::delete_comments_topic_module('wiki', $row['id']);
}
$result->dispose();
$db_querier->delete(PREFIX . 'wiki_articles', 'WHERE id_cat=:id', array('id' => $id));
$db_querier->delete(PREFIX . 'wiki_cats', 'WHERE id=:id', array('id' => $id));
}
WikiCategoriesCache::invalidate();
// Feeds Regeneration
Feed::clear_cache('wiki');
//On redirige soit vers l'article parent soit vers la catégorie
if (array_key_exists($article_infos['id_cat'], $categories) && $categories[$article_infos['id_cat']]['id_parent'] > 0) {
$title = stripslashes($categories[$categories[$article_infos['id_cat']]['id_parent']]['title']);
AppContext::get_response()->redirect('/wiki/' . url('wiki.php?title=' . Url::encode_rewrite($title), Url::encode_rewrite($title), '&'));
} else {
AppContext::get_response()->redirect('/wiki/' . url('wiki.php', '', '&'));
}
} elseif ($remove_action == 'move_all') {
$db_querier->update(PREFIX . "wiki_articles", array('id_cat' => $report_cat), 'WHERE id_cat = :id', array('id' => $article_infos['id_cat']));
$db_querier->update(PREFIX . "wiki_cats", array('id_parent' => $report_cat), 'WHERE id_parent = :id', array('id' => $article_infos['id_cat']));
WikiCategoriesCache::invalidate();
if (array_key_exists($report_cat, $categories)) {
$title = stripslashes($categories[$report_cat]['title']);
AppContext::get_response()->redirect('/wiki/' . url('wiki.php?title=' . Url::encode_rewrite($title), Url::encode_rewrite($title), '&'));
} else {
AppContext::get_response()->redirect('/wiki/' . url('wiki.php', '', '&'));
}
}
}
//On redirige vers l'index si on n'est rentré dans aucune des conditions ci-dessus
AppContext::get_response()->redirect('/wiki/' . url('wiki.php', '', '&'));
示例15: build_view
//.........这里部分代码省略.........
load_module_lang('media');
$config = MediaConfig::load();
$category = $this->get_category();
$authorized_categories = MediaService::get_authorized_categories($category->get_id());
//Contenu de la catégorie
$page = AppContext::get_request()->get_getint('p', 1);
$subcategories_page = AppContext::get_request()->get_getint('subcategories_page', 1);
$get_sort = retrieve(GET, 'sort', '');
$get_mode = retrieve(GET, 'mode', '');
$mode = $get_mode == 'asc' ? 'ASC' : 'DESC';
$unget = !empty($get_sort) && !empty($mode) ? '?sort=' . $get_sort . '&mode=' . $get_mode : '';
//On crée une pagination si le nombre de sous-catégories est trop important.
$subcategories_number = count(MediaService::get_categories_manager()->get_categories_cache()->get_childrens($category->get_id()));
$pagination = new ModulePagination($subcategories_page, $subcategories_number, $config->get_categories_number_per_page());
$pagination->set_url(new Url('/media/media.php' . (!empty($unget) ? $unget . '&' : '?') . 'cat=' . $category->get_id() . '&p=' . $page . '&subcategories_page=%d'));
if ($pagination->current_page_is_empty() && $subcategories_page > 1) {
$error_controller = PHPBoostErrors::unexisting_page();
DispatchManager::redirect($error_controller);
}
//Children categories
$result = PersistenceContext::get_querier()->select('SELECT @id_cat:= media_cats.id, media_cats.*,
(SELECT COUNT(*) FROM ' . MediaSetup::$media_table . '
WHERE idcat IN (
@id_cat,
(SELECT GROUP_CONCAT(id SEPARATOR \',\') FROM ' . MediaSetup::$media_cats_table . ' WHERE id_parent = @id_cat),
(SELECT GROUP_CONCAT(childs.id SEPARATOR \',\') FROM ' . MediaSetup::$media_cats_table . ' parents
INNER JOIN ' . MediaSetup::$media_cats_table . ' childs ON parents.id = childs.id_parent
WHERE parents.id_parent = @id_cat)
)
AND infos = :status
) AS mediafiles_number
FROM ' . MediaSetup::$media_cats_table . ' media_cats
WHERE id_parent = :id_category
AND id IN :authorized_categories
ORDER BY id_parent, c_order
LIMIT :number_items_per_page OFFSET :display_from', array('id_category' => $category->get_id(), 'status' => MEDIA_STATUS_APROBED, 'authorized_categories' => $authorized_categories, 'number_items_per_page' => $pagination->get_number_items_per_page(), 'display_from' => $pagination->get_display_from()));
$nbr_cat_displayed = 0;
while ($row = $result->fetch()) {
$category_image = new Url($row['image']);
$this->tpl->assign_block_vars('sub_categories_list', array('C_CATEGORY_IMAGE' => !empty($row['image']), 'CATEGORY_NAME' => $row['name'], 'CATEGORY_IMAGE' => $category_image->rel(), 'MEDIAFILES_NUMBER' => sprintf($row['mediafiles_number'] > 1 ? $MEDIA_LANG['num_medias'] : $MEDIA_LANG['num_media'], $row['mediafiles_number']), 'U_CATEGORY' => MediaUrlBuilder::display_category($row['id'], $row['rewrited_name'])->rel()));
$nbr_cat_displayed++;
}
$result->dispose();
$nbr_column_cats = $nbr_cat_displayed > $config->get_columns_number_per_line() ? $config->get_columns_number_per_line() : $nbr_cat_displayed;
$nbr_column_cats = !empty($nbr_column_cats) ? $nbr_column_cats : 1;
$cats_columns_width = floor(100 / $nbr_column_cats);
$category_description = FormatingHelper::second_parse($category->get_description());
$this->tpl->put_all(array('C_CATEGORIES' => true, 'C_ROOT_CATEGORY' => $category->get_id() == Category::ROOT_CATEGORY, 'C_CATEGORY_DESCRIPTION' => $category_description, 'C_SUB_CATEGORIES' => $nbr_cat_displayed > 0, 'C_MODO' => MediaAuthorizationsService::check_authorizations($category->get_id())->moderation(), 'C_SUBCATEGORIES_PAGINATION' => $pagination->has_several_pages(), 'SUBCATEGORIES_PAGINATION' => $pagination->display(), 'L_UNAPROBED' => $MEDIA_LANG['unaprobed_media_short'], 'L_BY' => $MEDIA_LANG['media_added_by'], 'CATS_COLUMNS_WIDTH' => $cats_columns_width, 'CATEGORY_NAME' => $category->get_id() == Category::ROOT_CATEGORY ? LangLoader::get_message('module_title', 'common', 'media') : $category->get_name(), 'CATEGORY_DESCRIPTION' => $category_description, 'U_EDIT_CATEGORY' => $category->get_id() == Category::ROOT_CATEGORY ? MediaUrlBuilder::configuration()->rel() : MediaUrlBuilder::edit_category($category->get_id())->rel(), 'ID_CAT' => $category->get_id()));
$selected_fields = array('alpha' => '', 'date' => '', 'nbr' => '', 'note' => '', 'com' => '', 'asc' => '', 'desc' => '');
switch ($get_sort) {
case 'alpha':
$sort = 'name';
$selected_fields['alpha'] = ' selected="selected"';
break;
default:
case 'date':
$sort = 'timestamp';
$selected_fields['date'] = ' selected="selected"';
break;
case 'nbr':
$sort = 'counter';
$selected_fields['nbr'] = ' selected="selected"';
break;
case 'note':
$sort = 'average_notes';
$selected_fields['note'] = ' selected="selected"';
break;
case 'com':
$sort = 'com.number_comments';
$selected_fields['com'] = ' selected="selected"';
break;
}
if ($mode == 'ASC') {
$selected_fields['asc'] = ' selected="selected"';
} else {
$selected_fields['desc'] = ' selected="selected"';
}
$this->tpl->put_all(array('C_DISPLAY_NOTATION' => $config->is_notation_enabled(), 'C_DISPLAY_COMMENTS' => $config->are_comments_enabled(), 'L_ALPHA' => $MEDIA_LANG['sort_title'], 'L_DATE' => LangLoader::get_message('date', 'date-common'), 'L_NBR' => $MEDIA_LANG['sort_popularity'], 'L_NOTE' => LangLoader::get_message('note', 'common'), 'L_COM' => $LANG['com'], 'L_DESC' => $LANG['desc'], 'L_ASC' => $LANG['asc'], 'L_ORDER_BY' => LangLoader::get_message('sort_by', 'common'), 'SELECTED_ALPHA' => $selected_fields['alpha'], 'SELECTED_DATE' => $selected_fields['date'], 'SELECTED_NBR' => $selected_fields['nbr'], 'SELECTED_NOTE' => $selected_fields['note'], 'SELECTED_COM' => $selected_fields['com'], 'SELECTED_ASC' => $selected_fields['asc'], 'SELECTED_DESC' => $selected_fields['desc']));
$condition = 'WHERE idcat = :idcat AND infos = :status';
$parameters = array('idcat' => $category->get_id(), 'status' => MEDIA_STATUS_APROBED);
//On crée une pagination si le nombre de fichiers est trop important.
$mediafiles_number = MediaService::count($condition, $parameters);
$pagination = new ModulePagination($page, $mediafiles_number, $config->get_items_number_per_page());
$pagination->set_url(new Url('/media/media.php' . (!empty($unget) ? $unget . '&' : '?') . 'cat=' . $category->get_id() . '&p=%d&subcategories_page=' . $subcategories_page));
if ($pagination->current_page_is_empty() && $page > 1) {
$error_controller = PHPBoostErrors::unexisting_page();
DispatchManager::redirect($error_controller);
}
$notation = new Notation();
$notation->set_module_name('media');
$notation->set_notation_scale($config->get_notation_scale());
$result = PersistenceContext::get_querier()->select("SELECT v.id, v.iduser, v.name, v.timestamp, v.counter, v.infos, v.contents, mb.display_name, mb.groups, mb.level, notes.average_notes, com.number_comments\n\t\t\tFROM " . PREFIX . "media AS v\n\t\t\tLEFT JOIN " . DB_TABLE_MEMBER . " AS mb ON v.iduser = mb.user_id\n\t\t\tLEFT JOIN " . DB_TABLE_AVERAGE_NOTES . " notes ON v.id = notes.id_in_module AND notes.module_name = 'media'\n\t\t\tLEFT JOIN " . DB_TABLE_COMMENTS_TOPIC . " com ON v.id = com.id_in_module AND com.module_id = 'media'\n\t\t\t" . $condition . "\n\t\t\tORDER BY " . $sort . " " . $mode . "\n\t\t\tLIMIT :number_items_per_page OFFSET :display_from", array_merge($parameters, array('number_items_per_page' => $pagination->get_number_items_per_page(), 'display_from' => $pagination->get_display_from())));
$this->tpl->put_all(array('C_FILES' => $result->get_rows_count() > 0, 'C_DISPLAY_NO_FILE_MSG' => $result->get_rows_count() == 0 && $category->get_id() != Category::ROOT_CATEGORY, 'C_PAGINATION' => $pagination->has_several_pages(), 'PAGINATION' => $pagination->display(), 'TARGET_ON_CHANGE_ORDER' => ServerEnvironmentConfig::load()->is_url_rewriting_enabled() ? 'media-0-' . $category->get_id() . '.php?' : 'media.php?cat=' . $category->get_id() . '&'));
while ($row = $result->fetch()) {
$notation->set_id_in_module($row['id']);
$group_color = User::get_group_color($row['groups'], $row['level']);
$this->tpl->assign_block_vars('file', array('ID' => $row['id'], 'NAME' => $row['name'], 'IMG_NAME' => str_replace('"', '\\"', $row['name']), 'C_DESCRIPTION' => !empty($row['contents']), 'DESCRIPTION' => stripslashes(FormatingHelper::second_parse($row['contents'])), 'POSTER' => $MEDIA_LANG['media_added_by'] . ' : ' . !empty($row['display_name']) ? '<a href="' . UserUrlBuilder::profile($row['iduser'])->rel() . '" class="' . UserService::get_level_class($row['level']) . '"' . (!empty($group_color) ? ' style="color:' . $group_color . '"' : '') . '>' . $row['display_name'] . '</a>' : $LANG['guest'], 'DATE' => sprintf($MEDIA_LANG['add_on_date'], Date::to_format($row['timestamp'], Date::FORMAT_DAY_MONTH_YEAR)), 'COUNT' => sprintf($MEDIA_LANG['view_n_times'], $row['counter']), 'NOTE' => NotationService::display_static_image($notation), 'U_MEDIA_LINK' => PATH_TO_ROOT . '/media/' . url('media.php?id=' . $row['id'], 'media-' . $row['id'] . '-' . $category->get_id() . '+' . Url::encode_rewrite($row['name']) . '.php'), 'U_ADMIN_UNVISIBLE_MEDIA' => PATH_TO_ROOT . url('/media/media_action.php?unvisible=' . $row['id'] . '&token=' . AppContext::get_session()->get_token()), 'U_ADMIN_EDIT_MEDIA' => PATH_TO_ROOT . url('/media/media_action.php?edit=' . $row['id']), 'U_ADMIN_DELETE_MEDIA' => PATH_TO_ROOT . url('/media/media_action.php?del=' . $row['id'] . '&token=' . AppContext::get_session()->get_token()), 'U_COM_LINK' => '<a href="' . PATH_TO_ROOT . '/media/media' . url('.php?id=' . $row['id'] . '&com=0', '-' . $row['id'] . '-' . $category->get_id() . '+' . Url::encode_rewrite($row['name']) . '.php?com=0') . '">' . CommentsService::get_number_and_lang_comments('media', $row['id']) . '</a>'));
}
$result->dispose();
}