public function execute()
 {
     $is_admin = $this->getUser()->isAdmin($this->getApp());
     $storage = $this->getStorage();
     if (waRequest::post('save')) {
         $this->save();
         $save_id = rand(10000, 99999);
         $storage->write('blog_setttings_save_id', $save_id);
         $this->redirect(array('module' => 'settings', 'save' => $save_id));
     }
     if ($is_admin) {
         $e_g = blogHelper::getAvailable();
         reset($e_g);
         $user = $this->getUser();
         $this->view->assign('e_g', current($e_g));
         $this->view->assign('user_name', $user['name']);
         // Checking if have saved now
         $save_id = $storage->read('blog_setttings_save_id');
     }
     // Checking if have saved now
     $save_id = $storage->read('blog_setttings_save_id');
     if ($save_id && $save_id == waRequest::get('save', 0)) {
         $storage->del('blog_setttings_save_id');
         $this->view->assign('saved', 1);
     }
     $this->getResponse()->setTitle(_w('Blog settings page'));
     $this->setLayout(new blogDefaultLayout());
     $this->view->assign('user_settings', $res = $this->getUserSettings());
     if ($is_admin) {
         $this->view->assign('backend_settings', $this->getFrontendSettings());
         $this->view->assign('routing_settings_url', blogHelper::getRouteSettingsUrl());
     }
 }
 public function execute()
 {
     $is_admin = $this->getUser()->isAdmin($this->getApp());
     $storage = $this->getStorage();
     if (waRequest::post('save')) {
         $this->save();
         $save_id = rand(10000, 99999);
         $storage->write('blog_setttings_save_id', $save_id);
         $this->redirect(array('module' => 'settings', 'save' => $save_id));
     }
     if ($is_admin) {
         $e_g = blogHelper::getAvailable();
         reset($e_g);
         $user = $this->getUser();
         $this->view->assign('e_g', current($e_g));
         $this->view->assign('user_email', $user->get('email', 'default'));
         // Checking if have saved now
         $save_id = $storage->read('blog_setttings_save_id');
     }
     // Checking if have saved now
     $save_id = $storage->read('blog_setttings_save_id');
     if ($save_id && $save_id == waRequest::get('save', 0)) {
         $storage->del('blog_setttings_save_id');
         $this->view->assign('saved', 1);
     }
     $this->getResponse()->setTitle(_w('Blog settings page'));
     $this->setLayout(new blogDefaultLayout());
     $this->view->assign('user_settings', $res = $this->getUserSettings());
     if ($is_admin) {
         $this->view->assign('backend_settings', $this->getFrontendSettings());
         // to mislead potential foes, apparently...
         $this->view->assign('routing_settings_url', blogHelper::getRouteSettingsUrl());
         $this->view->assign('photos_app_available', blogPhotosBridge::isAvailable());
     }
     $app_settings_model = new waAppSettingsModel();
     $this->view->assign('last_reminder_cron_time', $app_settings_model->get('blog', 'last_reminder_cron_time'));
     $this->view->assign('cron_command', 'php ' . wa()->getConfig()->getRootPath() . '/cli.php blog reminder');
 }