public function getKeys($routingPath = '')
 {
     $parser = new YAMLParser($this->logger);
     $parser->setFilePath(__SITE_PATH . DIRECTORY_SEPARATOR . 'src' . DIRECTORY_SEPARATOR . $routingPath);
     $retval = array();
     $config = $parser->loadConfig();
     if (is_array($config)) {
         $retval = $this->parseKeys($config);
     }
     $subdirectories = getDirectoryList();
     foreach ($subdirectories as $folder) {
         $parser->setFilePath($folder . '/config/routing.yml');
         $config = $parser->loadConfig();
         if (is_array($config)) {
             $retval = array_merge($retval, $this->parseKeys($config));
         }
     }
     return $retval;
 }
Exemple #2
0
function loadProb()
{
    global $pname, $filename, $uDir, $pDir, $inputFile, $probInput, $outputFile, $probOutput, $infoFile, $probInfo, $code, $language;
    $filename = "code";
    if (isset($pname)) {
        $filename = $pname;
    }
    // Read *input* file
    $pDir = "/var/www/HYPC/ProblemZone/Problems/" . $pname . "/";
    $allTestCases = getDirectoryList($pDir . "testCases/" . "in/", false);
    $inputFile = $pDir . "/testCases/in/" . $allTestCases[0];
    $probInput = readCode($pDir, $inputFile);
    // Read *output* file
    $outputFile = $pDir . "/testCases/out/" . $allTestCases[0];
    $probOutput = readCode($pDir, $outputFile);
    // Read *info* file
    $infoFile = $pDir . "info.txt";
    $probInfo = readCode($pDir, $infoFile);
}
function runProb()
{
    global $pname, $uOutput, $filename, $uDir, $pDir, $language, $inputFile, $input;
    $filename = "code";
    if (isset($pname)) {
        $filename = $pname;
    }
    // Write *input* file
    $userInputFile = $uDir . $filename . ".in";
    write2File($uDir, $userInputFile, $input);
    $tag = "pre";
    $uOutput = "";
    // User's test case
    $output = runCode($language, $filename, $userInputFile);
    $uOutput = $uOutput . "<tr><td><" . $tag . ">";
    $uOutput = $uOutput . $input;
    $uOutput = $uOutput . "</" . $tag . "></td>";
    $uOutput = $uOutput . "<td><" . $tag . ">";
    $uOutput = $uOutput . "Whatever you wanted it to output.";
    $uOutput = $uOutput . "</" . $tag . "></td>";
    $uOutput = $uOutput . "<td><" . $tag . ">";
    $uOutput = $uOutput . $output;
    $uOutput = $uOutput . "</" . $tag . "></td></tr>";
    // Go through all test cases
    $allTestCases = getDirectoryList($pDir . "testCases/in/", false);
    foreach ($allTestCases as $t) {
        // Read *input* file
        $allTestCases = getDirectoryList($pDir . "testCases/in/", false);
        $inputFile = $pDir . "/testCases/in/" . $t;
        $probInput = readCode($pDir, $inputFile);
        // Read *output* file
        $outputFile = $pDir . "/testCases/out/" . $t;
        $probOutput = readCode($pDir, $outputFile);
        // Run code
        $output = runCode($language, $filename, $inputFile);
        // Check if $output is equal to correct $probOutput
        if ($output == $probOutput) {
            $s = "color:green;font-weight:bold;";
        } else {
            $s = "color:red;font-style:italic;";
        }
        // Display data
        $uOutput = $uOutput . "<tr style='" . $s . "' ><td><" . $tag . ">";
        $uOutput = $uOutput . $probInput;
        $uOutput = $uOutput . "</" . $tag . "></td>";
        $uOutput = $uOutput . "<td><" . $tag . ">";
        $uOutput = $uOutput . $probOutput;
        $uOutput = $uOutput . "</" . $tag . "></td>";
        $uOutput = $uOutput . "<td><" . $tag . ">";
        $uOutput = $uOutput . $output;
        $uOutput = $uOutput . "</" . $tag . "></td></tr>";
    }
    /*
    <table border="1" id="output">
    	<tr>
    	<th>Input</th>
    	<th>Desired Output</th>
    	<th>Actual Output</th>
    	</tr>
    	<tr>
    	<td><pre><?PHP echo $probInput; ?></pre></td>
    	<td><pre><?PHP echo $probOutput; ?></pre></td>
    	<td><pre><?PHP echo $uOutput; ?></pre></td>
    	</tr>
    	<tr>
    	<td>Input2</td>
    	<td>Output2</td>
    	<td>UserOutput2</td>
    	</tr>
    	</table>
    */
}
 >Python</option>
<option value="Java" <?php 
isSelected($language, "Java");
?>
 >Java</option>
<option value="C++" <?php 
isSelected($language, "C++");
?>
 >C++</option>
</select>
<br />
<br />

Select a Problem: 
<?php 
$allProblems = getDirectoryList("/var/www/HYPC/ProblemZone/Problems/", false);
echo optionsFromArray($allProblems);
?>
 
