本文整理汇总了PHP中getRoot函数的典型用法代码示例。如果您正苦于以下问题:PHP getRoot函数的具体用法?PHP getRoot怎么用?PHP getRoot使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getRoot函数的16个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: doFilter
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;
}
}
}
开发者ID:fancige,项目名称:demo,代码行数:35,代码来源:filter.php
示例2: __log
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);
}
开发者ID:fancige,项目名称:demo,代码行数:8,代码来源:registerAuth.php
示例3: __userErrorHandler
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;
}
开发者ID:fancige,项目名称:demo,代码行数:10,代码来源:config.php
示例4: wordPreview
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;
}
开发者ID:tetherless-world,项目名称:twdoc,代码行数:16,代码来源:preview.php
示例5: getRoot
</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>
开发者ID:loopHere,项目名称:p5.js-website,代码行数:30,代码来源:heading.php
示例6: str_replace
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 [email protected].
*/
// 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()
开发者ID:ivanbautsita,项目名称:gestion-escolar-campus-virtuales,代码行数:31,代码来源:config.php
示例7: array
$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'];
开发者ID:Caojunkai,项目名称:working,代码行数:31,代码来源:index.php
示例8: getRoot
?>
" />
<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>
开发者ID:ivanbautsita,项目名称:gestion-escolar-campus-virtuales,代码行数:31,代码来源:step2.php
示例9: session_start
/*
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 [email protected].
*/
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);
开发者ID:ivanbautsita,项目名称:gestion-escolar-campus-virtuales,代码行数:30,代码来源:step3b.php
示例10: json_encode
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";
开发者ID:sfxsfl,项目名称:RaspberrySurveillance,代码行数:31,代码来源:api.php
示例11: array
}
?>
-->
<?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">
开发者ID:lmccart,项目名称:lauren-mccarthy.com,代码行数:31,代码来源:index3.php
示例12: getRoot
<?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">
开发者ID:ivanbautsita,项目名称:gestion-escolar-campus-virtuales,代码行数:31,代码来源:step5.php
示例13: getBestSupportedMimeType
</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];
开发者ID:tetherless-world,项目名称:twdoc,代码行数:31,代码来源:index.php
示例14: session_start
<?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';
}
开发者ID:ivanbautsita,项目名称:gestion-escolar-campus-virtuales,代码行数:11,代码来源:index.php
示例15: requestAuthentification
<?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.";
}
?>
开发者ID:KDE,项目名称:stibium,代码行数:28,代码来源:dologin.php
示例16: handleFileUpload
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}");
}
开发者ID:tetherless-world,项目名称:twdoc,代码行数:83,代码来源:common.php
注:本文中的getRoot函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论