当前位置: 首页>>代码示例>>PHP>>正文


PHP txt_time_diff函数代码示例

本文整理汇总了PHP中txt_time_diff函数的典型用法代码示例。如果您正苦于以下问题:PHP txt_time_diff函数的具体用法?PHP txt_time_diff怎么用?PHP txt_time_diff使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了txt_time_diff函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: print_summary

	function print_summary($link) {
		global $current_user;
		static $comment_counter = 0;

		if(!$this->read) return;
		$comment_counter++;
		echo '<li id="c-'.$this->id.'"><div class="comment-body" id="comment-'.$comment_counter.'"><a href="'.$_SERVER['PHP_SELF'].'?id='.$link->id.'#comment-'.$comment_counter.'"><strong>#'.$comment_counter.'</strong></a>&nbsp;&nbsp;&nbsp;'.$this->put_smileys(save_text_to_html($this->content)).'</div>';
		echo '<div class="comment-info">';
		echo _('escrito por'). ' <a href="./user.php?login='.$this->username.'">'.$this->username.'</a> '._('hace').' '.txt_time_diff($this->date);
		echo '<img src="'.get_gravatar_url($this->email, 20).'" width="20" height="20" alt="'.$this->username.'" title="gravatar.com" /></div></li>'."\n";

	}
开发者ID:BackupTheBerlios,项目名称:meneamenet-svn,代码行数:12,代码来源:comment.php

示例2: print_summary

	function print_summary($link, $length = 0) {
		global $current_user, $globals;
		static $comment_counter = 0;

		if(!$this->read) return;
		$comment_counter++;
		echo '<li id="ccontainer-'.$this->id.'">';
		echo '<div class="comment-body" id="comment-'.$comment_counter.'"><a href="'.$link->get_relative_permalink().'#comment-'.$comment_counter.'"><strong>#'.$comment_counter.'</strong></a>';
		echo '&nbsp;&nbsp;&nbsp;<span id="c-'.$this->id.'">'. "\n";
		//if($globals['external_ads']) echo "<!-- google_ad_section_start -->\n";
		$this->print_text($length);
		//if($globals['external_ads']) echo "<!-- google_ad_section_end -->\n";
		echo '</span></div>';
		echo '<div class="comment-info">';
		echo _('escrito por'). ' <a href="'.$globals['base_url'].'user.php?login='.urlencode($this->username).'">'.$this->username.'</a> '._('hace').' '.txt_time_diff($this->date);
		echo '<img src="'.get_avatar_url($this->author, $this->avatar, $this->email, 20).'" width="20" height="20" alt="'.$this->username.'" title="avatar" /></div>';
		echo "</li>\n";
	}
开发者ID:BackupTheBerlios,项目名称:meneamenet-svn,代码行数:18,代码来源:comment.php

示例3: print_summary

 function print_summary($link, $length = 0, $single_link = true)
 {
     global $current_user, $globals;
     if (!$this->read) {
         return;
     }
     echo '<li id="ccontainer-' . $this->id . '">';
     $this->hidden = $this->karma < -80 || $this->user_level == 'disabled' && $this->type != 'admin';
     if ($this->hidden) {
         $comment_meta_class = 'comment-meta-hidden';
         $comment_class = 'comment-body-hidden';
     } else {
         $comment_meta_class = 'comment-meta';
         $comment_class = 'comment-body';
         if ($this->karma > 80) {
             $comment_class .= ' high';
         }
     }
     $this->link_permalink = $link->get_relative_permalink();
     echo '<div class="' . $comment_class . '">';
     echo '<a href="' . $this->link_permalink . get_comment_page_suffix($globals['comments_page_size'], $this->order, $globals['link']->comments) . '#comment-' . $this->order . '"><strong>#' . $this->order . '</strong></a>';
     if ($single_link) {
         echo '<span id="comment-' . $this->order . '">';
     }
     echo '&nbsp;&nbsp;&nbsp;<span  id="cid-' . $this->id . '">';
     if ($this->hidden && ($current_user->user_comment_pref & 1) == 0) {
         echo '&#187;&nbsp;<a href="javascript:get_votes(\'get_comment.php\',\'comment\',\'cid-' . $this->id . '\',0,' . $this->id . ')" title="' . _('ver comentario') . '">' . _('ver comentario') . '</a>';
     } else {
         $this->print_text($length, $single_link);
     }
     if ($single_link) {
         echo '</span>';
     }
     echo '</span></div>';
     // The comments info bar
     echo '<div class="' . $comment_meta_class . '">';
     // Check that the user can vote
     if ($this->type != 'admin' && $this->user_level != 'disabled') {
         // Print the votes info (left)
         echo '<div class="comment-votes-info">';
         if ($current_user->user_id > 0 && $this->author != $current_user->user_id && $single_link) {
             $this->print_shake_icons();
         }
         echo _('votos') . ': <span id="vc-' . $this->id . '">' . $this->votes . '</span>, karma: <span id="vk-' . $this->id . '">' . $this->karma . '</span>';
         // Add the icon to show votes
         if ($this->votes > 0 && $this->date > $globals['now'] - 30 * 86400) {
             // Show votes if newer than 30 days
             echo '&nbsp;&nbsp;<a href="javascript:modal_from_ajax(\'' . $globals['base_url'] . 'backend/get_c_v.php?id=' . $this->id . '\')">';
             echo '<img src="' . $globals['base_url'] . 'img/common/vote-info01.png" width="12" height="12" alt="+ info" title="' . _('¿quién ha votado?') . '"/>';
             echo '</a>';
         }
         echo '</div>';
     }
     // Print comment info (right)
     echo '<div class="comment-info">';
     echo _('por') . ' ';
     if ($this->type == 'admin') {
         echo '<strong>' . get_server_name() . '</strong> ';
         if ($current_user->user_level == 'god' || $current_user->user_level == 'admin') {
             echo ' (' . $this->username . ') ';
         }
     } elseif ($single_link) {
         echo '<a href="' . get_user_uri($this->username) . '" title="karma:&nbsp;' . $this->user_karma . '" id="cauthor-' . $this->order . '">' . $this->username . '</a> ';
     } else {
         echo '<a href="' . get_user_uri($this->username) . '" title="karma:&nbsp;' . $this->user_karma . '">' . $this->username . '</a> ';
     }
     // Print dates
     if ($globals['now'] - $this->date > 604800) {
         // 7 days
         echo _('el') . get_date_time($this->date);
     } else {
         echo _('hace') . ' ' . txt_time_diff($this->date);
     }
     if (!$this->hidden && $this->type != 'admin') {
         echo '<img src="' . get_avatar_url($this->author, $this->avatar, 20) . '" width="20" height="20" alt="' . $this->username . '" title="' . $this->username . ',&nbsp;karma:&nbsp;' . $this->user_karma . '" />';
     }
     echo '</div></div>';
     echo "</li>\n";
 }