<!--
File Name (excluding extensions, no .py, .java, or .cpp):<input <?php 
if ($mobile) {
    echo 'autocapitalize="off" autocorrect="off"';
}
?>
 id="fname2" name="fname2" value="<?php 
echo $pname;
?>
" />
-->
<input type="submit" value="Load" id="load" name="load">
Exemple #5
0
$currentDirectory = $baseDirectory;
if ($relativeDirectory != '') {
    $currentDirectory .= "/" . $relativeDirectory . "/";
}
$column = $_POST['column'] ? $_POST['column'] : "name";
$order = $_POST['order'] ? $_POST['order'] : "ascending";
$message = "";
$errorMessage = "";
if ($task == "createFolder") {
    $message .= createNewFolder($currentDirectory, $newFolder);
}
if (isset($_POST['submitUpload'])) {
    $message .= uploadFile($_FILES["uploadFile"], $currentDirectory);
}
if ($task == "removeFile") {
    $message .= removeFile($currentDirectory, $deleteFile);
}
if ($task == "renameFile") {
    $message .= renameFile($currentDirectory, $renameFrom, $renameTo);
}
$directoryList = getDirectoryList($currentDirectory);
$fileList = getFileList($currentDirectory);
$navigationList["Fnow"] = str_replace('\\', '/', pFNOW);
$navigationList["base"] = $cfg['base_directory'];
$navigationList["relative"] = $relativeDirectory;
$navigationList["column"] = $column;
$navigationList["order"] = $order;
$navigationList["pathData"] = $def['DIRECTORY'];
$directoryListXML = setDirectoryListXML($currentDirectory, $navigationList, $directoryList, $fileList, $message);
$result = processTransformation($directoryListXML, pFNOW . "/xsl/directoryList.xsl");
print $result;
Exemple #6
0
$data = parse($mimedecoder->get_parsed_message()->parts['0']->body, true);


if($data['password'] == $bloggy_config['mail_pass']) {
//If the passwords match, lets continue!
$data['password'] = null;

$data = array_filter($data);

$post = "";

foreach($data as $key => $value) {
$post .= $key.": ".$value."\r\n";
}

$dirlistnormal = getDirectoryList('./posts');

$post_number = count($dirlistnormal) + 1;

$post_name = "./posts/post".$post_number.".post";

$file_stream = fopen($post_name, 'w');
fwrite($file_stream, $post);

}

