PHP Classes

File: application/models/admincp/redirects.php

Recommend this page to a friend!
  Classes of Minh Tien  >  Noblesse CMS  >  application/models/admincp/redirects.php  >  Download  
File: application/models/admincp/redirects.php
Role: Example script
Content type: text/plain
Description: Example script
Class: Noblesse CMS
Content management system with custom plugins
Author: By
Last change:
Date: 6 years ago
Size: 1,173 bytes
 

Contents

Class file image Download
<?php

function actionProcess()
{
   
$id=Request::get('id');

    if(!isset(
$id[0]))
    {
        return
false;
    }

   
$listID="'".implode("','", $id)."'";

   
$action=Request::get('action');

   
// die($action);

   
switch ($action) {
        case
'delete':
   
           
Redirect::remove($id);
            break;
           
        case
'enable':
   
           
Redirect::update($id,array(
               
'status'=>1
               
));
            break;

        case
'disable':
   
           
Redirect::update($id,array(
               
'status'=>0
               
));
            break;
       
    }
}

function
updateProcess($id)
{
   
$update=Request::get('update');

   
$valid=Validator::make(array(
       
'send.from_url'=>'min:1|slashes',
       
'send.to_url'=>'min:1|slashes',
       
'send.status'=>'slashes'
       
));

    if(!
$valid)
    {
        throw new
Exception("Error Processing Request: ".Validator::getMessage());
    }


   
Redirect::update($id,$update);
   
}

function
insertProcess()
{
   
$send=Request::get('send');

   
$valid=Validator::make(array(
       
'send.from_url'=>'min:1|slashes',
       
'send.to_url'=>'min:1|slashes',
       
'send.status'=>'slashes'
       
));

    if(!
$valid)
    {
        throw new
Exception("Error Processing Request: ".Validator::getMessage());
    }

    if(!
$id=Redirect::insert($send))
    {
        throw new
Exception("Error. ".Database::$error);
    }

}

?>

For more information send a message to info at phpclasses dot org.