Files
EasySoft-ZenTaoPMS/module/admin/control.php
wangyidong ff8ac1f30f * finish task #2246.
* code task #2252.
2015-05-12 11:14:46 +08:00

158 lines
4.3 KiB
PHP

<?php
/**
* The control file of admin module of ZenTaoPMS.
*
* @copyright Copyright 2009-2015 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com)
* @license ZPL (http://zpl.pub/page/zplv11.html)
* @author Chunsheng Wang <chunsheng@cnezsoft.com>
* @package admin
* @version $Id: control.php 4460 2013-02-26 02:28:02Z chencongzhi520@gmail.com $
* @link http://www.zentao.net
*/
class admin extends control
{
/**
* Index page.
* @access public
* @return void
*/
public function index()
{
$community = zget($this->config->global, 'community');
if(!$community or $community == 'na')
{
$this->view->bind = false;
$this->view->account = false;
$this->view->ignore = $community == 'na';
}
else
{
$this->view->bind = true;
$this->view->account = $community;
$this->view->ignore = false;
}
$this->app->loadLang('misc');
$this->view->title = $this->lang->admin->common;
$this->view->position[] = $this->lang->admin->index;
$this->display();
}
/**
* Ignore notice of register and bind.
*
* @access public
* @return void
*/
public function ignore()
{
$this->loadModel('setting')->setItem('system.common.global.community', 'na');
die(js::locate(inlink('index'), 'parent'));
}
/**
* Register zentao.
*
* @access public
* @return void
*/
public function register()
{
if($_POST)
{
$response = $this->admin->registerByAPI();
if($response == 'success')
{
$this->loadModel('setting')->setItem('system.common.global.community', $this->post->account);
echo js::alert($this->lang->admin->register->success);
die(js::locate(inlink('index'), 'parent'));
}
die($response);
}
$this->view->title = $this->lang->admin->register->caption;
$this->view->position[] = $this->lang->admin->register->caption;
$this->view->register = $this->admin->getRegisterInfo();
$this->view->sn = $this->config->global->sn;
$this->display();
}
/**
* Bind zentao.
*
* @access public
* @return void
*/
public function bind()
{
if($_POST)
{
$response = $this->admin->bindByAPI();
if($response == 'success')
{
$this->loadModel('setting')->setItem('system.common.global.community', $this->post->account);
echo js::alert($this->lang->admin->bind->success);
die(js::locate(inlink('index'), 'parent'));
}
die($response);
}
$this->view->title = $this->lang->admin->bind->caption;
$this->view->position[] = $this->lang->admin->bind->caption;
$this->view->sn = $this->config->global->sn;
$this->display();
}
/**
* Check all tables.
*
* @access public
* @return void
*/
public function checkDB()
{
$tables = $this->dbh->query('SHOW TABLES')->fetchAll();
foreach($tables as $table)
{
$tableName = current((array)$table);
$result = $this->dbh->query("REPAIR TABLE $tableName")->fetch();
echo "Repairing TABLE: " . $result->Table . "\t" . $result->Msg_type . ":" . $result->Msg_text . "\n";
}
}
/**
* Account safe.
*
* @access public
* @return void
*/
public function safe()
{
if($_POST)
{
$data = fixer::input('post')->get();
$this->loadModel('setting')->setItems('system.common.safe', $data);
die(js::reload('parent'));
}
$this->view->title = $this->lang->admin->safe->common . $this->lang->colon . $this->lang->admin->safe->account;
$this->view->position[] = $this->lang->admin->safe->common;
$this->display();
}
/**
* Check weak user.
*
* @access public
* @return void
*/
public function checkWeak()
{
$this->view->title = $this->lang->admin->safe->common . $this->lang->colon . $this->lang->admin->safe->checkWeak;
$this->view->position[] = html::a(inlink('safe'), $this->lang->admin->safe->common);
$this->view->position[] = $this->lang->admin->safe->checkWeak;
$this->view->weakUsers = $this->loadModel('user')->getWeakUsers();
$this->display();
}
}