$response=$imap->delete_message(1);

}
//header('Location: index.php')
?>
Exemple #7
0
    $hstr = $harr[0];
    $hashval = $harr[1];
    $path = "{$urlprefix}{$hstr}/{$hashval}";
    $ndofile = $GLOBALS["cfg_cache"] . "/{$hstr};{$hashval}";
    $metafile = $GLOBALS["cfg_metadir"] . "/" . $hstr . ";" . $hashval;
    $metalink = "<a href=\"" . $GLOBALS["cfg_metasite"] . "/" . $hstr . ";" . $hashval . "\">meta</a>";
    if (file_exists($metafile)) {
        print "<li><a href=\"" . $path . "\"> ni:///" . $hstr . ";" . $hashval . "</a> (" . $metalink . ")</li>\n";
    } else {
        print "Metafile is: {$metafile} \n";
        print "<li><a href=\"" . $path . "\"> ni:///" . $hstr . ";" . $hashval . "</a></li>\n";
    }
}
print "</ul>";
print "<h2>Static (DocRoot) named data objects, with .well-known/ni equivalents</h2>";
print "<p>Some of the above will also be here. That's ok:-)</p>";
print "<ul>";
for ($i = 0; $i != count($alglist); $i++) {
    $hstr = $alglist[$i];
    $arr = getDirectoryList($wkd . "/" . $hstr);
    foreach ($arr as &$fname) {
        $path = $urlprefix . $hstr . "/" . $fname;
        $fpath = $wkd . "/" . $hstr . "/" . $fname;
        // print $fpath;
        if (is_link($fpath)) {
            print "<li><a href=\"" . $path . "\"> ni:///" . $hstr . ";" . $fname . "</a></li>\n";
        }
    }
}
print "</ul>";
print "</body></html>";
Exemple #8
0
function getLocalAcceptanceInstances()
{
    $instances = apc_fetch('local_instances');
    if (empty($instances) || getenv('ADT_DEV_MODE')) {
        $instances = array();
        $vhosts = getDirectoryList(getenv('ADT_DATA') . "/conf/adt/");
        $now = new DateTime();
        foreach ($vhosts as $vhost) {
            // Parse deployment descriptor
            $descriptor_array = parse_ini_file(getenv('ADT_DATA') . "/conf/adt/" . $vhost);
            $matches = array();
            if (preg_match("/([^\\-]*)\\-(.*\\-.*)\\-SNAPSHOT/", $descriptor_array['PRODUCT_VERSION'], $matches)) {
                $descriptor_array['BASE_VERSION'] = $matches[1];
                $descriptor_array['BRANCH_NAME'] = $matches[2];
            } elseif (preg_match("/(.*)\\-SNAPSHOT/", $descriptor_array['PRODUCT_VERSION'], $matches)) {
                $descriptor_array['BASE_VERSION'] = $matches[1];
                $descriptor_array['BRANCH_NAME'] = "";
            } else {
                $descriptor_array['BASE_VERSION'] = $descriptor_array['PRODUCT_VERSION'];
                $descriptor_array['BRANCH_NAME'] = "";
            }
            // Instance note
            if (file_exists(getenv('ADT_DATA') . "/conf/instances/" . $descriptor_array['PRODUCT_NAME'] . "-" . $descriptor_array['PRODUCT_VERSION'] . "." . $_SERVER['SERVER_NAME'] . ".note")) {
                $descriptor_array['INSTANCE_NOTE'] = file_get_contents(getenv('ADT_DATA') . "/conf/instances/" . $descriptor_array['PRODUCT_NAME'] . "-" . $descriptor_array['PRODUCT_VERSION'] . "." . $_SERVER['SERVER_NAME'] . ".note");
            }
            if ($descriptor_array['ARTIFACT_DATE']) {
                $artifact_age = DateTime::createFromFormat('Ymd.His', $descriptor_array['ARTIFACT_DATE'])->diff($now, true);
                if ($artifact_age->days) {
                    $descriptor_array['ARTIFACT_AGE_STRING'] = $artifact_age->format('%a day(s) ago');
                } else {
                    if ($artifact_age->h > 0) {
                        $descriptor_array['ARTIFACT_AGE_STRING'] = $artifact_age->format('%h hour(s) ago');
                    } else {
                        $descriptor_array['ARTIFACT_AGE_STRING'] = $artifact_age->format('%i minute(s) ago');
                    }
                }
                if ($artifact_age->days > 5) {
                    $descriptor_array['ARTIFACT_AGE_CLASS'] = "red";
                } else {
                    if ($artifact_age->days > 2) {
                        $descriptor_array['ARTIFACT_AGE_CLASS'] = "orange";
                    } else {
                        $descriptor_array['ARTIFACT_AGE_CLASS'] = "green";
                    }
                }
            } else {
                $descriptor_array['ARTIFACT_AGE_STRING'] = "Unknown";
                $descriptor_array['ARTIFACT_AGE_CLASS'] = "black";
            }
            $deployment_age = DateTime::createFromFormat('Ymd.His', $descriptor_array['DEPLOYMENT_DATE'])->diff($now, true);
            if ($deployment_age->days) {
                $descriptor_array['DEPLOYMENT_AGE_STRING'] = $deployment_age->format('%a day(s) ago');
            } else {
                if ($deployment_age->h > 0) {
                    $descriptor_array['DEPLOYMENT_AGE_STRING'] = $deployment_age->format('%h hour(s) ago');
                } else {
                    $descriptor_array['DEPLOYMENT_AGE_STRING'] = $deployment_age->format('%i minute(s) ago');
                }
            }
            // Logs URLs
            $scheme = !empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off' ? "https" : "http";
            $descriptor_array['DEPLOYMENT_LOG_APPSRV_URL'] = $scheme . "://" . $_SERVER['SERVER_NAME'] . ":" . $_SERVER['SERVER_PORT'] . "/logs.php?file=" . $descriptor_array['DEPLOYMENT_LOG_PATH'];
            $descriptor_array['DEPLOYMENT_LOG_APACHE_URL'] = $scheme . "://" . $_SERVER['SERVER_NAME'] . ":" . $_SERVER['SERVER_PORT'] . "/logs.php?file=" . getenv('ADT_DATA') . "/var/log/apache2/" . $descriptor_array['PRODUCT_NAME'] . "-" . $descriptor_array['PRODUCT_VERSION'] . "." . $_SERVER['SERVER_NAME'] . "-access.log";
            $descriptor_array['DEPLOYMENT_AWSTATS_URL'] = $scheme . "://" . $_SERVER['SERVER_NAME'] . ":" . $_SERVER['SERVER_PORT'] . "/stats/awstats.pl?config=" . $descriptor_array['PRODUCT_NAME'] . "-" . $descriptor_array['PRODUCT_VERSION'] . "." . $_SERVER['SERVER_NAME'];
            // status
            if (file_exists($descriptor_array['DEPLOYMENT_PID_FILE']) && processIsRunning(file_get_contents($descriptor_array['DEPLOYMENT_PID_FILE']))) {
                $descriptor_array['DEPLOYMENT_STATUS'] = "Up";
            } else {
                $descriptor_array['DEPLOYMENT_STATUS'] = "Down";
            }
            // Acceptance process state
            if (file_exists(getenv('ADT_DATA') . "/conf/features/" . $descriptor_array['PRODUCT_NAME'] . "-" . $descriptor_array['PRODUCT_VERSION'] . "." . $_SERVER['SERVER_NAME'] . ".status")) {
                $descriptor_array['ACCEPTANCE_STATE'] = file_get_contents(getenv('ADT_DATA') . "/conf/features/" . $descriptor_array['PRODUCT_NAME'] . "-" . $descriptor_array['PRODUCT_VERSION'] . "." . $_SERVER['SERVER_NAME'] . ".status");
            } else {
                $descriptor_array['ACCEPTANCE_STATE'] = "Implementing";
            }
            // Specification Link
            if (file_exists(getenv('ADT_DATA') . "/conf/features/" . $descriptor_array['PRODUCT_NAME'] . "-" . $descriptor_array['PRODUCT_VERSION'] . "." . $_SERVER['SERVER_NAME'] . ".spec")) {
                $descriptor_array['SPECIFICATIONS_LINK'] = file_get_contents(getenv('ADT_DATA') . "/conf/features/" . $descriptor_array['PRODUCT_NAME'] . "-" . $descriptor_array['PRODUCT_VERSION'] . "." . $_SERVER['SERVER_NAME'] . ".spec");
            } else {
                $descriptor_array['SPECIFICATIONS_LINK'] = "";
            }
            // Issue Link
            if (file_exists(getenv('ADT_DATA') . "/conf/features/" . $descriptor_array['PRODUCT_NAME'] . "-" . $descriptor_array['PRODUCT_VERSION'] . "." . $_SERVER['SERVER_NAME'] . ".issue")) {
                $descriptor_array['ISSUE_NUM'] = file_get_contents(getenv('ADT_DATA') . "/conf/features/" . $descriptor_array['PRODUCT_NAME'] . "-" . $descriptor_array['PRODUCT_VERSION'] . "." . $_SERVER['SERVER_NAME'] . ".issue");
            } else {
                $descriptor_array['ISSUE_NUM'] = "";
            }
            // SCM BRANCH
            if (file_exists(getenv('ADT_DATA') . "/conf/features/" . $descriptor_array['PRODUCT_NAME'] . "-" . $descriptor_array['PRODUCT_VERSION'] . "." . $_SERVER['SERVER_NAME'] . ".branch")) {
                $descriptor_array['SCM_BRANCH'] = file_get_contents(getenv('ADT_DATA') . "/conf/features/" . $descriptor_array['PRODUCT_NAME'] . "-" . $descriptor_array['PRODUCT_VERSION'] . "." . $_SERVER['SERVER_NAME'] . ".branch");
            } else {
                $descriptor_array['SCM_BRANCH'] = "";
            }
            // Branch name
            if (file_exists(getenv('ADT_DATA') . "/conf/features/" . $descriptor_array['PRODUCT_NAME'] . "-" . $descriptor_array['PRODUCT_VERSION'] . "." . $_SERVER['SERVER_NAME'] . ".desc")) {
                $descriptor_array['BRANCH_DESC'] = file_get_contents(getenv('ADT_DATA') . "/conf/features/" . $descriptor_array['PRODUCT_NAME'] . "-" . $descriptor_array['PRODUCT_VERSION'] . "." . $_SERVER['SERVER_NAME'] . ".desc");
            } else {
                $descriptor_array['BRANCH_DESC'] = $descriptor_array['BRANCH_NAME'];
            }
            // Server scheme where is deployed the instance
            $descriptor_array['ACCEPTANCE_SCHEME'] = $scheme;
            // Server hostname where is deployed the instance
            $descriptor_array['ACCEPTANCE_HOST'] = $_SERVER['SERVER_NAME'];
            // Server port where is deployed the instance
            $descriptor_array['ACCEPTANCE_PORT'] = $_SERVER['SERVER_PORT'];
            // Add it in the list
            if (empty($descriptor_array['PLF_BRANCH'])) {
                $instances['UNKNOWN'][] = $descriptor_array;
            } else {
                $instances[$descriptor_array['PLF_BRANCH']][] = $descriptor_array;
            }
        }
        // Instances will be cached for 2 min
        apc_store('local_instances', $instances, 120);
    }
    return $instances;
}
Exemple #9
0
<?php

