Пример #1
0
 /**
  * saves the category in a specific order and change the parent
  * @return void 
  */
 public function action_saveorder()
 {
     $this->auto_render = FALSE;
     $this->template = View::factory('js');
     if (Menu::change_order(Core::get('order'))) {
         Cache::instance()->delete_all();
         Theme::delete_minified();
         $this->template->content = __('Saved');
     } else {
         $this->template->content = __('Error');
     }
 }
Пример #2
0
 public function action_cache()
 {
     $this->template->title = __('Cache');
     Breadcrumbs::add(Breadcrumb::factory()->set_title($this->template->title));
     $cache_config = Core::config('cache.' . Core::config('cache.default'));
     //force clean cache
     if (Core::get('force') == 1) {
         Core::delete_cache();
         Alert::set(Alert::SUCCESS, __('All cache deleted'));
     } elseif (Core::get('force') == 2) {
         Cache::instance()->garbage_collect();
         Theme::delete_minified();
         Alert::set(Alert::SUCCESS, __('Deleted expired cache'));
     }
     $this->template->content = View::factory('oc-panel/pages/tools/cache', array('cache_config' => $cache_config));
 }
Пример #3
0
 public function action_delete()
 {
     //get name of the param, get the name of the custom fields, deletes from config array and alters table
     $this->auto_render = FALSE;
     $name = $this->request->param('id');
     $field = new Model_Field();
     try {
         if ($field->delete($name)) {
             Cache::instance()->delete_all();
             Theme::delete_minified();
             Alert::set(Alert::SUCCESS, __('Field deleted ' . $name));
         } else {
             Alert::set(Alert::ERROR, __('Field does not exists ' . $name));
         }
         $this->request->redirect(Route::url('oc-panel', array('controller' => 'fields', 'action' => 'index')));
     } catch (Exception $e) {
         //throw 500
         throw new HTTP_Exception_500();
     }
 }
Пример #4
0
 /**
  * deletes all the cache + theme temp files
  * @return [type] [description]
  */
 public static function delete_cache()
 {
     Cache::instance()->delete_all();
     Theme::delete_minified();
 }
Пример #5
0
 /**
  * This function will upgrate DB that didn't existed in verisons below 2.0.7
  * changes added: config for advanced search by description
  */
 public function action_21()
 {
     $prefix = Database::instance()->table_prefix();
     $config_db = Kohana::$config->load('database');
     $charset = $config_db['default']['charset'];
     mysql_query("ALTER TABLE  `" . $prefix . "users` ADD  `hybridauth_provider_name` VARCHAR( 40 ) NULL DEFAULT NULL ,ADD  `hybridauth_provider_uid` VARCHAR( 245 ) NULL DEFAULT NULL");
     mysql_query("create unique index " . $prefix . "users_UK_provider_AND_uid on " . $prefix . "users (hybridauth_provider_name, hybridauth_provider_uid)");
     mysql_query("CREATE TABLE IF NOT EXISTS  `" . $prefix . "posts` (\n                  `id_post` int(10) unsigned NOT NULL AUTO_INCREMENT,\n                  `id_user` int(10) unsigned NOT NULL,\n                  `title` varchar(245) NOT NULL,\n                  `seotitle` varchar(245) NOT NULL,\n                  `description` text NOT NULL,\n                  `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,\n                  `status` tinyint(1) NOT NULL DEFAULT '0',\n                  PRIMARY KEY (`id_post`) USING BTREE,\n                  UNIQUE KEY `" . $prefix . "posts_UK_seotitle` (`seotitle`)\n                ) ENGINE=InnoDB DEFAULT CHARSET=" . $charset . ";");
     // build array with new (missing) configs
     $configs = array(array('config_key' => 'search_by_description', 'group_name' => 'general', 'config_value' => 0), array('config_key' => 'blog', 'group_name' => 'general', 'config_value' => 0), array('config_key' => 'minify', 'group_name' => 'general', 'config_value' => 0), array('config_key' => 'parent_category', 'group_name' => 'advertisement', 'config_value' => 1), array('config_key' => 'blog_disqus', 'group_name' => 'general', 'config_value' => ''), array('config_key' => 'upload_images_mobile', 'group_name' => 'general', 'config_value' => 0), array('config_key' => 'config', 'group_name' => 'social', 'config_value' => '{"debug_mode":"0","providers":{
                                                                       "OpenID":{"enabled":"1"},
                                                                       "Yahoo":{"enabled":"0","keys":{"id":"","secret":""}},
                                                                       "AOL":{"enabled":"1"}
                                                                       ,"Google":{"enabled":"0","keys":{"id":"","secret":""}},
                                                                       "Facebook":{"enabled":"0","keys":{"id":"","secret":""}},
                                                                       "Twitter":{"enabled":"0","keys":{"key":"","secret":""}},
                                                                       "Live":{"enabled":"0","keys":{"id":"","secret":""}},
                                                                       "MySpace":{"enabled":"0","keys":{"key":"","secret":""}},
                                                                       "LinkedIn":{"enabled":"0","keys":{"key":"","secret":""}},
                                                                       "Foursquare":{"enabled":"0","keys":{"id":"","secret":""}}},
                                                   "base_url":"",
                                                   "debug_file":""}'));
     // returns TRUE if some config is saved
     $return_conf = Model_Config::config_array($configs);
     //call update actions 203,205,206,207
     $this->action_203();
     $this->action_205();
     $this->action_206();
     $this->action_207();
     //clean cache
     Cache::instance()->delete_all();
     Theme::delete_minified();
     Alert::set(Alert::SUCCESS, __('Updated'));
     $this->request->redirect(Route::url('oc-panel', array('controller' => 'update', 'action' => 'index')));
 }