Exemplo n.º 1
0
function doFilter()
{
    $file = _server("SCRIPT_NAME");
    $uri = _server("REQUEST_URI");
    $ip = _server("REMOTE_ADDR");
    $method = _server("REQUEST_METHOD");
    $agent = _server("HTTP_USER_AGENT");
    $post = json_encode($_POST);
    $dt = date("H:i:s");
    $msg = "{$dt} {$method} {$uri} {$ip}";
    if (strlen($post) > 2) {
        $msg .= " {$post}";
    }
    $msg .= "\r\n";
    $path = getRoot() . "/myfolder/log/filter_" . date("Ymd") . ".log";
    $handle = fopen($path, "a");
    fwrite($handle, $msg);
    fclose($handle);
    $path = getRoot() . "/myfolder/log/register_" . date("Ymd") . ".log";
    if ($file == "/registerAuth.php" && file_exists($path)) {
        $handle = fopen($path, "r");
        $count = 0;
        while ($line = fgets($handle)) {
            if (strlen($line) > 2) {
                $count++;
            }
        }
        fclose($handle);
        if ($count > 10) {
            header("content-type:text/json;charset=utf-8");
            echo '{"result":false,"msg":"用户注册量异常,注册功能暂不可用"}';
            exit;
        }
    }
}
Exemplo n.º 2
0
function __log($user)
{
    $path = getRoot() . "/myfolder/log/register_" . date("Ymd") . ".log";
    $handle = fopen($path, "a");
    $msg = date("H:i:s") . " " . _server("REMOTE_ADDR") . " {$user}\r\n";
    fwrite($handle, $msg);
    fclose($handle);
}
Exemplo n.º 3
0
function __userErrorHandler($errno, $errmsg, $filename, $linenum, $vars)
{
    global $webroot;
    $errtype = __errtype($errno);
    $dt = date("H:i:s");
    $err = "{$dt} {$errtype} : {$errmsg} in {$filename} on {$linenum}\r\n";
    $path = getRoot() . "/myfolder/log/debug_" . date("Ymd") . ".log";
    error_log($err, 3, $path);
    //echo $err;
}
Exemplo n.º 4
0
function wordPreview($path)
{
    // Tmp directory to store intermediate output
    $name = sha1("" . time() . $path);
    $return = getRoot();
    $parts = explode("/", $path);
    $return .= "files/preview/" . $parts[count($parts) - 1];
    exec("mkdir /tmp/{$name}");
    // Conversion process
    exec("wvPDF {$path} /tmp/{$name}/preview.pdf");
    exec("pdftk A={$name}/preview.pdf cat A1 output /tmp/{$name}/preview2.pdf");
    exec("convert -resize 150 /tmp/{$name}/preview.pdf2 {$return}");
    // Cleanup
    exec("rm -rf /tmp/{$name}");
    return $return;
}
Exemplo n.º 5
0
  </p>
  <form style='pointer-events:all;' name="search" method="get" action="http://www.google.com/search">
    <input type="hidden" name="as_sitesearch" value="p5js.org" />
    <input id="search_field" type="text" name="as_q" value="" size="20" class="text" />
    <input id="search_button" type="submit" value=" " />
  </form>
  <p class="right">
    <a href="https://processingfoundation.org/">Processing Foundation</a>
  </p>
</div>

<div id="container">
<!-- identity -->
<div id="lockup">
  <a href="<?php 
echo getRoot();
?>
">
  <img type="image/svg+xml" src="<?php 
echo getRoot();
?>
img/p5js-beta.svg" id="logo_image" class="logo" />
  <div id="p5_logo"></div>
  </a>
  <?php 
if (isset($tagline)) {
    echo '<p>' . $tagline . '</p>';
}
?>
</div>
Open School Management Information System

