Author: SamPeng (sampeng87@gmail.com)
Inheritance: extends Administrator
Exemple #1
0
 /**
  * add action notes
  *
  * @author                                  youzhao.zxw<*****@*****.**>
  * @param   string  $tableName              target table name
  * @param   string  $action                 edit action
  * @param   array   $newRecordAttributes    new record attributes
  * @param   array   $oldRecordAttributs     old record attributes
  * @return  array                           add action notes result
  */
 public static function addActionNotes($tableName, $action, $newRecordAttributes, $oldRecordAttributs)
 {
     $infoAction = new AdminAction();
     $infoAction->action_type = $action;
     $infoAction->target_table = $tableName;
     $infoAction->target_id = $newRecordAttributes['id'];
     if (!$infoAction->save()) {
         $resultInfo['status'] = CommonService::$ApiResult['FAIL'];
         $resultInfo['detail'] = $infoAction->getErrors();
         return $resultInfo;
     } else {
         if (!empty($oldRecordAttributs)) {
             $diffAttributeArr = self::compareRecord($oldRecordAttributs, $newRecordAttributes);
             foreach ($diffAttributeArr as $diffInfo) {
                 $actionHistory = new AdminHistory();
                 $actionHistory->action_field = $diffInfo[0];
                 $actionHistory->adminaction_id = $infoAction->id;
                 $actionHistory->old_value = $diffInfo[1];
                 $actionHistory->new_value = $diffInfo[2];
                 if (!$actionHistory->save()) {
                     $resultInfo['status'] = CommonService::$ApiResult['FAIL'];
                     $resultInfo['detail'] = $actionHistory->getErrors();
                     return $resultInfo;
                 }
             }
         }
     }
     $resultInfo['status'] = CommonService::$ApiResult['SUCCESS'];
     $resultInfo['detail'] = array('id' => $infoAction->id);
     return $resultInfo;
 }
Exemple #2
0
 /**
  * 新增一条管理员操作记录
  * @param type $attr
  * @return boolean
  */
 public static function add($attr)
 {
     if (empty($attr)) {
         return false;
     }
     $modelAA = new AdminAction();
     $modelAA->attributes = $attr;
     if ($modelAA->save()) {
         return true;
     }
     return false;
 }
 public function _initialize()
 {
     parent::_initialize();
     $this->assign($this->tags_style());
     $this->VideoDB = D('Home.Video');
     $this->InfoDB = D('Home.Info');
 }
