public function update() { if (doo_csrf()) { $top_ad_field = $this->app->advertisement->where('id', 1); $this->app->advertisement->createOrUpdateById($top_ad_field, 'Top Ads', ['id' => 1, 'top_ad' => \Input::post('top_ad'), 'bottom_ad' => \Input::post('bottom_ad'), 'side_ad' => \Input::post('side_ad'), 'top_ad_logo' => \Input::post('top_ad_logo')]); \App::flash('ads-updated', 'Ad spaces have been updated!'); \Response::redirect($this->site_url . '/admin-area/ad-boxes'); } }
/** * Update item from edit form - post/patch */ public function update($id) { if (doo_csrf()) { $content = \Input::post('editor1'); $page_title = \Input::post('pageTitle'); $order = \Input::post('order'); $slug = \Input::post('slug'); $this->app->page->update('id', $id, ['title' => $page_title, 'content' => $content, 'order' => $order, 'slug' => $slug]); \App::flash('page_updated', $page_title . ' page has been updated!'); \Response::redirect($this->site_url . '/admin-area/pages'); } }
public function update() { //chechk if form $_POST 'token' is true - for csrf prevention if (doo_csrf()) { $public_key = \Input::post('public_key'); $private_key = \Input::post('private_key'); $check = $this->app->recaptcha->where('id', 1); $this->app->recaptcha->createOrUpdateById($check, 'reCAPTCHA keys ', ['id' => 1, 'public_key' => $public_key, 'private_key' => $private_key]); \App::flash('recaptcha', 'rCAPTCHA Keys updated.'); \Response::redirect($this->site_url . '/admin-area/recaptcha'); } }
public function update() { //chechk if form $_POST 'token' is true - for csrf prevention if (doo_csrf()) { $facebook_user = \Input::post('facebook_user'); $twitter_user = \Input::post('twitter_user'); //$gplus_user = Input::post('gplus_user'); $check = $this->app->social_username->where('id', 1); $this->app->social_username->createOrUpdateById($check, 'Side Media Usernames ', ['id' => 1, 'facebook_user' => $facebook_user, 'twitter_user' => $twitter_user]); \App::flash('socialUsernames', 'Social Media Usernames updated.'); \Response::redirect($this->site_url . '/admin-area/social-username'); } }
public function update() { //chechk if form $_POST 'token' is true - for csrf prevention if (doo_csrf()) { $facebook_app_id = \Input::post('facebook_app_id'); $facebook_secret_key = \Input::post('facebook_secret_key'); $twitter_app_id = \Input::post('twitter_app_id'); $twitter_secret_key = \Input::post('twitter_secret_key'); $check = $this->app->social_key->where('id', 1); $this->app->social_key->createOrUpdateById($check, 'Social Media Key ', ['id' => 1, 'facebook_public_key' => $facebook_app_id, 'facebook_secret_key' => $facebook_secret_key, 'twitter_public_key' => $twitter_app_id, 'twitter_secret_key' => $twitter_secret_key]); \App::flash('socialkeys', 'Social Media API Key updated.'); \Response::redirect($this->site_url . '/admin-area/social-keys'); } }
/** * Get site details * @param $data = $_POST * @return string and int */ public function update() { if (doo_csrf()) { try { $id = \Input::post('id'); $site_title = \Input::post('site_title'); $description = \Input::post('description'); $keywords = \Input::post('keywords'); $this->app->siteMetaForm->validator($_POST); $check = $this->app->site_meta->where('id', $id); $this->app->site_meta->createOrUpdateById($check, 'Site Meta Details ', ['id' => $id, 'title' => $site_title, 'description' => $description, 'keywords' => $keywords]); \App::flash('site-metas', 'Site Metas updated!'); \Response::redirect($this->site_url . '/admin-area/site-details'); } catch (\Doowebdev\Validation\DooFormValidationException $e) { $this->data['site_title_errors'] = $e->getErrorFor()->first('site_title'); $this->data['description_errors'] = $e->getErrorFor()->first('description'); $this->data['keywords_errors'] = $e->getErrorFor()->first('keywords'); \View::display('admin/setting/site-details.twig', $this->data); } } }
/** * Add settings to generate site */ public function addSettings() { if (doo_csrf()) { $item_priority = \Input::post('item_priority'); $item_frequency = \Input::post('item_frequency'); $page_priority = \Input::post('page_priority'); $page_frequency = \Input::post('page_frequency'); try { $this->app->siteMapForm->validator($_POST); $check = $this->app->site_map->where('id', 1); $this->app->site_map->createOrUpdateById($check, 'Item Sitemap Settings ', ['id' => 1, 'priority' => $item_priority, 'freqency' => $item_frequency]); $check = $this->app->site_map->where('id', 2); $this->app->site_map->createOrUpdateById($check, 'Page Sitemap Settings ', ['id' => 2, 'priority' => $page_priority, 'freqency' => $page_frequency]); \App::flash('sitemap', 'Site Map updated'); \Response::redirect($this->site_url . '/admin-area/sitemap'); } catch (\Doowebdev\Validation\DooFormValidationException $e) { $this->data['item_priority_errors'] = $e->getErrorFor()->first('item_priority'); $this->data['item_frequency_errors'] = $e->getErrorFor()->first('item_frequency'); $this->data['page_priority_errors'] = $e->getErrorFor()->first('page_priority'); $this->data['page_frequency_errors'] = $e->getErrorFor()->first('page_frequency'); return \View::display('admin/setting/sitemap.twig', $this->data); } } }
/** * Update item from edit form - post/patch */ public function update($id) { if (doo_csrf()) { // $id = Input::get('id'); $pwd = \Input::post('password'); $user_group = \Input::post('user_group'); $email = \Input::post('email'); $first_name = \Input::post('first_name'); $last_name = \Input::post('last_name'); $username = \Input::post('username'); $activate = \Input::post('activated'); try { // Find the user using the user id $user = $this->app->auth->findUserById($id); $group = $this->app->group->whereFirst('name', $user_group); //update into database $this->app->user_group->update('user_id', $id, ['group_id' => $group->id]); // Update the user details $user->email = $email; $user->first_name = $first_name; $user->last_name = $last_name; $user->username = $username; $user->activated = $activate; if (!empty($pwd)) { $user->password = $pwd; } // Update the user if ($user->save()) { // User information was updated \App::flash('user-updated', $email . ' User Updated.'); \Response::redirect($this->site_url . '/admin-area/users'); } else { // User information was not updated $error_msg = 'User information was not updated'; } } catch (\Cartalyst\Sentry\Users\UserExistsException $e) { $error_msg = 'User with this login ( ' . $email . ' ) already exists.'; } catch (\Cartalyst\Sentry\Users\UserNotFoundException $e) { $error_msg = 'User was not found.'; } catch (\Cartalyst\Sentry\Groups\GroupNotFoundException $e) { $error_msg = 'Group was not found.'; } if (!empty($error_msg)) { $user = $this->app->auth->findUserByID($id); $group = $user->getGroups(); $this->data['group_name'] = $group[0]['name']; $this->data['user'] = $user; $this->data['error_msg'] = $error_msg; return \View::display('admin/user/edit.twig', $this->data); } } }