//$debug = true;
// secure page
require '../../cgi/login.php';
debug_msg("User is logged in as {$username}");
if ($action = $_GET["action"]) {
    $fname = $_GET["file"];
    debug_msg("processing {$fname}");
    if ($action == "Overwrite pre-existing tutorial") {
        debug_msg("overwrite {$fname}");
        overwrite_old_file($fname);
    }
    remove_temp_file($fname);
}
$files = getDirectoryList("../users/{$username}/temp");
$num = count($files);
if ($num > 0) {
    echo "{$num} uploaded tutorial(s) already exist. What would you like to do?";
    echo "<ul>";
    foreach ($files as $file) {
        output_form($file);
    }
    echo "</ul>";
} else {
    header("Location: file_manager.php?msg=All files processed.");
}
function getDirectoryList($directory)
{
    // create an array to hold directory list
    $results = array();
 public static function run($allRules = false)
 {
     $database = Database::singleton();
     Notifications::addLog('------------------------- EXEC ENGINE STARTED -------------------------', 'ExecEngine');
     // Load the execEngine functions (security hazard :P)
     $files = getDirectoryList(__DIR__ . '/functions');
     foreach ($files as $file) {
         if (substr($file, -3) !== 'php') {
             continue;
         }
         require_once __DIR__ . '/functions/' . $file;
         Notifications::addLog('Included file: ' . __DIR__ . '/functions/' . $file, 'ExecEngine');
     }
     self::$roleName = Config::get('execEngineRoleName', 'execEngine');
     $role = Role::getRoleByName(self::$roleName);
     $maxRunCount = Config::get('maxRunCount', 'execEngine');
     self::$runCount = 0;
     self::$autoRerun = Config::get('autoRerun', 'execEngine');
     if ($role) {
         // Get all rules that are maintained by the ExecEngine
         while (self::$doRun) {
             self::$doRun = false;
             self::$runCount++;
             if (self::$runCount > $maxRunCount) {
                 throw new Exception('Maximum reruns exceeded for ExecEngine (rules with violations:' . implode(', ', $rulesThatHaveViolations) . ')', 500);
             }
             Notifications::addLog("ExecEngine run #" . self::$runCount . " (auto rerun: " . var_export(self::$autoRerun, true) . ") for role '" . $role->label . "'", 'ExecEngine');
             // Determine affected rules that must be checked by the exec engine
             $affectedConjuncts = (array) RuleEngine::getAffectedInvConjuncts($database->getAffectedConcepts(), $database->getAffectedRelations());
             $affectedConjuncts = array_merge($affectedConjuncts, (array) RuleEngine::getAffectedSigConjuncts($database->getAffectedConcepts(), $database->getAffectedRelations()));
             $affectedRules = array();
             foreach ($affectedConjuncts as $conjunctId) {
                 $conjunct = RuleEngine::getConjunct($conjunctId);
                 foreach ($conjunct['invariantRuleNames'] as $ruleName) {
                     $affectedRules[] = $ruleName;
                 }
                 foreach ($conjunct['signalRuleNames'] as $ruleName) {
                     $affectedRules[] = $ruleName;
                 }
             }
             // Check rules
             $rulesThatHaveViolations = array();
             foreach ($role->maintains() as $ruleName) {
                 if (!in_array($ruleName, $affectedRules) && !$allRules) {
                     continue;
                 }
                 // skip this rule
                 $rule = RuleEngine::getRule($ruleName);
                 $violations = RuleEngine::checkRule($rule, false);
                 if (count($violations)) {
                     $rulesThatHaveViolations[] = $rule['name'];
                     // Fix violations for every rule
                     ExecEngine::fixViolations($rule, $violations);
                     // Conjunct violations are not cached, because they are fixed by the ExecEngine
                     // If $autoRerun, set $doRun to true because violations have been fixed (this may fire other execEngine rules)
                     if (self::$autoRerun) {
                         self::$doRun = true;
                     }
                 }
             }
         }
     } else {
         Notifications::addInfo("ExecEngine extension included but role '" . self::$roleName . "' not found.");
     }
     Notifications::addLog('------------------------- END OF EXEC ENGINE -------------------------', 'ExecEngine');
 }
Exemple #11
0
  }


