Example #1
0
 function detail_info($param_id)
 {
     //获取该项记录集合
     $users = $this->app->model('users');
     $roles = $this->app->model('roles');
     $workgroup = $roles->getList('*');
     $sdf_users = $users->dump($param_id);
     if ($_POST) {
         $_POST['pam_account']['account_id'] = $param_id;
         if ($sdf_users['super'] == 1) {
             $users->editUser($_POST);
             //echo "修改成功";
         } elseif ($_POST['super'] == 0 && $_POST['role']) {
             foreach ($_POST['role'] as $roles) {
                 $_POST['roles'][] = array('role_id' => $roles);
             }
             $users->editUser($_POST);
             $users->save_per($_POST);
         } else {
             echo "<script>alert('请至少选择一个工作组')</script>";
         }
     }
     //返回无内容信息
     if (empty($sdf_users)) {
         return '无内容';
     }
     $hasrole = $this->app->model('hasrole');
     foreach ($workgroup as $key => $group) {
         $rolesData = $hasrole->getList('*', array('user_id' => $param_id, 'role_id' => $group['role_id']));
         if ($rolesData) {
             $check_id[] = $group['role_id'];
             $workgroup[$key]['checked'] = "true";
         } else {
             $workgroup[$key]['checked'] = "false";
         }
     }
     $ui = new base_component_ui($this);
     $html .= $ui->form_start();
     //foreach($arrGroup as  $arrVal){  $html .= $ui->form_input($arrVal); }
     $render = $this->app->render();
     $render->pagedata['workgroup'] = $workgroup;
     $render->pagedata['account_id'] = $param_id;
     $render->pagedata['name'] = $sdf_users['name'];
     $render->pagedata['super'] = $sdf_users['super'];
     $render->pagedata['status'] = $sdf_users['status'];
     if (!$sdf_users['super']) {
         $render->pagedata['per'] = $users->detail_per($check_id, $param_id);
     }
     $html .= $render->fetch('users/users_detail.html');
     $html .= $ui->form_end();
     return $html;
 }
Example #2
0
    /**
     * 重新生成图片入口
     * @param nulll
     * @return string html js刷新finder
     */
    function rebuild()
    {
        $ui = new base_component_ui($this);
        if ($_POST['size']) {
            $queue = app::get('base')->model('queue');
            parse_str($_POST['filter'], $filter);
            $data = array('queue_title' => app::get('image')->_('重新生成图片'), 'start_time' => time(), 'params' => array('filter' => $filter, 'watermark' => $_POST['watermark'], 'size' => $_POST['size'], 'queue_time' => time()), 'worker' => 'image_rebuild.run');
            $queue->insert($data);
            header('Content-Type:text/jcmd; charset=utf-8');
            echo '{success:"' . app::get('image')->_('执行成功') . '"}';
        } else {
            $html .= $ui->form_start(array('id' => 'rebuild_form', 'method' => 'post'));
            $size = array('L' => app::get('image')->_('大图'), 'M' => app::get('image')->_('中图'), 'S' => app::get('image')->_('小图'));
            foreach ($size as $k => $v) {
                $html .= $ui->form_input(array('title' => app::get('image')->_('生成') . $v, 'type' => 'checkbox', 'name' => 'size[]', 'value' => $k, 'checked' => 'checked'));
            }
            $html .= '<tr><td colspan="2" style="height:1px;background:#ccc;overflow:hidden;padding:0"></td><tr>';
            $filter = $_POST;
            unset($filter['_finder']);
            $filter = htmlspecialchars(utils::http_build_query($filter));
            $html .= $ui->form_input(array('title' => app::get('image')->_('使用水印'), 'type' => 'bool', 'name' => 'watermark', 'value' => 1));
            $html .= '<tr><td><input type="hidden" name="filter" value="' . $filter . '" /></td></tr>';
            $html .= $ui->form_end();
            echo $html;
            echo <<<EOF
<script>
   \$('rebuild_form').store('target',{
        
        onComplete:function(){
                 \$('rebuild_form').getParent('.dialog').retrieve('instance').close();
             
        }
   
   });

</script>
EOF;
        }
    }
