Вход Регистрация
Файл: modules/admin/controllers/admin.php
Строк: 82
<?defined('SYSPATH') or die('<b>403<br />Запрет доступа</b>');

class 
Admin extends DAuth
{

public function 
action_index()
    {
        
        
$this->aut();
        
$this->admin(4);
        
        
$this->view->display("Главная страница",'','admin');

}
public function 
action_news()
    {
        
        
$this->aut();
        
$this->admin(4);
        
$new $this->model('news');
        
        
            switch(
$_GET['type'])
            {
                default:
                    
$this->view->display('Новости','','admin_news');
                break;

                case 
'insert':

                    
$title=$this->post('name');
                    
$msg=$this->post('news');

                    if(empty(
$title) || empty($msg))Errors::__echo("Ошибка добавления новости!");


                    
$new->insert($title,$msg);
                    
header('Location: '.URL.'admin/news');
                break;

                case 
'edit':
                    
$id=(int)$_GET['id'];
                    if(empty(
$id))Errors::__echo("Не выбрана новость!");
                    
$content=$new->edit($id);
                    
$this->view->display('Новости',$content,'admin_news_edit');

                break;
                case 
'delete':

                    
$id=(int)$_GET['id'];
                    if(empty(
$id))Errors::__echo("Ошибка удаления новости!");


                    
$new->delete($id);
                    
Header('Location: '.URL.'admin/news');

                break;

                case 
'edit_ok':

                    
$id=(int)$_GET['id'];
                    if(empty(
$id))Errors::__echo("Не выбрана новость!");
                    
$title=$this->post('title');

                    if(empty(
$title))Errors::__echo("Не введено название новости!");

                    
$msg=$this->post('msg');


                    
$new->edit_ok($id,$title,$msg);
                    
Header('Location: '.URL.'admin/news');

                break;

                case 
'add':

                    
$this->view->display('Новости','','add_news');

                break;

            }
        
        
        
    }



    public function 
action_reklama()
    {
        
$this->aut();
        
$this->admin(4);
        switch(
$_GET['type'])
        {
            default:
                
$this->view->display('Реклама','','admin_reklama_index');
            break;

            case 
'update':
                
$reklama $this->model('reklama');
                
$verh=$_POST['verh'];
                
$niz=$_POST['niz'];
                
$count=$_POST['count'];



                
$reklama->update($verh,$niz,$count);
                
header('Location: '.URL.'admin/reklama');
            break;
        }
        
        
    }

    
    
    public function 
action_contact()
    {
        
$this->aut();
        
$this->admin(4);
        switch(
$_GET['type'])
        {
            default:
                
$this->view->display('Админка - контакты','','admin_contact');
            break;

            case 
'update':
                
$cont $this->model('Contact');
                
$contact $this->post('verh',1);
                
                
$cont->update($contact);
                
header('Location: '.URL.'admin/contact');
            break;
        }
        
        
    }    
    
    
    public function 
action_password()
    {
        
$this->aut();
        
$this->admin(4);
        switch(
$_GET['type'])
        {
            default:
                
$this->view->display('Админка - контакты','','admin_password');
            break;

            case 
'update':
                
                
$pass $this->post('pass',1);
                
$p_pass $this->post('p_pass',1);
                if(
$pass != $p_pass)Errors::__echo('Пароли несовподают!');
                
$model_pass $this->model('Password');
                
$model_pass->update($pass);
                
header('Location: '.URL.'admin/password');
            break;
        }
        
        
    }    
}
Онлайн: 1
Реклама