Exemple #4
0
 /**
  * @return void
  */
 function action()
 {
     parent::action();
     if ($this->ok) {
         Serveur::getInstance()->stopInstance();
     }
 }
 function action()
 {
     parent::action();
     if ($this->ok) {
         $this->sendFreeText(Serveur::getInstance());
     }
 }
 public function _initialize()
 {
     parent::_initialize();
     //RBAC 验证接口初始化
     Vendor('Common.Tree');
     //导入通用树型类
 }
 public function _initialize()
 {
     parent::_initialize();
     $this->VideoDB = D('Admin.Video');
     $this->UserVDB = D('Admin.Userview');
     $this->CommDB = D('Admin.Comment');
 }
 public function _initialize()
 {
     parent::_initialize();
     C('TMPL_FILE_NAME', './views/collection/..');
     $this->CModel = D('Admin.CustomCollect');
     $this->RModel = D('Admin.ColRun');
 }
 public function _initialize()
 {
     parent::_initialize();
     C('TMPL_FILE_NAME', './views/tools/..');
     //模板目录
     $this->DCModel = D('Admin.Datacheck');
 }
 public function _initialize()
 {
     parent::_initialize();
     $this->SpecDB = D('Admin.Special');
     $this->VideoDB = D('Admin.Video');
     $this->InfoDB = D('Admin.Info');
 }
    public function __construct(){
        parent::__construct();

        $this->_a = $this->getParam('a');
        $this->_m = $this->getParam('m');
        $this->assign('a', $this->_a);
        $this->assign('m', $this->_m);
        $this->_p = $this->getParam('p')?$this->getParam('p'):1;
        $this->assign('p', $this->_p);
        
        $this->_model = loadModel('Admin.Rebate');
        
        $this->_keyword = $this->getParam('keyword');
        $this->_createtime = $this->getParam('createtime');
        $this->_status = $this->getParam('status');
        $this->_gendar = $this->getParam('gendar');
        $this->_level = $this->getParam('level');
        $this->_channel = $this->getParam('channel'); 
        $this->_id = $this->getParam('id');
        $this->_openid = $this->getParam('openid');
        $this->_end_date = $this->getParam('end_date');
        
        $this->_param = array(
            'keyword'=>$this->_keyword ,
            'createtime'=>$this->_createtime,
            'end_date'=>$this->_end_date,
            'status' => $this->_status,
            'gendar' => $this->_gendar,
            'level'=>$this->_level,
            'channel'=>$this->_channel
        );
        $this->assign('webdata', $this->_param);
        
       
    }
 public function _initialize()
 {
     parent::_initialize();
     $this->UserDB = D('Admin.User');
     $this->UserVDB = D('Admin.Userview');
     $this->GbookDB = D('Admin.Gbook');
     $this->CommDB = D('Admin.Comment');
 }
 protected function _initialize()
 {
     if (!self::$init) {
         self::$init = true;
         //标记已经进入初始化,否则new AdminAction将陷入死递归
         define('TH_VERSION', '1.1.3');
         //所有action初始化代码放在这个大括号内部,否则下面的AdminAction实例化时又将重复执行一次初始化代码,注意不同功能代码可能需要一定的顺序
         ///////自定义扩展区///////////////
         ///////cookie初始化区域///////////
         if (C('COOKIE_PATH') == '/') {
             C('COOKIE_PATH', __ROOT__);
         }
         if (C('COOKIE_PREFIX') == '') {
             $prefix = trim(__ROOT__ . '_', '/\\');
             C('COOKIE_PREFIX', $prefix);
         }
         $listapp = new AdminAction();
         $list = $listapp->listAPP();
         if ($list == false) {
             $this->assign('noapp', "<span>还没有添加任何项目,或者applist.xml文件读取异常</span>");
             cookie('config_path', '');
             cookie('base_dir', '');
             cookie('app_name', '暂无');
             cookie('app_index', '暂无');
             cookie('app_url', '');
         } else {
             $this->assign('listapp', $list);
             if (cookie('switch') != 'on' && (!cookie('config_path') || !cookie('base_dir'))) {
                 $default = $list[0];
                 //cookie设置
                 cookie('config_path', CheckConfig::dirModifier($default['path']) . 'Conf/config.php');
                 cookie('base_dir', CheckConfig::dirModifier($default['path']));
                 cookie('app_name', $default['name']);
                 cookie('app_index', $default['index']);
                 cookie('app_url', $default['url']);
             }
         }
         cookie('think_path', CheckConfig::dirModifier(THINK_PATH));
         cookie('tp_helper', CheckConfig::dirModifier(APP_PATH));
         cookie('version', THINK_VERSION);
         ///////include模板变量分配区域/////////
         $this->include_assign();
     }
 }
 /**
  * Check that the parameter is correct.
  */
 function validate()
 {
     // let's make sure that the "page" parameter has a sane value
     // and that it is not below 0
     $val = new IntegerValidator();
     $this->_page = $this->_request->getValue("page");
     if (!$val->validate($this->_page) || $this->_page < 0) {
         $this->_page = 1;
     }
     // run the real validation stuff...
     return parent::validate();
 }
    /**
     * 构造方法,初始化
     */
    public function __construct() {
        parent::__construct();
        $this->_name = $this->getParam('cname');
        $this->_from = $this->getParam('from');
        $this->_to = $this->getParam('to');
        $this->_status = $this->getParam('cstatus');
        $this->_p = $this->getParam('p') ? intval($this->getParam('p')) : 0;
        $this->_openid = $this->getParam('copenid');
        $this->_usopenid = $this->getParam('openid');

        $this->_order_id = $this->getParam('order_id');
        $this->_start_date = $this->getParam('start_date');
        $this->_end_date = $this->getParam('end_date');
        $this->_status1 = $this->getParam('status1');
        $this->_status2 = $this->getParam('status2');
        $this->_state = $this->getParam('state');
        $this->_sex = $this->getParam('sex');
        $this->_grade = $this->getParam('grade');
        $this->_channel = $this->getParam('channel');
        $this->_create_time = $this->getParam('create_time');

        $this->_Model = loadModel('Admin.Card');
        $this->_IndexModel = loadModel('Index.Cardto');
        $this->_Channel = loadModel('Admin.Channel');
        $this->_ParModel = loadModel('Admin.Partner');
        $this->_CommonModel = loadModel('Common');
        
        $this->_a = $this->getParam('a');
        $this->_m = $this->getParam('m');
        $this->assign('a', $this->_a);
        $this->assign('m', $this->_m);
        
        $this->_param = array(
            'name' => $this->_name,
            'openid' => $this->_openid,
            'cfrom' => $this->_from,
            'cto' => $this->_to,
            'state' => $this->_state,
            'sex' => $this->_sex,
            'grade' => $this->_grade,
            'code' => $this->getParam('code'),
            'end_time' => $this->getParam('end_time'),
            'sub_status' => $this->getParam('sub_status'),
            'channel' => $this->getParam('channel'),
            'card_type' => $this->getParam('card_type'),
            'order_id' => $this->_order_id,
            'status1' => $this->_status1,
            'status2' => $this->_status2,
            'create_time' => $this->_create_time,
        );
        $this->assign('webdata', $this->_param);
    }
 function validate()
 {
     if (!parent::validate()) {
         $resources = new GalleryResources();
         $resource = $resources->getResource($this->_request->getValue("resourceId"), $this->_blogInfo->getId());
         if (!$resource) {
             $this->setValidationErrorView(new AdminResourcesListView($this->_blogInfo));
             $this->setCommonData();
             return false;
         }
         $this->_view->setValue("resource", $resource);
         return false;
     }
     return true;
 }
 function _initialize()
 {
     parent::_initialize();
     //RBAC 验证接口初始化
     header("Content-type: text/html;charset=utf-8");
     set_time_limit(0);
     //不超时
     ini_set('memory_limit', '512M');
     $this->config = array('path' => C('DB_BACKUP'), 'isCompress' => 0, 'isDownload' => 0);
     $this->dbName = C('DB_NAME');
     //当前数据库名称
     $this->model = new Model();
     //$sql = 'set interactive_timeout=24*3600';      //空闲多少秒后 断开链接
     //$this->model>execute($sql);
 }
    public function __construct() {
        parent::__construct();
        $this->_a = $this->getParam('a');
        $this->_m = $this->getParam('m');
        $this->_param = $this->getParam();
        $this->assign('a', $this->_a);
        $this->assign('m', $this->_m);

        $this->_p = $this->getParam('p') ? intval($this->getParam('p')) : 0;
        $this->_status = $this->getParam('status');
        $this->_keyword = $this->getParam('keyword');
        $this->_name = $this->getParam('name');
        $this->_id = $this->getParam('id');

        $this->_Model = loadModel('Admin.Channel');

        $webdata = array(
            'keyword'=>$this->_keyword,
            'status' => $this->_status,
        );
        $this->assign('webdata', $webdata);
    }
 /**
  * Validates that the information we've just received from the blog settings
  * form is valid... We have to be really sure about this one!!!
  */
 function validate()
 {
     // if all correct, we can proceed
     $this->_userPassword = trim($this->_request->getValue("userSettingsPassword"));
     $this->_userConfirmPassword = trim($this->_request->getValue("confirmPassword"));
     $valid = parent::validate();
     // check that the password is correct and confirm it
     if ($this->_userPassword != "") {
         $passwordVal = new PasswordValidator();
         if (!$passwordVal->validate($this->_userPassword)) {
             $this->_form->setFieldValidationStatus("userSettingsPassword", false);
             $this->setCommonData(true);
             return false;
         }
         if ($this->_userPassword != $this->_userConfirmPassword) {
             $this->_form->setFieldValidationStatus("confirmPassword", false);
             $this->setCommonData(true);
             return false;
         }
     }
     return $valid;
 }
