简体   繁体   English

Vtiger 自定义模块:“对不起! 尝试访问受限文件。”

[英]Vtiger Custom Module : “Sorry! Attempt to access restricted file.”

I have created a test module name Mytest.我创建了一个名为 Mytest 的测试模块。 While saving values from the module, I am getting a blank page and it saying "Sorry! Attempt to access restricted file. " .在保存模块中的值时,我得到一个空白页面,上面写着“抱歉!尝试访问受限文件。”。 Do anyone know, why this happening.有谁知道,为什么会这样。 Any help on this is really appreciating.对此的任何帮助真的很感激。

The most likely cause for the vTiger error “Sorry! vTiger 错误的最可能原因“对不起! Attempt to access restricted file.”尝试访问受限文件。” is the $root_directory value in the 'config.inc.php' is incorrect or misspelled. 'config.inc.php' 中的 $root_directory 值不正确或拼写错误。

In order to correct it follow the steps below:为了纠正它,请按照以下步骤操作:

Go to your vTigerCRM directory
Open “config.inc.php” with your favorite text editor
Go to line 86 and adjust $root_directory value to correct vTiger 
directory. Note, that the directory must end with /. It should look 
something like this – $root_directory = ‘/var/www/vtigercrm/’;

Also there is a problem with cache memory.高速缓存也有问题。 So do check your cache file for template files.所以一定要检查你的缓存文件中的模板文件。 For that go to your vTigerCRM directory.为此,请转到您的 vTigerCRM 目录。 Then Go to Smarty->templates_c.然后转到 Smarty->templates_c。

Here you will get list of cache files.在这里您将获得缓存文件列表。 Delete this file and check weather your problem is solved or not.删除此文件并检查您的问题是否已解决。

Don't worry about deletion of this file.不要担心删除此文件。

When trying to include files from your custom module, you will get these messages because Vtiger thinks you are including these files from a location they find rather unsafe.当尝试包含自定义模块中的文件时,您会收到这些消息,因为 Vtiger 认为您从他们认为相当不安全的位置包含这些文件。

To avoid this error you could use the standard way a module is used in Vtiger by navigating to it like so: ......./index.php?module=Mytest&action=index .为避免此错误,您可以使用......./index.php?module=Mytest&action=index使用模块的标准方式,如下所示: ......./index.php?module=Mytest&action=index Vtiger will include your module and now there is no need for you to include CRMEntity and other data or utils related files. Vtiger 将包含您的模块,现在您无需包含CRMEntity和其他datautils相关文件。 It should all be available this way but make sure you are using the global statement for $current_user , $current_module etc though.它应该以这种方式全部可用,但请确保您使用的是$current_user$current_module等的global语句。

Another way is to edit the following functions located in utils/CommonUtils.php :另一种方法是编辑位于utils/CommonUtils.php的以下函数:

heckFileAccessForInclusion() and checkFileAccess() heckFileAccessForInclusion()checkFileAccess()

Remove or comment out the die() in these functions to fix it.删除或注释掉这些函数中的die()以修复它。

In Save.php file, just add a line.在 Save.php 文件中,只需添加一行。

$focus->column_fields['assigned_user_id'] = '';

before the之前

if($_REQUEST['assigntype'] == 'U') {
$focus->column_fields['assigned_user_id'] = $_REQUEST['assigned_user_id'];
} elseif($_REQUEST['assigntype'] == 'T') {
$focus->column_fields['assigned_user_id'] = $_REQUEST['assigned_group_id'];
}

To second what caspersky said:附上卡巴斯基所说的:

Go to /include/database/PearDatabase.php and add $adb->setDebug(true);转到/include/database/PearDatabase.php并添加$adb->setDebug(true); right after $adb->connect(); $adb->connect();$adb->connect();

I just wrote a module and received this error and it was because the record could not save because I left out: $moduleInstance->setEntityIdentifier($fieldInstance);我刚刚写了一个模块并收到此错误,这是因为记录无法保存,因为我遗漏了: $moduleInstance->setEntityIdentifier($fieldInstance);