if ($debug) { echo "<b>DEBUG: $submit $ID $Name $Number</b><br>"; }

?>
<div id="Header">Incoming SMS anzeigen</div>
<div id="Content">

<!--body bgcolor="#FFFFFF" marginwidth="7" marginheight="30" topmargin="30" leftmargin="7" onLoad="Init()"-->
<body bgcolor="#FFFFFF" marginwidth="7" marginheight="30" topmargin="30" leftmargin="7">
<table width="500"border=1 cellpadding=0 cellspacing=0>
<tr>
<td>
<table border=1 cellpadding=0 cellspacing=3>
<?
	foreach (getDirectoryList ("/var/spool/sms/incoming/") as $file) {
		myreadfile ("/var/spool/sms/incoming/$file");
	}
	
?>
</table>
</td>
</tr>
</table>

</div>

</body>
</html>
Exemple #12
0
 *
 *
 *   You may not modify and/or remove any copyright notices or labels on the software on each
 *   page (unless full license is purchase) and in the header of each script source file.
 *
 *   You should have received a full copy of the LICENSE AGREEMENT along with
 *   Codefuture Image Hosting Script. If not, see http://codefuture.co.uk/projects/imagehost/license/.
 *
 *
 *   ABOUT THIS PAGE -----
 *   Used For:     Admin Database Tools
 *   Last edited:  19/12/2012
 *
 *************************************************************************************************************/
require_once 'lib/backup.class.php';
$backup_index = getDirectoryList();
////////////////////////////////////////////////////////////////////////////////////
//SAVE NEW SETTINGS
if (isset($_POST['changesettings'])) {
    $settings['SET_BACKUP_AUTO_ON'] = cl($_POST['setBackupAuto']) == 1 ? 1 : 0;
    $settings['SET_BACKUP_AUTO_TIME'] = cl($_POST['setBackupTime']);
    $settings['SET_BACKUP_AUTO_USE'] = cl($_POST['setUseBackup']) == 1 ? 1 : 0;
    $settings['SET_BACKUP_AUTO_REBUILD'] = cl($_POST['setRebuildBackup']) == 1 ? 1 : 0;
    // save settings
    if (empty($Err)) {
        if (saveSettings('inc/set.php', $settings)) {
            $Suc['saveing_settings'] = _T("admin_set_suc_update");
        } else {
            $Err['saveing_settings'] = _T("admin_set_err_saveing_settings");
        }
    }
Exemple #13
0
function loadProb()
{
    global $pname, $filename, $uDir, $pDir, $inputFile, $probInput, $outputFile, $probOutput, $infoFile, $probInfo, $code, $language, $topDir;
    $filename = "code";
    if ($pname == "") {
        $pname = "_Playground_";
    }
    if (isset($pname)) {
        $filename = $pname;
    }
    // Read *input* file
    $pDir = "{$topDir}/HYPC/ProblemZone/Problems/" . $pname . "/";
    $allTestCases = getDirectoryList($pDir . "/testCases/in/", false);
    //if (sizeof($allTestCases) != 0)
    //{
    //print_r($allTestCases);
    $inputFile = $pDir . "/testCases/in/" . $allTestCases[0];
    $probInput = readCode($pDir, $inputFile);
    // Read *output* file
    $outputFile = $pDir . "/testCases/out/" . $allTestCases[0];
    $probOutput = readCode($pDir, $outputFile);
    // Read *info* file
    $infoFile = $pDir . "info.txt";
    $probInfo = readCode($pDir, $infoFile);
    /*}
    	else
    	{
    	//echo "size is too small";
        $probInput = "";
        $probOutput = "";
        // Read *info* file
        $infoFile = $pDir."info.txt";
        $probInfo = readCode($pDir,$infoFile);
    	}*/
}
 public function buildHtml()
 {
     $this->addHtmlLine("<!doctype html>");
     $this->addHtmlLine('<html ng-app="AmpersandApp">');
     $this->addHtmlLine('<head>');
     $this->addHtmlLine('<title>' . Config::get('contextName') . '</title>');
     // Meta tags
     $this->addHtmlLine('<meta name="viewport" content="width=device-width, initial-scale=1.0"/>');
     $this->addHtmlLine('<meta charset="UTF-8">');
     $this->addHtmlLine('<meta http-equiv="Expires" content="0"/>');
     $this->addHtmlLine('<meta http-equiv="Cache-Control" content="no-store"/>');
     // initSessionId
     session_start();
     $this->addHtmlLine('<script type="text/javascript">var initSessionId = \'' . session_id() . '\';</script>');
     // JQuery
     $this->addHtmlLine('<script src="app/lib/jquery/jquery-1.11.0.min.js"></script>');
     $this->addHtmlLine('<script src="app/lib/jquery/jquery-migrate-1.2.1.js"></script>');
     $this->addHtmlLine('<script src="app/lib/jquery/jquery-ui-1.10.4.custom.js"></script>');
     // Bootstrap (requires Jquery, loaded above)
     $this->addHtmlLine('<link href="app/lib/bootstrap-3.3.5-dist/css/bootstrap.min.css" rel="stylesheet" media="screen">');
     // load boostrap.css before app specific css files that overwrite bootstrap.css
     $this->addHtmlLine('<script src="app/lib/bootstrap-3.3.5-dist/js/bootstrap.min.js"></script>');
     /*
      ********** Angular *********************************
      *
      */
     $this->addHtmlLine('<script src="app/lib/angular/angular.min.js"></script>');
     $this->addHtmlLine('<script src="app/lib/angular/angular-resource.min.js"></script>');
     $this->addHtmlLine('<script src="app/lib/angular/angular-route.min.js"></script>');
     $this->addHtmlLine('<script src="app/lib/angular/angular-sanitize.min.js"></script>');
     /* Third party directives/libraries for angular */
     // angular-ui-switch
     $this->addHtmlLine('<script src="app/lib/angular/angular-ui-switch/angular-ui-switch-adapted.js"></script>');
     $this->addHtmlLine('<link href="app/lib/angular/angular-ui-switch/angular-ui-switch.css" rel="stylesheet" media="screen" type="text/css">');
     // angular-busy
     $this->addHtmlLine('<script src="app/lib/angular/angular-busy/angular-busy.min.js"></script>');
     $this->addHtmlLine('<link href="app/lib/angular/angular-busy/angular-busy.min.css" rel="stylesheet" media="screen" type="text/css">');
     // si-table
     $this->addHtmlLine('<script src="app/lib/angular/si-table/si-table.js"></script>');
     // angular-code-mirror
     $this->addHtmlLine('<script src="app/lib/angular/angular-code-mirror/angular-code-mirror.min.js"></script>');
     $this->addHtmlLine('<link href="app/lib/angular/angular-code-mirror/angular-code-mirror.css" rel="stylesheet" media="screen" type="text/css">');
     // ng-storage
     $this->addHtmlLine('<script src="app/lib/angular/angular-ng-storage/ngStorage.min.js"></script>');
     // angular-file-upload
     $this->addHtmlLine('<script src="app/lib/angular/angular-file-upload/angular-file-upload.min.js"></script>');
     // angular-grid
     $this->addHtmlLine('<script src="app/lib/angular/angular-grid/ag-grid.min.js"></script>');
     $this->addHtmlLine('<link href="app/lib/angular/angular-grid/ag-grid.min.css" rel="stylesheet" media="screen" type="text/css">');
     $this->addHtmlLine('<link href="app/lib/angular/angular-grid/theme-dark.min.css" rel="stylesheet" media="screen" type="text/css">');
     $this->addHtmlLine('<link href="app/lib/angular/angular-grid/theme-fresh.min.css" rel="stylesheet" media="screen" type="text/css">');
     // Restangular (with depency for lodash)
     $this->addHtmlLine('<script src="app/lib/restangular/restangular.min.js"></script>');
     $this->addHtmlLine('<script src="app/lib/restangular/lodash.min.js"></script>');
     // jquery UI & bootstrap in native AngularJS
     $this->addHtmlLine('<script src="app/lib/ui-bootstrap/ui-bootstrap-tpls-0.14.3.min.js"></script>');
     // datetimepicker
     $this->addHtmlLine('<script src="app/lib/ui-bootstrap/datetimepicker/datetimepicker.js"></script>');
     $this->addHtmlLine('<link href="app/lib/ui-bootstrap/datetimepicker/datetimepicker.css" rel="stylesheet" media="screen" type="text/css">');
     $this->addHtmlLine('<script src="app/lib/json-patch/json-patch-duplex.min.js"></script>');
     /*
      ********** CSS *********************************
      *
      */
     // CSS files from app directory
     $files = getDirectoryList(__DIR__ . '/../app/css');
     $cssFiles = array();
     foreach ((array) $files as $file) {
         if (substr($file, -3) !== 'css') {
             continue;
         }
         if ($file == 'ampersand.css') {
             array_unshift($cssFiles, 'app/css/' . $file);
         } else {
             $cssFiles[] = 'app/css/' . $file;
         }
     }
     // Add css files to html output
     foreach ($cssFiles as $file) {
         $this->addHtmlLine('<link href="' . $file . '" rel="stylesheet" media="screen" type="text/css">');
     }
     // Other css files (from extensions)
     foreach (AngularApp::$cssFiles as $file) {
         $this->addHtmlLine('<link href="' . $file . '" rel="stylesheet" media="screen" type="text/css">');
     }
     /*
      ********** App specific javascript ***************
      *
      */
     // AmpersandApp
     $this->addHtmlLine('<script src="app/AmpersandApp.js"></script>');
     $this->addHtmlLine('<script src="generics/app/RouteProvider.js"></script>');
     // AngularApp static controler files
     $files = getDirectoryList(__DIR__ . '/../app/controllers');
     foreach ((array) $files as $file) {
         if (substr($file, -2) !== 'js') {
             continue;
         }
         $this->addHtmlLine('<script src="app/controllers/' . $file . '"></script>');
     }
     // AngularApp generic controler files (generated by Ampersand)
     $files = getDirectoryList(__DIR__ . '/../generics/app/controllers');
     foreach ((array) $files as $file) {
         if (substr($file, -2) !== 'js') {
             continue;
         }
         $this->addHtmlLine('<script src="generics/app/controllers/' . $file . '"></script>');
     }
     // Javascript files
     $files = getDirectoryList(__DIR__ . '/../app/js');
     foreach ((array) $files as $file) {
         if (substr($file, -2) !== 'js') {
             continue;
         }
         $this->addHtmlLine('<script src="app/js/' . $file . '"></script>');
     }
     // Add js files to html output
     foreach (AngularApp::$jsFiles as $file) {
         $this->addHtmlLine('<script src="' . $file . '"></script>');
     }
     $this->addHtmlLine('</head>');
     $this->addHtmlLine('<body>');
     $this->addHtmlLine(file_get_contents(__DIR__ . '/../app/AmpersandApp.html'));
     $this->addHtmlLine('</body>');
     $this->addHtmlLine('</html>');
 }
Exemple #15
0
{
    if (is_dir($dir)) {
        $objects = scandir($dir);
        foreach ($objects as $object) {
            if ($object != "." && $object != "..") {
                if (filetype($dir . "/" . $object) == "dir") {
                    RemoveReclusiveDir($dir . "/" . $object);
                } else {
                    unlink($dir . "/" . $object);
                }
            }
        }
        reset($objects);
        rmdir($dir);
    }
    return true;
}
//print '<h1>SQL Clean Up!</h1>';
foreach ($tables as $table) {
    $db->setSQL("TRUNCATE TABLE {$table}");
    $err = $db->execOnly();
    $msg = isset($err[1]) ? 'FAIL!' : 'PASS!';
    //print 'Empty  `' . $table . '`  ' . $msg . '<br>';
}
//print '<h1>Patient Directories Clean Up!</h1>';
$path = site_path . '/patients/';
$patientsDir = getDirectoryList($path);
foreach ($patientsDir as $dir) {
    RemoveReclusiveDir($path . $dir);
}
print 'Factory Reset Complete!';
Exemple #16
0
| PURPOSE:                                                          |
|   Index File			                                            |
|                                                                   |
+----------------------- Studio 182 Team ---------------------------+
| Hunter Dolan <*****@*****.**>                               |
| Pablo Merino <*****@*****.**>                                |
+-------------------------------------------------------------------+
*/



//Posts

$content = "";

$dirlist = getDirectoryList('./posts');
rsort($dirlist);


foreach ($dirlist as $file) {

$file_no_ext = str_replace('.post','',$file);

	$tagValue = array();
	$tagValue = parse('./posts/'.$file);
	$content .= "<div id=\"box\">\n";
	$content .="<h2><a href=\"?/viewpost/".$file_no_ext."/\">".$tagValue["title"]."</a></h2>\n";
	$content .= "<h1>".$tagValue["date"]."</h1>\n";
	$content .= "<h3>Posted by ".$tagValue["author"]."</h3>\n";
	$content .= "<p>".$tagValue["body"]."</p>\n";
	if($bloggy_config['skin'] == "iphone") {
<?php

$directory = "data";
echo getDirectoryList($directory);
function getDirectoryList($base)
{
    // create an array to hold directory list
    $results = array();
    // create a handler for the directory
    $dHandler = opendir($base);
    // open directory and walk through the filenames
    while ($dir = readdir($dHandler)) {
        if (preg_match("/^201/", $dir)) {
            // starts with 201? (2011, 2012, ...)
            $fHandler = opendir("{$base}/{$dir}");
            $langResults = array();
            while ($file = readdir($fHandler)) {
                if ($file != "." && $file != "..") {
                    $language = substr($file, 0, 2);
                    $stats = trim(file_get_contents("{$base}/{$dir}/{$file}"));
                    $langResults[] = "\n\t \"{$language}\":  {$stats} ";
                }
            }
            $results[] = "\"{$dir}\": { " . implode(",", $langResults) . "  \n}";
            closedir($fHandler);
        }
    }
    // tidy up: close the handler
    closedir($dHandler);
    $strResults = "{\n" . implode(", ", $results) . "\n}";
    // done!
Exemple #18
0
function remove_old_blackups($ntk = 7)
{
    $backup_list = getDirectoryList();
    foreach ($backup_list as $file) {
        if (count($file) > $ntk) {
            $remove_list = array_slice($file, $ntk);
            foreach ($remove_list as $rfile) {
                unlink(CFBACKUPPATH . $rfile);
            }
        }
    }
}
Exemple #19
0
    		</div>
            <div class="nine columns">
    <input type="text" placeholder="Page Link" class="six" required='required' maxlength="500" name="link" id="caption" />
            </div>
          </div>
        </div>

        <div class="twelve columns">
          <div class="row">
            <div class="three columns">
    <label for="right-label" class="left inline">Choose Template *</label>
    		</div>
            <div class="nine columns">
    	<select name="template">
        	<?php 
$files = getDirectoryList("template");
foreach ($files as $file) {
    echo "<option value='" . $file . "'>" . $file . "</option>";
}
?>

        </select>
            </div>
          </div>
        </div>

        <div class="twelve columns">
          <div class="row">
            <div class="three columns">
    <label for="right-label" class="left inline">Page Description</label>
    		</div>
        $rv = stripos($name, "moi") === false ? 1 : 0;
    } else {
        if ($filter == "none" || $filter == "all") {
            $rv = 1;
        } else {
            if (stripos($name, $filter) !== false) {
                $rv = 1;
            }
        }
    }
    return $rv;
}
//////////////////////////////////////////////////////////////////////
//                     end function section                         //
//////////////////////////////////////////////////////////////////////
$files = getDirectoryList(".");
// sort array ...
if ($_order == "asc") {
    usort($files, $_sort . "_cmp");
} else {
    usort($files, $_sort . "_r_cmp");
}
for ($i = 0; $i < count($files); $i++) {
    if (showRow($files[$i]['name'], $_filter)) {
        echo "      <tr>\n" . "         <td><a href='" . $files[$i]['name'] . "' title='click to download'>" . $files[$i]['name'] . "</a></td>\n" . "         <td><img src='images/" . $files[$i]['arch'] . ".png' alt='" . $files[$i]['arch'] . "' title='" . $files[$i]['arch'] . "' /></td>\n" . "         <td>" . round($files[$i]['size'] / (1024 * 1024), 2) . "MB</td>\n" . "         <td>" . date("d.m.Y H:i:s", $files[$i]['date']) . "</td>\n" . "      </tr>\n";
    }
}
?>
      </table>
      <b>Note:</b> Use this software at your own risk!<br />
      Be careful when trying beta versions (marked with a &quot;B&quot; in file name right behind the version number e.g. 2.61<b>B</b>).<br />