예제 #1
0
파일: tools.php 프로젝트: evilgeny/bob
function basis($index = NULL)
{
    $basisConfig = array();
    foreach (C('penetration.basis') as $row) {
        $basisConfig[] = $row['@'];
    }
    return is_null($index) ? $basisConfig : addBasisParts($basisConfig[$index]['name']);
}
예제 #2
0
if (!isset($params['f'])) {
    print "No input file given\n";
    usage(basename(__FILE__));
}
$dir = dirname(__FILE__);
$parts = array();
foreach (qw2('p>periods b>basis r>groups') as $code => $function) {
    if (!isset($params[$code])) {
        continue;
    }
    $parts = array_merge($parts, $function($params[$code]));
}
if (count($parts) > 0) {
    $parts = addBase($parts);
    if (isset($parts['basis'])) {
        $parts = array_merge($parts, addBasisParts($parts['basis']));
    }
    if (isset($parts['level'])) {
        $parts = array_merge($parts, addLevelParts($parts['level']));
    }
    $data = file_get_contents($dir . '/' . $params['f']);
    foreach ($parts as $k => $v) {
        $data = preg_replace("/%" . strtoupper($k) . "%/", $v, $data);
    }
    print $data;
}
function periods($index = NULL)
{
    $periods = C('penetration.periods.period');
    if (isset($periods['@'])) {
        $periods = array($periods['@']);