コード例 #1
0
ファイル: article.c.php プロジェクト: Ben749/racetrack
<?php

#article
/** templateengine **/
$name = 'custom var : $name injected';
function customfunction($a, $b)
{
    $args = get_defined_vars();
    return 'customfunction:done:arguments:' . json_encode($args);
}
$x = FGC('adm/contents/articles.json');
if ($t = $x['post'][$id]) {
    if (U != $t['url']) {
        r302('/' . $t['url'] . '#unique');
    }
    /*mini template engine*/
    preg_match_all("~\\{\\{\\\$([^\\}]+)\\}\\}~s", $t['content'], $vars);
    preg_match_all("~\\{\\{([^\\}]+)\\(([^\\)]*)\\)\\}\\}~s", $t['content'], $fun);
    #if(count($vars[1]) or count($fun[1]))die('<pre>'.print_r(compact('vars','fun'),1));
    if (count($vars[1])) {
        foreach ($vars[1] as $index => $var) {
            if (${$var}) {
                $t['content'] = str_replace($vars[0][$index], ${$var}, $t['content']);
            }
        }
    }
    if (count($fun[1])) {
        foreach ($fun[1] as $index => $func) {
            $args = explode(',', $fun[2][$index]);
            if (function_exists($func)) {
                $t['content'] = str_replace($fun[0][$index], call_user_func_array($func, $args), $t['content']);
コード例 #2
0
ファイル: deprecated.php プロジェクト: Ben749/racetrack
function eregis($AR, $str, $R)
{
    if (Meregi($AR, $str)) {
        r302($R);
    }
}
コード例 #3
0
ファイル: editor.php プロジェクト: Ben749/racetrack
        $x['maxid']++;
        $id = $x['maxid'];
    }
    #new id
    unset($_POST['id']);
    $_POST['url'] = $id . '.' . trim(preg_replace('~-{2,}~', '-', preg_replace("~[^a-z0-9]~i", '-', $_POST['title'])), '-');
    $x['post'][$id] = array_filter($_POST);
    $ve = var_export($_POST, 1);
    #reduce produced string
    $ve = str_replace(["array (\n  ", ",\n  "], ['[', ','], $ve);
    if (substr($ve, -3) == ",\n)") {
        $ve = str_replace(",\n)", ']', $ve);
    }
    fpc('contents/ve.' . $fi . '.' . $id . '-.php', '<?$x=' . $ve . ';');
    fpc($file, $x);
    r302("?fi={$fi}&id={$id}#saved");
}
$id = $title = $content = '';
$id = $_GET['id'];
if ($id and $x['post'] and $x['post'][$id]) {
    extract($x['post'][$id]);
}
#print_r(compact('id','x'));
edit:
foreach ($x['post'] as $k => $t) {
    $options .= "<option value='{$k}'>" . $t['title'] . "</option>";
    $list[] = "<a href='?fi={$fi}&id={$k}'>" . $t['title'] . "</a>";
}
html:
?>
<html><head><title>racetrack editor - <?php