* Fix code format.

This commit is contained in:
tanghucheng
2022-06-24 08:30:07 +08:00
parent 19c0ff84f9
commit 25d4830892
+58 -58
View File
@@ -215,7 +215,7 @@ class commonModel extends model
if($this->loadModel('setting')->getItem('owner=system&module=sso&key=turnon'))
{
if(isset($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] == 'on')
if(isset($_SERVER["HTTPS"]) and $_SERVER["HTTPS"] == 'on')
{
$session = $this->config->sessionVar . '=' . session_id();
header("Set-Cookie: $session; SameSite=None; Secure=true", false);
@@ -431,7 +431,7 @@ class commonModel extends model
echo "<ul class='dropdown-menu pull-right'>";
if(!$isGuest)
{
$noRole = (!empty($app->user->role) && isset($lang->user->roleList[$app->user->role])) ? '' : ' no-role';
$noRole = (!empty($app->user->role) and isset($lang->user->roleList[$app->user->role])) ? '' : ' no-role';
echo '<li class="user-profile-item">';
echo "<a href='" . helper::createLink('my', 'profile', '', '', true) . "' data-width='700' class='iframe $noRole'" . '>';
echo html::avatar($app->user, '', 'avatar-circle', 'id="menu-avatar"');
@@ -739,7 +739,7 @@ class commonModel extends model
if(is_array($menuItem->link))
{
$vars = isset($menuItem->link['vars']) ? $menuItem->link['vars'] : '';
if(isset($menuItem->tutorial) && $menuItem->tutorial)
if(isset($menuItem->tutorial) and $menuItem->tutorial)
{
if(!empty($vars)) $vars = helper::safe64Encode($vars);
$link = helper::createLink('tutorial', 'wizard', "module={$menuItem->link['module']}&method={$menuItem->link['method']}&params=$vars");
@@ -931,7 +931,7 @@ class commonModel extends model
list($title, $currentModule, $currentMethod, $vars) = explode('|', $nav);
/* When last divider is not used in mainNav, use it next menu. */
$printDivider = ($printDivider || ($lastItem != $key) && strpos($lang->dividerMenu, ",{$group},") !== false) ? true : false;
$printDivider = ($printDivider or ($lastItem != $key) and strpos($lang->dividerMenu, ",{$group},") !== false) ? true : false;
if($printDivider and !empty($items))
{
$items[] = 'divider';
@@ -1006,14 +1006,14 @@ class commonModel extends model
$item = new stdClass();
$item->group = $group;
$item->code = $group;
$item->active = zget($lang->navGroup, $moduleName, '') == $group || $moduleName != 'program' && $moduleName == $group;
$item->active = zget($lang->navGroup, $moduleName, '') == $group or $moduleName != 'program' and $moduleName == $group;
$item->title = $title;
$item->moduleName = $currentModule;
$item->methodName = $currentMethod;
$item->vars = $vars;
$isTutorialMode = commonModel::isTutorialMode();
if($isTutorialMode && $currentModule == 'project')
if($isTutorialMode and $currentModule == 'project')
{
if(!empty($vars)) $vars = helper::safe64Encode($vars);
$item->url = helper::createLink('tutorial', 'wizard', "module={$currentModule}&method={$currentMethod}&params=$vars", '', 0, 0, 1);
@@ -1064,7 +1064,7 @@ class commonModel extends model
echo "<ul class='nav nav-default'>\n";
foreach($menu as $menuItem)
{
if(isset($menuItem->hidden) && $menuItem->hidden && (!isset($menuItem->tutorial) || !$menuItem->tutorial)) continue;
if(isset($menuItem->hidden) and $menuItem->hidden and (!isset($menuItem->tutorial) or !$menuItem->tutorial)) continue;
if(empty($menuItem->link)) continue;
if($menuItem->divider) echo "<li class='divider'></li>";
@@ -1136,7 +1136,7 @@ class commonModel extends model
$subActive = '';
$activeMainMenu = false;
if($currentModule == strtolower($subModule) && $currentMethod == strtolower($subMethod))
if($currentModule == strtolower($subModule) and $currentMethod == strtolower($subMethod))
{
$activeMainMenu = true;
}
@@ -1260,7 +1260,7 @@ class commonModel extends model
/* Cycling to print every sub menu. */
foreach($menu as $menuItem)
{
if(isset($menuItem->hidden) && $menuItem->hidden) continue;
if(isset($menuItem->hidden) and $menuItem->hidden) continue;
if($isMobile and empty($menuItem->link)) continue;
if($menuItem->divider) echo "<li class='divider'></li>";
@@ -1305,7 +1305,7 @@ class commonModel extends model
$subLink = helper::createLink($subModule, $subMethod, $subParams);
if($currentModule == strtolower($subModule) && $currentMethod == strtolower($subMethod)) $subActive = 'active';
if($currentModule == strtolower($subModule) and $currentMethod == strtolower($subMethod)) $subActive = 'active';
$misc = (isset($lang->navGroup->$subModule) and $tab != $lang->navGroup->$subModule) ? "data-app='$tab'" : '';
$dropMenu .= "<li class='$subActive' data-id='$dropMenuItem->name'>" . html::a($subLink, $subLabel, '', $misc) . '</li>';
@@ -1474,7 +1474,7 @@ class commonModel extends model
}
$params = sprintf($vars, $orderBy);
if($app->getModuleName() == 'my' and $app->rawMethod == 'work') $params = "mode={$app->getMethodName()}&" .sprintf($vars, $orderBy);
if($app->getModuleName() == 'my' and $app->rawMethod == 'work') $params = "mode={$app->getMethodName()}&" . $params;
$link = helper::createLink($module, $method, $params);
echo $isMobile ? html::a($link, $label, '', "class='$className' data-app={$app->tab}") : html::a($link, $label, '', "class='$className' data-app={$app->tab}");
@@ -1887,7 +1887,7 @@ EOD;
$newStatus = zget($new, 'status', '');
$newSubStatus = zget($new, 'subStatus', '');
if($oldID && $oldStatus && $newStatus && !$newSubStatus && $oldStatus != $newStatus)
if($oldID and $oldStatus and $newStatus and !$newSubStatus and $oldStatus != $newStatus)
{
if(empty($moduleName)) $moduleName = $app->getModuleName();
@@ -1916,13 +1916,13 @@ EOD;
if(strtolower($key) == 'editedby') continue;
if(strtolower($key) == 'editeddate') continue;
if(strtolower($key) == 'uid') continue;
if(strtolower($key) == 'finisheddate' && $value == '') continue;
if(strtolower($key) == 'canceleddate' && $value == '') continue;
if(strtolower($key) == 'hangupeddate' && $value == '') continue;
if(strtolower($key) == 'lastcheckeddate' && $value == '') continue;
if(strtolower($key) == 'activateddate' && $value == '') continue;
if(strtolower($key) == 'closeddate' && $value == '') continue;
if(strtolower($key) == 'actualcloseddate' && $value == '') continue;
if(strtolower($key) == 'finisheddate' and $value == '') continue;
if(strtolower($key) == 'canceleddate' and $value == '') continue;
if(strtolower($key) == 'hangupeddate' and $value == '') continue;
if(strtolower($key) == 'lastcheckeddate' and $value == '') continue;
if(strtolower($key) == 'activateddate' and $value == '') continue;
if(strtolower($key) == 'closeddate' and $value == '') continue;
if(strtolower($key) == 'actualcloseddate' and $value == '') continue;
if(isset($old->$key) and $value != stripslashes($old->$key))
{
@@ -2336,28 +2336,28 @@ EOD;
*/
public function checkIframe()
{
if($this->app->getViewType() != 'html' || helper::isAjaxRequest() || isset($_GET['_single'])) return;
if($this->app->getViewType() != 'html' or helper::isAjaxRequest() or isset($_GET['_single'])) return;
if(isset($_SERVER['HTTP_SEC_FETCH_DEST']))
{
if($_SERVER['HTTP_SEC_FETCH_DEST'] == 'iframe') return;
}
else if((isset($_SERVER['HTTP_REFERER']) && !empty($_SERVER['HTTP_REFERER'])) || strpos(strtolower($_SERVER['HTTP_USER_AGENT']), 'safari') !== false)
else if((isset($_SERVER['HTTP_REFERER']) and !empty($_SERVER['HTTP_REFERER'])) or strpos(strtolower($_SERVER['HTTP_USER_AGENT']), 'safari') !== false)
{
return;
}
$module = $this->app->getModuleName();
$method = $this->app->getMethodName();
if($module == 'index' ||
$module == 'tutorial' ||
$module == 'install' ||
$module == 'upgrade' ||
($module == 'user' && strpos('|login|deny|logout|reset|forgetpassword|resetpassword|', "|{$method}|") !== false) ||
($module == 'my' && strpos('|changepassword|preference|', "|{$method}|") !== false) ||
($module == 'file' && strpos('|read|download|uploadimages|ajaxwopifiles|', "|{$method}|") !== false) ||
($module == 'sso' && $method == 'login') ||
($module == 'traincourse' && $method == 'ajaxuploadlargefile'))
if($module == 'index' or
$module == 'tutorial' or
$module == 'install' or
$module == 'upgrade' or
($module == 'user' and strpos('|login|deny|logout|reset|forgetpassword|resetpassword|', "|{$method}|") !== false) or
($module == 'my' and strpos('|changepassword|preference|', "|{$method}|") !== false) or
($module == 'file' and strpos('|read|download|uploadimages|ajaxwopifiles|', "|{$method}|") !== false) or
($module == 'sso' and $method == 'login') or
($module == 'traincourse' and $method == 'ajaxuploadlargefile'))
{
return;
}
@@ -2397,22 +2397,22 @@ EOD;
if(!empty($method) and strpos('close|batchclose', $method) === false and !commonModel::canBeChanged($module, $object)) return false;
/* Check is the super admin or not. */
if(!empty($app->user->admin) || strpos($app->company->admins, ",{$app->user->account},") !== false) return true;
if(!empty($app->user->admin) or strpos($app->company->admins, ",{$app->user->account},") !== false) return true;
/* If is the program/project/product/execution admin, have all program privs. */
if($app->config->vision != 'lite')
{
$inProject = isset($lang->navGroup->$module) && $lang->navGroup->$module == 'project';
if($inProject && $app->session->project && (strpos(",{$app->user->rights['projects']},", ",{$app->session->project},") !== false or strpos(",{$app->user->rights['projects']},", ',all,') !== false)) return true;
$inProject = isset($lang->navGroup->$module) and $lang->navGroup->$module == 'project';
if($inProject and $app->session->project and (strpos(",{$app->user->rights['projects']},", ",{$app->session->project},") !== false or strpos(",{$app->user->rights['projects']},", ',all,') !== false)) return true;
$inProduct = isset($lang->navGroup->$module) && $lang->navGroup->$module == 'product';
if($inProduct && $app->session->product && (strpos(",{$app->user->rights['products']},", ",{$app->session->product},") !== false or strpos(",{$app->user->rights['products']},", ',all,') !== false)) return true;
$inProduct = isset($lang->navGroup->$module) and $lang->navGroup->$module == 'product';
if($inProduct and $app->session->product and (strpos(",{$app->user->rights['products']},", ",{$app->session->product},") !== false or strpos(",{$app->user->rights['products']},", ',all,') !== false)) return true;
$inProgram = isset($lang->navGroup->$module) && $lang->navGroup->$module == 'program';
if($inProgram && $app->session->program && (strpos(",{$app->user->rights['programs']},", ",{$app->session->program},") !== false or strpos(",{$app->user->rights['programs']},", ',all,') !== false)) return true;
$inProgram = isset($lang->navGroup->$module) and $lang->navGroup->$module == 'program';
if($inProgram and $app->session->program and (strpos(",{$app->user->rights['programs']},", ",{$app->session->program},") !== false or strpos(",{$app->user->rights['programs']},", ',all,') !== false)) return true;
$inExecution = isset($lang->navGroup->$module) && $lang->navGroup->$module == 'execution';
if($inExecution && $app->session->execution && (strpos(",{$app->user->rights['executions']},", ",{$app->session->execution},") !== false or strpos(",{$app->user->rights['executions']},", ',all,') !== false)) return true;
$inExecution = isset($lang->navGroup->$module) and $lang->navGroup->$module == 'execution';
if($inExecution and $app->session->execution and (strpos(",{$app->user->rights['executions']},", ",{$app->session->execution},") !== false or strpos(",{$app->user->rights['executions']},", ',all,') !== false)) return true;
}
/* If not super admin, check the rights. */
@@ -2431,10 +2431,10 @@ EOD;
if(empty($acls['views'])) return true;
$menu = isset($lang->navGroup->$module) ? $lang->navGroup->$module : $module;
if($module == 'my' && $method == 'team') $menu = 'system'; // Fix bug #18642.
if($module == 'my' and $method == 'team') $menu = 'system'; // Fix bug #18642.
$menu = strtolower($menu);
if($menu != 'qa' and !isset($lang->$menu->menu)) return true;
if(($menu == 'my' && $method != 'team')or $menu == 'index' or $module == 'tree') return true;
if(($menu == 'my' and $method != 'team')or $menu == 'index' or $module == 'tree') return true;
if($module == 'company' and $method == 'dynamic') return true;
if($module == 'action' and $method == 'editcomment') return true;
if($module == 'action' and $method == 'comment') return true;
@@ -2523,8 +2523,8 @@ EOD;
/* Limited execution. */
$limitedExecution = false;
if(!empty($module) && in_array($module, array('task', 'story')) && !empty($object->execution) or
!empty($module) && $module == 'execution' && !empty($object->id)
if(!empty($module) and in_array($module, array('task', 'story')) and !empty($object->execution) or
!empty($module) and $module == 'execution' and !empty($object->id)
)
{
$objectID = '';
@@ -2534,23 +2534,23 @@ EOD;
$limitedExecutions = !empty($_SESSION['limitedExecutions']) ? $_SESSION['limitedExecutions'] : '';
if($objectID and strpos(",{$limitedExecutions},", ",$objectID,") !== false) $limitedExecution = true;
}
if(empty($app->user->rights['rights']['my']['limited']) && !$limitedExecution) return true;
if(empty($app->user->rights['rights']['my']['limited']) and !$limitedExecution) return true;
if(!empty($method) && strpos($method, 'batch') === 0) return false;
if(!empty($method) && strpos($method, 'link') === 0) return false;
if(!empty($method) && strpos($method, 'create') === 0) return false;
if(!empty($method) && strpos($method, 'import') === 0) return false;
if(!empty($method) and strpos($method, 'batch') === 0) return false;
if(!empty($method) and strpos($method, 'link') === 0) return false;
if(!empty($method) and strpos($method, 'create') === 0) return false;
if(!empty($method) and strpos($method, 'import') === 0) return false;
if(empty($object)) return true;
if(!empty($object->openedBy) && $object->openedBy == $app->user->account or
!empty($object->addedBy) && $object->addedBy == $app->user->account or
!empty($object->account) && $object->account == $app->user->account or
!empty($object->assignedTo) && $object->assignedTo == $app->user->account or
!empty($object->finishedBy) && $object->finishedBy == $app->user->account or
!empty($object->canceledBy) && $object->canceledBy == $app->user->account or
!empty($object->closedBy) && $object->closedBy == $app->user->account or
!empty($object->lastEditedBy) && $object->lastEditedBy == $app->user->account)
if(!empty($object->openedBy) and $object->openedBy == $app->user->account or
!empty($object->addedBy) and $object->addedBy == $app->user->account or
!empty($object->account) and $object->account == $app->user->account or
!empty($object->assignedTo) and $object->assignedTo == $app->user->account or
!empty($object->finishedBy) and $object->finishedBy == $app->user->account or
!empty($object->canceledBy) and $object->canceledBy == $app->user->account or
!empty($object->closedBy) and $object->closedBy == $app->user->account or
!empty($object->lastEditedBy) and $object->lastEditedBy == $app->user->account)
{
return true;
}
@@ -2645,7 +2645,7 @@ EOD;
*/
public static function getSysURL()
{
$httpType = (isset($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] == 'on') ? 'https' : 'http';
$httpType = (isset($_SERVER["HTTPS"]) and $_SERVER["HTTPS"] == 'on') ? 'https' : 'http';
if(isset($_SERVER['HTTP_X_FORWARDED_PROTO']) and strtolower($_SERVER['HTTP_X_FORWARDED_PROTO']) == 'https') $httpType = 'https';
if(isset($_SERVER['REQUEST_SCHEME']) and strtolower($_SERVER['REQUEST_SCHEME']) == 'https') $httpType = 'https';
$httpHost = $_SERVER['HTTP_HOST'];
@@ -3114,7 +3114,7 @@ EOD;
return;
}
if($currentModule == $tab && $currentMethod == 'create')
if($currentModule == $tab and $currentMethod == 'create')
{
$lang->menu = $lang->$tab->homeMenu;
return;