本文整理汇总了PHP中Date::to_format方法的典型用法代码示例。如果您正苦于以下问题:PHP Date::to_format方法的具体用法?PHP Date::to_format怎么用?PHP Date::to_format使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Date
的用法示例。
在下文中一共展示了Date::to_format方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: build_form
private function build_form($user_id)
{
$form = new HTMLForm('member-view-profile', '', false);
$fieldset = new FormFieldsetHTML('profile', $this->lang['profile']);
$form->add_fieldset($fieldset);
if (AppContext::get_current_user()->check_level(User::ADMIN_LEVEL)) {
$link_edit = '<a href="' . UserUrlBuilder::edit_profile($user_id)->rel() . '" title="' . $this->lang['profile.edit'] . '" class="fa fa-edit"></a>';
$fieldset->add_field(new FormFieldFree('profile_edit', $this->lang['profile.edit'], $link_edit));
}
$fieldset->add_field(new FormFieldFree('display_name', $this->lang['display_name'], $this->user_infos['display_name']));
$fieldset->add_field(new FormFieldFree('level', $this->lang['level'], '<a class="' . UserService::get_level_class($this->user_infos['level']) . '">' . $this->get_level_lang() . '</a>'));
$fieldset->add_field(new FormFieldFree('groups', $this->lang['groups'], $this->build_groups($this->user_infos['groups'])));
$registration_date = new Date($this->user_infos['registration_date']);
$fieldset->add_field(new FormFieldFree('registered_on', $this->lang['registration_date'], $registration_date ? $registration_date->format(Date::FORMAT_DAY_MONTH_YEAR) : ''));
$fieldset->add_field(new FormFieldFree('nbr_msg', $this->lang['number-messages'], $this->user_infos['posted_msg'] . '<br>' . '<a href="' . UserUrlBuilder::messages($user_id)->rel() . '">' . $this->lang['messages'] . '</a>'));
$last_connection_date = !empty($this->user_infos['last_connection_date']) ? Date::to_format($this->user_infos['last_connection_date'], Date::FORMAT_DAY_MONTH_YEAR) : LangLoader::get_message('never', 'main');
$fieldset->add_field(new FormFieldFree('last_connect', $this->lang['last_connection'], $last_connection_date));
if (AppContext::get_current_user()->check_auth(UserAccountsConfig::load()->get_auth_read_members(), UserAccountsConfig::AUTH_READ_MEMBERS_BIT) && $this->user_infos['show_email']) {
$link_email = '<a href="mailto:' . $this->user_infos['email'] . '" class="basic-button smaller">Mail</a>';
$fieldset->add_field(new FormFieldFree('email', $this->lang['email'], $link_email));
}
if (!$this->same_user_view_profile($user_id) && AppContext::get_current_user()->check_level(User::MEMBER_LEVEL)) {
$link_mp = '<a href="' . UserUrlBuilder::personnal_message($user_id)->rel() . '" class="basic-button smaller">MP</a>';
$fieldset->add_field(new FormFieldFree('private_message', $this->lang['private_message'], $link_mp));
}
MemberExtendedFieldsService::display_profile_fields($form, $user_id);
$this->form = $form;
}
示例2: build_table
private function build_table()
{
$table = new SQLHTMLTableModel(DB_TABLE_MEMBER, __CLASS__, array(new HTMLTableColumn('pseudo', 'display_name'), new HTMLTableColumn('email'), new HTMLTableColumn('inscrit le', 'registration_date'), new HTMLTableColumn('messages'), new HTMLTableColumn('derniere connexion'), new HTMLTableColumn('messagerie')), new HTMLTableSortingRule('user_id', HTMLTableSortingRule::ASC));
$table->set_caption('Liste des membres');
$options = array('horn' => 'Horn', 'coucou' => 'Coucou', 'teston' => 'teston');
$table->add_filter(new HTMLTableEqualsFromListSQLFilter('display_name', 'filter1', 'login Equals', $options));
$table->add_filter(new HTMLTableBeginsWithTextSQLFilter('display_name', 'filter2', 'login Begins with (regex)', '`^(?!%).+$`'));
$table->add_filter(new HTMLTableBeginsWithTextSQLFilter('display_name', 'filter3', 'login Begins with (no regex)'));
$table->add_filter(new HTMLTableEndsWithTextSQLFilter('display_name', 'filter4', 'login Ends with (regex)', '`^(?!%).+$`'));
$table->add_filter(new HTMLTableEndsWithTextSQLFilter('display_name', 'filter5', 'login Ends with (no regex)'));
$table->add_filter(new HTMLTableLikeTextSQLFilter('display_name', 'filter6', 'login Like (regex)', '`^toto`'));
$table->add_filter(new HTMLTableLikeTextSQLFilter('display_name', 'filter7', 'login Like (no regex)'));
$table->add_filter(new HTMLTableGreaterThanSQLFilter('user_id', 'filter8', 'id >'));
$table->add_filter(new HTMLTableGreaterThanSQLFilter('user_id', 'filter9', 'id > (lower=3)', 3));
$table->add_filter(new HTMLTableGreaterThanSQLFilter('user_id', 'filter10', 'id > (upper=3)', HTMLTableNumberComparatorSQLFilter::NOT_BOUNDED, 3));
$table->add_filter(new HTMLTableGreaterThanSQLFilter('user_id', 'filter11', 'id > (lower=1, upper=3)', 1, 3));
$table->add_filter(new HTMLTableLessThanSQLFilter('user_id', 'filter12', 'id <'));
$table->add_filter(new HTMLTableGreaterThanOrEqualsToSQLFilter('user_id', 'filter13', 'id >='));
$table->add_filter(new HTMLTableLessThanOrEqualsToSQLFilter('user_id', 'filter14', 'id <='));
$table->add_filter(new HTMLTableEqualsToSQLFilter('user_id', 'filter15', 'id ='));
$html_table = new HTMLTable($table);
$results = array();
$result = $table->get_sql_results();
foreach ($result as $row) {
$results[] = new HTMLTableRow(array(new HTMLTableRowCell($row['display_name']), new HTMLTableRowCell($row['show_email'] == 1 ? '<a href="mailto:' . $row['email'] . '" class="basic-button smaller">Mail</a>' : ' '), new HTMLTableRowCell(Date::to_format($row['registration_date'], Date::FORMAT_DAY_MONTH_YEAR_HOUR_MINUTE)), new HTMLTableRowCell(!empty($row['posted_msg']) ? $row['posted_msg'] : '0'), new HTMLTableRowCell(!empty($row['last_connection_date']) ? Date::to_format($row['last_connection_date'], Date::FORMAT_DAY_MONTH_YEAR) : LangLoader::get_message('never', 'main')), new HTMLTableRowCell('<a href="' . Url::to_rel('/user/pm.php?pm=' . $row['user_id']) . '" class="basic-button smaller">MP</a>')));
}
$html_table->set_rows($table->get_number_of_matching_rows(), $results);
return $html_table;
}
示例3: build_table
private function build_table()
{
$table_model = new SQLHTMLTableModel(DB_TABLE_MEMBER, 'table', array(new HTMLTableColumn($this->lang['display_name'], 'display_name'), new HTMLTableColumn($this->lang['email']), new HTMLTableColumn($this->lang['registration_date'], 'registration_date'), new HTMLTableColumn($this->lang['messages'], 'posted_msg'), new HTMLTableColumn($this->lang['last_connection'], 'last_connection_date'), new HTMLTableColumn($this->lang['private_message'])), new HTMLTableSortingRule('display_name', HTMLTableSortingRule::ASC));
$table = new HTMLTable($table_model);
$results = array();
$result = $table_model->get_sql_results('m LEFT JOIN ' . DB_TABLE_INTERNAL_AUTHENTICATION . ' ia ON ia.user_id = m.user_id');
foreach ($result as $row) {
$posted_msg = !empty($row['posted_msg']) ? $row['posted_msg'] : '0';
$group_color = User::get_group_color($row['groups'], $row['level']);
$author = new LinkHTMLElement(UserUrlBuilder::profile($row['user_id']), $row['display_name'], !empty($group_color) ? array('style' => 'color: ' . $group_color) : array(), UserService::get_level_class($row['level']));
$results[] = new HTMLTableRow(array(new HTMLTableRowCell($author), new HTMLTableRowCell($row['show_email'] == 1 ? new LinkHTMLElement('mailto:' . $row['email'], $this->lang['email'], array(), 'basic-button smaller') : ''), new HTMLTableRowCell(Date::to_format($row['registration_date'], Date::FORMAT_DAY_MONTH_YEAR)), new HTMLTableRowCell($posted_msg), new HTMLTableRowCell(!empty($row['last_connection_date']) ? Date::to_format($row['last_connection_date'], Date::FORMAT_DAY_MONTH_YEAR) : LangLoader::get_message('never', 'main')), new HTMLTableRowCell(new LinkHTMLElement(UserUrlBuilder::personnal_message($row['user_id']), 'PM', array(), 'basic-button smaller'))));
}
$table->set_rows($table_model->get_number_of_matching_rows(), $results);
$this->view->put('table', $table->display());
}
示例4: build_form
private function build_form($request)
{
$field = $request->get_value('field', NewsletterUrlBuilder::DEFAULT_SORT_FIELD);
$sort = $request->get_value('sort', NewsletterUrlBuilder::DEFAULT_SORT_MODE);
$current_page = $request->get_int('page', 1);
$mode = $sort == 'top' ? 'ASC' : 'DESC';
if (!NewsletterAuthorizationsService::id_stream($this->stream->get_id())->read_archives()) {
NewsletterAuthorizationsService::get_errors()->read_archives();
}
if (!NewsletterStreamsCache::load()->stream_exists($this->stream->get_id())) {
$controller = new UserErrorController(LangLoader::get_message('error', 'status-messages-common'), LangLoader::get_message('admin.stream-not-existed', 'common', 'newsletter'));
DispatchManager::redirect($controller);
}
switch ($field) {
case 'stream':
$field_bdd = 'stream_id';
break;
case 'subject':
$field_bdd = 'subject';
break;
case 'date':
$field_bdd = 'timestamp';
break;
case 'subscribers':
$field_bdd = 'nbr_subscribers';
break;
default:
$field_bdd = 'timestamp';
}
$stream_id = $this->stream->get_id();
$stream_condition = $stream_id ? "WHERE stream_id = '" . $stream_id . "'" : "";
$nbr_archives = PersistenceContext::get_querier()->count(NewsletterSetup::$newsletter_table_archives, $stream_condition);
$pagination = $this->get_pagination($current_page, $nbr_archives, $field, $sort);
$moderation_auth = NewsletterAuthorizationsService::id_stream($this->stream->get_id())->moderation_archives();
$this->view->put_all(array('C_MODERATE' => $moderation_auth, 'C_ARCHIVES' => (double) $nbr_archives, 'C_SPECIFIC_STREAM' => $stream_id, 'C_PAGINATION' => $pagination->has_several_pages(), 'NUMBER_COLUMN' => 3 + (int) (empty($stream_id) && !empty($nbr_archives)) + $moderation_auth, 'SORT_STREAM_TOP' => NewsletterUrlBuilder::archives($this->stream->get_id(), $this->stream->get_rewrited_name(), 'stream', 'top', $current_page)->rel(), 'SORT_STREAM_BOTTOM' => NewsletterUrlBuilder::archives($this->stream->get_id(), $this->stream->get_rewrited_name(), 'stream', 'bottom', $current_page)->rel(), 'SORT_SUBJECT_TOP' => NewsletterUrlBuilder::archives($this->stream->get_id(), $this->stream->get_rewrited_name(), 'subject', 'top', $current_page)->rel(), 'SORT_SUBJECT_BOTTOM' => NewsletterUrlBuilder::archives($this->stream->get_id(), $this->stream->get_rewrited_name(), 'subject', 'bottom', $current_page)->rel(), 'SORT_DATE_TOP' => NewsletterUrlBuilder::archives($this->stream->get_id(), $this->stream->get_rewrited_name(), 'date', 'top', $current_page)->rel(), 'SORT_DATE_BOTTOM' => NewsletterUrlBuilder::archives($this->stream->get_id(), $this->stream->get_rewrited_name(), 'date', 'bottom', $current_page)->rel(), 'SORT_SUBSCRIBERS_TOP' => NewsletterUrlBuilder::archives($this->stream->get_id(), $this->stream->get_rewrited_name(), 'subscribers', 'top', $current_page)->rel(), 'SORT_SUBSCRIBERS_BOTTOM' => NewsletterUrlBuilder::archives($this->stream->get_id(), $this->stream->get_rewrited_name(), 'subscribers', 'bottom', $current_page)->rel(), 'PAGINATION' => $pagination->display()));
$result = PersistenceContext::get_querier()->select("SELECT *\n\t\tFROM " . NewsletterSetup::$newsletter_table_archives . "\n\t\t" . $stream_condition . "\n\t\tORDER BY " . $field_bdd . " " . $mode . "\n\t\tLIMIT :number_items_per_page OFFSET :display_from", array('number_items_per_page' => $pagination->get_number_items_per_page(), 'display_from' => $pagination->get_display_from()));
while ($row = $result->fetch()) {
$stream = NewsletterStreamsCache::load()->get_stream($row['stream_id']);
$this->view->assign_block_vars('archives_list', array('STREAM_NAME' => $stream->get_name(), 'SUBJECT' => $row['subject'], 'DATE' => Date::to_format($row['timestamp'], Date::FORMAT_DAY_MONTH_YEAR), 'NBR_SUBSCRIBERS' => $row['nbr_subscribers'], 'U_VIEW_STREAM' => NewsletterUrlBuilder::archives($stream->get_id(), $this->stream->get_rewrited_name())->rel(), 'U_VIEW_ARCHIVE' => NewsletterUrlBuilder::archive($row['id'])->rel(), 'U_DELETE_ARCHIVE' => NewsletterUrlBuilder::delete_archive($row['id'], $stream->get_id())->rel()));
}
$result->dispose();
}
示例5: build_table
private function build_table()
{
$number_admins = UserService::count_admin_members();
$table_model = new SQLHTMLTableModel(DB_TABLE_MEMBER, 'table', array(new HTMLTableColumn($this->lang['display_name'], 'display_name'), new HTMLTableColumn($this->lang['level'], 'level'), new HTMLTableColumn($this->lang['email']), new HTMLTableColumn($this->lang['registration_date'], 'registration_date'), new HTMLTableColumn($this->lang['last_connection'], 'last_connection_date'), new HTMLTableColumn($this->lang['approbation'], 'approved'), new HTMLTableColumn('')), new HTMLTableSortingRule('display_name', HTMLTableSortingRule::ASC));
$table = new HTMLTable($table_model);
$table_model->set_caption(LangLoader::get_message('members.members-management', 'admin-user-common'));
$results = array();
$result = $table_model->get_sql_results('m LEFT JOIN ' . DB_TABLE_INTERNAL_AUTHENTICATION . ' ia ON ia.user_id = m.user_id');
foreach ($result as $row) {
$user = new User();
$user->set_properties($row);
$edit_link = new LinkHTMLElement(UserUrlBuilder::edit_profile($user->get_id()), '', array('title' => LangLoader::get_message('edit', 'common')), 'fa fa-edit');
if ($user->get_level() != User::ADMIN_LEVEL || $user->get_level() == User::ADMIN_LEVEL && $number_admins > 1) {
$delete_link = new LinkHTMLElement(AdminMembersUrlBuilder::delete($user->get_id()), '', array('title' => LangLoader::get_message('delete', 'common'), 'data-confirmation' => 'delete-element'), 'fa fa-delete');
} else {
$delete_link = new LinkHTMLElement('', '', array('title' => LangLoader::get_message('delete', 'common'), 'onclick' => 'return false;'), 'fa fa-delete icon-disabled');
}
$user_group_color = User::get_group_color($user->get_groups(), $user->get_level(), true);
$results[] = new HTMLTableRow(array(new HTMLTableRowCell(new LinkHTMLElement(UserUrlBuilder::profile($user->get_id()), $user->get_display_name(), !empty($user_group_color) ? array('style' => 'color: ' . $user_group_color) : array(), UserService::get_level_class($user->get_level()))), new HTMLTableRowCell(UserService::get_level_lang($user->get_level())), new HTMLTableRowCell(new LinkHTMLElement('mailto:' . $user->get_email(), $this->lang['email'], array(), 'basic-button smaller')), new HTMLTableRowCell(Date::to_format($row['registration_date'], Date::FORMAT_DAY_MONTH_YEAR)), new HTMLTableRowCell(!empty($row['last_connection_date']) ? Date::to_format($row['last_connection_date'], Date::FORMAT_DAY_MONTH_YEAR) : LangLoader::get_message('never', 'main')), new HTMLTableRowCell($row['approved'] ? LangLoader::get_message('yes', 'common') : LangLoader::get_message('no', 'common')), new HTMLTableRowCell($edit_link->display() . $delete_link->display())));
}
$table->set_rows($table_model->get_number_of_matching_rows(), $results);
$this->view->put_all(array('FORM' => $this->build_form()->display(), 'table' => $table->display()));
}
示例6: define
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
###################################################*/
require_once '../kernel/begin.php';
require_once '../forum/forum_begin.php';
require_once '../forum/forum_tools.php';
$Bread_crumb->add($config->get_forum_name(), 'index.php');
$Bread_crumb->add($LANG['stats'], '');
define('TITLE', $LANG['stats']);
require_once '../kernel/header.php';
$tpl = new FileTemplate('forum/forum_stats.tpl');
$total_day = NumberHelper::round((time() - GeneralConfig::load()->get_site_install_date()->get_timestamp()) / (3600 * 24), 0);
$timestamp_today = @mktime(0, 0, 1, Date::to_format(Date::DATE_NOW, 'm'), Date::to_format(Date::DATE_NOW, 'd'), Date::to_format(Date::DATE_NOW, 'y'));
$total_topics = PersistenceContext::get_querier()->count(ForumSetup::$forum_topics_table);
$total_messages = PersistenceContext::get_querier()->count(ForumSetup::$forum_message_table);
$total_day = max(1, $total_day);
$nbr_topics_day = NumberHelper::round($total_topics / $total_day, 1);
$nbr_msg_day = NumberHelper::round($total_messages / $total_day, 1);
$row = PersistenceContext::get_querier()->select_single_row_query("SELECT COUNT(*) as nbr_topics_today\nFROM " . ForumSetup::$forum_topics_table . " t\nJOIN " . ForumSetup::$forum_message_table . " m ON m.id = t.first_msg_id\nWHERE m.timestamp > :timestamp", array('timestamp' => $timestamp_today));
$nbr_topics_today = $row['nbr_topics_today'];
$nbr_msg_today = PersistenceContext::get_querier()->count(ForumSetup::$forum_message_table, 'WHERE timestamp > :timestamp', array('timestamp' => $timestamp_today));
$vars_tpl = array('FORUM_NAME' => $config->get_forum_name(), 'NBR_TOPICS' => $total_topics, 'NBR_MSG' => $total_messages, 'NBR_TOPICS_DAY' => $nbr_topics_day, 'NBR_MSG_DAY' => $nbr_msg_day, 'NBR_TOPICS_TODAY' => $nbr_topics_today, 'NBR_MSG_TODAY' => $nbr_msg_today, 'L_FORUM_INDEX' => $LANG['forum_index'], 'L_FORUM' => $LANG['forum'], 'L_STATS' => $LANG['stats'], 'L_NBR_TOPICS' => $total_topics > 1 ? $LANG['topic_s'] : $LANG['topic'], 'L_NBR_MSG' => $total_messages > 1 ? $LANG['message_s'] : $LANG['message'], 'L_NBR_TOPICS_DAY' => $LANG['nbr_topics_day'], 'L_NBR_MSG_DAY' => $LANG['nbr_msg_day'], 'L_NBR_TOPICS_TODAY' => $LANG['nbr_topics_today'], 'L_NBR_MSG_TODAY' => $LANG['nbr_msg_today'], 'L_LAST_MSG' => $LANG['forum_last_msg'], 'L_POPULAR' => $LANG['forum_popular'], 'L_ANSWERS' => $LANG['forum_nbr_answers']);
//Vérification des autorisations.
$authorized_categories = ForumService::get_authorized_categories(Category::ROOT_CATEGORY);
//Dernières réponses
$result = PersistenceContext::get_querier()->select("SELECT t.id, t.title, c.id as cid, c.auth\nFROM " . PREFIX . "forum_topics t\nLEFT JOIN " . PREFIX . "forum_cats c ON c.id = t.idcat\nWHERE c.id_parent != 0 AND c.id IN :authorized_categories\nORDER BY t.last_timestamp DESC\nLIMIT 10", array('authorized_categories' => $authorized_categories));
while ($row = $result->fetch()) {
$tpl->assign_block_vars('last_msg', array('U_TOPIC_ID' => url('.php?id=' . $row['id'], '-' . $row['id'] . '.php'), 'TITLE' => stripslashes($row['title'])));
示例7: elseif
$result->dispose();
$tpl->put_all(array('C_STATS_REFERER' => true, 'C_REFERERS' => $nbr_referer, 'C_PAGINATION' => $pagination->has_several_pages(), 'PAGINATION' => $pagination->display(), 'L_URL' => $LANG['url'], 'L_TOTAL_VISIT' => $LANG['total_visit'], 'L_AVERAGE_VISIT' => $LANG['average_visit'], 'L_TREND' => $LANG['trend'], 'L_LAST_UPDATE' => $LANG['last_update'], 'L_NO_REFERER' => $LANG['no_referer']));
} elseif (!empty($keyword)) {
include_once PATH_TO_ROOT . '/stats/stats_functions.php';
$nbr_keyword = $db_querier->count(StatsSetup::$stats_referer_table, 'WHERE type = 1', array(), 'DISTINCT(relative_url)');
$page = AppContext::get_request()->get_getint('p', 1);
$pagination = new ModulePagination($page, $nbr_keyword, $_NBR_ELEMENTS_PER_PAGE);
$pagination->set_url(new Url('/stats/admin_stats.php?keyword=1&p=%d'));
if ($pagination->current_page_is_empty() && $page > 1) {
$error_controller = PHPBoostErrors::unexisting_page();
DispatchManager::redirect($error_controller);
}
$result = $db_querier->select("SELECT id, count(*) as count, relative_url, SUM(total_visit) as total_visit, SUM(today_visit) as today_visit, SUM(yesterday_visit) as yesterday_visit, nbr_day, MAX(last_update) as last_update\n\t\tFROM " . PREFIX . "stats_referer\n\t\tWHERE type = 1\n\t\tGROUP BY relative_url\n\t\tORDER BY total_visit DESC\n\t\tLIMIT :number_items_per_page OFFSET :display_from", array('number_items_per_page' => $pagination->get_number_items_per_page(), 'display_from' => $pagination->get_display_from()));
while ($row = $result->fetch()) {
$trend_parameters = get_trend_parameters($row['total_visit'], $row['nbr_day'], $row['yesterday_visit'], $row['today_visit']);
$tpl->assign_block_vars('keyword_list', array('ID' => $row['id'], 'KEYWORD' => $row['relative_url'], 'IMG_MORE' => '<a class="fa fa-plus-square-o" style="cursor:pointer;" onclick="XMLHttpRequest_referer(' . $row['id'] . ')" id="img_url' . $row['id'] . '"></a>', 'NBR_LINKS' => $row['count'], 'TOTAL_VISIT' => $row['total_visit'], 'AVERAGE_VISIT' => $trend_parameters['average'], 'LAST_UPDATE' => Date::to_format($row['last_update'], Date::FORMAT_DAY_MONTH_YEAR), 'TREND' => ($trend_parameters['picture'] ? '<i class="fa fa-trend-' . $trend_parameters['picture'] . '"></i> ' : '') . '(' . $trend_parameters['sign'] . $trend_parameters['trend'] . '%)'));
}
$result->dispose();
$tpl->put_all(array('C_STATS_KEYWORD' => true, 'C_KEYWORDS' => $nbr_keyword, 'C_PAGINATION' => $pagination->has_several_pages(), 'PAGINATION' => $pagination->display(), 'L_SEARCH_ENGINE' => $LANG['keyword_s'], 'L_TOTAL_VISIT' => $LANG['total_visit'], 'L_AVERAGE_VISIT' => $LANG['average_visit'], 'L_TREND' => $LANG['trend'], 'L_LAST_UPDATE' => $LANG['last_update'], 'L_NO_KEYWORD' => $LANG['no_keyword']));
} elseif (!empty($browser) || !empty($os) || !empty($user_lang)) {
if (!empty($browser)) {
$tpl->put_all(array('C_STATS_BROWSERS' => true, 'GRAPH_RESULT' => '<img src="display_stats.php?browsers=1" alt="' . $LANG['browser_s'] . '" />', 'L_BROWSERS' => $LANG['browser_s'], 'L_COLORS' => $LANG['colors'], 'L_PERCENTAGE' => $LANG['percentage']));
$stats_menu = 'browsers';
$array_stats_info = $stats_array_browsers;
$path = '../images/stats/browsers/';
} elseif (!empty($os)) {
$tpl->put_all(array('C_STATS_OS' => true, 'GRAPH_RESULT' => '<img src="display_stats.php?os=1" alt="' . $LANG['os'] . '" />', 'L_OS' => $LANG['os'], 'L_COLORS' => $LANG['colors'], 'L_PERCENTAGE' => $LANG['percentage']));
$stats_menu = 'os';
$array_stats_info = $stats_array_os;
$path = '../images/stats/os/';
} elseif (!empty($user_lang)) {
示例8: ceil
//Si le dernier message lu est présent on redirige vers lui, sinon on redirige vers le dernier posté.
if (!empty($row['last_view_id'])) {
$last_msg_id = $row['last_view_id'];
$last_page = 'idm=' . $row['last_view_id'] . '&';
$last_page_rewrite = '-0-' . $row['last_view_id'];
} else {
$last_msg_id = $row['last_msg_id'];
$last_page = ceil($row['nbr_msg'] / $config->get_number_messages_per_page());
$last_page_rewrite = $last_page > 1 ? '-' . $last_page : '';
$last_page = $last_page > 1 ? 'pt=' . $last_page . '&' : '';
}
//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']) : '';
//Affichage du dernier message posté.
$last_group_color = User::get_group_color($row['last_user_groups'], $row['last_user_level']);
$last_msg = '<a href="topic' . url('.php?' . $last_page . 'id=' . $row['id'], '-' . $row['id'] . $last_page_rewrite . $rewrited_title . '.php') . '#m' . $last_msg_id . '" title=""><i class="fa fa-hand-o-right"></i></a>' . ' ' . $LANG['on'] . ' ' . Date::to_format($row['last_timestamp'], Date::FORMAT_DAY_MONTH_YEAR_HOUR_MINUTE) . '<br /> ' . $LANG['by'] . ' ' . (!empty($row['last_login']) ? '<a class="small ' . UserService::get_level_class($row['last_user_level']) . '"' . (!empty($last_group_color) ? ' style="color:' . $last_group_color . '"' : '') . ' href="' . UserUrlBuilder::profile($row['last_user_id'])->rel() . '">' . TextHelper::wordwrap_html($row['last_login'], 13) . '</a>' : '<em>' . $LANG['guest'] . '</em>');
//Ancre ajoutée aux messages non lus.
$new_ancre = '<a href="topic' . url('.php?' . $last_page . 'id=' . $row['id'], '-' . $row['id'] . $last_page_rewrite . $rewrited_title . '.php') . '#m' . $last_msg_id . '" title=""><i class="fa fa-hand-o-right"></i></a>';
//On crée une pagination (si activé) si le nombre de topics est trop important.
$page = AppContext::get_request()->get_getint('pt', 1);
$topic_pagination = new ModulePagination($page, $row['nbr_msg'], $config->get_number_messages_per_page(), Pagination::LIGHT_PAGINATION);
$topic_pagination->set_url(new Url('/forum/topic.php?id=' . $row['id'] . '&pt=%d'));
$group_color = User::get_group_color($row['groups'], $row['user_level']);
$tpl->assign_block_vars('topics', array('C_PAGINATION' => $topic_pagination->has_several_pages(), 'C_IMG_POLL' => !empty($row['question']), 'C_IMG_TRACK' => !empty($row['idtrack']), 'C_DISPLAY_MSG' => $config->is_message_before_topic_title_displayed() && $config->is_message_before_topic_title_icon_displayed() && $row['display_msg'], 'C_HOT_TOPIC' => $row['type'] == '0' && $row['status'] != '0' && $row['nbr_msg'] > $config->get_number_messages_per_page(), 'C_BLINK' => $blink, 'IMG_ANNOUNCE' => $img_announce, 'ANCRE' => $new_ancre, 'TYPE' => $type[$row['type']], 'TITLE' => stripslashes($row['title']), 'AUTHOR' => !empty($row['login']) ? '<a href="' . UserUrlBuilder::profile($row['user_id'])->rel() . '" class="small ' . UserService::get_level_class($row['user_level']) . '"' . (!empty($group_color) ? ' style="color:' . $group_color . '"' : '') . '>' . $row['login'] . '</a>' : '<em>' . $LANG['guest'] . '</em>', 'DESC' => $row['subtitle'], 'PAGINATION' => $topic_pagination->display(), 'MSG' => $row['nbr_msg'] - 1, 'VUS' => $row['nbr_views'], 'U_TOPIC_VARS' => url('.php?id=' . $row['id'], '-' . $row['id'] . $rewrited_title . '.php'), 'U_LAST_MSG' => $last_msg, 'L_DISPLAY_MSG' => $config->is_message_before_topic_title_displayed() && $row['display_msg'] ? $config->get_message_before_topic_title() : ''));
}
$result->dispose();
//Le membre a déjà lu tous les messages.
if ($nbr_topics == 0) {
$tpl->put_all(array('C_NO_TOPICS' => true, 'L_NO_TOPICS' => '0 ' . $LANG['no_last_read']));
}
//Listes les utilisateurs en lignes.
示例9: elseif
} elseif (!empty($row['login'])) {
$author = '<a href="' . UserUrlBuilder::profile($row['user_id'])->rel() . '" class="small ' . UserService::get_level_class($row['level']) . '"' . (!empty($group_color) ? ' style="color:' . $group_color . '"' : '') . '>' . $row['login'] . '</a>';
} else {
$author = '<strike>' . $LANG['guest'] . '</strike>';
}
$participants = $row['login_dest'] != $current_user->get_display_name() ? $row['login_dest'] : $author;
$user_id_dest = $row['user_id_dest'] != $current_user->get_id() ? $row['user_id_dest'] : $row['user_id'];
$participants_group_color = $participants != $LANG['admin'] && $participants != '<strike>' . $LANG['guest'] . '</strike>' ? User::get_group_color($row['dest_groups'], $row['dest_level']) : '';
switch ($author) {
case $LANG['admin']:
$participants_level_class = UserService::get_level_class(User::ADMIN_LEVEL);
break;
case '<strike>' . $LANG['guest'] . '</strike>':
$participants_level_class = '';
break;
default:
$participants_level_class = UserService::get_level_class($row['dest_level']);
break;
}
$participants = !empty($participants) ? '<a href="' . UserUrlBuilder::profile($user_id_dest)->rel() . '" class="' . $participants_level_class . '"' . (!empty($participants_group_color) ? ' style="color:' . $participants_group_color . '"' : '') . '>' . $participants . '</a>' : '<strike>' . $LANG['admin'] . '</strike>';
//Affichage du dernier message posté.
$last_group_color = User::get_group_color($row['last_groups'], $row['last_level']);
$last_msg = '<a href="pm' . url('.php?' . $last_page . 'id=' . $row['id'], '-0-' . $row['id'] . $last_page_rewrite . '.php') . '#m' . $row['last_msg_id'] . '" title="" class="fa fa-hand-o-right"></a>' . ' ' . $LANG['on'] . ' ' . Date::to_format($row['last_timestamp'], Date::FORMAT_DAY_MONTH_YEAR_HOUR_MINUTE) . '<br />';
$last_msg .= $row['user_id'] == -1 ? $LANG['by'] . ' ' . $LANG['admin'] : $LANG['by'] . ' <a href="' . UserUrlBuilder::profile($row['last_user_id'])->rel() . '" class="small ' . UserService::get_level_class($row['last_level']) . '"' . (!empty($last_group_color) ? ' style="color:' . $last_group_color . '"' : '') . '>' . $row['last_login'] . '</a>';
$tpl->assign_block_vars('convers.list', array('INCR' => $i, 'ID' => $row['id'], 'ANNOUNCE' => $announce, 'TITLE' => $row['title'], 'MSG' => $row['nbr_msg'] - 1, 'U_PARTICIPANTS' => $row['user_convers_status'] != 0 ? '<strike>' . $participants . '</strike>' : $participants, 'U_CONVERS' => url('.php?id=' . $row['id'], '-0-' . $row['id'] . '.php'), 'U_AUTHOR' => $LANG['by'] . ' ' . $author, 'U_LAST_MSG' => $last_msg));
$i++;
}
$result->dispose();
$tpl->display();
}
include '../kernel/footer.php';
示例10: foreach
$tpl->put_all(array('L_INFO' => $LANG['db_empty_dir']));
} else {
$tpl->put_all(array('C_FILES' => true, 'L_INFO' => $LANG['db_restore_file']));
foreach ($filelist as $file) {
$tpl->assign_block_vars('file', array('FILE_NAME' => $file['file_name'], 'WEIGHT' => $file['weight'], 'FILE_DATE' => $file['file_date']));
}
}
} else {
//Sauvegarde
if ($action == 'backup') {
$backup_type = $request->has_postparameter('backup_type') && $request->get_postvalue('backup_type') != 'all' ? $request->get_postvalue('backup_type') == 'data' ? DBMSUtils::DUMP_DATA : DBMSUtils::DUMP_STRUCTURE : DBMSUtils::DUMP_STRUCTURE_AND_DATA;
$selected_tables = $request->get_postarray('table_list');
if (empty($selected_tables)) {
AppContext::get_response()->redirect(HOST . DIR . url('/database/admin_database.php?error=empty_list'));
}
$file_name = 'backup_' . PersistenceContext::get_dbms_utils()->get_database_name() . '_' . str_replace('/', '-', Date::to_format(Date::DATE_NOW, 'y-m-d-H-i-s')) . '.sql';
$file_path = PATH_TO_ROOT . '/cache/backup/' . $file_name;
Environment::try_to_increase_max_execution_time();
PersistenceContext::get_dbms_utils()->dump_tables(new BufferedFileWriter(new File($file_path)), $selected_tables, $backup_type);
AppContext::get_response()->redirect(HOST . DIR . url('/database/admin_database.php?error=backup_success&file=' . $file_name));
}
if ($tables_backup) {
$tables = PersistenceContext::get_dbms_utils()->list_tables(true);
$tpl->put_all(array('C_DATABASE_BACKUP' => true, 'NBR_TABLES' => count($tables), 'TARGET' => url('admin_database.php?token=' . AppContext::get_session()->get_token()), 'SELECT_ALL' => $LANG['select_all'], 'SELECT_NONE' => $LANG['select_none'], 'L_BACKUP_DATABASE' => $LANG['db_backup_database'], 'L_EXPLAIN_BACKUP' => $LANG['db_backup_explain'], 'L_SELECTION' => $LANG['db_selected_tables'], 'L_BACKUP_ALL' => $LANG['db_backup_all'], 'L_BACKUP_STRUCT' => $LANG['db_backup_struct'], 'L_BACKUP_DATA' => $LANG['db_backup_data'], 'L_BACKUP' => $LANG['db_backup']));
$selected_tables = array();
$i = 0;
foreach ($tables as $table) {
if ($table == $get_table || $request->has_postparameter('table_' . $table) && $request->get_postvalue('table_' . $table) == 'on') {
$selected_tables[] = $table;
}
$tpl->assign_block_vars('table_list', array('NAME' => $table, 'SELECTED' => in_array($table, $selected_tables) ? 'selected="selected"' : '', 'I' => $i));
示例11: ModulePagination
$pagination = new ModulePagination($page, $nbrarchives, $_NBR_ELEMENTS_PER_PAGE);
$pagination->set_url(new Url('/poll/poll.php?p=%d'));
if ($pagination->current_page_is_empty() && $page > 1) {
$error_controller = PHPBoostErrors::unexisting_page();
DispatchManager::redirect($error_controller);
}
$tpl->put_all(array('C_POLL_ARCHIVES' => true, 'C_IS_ADMIN' => AppContext::get_current_user()->check_level(User::ADMIN_LEVEL), 'C_PAGINATION' => $pagination->has_several_pages(), 'PAGINATION' => $pagination->display(), 'L_ARCHIVE' => $LANG['archives'], 'L_BACK_POLL' => $LANG['poll_back'], 'L_ON' => $LANG['on'], 'L_EDIT' => LangLoader::get_message('edit', 'common'), 'L_DELETE' => LangLoader::get_message('delete', 'common')));
//On recupère les sondages archivés.
$result = PersistenceContext::get_querier()->select("SELECT id, question, votes, answers, type, timestamp\n\tFROM " . PREFIX . "poll\n\tWHERE archive = 1 AND visible = 1\n\tORDER BY timestamp DESC\n\tLIMIT :number_items_per_page OFFSET :display_from", array('number_items_per_page' => $pagination->get_number_items_per_page(), 'display_from' => $pagination->get_display_from()));
while ($row = $result->fetch()) {
$array_answer = explode('|', $row['answers']);
$array_vote = explode('|', $row['votes']);
$sum_vote = array_sum($array_vote);
$sum_vote = $sum_vote == 0 ? 1 : $sum_vote;
//Empêche la division par 0.
$tpl->assign_block_vars('list', array('ID' => $row['id'], 'QUESTION' => stripslashes($row['question']), 'EDIT' => '<a href="' . PATH_TO_ROOT . '/poll/admin_poll' . url('.php?id=' . $row['id']) . '" title="' . LangLoader::get_message('edit', 'common') . '" class="fa fa-edit"></a>', 'DEL' => ' <a href="' . PATH_TO_ROOT . '/poll/admin_poll' . url('.php?delete=1&id=' . $row['id']) . '" title="' . LangLoader::get_message('delete', 'common') . '" class="fa fa-delete" data-confirmation="delete-element"></a>', 'VOTE' => $sum_vote, 'DATE' => Date::to_format(Date::DATE_NOW, Date::FORMAT_DAY_MONTH_YEAR_HOUR_MINUTE), 'L_VOTE' => $sum_vote > 1 ? $LANG['poll_vote_s'] : $LANG['poll_vote']));
$array_poll = array_combine($array_answer, $array_vote);
foreach ($array_poll as $answer => $nbrvote) {
$tpl->assign_block_vars('list.result', array('ANSWERS' => $answer, 'NBRVOTE' => $nbrvote, 'WIDTH' => NumberHelper::round($nbrvote * 100 / $sum_vote, 1) * 4, 'PERCENT' => NumberHelper::round($nbrvote * 100 / $sum_vote, 1), 'L_VOTE' => $nbrvote > 1 ? $LANG['poll_vote_s'] : $LANG['poll_vote']));
}
}
$result->dispose();
$tpl->display();
} else {
$modulesLoader = AppContext::get_extension_provider_service();
$module = $modulesLoader->get_provider('poll');
if ($module->has_extension_point(HomePageExtensionPoint::EXTENSION_POINT)) {
echo $module->get_extension_point(HomePageExtensionPoint::EXTENSION_POINT)->get_home_page()->get_view()->display();
}
}
require_once '../kernel/footer.php';
示例12: array
$tpl->assign_block_vars('list', array('TITLE' => $LANG['wiki_consult_article'], 'AUTHOR' => !empty($row['login']) ? '<a href="' . UserUrlBuilder::profile($row['user_id'])->rel() . '" class="' . UserService::get_level_class($row['level']) . '"' . (!empty($group_color) ? ' style="color:' . $group_color . '"' : '') . '>' . $row['login'] . '</a>' : $row['user_ip'], 'DATE' => Date::to_format($row['timestamp'], Date::FORMAT_DAY_MONTH_YEAR_HOUR_MINUTE), 'U_ARTICLE' => $row['activ'] == 1 ? url('wiki.php?title=' . $row['encoded_title'], $row['encoded_title']) : url('wiki.php?id_contents=' . $row['id_contents']), 'CURRENT_RELEASE' => $row['activ'] == 1 ? '(' . $LANG['wiki_current_version'] . ')' : '', 'ACTIONS' => !empty($actions) ? $actions : $LANG['wiki_no_possible_action']));
}
$result->dispose();
$tpl->put_all(array('L_VERSIONS' => $LANG['wiki_version_list'], 'L_DATE' => LangLoader::get_message('date', 'date-common'), 'L_AUTHOR' => $LANG['wiki_author'], 'L_ACTIONS' => $LANG['wiki_possible_actions']));
$tpl->display();
} else {
$_WIKI_NBR_ARTICLES_A_PAGE_IN_HISTORY = 25;
//Champs sur lesquels on ordonne
$field = $field == 'title' ? 'title' : 'timestamp';
$order = $order == 'asc' ? 'asc' : 'desc';
//On compte le nombre d'articles
$nbr_articles = PersistenceContext::get_querier()->count(PREFIX . "wiki_articles", 'WHERE redirect = 0');
//On instancie la classe de pagination
$page = AppContext::get_request()->get_getint('p', 1);
$pagination = new ModulePagination($page, $nbr_articles, $_WIKI_NBR_ARTICLES_A_PAGE_IN_HISTORY);
$pagination->set_url(new Url('/wiki/history.php?field=' . $field . '&order=' . $order . '&p=%d'));
if ($pagination->current_page_is_empty() && $page > 1) {
$error_controller = PHPBoostErrors::unexisting_page();
DispatchManager::redirect($error_controller);
}
$tpl = new FileTemplate('wiki/history.tpl');
$tpl->put_all(array('C_PAGINATION' => $pagination->has_several_pages(), 'L_HISTORY' => $LANG['wiki_history'], 'L_TITLE' => $LANG['wiki_article_title'], 'L_AUTHOR' => $LANG['wiki_author'], 'L_DATE' => LangLoader::get_message('date', 'date-common'), 'TOP_TITLE' => $field == 'title' && $order == 'asc' ? '' : url('history.php?p=' . $page . '&field=title&order=asc'), 'BOTTOM_TITLE' => $field == 'title' && $order == 'desc' ? '' : url('history.php?p=' . $page . '&field=title&order=desc'), 'TOP_DATE' => $field == 'timestamp' && $order == 'asc' ? '' : url('history.php?p=' . $page . '&field=timestamp&order=asc'), 'BOTTOM_DATE' => $field == 'timestamp' && $order == 'desc' ? '' : url('history.php?p=' . $page . '&field=timestamp&order=desc'), 'PAGINATION' => $pagination->display()));
$result = PersistenceContext::get_querier()->select("SELECT a.title, a.encoded_title, c.timestamp, c.id_contents AS id, c.user_id, c.user_ip, m.display_name, m.groups, m.level, c.id_article, c.activ, a.id_contents\n\t\tFROM " . PREFIX . "wiki_articles a\n\t\tLEFT JOIN " . PREFIX . "wiki_contents c ON c.id_contents = a.id_contents\n\t\tLEFT JOIN " . DB_TABLE_MEMBER . " m ON m.user_id = c.user_id\n\t\tWHERE a.redirect = 0\n\t\tORDER BY " . ($field == 'title' ? 'a' : 'c') . "." . $field . " " . $order . "\n\t\tLIMIT :number_items_per_page OFFSET :display_from", array('number_items_per_page' => $pagination->get_number_items_per_page(), 'display_from' => $pagination->get_display_from()));
while ($row = $result->fetch()) {
$group_color = User::get_group_color($row['groups'], $row['level']);
$tpl->assign_block_vars('list', array('TITLE' => stripslashes($row['title']), 'AUTHOR' => !empty($row['login']) ? '<a href="' . UserUrlBuilder::profile($row['user_id'])->rel() . '" class="' . UserService::get_level_class($row['level']) . '"' . (!empty($group_color) ? ' style="color:' . $group_color . '"' : '') . '>' . $row['login'] . '</a>' : $row['user_ip'], 'DATE' => Date::to_format($row['timestamp'], Date::FORMAT_DAY_MONTH_YEAR_HOUR_MINUTE), 'U_ARTICLE' => url('wiki.php?title=' . $row['encoded_title'], $row['encoded_title'])));
}
$result->dispose();
$tpl->display();
}
require_once '../kernel/footer.php';
示例13: foreach
}
foreach ($table_structure['fields'] as $fields_info) {
$primary_key = false;
foreach ($table_structure['index'] as $index_info) {
if ($index_info['type'] == 'PRIMARY KEY' && in_array($fields_info['name'], explode(',', $index_info['fields']))) {
$primary_key = true;
break;
}
}
//Champs.
$tpl->assign_block_vars('field', array('FIELD_NAME' => $primary_key ? '<span style="text-decoration:underline">' . $fields_info['name'] . '<span>' : $fields_info['name'], 'FIELD_TYPE' => $fields_info['type'], 'FIELD_ATTRIBUTE' => $fields_info['attribute'], 'FIELD_NULL' => $fields_info['null'] ? '<strong>' . LangLoader::get_message('yes', 'common') . '</strong>' : LangLoader::get_message('no', 'common'), 'FIELD_DEFAULT' => $fields_info['default'], 'FIELD_EXTRA' => $fields_info['extra']));
}
//index
foreach ($table_structure['index'] as $index_info) {
$tpl->assign_block_vars('index', array('INDEX_NAME' => $index_info['name'], 'INDEX_TYPE' => $index_info['type'], 'INDEX_FIELDS' => str_replace(',', '<br />', $index_info['fields'])));
}
//Infos sur la table.
$free = NumberHelper::round($backup->tables[$table]['data_free'] / 1024, 1);
$data = NumberHelper::round($backup->tables[$table]['data_length'] / 1024, 1);
$index = NumberHelper::round($backup->tables[$table]['index_length'] / 1024, 1);
$total = $index + $data;
$l_total = $total > 1024 ? NumberHelper::round($total / 1024, 1) . ' MB' : $total . ' kB';
$free = $free > 1024 ? NumberHelper::round($free / 1024, 1) . ' MB' : $free . ' kB';
$data = $data > 1024 ? NumberHelper::round($data / 1024, 1) . ' MB' : $data . ' kB';
$index = $index > 1024 ? NumberHelper::round($index / 1024, 1) . ' MB' : $index . ' kB';
$tpl->put_all(array('C_DATABASE_TABLE_STRUCTURE' => true, 'C_DATABASE_TABLE_DATA' => false, 'C_AUTOINDEX' => !empty($backup->tables[$table]['auto_increment']) ? true : false, 'TABLE_ENGINE' => $backup->tables[$table]['engine'], 'TABLE_ROW_FORMAT' => $backup->tables[$table]['row_format'], 'TABLE_ROWS' => $backup->tables[$table]['rows'], 'TABLE_DATA' => $data != 0 ? $data : '-', 'TABLE_INDEX' => $index != 0 ? $index : '-', 'TABLE_TOTAL_SIZE' => $total != 0 ? $l_total : '-', 'TABLE_FREE' => $free != 0 ? '<span style="color:red">' . $free . '</span>' : '-', 'TABLE_COLLATION' => $backup->tables[$table]['collation'], 'TABLE_AUTOINCREMENT' => $backup->tables[$table]['auto_increment'], 'TABLE_CREATION_DATE' => Date::to_format(strtotime($backup->tables[$table]['create_time'], Date::FORMAT_DAY_MONTH_YEAR_HOUR_MINUTE)), 'TABLE_LAST_UPDATE' => Date::to_format(strtotime($backup->tables[$table]['update_time'], Date::FORMAT_DAY_MONTH_YEAR_HOUR_MINUTE)), 'L_TABLE_FIELD' => $LANG['db_table_field'], 'L_TABLE_TYPE' => $LANG['type'], 'L_TABLE_ATTRIBUTE' => $LANG['db_table_attribute'], 'L_TABLE_NULL' => $LANG['db_table_null'], 'L_TABLE_DEFAULT' => $LANG['default'], 'L_TABLE_EXTRA' => $LANG['db_table_extra'], 'L_TABLE_NAME' => $LANG['db_table_name'], 'L_TABLE_ROWS' => $LANG['db_table_rows'], 'L_TABLE_ROWS_FORMAT' => $LANG['db_table_rows_format'], 'L_TABLE_ENGINE' => $LANG['db_table_engine'], 'L_TABLE_COLLATION' => $LANG['db_table_collation'], 'L_TABLE_DATA' => $LANG['db_table_data'], 'L_TABLE_TOTAL' => $LANG['total'], 'L_INDEX_NAME' => $LANG['name'], 'L_TABLE_INDEX' => $LANG['db_table_index'], 'L_TABLE_FREE' => $LANG['db_table_free'], 'L_STATISTICS' => $LANG['stats'], 'L_OPTIMIZE' => $LANG['db_optimize'], 'L_AUTOINCREMENT' => $LANG['db_autoincrement'], 'L_LAST_UPDATE' => $LANG['last_update'], 'L_CREATION_DATE' => $LANG['creation_date'], 'L_OPTIMIZE' => $LANG['db_optimize'], 'L_SIZE' => $LANG['size']));
} else {
AppContext::get_response()->redirect('/database/admin_database.php');
}
$tpl->display();
require_once '../admin/admin_footer.php';
示例14: parse_search_result
/**
* @desc Return the string to print the result
* @param &string[] $result_data the result's data
* @return string[] The string to print the result of a search element
*/
public function parse_search_result($result_data)
{
global $LANG;
load_module_lang('forum');
//Chargement de la langue du module.
$tpl = new FileTemplate('forum/forum_generic_results.tpl');
$tpl->put_all(array('L_ON' => $LANG['on'], 'L_TOPIC' => $LANG['topic']));
$rewrited_title = ServerEnvironmentConfig::load()->is_url_rewriting_enabled() ? '+' . Url::encode_rewrite($result_data['title']) : '';
$tpl->put_all(array('USER_ONLINE' => '<i class="fa ' . (!empty($result_data['connect']) && $result_data['user_id'] !== -1 ? 'fa-online' : 'fa-offline') . '"></i>', 'U_USER_PROFILE' => !empty($result_data['user_id']) ? UserUrlBuilder::profile($result_data['user_id'])->rel() : '', 'USER_PSEUDO' => !empty($result_data['display_name']) ? TextHelper::wordwrap_html($result_data['display_name'], 13) : $LANG['guest'], 'U_TOPIC' => PATH_TO_ROOT . '/forum/topic' . url('.php?id=' . $result_data['topic_id'], '-' . $result_data['topic_id'] . $rewrited_title . '.php') . '#m' . $result_data['msg_id'], 'TITLE' => stripslashes($result_data['title']), 'DATE' => Date::to_format($result_data['date'], 'd/m/y'), 'CONTENTS' => FormatingHelper::second_parse(stripslashes($result_data['contents'])), 'USER_AVATAR' => '<img src="' . (UserAccountsConfig::load()->is_default_avatar_enabled() && !empty($result_data['avatar']) ? $result_data['avatar'] : PATH_TO_ROOT . '/templates/' . AppContext::get_current_user()->get_theme() . '/images/' . UserAccountsConfig::load()->get_default_avatar_name()) . '" alt="' . LangLoader::get_message('avatar', 'user-common') . '" class="message-avatar"/>'));
return $tpl->render();
}
示例15: compute_error_log_string
private static function compute_error_log_string($error_msg, $error_stacktrace, $errno = 0)
{
return Date::to_format(time(), 'Y-m-d H:i:s', Timezone::SERVER_TIMEZONE) . "\n" . $errno . "\n" . self::clean_error_string($error_msg) . "\n" . self::clean_error_string($error_stacktrace) . "\n";
}