<?php
class ControllerModuleArticleAllSettings extends Controller {
	private $error = array(); 
	
	public function index() {   
		$this->load->language('module/article_all_settings');
			$this->load->model('news/install');		
			$this->model_news_install->checkInstall();		
		$this->document->setTitle($this->language->get('heading_title'));
		$this->getForm();
	}	
	
	public function info(){			
		$this->load->language('module/article_all_settings');
	
		$this->data['heading_title'] = $this->language->get('heading_title');
		
		$this->data['text_setting'] = $this->language->get('text_setting');
		$this->data['text_uninstall'] = $this->language->get('text_uninstall');
		$this->data['text_optimize_db'] = $this->language->get('text_optimize_db');
		$this->data['text_optimize'] = $this->language->get('text_optimize');
		$this->data['text_empty'] = $this->language->get('text_empty');
		$this->data['text_drop'] = $this->language->get('text_drop');
		$this->data['text_uninstall_module'] = $this->language->get('text_uninstall_module');
		$this->data['text_empty_db'] = $this->language->get('text_empty_db');
		$this->data['text_install'] = $this->language->get('text_install');
		$this->data['text_sample'] = $this->language->get('text_sample');
		$this->data['text_drop_db'] = $this->language->get('text_drop_db');
		$this->data['text_article_type'] = $this->language->get('text_article_type');
		$this->data['text_author'] = $this->language->get('text_author');
		$this->data['text_download'] = $this->language->get('text_download');
		$this->data['text_comment'] = $this->language->get('text_comment');
		
		$this->data['text_confirm'] = $this->language->get('text_confirm');
		$this->data['text_confirm_empty'] = $this->language->get('text_confirm_empty');
		$this->data['text_confirm_drop'] = $this->language->get('text_confirm_drop');
		
		$this->data['sample']=$this->url->link('module/article_all_settings/install_sample','token='.$this->session->data['token'], 'SSL');
		$this->data['uninstall_module']=$this->url->link('module/article_all_settings/uninstall_module','token='.$this->session->data['token'], 'SSL');
		$this->data['optimize']=$this->url->link('module/article_all_settings/optimize','token='.$this->session->data['token'], 'SSL');
		$this->data['empty_db']=$this->url->link('module/article_all_settings/empty_db','token='.$this->session->data['token'], 'SSL');
		$this->data['drop_db']=$this->url->link('module/article_all_settings/drop_db','token='.$this->session->data['token'], 'SSL');
		
		$this->data['setting'] = $this->url->link('module/article_all_settings/settings', 'token=' . $this->session->data['token'], 'SSL');
		$this->data['category'] = $this->url->link('news/category', 'token=' . $this->session->data['token'], 'SSL');
		$this->data['article'] = $this->url->link('news/article', 'token=' . $this->session->data['token'], 'SSL');
		$this->data['author'] = $this->url->link('news/author', 'token=' . $this->session->data['token'], 'SSL');
		$this->data['download'] = $this->url->link('news/download', 'token=' . $this->session->data['token'], 'SSL');
		$this->data['comment'] = $this->url->link('news/comment', 'token=' . $this->session->data['token'], 'SSL');
		$this->data['poll'] = $this->url->link('news/poll', 'token=' . $this->session->data['token'], 'SSL');		
		$this->data['general'] = $this->url->link('module/article_all_settings', 'token=' . $this->session->data['token'], 'SSL');	
			
		$this->data['button_cancel'] = $this->language->get('button_cancel');			
		$this->data['text_news_overview'] = $this->language->get('text_news_overview');
		$this->data['text_total_category'] = $this->language->get('text_total_category');
		$this->data['text_total_article'] = $this->language->get('text_total_article');
		$this->data['text_total_author'] = $this->language->get('text_total_author');
		$this->data['text_total_download'] = $this->language->get('text_total_download');
		$this->data['text_total_comment'] = $this->language->get('text_total_comment');
		$this->data['text_total_poll'] = $this->language->get('text_total_poll');
		$this->data['text_total_comment_awaiting'] = $this->language->get('text_total_comment_awaiting');
		$this->data['text_empty_db'] = $this->language->get('text_empty_db');
		$this->data['text_drop_db'] = $this->language->get('text_drop_db');
		
		$this->load->model('news/category');
		$this->load->model('news/article');
		$this->load->model('news/author');
		$this->load->model('news/comment');
		$this->load->model('news/download');
		$this->load->model('news/poll');
		
		$this->data['total_category'] = $this->model_news_category->getTotalCategories();
		$this->data['total_article'] = $this->model_news_article->getTotalArticle();
		$this->data['total_author'] = $this->model_news_author->getTotalAuthors();
		$this->data['total_download'] = $this->model_news_download->getTotalDownloads();
		$this->data['total_comment'] = $this->model_news_comment->getTotalComments();
		$this->data['total_comment_awaiting'] = $this->model_news_comment->getTotalCommentsAwaitingApproval();
		$this->data['total_poll'] = $this->model_news_poll->getTotalPolls();
		
		/*Success*/ 
		if (isset($this->session->data['success'])) {
			$this->data['success'] = $this->session->data['success'];
		
			unset($this->session->data['success']);
		} else {
			$this->data['success'] = '';
		}
		/*Error*/ 
		
		
  		$this->data['breadcrumbs'] = array();

   		$this->data['breadcrumbs'][] = array(
       		'text'      => $this->language->get('text_home'),
			'href'      => $this->url->link('common/home', 'token=' . $this->session->data['token'], 'SSL'),
      		'separator' => false
   		);

   		$this->data['breadcrumbs'][] = array(
       		'text'      => $this->language->get('text_module'),
			'href'      => $this->url->link('extension/module', 'token=' . $this->session->data['token'], 'SSL'),
      		'separator' => ' :: '
   		);
		
   		$this->data['breadcrumbs'][] = array(
       		'text'      => $this->language->get('heading_title'),
			'href'      => $this->url->link('module/article_all_settings', 'token=' . $this->session->data['token'], 'SSL'),
      		'separator' => ' :: '
   		);
		
		$this->data['cancel'] = $this->url->link('extension/module', 'token=' . $this->session->data['token'], 'SSL');

		$this->template = 'module/article_setting_main.tpl';
		$this->children = array(
			'common/header',
			'news/shortcut_route',
			'news/shortcut_module',
			'common/footer'
		);;
				
		$this->response->setOutput($this->render());
	}
	
