Skip to content

Commit

Permalink
分享
Browse files Browse the repository at this point in the history
  • Loading branch information
blackstoneblackstone committed Jun 3, 2015
1 parent 41c7945 commit 98072bb
Show file tree
Hide file tree
Showing 13,876 changed files with 182,416 additions and 0 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
42 changes: 42 additions & 0 deletions Application/Adminc/Common/function.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<?php


/**
* TODO e.wesambo.com
* @param $count 要分页的总记录数
* @param int $pagesize 每页查询条数
* @return \Think\Page
*/
function getpage($count, $pagesize = 10) {
$p = new Think\Page($count, $pagesize);
$p->setConfig('header', '<li class="rows">共<b>%TOTAL_ROW%</b>条记录&nbsp;第<b>%NOW_PAGE%</b>页/共<b>%TOTAL_PAGE%</b>页</li>');
$p->setConfig('prev', '上一页');
$p->setConfig('next', '下一页');
$p->setConfig('last', '末页');
$p->setConfig('first', '首页');
$p->setConfig('theme', '%FIRST%%UP_PAGE%%LINK_PAGE%%DOWN_PAGE%%END%%HEADER%');
$p->lastSuffix = false;//最后一页不显示为总页数
return $p;
}

function getPageMode($mode){
$array=array('上下翻页','上下惯性翻页','左右翻页','左右惯性翻页','左右连续翻页');
return $array[$mode];
}
function getCateName($mode){

$array=array('tpType'=>'图片','bgType'=>'背景','musType'=>'音乐','scene_type'=>'场景' );
return $array[$mode];
}
function getUserName($id){
$userinfo=M('users')->where("userid_int='$id'")->field('uname,email_varchar')->find();

return $userinfo['uname']?$userinfo['uname']:$userinfo['email_varchar'];
}

function getSceneType($value){
$title=M('cate')->where("value='$value'")->getField('title');

return $title;

}
1 change: 1 addition & 0 deletions Application/Adminc/Common/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

7 changes: 7 additions & 0 deletions Application/Adminc/Conf/config.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?php
return array(
//'配置项'=>'配置值'
'TEST_ADMIN_ID'=>2,
'URL_MODEL'=>0
// URL_MODEL => 3,
);
1 change: 1 addition & 0 deletions Application/Adminc/Conf/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

