示例#1
0
 /**
  * 发布评论
  */
 static function comment($slug, $body, $display = 1)
 {
     $minute = 3;
     //几分钟内不能重复评论
     if (!$body || !$slug) {
         return __('comment body required');
     }
     if (!Auth::id()) {
         return __('please login first');
     }
     $sid = static::slug($slug);
     $body_id = static::body($body);
     $one = DB::one('comment', array('where' => array('mid' => Auth::id()), 'orderBy' => 'id desc'));
     if ($one && $one['created'] + 60 * $minute >= time()) {
         return __('comment have a rest');
     }
     $array = array('body_id' => $body_id, 'mid' => Auth::id(), 'slug_id' => $sid, 'display' => $display, 'created' => time());
     DB::insert('comment', $array);
 }
示例#2
0
<div class="<?php 
echo $formId;
?>
">
	<?php 
foreach ($rows->models as $model) {
    ?>
		 
		<p><?php 
    echo Classes::get_body($model['body_id']);
    ?>
</p>
    	<div>
    		<span class="label">
    		<?php 
    $o = Auth::get_member($model['mid']);
    echo $o->name;
    ?>
    		</span>
        
        	<div class="pull-right"> 
		         <span class="badge badge-success"><?php 
    echo __('commented');
    ?>
: <?php 
    echo date('Y-m-d H:i', $model['created']);
    ?>
</span>
		        	
		      </div>
		 </div> 
示例#3
0
    //widget paginate 的class值 需要返回的ajax内容替换
} else {
    $paginatFormId = $_bottom;
    //widget paginate 的class值 需要返回的ajax内容替换
}
$query = array('slug' => $slug, 'formId' => $formId);
//ajax 传到comment/ajax/index
?>
 
<?php 
$script = " \najax_pagination();\nfunction ajax_pagination(){\n\t\$( '.pagination a' ).bind( 'click' , function (){  \n\t\t\$.post(\$( this ).attr( 'href' )," . Json::encode($query) . ",function(data){ \n\t\t \t\$( '#" . $paginatFormId . "' ).html(data); \n\t\t \tajax_pagination();\n\t\t}); \n\t\treturn  false ; \n\t});\n}";
UI::ajax(url('comment/ajax/index'), $query, "#" . $paginatFormId, $script);
if ($top === true) {
    echo "<div id='" . $paginatFormId . "'></div>";
}
if (true === Auth::check()) {
    ?>
	<div id="<?php 
    echo $infoMessage;
    ?>
" class="alert" style="display:none"></div>
	<?php 
    $form = ActiveForm::begin(array('options' => array('class' => 'form-horizontal', 'id' => $formId), 'fieldConfig' => array('inputOptions' => array('class' => 'input-xlarge'))));
    ?>
	<?php 
    echo Html::textArea('Comment[body]', null, array('required' => 'required', 'id' => 'Comment_body'));
    ?>
	 
	<p style='margin-top:10px;'>
		<?php 
    echo Html::button(__('comment'), null, null, array('class' => 'btn'));
示例#4
0
</a>
           </li>
        <?php 
}
?>
        </ul>
        <h3 class="muted">MINCMS</h3>
        <?php 
if (\app\modules\member\Auth::check()) {
    ?>
        	<div class='alert aler-info'>
        		<?php 
    echo __('logined');
    ?>
:<?php 
    echo \app\modules\member\Auth::info()->name;
    ?>
        		<a href="<?php 
    echo url('member/logout/index');
    ?>
"><?php 
    echo __('logout');
    ?>
</a>
        	</div>
        <?php 
} else {
    ?>
 
			<?php 
    echo module_widget('oauth', 'login');
示例#5
0
 public function actionIndex()
 {
     Auth::logout();
     flash('success', __('logout success'));
     $this->redirect(return_url());
 }