/** * 显示首页、新闻信息 */ function actionIndex() { $page = isset($_GET['page']) ? (int) $_GET['page'] : 0; FLEA::loadClass('FLEA_Helper_Pager'); $table =& $this->_modelPosts->getTable(); $pager =& new FLEA_Helper_Pager($table, $page, 20, null, 'post_id DESC'); $pk = $table->primaryKey; $rowset = $pager->findAll(); $this->_setBack(); include APP_DIR . '/ZobHome.php'; }
/** * 保存帖子 */ function actionSave() { $post = array('post_id' => $_POST['post_id'], 'title' => $_POST['title'], 'body' => strip_tags($_POST['body'])); __TRY(); $this->_modelPosts->savePost($post); $ex = __CATCH(); if (__IS_EXCEPTION($ex)) { return $this->_editComment($post, $ex->getMessage()); } js_alert(_T('ui_c_success_post'), '', $this->_url('index')); }
public static function add_new_post($data) { $user = Model_Users::find('first', array('where' => array('fb_id' => $data['author']))); $page = Model_Pages::find($data['page_id']); $post = Model_Posts::forge($data); $post->author = $user->id; $post->modifier = $user->id; $post->page_id = $page->id; if (!$post->save()) { return false; } return true; }
public function post_add_image_with_url() { $data = Libs\Helper\Input::get_new_data_photo_by_url(); if (!empty(Input::post('push_facebook_on'))) { //*** Call api if (!Libs\Helper\Features::post_photo_to_fb_by_url($data['content'])) { //Unset push_facebook_on $data['push_facebook_on'] = 0; Session::set_flash('warning', 'Cannot post to facebook. Please try again later'); } } //*** Add to DB if (!Model_Posts::add_new_post($data)) { Session::set_flash('error', 'Cannot add new post'); \Fuel\Core\Response::redirect('fanpage/index'); } Session::set_flash('success', 'Added new post'); Response::redirect('fanpage/dashboard/' . Input::post('page_id')); }
function __destruct() { gen_time('Controllers/Control_Posts'); parent::__destruct(); }