98 changes: 98 additions & 0 deletions Application/Adminc/Controller/AdvController.class.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
<?php
namespace Adminc\Controller;
use Adminc\Controller\BaseController;
class AdvController extends BaseController {
public function index(){
if(!defined('VIRIFY')){
aboutaa();
}

$m = M('scenepage');
$where=array();
$count = $m->where($where)->count();
$p = getpage($count,16);
$list = $m->field(true)->where($where)->order('USERID ASC')->limit($p->firstRow, $p->listRows)->select();
$this->assign('select', $list);
$this->assign('page', $p->show());

// var_export($list);
//echo C('TEST_ADMIN_ID');


$this->display();
}
public function e(){
$m = M('scenepagesys');
if(IS_POST){
$where['pageid_bigint']=I('post.id');
$update_arr=I('post.user');

if(I('post.userpassword')){
$update_arr['USERPASSWORD']=md5(I('post.userpassword'));
}

$m->where($where)->save($update_arr);

$this->success ( '操作成功','/adminc.php?c=sys&a=admin' ); //U ( 'sys/admin' )

}else{
$where['pageid_bigint']=I('get.id',2);
$userinfo= $m->where($where)->find();


$this->assign('user', $userinfo);


$this->display();
}
}
public function getoe(){


}

public function add(){
$m = M('scenepage');

if(session('adminRole')==2 && session('adminUserid') != $_REQUEST['id']){
$this->error ( '您没有编辑其它管理员的权限', '/adminc.php?c=sys&a=admin' );
}
if(IS_POST){

$update_arr=I('post.user');

if(I('post.userpassword')){
$update_arr['USERPASSWORD']=md5(I('post.userpassword'));
}
$update_arr['REGTIME']=time();
$update_arr['USERIS']=1;

$m->add($update_arr);

$this->success ( '操作成功','/adminc.php?c=sys&a=admin' ); //U ( 'sys/admin' )

}else{


$this->assign('isAdd', 1);
$this->assign('user', array());


$this->display('edit');
}
}
public function del(){
if(session('adminRole')==2 ){
$this->error ( '您没有编辑其它管理员的权限', '/adminc.php?c=sys&a=admin' );
}

$m = M('scenepage');
$m->where('userid='.$_REQUEST['id'])->delete();

$this->success ( '操作成功', '/adminc.php?c=sys&a=admin' );

}



}
55 changes: 55 additions & 0 deletions Application/Adminc/Controller/AuthController.class.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
<?php
namespace Adminc\Controller;
use Think\Controller;
class AuthController extends Controller {
public function login(){
$sysinfo=M('sys')->order('id asc')->find();
$this->assign('sys', $sysinfo);

if (IS_POST ) {
$datas = $_POST;
$password_varchar = md5($datas['password']);
$userinfo['USERNAME'] = $datas['username'];

$User = M('admin');


$returnInfo=$User->where($userinfo)->find();

if($returnInfo){
if($returnInfo['userpassword']==$password_varchar){
if($returnInfo['useris']==1){
session('adminUser',$returnInfo["username"]);
session('adminUserid',$returnInfo["userid"]);
session('adminRole',$returnInfo["role"]);

$User->where('USERID='.$returnInfo['userid'])->save(array('LOGINTIME'=>time(),'LOGINIP'=>$_SERVER['REMOTE_ADDR'],'LOGINNUM'=>$returnInfo[LOGINNUM]+1));
echo '{"status":1,"info":""}'; exit;
}else{
$this->error('账号已被禁','?c=auth&a=login',3);
}


}else{
$this->error('密码不对','?c=auth&a=login',3);
}

}else{
$this->error('登录失败','?c=auth&a=login',3);
}
}else{

$this->display();
}

}

public function logout(){
session('adminUser',null);
session('adminUserid',null);
session('adminRole',null);
cookie('adminUser',null);
$this->success ( '安全退出', '/adminc.php' );
//redirect('login',20,'安全退出!');
}
}
34 changes: 34 additions & 0 deletions Application/Adminc/Controller/BaseController.class.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?php
namespace Adminc\Controller;
use Think\Controller;
class BaseController extends Controller {
protected function _initialize(){
if(!defined('VIRIFY')){
virifylocal();
}

$this->assign('adminRole', session('adminRole'));
if(!session('adminUser')){
//$this->redirect('auth/login');
header('Location: ' . '/adminc.php?c=auth&a=login');
}
else {
return true;
}

}
protected function all_insert($name = '', $back = '/index') {
$name = $name ? $name : MODULE_NAME;
$db = D ( $name );
if ($db->create () === false) {
$this->error ( $db->getError () );
} else {
$id = $db->add ();
if ($id) {
$this->success ( '操作成功', U ( MODULE_NAME . $back ) );
} else {
$this->error ( '操作失败', U ( MODULE_NAME . $back ) );
}
}
}
}
87 changes: 87 additions & 0 deletions Application/Adminc/Controller/CateController.class.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
<?php
namespace Adminc\Controller;
use Adminc\Controller\BaseController;
class CateController extends BaseController {
public function index(){
if(!defined('VIRIFY')){
aboutaa();
}

$m = M('cate');
$type=I('get.filetype','bgType');
$where=array('type'=>$type);
$count = $m->where($where)->count();
$p = getpage($count,16);
$list = $m->field(true)->where($where)->order('create_time desc')->limit($p->firstRow, $p->listRows)->select();

$this->assign('select', $list);
$this->assign('page', $p->show());
$this->assign('type', $type);

$this->display();
}
public function del(){
if(session('adminRole')==2 ){
$this->error ( '您没有相关权限', U ( 'user/index' ) );
}
$m = M('cate');
$m->where('userid_int='.$_REQUEST['id'])->delete();
$this->success ( '操作成功', '/adminc.php?c=user'); // U ('user/index')

}
public function add(){
$m = M('cate');

if(IS_POST){
$update_arr=I('post.user');


$update_arr['create_time'] =time();

$update_arr['type']= I('post.filetype');

$new_id= $m->add($update_arr);

$m->where('id='.$new_id)->save(array('value'=>$new_id));

$this->success ( '操作成功', '/adminc.php?c=cate&filetype='.$update_arr['type'] ); //U ( 'cate/index' )

}else{

$this->assign('filetype_int', I('get.type'));

$this->assign('user', array());

$this->display('e');
}
}
public function e(){
$m = M('cate');

if(IS_POST){
$where['id']=I('post.id');
$update_arr=I('post.user');



$m->where($where)->save($update_arr);



$this->success ( '操作成功', '/adminc.php?c=cate&a=e&id='.I('post.id') ); //U ( 'cate/index' )

}else{
$where['fileid_bigint']=I('get.id');
$userinfo= $m->where($where)->find();


$this->assign('filetypelist', upfilesClass($userinfo['filetype_int']));

$this->assign('user', $userinfo);
$this->assign('filetype_int', $userinfo['filetype_int']);


$this->display();
}
}
}
Loading

0 comments on commit 98072bb

Please sign in to comment.