Exemple #20
0
        $ctr = 1;
    }
    if ($ctr == "") {
        if (isset($_POST['isFreeShipping'])) {
            $isFreeShipping = 1;
        } else {
            $isFreeShipping = 0;
        }
        $_POST = sanitize($_POST);
        $coupons = $_POST;
        settype($coupons, 'object');
        $coupons->isFreeShipping = $isFreeShipping;
        Coupon::updateCoupon($coupons);
        $success = "Copun Code Successfully Saved!";
        $updates = 'Add new coupon code content';
        AdminAction::addAdminAction($_SESSION['admin_name'], $updates);
    }
}
?>
<!DOCTYPE html>  
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-us" lang="en-us">  
<head>
  <meta http-equiv="content-type" content="text/html; charset=utf-8" />
  <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
  <link rel="stylesheet" type="text/css" media="screen" href="<?php 
echo $ROOT_URL;
?>
_admin/_assets/css/core3.css" /> 
  <link rel="stylesheet" type="text/css" media="screen" href="<?php 
echo $ROOT_URL;
?>
 public function _initialize()
 {
     parent::_initialize();
     //RBAC 验证接口初始化
 }
 public function _initialize()
 {
     parent::_initialize();
     $this->CommDB = D('Admin.Comment');
 }
 /**
  * 控制器初始化
  * @author Terry <*****@*****.**>
  * @date 2013-04-18
  */
 public function _initialize()
 {
     parent::_initialize();
 }
 public function _initialize()
 {
     parent::_initialize();
     $this->GbookDB = D('Admin.Gbook');
 }
Exemple #25
0
 public static function record($type, $logid = 0)
 {
     if ($type == '') {
         return false;
     }
     if (Yii::app()->user->isGuest) {
         return false;
     }
     $uid = Yii::app()->user->id;
     $desc = GroupPowers::getDesc('admin', $type);
     if ($desc == '') {
         return false;
     }
     $data = array('uid' => $uid, 'logid' => $logid, 'classify' => $type, 'description' => $desc, 'ip' => ip2long(Yii::app()->request->userHostAddress), 'cTime' => time());
     $model = new AdminAction();
     $model->attributes = $data;
     if ($model->save()) {
         return true;
     } else {
         return false;
     }
 }
 public function _initialize()
 {
     parent::_initialize();
     $this->file_path = HCMS_PATH . 'Lib' . DIRECTORY_SEPARATOR . 'Common' . DIRECTORY_SEPARATOR . 'Oauth' . DIRECTORY_SEPARATOR;
     $this->oauth = new Oauth($this->file_path);
 }
 public function _initialize()
 {
     parent::_initialize();
     $this->name = $this->_name;
 }
 public function __construct() {
     parent::__construct();
     $this->_Model = loadModel("Admin.Manage");
 }
 public function _initialize()
 {
     parent::_initialize();
     $this->SlideDB = D('Admin.Slide');
 }
 public function _initialize()
 {
     parent::_initialize();
     $this->UserVDB = D('Admin.Userview');
 }