A couple of things spring to mind:有几件事浮现在脑海:

  1. Have you actually created the modules/CustomeModule directory and populated it?您是否真的创建了 modules/CustomeModule 目录并填充了它? (Using the template in vtlib/ModuleDir/5.4.0 and then editing the filenames and class of CustomeModule.php) (使用vtlib/ModuleDir/5.4.0中的模板,然后编辑CustomeModule.php的文件名和类)

  2. Check the case of your module class definition, eg class CustomeModule vs. class Customemodule检查您的模块类定义的情况,例如类 CustomeModule 与类 Customemodule

  3. If you are using any version control or symlinks in the development of your modules/Mytest code then this can trigger the "Sorry! Attempt to access restricted file."如果您在开发模块/Mytest 代码时使用任何版本控制或符号链接,那么这可能会触发“抱歉!尝试访问受限文件”。 messages.消息。

  4. In module setup script make sure you have added this lines.在模块设置脚本中确保您已添加此行。

$module->initTables(); $module->initTables(); $module->initWebservice(); $module->initWebservice();

Check out file permissions and file path it's trying to refer.检查它试图引用的文件权限和文件路径。

If you want to debug more set $adb->setDebug(true) in your index file and checkout for the errors.如果您想在索引文件中调试更多 set $adb->setDebug(true) 并检查错误。

您似乎没有为 Smarty 文件夹设置写权限

Check that all language files exist.检查所有语言文件是否存在。

The user module allows the admin user to configure a user's language even though the language file is not present on disk.即使语言文件不在磁盘上,用户模块也允许管理员用户配置用户的语言。

To quickly verify this is indeed the issue :- - Edit the include/utils/CommonUtils.php and print the $realfilepath variable ,and comment out the die();要快速验证这确实是问题所在:- - 编辑 include/utils/CommonUtils.php 并打印 $realfilepath 变量,并注释掉 die(); - In the database, "select distinct language from xxx_users"; - 在数据库中,“从 xxx_users 中选择不同的语言”;

You can fix this by downloading the required files.您可以通过下载所需的文件来解决此问题。

As a quick fix (read:hack):- - go to the include/language directory - copy an existing language file as the required one.作为快速修复(阅读:hack):--转到包含/语言目录-将现有语言文件复制为所需的文件。 (may not always work - for example en_us to en_gb is great, but en_us to sp_es is not) (可能并不总是有效 - 例如 en_us 到 en_gb 很棒,但 en_us 到 sp_es 不是)

Probably a file is missing in your vtiger install.您的 vtiger 安装中可能缺少文件。

To find out which one is mission you would need to edit the include/utils/CommonUtils.php file.要找出哪个是任务,您需要编辑 include/utils/CommonUtils.php 文件。 Open it with a text editor, go around line 2755 and add the following用文本编辑器打开它,绕过第 2755 行并添加以下内容

echo “REAL: $realfilepath, ROOT: $rootdirpath”;

Before die(Sorry....)死前(对不起....)

This would print on the screen which one is the missing file.这将在屏幕上打印哪个是丢失的文件。

Sometimes this error is caused by an nonexistent module, what I mean here is that vtiger thinks you have a module but the files are not in there (might be caused by a bad migration to a new server).有时这个错误是由不存在的模块引起的,我在这里的意思是 vtiger 认为你有一个模块,但文件不在那里(可能是由于错误迁移到新服务器引起的)。

  • Disable some modules and try again until you find which module is broken.禁用某些模块并重试,直到找到哪个模块损坏。

In my case the broken module was VGS.就我而言,损坏的模块是 VGS。

I solved this on vtiger 7.3.. (maybe it works for other vesion)我在 vtiger 7.3 上解决了这个问题..(也许它适用于其他版本)

I went to users permission on vtiger inside configuration settings and update tham all again with the same settings .. and got them to a more default settings .. them all users appeared back and I was able to create new users ..change password again.我在配置设置中获得了用户对 vtiger 的许可,并使用相同的设置再次更新 tham .. 并将它们设置为更多的默认设置.. 他们所有用户都回来了,我能够创建新用户 .. 再次更改密码。

I suggest logging out and maybe forcing refresh and waiting a little to make it work .我建议注销并强制刷新并稍等一下以使其正常工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM