예제 #1
0
/**
 * 
 * Function folder loop
 * This function checks http security settings
 * @param string $path = path to loop through
 * @version 1.0
 * @author Patrick Lockley
 */
function folder_loop($path)
{
    global $likelihood_array;
    $d = opendir($path);
    while ($f = readdir($d)) {
        if (is_dir($path . $f)) {
            if ($f != "." && $f != "..") {
                folder_loop($path . $f . "/");
            }
        } else {
            if ($f === "data.xml") {
                $template_check = simplexml_load_file($path . $f);
                if ($template_check->getName() == "learningObject") {
                    $folder = (string) $template_check['targetFolder'];
                    if ($folder != "") {
                        array_push($likelihood_array, $folder);
                    }
                }
            }
        }
    }
    closedir($d);
}
{
    $xwds = array();
    $d = opendir($path);
    while ($f = readdir($d)) {
        if (!is_dir($path . $f)) {
            if (strpos($f, ".xwd") > 0) {
                $string = $path . '/' . $f;
                array_push($xwds, $string);
            }
        }
    }
    closedir($d);
    return $xwds;
}
if ($argc != 2) {
    print "Usage: rebuildmodel <model xwd folder>\n";
} else {
    $xwd = new XerteXWDBuilder();
    if ($xwd->loadTemplateXWD($argv[1] . '/basic.xwd') != -1) {
        $skipTemplate = $argv[1] . '/template.xwd';
        $skipBasic = $argv[1] . '/basic.xwd';
        $xwds = folder_loop($argv[1]);
        sort($xwds);
        foreach ($xwds as $model) {
            if ($model != $skipTemplate && $model != $skipBasic) {
                $xwd->addXwd($model, 'true', 'false');
            }
        }
        $xwd->xml->asXML($argv[1] . '/template.xwd');
    }
}
예제 #3
0
/**
 * 
 * Function folder loop
 * This function checks http security settings
 * @param string $path = path to loop through
 * @version 1.0
 * @author Patrick Lockley
 */
function folder_loop($path)
{
    global $likelihood_array;
    $d = opendir($path);
    while ($f = readdir($d)) {
        if (is_dir($path . $f)) {
            if ($f != "." && $f != "..") {
                folder_loop($path . $f . "/");
            }
        } else {
            if (strpos($f, ".rlt") != 0) {
                $template_check = file_get_contents($path . $f);
                $folder = explode('"', substr($template_check, strpos($template_check, "targetFolder"), strpos($template_check, "version") - strpos($template_check, "targetFolder")));
                $start_point = strpos($template_check, "version");
                $version = explode('"', substr($template_check, $start_point, strpos($template_check, " ", $start_point) - $start_point));
                $temp_array = array($folder[1], $version[1]);
                array_push($likelihood_array, $temp_array);
            } else {
            }
        }
    }
    closedir($d);
}