<?php



/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: 			*/



// +----------------------------------------------------------------------+



// | PHP version 4/5                                                      |



// +----------------------------------------------------------------------+



// | Copyright (c) 2004-2010 ARMIA INC                                    |



// +----------------------------------------------------------------------+



// | This source file is a part of iScripts VistaCart                     |



// +----------------------------------------------------------------------+



// | Authors: Jipson<jipson.thomas@armiasystems.com>             		  |



// +----------------------------------------------------------------------+



App::import('Sanitize');



class BlogController extends AppController



{
//var $name = "admin";

 var $helpers = array('Html', 'Form','Pagination','Javascript','Ajax','Csv','xls');

	var $components = array ('Pagination','Catmenu','History','Email'); // Added

	var $uses = array('User','Setting','Country','Cmspage','Category','Newsletter','Newsletteruser','Statecode');

	var $paginate = array('limit' => 25,'order' => array('User.uname' => 'asc'));
function index()

    {
    $this->layout = 'adm'; 
    }

     function beforeFilter()

    {

        if (isset($this->Setting) && !empty($this->Setting->table))

        {

             $this->Setting->load();

        }

		global $sitefolder;

		global $meta_description;

		global $meta_keywords;

		global $page_title;

		$cnfg 				=	Configure::read('Neutrino');

		$sitefolder			=	$cnfg["sitebasefolder"];

		$meta_description	=	$cnfg["meta_description"];

		$meta_keywords		=	$cnfg["meta_keywords"];

		$page_title			=	$cnfg["page_title"];

		global $style;

		$style				=	$cnfg["style"];

		$this->set('style', $style);

		$this->set('meta_description', $meta_description);

		$this->set('meta_keywords', $meta_keywords);

		$this->pageTitle = $page_title	;

		$this->set('cnfg',$cnfg);

		$this->paginate["limit"]=$cnfg["items_perpage"]; //Setting pagination limit per page.

		$this->set('sitefolder', $sitefolder);

		$httpHost	=	$_SERVER['HTTP_HOST'];

		$this->set('sitebase','http://'.$httpHost);

    }

	function beforeRender(){

				//$lst	=	$this->Catmenu->getCatList(1);

				//$this->set('catmenu', $lst);

		//Code Added By shyam for Category Menu Listing starts here..

		// $lst	=	$this->Category->findAll();
                $lst	=	$this->Category->findAll(null, NULL, 'Category.cname ASC', null, null);
		  if(empty($lst)===false)

		 {

			 foreach($lst as $det)

			 $menu_array[$det["Category"]["id"]] = array('name' => $det["Category"]["cname"],'parent' => $det["Category"]["parent_id"]);

			 $this->set('menu_array', $menu_array);

		 }

		//Code Added By shyam for Category Menu Listing ends here..
		$footer_links = $this->Cmspage->find('list',array('conditions' => array('Cmspage.type' => 'content','Cmspage.status' => 'Y')));
		$this->set('footerlinks', $footer_links);

	}

    function __validateLoginStatus($typ='A')

    {

           if($typ == 'A'){

				if($this->Session->check('Admin') == false)

				{

					$this->redirect(array('controller' => 'admins', 'action' => 'login'));

					 $this->Session->setFlash(__('The URL you\'ve followed requires you login.'));

				}

			}else{

				if($this->Session->check('Userlog') == false)

				{

					$this->redirect(array('controller' => 'users', 'action' => 'login'));

					 $this->Session->setFlash(__('The URL you\'ve followed requires you login.'));

				}

			}

    }

}// Class ends



?>