* code for task #43565.
This commit is contained in:
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
/**
|
||||
* The langs entry point of ZenTaoPMS.
|
||||
*
|
||||
* @copyright Copyright 2009-2021 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com)
|
||||
* @license ZPL (http://zpl.pub/page/zplv12.html)
|
||||
* @author Chunsheng Wang <chunsheng@cnezsoft.com>
|
||||
* @package entries
|
||||
* @version 1
|
||||
* @link http://www.zentao.net
|
||||
*/
|
||||
class langsEntry extends entry
|
||||
{
|
||||
/**
|
||||
* GET method.
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function get()
|
||||
{
|
||||
$modules = $this->param('modules', '');
|
||||
$language = $this->param('lang', '');
|
||||
|
||||
if($language and !isset($this->config->langs[$language])) return $this->sendError(400, 'Error lang parameter');
|
||||
if(empty($modules)) return $this->sendError(400, 'Need modules');
|
||||
|
||||
if($language) $this->app->setClientLang($language);
|
||||
|
||||
$modules = explode(',', $modules);
|
||||
foreach($modules as $module)
|
||||
{
|
||||
if($module == 'all')
|
||||
{
|
||||
foreach(glob($this->app->getModuleRoot() . '*') as $modulePath)
|
||||
{
|
||||
if(!is_dir($modulePath)) continue;
|
||||
|
||||
$moduleName = basename($modulePath);
|
||||
$this->app->loadLang($moduleName);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
$this->app->loadLang($module);
|
||||
}
|
||||
|
||||
return $this->send(200, array('lang' => $this->lang));
|
||||
}
|
||||
}
|
||||
@@ -189,8 +189,15 @@ class userEntry extends Entry
|
||||
|
||||
if($data->status == 'success')
|
||||
{
|
||||
$stories = array();
|
||||
foreach($data->data->stories as $story)
|
||||
{
|
||||
$story->status = array('code' => $story->status, 'name' => $this->lang->story->statusList[$story->status]);
|
||||
$stories[$story->id] = $story;
|
||||
}
|
||||
|
||||
$info->story['total'] = $data->data->pager->recTotal;
|
||||
$info->story['stories'] = array_values((array)$data->data->stories);
|
||||
$info->story['stories'] = array_values($stories);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
@@ -5,6 +5,8 @@
|
||||
$routes = array();
|
||||
|
||||
$routes['/tokens'] = 'tokens';
|
||||
$routes['/langs'] = 'langs';
|
||||
|
||||
$routes['/tabs/:module'] = 'tabs';
|
||||
|
||||
$routes['/configurations'] = 'configs';
|
||||
|
||||
Reference in New Issue
Block a user