本文整理汇总了PHP中checkFileAccess函数的典型用法代码示例。如果您正苦于以下问题:PHP checkFileAccess函数的具体用法?PHP checkFileAccess怎么用?PHP checkFileAccess使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了checkFileAccess函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: updateUserModuleStep3
public function updateUserModuleStep3(Vtiger_Request $request)
{
$importModuleName = $request->get('module_import_name');
$uploadFile = $request->get('module_import_file');
$uploadDir = Settings_ModuleManager_Module_Model::getUploadDirectory();
$uploadFileName = "{$uploadDir}/{$uploadFile}";
checkFileAccess($uploadFileName);
$importType = strtolower($request->get('module_import_type'));
if ($importType == 'language') {
$package = new Vtiger_Language();
} else {
if ($importType == 'layout') {
vimport('vtlib.Vtiger.Layout');
$package = new Vtiger_Layout();
} else {
$package = new Vtiger_Package();
}
}
if ($importType == 'language' || $importType == 'layout') {
$package->import($uploadFileName);
} else {
$package->update(Vtiger_Module::getInstance($importModuleName), $uploadFileName);
}
checkFileAccessForDeletion($uploadFileName);
unlink($uploadFileName);
$result = array('success' => true, 'importModuleName' => $importModuleName);
$response = new Vtiger_Response();
$response->setResult($result);
$response->emit();
}
示例2: getInstance
static function getInstance($providername)
{
if (!empty($providername)) {
$providername = trim($providername);
$filepath = dirname(__FILE__) . "/providers/{$providername}.php";
checkFileAccess($filepath);
if (!class_exists($providername)) {
include_once $filepath;
}
return new $providername();
}
return false;
}
示例3: getInstance
static function getInstance($module)
{
$modName = $module;
if ($module == 'Calendar' || $module == 'Events') {
$module = 'Calendar';
$modName = 'Activity';
}
// File access security check
if (!class_exists($modName)) {
checkFileAccess("modules/{$module}/{$modName}.php");
require_once "modules/{$module}/{$modName}.php";
}
$focus = new $modName();
return $focus;
}
示例4: models
static function models()
{
global $adb;
$models = array();
$handlerResult = $adb->pquery("SELECT * FROM vtiger_mobile_alerts WHERE deleted = 0", array());
if ($adb->num_rows($handlerResult)) {
while ($handlerRow = $adb->fetch_array($handlerResult)) {
$handlerPath = $handlerRow['handler_path'];
if (file_exists($handlerPath)) {
checkFileAccess($handlerPath);
include_once $handlerPath;
$alertModel = new $handlerRow['handler_class']();
$alertModel->alertid = $handlerRow['id'];
$models[] = $alertModel;
}
}
}
return $models;
}
示例5: importUserModuleStep2
public function importUserModuleStep2(Vtiger_Request $request)
{
$viewer = $this->getViewer($request);
$uploadDir = Settings_ModuleManager_Extension_Model::getUploadDirectory();
$qualifiedModuleName = $request->getModule(false);
$uploadFile = 'usermodule_' . time() . '.zip';
$uploadFileName = "{$uploadDir}/{$uploadFile}";
checkFileAccess($uploadDir);
if (!move_uploaded_file($_FILES['moduleZip']['tmp_name'], $uploadFileName)) {
$viewer->assign('MODULEIMPORT_FAILED', true);
} else {
$package = new Vtiger_Package();
$importModuleName = $package->getModuleNameFromZip($uploadFileName);
$importModuleDepVtVersion = $package->getDependentVtigerVersion();
if ($importModuleName == null) {
$viewer->assign('MODULEIMPORT_FAILED', true);
$viewer->assign("MODULEIMPORT_FILE_INVALID", true);
checkFileAccessForDeletion($uploadFileName);
unlink($uploadFileName);
} else {
// We need these information to push for Update if module is detected to be present.
$moduleLicence = vtlib_purify($package->getLicense());
$viewer->assign("MODULEIMPORT_FILE", $uploadFile);
$viewer->assign("MODULEIMPORT_TYPE", $package->type());
$viewer->assign("MODULEIMPORT_NAME", $importModuleName);
$viewer->assign("MODULEIMPORT_DEP_VTVERSION", $importModuleDepVtVersion);
$viewer->assign("MODULEIMPORT_LICENSE", $moduleLicence);
if (!$package->isLanguageType() && !$package->isModuleBundle()) {
$moduleInstance = Vtiger_Module::getInstance($importModuleName);
$moduleimport_exists = $moduleInstance ? "true" : "false";
$moduleimport_dir_name = "modules/{$importModuleName}";
$moduleimport_dir_exists = is_dir($moduleimport_dir_name) ? "true" : "false";
$viewer->assign("MODULEIMPORT_EXISTS", $moduleimport_exists);
$viewer->assign("MODULEIMPORT_DIR", $moduleimport_dir_name);
$viewer->assign("MODULEIMPORT_DIR_EXISTS", $moduleimport_dir_exists);
}
}
}
$viewer->view('ImportUserModuleStep2.tpl', $qualifiedModuleName);
}
示例6: vtlib_isCustomModule
/**
* Check for custom module by its name.
*/
function vtlib_isCustomModule($moduleName)
{
$moduleFile = "modules/{$moduleName}/{$moduleName}.php";
if (file_exists($moduleFile)) {
if (function_exists('checkFileAccess')) {
checkFileAccess($moduleFile);
}
include_once $moduleFile;
$focus = new $moduleName();
return isset($focus->IsCustomModule) && $focus->IsCustomModule;
}
return false;
}
示例7: parse_url
$siteURLParts = parse_url($site_URL);
$cookieDomain = $siteURLParts['host'];
if (isset($_SESSION['authenticated_user_id'])) {
$log->debug("setting cookie ck_login_id_vtiger to " . $_SESSION['authenticated_user_id']);
setcookie('ck_login_id_vtiger', $_SESSION['authenticated_user_id'], 0, null, $cookieDomain, false, true);
}
if (isset($_SESSION['vtiger_authenticated_user_theme'])) {
$log->debug("setting cookie ck_login_theme_vtiger to " . $_SESSION['vtiger_authenticated_user_theme']);
setcookie('ck_login_theme_vtiger', $_SESSION['vtiger_authenticated_user_theme'], 0, null, $cookieDomain, false, true);
}
if (isset($_SESSION['authenticated_user_language'])) {
$log->debug("setting cookie ck_login_language_vtiger to " . $_SESSION['authenticated_user_language']);
setcookie('ck_login_language_vtiger', $_SESSION['authenticated_user_language'], 0, null, $cookieDomain, false, true);
}
if ($_REQUEST['module'] == 'Documents' && $action == 'DownloadFile') {
checkFileAccess('modules/Documents/DownloadFile.php');
include 'modules/Documents/DownloadFile.php';
exit;
}
//skip headers for popups, deleting, saving, importing and other actions
if (!$skipHeaders) {
$log->debug("including headers");
if ($use_current_login) {
if (isset($_REQUEST['category']) && $_REQUEST['category'] != '') {
$category = vtlib_purify($_REQUEST['category']);
} else {
$category = getParentTabFromModule($currentModule);
}
include 'modules/Vtiger/header.php';
}
if (isset($_SESSION['administrator_error'])) {
示例8: get_pdf
/** function used to get the Quotes/Invoice pdf
* @param int $id - id -id
* return string $output - pd link value
*/
function get_pdf($id, $block, $customerid, $sessionid)
{
global $adb;
global $current_user, $log, $default_language;
global $currentModule, $mod_strings, $app_strings, $app_list_strings;
$log->debug("Entering customer portal function get_pdf");
$isPermitted = check_permission($customerid, $block, $id);
if ($isPermitted == false) {
return array("#NOT AUTHORIZED#");
}
if (!validateSession($customerid, $sessionid)) {
return null;
}
require_once "modules/Users/Users.php";
require_once "config.inc.php";
$seed_user = new Users();
$user_id = $seed_user->retrieve_user_id('admin');
$current_user = $seed_user;
$current_user->retrieveCurrentUserInfoFromFile($user_id);
$currentModule = $block;
$current_language = $default_language;
$app_strings = return_application_language($current_language);
$app_list_strings = return_app_list_strings_language($current_language);
$mod_strings = return_module_language($current_language, $currentModule);
$_REQUEST['record'] = $id;
$_REQUEST['savemode'] = 'file';
$filenamewithpath = 'test/product/' . $id . '_' . $block . '.pdf';
if (file_exists($filenamewithpath) && filesize($filenamewithpath) != 0) {
unlink($filenamewithpath);
}
checkFileAccess("modules/{$block}/CreatePDF.php");
include "modules/{$block}/CreatePDF.php";
if (file_exists($filenamewithpath) && filesize($filenamewithpath) != 0) {
//we have to pass the file content
$filecontents[] = base64_encode(file_get_contents($filenamewithpath));
unlink($filenamewithpath);
// TODO: Delete the file to avoid public access.
} else {
$filecontents = "failure";
}
$log->debug("Exiting customer portal function get_pdf");
return $filecontents;
}
示例9: getInstanceById
/**
* Function to get instance by using id
* @param <Integer> $extensionId
* @param <String> $fileName
* @return <Settings_ModuleManager_Extension_Model> $extension Model
*/
public static function getInstanceById($extensionId, $fileName = false)
{
$uploadDir = self::getUploadDirectory();
if ($fileName) {
if (is_dir($uploadDir)) {
$uploadFileName = "{$uploadDir}/{$fileName}";
checkFileAccess(self::getUploadDirectory());
$extensionModel = new self();
$extensionModel->setId($extensionId)->setFileName($fileName);
return $extensionModel;
}
} else {
if (!is_dir($uploadDir)) {
mkdir($uploadDir);
}
$uploadFile = 'usermodule_' . time() . '.zip';
$uploadFileName = "{$uploadDir}/{$uploadFile}";
checkFileAccess(self::getUploadDirectory());
$packageAvailable = Settings_ModuleManager_Extension_Model::download($extensionId, $uploadFileName);
if ($packageAvailable) {
$extensionModel = new self();
$extensionModel->setId($extensionId)->setFileName($uploadFile);
return $extensionModel;
}
}
return false;
}
示例10: sprintf
try {
$cronTask->setBulkMode(true);
// Not ready to run yet?
if (!$cronTask->isRunnable()) {
echo sprintf("[INFO] %s - not ready to run as the time to run again is not completed\n", $cronTask->getName());
continue;
}
// Timeout could happen if intermediate cron-tasks fails
// and affect the next task. Which need to be handled in this cycle.
if ($cronTask->hadTimedout()) {
echo sprintf("[INFO] %s - cron task had timedout as it is not completed last time it run- restarting\n", $cronTask->getName());
}
// Mark the status - running
$cronTask->markRunning();
echo sprintf('[CRON],"%s",%s,%s,"%s","",[STARTS]', $cronRunId, $site_URL, $cronTask->getName(), date('Y-m-d H:i:s', $cronTask->getLastStart())) . "\n";
checkFileAccess($cronTask->getHandlerFile());
require_once $cronTask->getHandlerFile();
// Mark the status - finished
$cronTask->markFinished();
echo "\n" . sprintf('[CRON],"%s",%s,%s,"%s","%s",[ENDS]', $cronRunId, $site_URL, $cronTask->getName(), date('Y-m-d H:i:s', $cronTask->getLastStart()), date('Y-m-d H:i:s', $cronTask->getLastEnd())) . "\n";
} catch (Exception $e) {
echo sprintf("[ERROR]: %s - cron task execution throwed exception.\n", $cronTask->getName());
echo $e->getMessage();
echo "\n";
}
}
$cronEnds = date('Y-m-d H:i:s');
echo sprintf('[CRON],"%s",%s,Instance,"%s","%s",[ENDS]', $cronRunId, $site_URL, $cronStarts, $cronEnds) . "\n";
} else {
echo "Access denied!";
}
示例11: array
$result = $adb->pquery($query, array($current_user->id));
$res_row = $adb->fetchByAssoc($result);
foreach ($res_row as $columnName => $value) {
$myString .= '$users_' . $columnName . ' = "' . $value . "\";\n\n";
$usercolName[$n] = $columnName;
$n++;
$m = $n;
}
$myString .= "\$globals = \"";
for ($i = 0; $i < $j - 1; $i++) {
$myString .= "\\\$" . $module . "_" . $colName[$i] . ", ";
}
for ($n = 0; $n < $m; $n++) {
$myString .= '\\$users_' . $usercolName[$n] . ", ";
}
$myString .= "\\\$" . $module . "_" . $colName[$i];
$myString .= "\"; \n\n";
$myString .= "?> \n";
if ($is_writable && ($config_file = @fopen($root_directory . '/modules/Emails/templates/testemailtemplateusage.php', "w"))) {
$log->debug("writing to the testemailtemplatuseage.php file");
fputs($config_file, $myString, strlen($myString));
fclose($config_file);
}
checkFileAccess($root_directory . '/modules/Emails/templates/' . $_REQUEST["templatename"]);
$templatename = $root_directory . '/modules/Emails/templates/' . $_REQUEST["templatename"];
header("Location:index.php?module=Users&action=TemplateMerge&templatename=" . $templatename);
?>
<script>
window.close()
</script>
示例12: updateUserModuleStep3
public function updateUserModuleStep3(Vtiger_Request $request)
{
$viewer = $this->getViewer($request);
$qualifiedModuleName = $request->getModule(false);
$importModuleName = $request->get('module_import_name');
$uploadFile = $request->get('module_import_file');
$uploadDir = Settings_ModuleManager_Extension_Model::getUploadDirectory();
$uploadFileName = "{$uploadDir}/{$uploadFile}";
checkFileAccess($uploadFileName);
$importType = $request->get('module_import_type');
if (strtolower($importType) == 'language') {
$package = new Vtiger_Language();
} else {
$package = new Vtiger_Package();
}
if (strtolower($importType) == 'language') {
$package->import($uploadFileName);
} else {
$package->update(Vtiger_Module::getInstance($importModuleName), $uploadFileName);
}
checkFileAccessForDeletion($uploadFileName);
unlink($uploadFileName);
$viewer->assign("UPDATE_MODULE_NAME", $importModuleName);
$viewer->assign('QUALIFIED_MODULE', $qualifiedModuleName);
$viewer->view('UpdateUserModuleStep3.tpl', $qualifiedModuleName);
}
示例13: checkFileAccess
?>
<?php
if (is_file($filename)) {
checkFileAccess($filename);
include $filename;
} else {
if ($_SESSION['customer_id'] != '') {
$permission = array();
// Look if we have the information already
if (isset($_SESSION['__permitted_modules'])) {
$permission = $_SESSION['__permitted_modules'];
// Store for further re-use
$_SESSION['__permitted_modules'] = $permission;
} else {
// Get the information from server
$params = array();
$permission = $client->call('get_modules', $params, $Server_path, $Server_path);
}
$module = $permission[0];
checkFileAccess("{$module}/index.php");
include "{$module}/index.php";
}
}
if (!$isAjax) {
include "footer.html";
}
} else {
header("Location: login.php");
}
}
示例14: getInstanceById
/**
* Function to get instance by using id
* @param <Integer> $extensionId
* @param <String> $fileName
* @return <Settings_ExtensionStore_Extension_Model> $extension Model
*/
public function getInstanceById($extensionId, $trial = false, $fileName = false) {
$uploadDir = self::getUploadDirectory();
if ($fileName) {
if (is_dir($uploadDir)) {
$uploadFileName = "$uploadDir/$fileName";
checkFileAccess(self::getUploadDirectory());
$extensionModel = new self();
$extensionModel->setId($extensionId)->setFileName($fileName);
return $extensionModel;
}
} else {
if (!is_dir($uploadDir)) {
mkdir($uploadDir);
}
$uploadFile = 'usermodule_'. time() . '.zip';
$uploadFileName = "$uploadDir/$uploadFile";
checkFileAccess(self::getUploadDirectory());
$response = $this->download($extensionId, $trial, $uploadFileName);
if ($response['success']) {
$extensionModel = new self();
$extensionModel->setId($extensionId)->setFileName($uploadFile);
return array('success' => true, 'result' => $extensionModel);
}else{
return array('success' => false, 'message' => $response['message']);
}
}
return false;
}
示例15: checkFileAccess
exit;
}
if (isset($_REQUEST['file']) && $_REQUEST['file'] != '' && !isset($_REQUEST['ajax'])) {
checkFileAccess("modules/" . $_REQUEST['module'] . "/" . $_REQUEST['file'] . ".php");
require_once "modules/" . $_REQUEST['module'] . "/" . $_REQUEST['file'] . ".php";
exit;
}
$mailid = vtlib_purify($_REQUEST["mailid"]);
if (isset($_REQUEST["mailbox"]) && $_REQUEST["mailbox"] != "") {
$mailbox = vtlib_purify($_REQUEST["mailbox"]);
} else {
$mailbox = "INBOX";
}
$adb->println("Inside WebmailsAjax.php");
if (isset($_POST["file"]) && $_POST["ajax"] == "true") {
checkFileAccess("modules/" . $_REQUEST["module"] . "/" . $_POST["file"] . ".php");
require_once "modules/" . $_REQUEST["module"] . "/" . $_POST["file"] . ".php";
}
if (isset($_REQUEST["command"]) && $_REQUEST["command"] != "") {
$command = $_REQUEST["command"];
if ($command == "expunge") {
$MailBox = new MailBox($mailbox);
imap_expunge($MailBox->mbox);
$MailBox = new MailBox($mailbox);
$elist = $MailBox->mailList;
$num_mails = $elist['count'];
$start_page = cal_start($num_mails, $MailBox->mails_per_page);
imap_close($MailBox->mbox);
echo $start_page;
flush();
exit;