Example #1
0
quietechorun("\"{$ac['PHP']}\" -q \"{$ac['basedir']}/scripts/file-entities.php\"{$redir}");
checking("for if we should generate a simplified file");
if ($ac["GENERATE"] != "no") {
    if (!file_exists($ac["GENERATE"])) {
        checkerror("Can't find {$ac["GENERATE"]}");
    }
    $tmp = realpath($ac["GENERATE"]);
    $ac["GENERATE"] = str_replace($ac["ROOTDIR"] . $ac["LANGDIR"], "", $tmp);
    $str = "\n<!ENTITY developer.include.file SYSTEM 'file:///{$ac["GENERATE"]}'>";
    file_put_contents("{$ac["basedir"]}/entities/file-entities.ent", $str, FILE_APPEND);
    $ac["INPUT_FILENAME"] = "developer.template.xml";
    $ac["FORCE_DOM_SAVE"] = "yes";
}
checkvalue($ac["GENERATE"]);
checking('whether to save an invalid .manual.xml');
checkvalue($ac['FORCE_DOM_SAVE']);
echo "Loading and parsing {$ac["INPUT_FILENAME"]}... ";
flush();
$dom = new DOMDocument();
// realpath() is important: omitting it causes severe performance degradation
// and doubled memory usage on Windows.
$didLoad = $dom->load(realpath("{$ac['srcdir']}/{$ac["INPUT_FILENAME"]}"), $LIBXML_OPTS);
// Check if the XML was simply broken, if so then just bail out
if ($didLoad === false) {
    echo "failed.\n";
    print_xml_errors();
    errors_are_bad(1);
}
echo "done.\n";
echo "Validating {$ac["INPUT_FILENAME"]}... ";
flush();
    if ($_GET['rid']) {
        $wheresql = " AND rid='{$rid}'";
    }
    require_once libfile('function/forumlist');
    $select = forumselect(false, 0, $_GET['fid']);
    $keys = array_keys($_G['setting']['extcredits']);
    foreach (C::t('common_credit_rule')->fetch_all_by_rid($rid) as $value) {
        if (!helper_access::check_module('doing') && $value['action'] == 'doing') {
            continue;
        } elseif (!helper_access::check_module('blog') && $value['action'] == 'publishblog') {
            continue;
        } elseif (!helper_access::check_module('wall') && in_array($value['action'], array('guestbook', 'getguestbook'))) {
            continue;
        }
        if (empty($_GET['fid']) || in_array($value['action'], array('digest', 'post', 'reply', 'getattach', 'postattach'))) {
            if (checkvalue($value, $keys)) {
                $list[$value['action']] = $value;
            }
        }
    }
    if (!empty($_GET['fid'])) {
        $_GET['fid'] = intval($_GET['fid']);
        $foruminfo = C::t('forum_forumfield')->fetch($_GET['fid']);
        $flist = dunserialize($foruminfo['creditspolicy']);
        foreach ($flist as $action => $value) {
            $list[$value['action']] = $value;
        }
    }
}
include_once template("home/spacecp_credit_base");
function checkvalue($value, $creditids)
Example #3
0
function safe_get($str)
{
    @($x = $_REQUEST[$str]);
    checkvalue($x);
    return $x;
}