本文整理汇总了PHP中Date::get_timestamp方法的典型用法代码示例。如果您正苦于以下问题:PHP Date::get_timestamp方法的具体用法?PHP Date::get_timestamp怎么用?PHP Date::get_timestamp使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Date
的用法示例。
在下文中一共展示了Date::get_timestamp方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_search_request
public function get_search_request($args)
{
$now = new Date();
$authorized_categories = DownloadService::get_authorized_categories(Category::ROOT_CATEGORY);
$weight = isset($args['weight']) && is_numeric($args['weight']) ? $args['weight'] : 1;
return "SELECT " . $args['id_search'] . " AS id_search,\n\t\t\td.id AS id_content,\n\t\t\td.name AS title,\n\t\t\t( 2 * FT_SEARCH_RELEVANCE(d.name, '" . $args['search'] . "') + (FT_SEARCH_RELEVANCE(d.contents, '" . $args['search'] . "') +\n\t\t\tFT_SEARCH_RELEVANCE(d.short_contents, '" . $args['search'] . "')) / 2 ) / 3 * " . $weight . " AS relevance,\n\t\t\tCONCAT('" . PATH_TO_ROOT . "/download/index.php?url=/', id_category, '-', IF(id_category != 0, cat.rewrited_name, 'root'), '/', d.id, '-', d.rewrited_name) AS link\n\t\t\tFROM " . DownloadSetup::$download_table . " d\n\t\t\tLEFT JOIN " . DownloadSetup::$download_cats_table . " cat ON d.id_category = cat.id\n\t\t\tWHERE ( FT_SEARCH(d.name, '" . $args['search'] . "') OR FT_SEARCH(d.contents, '" . $args['search'] . "') OR FT_SEARCH_RELEVANCE(d.short_contents, '" . $args['search'] . "') )\n\t\t\tAND id_category IN (" . implode(", ", $authorized_categories) . ")\n\t\t\tAND (approbation_type = 1 OR (approbation_type = 2 AND start_date < '" . $now->get_timestamp() . "' AND (end_date > '" . $now->get_timestamp() . "' OR end_date = 0)))\n\t\t\tORDER BY relevance DESC\n\t\t\tLIMIT 100 OFFSET 0";
}
示例2: get_search_request
public function get_search_request($args)
{
$now = new Date();
$authorized_categories = ArticlesService::get_authorized_categories(Category::ROOT_CATEGORY);
$weight = isset($args['weight']) && is_numeric($args['weight']) ? $args['weight'] : 1;
return "SELECT " . $args['id_search'] . " AS id_search,\n\t\t\tarticles.id AS id_content,\n\t\t\tarticles.title AS title,\n\t\t\t(2 * FT_SEARCH_RELEVANCE(articles.title, '" . $args['search'] . "') + (FT_SEARCH_RELEVANCE(articles.contents, '" . $args['search'] . "') +\n\t\t\tFT_SEARCH_RELEVANCE(articles.description, '" . $args['search'] . "')) / 2 ) / 3 * " . $weight . " AS relevance,\n\t\t\tCONCAT('" . PATH_TO_ROOT . "/articles/index.php?url=/', id_category, '-', IF(id_category != 0, cat.rewrited_name, 'root'), '/', articles.id, '-', articles.rewrited_title) AS link\n\t\t\tFROM " . ArticlesSetup::$articles_table . " articles\n\t\t\tLEFT JOIN " . ArticlesSetup::$articles_cats_table . " cat ON cat.id = articles.id_category\n\t\t\tWHERE ( FT_SEARCH(articles.title, '" . $args['search'] . "') OR FT_SEARCH(articles.contents, '" . $args['search'] . "') OR FT_SEARCH_RELEVANCE(articles.description, '" . $args['search'] . "') )\n\t\t\tAND id_category IN(" . implode(", ", $authorized_categories) . ")\n\t\t\tAND (published = 1 OR (published = 2 AND publishing_start_date < '" . $now->get_timestamp() . "' AND (publishing_end_date > '" . $now->get_timestamp() . "' OR publishing_end_date = 0)))\n\t\t\tORDER BY relevance DESC\n\t\t\tLIMIT 100 OFFSET 0";
}
示例3: build_view
public function build_view()
{
$now = new Date();
$authorized_categories = NewsService::get_authorized_categories(Category::ROOT_CATEGORY);
$news_config = NewsConfig::load();
$condition = 'WHERE id_category IN :authorized_categories
' . (!NewsAuthorizationsService::check_authorizations()->moderation() ? ' AND author_user_id = :user_id' : '') . '
AND (approbation_type = 0 OR (approbation_type = 2 AND (start_date > :timestamp_now OR (end_date != 0 AND end_date < :timestamp_now))))';
$parameters = array('authorized_categories' => $authorized_categories, 'user_id' => AppContext::get_current_user()->get_id(), 'timestamp_now' => $now->get_timestamp());
$page = AppContext::get_request()->get_getint('page', 1);
$pagination = $this->get_pagination($condition, $parameters, $page);
$result = PersistenceContext::get_querier()->select('SELECT news.*, member.*
FROM ' . NewsSetup::$news_table . ' news
LEFT JOIN ' . DB_TABLE_MEMBER . ' member ON member.user_id = news.author_user_id
' . $condition . '
ORDER BY top_list_enabled DESC, news.creation_date DESC
LIMIT :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())));
$number_columns_display_news = $news_config->get_number_columns_display_news();
$this->tpl->put_all(array('C_DISPLAY_BLOCK_TYPE' => $news_config->get_display_type() == NewsConfig::DISPLAY_BLOCK, 'C_DISPLAY_LIST_TYPE' => $news_config->get_display_type() == NewsConfig::DISPLAY_LIST, 'C_DISPLAY_CONDENSED_CONTENT' => $news_config->get_display_condensed_enabled(), 'C_COMMENTS_ENABLED' => $news_config->get_comments_enabled(), 'C_NEWS_NO_AVAILABLE' => $result->get_rows_count() == 0, 'C_PENDING_NEWS' => true, 'C_PAGINATION' => $pagination->has_several_pages(), 'PAGINATION' => $pagination->display(), 'C_SEVERAL_COLUMNS' => $number_columns_display_news > 1, 'NUMBER_COLUMNS' => $number_columns_display_news));
while ($row = $result->fetch()) {
$news = new News();
$news->set_properties($row);
$this->tpl->assign_block_vars('news', $news->get_array_tpl_vars());
$this->build_sources_view($news);
}
$result->dispose();
}
示例4: build_view
public function build_view()
{
$now = new Date();
$authorized_categories = NewsService::get_authorized_categories(Category::ROOT_CATEGORY);
$news_config = NewsConfig::load();
$condition = 'WHERE relation.id_keyword = :id_keyword
AND id_category IN :authorized_categories
AND (approbation_type = 1 OR (approbation_type = 2 AND start_date < :timestamp_now AND (end_date > :timestamp_now OR end_date = 0)))';
$parameters = array('id_keyword' => $this->get_keyword()->get_id(), 'authorized_categories' => $authorized_categories, 'timestamp_now' => $now->get_timestamp());
$page = AppContext::get_request()->get_getint('page', 1);
$pagination = $this->get_pagination($condition, $parameters, $page);
$result = PersistenceContext::get_querier()->select('SELECT news.*, member.*
FROM ' . NewsSetup::$news_table . ' news
LEFT JOIN ' . DB_TABLE_KEYWORDS_RELATIONS . ' relation ON relation.module_id = \'news\' AND relation.id_in_module = news.id
LEFT JOIN ' . DB_TABLE_MEMBER . ' member ON member.user_id = news.author_user_id
' . $condition . '
ORDER BY top_list_enabled DESC, news.creation_date DESC
LIMIT :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())));
$number_columns_display_news = $news_config->get_number_columns_display_news();
$this->tpl->put_all(array('C_DISPLAY_BLOCK_TYPE' => $news_config->get_display_type() == NewsConfig::DISPLAY_BLOCK, 'C_DISPLAY_LIST_TYPE' => $news_config->get_display_type() == NewsConfig::DISPLAY_LIST, 'C_DISPLAY_CONDENSED_CONTENT' => $news_config->get_display_condensed_enabled(), 'C_COMMENTS_ENABLED' => $news_config->get_comments_enabled(), 'C_NEWS_NO_AVAILABLE' => $result->get_rows_count() == 0, 'C_PAGINATION' => $pagination->has_several_pages(), 'PAGINATION' => $pagination->display(), 'C_SEVERAL_COLUMNS' => $number_columns_display_news > 1, 'NUMBER_COLUMNS' => $number_columns_display_news, 'CATEGORY_NAME' => $this->get_keyword()->get_name()));
while ($row = $result->fetch()) {
$news = new News();
$news->set_properties($row);
$this->tpl->assign_block_vars('news', array_merge($news->get_array_tpl_vars(), array('L_COMMENTS' => CommentsService::get_number_and_lang_comments('news', $row['id']), 'NUMBER_COM' => !empty($row['number_comments']) ? $row['number_comments'] : 0)));
$this->build_sources_view($news);
}
$result->dispose();
}
示例5: build_view
public function build_view(HTTPRequestCustom $request)
{
$now = new Date();
$config = WebConfig::load();
$authorized_categories = WebService::get_authorized_categories(Category::ROOT_CATEGORY);
$mode = $request->get_getstring('sort', WebUrlBuilder::DEFAULT_SORT_MODE);
$field = $request->get_getstring('field', WebUrlBuilder::DEFAULT_SORT_FIELD);
$condition = 'WHERE relation.id_keyword = :id_keyword
AND id_category IN :authorized_categories
AND (approbation_type = 1 OR (approbation_type = 2 AND start_date < :timestamp_now AND (end_date > :timestamp_now OR end_date = 0)))';
$parameters = array('id_keyword' => $this->get_keyword()->get_id(), 'authorized_categories' => $authorized_categories, 'timestamp_now' => $now->get_timestamp());
$page = AppContext::get_request()->get_getint('page', 1);
$pagination = $this->get_pagination($condition, $parameters, $field, $mode, $page);
$sort_mode = $mode == 'asc' ? 'ASC' : 'DESC';
switch ($field) {
case 'name':
$sort_field = WebLink::SORT_ALPHABETIC;
break;
case 'visits':
$sort_field = WebLink::SORT_NUMBER_VISITS;
break;
case 'com':
$sort_field = WebLink::SORT_NUMBER_COMMENTS;
break;
case 'note':
$sort_field = WebLink::SORT_NOTATION;
break;
default:
$sort_field = WebLink::SORT_DATE;
break;
}
$result = PersistenceContext::get_querier()->select('SELECT web.*, member.*, com.number_comments, notes.average_notes, notes.number_notes, note.note
FROM ' . WebSetup::$web_table . ' web
LEFT JOIN ' . DB_TABLE_KEYWORDS_RELATIONS . ' relation ON relation.module_id = \'web\' AND relation.id_in_module = web.id
LEFT JOIN ' . DB_TABLE_MEMBER . ' member ON member.user_id = web.author_user_id
LEFT JOIN ' . DB_TABLE_COMMENTS_TOPIC . ' com ON com.id_in_module = web.id AND com.module_id = \'web\'
LEFT JOIN ' . DB_TABLE_AVERAGE_NOTES . ' notes ON notes.id_in_module = web.id AND notes.module_name = \'web\'
LEFT JOIN ' . DB_TABLE_NOTE . ' note ON note.id_in_module = web.id AND note.module_name = \'web\' AND note.user_id = :user_id
' . $condition . '
ORDER BY web.privileged_partner DESC, ' . $sort_field . ' ' . $sort_mode . '
LIMIT :number_items_per_page OFFSET :display_from', array_merge($parameters, array('user_id' => AppContext::get_current_user()->get_id(), 'number_items_per_page' => $pagination->get_number_items_per_page(), 'display_from' => $pagination->get_display_from())));
$this->tpl->put_all(array('C_WEBLINKS' => $result->get_rows_count() > 0, 'C_MORE_THAN_ONE_WEBLINK' => $result->get_rows_count() > 1, 'C_CATEGORY_DISPLAYED_SUMMARY' => $config->is_category_displayed_summary(), 'C_CATEGORY_DISPLAYED_TABLE' => $config->is_category_displayed_table(), 'C_COMMENTS_ENABLED' => $config->are_comments_enabled(), 'C_NOTATION_ENABLED' => $config->is_notation_enabled(), 'C_PAGINATION' => $pagination->has_several_pages(), 'PAGINATION' => $pagination->display(), 'TABLE_COLSPAN' => 3 + (int) $config->are_comments_enabled() + (int) $config->is_notation_enabled(), 'CATEGORY_NAME' => $this->get_keyword()->get_name()));
while ($row = $result->fetch()) {
$weblink = new WebLink();
$weblink->set_properties($row);
$keywords = $weblink->get_keywords();
$has_keywords = count($keywords) > 0;
$this->tpl->assign_block_vars('weblinks', array_merge($weblink->get_array_tpl_vars(), array('C_KEYWORDS' => $has_keywords)));
if ($has_keywords) {
$this->build_keywords_view($keywords);
}
}
$result->dispose();
$this->build_sorting_form($field, $mode);
}
示例6: get_view
private function get_view()
{
$this->check_authorizations();
global $Bread_crumb, $LANG;
require_once PATH_TO_ROOT . '/poll/poll_begin.php';
$tpl = new FileTemplate('poll/poll.tpl');
$now = new Date();
$show_archives = PersistenceContext::get_querier()->count(PREFIX . "poll", 'WHERE archive = 1 AND visible = 1 AND start <= :timestamp AND (end >= :timestamp OR end = 0)', array('timestamp' => $now->get_timestamp()));
$show_archives = !empty($show_archives) ? '<a href="poll' . url('.php?archives=1', '.php?archives=1') . '">' . $LANG['archives'] . '</a>' : '';
$edit = '';
if (AppContext::get_current_user()->check_level(User::ADMIN_LEVEL)) {
$edit = '<a href="' . PATH_TO_ROOT . '/poll/admin_poll.php" title="' . LangLoader::get_message('edit', 'common') . '" class="fa fa-edit"></a>';
}
$tpl->put_all(array('C_POLL_MAIN' => true, 'EDIT' => $edit, 'U_ARCHIVE' => $show_archives, 'L_POLL' => $LANG['poll'], 'L_POLL_MAIN' => $LANG['poll_main']));
$result = PersistenceContext::get_querier()->select("SELECT id, question \r\n\t\tFROM " . PREFIX . "poll \r\n\t\tWHERE archive = 0 AND visible = 1 AND start <= :timestamp AND (end >= :timestamp OR end = 0)\r\n\t\tORDER BY id DESC", array('timestamp' => $now->get_timestamp()));
while ($row = $result->fetch()) {
$tpl->assign_block_vars('list', array('U_POLL_ID' => url('.php?id=' . $row['id'], '-' . $row['id'] . '.php'), 'QUESTION' => stripslashes($row['question'])));
}
$result->dispose();
return $tpl;
}
示例7: build_view
public function build_view(HTTPRequestCustom $request)
{
$now = new Date();
$config = DownloadConfig::load();
$authorized_categories = DownloadService::get_authorized_categories(Category::ROOT_CATEGORY);
$mode = $request->get_getstring('sort', DownloadUrlBuilder::DEFAULT_SORT_MODE);
$field = $request->get_getstring('field', DownloadUrlBuilder::DEFAULT_SORT_FIELD);
$condition = 'WHERE id_category IN :authorized_categories
' . (!DownloadAuthorizationsService::check_authorizations()->moderation() ? ' AND author_user_id = :user_id' : '') . '
AND (approbation_type = 0 OR (approbation_type = 2 AND (start_date > :timestamp_now OR (end_date != 0 AND end_date < :timestamp_now))))';
$parameters = array('user_id' => AppContext::get_current_user()->get_id(), 'authorized_categories' => $authorized_categories, 'timestamp_now' => $now->get_timestamp());
$page = AppContext::get_request()->get_getint('page', 1);
$pagination = $this->get_pagination($condition, $parameters, $field, $mode, $page);
$sort_mode = $mode == 'asc' ? 'ASC' : 'DESC';
switch ($field) {
case 'name':
$sort_field = DownloadFile::SORT_ALPHABETIC;
break;
case 'author':
$sort_field = DownloadFile::SORT_AUTHOR;
break;
default:
$sort_field = DownloadFile::SORT_DATE;
break;
}
$result = PersistenceContext::get_querier()->select('SELECT download.*, member.*, com.number_comments, notes.average_notes, notes.number_notes, note.note
FROM ' . DownloadSetup::$download_table . ' download
LEFT JOIN ' . DB_TABLE_MEMBER . ' member ON member.user_id = download.author_user_id
LEFT JOIN ' . DB_TABLE_COMMENTS_TOPIC . ' com ON com.id_in_module = download.id AND com.module_id = \'download\'
LEFT JOIN ' . DB_TABLE_AVERAGE_NOTES . ' notes ON notes.id_in_module = download.id AND notes.module_name = \'download\'
LEFT JOIN ' . DB_TABLE_NOTE . ' note ON note.id_in_module = download.id AND note.module_name = \'download\' AND note.user_id = :user_id
' . $condition . '
ORDER BY ' . $sort_field . ' ' . $sort_mode . '
LIMIT :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_MORE_THAN_ONE_FILE' => $result->get_rows_count() > 1, 'C_PENDING' => true, 'C_CATEGORY_DISPLAYED_SUMMARY' => $config->is_category_displayed_summary(), 'C_CATEGORY_DISPLAYED_TABLE' => $config->is_category_displayed_table(), 'C_COMMENTS_ENABLED' => $config->are_comments_enabled(), 'C_NOTATION_ENABLED' => $config->is_notation_enabled(), 'C_AUTHOR_DISPLAYED' => $config->is_author_displayed(), 'C_PAGINATION' => $pagination->has_several_pages(), 'PAGINATION' => $pagination->display(), 'TABLE_COLSPAN' => 4 + (int) $config->are_comments_enabled() + (int) $config->is_notation_enabled()));
while ($row = $result->fetch()) {
$downloadfile = new DownloadFile();
$downloadfile->set_properties($row);
$keywords = $downloadfile->get_keywords();
$has_keywords = count($keywords) > 0;
$this->tpl->assign_block_vars('downloadfiles', array_merge($downloadfile->get_array_tpl_vars(), array('C_KEYWORDS' => $has_keywords)));
if ($has_keywords) {
$this->build_keywords_view($keywords);
}
}
$result->dispose();
$this->build_sorting_form($field, $mode);
}
示例8: addslashes
static function save_alert(&$alert)
{
global $Sql, $Cache;
if ($alert->get_id() > 0) {
$creation_date = $alert->get_creation_date();
$Sql->query_inject("UPDATE " . DB_TABLE_EVENTS . " SET entitled = '" . addslashes($alert->get_entitled()) . "', description = '" . addslashes($alert->get_properties()) . "', fixing_url = '" . addslashes($alert->get_fixing_url()) . "', current_status = '" . $alert->get_status() . "', creation_date = '" . $creation_date->get_timestamp() . "', id_in_module = '" . $alert->get_id_in_module() . "', identifier = '" . addslashes($alert->get_identifier()) . "', type = '" . addslashes($alert->get_type()) . "', priority = '" . $alert->get_priority() . "' WHERE id = '" . $alert->get_id() . "'", __LINE__, __FILE__);
if ($alert->get_must_regenerate_cache()) {
$Cache->generate_file('member');
$alert->set_must_regenerate_cache(false);
}
} else {
$creation_date = new Date();
$Sql->query_inject("INSERT INTO " . DB_TABLE_EVENTS . " (entitled, description, fixing_url, current_status, creation_date, id_in_module, identifier, type, priority) VALUES ('" . addslashes($alert->get_entitled()) . "', '" . addslashes($alert->get_properties()) . "', '" . addslashes($alert->get_fixing_url()) . "', '" . $alert->get_status() . "', '" . $creation_date->get_timestamp() . "', '" . $alert->get_id_in_module() . "', '" . addslashes($alert->get_identifier()) . "', '" . addslashes($alert->get_type()) . "', '" . $alert->get_priority() . "')", __LINE__, __FILE__);
$alert->set_id($Sql->insert_id("SELECT MAX(id) FROM " . DB_TABLE_EVENTS));
$Cache->generate_file('member');
}
}
示例9: synchronize
/**
* {@inheritdoc}
*/
public function synchronize()
{
$this->downloadfiles = array();
$now = new Date();
$config = DownloadConfig::load();
$result = PersistenceContext::get_querier()->select('
SELECT download.*, notes.average_notes, notes.number_notes
FROM ' . DownloadSetup::$download_table . ' download
LEFT JOIN ' . DB_TABLE_AVERAGE_NOTES . ' notes ON notes.id_in_module = download.id AND notes.module_name = \'download\'
WHERE (approbation_type = 1 OR (approbation_type = 2 AND start_date < :timestamp_now AND (end_date > :timestamp_now OR end_date = 0)))
ORDER BY ' . $config->get_sort_type() . ' DESC
LIMIT :files_number_in_menu OFFSET 0', array('timestamp_now' => $now->get_timestamp(), 'files_number_in_menu' => (int) $config->get_files_number_in_menu()));
while ($row = $result->fetch()) {
$this->downloadfiles[$row['id']] = $row;
}
$result->dispose();
}
示例10: synchronize
/**
* {@inheritdoc}
*/
public function synchronize()
{
$this->partners_weblinks = array();
$now = new Date();
$config = WebConfig::load();
$result = PersistenceContext::get_querier()->select('
SELECT web.id, web.name, web.partner_picture
FROM ' . WebSetup::$web_table . ' web
LEFT JOIN ' . DB_TABLE_COMMENTS_TOPIC . ' com ON com.id_in_module = web.id AND com.module_id = \'web\'
LEFT JOIN ' . DB_TABLE_AVERAGE_NOTES . ' notes ON notes.id_in_module = web.id AND notes.module_name = \'web\'
WHERE web.approbation_type = 1 OR (web.approbation_type = 2 AND (web.start_date > :timestamp_now OR (end_date != 0 AND end_date < :timestamp_now))) AND partner = 1
ORDER BY web.privileged_partner DESC, ' . $config->get_sort_type() . ' ' . $config->get_sort_mode() . '
LIMIT :partners_number_in_menu OFFSET 0', array('timestamp_now' => $now->get_timestamp(), 'partners_number_in_menu' => (int) $config->get_partners_number_in_menu()));
while ($row = $result->fetch()) {
$this->partners_weblinks[$row['id']] = $row;
}
$result->dispose();
}
示例11: get_feed_data_struct
public function get_feed_data_struct($idcat = 0, $name = '')
{
if (ArticlesService::get_categories_manager()->get_categories_cache()->category_exists($idcat)) {
$querier = PersistenceContext::get_querier();
$category = ArticlesService::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('articles.feed_name', 'common', 'articles');
$data = new FeedData();
$data->set_title($feed_module_name . ' - ' . $site_name);
$data->set_date(new Date());
$data->set_link(SyndicationUrlBuilder::rss('articles', $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 = ArticlesService::get_categories_manager()->get_childrens($idcat, new SearchCategoryChildrensOptions(), true);
$ids_categories = array_keys($categories);
$now = new Date();
$results = $querier->select('SELECT articles.id, articles.id_category, articles.title, articles.rewrited_title, articles.picture_url,
articles.contents, articles.description, articles.date_created, cat.rewrited_name AS rewrited_name_cat
FROM ' . ArticlesSetup::$articles_table . ' articles
LEFT JOIN ' . ArticlesSetup::$articles_cats_table . ' cat ON cat.id = articles.id_category
WHERE articles.id_category IN :cats_ids
AND (published = 1 OR (published = 2 AND publishing_start_date < :timestamp_now AND (publishing_end_date > :timestamp_now OR publishing_end_date = 0)))
ORDER BY articles.date_created DESC', array('cats_ids' => $ids_categories, 'timestamp_now' => $now->get_timestamp()));
foreach ($results as $row) {
$row['rewrited_name_cat'] = !empty($row['id_category']) ? $row['rewrited_name_cat'] : 'root';
$link = ArticlesUrlBuilder::display_article($row['id_category'], $row['rewrited_name_cat'], $row['id'], $row['rewrited_title']);
$item = new FeedItem();
$item->set_title($row['title']);
$item->set_link($link);
$item->set_guid($link);
$item->set_desc(FormatingHelper::second_parse($row['contents']));
$item->set_date(new Date($row['date_created'], Timezone::SERVER_TIMEZONE));
$item->set_image_url($row['picture_url']);
$item->set_auth(ArticlesService::get_categories_manager()->get_heritated_authorizations($row['id_category'], Category::READ_AUTHORIZATIONS, Authorizations::AUTH_PARENT_PRIORITY));
$data->add_item($item);
}
$results->dispose();
return $data;
}
}
示例12: execute_add_comment_event
public function execute_add_comment_event()
{
//Load module lang
$lang = LangLoader::get('common', 'bugtracker');
//Load module configuration
$config = BugtrackerConfig::load();
//Get the content of the comment
$comment = stripslashes(FormatingHelper::strparse(AppContext::get_request()->get_poststring('comments_message', '')));
//Retrieve the id of the bug
$bug_id = $this->comments_topic->get_id_in_module();
$now = new Date();
//New line in the bug history
BugtrackerService::add_history(array('bug_id' => $bug_id, 'updater_id' => AppContext::get_current_user()->get_id(), 'update_date' => $now->get_timestamp(), 'change_comment' => $lang['notice.new_comment']));
//Send a PM to the list of members who updated the bug if the send of PM is enabled
if ($config->are_pm_enabled() && $config->are_pm_comment_enabled()) {
BugtrackerPMService::send_PM_to_updaters('comment', $bug_id, $comment);
}
return true;
}
示例13: elseif
if ($end_timestamp > time() && $end_timestamp > $start_timestamp && $start_timestamp != 0) {
$visible = 2;
} elseif ($start_timestamp != 0) {
//Date inférieur à celle courante => inutile.
$end_timestamp = 0;
}
} elseif ($get_visible == 1) {
$start_timestamp = 0;
$end_timestamp = 0;
} else {
$visible = 0;
$start_timestamp = 0;
$end_timestamp = 0;
}
$date = new Date($current_date);
$timestamp = $date->get_timestamp();
if ($timestamp > 0) {
//Ajout des heures et minutes
$timestamp += $hour * 3600 + $min * 60;
} else {
$timestamp = time();
}
$answers = '';
$votes = '';
for ($i = 0; $i < 20; $i++) {
if ($request->has_postparameter('a' . $i)) {
if (!empty(retrieve(POST, 'a' . $i, ''))) {
$answers .= str_replace('|', '', retrieve(POST, 'a' . $i, '')) . '|';
$votes .= str_replace('|', '', retrieve(POST, 'v' . $i, 0)) . '|';
}
}
示例14: array
//Image svg
case 'svg':
$bbcode = '[img]/upload/' . $row['path'] . '[/img]';
$link = 'javascript:popup_upload(\'' . Url::to_rel('/upload/' . $row['path']) . '\', 0, 0, \'no\')';
break;
//Sons
//Sons
case 'mp3':
$bbcode = '[sound]/upload/' . $row['path'] . '[/sound]';
$link = 'javascript:popup_upload(\'' . Url::to_rel('/upload/' . $row['path']) . '\', 220, 10, \'no\')';
break;
default:
$bbcode = '[url=/upload/' . $row['path'] . ']' . $row['name'] . '[/url]';
$link = PATH_TO_ROOT . '/upload/' . $row['path'];
}
$template->assign_block_vars('files', array('C_RECENT_FILE' => $row['timestamp'] > $now->get_timestamp() - 15 * 60, 'ID' => $row['id'], 'IMG' => $get_img_mimetype['img'], 'URL' => $link, 'NAME' => $name_cut, 'RENAME_FILE' => '<span id="fihref' . $row['id'] . '"><a href="javascript:display_rename_file(\'' . $row['id'] . '\', \'' . addslashes($row['name']) . '\', \'' . addslashes($name_cut) . '\');" title="' . LangLoader::get_message('edit', 'common') . '" class="fa fa-edit"></a></span>', 'FILETYPE' => $get_img_mimetype['filetype'] . $size_img, 'BBCODE' => '<input readonly="readonly" type="text" onclick="select_div(\'text_' . $row['id'] . '\');" id="text_' . $row['id'] . '" style="margin-top:2px;cursor:pointer;" value="' . $bbcode . '">', 'SIZE' => $row['size'] > 1024 ? NumberHelper::round($row['size'] / 1024, 2) . ' ' . LangLoader::get_message('unit.megabytes', 'common') : NumberHelper::round($row['size'], 0) . ' ' . LangLoader::get_message('unit.kilobytes', 'common'), 'LIGHTBOX' => !empty($size_img) ? ' data-lightbox="1" data-rel="lightcase:collection"' : '', 'U_MOVE' => '.php?movefi=' . $row['id'] . '&f=' . $folder . '&fm=' . $row['user_id']));
$total_folder_size += $row['size'];
$total_files++;
}
$result->dispose();
}
$total_size = 0;
try {
$total_size = PersistenceContext::get_querier()->get_column_value(DB_TABLE_UPLOAD, 'SUM(size)', '');
} catch (RowNotFoundException $e) {
}
$template->put_all(array('TOTAL_SIZE' => $total_size > 1024 ? NumberHelper::round($total_size / 1024, 2) . ' ' . LangLoader::get_message('unit.megabytes', 'common') : NumberHelper::round($total_size, 0) . ' ' . LangLoader::get_message('unit.kilobytes', 'common'), 'TOTAL_FOLDER_SIZE' => $total_folder_size > 1024 ? NumberHelper::round($total_folder_size / 1024, 2) . ' ' . LangLoader::get_message('unit.megabytes', 'common') : NumberHelper::round($total_folder_size, 0) . ' ' . LangLoader::get_message('unit.kilobytes', 'common'), 'TOTAL_FOLDERS' => $total_directories, 'TOTAL_FILES' => $total_files));
if ($total_directories == 0 && $total_files == 0 && (!empty($folder) || !empty($show_member))) {
$template->put_all(array('C_EMPTY_FOLDER' => true, 'L_EMPTY_FOLDER' => LangLoader::get_message('no_item_now', 'common')));
}
$template->display();
示例15: save
private function save()
{
$now = new Date();
$pm_recipients_list = array();
$send_pm = true;
$versions = array_reverse($this->config->get_versions_fix(), true);
$status = $this->form->get_value('status')->get_raw_value();
if (count($versions)) {
if (!$this->form->field_is_disabled('fixed_in')) {
$fixed_in = $this->form->get_value('fixed_in')->get_raw_value() ? $this->form->get_value('fixed_in')->get_raw_value() : 0;
if ($fixed_in != $this->bug->get_fixed_in()) {
//Bug history update
BugtrackerService::add_history(array('bug_id' => $this->bug->get_id(), 'updater_id' => $this->current_user->get_id(), 'update_date' => $now->get_timestamp(), 'updated_field' => 'fixed_in', 'old_value' => $this->bug->get_fixed_in(), 'new_value' => $fixed_in));
$this->bug->set_fixed_in($fixed_in);
}
} else {
if (in_array($status, array(Bug::NEW_BUG, Bug::REJECTED))) {
$this->bug->set_fixed_in(0);
}
}
}
if (!$this->form->field_is_disabled('assigned_to')) {
$assigned_to = $this->form->get_value('assigned_to');
$assigned_to_id = UserService::user_exists("WHERE display_name = :display_name", array('display_name' => $assigned_to));
if ($this->bug->get_assigned_to_id()) {
$old_user_assigned_id = UserService::user_exists("WHERE user_id = :user_id", array('user_id' => $this->bug->get_assigned_to_id()));
$old_user_assigned = !empty($old_user_assigned_id) ? UserService::get_user($old_user_assigned_id) : 0;
} else {
$old_user_assigned = 0;
}
$new_user_assigned = !empty($assigned_to) && !empty($assigned_to_id) ? UserService::get_user($assigned_to_id) : 0;
$new_assigned_to_id = !empty($new_user_assigned) ? $new_user_assigned->get_id() : 0;
if ($new_assigned_to_id != $this->bug->get_assigned_to_id()) {
//Bug history update
BugtrackerService::add_history(array('bug_id' => $this->bug->get_id(), 'updater_id' => $this->current_user->get_id(), 'update_date' => $now->get_timestamp(), 'updated_field' => 'assigned_to_id', 'old_value' => $old_user_assigned ? $old_user_assigned->get_display_name() : $this->lang['notice.no_one'], 'new_value' => $new_user_assigned ? $new_user_assigned->get_display_name() : $this->lang['notice.no_one']));
//Bug update
$this->bug->set_assigned_to_id($new_assigned_to_id);
//The PM will only be sent to the assigned user
if ($new_assigned_to_id != $this->current_user->get_id()) {
$pm_recipients_list[] = $new_assigned_to_id;
} else {
$send_pm = false;
}
}
}
if ($status != $this->bug->get_status()) {
//Bug history update
BugtrackerService::add_history(array('bug_id' => $this->bug->get_id(), 'updater_id' => $this->current_user->get_id(), 'update_date' => $now->get_timestamp(), 'updated_field' => 'status', 'old_value' => $this->bug->get_status(), 'new_value' => $status));
//Bug update
$this->bug->set_status($status);
if ($this->bug->is_fixed() || $this->bug->is_rejected()) {
$this->bug->set_fix_date($now);
} else {
$this->bug->set_fix_date(0);
}
}
BugtrackerService::update($this->bug);
Feed::clear_cache('bugtracker');
switch ($status) {
case Bug::IN_PROGRESS:
$is_pm_enabled = $this->config->are_pm_in_progress_enabled();
break;
case Bug::PENDING:
$is_pm_enabled = $this->config->are_pm_pending_enabled();
break;
case Bug::ASSIGNED:
$is_pm_enabled = $this->config->are_pm_assign_enabled();
break;
case Bug::FIXED:
$is_pm_enabled = $this->config->are_pm_fix_enabled();
break;
case Bug::REOPEN:
$is_pm_enabled = $this->config->are_pm_reopen_enabled();
break;
case Bug::REJECTED:
$is_pm_enabled = $this->config->are_pm_reject_enabled();
break;
default:
$is_pm_enabled = false;
break;
}
//Add comment if needed
$comment = $this->form->get_value('comments_message', '');
if (!empty($comment)) {
$comments_topic = new BugtrackerCommentsTopic();
$comments_topic->set_id_in_module($this->bug->get_id());
$comments_topic->set_url(BugtrackerUrlBuilder::detail($this->bug->get_id() . '-' . $this->bug->get_rewrited_title()));
CommentsManager::add_comment($comments_topic->get_module_id(), $comments_topic->get_id_in_module(), $comments_topic->get_topic_identifier(), $comments_topic->get_path(), $comment);
//New line in the bug history
BugtrackerService::add_history(array('bug_id' => $this->bug->get_id(), 'updater_id' => $this->current_user->get_id(), 'update_date' => $now->get_timestamp(), 'change_comment' => $this->lang['notice.new_comment']));
}
//Send PM with comment to updaters if the option is enabled
if (!$this->bug->is_new() && $this->config->are_pm_enabled() && $is_pm_enabled && $send_pm) {
BugtrackerPMService::send_PM_to_updaters($status, $this->bug->get_id(), $comment, $pm_recipients_list);
}
if (in_array($status, array(Bug::NEW_BUG, Bug::REOPEN, Bug::REJECTED, Bug::FIXED)) && $this->config->are_admin_alerts_enabled() && in_array($this->bug->get_severity(), $this->config->get_admin_alerts_levels())) {
$alerts = AdministratorAlertService::find_by_criteria($this->bug->get_id(), 'bugtracker');
if (!empty($alerts)) {
$alert = $alerts[0];
if ($this->bug->is_new() || $this->bug->is_reopen()) {
//.........这里部分代码省略.........