晋太元中,武陵人捕鱼为业。缘溪行,忘路之远近。忽逢桃花林,夹岸数百步,中无杂树,芳草鲜美,落英缤纷。渔人甚异之,复前行,欲穷其林。 林尽水源,便得一山,山有小口,仿佛若有光。便舍船,从口入。初极狭,才通人。复行数十步,豁然开朗。土地平旷,屋舍俨然,有良田、美池、桑竹之属。阡陌交通,鸡犬相闻。其中往来种作,男女衣着,悉如外人。黄发垂髫,并怡然自乐。 见渔人,乃大惊,问所从来。具答之。便要还家,设酒杀鸡作食。村中闻有此人,咸来问讯。自云先世避秦时乱,率妻子邑人来此绝境,不复出焉,遂与外人间隔。问今是何世,乃不知有汉,无论魏晋。此人一一为具言所闻,皆叹惋。余人各复延至其家,皆出酒食。停数日,辞去。此中人语云:“不足为外人道也。”(间隔 一作:隔绝) 既出,得其船,便扶向路,处处志之。及郡下,诣太守,说如此。太守即遣人随其往,寻向所志,遂迷,不复得路。 南阳刘子骥,高尚士也,闻之,欣然规往。未果,寻病终。后遂无问津者。
|
Server : Apache System : Linux srv.rainic.com 4.18.0-553.47.1.el8_10.x86_64 #1 SMP Wed Apr 2 05:45:37 EDT 2025 x86_64 User : rainic ( 1014) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/akaindir/public_html/crm/includes/runtime/ |
Upload File : |
<?php
/*+**********************************************************************************
* The contents of this file are subject to the vtiger CRM Public License Version 1.1
* ("License"); You may not use this file except in compliance with the License
* The Original Code is: vtiger CRM Open Source
* The Initial Developer of the Original Code is vtiger.
* Portions created by vtiger are Copyright (C) vtiger.
* All Rights Reserved.
************************************************************************************/
/**
* Abstract Controller Class
*/
abstract class Vtiger_Controller {
function __construct() { }
function loginRequired() {
return true;
}
abstract function getViewer(Vtiger_Request $request);
abstract function process (Vtiger_Request $request);
function validateRequest(Vtiger_Request $request) {}
function preProcess(Vtiger_Request $request) {}
function postProcess(Vtiger_Request $request) {}
// Control the exposure of methods to be invoked from client (kind-of RPC)
protected $exposedMethods = array();
/**
* Function that will expose methods for external access
* @param <String> $name - method name
*/
protected function exposeMethod($name) {
if(!in_array($name, $this->exposedMethods)) {
$this->exposedMethods[] = $name;
}
}
/**
* Function checks if the method is exposed for client usage
* @param string $name - method name
* @return boolean
*/
function isMethodExposed($name) {
if(in_array($name, $this->exposedMethods)) {
return true;
}
return false;
}
/**
* Function invokes exposed methods for this class
* @param string $name - method name
* @param Vtiger_Request $request
* @throws Exception
*/
function invokeExposedMethod() {
$parameters = func_get_args();
$name = array_shift($parameters);
if (!empty($name) && $this->isMethodExposed($name)) {
return call_user_func_array(array($this, $name), $parameters);
}
throw new Exception(vtranslate('LBL_NOT_ACCESSIBLE'));
}
}
/**
* Abstract Action Controller Class
*/
abstract class Vtiger_Action_Controller extends Vtiger_Controller {
function __construct() {
parent::__construct();
}
function getViewer(Vtiger_Request $request) {
throw new AppException ('Action - implement getViewer - JSONViewer');
}
function validateRequest(Vtiger_Request $request) {
return $request->validateReadAccess();
}
function preProcess(Vtiger_Request $request) {
return true;
}
protected function preProcessDisplay(Vtiger_Request $request) {
}
protected function preProcessTplName(Vtiger_Request $request) {
return false;
}
//TODO: need to revisit on this as we are not sure if this is helpful
/*function preProcessParentTplName(Vtiger_Request $request) {
return false;
}*/
function postProcess(Vtiger_Request $request) {
return true;
}
}
/**
* Abstract View Controller Class
*/
abstract class Vtiger_View_Controller extends Vtiger_Action_Controller {
protected $viewer;
function __construct() {
parent::__construct();
}
function getViewer(Vtiger_Request $request) {
if(!$this->viewer) {
global $vtiger_current_version, $vtiger_display_version, $onlyV7Instance;
$viewer = new Vtiger_Viewer();
$viewer->assign('APPTITLE', getTranslatedString('APPTITLE'));
$viewer->assign('VTIGER_VERSION', $vtiger_current_version);
$viewer->assign('VTIGER_DISPLAY_VERSION', $vtiger_display_version);
$viewer->assign('ONLY_V7_INSTANCE', $onlyV7Instance);
$this->viewer = $viewer;
}
return $this->viewer;
}
function getPageTitle(Vtiger_Request $request) {
$moduleName = $request->getModule();
$recordId = $request->get('record');
if($recordId && $moduleName) {
$module = Vtiger_Module_Model::getInstance($moduleName);
if($module && $module->isEntityModule()) {
$recordName = Vtiger_Util_Helper::getRecordName($recordId);
}
}
if ($recordName) {
return vtranslate($moduleName, $moduleName).' - '.$recordName;
} else {
$currentLang = Vtiger_Language_Handler::getLanguage();
$customWebTitle = Vtiger_Language_Handler::getLanguageTranslatedString($currentLang, 'LBL_'.$moduleName.'_WEBTITLE', $request->getModule(false));
if ($customWebTitle) {
return $customWebTitle;
}
return vtranslate($moduleName, $moduleName);
}
}
function preProcess(Vtiger_Request $request, $display=true) {
$currentUser = Users_Record_Model::getCurrentUserModel();
$viewer = $this->getViewer($request);
$viewer->assign('PAGETITLE', $this->getPageTitle($request));
$viewer->assign('SCRIPTS',$this->getHeaderScripts($request));
$viewer->assign('STYLES',$this->getHeaderCss($request));
$viewer->assign('SKIN_PATH', Vtiger_Theme::getCurrentUserThemePath());
$viewer->assign('LANGUAGE_STRINGS', $this->getJSLanguageStrings($request));
$viewer->assign('LANGUAGE', $currentUser->get('language'));
if ($request->getModule() != 'Install') {
$userCurrencyInfo = getCurrencySymbolandCRate($currentUser->get('currency_id'));
$viewer->assign('USER_CURRENCY_SYMBOL', $userCurrencyInfo['symbol']);
}
$viewer->assign('CURRENT_USER_MODEL', Users_Record_Model::getCurrentUserModel());
if($display) {
$this->preProcessDisplay($request);
}
}
protected function preProcessTplName(Vtiger_Request $request) {
return 'Header.tpl';
}
//Note : To get the right hook for immediate parent in PHP,
// specially in case of deep hierarchy
//TODO: Need to revisit this.
/*function preProcessParentTplName(Vtiger_Request $request) {
return parent::preProcessTplName($request);
}*/
protected function preProcessDisplay(Vtiger_Request $request) {
$viewer = $this->getViewer($request);
$displayed = $viewer->view($this->preProcessTplName($request), $request->getModule(false));
/*if(!$displayed) {
$tplName = $this->preProcessParentTplName($request);
if($tplName) {
$viewer->view($tplName, $request->getModule());
}
}*/
}
function postProcess(Vtiger_Request $request) {
$moduleName = $request->getModule();
$viewer = $this->getViewer($request);
$currentUser = Users_Record_Model::getCurrentUserModel();
$viewer->assign('ACTIVITY_REMINDER', $currentUser->getCurrentUserActivityReminderInSeconds());
$viewer->view('Footer.tpl', $moduleName);
}
/**
* Retrieves headers scripts that need to loaded in the page
* @param Vtiger_Request $request - request model
* @return <array> - array of Vtiger_JsScript_Model
*/
function getHeaderScripts(Vtiger_Request $request){
$headerScriptInstances = array();
$languageHandlerShortName = Vtiger_Language_Handler::getShortLanguageName();
$fileName = "libraries/jquery/posabsolute-jQuery-Validation-Engine/js/languages/jquery.validationEngine-$languageHandlerShortName.js";
if (!file_exists($fileName)) {
$fileName = "~libraries/jquery/posabsolute-jQuery-Validation-Engine/js/languages/jquery.validationEngine-en.js";
} else {
$fileName = "~libraries/jquery/posabsolute-jQuery-Validation-Engine/js/languages/jquery.validationEngine-$languageHandlerShortName.js";
}
$jsFileNames = array($fileName);
$jsScriptInstances = $this->checkAndConvertJsScripts($jsFileNames);
$headerScriptInstances = array_merge($jsScriptInstances,$headerScriptInstances);
return $headerScriptInstances;
}
function checkAndConvertJsScripts($jsFileNames) {
$fileExtension = 'js';
$jsScriptInstances = array();
if($jsFileNames) {
foreach($jsFileNames as $jsFileName) {
// TODO Handle absolute inclusions (~/...) like in checkAndConvertCssStyles
$jsScript = new Vtiger_JsScript_Model();
// external javascript source file handling
if(strpos($jsFileName, 'http://') === 0 || strpos($jsFileName, 'https://') === 0) {
$jsScriptInstances[$jsFileName] = $jsScript->set('src', $jsFileName);
continue;
}
$completeFilePath = Vtiger_Loader::resolveNameToPath($jsFileName, $fileExtension);
if(file_exists($completeFilePath)) {
if (strpos($jsFileName, '~') === 0) {
$filePath = ltrim(ltrim($jsFileName, '~'), '/');
// if ~~ (reference is outside vtiger6 folder)
if (substr_count($jsFileName, "~") == 2) {
$filePath = "../" . $filePath;
}
} else {
$filePath = str_replace('.','/', $jsFileName) . '.'.$fileExtension;
}
$jsScriptInstances[$jsFileName] = $jsScript->set('src', $filePath);
} else {
$fallBackFilePath = Vtiger_Loader::resolveNameToPath(Vtiger_JavaScript::getBaseJavaScriptPath().'/'.$jsFileName, 'js');
if(file_exists($fallBackFilePath)) {
$filePath = str_replace('.','/', $jsFileName) . '.js';
$jsScriptInstances[$jsFileName] = $jsScript->set('src', Vtiger_JavaScript::getFilePath($filePath));
}
}
}
}
return $jsScriptInstances;
}
/**
* Function returns the css files
* @param <Array> $cssFileNames
* @param <String> $fileExtension
* @return <Array of Vtiger_CssScript_Model>
*
* First check if $cssFileName exists
* if not, check under layout folder $cssFileName eg:layouts/vlayout/$cssFileName
*/
function checkAndConvertCssStyles($cssFileNames, $fileExtension='css') {
$cssStyleInstances = array();
foreach($cssFileNames as $cssFileName) {
$cssScriptModel = new Vtiger_CssScript_Model();
if(strpos($cssFileName, 'http://') === 0 || strpos($cssFileName, 'https://') === 0) {
$cssStyleInstances[] = $cssScriptModel->set('href', $cssFileName);
continue;
}
$completeFilePath = Vtiger_Loader::resolveNameToPath($cssFileName, $fileExtension);
$filePath = NULL;
if(file_exists($completeFilePath)) {
if (strpos($cssFileName, '~') === 0) {
$filePath = ltrim(ltrim($cssFileName, '~'), '/');
// if ~~ (reference is outside vtiger6 folder)
if (substr_count($cssFileName, "~") == 2) {
$filePath = "../" . $filePath;
}
} else {
$filePath = str_replace('.','/', $cssFileName) . '.'.$fileExtension;
$filePath = Vtiger_Theme::getStylePath($filePath);
}
$cssStyleInstances[] = $cssScriptModel->set('href', $filePath);
}
}
return $cssStyleInstances;
}
/**
* Retrieves css styles that need to loaded in the page
* @param Vtiger_Request $request - request model
* @return <array> - array of Vtiger_CssScript_Model
*/
function getHeaderCss(Vtiger_Request $request){
return array();
}
/**
* Function returns the Client side language string
* @param Vtiger_Request $request
*/
function getJSLanguageStrings(Vtiger_Request $request) {
$moduleName = $request->getModule(false);
if ($moduleName === 'Settings:Users') {
$moduleName = 'Users';
}
return Vtiger_Language_Handler::export($moduleName, 'jsLanguageStrings');
}
}