	public function settings() {   
		$this->load->language('module/article_all_settings');
		$this->document->setTitle($this->language->get('heading_title'));
		
		$this->load->model('setting/setting');
				
		if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validate()) {
			$this->model_setting_setting->editSetting('article_all_settings', $this->request->post);		
					
			$this->session->data['success'] = $this->language->get('text_success');
						
			$this->redirect($this->url->link('extension/module', 'token=' . $this->session->data['token'], 'SSL'));
		}
			$this->getForm();
	}
	
	
	private function getForm(){				
			$this->load->model('news/install');		
			$this->model_news_install->checkInstall();	
		$this->data['heading_title'] = $this->language->get('heading_title');
		$this->data['text_enabled'] = $this->language->get('text_enabled');		
		$this->data['text_disabled'] = $this->language->get('text_disabled');
		$this->data['text_yes'] = $this->language->get('text_yes');		
		$this->data['text_no'] = $this->language->get('text_no');
		
        $this->data['text_date_desc']    = $this->language->get('text_date_desc');
		$this->data['text_name_asc']     = $this->language->get('text_name_asc');
		$this->data['text_name_desc']    = $this->language->get('text_name_desc');
		$this->data['text_sort_asc']     = $this->language->get('text_sort_asc');
		$this->data['text_sort_desc']    = $this->language->get('text_sort_desc');
		$this->data['text_viewed_asc']   = $this->language->get('text_viewed_asc');
		$this->data['text_viewed_desc']  = $this->language->get('text_viewed_desc');
		$this->data['text_rating_asc']   = $this->language->get('text_rating_asc');
		$this->data['text_rating_desc']  = $this->language->get('text_rating_desc');
		$this->data['text_author_asc']    = $this->language->get('text_author_asc');
		$this->data['text_author_desc']   = $this->language->get('text_author_desc');
		
		$this->data['text_content_top'] = $this->language->get('text_content_top');
		$this->data['text_content_bottom'] = $this->language->get('text_content_bottom');		
		$this->data['text_column_left'] = $this->language->get('text_column_left');
		$this->data['text_column_right'] = $this->language->get('text_column_right');
		
		$this->data['text_category'] = $this->language->get('text_category');
		$this->data['text_featured_article'] = $this->language->get('text_featured_article');
		$this->data['text_image_size'] = $this->language->get('text_image_size');
		$this->data['text_date_format'] = $this->language->get('text_date_format');
		$this->data['text_featured_article'] = $this->language->get('text_featured_article');
		$this->data['text_comment'] = $this->language->get('text_comment');
		$this->data['text_confirm'] = $this->language->get('text_confirm');
          
		
		$this->data['entry_code'] = $this->language->get('entry_code');
		$this->data['entry_layout'] = $this->language->get('entry_layout');
		$this->data['entry_position'] = $this->language->get('entry_position');
		$this->data['entry_status'] = $this->language->get('entry_status');
		$this->data['entry_sort_order'] = $this->language->get('entry_sort_order');
		
		$this->data['button_save'] = $this->language->get('button_save');
		$this->data['button_cancel'] = $this->language->get('button_cancel');
		$this->data['button_add_module'] = $this->language->get('button_add_module');
		$this->data['button_remove'] = $this->language->get('button_remove');
		

		
		$this->data['entry_upload_allowed'] = $this->language->get('entry_upload_allowed');
		$this->data['entry_login_to_download'] = $this->language->get('entry_login_to_download');
		$this->data['entry_article_category'] = $this->language->get('entry_article_category');
		$this->data['entry_article_thumb'] = $this->language->get('entry_article_thumb');
		$this->data['entry_article_popup'] = $this->language->get('entry_article_popup');
		$this->data['entry_image_article'] = $this->language->get('entry_image_article');
		$this->data['entry_image_column'] = $this->language->get('entry_image_column');
		$this->data['entry_article_additional'] = $this->language->get('entry_article_additional');
		$this->data['entry_article_related'] = $this->language->get('entry_article_related');
		$this->data['entry_article_description_limit'] = $this->language->get('entry_article_description_limit');
		$this->data['entry_default_article_sort'] = $this->language->get('entry_default_article_sort');
		
		$this->data['entry_comment'] = $this->language->get('entry_comment');
		$this->data['entry_comment_email'] = $this->language->get('entry_comment_email');
		$this->data['entry_comment_email_value'] = $this->language->get('entry_comment_email_value');
		$this->data['entry_comment_approved'] = $this->language->get('entry_comment_approved');
		$this->data['entry_article_date_format'] = $this->language->get('entry_article_date_format');
		
		/*Success*/ 
		if (isset($this->session->data['success'])) {
			$this->data['success'] = $this->session->data['success'];
		
			unset($this->session->data['success']);
		} else {
			$this->data['success'] = '';
		}
		/*Error*/ 
 		if (isset($this->error['warning'])) {
			$this->data['error_warning'] = $this->error['warning'];
		} else {
			$this->data['error_warning'] = '';
		}
		
		if (isset($this->error['email'])) {
			$this->data['error_email'] = $this->error['email'];
		} else {
			$this->data['error_email'] = '';
		}
		if (isset($this->error['article_description_limit'])) {
			$this->data['error_article_description_limit'] = $this->error['article_description_limit'];
		} else {
			$this->data['error_article_description_limit'] = '';
		}
		
		if (isset($this->error['image_column'])) {
			$this->data['error_image_column'] = $this->error['image_column'];
		} else {
			$this->data['error_image_column'] = '';
		}
		if (isset($this->error['image_article'])) {
			$this->data['error_image_article'] = $this->error['image_article'];
		} else {
			$this->data['error_image_article'] = '';
		}
		if (isset($this->error['image_article_category'])) {
			$this->data['error_image_article_category'] = $this->error['image_article_category'];
		} else {
			$this->data['error_image_article_category'] = '';
		}
				
 		if (isset($this->error['image_article_thumb'])) {
			$this->data['error_image_article_thumb'] = $this->error['image_article_thumb'];
		} else {
			$this->data['error_image_article_thumb'] = '';
		}
		
 		if (isset($this->error['image_article_popup'])) {
			$this->data['error_image_article_popup'] = $this->error['image_article_popup'];
		} else {
			$this->data['error_image_article_popup'] = '';
		}
		
 		if (isset($this->error['image_article_additional'])) {
			$this->data['error_image_article_additional'] = $this->error['image_article_additional'];
		} else {
			$this->data['error_image_article_additional'] = '';
		}	
		
 		if (isset($this->error['image_article_related'])) {
			$this->data['error_image_article_related'] = $this->error['image_article_related'];
		} else {
			$this->data['error_image_article_related'] = '';
		}
		
		
  		$this->data['breadcrumbs'] = array();

   		$this->data['breadcrumbs'][] = array(
       		'text'      => $this->language->get('text_home'),
			'href'      => $this->url->link('common/home', 'token=' . $this->session->data['token'], 'SSL'),
      		'separator' => false
   		);

   		$this->data['breadcrumbs'][] = array(
       		'text'      => $this->language->get('text_module'),
			'href'      => $this->url->link('extension/module', 'token=' . $this->session->data['token'], 'SSL'),
      		'separator' => ' :: '
   		);
		
   		$this->data['breadcrumbs'][] = array(
       		'text'      => $this->language->get('heading_title'),
			'href'      => $this->url->link('module/article_all_settings', 'token=' . $this->session->data['token'], 'SSL'),
      		'separator' => ' :: '
   		);
		
		$this->data['token'] = $this->session->data['token'];
		$this->data['action'] = $this->url->link('module/article_all_settings/settings', 'token=' . $this->session->data['token'], 'SSL');
		
		$this->data['cancel'] = $this->url->link('module/article_all_settings', 'token=' . $this->session->data['token'], 'SSL');
		
		$this->data['button_sample'] = $this->language->get('button_sample');
		$this->data['sample']=$this->url->link('module/article_all_settings/install_sample','token='.$this->session->data['token'], 'SSL');
		$this->data['hide_sample']=$this->url->link('module/article_all_settings/hide_sample','token='.$this->session->data['token'], 'SSL');
	/*General Settings*/ 
	
		if (isset($this->request->post['config_news_sample_installed'])) {
			$this->data['config_news_sample_installed'] = $this->request->post['config_news_sample_installed'];
		} else {
			$this->data['config_news_sample_installed'] = $this->config->get('config_news_sample_installed');
		}
		if (isset($this->request->post['config_news_installed'])) {
			$this->data['config_news_installed'] = $this->request->post['config_news_installed'];
		} else {
			$this->data['config_news_installed'] = $this->config->get('config_news_installed');
		}/*Article*/ 
		if (isset($this->request->post['config_article_sort'])) {
			$this->data['config_article_sort'] = $this->request->post['config_article_sort'];
		} else {
			$this->data['config_article_sort'] = $this->config->get('config_article_sort');
		}
		/*Date fotmat*/ 
		if (isset($this->request->post['config_article_date_format'])) {
			$this->data['config_article_date_format'] = $this->request->post['config_article_date_format'];
		} else {
			$this->data['config_article_date_format'] = $this->config->get('config_article_date_format');
		}
		/*Downloads*/ 
		if (isset($this->request->post['config_news_upload_allowed'])) {
			$this->data['config_news_upload_allowed'] = $this->request->post['config_news_upload_allowed'];
		} else {
			$this->data['config_news_upload_allowed'] = $this->config->get('config_news_upload_allowed');
		}
		if (isset($this->request->post['config_login_to_download'])) {
			$this->data['config_login_to_download'] = $this->request->post['config_login_to_download'];
		} else {
			$this->data['config_login_to_download'] = $this->config->get('config_login_to_download');
		}
		/*Comment allow*/		
		if (isset($this->request->post['config_comment_email'])) {
			$this->data['config_comment_email'] = $this->request->post['config_comment_email'];
		} else {
			$this->data['config_comment_email'] = $this->config->get('config_comment_email');
		}
		if (isset($this->request->post['config_comment_email_notifications'])) {
			$this->data['config_comment_email_notifications'] = $this->request->post['config_comment_email_notifications'];
		} else {
			$this->data['config_comment_email_notifications'] = $this->config->get('config_comment_email_notifications');
		}
		if (isset($this->request->post['config_comment_status'])) {
			$this->data['config_comment_status'] = $this->request->post['config_comment_status'];
		} else {
			$this->data['config_comment_status'] = $this->config->get('config_comment_status');
		}
		if (isset($this->request->post['config_comment_approved'])) {
			$this->data['config_comment_approved'] = $this->request->post['config_comment_approved'];
		} else {
			$this->data['config_comment_approved'] = $this->config->get('config_comment_approved');
		}
		/*Article Image*/ 
		if (isset($this->request->post['article_description_limit'])) {
			$this->data['article_description_limit'] = $this->request->post['article_description_limit'];
		}elseif($this->config->get('article_description_limit')) {
			$this->data['article_description_limit'] = $this->config->get('article_description_limit');
		}else {
			$this->data['article_description_limit'] = 255;
		}
		
		if (isset($this->request->post['config_image_column_width'])) {
			$this->data['config_image_column_width'] = $this->request->post['config_image_column_width'];
		}elseif($this->config->get('config_image_column_width')) {
			$this->data['config_image_column_width'] = $this->config->get('config_image_column_width');
		}else {
			$this->data['config_image_column_width'] = 150;
		}
		
		if (isset($this->request->post['config_image_column_height'])) {
			$this->data['config_image_column_height'] = $this->request->post['config_image_column_height'];
		}elseif($this->config->get('config_image_column_height')) {
			$this->data['config_image_column_height'] = $this->config->get('config_image_column_height');
		}else {
			$this->data['config_image_column_height'] = 112;
		}
				
		if (isset($this->request->post['config_article_category_width'])) {
			$this->data['config_article_category_width'] = $this->request->post['config_article_category_width'];
		} else {
			$this->data['config_article_category_width'] = $this->config->get('config_article_category_width');
		}
		
		if (isset($this->request->post['config_article_category_height'])) {
			$this->data['config_article_category_height'] = $this->request->post['config_article_category_height'];
		} else {
			$this->data['config_article_category_height'] = $this->config->get('config_article_category_height');
		}
				
		if (isset($this->request->post['config_article_thumb_width'])) {
			$this->data['config_article_thumb_width'] = $this->request->post['config_article_thumb_width'];
		} else {
			$this->data['config_article_thumb_width'] = $this->config->get('config_article_thumb_width');
		}
		
		if (isset($this->request->post['config_article_thumb_height'])) {
			$this->data['config_article_thumb_height'] = $this->request->post['config_article_thumb_height'];
		} else {
			$this->data['config_article_thumb_height'] = $this->config->get('config_article_thumb_height');
		}
		
		if (isset($this->request->post['config_article_popup_width'])) {
			$this->data['config_article_popup_width'] = $this->request->post['config_article_popup_width'];
		} else {
			$this->data['config_article_popup_width'] = $this->config->get('config_article_popup_width');
		}
		
		if (isset($this->request->post['config_article_popup_height'])) {
			$this->data['config_article_popup_height'] = $this->request->post['config_article_popup_height'];
		} else {
			$this->data['config_article_popup_height'] = $this->config->get('config_article_popup_height');
		}
		
		if (isset($this->request->post['config_article_additional_width'])) {
			$this->data['config_article_additional_width'] = $this->request->post['config_article_additional_width'];
		} else {
			$this->data['config_article_additional_width'] = $this->config->get('config_article_additional_width');
		}
		
		if (isset($this->request->post['config_article_additional_height'])) {
			$this->data['config_article_additional_height'] = $this->request->post['config_article_additional_height'];
		} else {
			$this->data['config_article_additional_height'] = $this->config->get('config_article_additional_height');
		}
		
		if (isset($this->request->post['config_article_related_width'])) {
			$this->data['config_article_related_width'] = $this->request->post['config_article_related_width'];
		} else {
			$this->data['config_article_related_width'] = $this->config->get('config_article_related_width');
		}
		
		if (isset($this->request->post['config_article_related_height'])) {
			$this->data['config_article_related_height'] = $this->request->post['config_article_related_height'];
		} else {
			$this->data['config_article_related_height'] = $this->config->get('config_article_related_height');
		}
		


		if (isset($this->request->post['config_image_article_width'])) {
			$this->data['config_image_article_width'] = $this->request->post['config_image_article_width'];
		} else {
			$this->data['config_image_article_width'] = $this->config->get('config_image_article_width');
		}
		
		if (isset($this->request->post['config_image_article_height'])) {
			$this->data['config_image_article_height'] = $this->request->post['config_image_article_height'];
		} else {
			$this->data['config_image_article_height'] = $this->config->get('config_image_article_height');
		}
		/*general settings*/ 	
		
		$this->data['modules'] = array();
		
		if (isset($this->request->post['article_all_settings_module'])) {
			$this->data['modules'] = $this->request->post['article_all_settings_module'];
		} elseif ($this->config->get('article_all_settings_module')) { 
			$this->data['modules'] = $this->config->get('article_all_settings_module');
		}			
				
		$this->load->model('design/layout');
		
		$this->data['layouts'] = $this->model_design_layout->getLayouts();

		$this->template = 'module/article_setting_form.tpl';
		$this->children = array(
			'common/header',
			'news/shortcut_route',
			'news/shortcut_module',
			'common/footer'
		);;
				
		$this->response->setOutput($this->render());
	}
	
	private function validate() {
		if (!$this->user->hasPermission('modify', 'module/article_all_settings')) {
			$this->error['warning'] = $this->language->get('error_permission');
		}		
		$this->load->model('news/utf8');
		if ($this->request->post['config_comment_email']==1&&($this->model_news_utf8->utf8_strlen($this->request->post['config_comment_email_notifications']) > 96) || !preg_match('/^[^\@]+@.*\.[a-z]{2,6}$/i', $this->request->post['config_comment_email_notifications'])&&$this->request->post['config_comment_email']==1) {
      		$this->error['email'] = $this->language->get('error_email');
    	}
		/*General Setting*/ 	
		if (($this->request->post['article_description_limit']) < 3 || ($this->request->post['article_description_limit']) > 1024) {
			$this->error['article_description_limit'] = $this->language->get('error_article_description_limit');
		}
							
		if (!$this->request->post['config_article_category_width'] || !$this->request->post['config_article_category_height']) {
			$this->error['image_article_category'] = $this->language->get('error_image_article_category');
		} 
				
		if (!$this->request->post['config_article_thumb_width'] || !$this->request->post['config_article_thumb_height']) {
			$this->error['image_article_thumb'] = $this->language->get('error_image_article_thumb');
		}	
		
		if (!$this->request->post['config_article_popup_width'] || !$this->request->post['config_article_popup_height']) {
			$this->error['image_article_popup'] = $this->language->get('error_image_article_popup');
		}	
		
		if (!$this->request->post['config_image_column_width'] || !$this->request->post['config_image_column_height']) {
			$this->error['image_column'] = $this->language->get('error_image_column');
		}	
		if (!$this->request->post['config_image_article_width'] || !$this->request->post['config_image_article_height']) {
			$this->error['image_article'] = $this->language->get('error_image_article');
		}		
		
		if (!$this->request->post['config_article_additional_width'] || !$this->request->post['config_article_additional_height']) {
			$this->error['image_article_additional'] = $this->language->get('error_image_article_additional');
		}
		
		if (!$this->request->post['config_article_related_width'] || !$this->request->post['config_article_related_height']) {
			$this->error['image_article_related'] = $this->language->get('error_image_article_related');
		}
		/*general*/ 
		if (!$this->error) {
			return true;
		} else {
			return false;
		}	
	}	
		
	
	public function uninstall_module(){
		$this->load->model('news/install');
		$this->model_news_install->delete_module_setting();	
		$this->model_news_install->uninstall_module();	
		$this->session->data['success']='Success: Successfully drop Blog database!';
		$this->redirect($this->url->link('extension/module','token='.$this->session->data['token'], 'SSL'));
	}		
	public function optimize() {
		$this->load->model('news/install');
		$this->model_news_install->optimize();
		$this->session->data['success']='Success: Successfully Optimize News/Blog database!';
		$this->redirect($this->url->link('extension/module','token='.$this->session->data['token'], 'SSL'));
	}		
	public function empty_db() {
		$this->load->model('news/install');
		$this->model_news_install->empty_db();
		$this->model_news_install->delete_module_setting();
		$this->model_news_install->uninstall_module();	
		$this->session->data['success']='Success: Successfully empty Blog database!';
		$this->redirect($this->url->link('extension/module','token='.$this->session->data['token'], 'SSL'));
	}	
	public function drop_db(){
		$this->load->model('news/install');
		$this->model_news_install->drop_db();
		$this->model_news_install->delete_module_setting();
		$this->model_news_install->uninstall_module();
		//$this->model_news_install->delete_news_setting();	
		$this->session->data['success']='Success: Successfully drop Blog database!';
		$this->redirect($this->url->link('extension/module','token='.$this->session->data['token'], 'SSL'));
	}	
	public function uninstall() {
		$this->load->model('news/install');
		$this->model_news_install->uninstall();
	}
	public function install_sample(){
		$this->load->model('news/install');
		$this->model_news_install->installSampleNews();
		$this->session->data['success']='Success: Successfully installed sample database!';
		$this->redirect($this->url->link('module/article_all_settings/settings','token='.$this->session->data['token'], 'SSL'));
	}	
	public function hide_sample(){
		$this->load->model('news/install');
		$this->model_news_install->hideSampleNews();
		$this->redirect($this->url->link('module/article_all_settings/settings','token='.$this->session->data['token'], 'SSL'));
	}
}
?>