开发者ID:brainsqueezer,项目名称:fffff,代码行数:79,代码来源:comment.php

示例4: time

 //
 if (!empty($_REQUEST['time'])) {
     /////
     // Prepare for times
     /////
     if (!($time = check_integer('time'))) {
         die;
     }
     $sql = "SELECT link_id, link_votes as votes FROM links, sub_statuses WHERE id = {$site_id} AND link_id = link AND ";
     if ($time < 0 || $time > 86400 * 5) {
         $time = 86400 * 2;
     }
     $from = time() - $time;
     $sql .= "date > FROM_UNIXTIME({$from}) AND ";
     $sql .= "status = 'published' ORDER BY link_votes DESC LIMIT {$rows}";
     $title = $site_info->name . ': ' . sprintf(_('más votadas en %s'), txt_time_diff($from));
 } elseif (!empty($_REQUEST['favorites'])) {
     /////
     // users' favorites
     /////
     $user_id = guess_user_id($_REQUEST['favorites']);
     $sql = "SELECT link_id FROM links, favorites WHERE favorite_user_id={$user_id} AND favorite_type='link' AND favorite_link_id=link_id ORDER BY favorite_date DESC limit {$rows}";
     $user_login = $db->get_var("select user_login from users where user_id={$user_id}");
     $title = $site_info->name . ': ' . sprintf(_('favoritas de %s'), $user_login);
 } elseif (!empty($_REQUEST['voted_by'])) {
     // voted links
     $user_id = guess_user_id($_REQUEST['voted_by']);
     if (!$user_id > 0) {
         die;
     }
     $sql = "SELECT vote_link_id FROM votes WHERE vote_type='links' and vote_user_id = {$user_id} and vote_value > 0 ORDER BY vote_date DESC limit {$rows}";
开发者ID:GallardoAlba,项目名称:Meneame,代码行数:31,代码来源:list.php

示例5: fill_smarty

 function fill_smarty($smarty)
 {
     global $current_user, $the_template, $comment_counter, $link, $ranklist, $db;
     if (!$ranklist) {
         $users = $db->get_results("SELECT user_karma, COUNT(*) FROM " . table_users . " WHERE user_level NOT IN ('Spammer') AND user_karma>0 GROUP BY user_karma ORDER BY user_karma DESC", ARRAY_N);
         $ranklist = array();
         $rank = 1;
         if ($users) {
             foreach ($users as $dbuser) {
                 $ranklist[$dbuser[0]] = $rank;
                 $rank += $dbuser[1];
             }
         }
     }
     $smarty->assign('comment_counter', $comment_counter);
     $text = save_text_to_html($this->content);
     $vars = array('comment_text' => $text, 'comment_id' => $this->id, 'smarty' => $smarty);
     check_actions('show_comment_content', $vars);
     $smarty->assign('comment_content', $vars['comment_text']);
     $vars = array('comment_form_label' => '');
     check_actions('comment_form_label', $vars);
     $smarty->assign('comment_form_label', $vars['comment_form_label']);
     $smarty->assign('current_userid', $current_user->user_id);
     $smarty->assign('user_logged_in', $current_user->user_login);
     $vars = array('comment_username' => $this->username(), 'is_anonymous' => 0, 'comment_id' => $this->id);
     check_actions('show_comment_username', $vars);
     $smarty->assign('user_username', $vars['comment_username']);
     $smarty->assign('user_rank', $ranklist[$this->userkarma]);
     $smarty->assign('is_anonymous', $vars['is_anonymous']);
     $smarty->assign('user_extra_fields', $this->extra_field);
     //$smarty->assign('link_submitter', $link->username());
     $smarty->assign('comment_id', $this->id);
     $smarty->assign('comment_status', $this->status);
     $smarty->assign('comment_author', $this->author);
     $smarty->assign('comment_link', $this->link);
     $smarty->assign('user_view_url', getmyurl('user', $this->username));
     $smarty->assign('comment_date_timestamp', $this->date);
     $smarty->assign('comment_date', date('F, d Y g:i A', $this->date));
     $smarty->assign('comment_age', txt_time_diff($this->date));
     $smarty->assign('comment_randkey', $this->randkey);
     $smarty->assign('comment_votes', $this->votes);
     $smarty->assign('comment_parent', $this->parent);
     $smarty->assign('hide_comment_edit', $this->hideedit);
     $this->user_vote_count = $this->votes($current_user->user_id);
     $smarty->assign('comment_user_vote_count', $this->user_vote_count);
     $smarty->assign('comment_shakebox_currentuser_votes', $this->votes($current_user->user_id, '>0'));
     $smarty->assign('comment_shakebox_currentuser_reports', $this->votes($current_user->user_id, '<0'));
     // if the person logged in is the person viewing the comment, show 'you' instead of the name
     $smarty->assign('user_userlogin', $this->username);
     // the url for the edit comment link
     $smarty->assign('edit_comment_url', getmyurl('editcomment', $this->id, $link->id));
     $smarty->assign('delete_comment_url', my_pligg_base . '/delete.php?comment_id=' . $this->id);
     // avatars
     $smarty->assign('UseAvatars', do_we_use_avatars());
     $smarty->assign('Avatar', $avatars = get_avatar('all', '', $this->username, ''));
     $smarty->assign('Avatar_ImgSrc', $avatars['large']);
     $smarty->assign('Avatar_ImgSrc_Small', $avatars['small']);
     // does the person logged in have admin or moderator status?
     $canIhaveAccess = 0;
     $canIhaveAccess = $canIhaveAccess + checklevel('admin');
     $canIhaveAccess = $canIhaveAccess + checklevel('moderator');
     if ($canIhaveAccess == 1) {
         $smarty->assign('isadmin', 1);
     }
     // the link to upvote the comment
     $jslinky = "cvote({$current_user->user_id},{$this->id},{$this->id}," . "'" . md5($current_user->user_id . $this->randkey) . "',10,'" . my_base_url . my_pligg_base . "/')";
     $smarty->assign('link_shakebox_javascript_votey', $jslinky);
     $jslinky = "cunvote({$current_user->user_id},{$this->id},{$this->id}," . "'" . md5($current_user->user_id . $this->randkey) . "',10,'" . my_base_url . my_pligg_base . "/')";
     $smarty->assign('link_shakebox_javascript_unvotey', $jslinky);
     // the link to downvote the comment
     $jslinkn = "cvote({$current_user->user_id},{$this->id},{$this->id}," . "'" . md5($current_user->user_id . $this->randkey) . "',-10,'" . my_base_url . my_pligg_base . "/')";
     $smarty->assign('link_shakebox_javascript_voten', $jslinkn);
     $jslinkn = "cunvote({$current_user->user_id},{$this->id},{$this->id}," . "'" . md5($current_user->user_id . $this->randkey) . "',-10,'" . my_base_url . my_pligg_base . "/')";
     $smarty->assign('link_shakebox_javascript_unvoten', $jslinkn);
     // misc
     $smarty->assign('Enable_Comment_Voting', Enable_Comment_Voting);
     $smarty->assign('my_base_url', my_base_url);
     $smarty->assign('my_pligg_base', my_pligg_base);
     $smarty->assign('Default_Gravatar_Small', Default_Gravatar_Small);
     return $smarty;
 }
开发者ID:bendroid,项目名称:pligg-cms,代码行数:81,代码来源:comment.php

示例6: print_form

	static function print_form($link, $rows=12) {
		global $current_user, $globals;

		if (!$link->votes > 0) return;
    if ($link->association && !in_array($current_user->user_id, $globals['association_users'])) {
      // so a xente da asociacion pode comentar aqui
			echo '<div class="commentform warn">'."\n";
			echo _('Tes que ser da asociación para poder comentar nesta noticia')."\n";
			echo '</div>'."\n";
    } elseif($link->date < $globals['now']-$globals['time_enabled_comments'] || $link->comments >= $globals['max_comments']) {
			// Comments already closed
			echo '<div class="commentform warn">'."\n";
			echo _('comentarios cerrados')."\n";
			echo '</div>'."\n";
		} elseif ($current_user->authenticated 
					&& (($current_user->user_karma > $globals['min_karma_for_comments'] 
							&& $current_user->user_date < $globals['now'] - $globals['min_time_for_comments']) 
						|| $current_user->user_id == $link->author)) {
			// User can comment
			echo '<div class="commentform">'."\n";
			echo '<form action="" method="post">'."\n";
			echo '<fieldset>'."\n";
			echo '<legend>'._('envía un comentario'). ' <em style="font-size:80%">'._('porque alguien en Internet está equivocado').'</em></legend>'."\n";
			print_simpleformat_buttons('comment');
			echo '<label for="comment">'. _('texto del comentario / no se admiten etiquetas HTML').'<br /><span class="note">'._('comentarios xenófobos, racistas o difamatorios causarán la anulación de la cuenta').'</span></label>'."\n";
			echo '<div><textarea name="comment_content" id="comment" cols="75" rows="'.$rows.'"></textarea></div>'."\n";
			echo '<input class="button" type="submit" name="submit" value="'._('enviar el comentario').'" />'."\n";
			// Allow gods to put "admin" comments which does not allow votes
			if ($current_user->user_level == 'god') {
				echo '&nbsp;&nbsp;&nbsp;&nbsp;<label><strong>'._('admin').' </strong><input name="type" type="checkbox" value="admin"/></label>'."\n";
			}
			echo '<input type="hidden" name="process" value="newcomment" />'."\n";
			echo '<input type="hidden" name="randkey" value="'.rand(1000000,100000000).'" />'."\n";
			echo '<input type="hidden" name="link_id" value="'.$link->id.'" />'."\n";
			echo '<input type="hidden" name="user_id" value="'.$current_user->user_id.'" />'."\n";
			echo '<input type="hidden" name="parent_id" value="0" />'."\n"; // for comment replies
			echo '</fieldset>'."\n";
			echo '</form>'."\n";
			echo "</div>\n";
      echo '<div style="visibility:hidden;text-align:center;" id="comentarNoticia" ><a href="#" >'._("Comentar Noticia").'</a></div>'."\n";
		} else {
			// Not enough karma or anonymous user
			if($tab_option == 1) do_comment_pages($link->comments, $current_page);
			if ($current_user->authenticated) {
				if ($current_user->user_date >= $globals['now'] - $globals['min_time_for_comments']) {
					$remaining = txt_time_diff($globals['now'], $current_user->user_date+$globals['min_time_for_comments']);
					$msg = _('debes esperar') . " $remaining " . _('para escribir el primer comentario');
				}
				if ($current_user->user_karma <= $globals['min_karma_for_comments']) {
					$msg = _('no tienes el mínimo karma requerido')." (" . $globals['min_karma_for_comments'] . ") ". _('para comentar'). ": ".$current_user->user_karma;
				}
				echo '<div class="commentform warn">'."\n";
				echo $msg . "\n";
				echo '</div>'."\n";
			} elseif (!$globals['bot']){
				echo '<div class="commentform warn">'."\n";
				echo '<a href="'.get_auth_link().'login.php?return='.$_SERVER['REQUEST_URI'].'">'._('Autentifícate si deseas escribir').'</a> '._('comentarios').'. '._('O crea tu cuenta'). ' <a href="'.$globals['base_url'].'register.php">aquí.</a>'."\n";
				echo '</div>'."\n";

				echo '<div style="margin-top: 20px" align="center">';
				print_oauth_icons();
				echo '</div>'."\n";
			}
		}
	}
开发者ID:rasomu,项目名称:chuza,代码行数:65,代码来源:comment.php

示例7: define

// pagename
define('pagename', 'rss');
$main_smarty->assign('pagename', pagename);
$rows = isset($_GET['rows']) && is_numeric($_GET['rows']) ? $_GET['rows'] : 20;
$status = sanitize($_GET['status'], 3) != '' ? sanitize($_GET['status'], 3) : 'published';
$time = isset($_GET['time']) && is_numeric($_GET['time']) ? $_GET['time'] : 0;
if ($time > 0) {
    // Prepare for times
    $sql = "SELECT link_id, count(*) as votes FROM " . table_votes . ", " . table_links . " WHERE  ";
    if ($time > 0) {
        $from = time() - $time;
        $sql .= "vote_date > FROM_UNIXTIME({$from}) AND ";
    }
    $sql .= "vote_link_id=link_id  AND (link_status='published' OR link_status='new') GROUP BY vote_link_id  ORDER BY votes DESC LIMIT {$rows}";
    $last_modified = time();
    $title = $main_smarty->get_config_vars('PLIGG_Visual_RSS_Recent') . ' ' . txt_time_diff($from);
    $link_date = "";
} else {
    // All the others
    $tmpsearch = new Search();
    $tmpsearch->searchTerm = isset($_GET['search']) && sanitize($_GET['search'], 3) != '' ? sanitize($_GET['search'], 3) : '';
    $search = $tmpsearch->get_search_clause();
    if ($search) {
        $status = 'all';
    }
    switch ($status) {
        case 'published':
            $order_field = 'link_date';
            $link_date = 'date';
            $title = " | " . $main_smarty->get_config_vars("PLIGG_Visual_Published_News");
            break;
开发者ID:hyrmedia,项目名称:pligg-cms,代码行数:31,代码来源:rss.php

示例8: time

if (!empty($_REQUEST['time'])) {
    /////
    // Prepare for times
    /////
    if (!($time = check_integer('time'))) {
        die;
    }
    $sql = "SELECT link_id, link_votes as votes FROM links WHERE ";
    if ($time < 0 || $time > 86400 * 5) {
        $time = 86400 * 2;
    }
    $from = time() - $time;
    $sql .= "link_date > FROM_UNIXTIME({$from}) AND ";
    $sql .= "link_status = 'published' ORDER BY link_votes DESC LIMIT {$rows}";
    $last_modified = time();
    $title = _('Menéame') . ': ' . sprintf(_('más votadas en %s'), txt_time_diff($from));
} elseif (!empty($_REQUEST['favorites'])) {
    /////
    // RSS for users' favorites
    /////
    $user_id = guess_user_id($_REQUEST['favorites']);
    $sql = "SELECT link_id FROM links, favorites WHERE favorite_user_id={$user_id} AND favorite_type='link' AND favorite_link_id=link_id ORDER BY favorite_date DESC limit {$rows}";
    $last_modified = $db->get_var("SELECT UNIX_TIMESTAMP(max(favorite_date)) from favorites where favorite_user_id={$user_id} AND favorite_type='link'");
    $user_login = $db->get_var("select user_login from users where user_id={$user_id}");
    $title = _('Menéame') . ': ' . sprintf(_('favoritas de %s'), $user_login);
    $globals['redirect_feedburner'] = false;
} elseif (!empty($_REQUEST['voted_by'])) {
    // RSS for voted links
    $user_id = guess_user_id($_REQUEST['voted_by']);
    if (!$user_id > 0) {
        die;
开发者ID:brainsqueezer,项目名称:fffff,代码行数:31,代码来源:rss2.php

示例9: define

$from_where = " FROM " . table_links . " \n\t\tLEFT JOIN " . table_users . " ON link_author=user_id \n\t\t{$from}\n\t\tWHERE link_status = 'published' {$where}";
$order_by = " ORDER BY link_published_date DESC, link_date DESC";
// pagename
define('pagename', 'live_published');
$main_smarty->assign('pagename', pagename);
// get the data to be displayed
$rows = $db->get_var("SELECT count(*) as count {$from_where} {$order_by}");
$stories = $db->get_results("{$select} {$from_where} {$order_by} LIMIT {$offset},{$top_users_size}");
$link = new Link();
//$user = new User;
if ($stories) {
    foreach ($stories as $story) {
        $link->id = $story->link_id;
        $cached_links[$story->link_id] = $story;
        $link->read();
        $live_item['link_date'] = txt_time_diff($link->published_date);
        $live_item['link_title'] = $link->title;
        if (Voting_Method == 2) {
            $live_item['link_votes'] = $link->rating($link->id) / 2;
        } else {
            $live_item['link_votes'] = $link->votes;
        }
        $live_item['link_username'] = $story->user_login;
        $live_item['link_category'] = GetCatName($link->category);
        $live_item['link_category_url'] = getmyurl("maincategory", $link->category_safe_name());
        $live_item['link_url'] = $link->get_internal_url();
        $live_items[] = $live_item;
    }
    $main_smarty->assign('live_items', $live_items);
}
// pagination
开发者ID:hyrmedia,项目名称:pligg-cms,代码行数:31,代码来源:live_published.php

示例10: fill_smarty

 function fill_smarty($smarty)
 {
     global $current_user, $the_template, $comment_counter, $link;
     $smarty->assign('comment_counter', $comment_counter);
     $smarty->assign('comment_content', save_text_to_html($this->content));
     $smarty->assign('current_userid', $current_user->user_id);
     $smarty->assign('user_logged_in', $current_user->user_login);
     $smarty->assign('user_username', $this->username());
     $smarty->assign('comment_id', $this->id);
     $smarty->assign('comment_author', $this->author);
     $smarty->assign('comment_link', $this->link);
     $smarty->assign('user_view_url', getmyurl('user', $this->username()));
     $smarty->assign('comment_age', txt_time_diff($this->date));
     $smarty->assign('comment_randkey', $this->randkey);
     $smarty->assign('comment_votes', $this->votes);
     $smarty->assign('comment_parent', $this->parent);
     $smarty->assign('hide_comment_edit', $this->hideedit);
     $this->user_vote_count = $this->votes($current_user->user_id);
     $smarty->assign('comment_user_vote_count', $this->user_vote_count);
     // if the person logged in is the person viewing the comment, show 'you' instead of the name
     if ($current_user->user_login == $this->username()) {
         $smarty->assign('user_username', 'you');
     }
     // the url for the edit comment link
     $smarty->assign('edit_comment_url', getmyurl('editcomment', $this->id, $link->id));
     // avatars
     $smarty->assign('UseAvatars', do_we_use_avatars());
     $smarty->assign('Avatar_ImgSrc', get_avatar('small', "", $this->username(), ""));
     //spellchecker
     $smarty->assign('Spell_Checker', Spell_Checker);
     // does the person logged in have admin or god access?
     $canIhaveAccess = 0;
     $canIhaveAccess = $canIhaveAccess + checklevel('god');
     $canIhaveAccess = $canIhaveAccess + checklevel('admin');
     if ($canIhaveAccess == 1) {
         $smarty->assign('isadmin', 1);
     }
     // the link to upvote the comment
     $jslinky = "cvote({$current_user->user_id}, {$this->id}, {$this->id}, " . "'" . md5($current_user->user_id . $this->randkey) . "', 10, '" . my_base_url . my_pligg_base . "/')";
     $smarty->assign('link_shakebox_javascript_votey', $jslinky);
     // the link to downvote the comment
     $jslinkn = "cvote({$current_user->user_id}, {$this->id}, {$this->id}, " . "'" . md5($current_user->user_id . $this->randkey) . "', -10,  '" . my_base_url . my_pligg_base . "/')";
     $smarty->assign('link_shakebox_javascript_voten', $jslinkn);
     // misc
     $smarty->assign('Enable_Comment_Voting', Enable_Comment_Voting);
     $smarty->assign('my_base_url', my_base_url);
     $smarty->assign('my_pligg_base', my_pligg_base);
     $smarty->assign('Default_Gravatar_Small', Default_Gravatar_Small);
     return $smarty;
 }
开发者ID:holsinger,项目名称:openfloor,代码行数:50,代码来源:comment.php

示例11: get_if_modified

} else $rows = 30;
	
$if_modified = get_if_modified();

if(!empty($_REQUEST['time'])) {
	// Prepare for times
	if(!($time = check_integer('time')))
		die;
	$sql = "SELECT link_id, count(*) as votes FROM votes, links WHERE  ";	
	if ($time > 0) {
		$from = time()-$time;
		$sql .= "vote_date > FROM_UNIXTIME($from) AND ";
	}
	$sql .= "vote_link_id=link_id  AND link_status != 'discard' GROUP BY vote_link_id  ORDER BY votes DESC LIMIT $rows";
	$last_modified = time();
	$title = _('Menéame: más votadas en') . ' ' . txt_time_diff($from);
	//$link_date = "modified";
	$link_date = "";
} else {
	// All the others
	$search = get_search_clause('boolean');
	// The link_status to search
	if(!empty($_REQUEST['status'])) {
		$status = $db->escape(preg_replace('/ /', '', trim($_REQUEST['status'])));
	} else {
		// By default it searches on all
		if($search) $status = 'all';
		else $status = 'published';
	}
	/*****  WARNING
		this function is to redirect to feed burner
开发者ID:BackupTheBerlios,项目名称:meneamenet-svn,代码行数:31,代码来源:rss2.php

示例12: print_summary

 function print_summary($type = 'full', $karma_best_comment = 0)
 {
     global $current_user, $current_user, $globals, $db;
     if (!$this->read) {
         return;
     }
     if ($this->is_votable()) {
         $this->voted = $this->vote_exists($current_user->user_id);
         if (!$this->voted) {
             $this->md5 = md5($current_user->user_id . $this->id . $this->randkey . $globals['user_ip']);
         }
     }
     $url = htmlspecialchars($this->url);
     echo '<div class="news-summary">';
     echo '<div class="news-body">';
     if ($type != 'preview' && !empty($this->title) && !empty($this->content)) {
         $this->print_shake_box($votes_enabled);
     }
     $this->print_warn();
     //if($globals['external_ads']) echo "<!-- google_ad_section_start -->\n";
     if ($this->status != 'published') {
         $nofollow = ' rel="nofollow"';
     } else {
         $nofollow = '';
     }
     echo '<h1>';
     echo '<a href="' . $url . '"' . $nofollow . '>' . $this->title . '</a>';
     // Content type (for video and images)
     if ($this->content_type == 'image') {
         echo '&nbsp;<img src="' . $globals['base_url'] . 'img/common/is-photo01.png" class="media-icon" width="18" height="15" alt="' . _('imagen') . '" title="' . _('imagen') . '" />';
     } elseif ($this->content_type == 'video') {
         echo '&nbsp;<img src="' . $globals['base_url'] . 'img/common/is-video01.png" class="media-icon" width="18" height="15" alt="' . _('vídeo') . '" title="' . _('vídeo') . '" />';
     }
     echo '</h1>';
     if (!$globals['bot']) {
         // GEO
         if ($this->latlng) {
             echo '<div class="thumbnail" id="map" style="width:130px;height:130px">&nbsp;</div>' . "\n";
         } elseif ($type == 'full' && $globals['do_websnapr'] && $this->votes_enabled && $globals['link_id'] > 0 && !empty($this->url_title)) {
             // Websnapr
             // In order not to overload websnapr, display the image only if votes are enabled
             echo '<img class="news-websnapr" alt="websnapr.com" src="http://images.websnapr.com/?size=T&amp;url=' . $url . '" width="92" height="70"  onmouseover="return tooltip.ajax_delayed(event, \'get_link_snap.php\', ' . $this->id . ');" onmouseout="tooltip.clear(event);" onclick="tooltip.clear(this);"/>';
         }
         echo '<div class="news-submitted">';
         if ($type != 'short') {
             echo '<a href="' . get_user_uri($this->username) . '"><img src="' . get_avatar_url($this->author, $this->avatar, 25) . '" width="25" height="25" alt="' . $this->username . '" onmouseover="return tooltip.ajax_delayed(event, \'get_user_info.php\', ' . $this->author . ');" onmouseout="tooltip.clear(event);" /></a>';
         }
         echo '<strong>' . htmlentities(preg_replace('/^https*:\\/\\//', '', txt_shorter($this->url))) . '</strong>' . "<br />\n";
         echo _('por') . ' <a href="' . get_user_uri($this->username, 'history') . '">' . $this->username . '</a> ';
         // Print dates
         if ($globals['now'] - $this->date > 604800) {
             // 7 days
             echo _('el') . get_date_time($this->sent_date);
             if ($this->status == 'published') {
                 echo ', ' . _('publicado el') . get_date_time($this->date);
             }
         } else {
             echo _('hace') . txt_time_diff($this->sent_date);
             if ($this->status == 'published') {
                 echo ', ' . _('publicado hace') . txt_time_diff($this->date);
             }
         }
         echo "</div>\n";
     }
     if ($type == 'full' || $type == 'preview') {
         echo '<p>' . text_to_html($this->content);
         if ($type != 'preview') {
             if ($this->is_editable()) {
                 echo '&nbsp;&nbsp;<a href="' . $globals['base_url'] . 'editlink.php?id=' . $this->id . '&amp;user=' . $current_user->user_id . '" title="' . _('editar noticia') . ' #' . $this->id . '"><img src="' . $globals['base_url'] . 'img/common/edit-misc01.png" alt="edit"/></a>';
             }
             if ($this->geo && $this->is_map_editable()) {
                 echo '&nbsp;&nbsp;<a href="#" onclick="$(\'#geoedit\').load(\'' . $globals['base_url'] . "geo/get_form.php?id={$this->id}&amp;type=link&amp;icon={$this->status}" . '\'); return false;"><img src="' . $globals['base_url'] . 'img/common/edit-geo01.png" alt="edit" title="' . _('editar geolocalización') . '"/></a>';
             }
         }
         echo '</p>';
     }
     // Print a summary of the best comment
     if ($karma_best_comment > 0 && ($best_comment = $db->get_row("select comment_id, comment_order, comment_content from comments where comment_link_id = {$this->id} and comment_karma > {$karma_best_comment} order by comment_karma desc limit 1"))) {
         echo '<div style="font-size: 80%; border: 1px solid; border-color: #dadada; background: #fafafa; margin: 7px 50px 7px 25px; padding: 4px; overflow:hidden">';
         $link = $this->get_permalink() . get_comment_page_suffix($globals['comments_page_size'], $best_comment->comment_order, $this->comments) . '#comment-' . $best_comment->comment_order;
         echo '<a onmouseout="tooltip.clear(event);"  onclick="tooltip.clear(this);" onmouseover="return tooltip.ajax_delayed(event, \'get_comment_tooltip.php\', \'' . $best_comment->comment_id . '\', 10000);" href="' . $link . '"><strong>' . $best_comment->comment_order . '</strong></a>';
         echo ':&nbsp;' . text_to_summary($best_comment->comment_content, 200) . '</div>';
     }
     echo '<div class="news-details">';
     if ($this->comments > 0) {
         $comments_mess = $this->comments . ' ' . _('comentarios');
     } else {
         $comments_mess = _('sin comentarios');
     }
     echo '<span class="comments">&nbsp;<a href="' . $this->get_relative_permalink() . '">' . $comments_mess . '</a></span>';
     // If the user is authenticated, show favorite box
     if ($current_user->user_id > 0) {
         echo '<span class="tool"><a id="fav-' . $this->id . '" href="javascript:get_votes(\'get_favorite.php\',\'' . $current_user->user_id . '\',\'fav-' . $this->id . '\',0,\'' . $this->id . '\')">' . favorite_teaser($current_user->user_id, $this->id) . '</a></span>';
     }
     // Print meta and category
     echo ' <span class="tool">' . _('en') . ': ';
     echo '<a href="' . $globals['base_url'] . '?meta=' . $this->meta_uri . '" title="' . _('meta') . '">' . $this->meta_name . '</a>, ';
     echo '<a href="' . $globals['base_url'] . '?meta=' . $this->meta_uri . '&amp;category=' . $this->category . '" title="' . _('categoría') . '">' . $this->category_name . '</a>';
     echo '</span>';
     echo ' <span class="tool">karma: <span id="a-karma-' . $this->id . '">' . intval($this->karma) . '</span></span>';
//.........这里部分代码省略.........
开发者ID:brainsqueezer,项目名称:fffff,代码行数:101,代码来源:link.php

示例13: print_summary

 function print_summary($type = 'full', $karma_best_comment = 0, $show_tags = true)
 {
     global $current_user, $current_user, $globals, $db;
     if (!$this->read) {
         return;
     }
     if ($this->is_votable()) {
         $this->voted = $this->vote_exists($current_user->user_id);
     }
     echo '<div class="news-summary">';
     echo '<div class="news-body">';
     $this->print_warn();
     /*
     		if (! $globals['link']) {
     			$url = $this->get_permalink();
     			$nofollow = '';
     */
     if ($this->status != 'published') {
         $nofollow = ' rel="nofollow"';
     } else {
         $nofollow = '';
     }
     $url = htmlspecialchars($this->url);
     if ($type != 'preview' && !empty($this->title) && !empty($this->content)) {
         $this->print_shake_box();
     }
     echo '<h1>';
     echo '<a href="' . $url . '"' . $nofollow . '>' . $this->title . '</a>';
     echo '</h1>';
     echo '<div class="news-submitted">';
     echo '<strong>' . txt_shorter($this->url, 40) . '</strong><br/>';
     if ($globals['link']) {
         printf(_('por %s'), ' <a href="' . get_user_uri($this->username, 'history') . '">' . $this->username . '</a> ');
         // Print dates
         if ($globals['now'] - $this->date > 604800) {
             // 7 days
             if ($this->status == 'published') {
                 echo _('publicado el') . get_date_time($this->date);
             } else {
                 echo _('el') . get_date_time($this->sent_date);
             }
         } else {
             if ($this->status == 'published') {
                 echo _('publicado hace') . txt_time_diff($this->date);
             } else {
                 echo _('hace') . txt_time_diff($this->sent_date);
             }
         }
     }
     echo "</div>\n";
     $text = text_to_html($this->content);
     // Change links to mydomain.net to m.mydomain.net (used in "related")
     $my_domain = get_server_name();
     $parent_domain = preg_replace('/m\\./', '', $my_domain);
     if ($parent_domain != $my_domain && preg_match('#[^\\.]' . preg_quote($parent_domain) . '/#', $text)) {
         $text = preg_replace('#([^\\.])' . preg_quote($parent_domain) . '/#', "\$1{$my_domain}/", $text);
     }
     echo $text;
     echo '<div class="news-details">';
     if ($this->comments > 0) {
         $comments_mess = $this->comments . ' ' . _('comentarios');
     } else {
         $comments_mess = _('sin comentarios');
     }
     echo '<span class="comments"><a href="' . $this->get_relative_permalink() . '">' . $comments_mess . '</a> </span>';
     echo '&nbsp;<span class="tool"><a href="http://' . preg_replace('/(\\.|^)m\\./', '$1', get_server_name()) . $this->get_relative_permalink() . '"><strong>' . _('versión estándar') . '&nbsp;&#187;</strong></a></span>';
     /*
      * Disabled, it does not give too much information and is hidden to the right (at least in Android)
     		if ($globals['link']) {
     			// Print meta and category
     			echo ' <span class="tool">'._('en').': ';
     			echo $this->meta_name.', ';
     			echo $this->category_name;
     			echo '</span>';
     		}
     */
     echo '</div>' . "\n";
     // End news details
     if ($globals['link']) {
         echo '<div class="news-details">';
         echo '<strong>karma</strong>: <span id="a-karma-' . $this->id . '">' . intval($this->karma) . '</span>&nbsp;&nbsp;';
         echo '<strong>' . _('negativos') . '</strong>: ' . $this->negatives . '&nbsp;&nbsp;';
         echo '<strong>' . _('usuarios') . '</strong>: ' . $this->votes . '&nbsp;&nbsp;';
         echo '<strong>' . _('anónimos') . '</strong>: ' . $this->anonymous . '&nbsp;&nbsp;';
         echo '</div>' . "\n";
     }
     echo '</div>' . "\n";
     echo '</div>' . "\n";
 }
开发者ID:brainsqueezer,项目名称:fffff,代码行数:89,代码来源:linkmobile.php

示例14: insert_comment

 if (isset($_POST['process'])) {
     if ($_POST['process'] == 'newcomment') {
         insert_comment();
     }
 }
 // log the pageview
 $pageview = new Pageview();
 $pageview->type = 'story';
 $pageview->page_id = $link->id;
 $pageview->user_id = $current_user->user_id;
 require_once mnminclude . 'check_behind_proxy.php';
 $pageview->user_ip = check_ip_behind_proxy();
 // find the last pageview
 $last_visit = $pageview->last_visit();
 if ($last_visit != 0) {
     $last_visit = txt_time_diff($pageview->last_visit(), time());
 }
 $main_smarty->assign('last_visit', $last_visit);
 $pageview->insert();
 // Set globals
 $globals['link_id'] = $link->id;
 $globals['category_id'] = $link->category;
 $globals['category_name'] = $link->category_name();
 $globals['category_url'] = $link->category_safe_name();
 check_actions('story_top');
 $main_smarty->assign('link_submitter', $link->username());
 // setup breadcrumbs and page title
 $main_smarty->assign('posttitle', $link->title);
 $navwhere['text1'] = $globals['category_name'];
 $navwhere['link1'] = getmyurl('maincategory', makeCategoryFriendly($globals['category_url']));
 $navwhere['text2'] = $link->title;
开发者ID:hyrmedia,项目名称:modules,代码行数:31,代码来源:story.php

示例15: print_summary

 function print_summary($length = 0)
 {
     global $current_user, $globals;
     if (!$this->read) {
         $this->read();
     }
     echo '<li id="pcontainer-' . $this->id . '">';
     $post_meta_class = 'comment-meta';
     $post_class = 'comment-body';
     echo '<div class="' . $post_class . '">';
     echo '<a href="' . get_user_uri($this->username) . '"><img onmouseover="return tooltip.ajax_delayed(event, \'get_user_info.php\', ' . $this->author . ');" onmouseout="tooltip.clear(event);" class="avatar" src="' . get_avatar_url($this->author, $this->avatar, 40) . '" width="40" height="40" alt="' . $this->username . '"/></a>';
     $this->print_text($length);
     echo '</div>';
     // The comments info bar
     echo '<div class="' . $post_meta_class . '">';
     // Print the votes info (left)
     echo '<div class="comment-votes-info">';
     // Check that the user can vote
     if ($current_user->user_id > 0 && $this->author != $current_user->user_id) {
         $this->print_shake_icons();
     }
     echo _('votos') . ': <span id="vc-' . $this->id . '">' . $this->votes . '</span>, karma: <span id="vk-' . $this->id . '">' . $this->karma . '</span>';
     // Add the icon to show votes
     if ($this->votes > 0 && $this->date > $globals['now'] - 30 * 86400) {
         // Show votes if newer than 30 days
         echo '&nbsp;&nbsp;<a href="javascript:modal_from_ajax(\'' . $globals['base_url'] . 'backend/get_p_v.php?id=' . $this->id . '\')">';
         echo '<img src="' . $globals['base_url'] . 'img/common/vote-info01.png" width="12" height="12" alt="+ info" title="' . _('¿quién ha votado?') . '"/>';
         echo '</a>';
     }
     echo '</div>';
     // Print comment info (right)
     echo '<div class="comment-info">';
     echo '<a href="' . post_get_base_url($this->username) . '">' . _('nota de') . ' ' . $this->username . '</a> ';
     echo '(' . $this->src . ') ';
     echo '(<a href="' . post_get_base_url($this->username) . '/' . $this->id . '" title="permalink">#</a>) ';
     // Print dates
     if (time() - $this->date > 604800) {
         // 7 days
         echo _('el') . get_date_time($this->date);
     } else {
         echo _('hace') . ' ' . txt_time_diff($this->date);
     }
     echo '</div></div>';
     echo "</li>\n";
 }
开发者ID:brainsqueezer,项目名称:fffff,代码行数:45,代码来源:post.php


注:本文中的txt_time_diff函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。