Question

I have created a test module name 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.

Was it helpful?

Solution 3

In Save.php file, just add a line.

$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'];
}

OTHER TIPS

The most likely cause for the vTiger error “Sorry! Attempt to access restricted file.” is the $root_directory value in the ‘config.inc.php’ is incorrect or misspelled.

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. Then Go to 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.

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. Vtiger will include your module and now there is no need for you to include CRMEntity and other data or utils related files. It should all be available this way but make sure you are using the global statement for $current_user, $current_module etc though.

Another way is to edit the following functions located in utils/CommonUtils.php:

heckFileAccessForInclusion() and checkFileAccess()

Remove or comment out the die() in these functions to fix it.

To second what caspersky said:

Go to /include/database/PearDatabase.php and add $adb->setDebug(true); right after $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);

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.

A couple of things spring to mind:

  1. Have you actually created the modules/CustomeModule directory and populated it? (Using the template in vtlib/ModuleDir/5.4.0 and then editing the filenames and class of CustomeModule.php)

  2. Check the case of your module class definition, e.g. class CustomeModule vs. class 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." messages.

  4. In module setup script make sure you have added this lines.

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

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(); - In the database, "select distinct language from 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. (may not always work - for example en_us to en_gb is great, but en_us to sp_es is not)

It seems you did not set write permission for Smarty folder

Probably a file is missing in your vtiger install.

To find out which one is mission you would need to edit the include/utils/CommonUtils.php file. Open it with a text editor, go around line 2755 and add the following

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).

  • Disable some modules and try again until you find which module is broken.

In my case the broken module was VGS.

I solved this on vtiger 7.3.. (maybe it works for other vesion)

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.

I suggest logging out and maybe forcing refresh and waiting a little to make it work .

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top