Merge branch 'development' of http://git.westgis.ac.cn:8000/lijianxuan/westdc-core into development
This commit is contained in:
commit
f356418d00
|
@ -2,11 +2,9 @@
|
||||||
namespace Westdc\Authentication;
|
namespace Westdc\Authentication;
|
||||||
|
|
||||||
use Zend\Permissions\Acl\Acl;
|
use Zend\Permissions\Acl\Acl;
|
||||||
use Zend\Permissions\Acl\Role\GenericRole as Role;
|
|
||||||
use Zend\Permissions\Acl\Resource\GenericResource as Resource;
|
|
||||||
use Westdc\Helpers\Assist as view;
|
use Westdc\Helpers\Assist as view;
|
||||||
use Westdc\Member\Cookie;
|
use Westdc\Member\Cookie;
|
||||||
use Zend\Mvc\MvcEvent;
|
use Westdc\User\Account;
|
||||||
|
|
||||||
class AuthenticationService
|
class AuthenticationService
|
||||||
{
|
{
|
||||||
|
@ -86,7 +84,7 @@ class AuthenticationService
|
||||||
if($mb->checkcookie())
|
if($mb->checkcookie())
|
||||||
{
|
{
|
||||||
$account = new Account();
|
$account = new Account();
|
||||||
$account->cookieLogin(array($mb->FieldUsername=>$mb->user,$mb->FieldPasword=>$mb->srpwd));
|
$account->cookieLogin(array('username'=>$mb->user));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,20 +1,17 @@
|
||||||
<?php
|
<?php
|
||||||
namespace Westdc\Db;
|
namespace Westdc\Db;
|
||||||
|
|
||||||
use Zend\Config\Config as Zend_Config;
|
use Westdc\Helpers\Config;
|
||||||
|
|
||||||
class Pdo extends \PDO
|
class Pdo extends \PDO
|
||||||
{
|
{
|
||||||
private $debug = 0; //调试模式
|
|
||||||
|
|
||||||
private $config_local_path = "config/autoload/local.php";
|
|
||||||
|
|
||||||
function __construct($DSN = NULL)
|
function __construct($DSN = NULL)
|
||||||
{
|
{
|
||||||
if (!empty($DSN)) {
|
if (!empty($DSN)) {
|
||||||
parent::__construct($DSN);
|
parent::__construct($DSN);
|
||||||
} else {
|
} else {
|
||||||
$config_local = new Zend_Config(include $this->config_local_path);
|
$config_local = Config::get('local');
|
||||||
|
|
||||||
$dsn = "pgsql:host={$config_local->db->hostname};"
|
$dsn = "pgsql:host={$config_local->db->hostname};"
|
||||||
. "port={$config_local->db->port};"
|
. "port={$config_local->db->port};"
|
||||||
|
|
|
@ -16,6 +16,8 @@ use Westdc\File\Listener\DefaultFileUploadListener;
|
||||||
class Upload extends AbstractEventManager implements ServiceManagerAwareInterface{
|
class Upload extends AbstractEventManager implements ServiceManagerAwareInterface{
|
||||||
|
|
||||||
protected $serviceManager;
|
protected $serviceManager;
|
||||||
|
protected $defaultListener = false;
|
||||||
|
protected $returnInPreCheckTrigger = true;
|
||||||
|
|
||||||
private $uploadPath = "";
|
private $uploadPath = "";
|
||||||
private $relativePath = "";
|
private $relativePath = "";
|
||||||
|
@ -39,9 +41,6 @@ class Upload extends AbstractEventManager implements ServiceManagerAwareInterfac
|
||||||
|
|
||||||
public function init()
|
public function init()
|
||||||
{
|
{
|
||||||
$Listener = new DefaultFileUploadListener;
|
|
||||||
$this->getEventManager()->attachAggregate($Listener);
|
|
||||||
|
|
||||||
$configService = $this->serviceManager->get('ConfigService');
|
$configService = $this->serviceManager->get('ConfigService');
|
||||||
$this->config = $configService->get('file.php');
|
$this->config = $configService->get('file.php');
|
||||||
}
|
}
|
||||||
|
@ -51,6 +50,16 @@ class Upload extends AbstractEventManager implements ServiceManagerAwareInterfac
|
||||||
return $this->upload($files,$rootDir,$childDir,$fileName,$dateDirModel);
|
return $this->upload($files,$rootDir,$childDir,$fileName,$dateDirModel);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加默认侦听器,会将信息保存到Attachments数据表
|
||||||
|
*/
|
||||||
|
public function attachDefaultListener()
|
||||||
|
{
|
||||||
|
$Listener = new DefaultFileUploadListener;
|
||||||
|
$this->getEventManager()->attachAggregate($Listener);
|
||||||
|
$this->defaultListener = true;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 上传文件
|
* 上传文件
|
||||||
* @param $files 上传文件的信息 e.g.$_FILE['fileData']
|
* @param $files 上传文件的信息 e.g.$_FILE['fileData']
|
||||||
|
@ -73,11 +82,15 @@ class Upload extends AbstractEventManager implements ServiceManagerAwareInterfac
|
||||||
$file = $files;
|
$file = $files;
|
||||||
|
|
||||||
$results = $this->getEventManager()->trigger('upload.pre', $this, compact('file'));
|
$results = $this->getEventManager()->trigger('upload.pre', $this, compact('file'));
|
||||||
$cache_data = $results->last();
|
|
||||||
|
|
||||||
if($cache_data !== true)
|
if($this->returnInPreCheckTrigger === true)
|
||||||
{
|
{
|
||||||
return $cache_data;
|
$cache_data = $results->last();
|
||||||
|
|
||||||
|
if($cache_data !== true)
|
||||||
|
{
|
||||||
|
return $cache_data;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$fileService = $this->serviceManager->get('File');
|
$fileService = $this->serviceManager->get('File');
|
||||||
|
@ -88,7 +101,11 @@ class Upload extends AbstractEventManager implements ServiceManagerAwareInterfac
|
||||||
if($dateDirModel !== false)
|
if($dateDirModel !== false)
|
||||||
$this->makeDateDir($dateDirModel);
|
$this->makeDateDir($dateDirModel);
|
||||||
|
|
||||||
$this->setFileName($fileName , $fileService->getFileTextExt($files['name']));
|
if(empty($this->fileName) || empty($fileName))
|
||||||
|
$this->setFileName(NULL , $fileService->getFileTextExt($files['name']));
|
||||||
|
|
||||||
|
if(!empty($fileName))
|
||||||
|
$this->setFileName($fileName , $fileService->getFileTextExt($files['name']));
|
||||||
|
|
||||||
//移动文件
|
//移动文件
|
||||||
$file_path = $this->getUploadPath() . $this->getFileName();
|
$file_path = $this->getUploadPath() . $this->getFileName();
|
||||||
|
@ -106,7 +123,7 @@ class Upload extends AbstractEventManager implements ServiceManagerAwareInterfac
|
||||||
$file_data['file_ext'] = $fileService->getFileTextExt($files['name']);
|
$file_data['file_ext'] = $fileService->getFileTextExt($files['name']);
|
||||||
$file_data['file_mime'] = $fileService->getFileMime($file_path);
|
$file_data['file_mime'] = $fileService->getFileMime($file_path);
|
||||||
|
|
||||||
if(!empty($file_data) && is_array($file_data))
|
if(!empty($this->params) && is_array($this->params))
|
||||||
{
|
{
|
||||||
$file_data = array_merge($file_data,$this->params);
|
$file_data = array_merge($file_data,$this->params);
|
||||||
}
|
}
|
||||||
|
@ -203,26 +220,52 @@ class Upload extends AbstractEventManager implements ServiceManagerAwareInterfac
|
||||||
* @param $fileName
|
* @param $fileName
|
||||||
* @param $fileExt
|
* @param $fileExt
|
||||||
*/
|
*/
|
||||||
public function setFileName($fileName,$fileExt)
|
public function setFileName($fileName,$fileExt = "")
|
||||||
{
|
{
|
||||||
if(!empty($fileName)){
|
if(!empty($fileName)){
|
||||||
$this->fileName = $fileName . "." .$fileExt;
|
|
||||||
|
if(empty($fileExt))
|
||||||
|
{
|
||||||
|
$fileExt = pathinfo($fileName,PATHINFO_EXTENSION);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(empty($fileExt))
|
||||||
|
$this->fileName = $fileName;
|
||||||
|
else
|
||||||
|
$this->fileName = $fileName . "." .$fileExt;
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$tools = $this->serviceManager->get('Tools');
|
$tools = $this->serviceManager->get('Tools');
|
||||||
$uuid = $tools->uuid();
|
$uuid = $tools->uuid();
|
||||||
|
|
||||||
$this->fileName = $uuid . "." . $fileExt;
|
if(empty($fileExt))
|
||||||
|
$this->fileName = $uuid;
|
||||||
|
else
|
||||||
|
$this->fileName = $uuid . "." . $fileExt;
|
||||||
|
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param $params
|
||||||
|
*/
|
||||||
public function setParams($params)
|
public function setParams($params)
|
||||||
{
|
{
|
||||||
$this->params = $params;
|
$this->params = $params;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 强制关闭文件上传前的钩子,默认是所有上传必须执行此钩子已避免上传文件不符合规格
|
||||||
|
* 除了后台中特殊的文件操作之外不建议关闭
|
||||||
|
*/
|
||||||
|
public function forceDetachPreCheckTrigger()
|
||||||
|
{
|
||||||
|
$this->returnInPreCheckTrigger = false;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -1,9 +1,8 @@
|
||||||
<?php
|
<?php
|
||||||
namespace Westdc\Helpers;
|
namespace Westdc\Helpers;
|
||||||
|
|
||||||
use \Zend\Authentication\AuthenticationService;
|
use Zend\Authentication\AuthenticationService;
|
||||||
use \Zend\Authentication\Storage\Session as SessionStorage;
|
use Zend\Authentication\Storage\Session as SessionStorage;
|
||||||
use \Westdc\Helpers\Config;
|
|
||||||
|
|
||||||
class Auth
|
class Auth
|
||||||
{
|
{
|
||||||
|
|
|
@ -3,26 +3,43 @@ namespace Westdc\Helpers;
|
||||||
|
|
||||||
class Config
|
class Config
|
||||||
{
|
{
|
||||||
private $config_path = array(
|
|
||||||
'local' => "config/autoload/local.php",
|
|
||||||
'global' => "config/autoload/global.php"
|
|
||||||
);
|
|
||||||
|
|
||||||
function __construct()
|
function __construct()
|
||||||
{
|
{
|
||||||
//$reader = new \Zend\Config\Reader\Ini();
|
//$reader = new \Zend\Config\Reader\Ini();
|
||||||
//$data = $reader->fromFile('config/config.ini');
|
//$data = $reader->fromFile('config/config.ini');
|
||||||
}
|
}
|
||||||
|
|
||||||
static function get($type = 'global')
|
static function get($configName = 'global')
|
||||||
{
|
{
|
||||||
$config_path = array(
|
if(defined(CONFIG_PATH))
|
||||||
'local' => "config/autoload/local.php",
|
{
|
||||||
'global' => "config/autoload/global.php",
|
throw new \RuntimeException('Not found the config files path');
|
||||||
'file' => "config/autoload/file.php"
|
}
|
||||||
|
|
||||||
|
$config_path = CONFIG_PATH;
|
||||||
|
|
||||||
|
if(empty($configName))
|
||||||
|
$configName = "global.php";
|
||||||
|
|
||||||
|
if(!preg_match("/(\\/|\\\)$/",$config_path))
|
||||||
|
{
|
||||||
|
$config_path .= "/";
|
||||||
|
}
|
||||||
|
|
||||||
|
$config_names = array(
|
||||||
|
'local' => "local.php",
|
||||||
|
'global' => "global.php",
|
||||||
|
'file' => "file.php"
|
||||||
);
|
);
|
||||||
|
|
||||||
|
$configFile = $config_path .'autoload/' . $config_names[$configName];
|
||||||
|
|
||||||
|
unset($config_path);
|
||||||
|
unset($configName);
|
||||||
|
|
||||||
$config = new \Zend\Config\Config(include $config_path[$type]);
|
$config = new \Zend\Config\Config(include $configFile);
|
||||||
|
|
||||||
return $config;
|
return $config;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,17 +3,15 @@ namespace Westdc\Helpers;
|
||||||
|
|
||||||
use \Zend\Authentication\AuthenticationService;
|
use \Zend\Authentication\AuthenticationService;
|
||||||
use \Zend\Authentication\Storage\Session as SessionStorage;
|
use \Zend\Authentication\Storage\Session as SessionStorage;
|
||||||
use \Westdc\Helpers\Config;
|
|
||||||
use Westdc\Helpers\MobileDetect;
|
|
||||||
use View as view;
|
use View as view;
|
||||||
|
|
||||||
class Layout
|
class Layout
|
||||||
{
|
{
|
||||||
public $config;
|
|
||||||
|
|
||||||
function __construct()
|
function __construct()
|
||||||
{
|
{
|
||||||
$this->config = Config::get();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//设置网页标题
|
//设置网页标题
|
||||||
|
@ -26,8 +24,8 @@ class Layout
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$action = $matches->getParam('action');
|
// $action = $matches->getParam('action');
|
||||||
$controller = $matches->getParam('controller');
|
// $controller = $matches->getParam('controller');
|
||||||
|
|
||||||
$viewHelperManager = $e->getApplication()->getServiceManager()->get('viewHelperManager');
|
$viewHelperManager = $e->getApplication()->getServiceManager()->get('viewHelperManager');
|
||||||
|
|
||||||
|
@ -36,15 +34,7 @@ class Layout
|
||||||
// Setting a separator string for segments
|
// Setting a separator string for segments
|
||||||
$headTitleHelper->setSeparator(' - ');
|
$headTitleHelper->setSeparator(' - ');
|
||||||
|
|
||||||
if(isset($this->config->title_map->$controller->action->$action))
|
return;
|
||||||
{
|
|
||||||
$headTitleHelper->append($this->config->title_map->$controller->action->$action->title);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(isset($this->config->title_map->$controller))
|
|
||||||
{
|
|
||||||
$headTitleHelper->append($this->config->title_map->$controller->title);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//导航条按钮激活
|
//导航条按钮激活
|
||||||
|
|
|
@ -30,10 +30,6 @@ class Paginator implements ServiceManagerAwareInterface{
|
||||||
{
|
{
|
||||||
$this->serviceManager = $serviceManager;
|
$this->serviceManager = $serviceManager;
|
||||||
|
|
||||||
$this->setPageLimit();
|
|
||||||
$this->setPageRange();
|
|
||||||
$this->setRoute();
|
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -97,6 +93,16 @@ class Paginator implements ServiceManagerAwareInterface{
|
||||||
{
|
{
|
||||||
$page = $ctl->params()->fromRoute('page');
|
$page = $ctl->params()->fromRoute('page');
|
||||||
|
|
||||||
|
if(empty($this->pageLimit))
|
||||||
|
$this->setPageLimit();
|
||||||
|
|
||||||
|
if(empty($this->pageRange))
|
||||||
|
$this->setPageRange();
|
||||||
|
|
||||||
|
if(empty($this->route))
|
||||||
|
$this->setRoute();
|
||||||
|
|
||||||
|
|
||||||
if(is_array($data))
|
if(is_array($data))
|
||||||
$data = new ArrayAdapter($data);
|
$data = new ArrayAdapter($data);
|
||||||
|
|
||||||
|
|
|
@ -45,8 +45,12 @@ class Tools {
|
||||||
{
|
{
|
||||||
$response = array();
|
$response = array();
|
||||||
$handle = popen("$cmd 2>&1", 'r');
|
$handle = popen("$cmd 2>&1", 'r');
|
||||||
$read = '';
|
|
||||||
while ($read = fread($handle, 20096)) {
|
while ($read = fread($handle, 20096)) {
|
||||||
|
|
||||||
|
if(!mb_detect_encoding($read, 'UTF-8', true))
|
||||||
|
iconv("GB2312","UTF-8",$read);
|
||||||
|
|
||||||
$response[] = trim($read);
|
$response[] = trim($read);
|
||||||
}
|
}
|
||||||
pclose($handle);
|
pclose($handle);
|
||||||
|
|
|
@ -10,6 +10,7 @@ namespace Westdc\Mail;
|
||||||
|
|
||||||
use Zend\ServiceManager\ServiceManager;
|
use Zend\ServiceManager\ServiceManager;
|
||||||
use Zend\ServiceManager\ServiceManagerAwareInterface;
|
use Zend\ServiceManager\ServiceManagerAwareInterface;
|
||||||
|
use Westdc\Service\ServiceManager as WestdcServiceManager;
|
||||||
|
|
||||||
class Sender implements ServiceManagerAwareInterface{
|
class Sender implements ServiceManagerAwareInterface{
|
||||||
|
|
||||||
|
@ -24,6 +25,15 @@ class Sender implements ServiceManagerAwareInterface{
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
if(!$this->serviceManager instanceof ServiceManager)
|
||||||
|
{
|
||||||
|
$serviceManager = new WestdcServiceManager();
|
||||||
|
$this->serviceManager = $serviceManager->getServiceManager();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 发送即时邮件
|
* 发送即时邮件
|
||||||
* @param $options
|
* @param $options
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
namespace Westdc\Member;
|
namespace Westdc\Member;
|
||||||
|
|
||||||
use Westdc\Helpers\Config;
|
use Westdc\Helpers\Config;
|
||||||
use Westdc\Db\PDO as Db;
|
use Westdc\Db\Pdo as Db;
|
||||||
|
|
||||||
class Cookie
|
class Cookie
|
||||||
{
|
{
|
||||||
|
|
|
@ -97,6 +97,7 @@ class Reference extends AbstractEventManager implements ServiceManagerAwareInter
|
||||||
$appConfig = $configService->get('application.ini');
|
$appConfig = $configService->get('application.ini');
|
||||||
|
|
||||||
$fileUploadService = $this->serviceManager->get('File/Upload');
|
$fileUploadService = $this->serviceManager->get('File/Upload');
|
||||||
|
$fileUploadService->attachDefaultListener();
|
||||||
$fileUploadService->setParams(['file_type' => 'literature']);
|
$fileUploadService->setParams(['file_type' => 'literature']);
|
||||||
$file_info = $fileUploadService($file,$appConfig['reference_save_path'],"","",$fileUploadService::DATETIME_MODEL_Y);
|
$file_info = $fileUploadService($file,$appConfig['reference_save_path'],"","",$fileUploadService::DATETIME_MODEL_Y);
|
||||||
|
|
||||||
|
|
|
@ -10,6 +10,7 @@ namespace Westdc\Review;
|
||||||
use Zend\ServiceManager\ServiceManager;
|
use Zend\ServiceManager\ServiceManager;
|
||||||
use Zend\ServiceManager\ServiceManagerAwareInterface;
|
use Zend\ServiceManager\ServiceManagerAwareInterface;
|
||||||
use Westdc\EventModel\AbstractEventManager;
|
use Westdc\EventModel\AbstractEventManager;
|
||||||
|
use Zend\Db\Sql\Select;
|
||||||
|
|
||||||
class Review extends AbstractEventManager implements ServiceManagerAwareInterface{
|
class Review extends AbstractEventManager implements ServiceManagerAwareInterface{
|
||||||
|
|
||||||
|
@ -119,14 +120,43 @@ class Review extends AbstractEventManager implements ServiceManagerAwareInterfac
|
||||||
RIGHT JOIN metadata md ON md.uuid=m.uuid
|
RIGHT JOIN metadata md ON md.uuid=m.uuid
|
||||||
LEFT JOIN users u ON u.id=m.userid
|
LEFT JOIN users u ON u.id=m.userid
|
||||||
LEFT JOIN geonetworkmetadata gn ON m.uuid=gn.uuid
|
LEFT JOIN geonetworkmetadata gn ON m.uuid=gn.uuid
|
||||||
WHERE m.status=0 $searchJoin
|
WHERE m.status=".self::REVIEW_STATUS_DEFAULT." $searchJoin
|
||||||
{$this->orderSql} {$this->sortSql}
|
{$this->orderSql} {$this->sortSql}
|
||||||
{$this->limitSql}";
|
{$this->limitSql}";
|
||||||
|
|
||||||
$rs = $this->db->query($sql);
|
$rs = $this->db->query($sql);
|
||||||
return $rs->fetchAll();
|
return $rs->fetchAll(\PDO::FETCH_ASSOC);
|
||||||
}//getDraft()
|
}//getDraft()
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取被取消评审的元数据
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function getCanceled()
|
||||||
|
{
|
||||||
|
$this->processOptions();
|
||||||
|
|
||||||
|
$searchJoin = "";
|
||||||
|
if(isset($this->opt->keyword) && !empty($this->opt->keyword))
|
||||||
|
{
|
||||||
|
$searchJoin = " AND md.title LIKE '%{$this->opt->keyword}%'";
|
||||||
|
}
|
||||||
|
|
||||||
|
if(empty($this->orderSql))
|
||||||
|
{
|
||||||
|
$this->orderSql = "ORDER BY m.ts_created DESC";
|
||||||
|
}
|
||||||
|
|
||||||
|
$sql = "SELECT m.id,md.title,md.uuid,m.status,m.ts_created FROM mdstatus m
|
||||||
|
RIGHT JOIN metadata md ON md.uuid=m.uuid
|
||||||
|
WHERE m.status=".self::REVIEW_STATUS_CANCELED." $searchJoin
|
||||||
|
{$this->orderSql} {$this->sortSql}
|
||||||
|
{$this->limitSql}";
|
||||||
|
|
||||||
|
$rs = $this->db->query($sql);
|
||||||
|
return $rs->fetchAll(\PDO::FETCH_ASSOC);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 取消评审
|
* 取消评审
|
||||||
* @param $id
|
* @param $id
|
||||||
|
@ -135,6 +165,9 @@ class Review extends AbstractEventManager implements ServiceManagerAwareInterfac
|
||||||
public function cancel($id){
|
public function cancel($id){
|
||||||
if(!is_numeric($id) || $id<1)
|
if(!is_numeric($id) || $id<1)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
$this->getEventManager()->trigger('review.canceled', $this, compact('id'));
|
||||||
|
|
||||||
return $this->changeStatus($id,self::REVIEW_STATUS_CANCELED);
|
return $this->changeStatus($id,self::REVIEW_STATUS_CANCELED);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -159,43 +192,12 @@ class Review extends AbstractEventManager implements ServiceManagerAwareInterfac
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$authorEmail = $this->getAuthor($id);
|
$this->getEventManager()->trigger('review.accepted', $this, compact('id'));
|
||||||
|
|
||||||
foreach($authorEmail as $v)
|
|
||||||
{
|
|
||||||
$mailSender = $this->serviceManager->get('Mail/Sender');
|
|
||||||
$mailSender->backend([
|
|
||||||
'email' => $v['email'],
|
|
||||||
'name' => !empty($v['realname']) ? $v['realname']:$v['username'],
|
|
||||||
'template' => 'review-new-accept',
|
|
||||||
'data' => [
|
|
||||||
'uuid' => $v['uuid'],
|
|
||||||
'title' => $v['title'],
|
|
||||||
]
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
}//accept($id)
|
}//accept($id)
|
||||||
|
|
||||||
/**
|
|
||||||
* 获得某条评审涉及的元数据相关作者信息(email,元数据标题,uuid)
|
|
||||||
* @param $id
|
|
||||||
* @return mixed
|
|
||||||
*/
|
|
||||||
public function getAuthor($id){
|
|
||||||
$sql = "SELECT DISTINCT u.email,u.realname,u.username,m.title,m.uuid FROM mdstatus s
|
|
||||||
LEFT JOIN metadata m ON s.uuid=m.uuid
|
|
||||||
RIGHT JOIN mdauthor a ON s.uuid=a.uuid
|
|
||||||
LEFT JOIN users u ON a.userid=u.id
|
|
||||||
WHERE s.id=$id
|
|
||||||
ORDER BY u.email";
|
|
||||||
|
|
||||||
$rs = $this->db->query($sql);
|
|
||||||
return $rs->fetchAll(\PDO::FETCH_ASSOC);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function reset($id){
|
public function reset($id){
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,7 @@ class Db {
|
||||||
|
|
||||||
public function getZendDb(){
|
public function getZendDb(){
|
||||||
|
|
||||||
$dbObject = new WestdcDb\Db($adapter);
|
$dbObject = new WestdcDb\Db();
|
||||||
|
|
||||||
return $dbObject->getAdapter();
|
return $dbObject->getAdapter();
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,9 +8,9 @@ use Zend\Authentication\AuthenticationService;
|
||||||
use Zend\Authentication\Storage\Session as SessionStorage;
|
use Zend\Authentication\Storage\Session as SessionStorage;
|
||||||
use Westdc\Helpers\View as view;
|
use Westdc\Helpers\View as view;
|
||||||
use Westdc\Helpers\Config;
|
use Westdc\Helpers\Config;
|
||||||
use Westdc\Helpers\Dbh as dbh;
|
use Westdc\Db\Dbh as dbh;
|
||||||
use Westdc\Helpers\PDO as Db;
|
use Westdc\Db\Pdo as Db;
|
||||||
use Westdc\Helpers\Db as Zend_Db;
|
use Westdc\Db\Db as Zend_Db;
|
||||||
use Westdc\Mail\Mail;
|
use Westdc\Mail\Mail;
|
||||||
use Westdc\User\Listener\AccountListener as Listener;
|
use Westdc\User\Listener\AccountListener as Listener;
|
||||||
use Westdc\User\Listener\PwdListener;
|
use Westdc\User\Listener\PwdListener;
|
||||||
|
@ -18,7 +18,7 @@ use Westdc\User\Member;
|
||||||
|
|
||||||
class Account implements EventManagerAwareInterface
|
class Account implements EventManagerAwareInterface
|
||||||
{
|
{
|
||||||
public $memberTable = "tbl_member";
|
public $memberTable = "users";
|
||||||
public $FieldUsername = "username";
|
public $FieldUsername = "username";
|
||||||
public $FieldPasword = "password";
|
public $FieldPasword = "password";
|
||||||
public $FieldLastlogin = "ts_last_login";
|
public $FieldLastlogin = "ts_last_login";
|
||||||
|
@ -60,16 +60,21 @@ class Account implements EventManagerAwareInterface
|
||||||
}
|
}
|
||||||
|
|
||||||
//获取账号信息,数组
|
//获取账号信息,数组
|
||||||
public function getAccountInfo($id = 0)
|
public function getAccountInfo($id = 0)
|
||||||
{
|
{
|
||||||
if($id == 0)
|
|
||||||
{
|
if(is_string($id))
|
||||||
$id = view::User('id');
|
$sql = "SELECT * FROM ".$this->memberTable." WHERE username='$id'";
|
||||||
}
|
elseif(is_numeric($id))
|
||||||
$sql = "SELECT * FROM {$this->memberTable} WHERE id=$id";
|
{
|
||||||
$rs = $this->db->query($sql);
|
if($id == 0)
|
||||||
return $rs->fetch();
|
$id == view::User('id');
|
||||||
}
|
$sql = "SELECT * FROM {$this->memberTable} WHERE id=$id";
|
||||||
|
}
|
||||||
|
|
||||||
|
$rs = $this->db->query($sql);
|
||||||
|
return $rs->fetch(\PDO::FETCH_ASSOC);
|
||||||
|
}
|
||||||
|
|
||||||
//注册
|
//注册
|
||||||
public function register($data)
|
public function register($data)
|
||||||
|
@ -212,7 +217,14 @@ class Account implements EventManagerAwareInterface
|
||||||
|
|
||||||
public function cookieLogin($data)
|
public function cookieLogin($data)
|
||||||
{
|
{
|
||||||
return $this->storeLogin($data,false);
|
$data = $this->getAccountInfo($data['username']);
|
||||||
|
|
||||||
|
if(!$data)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->storeLogin($data,false);
|
||||||
}
|
}
|
||||||
|
|
||||||
//注册信息参数
|
//注册信息参数
|
||||||
|
|
|
@ -1,13 +0,0 @@
|
||||||
<?php
|
|
||||||
namespace Sookon\User\Event;
|
|
||||||
|
|
||||||
use Zend\EventManager\EventInterface;
|
|
||||||
|
|
||||||
interface EditEvent
|
|
||||||
{
|
|
||||||
|
|
||||||
public function checkParam(EventInterface $e);
|
|
||||||
|
|
||||||
public function editSuccess(EventInterface $e);
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,14 +0,0 @@
|
||||||
<?php
|
|
||||||
namespace Sookon\User\Event;
|
|
||||||
|
|
||||||
use Zend\EventManager\EventInterface;
|
|
||||||
|
|
||||||
interface LoginEvent
|
|
||||||
{
|
|
||||||
|
|
||||||
public function checkParam(EventInterface $e);
|
|
||||||
|
|
||||||
public function updateStatus(EventInterface $e);
|
|
||||||
|
|
||||||
public function createAvatar(EventInterface $e);
|
|
||||||
}
|
|
|
@ -1,15 +0,0 @@
|
||||||
<?php
|
|
||||||
namespace Sookon\User\Event;
|
|
||||||
|
|
||||||
use Zend\EventManager\EventInterface;
|
|
||||||
|
|
||||||
interface PwdEvent
|
|
||||||
{
|
|
||||||
|
|
||||||
public function forgotPwdCheckParam(EventInterface $e);
|
|
||||||
|
|
||||||
public function sendGetPasswordMail(EventInterface $e);
|
|
||||||
|
|
||||||
public function resetPwdCheckParam(EventInterface $e);
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,15 +0,0 @@
|
||||||
<?php
|
|
||||||
namespace Sookon\User\Event;
|
|
||||||
|
|
||||||
use Zend\EventManager\EventInterface;
|
|
||||||
|
|
||||||
interface RegisterEvent
|
|
||||||
{
|
|
||||||
|
|
||||||
public function checkParam(EventInterface $e);
|
|
||||||
|
|
||||||
public function checkUser(EventInterface $e);
|
|
||||||
|
|
||||||
public function registerSuccess(EventInterface $e);
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,5 +1,5 @@
|
||||||
<?php
|
<?php
|
||||||
namespace Sookon\User;
|
namespace Westdc\User;
|
||||||
|
|
||||||
class Gravatar{
|
class Gravatar{
|
||||||
|
|
||||||
|
|
|
@ -1,13 +1,12 @@
|
||||||
<?php
|
<?php
|
||||||
namespace Sookon\User\Handle;
|
namespace Westdc\User\Handle;
|
||||||
|
|
||||||
use Sookon\Mail\Mail;
|
use Westdc\Helpers\View as view;
|
||||||
use Sookon\Helpers\View as view;
|
use Westdc\Helpers\Pdo;
|
||||||
use Sookon\Helpers\Pdo;
|
use Westdc\Helpers\Config;
|
||||||
use Sookon\Helpers\Config;
|
|
||||||
use Zend\EventManager\EventInterface;
|
use Zend\EventManager\EventInterface;
|
||||||
|
|
||||||
class EditHandle implements \Sookon\User\Event\EditEvent
|
class EditHandle
|
||||||
{
|
{
|
||||||
private $db; //传入PDO对象
|
private $db; //传入PDO对象
|
||||||
public $tbl_member = "tbl_member";
|
public $tbl_member = "tbl_member";
|
||||||
|
|
|
@ -1,13 +1,12 @@
|
||||||
<?php
|
<?php
|
||||||
namespace Sookon\User\Handle;
|
namespace Westdc\User\Handle;
|
||||||
|
|
||||||
use Sookon\Helpers\Dbh as dbh;
|
use Westdc\Db\Dbh as dbh;
|
||||||
use Sookon\Helpers\PDO as Db;
|
use Westdc\Db\Pdo as Db;
|
||||||
use Sookon\User\Gravatar;
|
use Westdc\User\Gravatar;
|
||||||
use Sookon\Helpers\View as view;
|
|
||||||
use Zend\EventManager\EventInterface;
|
use Zend\EventManager\EventInterface;
|
||||||
|
|
||||||
class LoginHandle implements \Sookon\User\Event\LoginEvent
|
class LoginHandle
|
||||||
{
|
{
|
||||||
private $db; //传入PDO对象
|
private $db; //传入PDO对象
|
||||||
public $tbl_member = "tbl_member";
|
public $tbl_member = "tbl_member";
|
||||||
|
@ -17,8 +16,6 @@ class LoginHandle implements \Sookon\User\Event\LoginEvent
|
||||||
public $FieldEmail = "email";
|
public $FieldEmail = "email";
|
||||||
public $FieldLastloginIp = "last_login_ip";
|
public $FieldLastloginIp = "last_login_ip";
|
||||||
public $FieldGravatarEmail = "gravatar_email";
|
public $FieldGravatarEmail = "gravatar_email";
|
||||||
private $DefaultFetchMode = \PDO::FETCH_BOTH; //默认检索模式,防止出现sdtClass错误
|
|
||||||
private $config; //全局配置
|
|
||||||
|
|
||||||
function __construct()
|
function __construct()
|
||||||
{
|
{
|
||||||
|
@ -55,7 +52,7 @@ class LoginHandle implements \Sookon\User\Event\LoginEvent
|
||||||
$sql = "SELECT id,{$this->FieldPasword},status FROM {$this->tbl_member} WHERE {$this->FieldUsername}=?";
|
$sql = "SELECT id,{$this->FieldPasword},status FROM {$this->tbl_member} WHERE {$this->FieldUsername}=?";
|
||||||
$sth = $this->db->prepare($sql);
|
$sth = $this->db->prepare($sql);
|
||||||
$rs = $sth->execute(array($data[$this->FieldUsername]));
|
$rs = $sth->execute(array($data[$this->FieldUsername]));
|
||||||
$row = $sth->fetch();
|
$row = $sth->fetch(\PDO::FETCH_ASSOC);
|
||||||
|
|
||||||
if(isset($row['id']) && !empty($row['id']))
|
if(isset($row['id']) && !empty($row['id']))
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,12 +1,10 @@
|
||||||
<?php
|
<?php
|
||||||
namespace Sookon\User\Handle;
|
namespace Westdc\User\Handle;
|
||||||
|
|
||||||
use Sookon\Mail\Mail;
|
use Westdc\Db\Pdo;
|
||||||
use Sookon\Helpers\View as view;
|
use Westdc\Helpers\Config;
|
||||||
use Sookon\Helpers\Pdo;
|
|
||||||
use Sookon\Helpers\Config;
|
|
||||||
|
|
||||||
class PwdHandle implements \Sookon\User\Event\PwdEvent
|
class PwdHandle
|
||||||
{
|
{
|
||||||
private $db; //传入PDO对象
|
private $db; //传入PDO对象
|
||||||
public $tbl_member = "tbl_member";
|
public $tbl_member = "tbl_member";
|
||||||
|
|
|
@ -1,14 +1,12 @@
|
||||||
<?php
|
<?php
|
||||||
namespace Sookon\User\Handle;
|
namespace Westdc\User\Handle;
|
||||||
|
|
||||||
use Sookon\Mail\Mail;
|
use Westdc\Mail\Mail;
|
||||||
use Sookon\Helpers\Config;
|
use Westdc\Helpers\Config;
|
||||||
use Sookon\Helpers\View as view;
|
use Westdc\Db\Pdo as Db;
|
||||||
use Sookon\Helpers\PDO as Db;
|
|
||||||
use Sookon\User\Event\RegisterEvent as Event;
|
|
||||||
use Zend\EventManager\EventInterface;
|
use Zend\EventManager\EventInterface;
|
||||||
|
|
||||||
class RegisterHandle implements Event
|
class RegisterHandle
|
||||||
{
|
{
|
||||||
private $db; //传入PDO对象
|
private $db; //传入PDO对象
|
||||||
public $tbl_member = "tbl_member";
|
public $tbl_member = "tbl_member";
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
<?php
|
<?php
|
||||||
namespace Sookon\User\Listener;
|
namespace Westdc\User\Listener;
|
||||||
|
|
||||||
use Sookon\User\Handle\RegisterHandle;
|
use Westdc\User\Handle\RegisterHandle;
|
||||||
use Sookon\User\Handle\LoginHandle;
|
use Westdc\User\Handle\LoginHandle;
|
||||||
use Zend\EventManager\EventCollection;
|
use Zend\EventManager\EventCollection;
|
||||||
use Zend\EventManager\ListenerAggregateInterface;
|
use Zend\EventManager\ListenerAggregateInterface;
|
||||||
use Zend\EventManager\EventInterface;
|
use Zend\EventManager\EventInterface;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
namespace Sookon\User\Listener;
|
namespace Westdc\User\Listener;
|
||||||
|
|
||||||
use Sookon\User\Handle\EditHandle;
|
use Westdc\User\Handle\EditHandle;
|
||||||
use Zend\EventManager\EventCollection;
|
use Zend\EventManager\EventCollection;
|
||||||
use Zend\EventManager\ListenerAggregateInterface;
|
use Zend\EventManager\ListenerAggregateInterface;
|
||||||
use Zend\EventManager\EventInterface;
|
use Zend\EventManager\EventInterface;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
namespace Sookon\User\Listener;
|
namespace Westdc\User\Listener;
|
||||||
|
|
||||||
use Sookon\User\Handle\PwdHandle;
|
use Westdc\User\Handle\PwdHandle;
|
||||||
use Zend\EventManager\EventCollection;
|
use Zend\EventManager\EventCollection;
|
||||||
use Zend\EventManager\ListenerAggregateInterface;
|
use Zend\EventManager\ListenerAggregateInterface;
|
||||||
use Zend\EventManager\EventInterface;
|
use Zend\EventManager\EventInterface;
|
||||||
|
|
Loading…
Reference in New Issue