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')); }