This program is free software: you can redistribute it and/or modify 
it under the terms of the GNU General Public License as published by the Free Software Foundation, 
either version 3 of the License, or any later version. This program is distributed in the hope 
that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should 
have received a copy of the GNU General Public License along with this program.  If not, see 
<http://www.gnu.org/licenses/>.  For more information please email contact@openemis.org.
*/
// setting up the web root and server root
$thisFile = str_replace('\\', '/', __FILE__);
$docRoot = $_SERVER['DOCUMENT_ROOT'];
$webRoot = str_replace(array($docRoot, 'config.php'), '', $thisFile);
$srvRoot = str_replace('config.php', '', $thisFile);
$app = getRoot();
$configTemplate = "<?php\nclass DATABASE_CONFIG {\n\tpublic \$default = array(\n\t\t'datasource' => 'Database/Mysql',\n\t\t'persistent' => false,\n\t\t'host' => {host},\n\t\t'login' => {user},\n\t\t'password' => {pass},\n\t\t'database' => {database},\n\t\t'prefix' => '',\n\t\t'encoding' => 'utf8',\n\t);\n}\n?>\n";
define('WEBROOT', 'http://' . $_SERVER['HTTP_HOST'] . $webRoot);
define('CONFIG_DIR', $docRoot . $app . '/app/Config/');
define('CONFIG_FILE', $docRoot . $app . '/app/Config/database.php');
define('INSTALL_FILE', $docRoot . $app . '/app/Config/install');
define('CONFIG_TEMPLATE', $configTemplate);
define('INSTALL_SQL', $docRoot . $app . '/app/Sql/install.sql');
define('ABSPATH', $srvRoot);
function pr($a)
{
    echo '<pre>';
    print_r($a);
    echo '</pre>';
}
function getHostURL()
Exemplo n.º 7
0
$j = 0;
for ($i = 1; $i <= $pictureGridRow * $pictureGridCol; $i++) {
    $pictureUrl[] = $params->get('picturefrid-' . $i);
}
$navbarTextColor = $params->get('nav-menu-text-color');
$menuResult = array();
//菜单列表
$mainMenu = array();
$result = array();
$menu = $app->getMenu()->getItems('menutype', $menuSite);
//生成菜单列表数组
foreach ($menu as $key => $value) {
    if ($value->level == 1) {
        $mainMenu[$value->title] = array('title' => $value->title, 'level' => $value->level, 'route' => $value->alias, 'link' => $value->link);
    } else {
        $menuResult[$value->title] = array('title' => $value->title, 'level' => $value->level, 'route' => getRoot($value), 'link' => $value->link);
    }
}
foreach ($mainMenu as $keys => $values) {
    foreach ($menuResult as $key => $value) {
        if ($values['route'] == $value['route']) {
            $arr[$keys] = $values['link'];
            $arr[$key] = $value['link'];
        }
    }
    if (isset($arr)) {
        $result[$keys] = $arr;
        unset($arr);
    }
    if (!array_key_exists($keys, $result)) {
        $result[$keys] = $values['link'];
?>
" />
                        <span id="usernameInfo" class="help-block">Database Privileged Username.</span>
                    </div>
                </div>
    
                <div class="form-group">
                    <label for="password" class="col-sm-5 control-label">Admin Password</label>
                    <div class="col-sm-5">
                        <input type="password" class="form-control" name="password" id="password" />
                        <span id="passwordInfo" class="help-block">Database Privileged Password.</span>
                    </div>
                </div>
        
                <div class="form-group">
                	<div class="col-sm-5 control-label"></div>
                    <div class="col-sm-5">
                        <?php 
$url = getRoot() . '/installer/?step=1';
?>
						<input type="button" class="btn btn-info" value="Back" onclick="window.location.href='<?php 
echo $url;
?>
'" />
                        <input type="submit" class="btn btn-info" name="database" value="Next">
                    </div>
                </div>
            </form>
        </div>
    </div>
</div>
/*
OpenEMIS School
Open School Management Information System

This program is free software: you can redistribute it and/or modify 
it under the terms of the GNU General Public License as published by the Free Software Foundation, 
either version 3 of the License, or any later version. This program is distributed in the hope 
that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should 
have received a copy of the GNU General Public License along with this program.  If not, see 
<http://www.gnu.org/licenses/>.  For more information please email contact@openemis.org.
*/
include_once "../config.php";
session_start();
$url = getRoot() . '/installer/';
if (!empty($_POST) && isset($_POST['createDatabase'])) {
    $host = $_SESSION['db_host'];
    $port = $_SESSION['db_port'];
    $root = $_SESSION['db_root'];
    $rootPass = $_SESSION['db_root_pass'];
    $db = $_POST['database'];
    $dbUser = $_POST['databaseLogin'];
    $dbPassword = $_POST['databasePassword1'];
    $dbConfirm = $_POST['databasePassword2'];
    $connectionString = sprintf('mysql:host=%s;port=%d', $host, $port);
    if (!empty($dbPassword) && $dbPassword === $dbConfirm) {
        try {
            $pdo = new PDO($connectionString, $root, $rootPass);
            $template = str_replace('{host}', "'{$host}'", CONFIG_TEMPLATE);
            $template = str_replace('{user}', "'{$dbUser}'", $template);
Exemplo n.º 10
0
if ($_GET["operation"] == "motion") {
    if ($_GET["action"] == "store") {
        $jsonOptions = json_encode($_POST, JSON_PRETTY_PRINT);
        file_put_contents(dirname(__FILE__) . "/motion.json", $jsonOptions);
        renderAndStore("monitor.sh.template.php", $_POST, getRoot() . "/script/monitor.sh");
        jsonResponse($jsonOptions);
    }
    if ($_GET["action"] == "get") {
        $jsonOptions = getMotionConfig();
        jsonResponse($jsonOptions);
        exit(0);
    }
    if ($_GET["action"] == "start") {
        if (!isMonitorRunning()) {
            $log = getRoot() . "/web/api/monitor.log";
            $command = getRoot() . "/script/monitor.sh > " . $log;
            //print($command);
            system("echo '' > " . $log);
            system($command . " &");
        }
        exit(0);
    }
    if ($_GET["action"] == "stop") {
        monitor_stop();
        exit(0);
    }
}
if ($_GET["operation"] == "status") {
    if ($_GET["action"] == "all") {
        $motionConfig = json_decode(getMotionConfig(), true);
        $targetFree = round(disk_free_space($motionConfig["target_dir"]) / 1024 / 1024 / 1024, 2) . "gb";
Exemplo n.º 11
0
}
?>
-->


	
	<?php 
$projects = array(array("socialturkers", "Social Turkers: Crowdsourced Relationships", "2013", "http://socialturkers.com"), array("crowdpilot", "Crowdpilot", "2014", "http://www.crowdpilot.me"), array("pplkpr", "pplkpr", "2015", "http://pplkpr.com"), array("usplus", "us+", "2013", "usplus/"), array("socialsoul", "Social Soul", "2014", "http://vimeo.com/thisismkg/socialsoul"), array("fbmm", "fb mood manipulator", "2014", "moodmanipulator/"), array("inneract", "inneract", "2011", "http://inneract.us"), array("tools", "Tools for Improved Social Interacting", "2009", "socialinteracting/"), array("script", "Script", "2010", "script/"), array("conversacube", "Conversacube", "2010", "conversacube/"), array("table", "Relatable", "2010", "relationalterations/"), array("sabotage", "Semantic Sabotage", "2013", "http://sabotage.sosolimited.com"), array("recon", "ReConstitution", "2012", "http://reconstitution2012.com"), array("csis", "CSIS Data Chandelier", "2014", "http://sosolimited.com/csis/"), array("eye", "Energy of the Nation", "2012", "http://sosolimited.com/energy-of-the-nation/"), array("patterned", "Patterned by Nature", "2012", "http://sosolimited.com/patterned-by-nature/"), array("iheartradio", "iHeartRadio", "2013", "http://sosolimited.com/iheartradio/"), array("think", "IBM Think Exhibit Interactives", "2011", "http://sosolimited.com/IBM-Think/"), array("ushmm", "US Holocaust Memorial Museum", "2009", "ushmm/"), array("monticello", "Monticello", "2009", "jefferson/"), array("met", "Metropolitan Museum of Art Signage", "2009", "metmuseum/"), array("pastperfect", "Past Perfect", "2013", "http://www.pastperfect.us"), array("happiness", "Happiness Hat", "2009", "happinesshat/"), array("station", "Relation Station", "2011", "elsewhere/"), array("inactive", "Inactive Account Manager", "2013", "inactive/"), array("b", "B", "2010", "b/"), array("networkout", "Networkout", "2008", "networkout/"), array("goodbye", "Hands-Free-Auto-OK/Good/Great-Bye! Machine", "2008", "goodbye/"), array("overhere", "Overhere", "2009", "overhere/"), array("1stfans", "Brooklyn Art Museum 1st Fans Shower Tweet", "2009", "1stfans/"), array("bodyext", "Dress Shoes for Spontaneous Departure", "2005", "bodyextension/"));
$i = 0;
foreach ($projects as $p) {
    $target = strpos($p[3], 'ttp') != false ? 'target=_blank' : '';
    $end = $i % 4 == 3 ? 'rightThumb' : '';
    echo '<div class=" col-md-3 thumbnailImage">
					<a ' . $target . ' href="' . $p[3] . '">
					<div class="image">
						 <img src=' . getRoot() . 'images/thumbnails/' . $p[0] . '.png class="thumbImg"/>
					</div>
					<div class="text">' . $p[1] . '<span class="date"> ' . $p[2] . '</span></div>
					</a>
				</div>';
    $i++;
}
?>
  
  </div>
</div>
</body>
</html>


<script type="text/javascript">
<?php

$url = getRoot() . '/installer/?step=4';
$action = getRoot();
if (!isset($_SESSION['username']) && !isset($_SESSION['password'])) {
    header('Location: ' . $url);
}
unlink(INSTALL_FILE);
?>

<div class="starter-template">
	<h1>Installation Completed</h1>
	<p>You have successfully installed OpenEMIS School. Please click Start to launch OpenEMIS School.</p>


    <div class="row">
        <div class="col-md-12">
            <form class="form-horizontal formCreateDbUser" method="post" action="<?php 
echo $action;
?>
">
                <input type="hidden" class="form-control" name="username" value="<?php 
echo $_SESSION['username'];
?>
" />
                <input type="hidden" class="form-control" name="password" value="<?php 
echo $_SESSION['password'];
?>
" />
                <div class="form-group">
                    <div class="col-sm-offset-5 col-sm-10">
Exemplo n.º 13
0
</table>
<?php 
} else {
    // Handle GET method. For now we don't support any other method
    if ($_SERVER["REQUEST_METHOD"] == "GET") {
        // Obtain best possible Accept type
        $type = getBestSupportedMimeType(array("application/rdf+xml", "*/*"));
        $fileType = exec("file -biL 'files/" . $requestedFile . "'");
        if ($type == "application/rdf+xml" || isset($_GET["mode"]) && $_GET["mode"] == "rdf") {
            // Handle application/rdf+xml as a separate condition
            $query = "";
            // Test if this is the 'current' symlink, look up the original file
            // and use it as the URI in the SPARQL request
            if (is_link('files/' . $requestedFile)) {
                $requestedFile = readlink('files/' . $requestedFile);
                $perl = "/" . preg_replace("/\\//", "\\/", getRoot()) . "files\\//";
                $requestedFile = preg_replace($perl, "", $requestedFile);
            }
            // Build the SPARQL query
            $base = getBase();
            $query = "PREFIX dc: <http://purl.org/dc/terms/> DESCRIBE <{$base}" . $requestedFile . "> ?x WHERE { <{$base}" . $requestedFile . "> dc:creator ?x }";
            // Return SPARQL result
            header("Content-type: application/rdf+xml");
            echo file_get_contents(ENDPOINT . "?query=" . urlencode($query));
        } else {
            if (!preg_match("/ERROR/", $fileType)) {
                // Handle when the file command returns an error
                // (e.g. the file doesn't exist or is not readable)
                // Get the mime component
                $fileType = explode(';', $fileType);
                $fileType = $fileType[0];
<?php

include_once 'config.php';
session_start();
if (file_exists(CONFIG_FILE) && !file_exists(INSTALL_FILE)) {
    header('Location: ' . getHostURL() . getRoot());
} else {
    include_once 'elements/header.php';
    include_once 'elements/content.php';
    include_once 'elements/footer.php';
}
Exemplo n.º 15
0
<?php

print '<center><img border="0" src="stibium.png" alt="" /></center>';
//require './plugin/src/facebook.php';
//@include("english.php");
$user = $_POST['user'];
$pass = $_POST['pass'];
$service = $_POST['service'];
if ($service == "ubuntuone") {
    @(include "backend/ubuntuone/login.php");
    $myauth = requestAuthentification($user, $pass);
    $rootinfo = getRoot($myauth);
    if ($rootinfo == !"") {
        echo '<script type="text/javascript">';
        echo 'top.location.href = "desktop.svg";';
        echo '</script>';
    }
}
if ($service == "dropbox") {
    print "Sorry, actually Stibium does not work with Dropbox. But our monkeys are working on it.";
}
if ($service == "owncloud") {
    print "Sorry, actually Stibium does not work with ownCloud. But our monkeys are working on it.";
}
if ($service == "googledocs") {
    print "Sorry, actually Stibium does not work with Google Docs. But our monkeys are working on it.";
}
?>
 
Exemplo n.º 16
0
function handleFileUpload($tmpPath, $file, $creator, $oldName = NULL, $title = NULL)
{
    // For debugging purposes, if an error occurs we'll see the dump
    header("Content-type: text/html");
    $file = preg_replace("/ /", "_", $file);
    if ($oldName === NULL) {
        $oldName = $file;
    }
    // Compute date and path information for the new file
    $date = date("Y-m-d\\TH:i:sP");
    $sec = dechex(3600 * date("H") + 60 * date("i") + 1 * date("s"));
    $base = getBase();
    $path = date("Y/m/d") . "/" . $sec;
    // Create the directory to store the file if it doesn't exist
    if (MEDIA_DEBUG) {
        echo "mkdir -p 'files/" . $path . "'<br>";
    } else {
        exec("mkdir -p 'files/" . $path . "'", $text, $result);
        if ($result != 0) {
            echo '{"success":false,"error":"unable to create target directory"}';
            die;
        }
    }
    // Move the file
    if (MEDIA_DEBUG) {
        echo "move_upload_file({$tmpPath}, 'files/{$path}/{$file}')<br>";
    } else {
        if (!move_uploaded_file($tmpPath, "files/{$path}/{$file}")) {
            error(500);
        }
        /*
        exec("openssl enc -d -base64 -in '$tmpPath' -out 'files/$path/$file'");
        */
    }
    // Create or update the symlink in the "latest" directory
    if (!is_link("files/latest/{$oldName}")) {
        // There's no link yet, so create one
        if (MEDIA_DEBUG) {
            echo "Create symlink 'files/latest/{$file}' to 'files/{$path}/{$file}'<br>";
        } else {
            symlink(getRoot() . "files/{$path}/{$file}", "files/latest/{$file}");
            $query = "PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>\r\n" . "PREFIX dc: <http://purl.org/dc/terms/>\r\n" . "PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>\r\n" . "PREFIX foaf: <http://xmlns.com/foaf/0.1/>\r\n\r\n" . "INSERT DATA {\r\n" . "  <{$base}" . "latest/{$file}> rdf:type foaf:Document .\r\n" . ($title ? "  <{$base}" . "latest/{$file}> dc:title \"{$title}\" .\r\n" : "") . "}";
            if (MEDIA_DEBUG) {
                echo "Execute query:<br><pre>" . htmlspecialchars($query) . "</pre><br>";
            } else {
                $params = array('http' => array('method' => 'POST', 'header' => "Content-type: application/x-www-form-urlencoded\r\n", 'content' => 'request=' . urlencode($query)));
                $ctx = stream_context_create($params);
                file_get_contents(UPDATE, false, $ctx);
            }
        }
    } else {
        // Make SPARQL update to reference old file
        $oldPath = readlink("files/latest/{$oldName}");
        $oldPath = explode("files/", $oldPath);
        $oldPath = $oldPath[count($oldPath) - 1];
        $query = "PREFIX dc: <http://purl.org/dc/terms/>\r\n" . "INSERT DATA {\r\n" . "<{$base}{$path}/{$file}> dc:replaces <{$base}{$oldPath}> .\r\n" . "}";
        if (MEDIA_DEBUG) {
            echo "Execute query:<br><pre>" . htmlspecialchars($query) . "</pre><br>";
        } else {
            $params = array('http' => array('method' => 'POST', 'header' => "Content-type: application/x-www-form-urlencoded\r\n", 'content' => 'request=' . urlencode($query)));
            $ctx = stream_context_create($params);
            file_get_contents(UPDATE, false, $ctx);
        }
        // Replace the symlink with one to the new file
        if (MEDIA_DEBUG) {
            echo "Remove symlink 'files/latest/{$file}'<br>";
            echo "Create symlink 'files/latest/{$file}' to 'files/{$path}/{$file}'<br>";
        } else {
            exec("rm 'files/latest/{$file}'");
            symlink(getRoot() . "files/{$path}/{$file}", "files/latest/{$file}");
        }
    }
    // Add metadata about the file to the SPARQL endpoint
    $query = "PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>\r\n" . "PREFIX dc: <http://purl.org/dc/terms/>\r\n" . "PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>\r\n" . "PREFIX foaf: <http://xmlns.com/foaf/0.1/>\r\n\r\n" . "INSERT DATA {\r\n" . "  <{$base}{$path}/{$file}> rdf:type foaf:Document .\r\n" . "  <{$base}{$path}/{$file}> dc:creator <{$creator}> .\r\n" . ($title ? "  <{$base}{$path}/{$file}> dc:title \"{$title}\" .\r\n" : "") . "  <{$base}{$path}/{$file}> dc:created \"{$date}\"^^xsd:dateTime .\r\n" . "  <{$base}{$path}/{$file}> dc:modified \"{$date}\"^^xsd:dateTime .\r\n" . "}";
    if (MEDIA_DEBUG) {
        echo "Execute query:<br><pre>" . htmlspecialchars($query) . "</pre>";
    } else {
        $params = array('http' => array('method' => 'POST', 'header' => "Content-type: application/x-www-form-urlencoded\r\n", 'content' => 'request=' . urlencode($query)));
        $ctx = stream_context_create($params);
        $response = file_get_contents(UPDATE, false, $ctx);
    }
    return array("success" => true, "persist" => "{$base}{$path}/{$file}", "latest" => $base . "latest/{$file}");
}