예제 #1
0
/**
 * Looks recursively through the directory structure for an access.php file.
 * If found, it will return this file parsed into an array.
 *
 * @param string
 * @param string
 * @return array
 *
 */
function help_get_access($path, $stop)
{
    if (@file_exists($path . '/access.php')) {
        return ini_parse($path . '/access.php', false);
    }
    $info = pathinfo($path);
    $newpath = $info['dirname'];
    if ($newpath == $stop) {
        return array();
    }
    return help_get_access($newpath, $stop);
}
예제 #2
0
<?php

loader_import('appdoc.functions');
if (empty($parameters['appname']) || strstr($parameters['appname'], '..') || !@is_dir(getcwd() . '/inc/app/' . $parameters['appname'])) {
    header('Location: ' . $_SERVER['HTTP_REFERER']);
    exit;
}
if (empty($parameters['form']) || strstr($parameters['form'], '..') || !@is_dir(getcwd() . '/inc/app/' . $parameters['appname'] . '/forms/' . $parameters['form'])) {
    header('Location: ' . $_SERVER['HTTP_REFERER']);
    exit;
}
$path = getcwd() . '/inc/app/' . $parameters['appname'] . '/forms/' . $parameters['form'];
$data = array();
$data['access'] = help_get_access($path, getcwd() . '/inc/app/' . $parameters['appname']);
$data['settings'] = ini_parse($path . '/settings.php');
$data['info'] = array_shift($data['settings']);
$data['params'] = $data['settings'];
$data['description'] = $data['info']['description'];
foreach ($data['params'] as $key => $value) {
    $rules = array();
    foreach ($value as $k => $v) {
        if (strpos($k, 'rule ') === 0) {
            $rules[] = $v;
        }
    }
    if (count($rules) == 0) {
        $rules = false;
    }
    $data['params'][$key]['rules'] = $rules;
}
ob_start();