Example #3
0
 function chkpassword()
 {
     $account_id = $this->user->get_id();
     $users = $this->app->model('users');
     $sdf = $users->dump($account_id, '*', array(':account@pam' => array('*'), 'roles' => array('*')));
     $old_password = $sdf['account']['login_password'];
     $filter['account_id'] = $account_id;
     $filter['account_type'] = pam_account::get_account_type($this->app->app_id);
     $use_pass_data['login_name'] = $sdf['account']['login_name'];
     $use_pass_data['createtime'] = $sdf['account']['createtime'];
     $filter['login_password'] = pam_encrypt::get_encrypted_password(trim($_POST['old_login_password']), pam_account::get_account_type($this->app->app_id), $use_pass_data);
     $pass_row = app::get('pam')->model('account')->getList('account_id', $filter);
     if ($_POST) {
         $this->begin();
         if (!$pass_row) {
             $this->end(false, app::get('desktop')->_('原始密码不正确'));
         } elseif (!(strlen($_POST['new_login_password']) >= 6 && preg_match("/\\d+/", $_POST['new_login_password']) && preg_match("/[a-zA-Z]+/", $_POST['new_login_password']))) {
             $this->end(false, app::get('desktop')->_('密码必须同时包含字母及数字且长度不能小于6!'));
         } elseif ($_POST['new_login_password'] != $_POST[':account@pam']['login_password']) {
             $this->end(false, app::get('desktop')->_('两次密码不一致'));
         } elseif ($sdf['account']['login_name'] == $_POST['new_login_password']) {
             $this->end(false, app::get('desktop')->_('用户名与密码不能相同'));
         } else {
             $_POST['pam_account']['account_id'] = $account_id;
             $_POST['pam_account']['login_password'] = pam_encrypt::get_encrypted_password(trim($_POST['new_login_password']), pam_account::get_account_type($this->app->app_id), $use_pass_data);
             $users->save($_POST);
             $this->end(true, app::get('desktop')->_('密码修改成功'));
         }
     }
     $ui = new base_component_ui($this);
     $arrGroup = array(array('title' => app::get('desktop')->_('原始密码'), 'type' => 'password', 'name' => 'old_login_password', 'required' => true), array('title' => app::get('desktop')->_('新密码'), 'type' => 'password', 'name' => 'new_login_password', 'required' => true), array('title' => app::get('desktop')->_('再次输入新密码'), 'type' => 'password', 'name' => ':account@pam[login_password]', 'required' => true));
     $html .= $ui->form_start(array('method' => 'POST'));
     foreach ($arrGroup as $arrVal) {
         $html .= $ui->form_input($arrVal);
     }
     $html .= $ui->form_end();
     echo $html;
     //return $html;
 }
Example #4
0
    function tag_edit($id)
    {
        $this->url = 'index.php?app=' . $_GET['app'] . '&ctl=' . $_GET['ctl'];
        $render = app::get('desktop')->render();
        //return $render->fetch('admin/tag/detail.html',$this->app->app_id);
        $mdl_tag = app::get('desktop')->model('tag');
        $tag = $mdl_tag->dump($id, '*');
        $ui = new base_component_ui(null, app::get('desktop'));
        $html = $ui->form_start(array('action' => $this->url . '&act=new_mormal_tag' . $ex_p, 'id' => 'tag_form_add', 'method' => 'post'));
        $html .= $ui->form_input(array('title' => app::get('desktop')->_('标签名'), 'name' => 'tag_name', 'value' => $tag['tag_name']));
        $html .= $ui->form_input(array('title' => app::get('desktop')->_('标签备注'), 'name' => 'tag_abbr', 'value' => $tag['tag_abbr']));
        $html .= $ui->form_input(array('title' => app::get('desktop')->_('标签颜色'), 'type' => 'color', 'name' => 'tag_bgcolor', 'value' => $tag['tag_bgcolor']));
        //$html .= $ui->form_input(array('title'=>app::get('desktop')->_('标签字体色'),'type'=>'color','name'=>'tag_fgcolor','value'=>$tag['tag_fgcolor']));
        $html .= '<input type="hidden" name="tag_id" value="' . $id . '"/>';
        $html .= '<input type="hidden" name="app_id" value="' . $tag['app_id'] . '"/>';
        $html .= '<input type="hidden" name="type" value="' . $tag['tag_type'] . '"/>';
        $html .= $ui->form_end();
        echo $html;
        echo <<<EOF
<script>
window.addEvent('domready', function(){
    \$('tag_form_add').store('target',{
        onComplete:function(){
            
           if(window.finderGroup['{$_GET['finder_id']}'])
            window.finderGroup['{$_GET['finder_id']}'].refresh();
            
            if(\$('tag_form_add').getParent('.dialog'))
            \$('tag_form_add').getParent('.dialog').retrieve('instance').close();
        }
    });
});
</script>
EOF;
    }
Example #5
0
 function chkpassword()
 {
     $account_id = $this->user->get_id();
     $users = $this->app->model('users');
     $sdf = $users->dump($account_id, '*', array(':account@pam' => array('*'), 'roles' => array('*')));
     $old_password = $sdf['account']['login_password'];
     if ($_POST) {
         $this->begin();
         if (md5(trim($_POST['old_login_password'])) != $old_password) {
             //echo "旧密码不正确";
             $this->end(false, '旧密码不正确');
         } elseif ($_POST['new_login_password'] != $_POST[':account@pam']['login_password']) {
             //echo "两次密码不一致";
             $this->end(false, '两次密码不一致');
         } else {
             $_POST['pam_account']['account_id'] = $account_id;
             $_POST['pam_account']['login_password'] = md5(trim($_POST['new_login_password']));
             $users->save($_POST);
             //echo "密码修改成功";
             $this->end(true, '密码修改成功');
         }
     }
     $ui = new base_component_ui($this);
     $arrGroup = array(array('title' => '旧密码', 'type' => 'password', 'name' => 'old_login_password', 'required' => true), array('title' => '新密码', 'type' => 'password', 'name' => 'new_login_password', 'required' => true), array('title' => '再次输入新密码', 'type' => 'password', 'name' => ':account@pam[login_password]', 'required' => true));
     $html .= $ui->form_start();
     foreach ($arrGroup as $arrVal) {
         $html .= $ui->form_input($arrVal);
     }
     $html .= $ui->form_end();
     echo $html;
     //return $html;
 }