public function actionIndex($genre = '') { $crit = array('conditions' => array('status' => array('equals' => 3)), 'limit' => 10, 'sort' => array('_id' => EMongoCriteria::SORT_ASC)); if ($genre != '') { $crit['conditions']['genre'] = array('equals' => $genre); } $data = Meme::model()->findAll($crit); if ($data) { foreach ($data as $meme) { $model = Meme::model()->findByPk($meme->_id); $model->updated_datetime = date('Y-m-d H:i:s'); $model->status = 1; $res = $model->save(); echo $res ? "Update status success!" : "Update fail"; echo "\n"; echo $meme->_id; } } else { echo 'Not found content to active' . "\n"; } }
<?php require_once '../lib/YahooMeme.class.php'; $meme = new Meme(); print "<h2>[info about bigo]</h2> <br />"; print $meme->get("bigodines")->toString(true); print "<h2>[people following bigodines]</h2> <br/>"; $repo = new MemeRepository(); foreach ($repo->following("bigodines") as $row) { print $row->toString() . "<br />"; } print "<h2>[bigo latest 5 posts]</h2>"; foreach ($meme->get("bigodines")->getPosts(0, 5) as $row) { print $row->toString() . "<br />\n"; } print "<h2>[meme popular posts]</h2> <br />"; $post = new Post(); foreach ($post->popular() as $row) { print $row->toString() . "<br />"; } print "<h2>[latest 5 posts from meme]</h2> <br />"; foreach ($post->search('sort:cdate', 0, 5) as $row) { print $row->toString() . "<br />\n"; }
public function getDestroy($id) { if (Session::get('user_level') < Config::get('cms.deleteMemes')) { return Redirect::to(_l(URL::action('AdminHomeController@getIndex')))->with('message', Lang::get('admin.notPermitted'))->with('notif', 'warning'); } try { $meme = Meme::onlyTrashed()->findOrFail($id); $meme->instances()->withTrashed()->forceDelete(); $meme->forceDelete(); return Redirect::to(_l(URL::action('MemeController@getTrashed')))->with('message', Lang::get('admin.memeDeleted'))->with('notif', 'success'); } catch (Exception $e) { return Redirect::to(_l(URL::action('MemeController@getTrashed')))->with('message', Lang::get('admin.noSuchMeme'))->with('notif', 'danger'); } }
public function actionView() { try { $criteria = array('conditions' => array('status' => array('equals' => 0)), 'limit' => 10, 'offset' => 0, 'sort' => array('_id' => EMongoCriteria::SORT_ASC)); $memeLink = MemeLink::model()->findAll($criteria); if ($memeLink) { foreach ($memeLink as $link) { $meme = new Meme(); $meme->title = $link->title; $meme->content = $link->img; $meme->link_id = $link->_id; $meme->type = $link->type; $meme->source = $link->source; $author = rand(1, 20); $meme->created_by = $author; $meme->created_datetime = date('Y-m-d H:i:s'); $meme->status = 3; $meme->views = 0; $link->status = 1; if ($link->save()) { $res = $meme->save(); echo $res ? "success" : "fail"; echo "\n"; } } } } catch (Exception $e) { echo $e->getMessage(); } }
<a class="delete-meme-btn meme-menu-btn ttip" title="<?php echo Yii::t('yii', 'delete'); ?> " data-meme-id="<?php echo $meme->meme_id; ?> " href="<?php echo Yii::app()->createUrl('site/delete', array('id' => $meme->meme_id)); ?> "><i class="icon-trash"></i></a> <?php } ?> </div> <?php if (!Yii::app()->user->isGuest && !Meme::hasFlagged($meme->meme_id)) { ?> <a class="ttip mark-flag no-underline" title="<?php echo Yii::t('yii', 'mark as inappropriate'); ?> " href="<?php echo Yii::app()->createUrl('site/flag', array('id' => $meme->meme_id)); ?> "><i class="icon-flag"></i> Report</a> <?php } ?> </div> </div> </div>
/** * Store a newly created resource in storage. * POST /frontend/publicmeme * * @return Response */ public function store() { $rules = array('first_line' => 'Required', 'second_line' => 'Required', 'meme_id' => 'Required'); $v = Validator::make(Input::all(), $rules); if ($v->passes()) { if (Input::get('antibot') == Session::get('antispam1') + Session::get('antispam2')) { $base = Meme::findOrFail(Input::get('meme_id')); $meme = new MemeInstance(); $meme->meme_id = strip_tags(Input::get("meme_id")); $meme->first_line = strip_tags(Input::get("first_line")); $meme->second_line = strip_tags(Input::get("second_line")); $akismet = new Akismet('http://www.puskice.org/', '5fa6e0236f7b'); if (Session::get("id") != null) { $meme->user_id = strip_tags(Session::get("id")); $user = User::find($meme->user_id); $akismet->setCommentAuthor($user->username); $akismet->setCommentAuthorEmail($user->email); } else { $meme->user_id = -1; $akismet->setCommentAuthor('anonymous'); $akismet->setCommentAuthorEmail('*****@*****.**'); } $meme->permalink = Puskice::url_slug(htmlspecialchars_decode($meme->first_line)); $meme->published = 1; $meme->trashed = 0; $meme->view_count = 0; $meme->thumbs_up = 0; $meme->thumbs_down = 0; $akismet->setCommentAuthorURL(""); $akismet->setCommentContent($meme->first_line . " " . $meme->second_line); $akismet->setPermalink('http://www.puskice.org/meme/' . $meme->id . '-' . $meme->permalink); if ($akismet->isCommentSpam()) { return Redirect::to(Request::root() . "/memes/new")->with('message', __("Систем каже да спамујете"))->with('notif', 'danger')->withInput(); } $meme->save(); Session::forget('antispam1'); Session::forget('antispam2'); return Redirect::to(Request::root() . "/meme/" . $meme->id . "-" . $meme->permalink); } else { return Redirect::to(Request::root() . "/memes/new")->with('message', __("Нисте добро сабрали бројеве"))->with('notif', 'danger')->withInput(); } } else { return Redirect::to(Request::root() . "/memes/new")->withErrors($v)->with('notif', 'danger'); } }