本文整理汇总了PHP中util_getRootPath函数的典型用法代码示例。如果您正苦于以下问题:PHP util_getRootPath函数的具体用法?PHP util_getRootPath怎么用?PHP util_getRootPath使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了util_getRootPath函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: util_requireOtherFiles
function util_requireOtherFiles()
{
$root = util_getRootPath();
require_once "{$root}/phplib/idiorm/idiorm.php";
require_once "{$root}/phplib/idiorm/paris.php";
require_once "{$root}/phplib/serverPreferences.php";
require_once "{$root}/phplib/db.php";
require_once "{$root}/phplib/logging.php";
require_once "{$root}/phplib/session.php";
require_once "{$root}/phplib/smarty.php";
require_once "{$root}/phplib/memcache.php";
}
示例2: runAllModules
public static function runAllModules($lexems, $definitions)
{
$adsModules = Config::get('global.adsModulesH');
if ($adsModules) {
foreach ($adsModules as $adsModule) {
require_once util_getRootPath() . "phplib/ads/{$adsModule}/{$adsModule}AdsModule.php";
$className = ucfirst($adsModule) . 'AdsModule';
$module = new $className();
$result = $module->run(empty($lexems) ? null : $lexems, empty($definitions) ? null : $definitions);
if ($result) {
SmartyWrap::assign('adsProvider', $adsModule);
SmartyWrap::assign('adsProviderParams', $result);
break;
}
}
}
}
示例3: init
static function init()
{
self::$theSmarty = new Smarty();
self::$theSmarty->template_dir = util_getRootPath() . 'templates';
self::$theSmarty->compile_dir = util_getRootPath() . 'templates_c';
self::$theSmarty->inheritance_merge_compiled_includes = false;
// This allows variable names in {include} tags
self::assign('wwwRoot', util_getWwwRoot());
self::assign('imgRoot', util_getImgRoot());
self::assign('sources', Model::factory('Source')->order_by_desc('isOfficial')->order_by_asc('displayOrder')->find_many());
self::assign('sUser', session_getUser());
self::assign('nick', session_getUserNick());
self::assign('currentYear', date("Y"));
self::assign('isMobile', util_isMobile());
self::assign('suggestNoBanner', util_suggestNoBanner());
self::assign('cfg', Config::getAll());
self::assign('GLOBALS', $GLOBALS);
self::$theSmarty->registerPlugin('function', 'getDebugInfo', array('SmartyWrap', 'getDebugInfo'));
}
示例4: getByDate
static function getByDate($displayDate, $wotm = false)
{
$creditsFile = $wotm ? self::CREDITS_FILE_WOTM : self::CREDITS_FILE_WOTD;
$lines = @file(util_getRootPath() . $creditsFile);
if (!$lines) {
return null;
}
foreach ($lines as $line) {
$commentStart = strpos($line, '#');
if ($commentStart !== false) {
$line = substr($line, 0, $commentStart);
}
$line = trim($line);
if ($line) {
$parts = explode('::', trim($line));
if (preg_match("/{$parts[0]}/", $displayDate)) {
return WotdArtist::get_by_label($parts[1]);
}
}
}
return null;
}
示例5: smarty_init
function smarty_init()
{
$smarty = new Smarty();
$smarty->template_dir = util_getRootPath() . 'templates';
$smarty->compile_dir = util_getRootPath() . 'templates_c';
$smarty->assign('wwwRoot', util_getWwwRoot());
$smarty->assign('cssRoot', util_getCssRoot());
$smarty->assign('imgRoot', util_getImgRoot());
$smarty->assign('sources', Model::factory('Source')->order_by_desc('isOfficial')->order_by_asc('displayOrder')->find_many());
$smarty->assign('sUser', session_getUser());
$smarty->assign('is_mirror', pref_isMirror());
$smarty->assign('nick', session_getUserNick());
$smarty->assign('contact_email', pref_getContactEmail());
$smarty->assign('hostedBy', pref_getHostedBy());
$smarty->assign('currentYear', date("Y"));
$smarty->assign('bannerType', pref_getServerPreference('bannerType'));
$smarty->assign('developmentMode', pref_getServerPreference('developmentMode'));
$smarty->assign('isMobile', util_isMobile());
smarty_registerFunction($smarty, 'getDebugInfo', 'smarty_function_getDebugInfo');
$smarty->assign('GLOBALS', $GLOBALS);
$GLOBALS['smarty_theSmarty'] = $smarty;
}
示例6: init
static function init()
{
self::$theSmarty = new Smarty();
self::$theSmarty->template_dir = util_getRootPath() . 'templates';
self::$theSmarty->compile_dir = util_getRootPath() . 'templates_c';
self::assign('wwwRoot', util_getWwwRoot());
self::assign('imgRoot', util_getImgRoot());
self::assign('staticServer', Config::get('static.url'));
self::assign('sources', Model::factory('Source')->order_by_desc('isOfficial')->order_by_asc('displayOrder')->find_many());
self::assign('sUser', session_getUser());
self::assign('is_mirror', Config::get('global.mirror'));
self::assign('nick', session_getUserNick());
self::assign('contact_email', Config::get('global.contact'));
self::assign('hostedBy', Config::get('global.hostedBy'));
self::assign('currentYear', date("Y"));
self::assign('bannerType', Config::get('banner.type'));
self::assign('developmentMode', Config::get('global.developmentMode'));
self::assign('isMobile', util_isMobile());
self::assign('suggestNoBanner', util_suggestNoBanner());
self::assign('acEnable', Config::get('search.acEnable'));
self::assign('acMinChars', Config::get('search.acMinChars'));
self::assign('GLOBALS', $GLOBALS);
self::$theSmarty->registerPlugin('function', 'getDebugInfo', array('SmartyWrap', 'getDebugInfo'));
}
示例7: util_getRequestParameter
$provider = util_getRequestParameter('provider');
// Display a banner for this provider
$go = util_getRequestParameter('go');
// Track a click and redirect to this provider
$clickurl = util_getRequestParameter('clickurl');
// Sent to us by OpenX; when displaying a banner, we have to link to this URL
if ($go) {
$provider = $go;
$go = true;
}
require_once "../phplib/ads/{$provider}/{$provider}AdsModule.php";
if ($provider == 'diverta') {
$bookId = util_getRequestParameter('bookId');
$book = DivertaBook::get_by_id($bookId);
if (!$book) {
exit;
}
if ($go) {
$book->clicks++;
$book->save();
util_redirect($book->url);
}
$book->impressions++;
$book->save();
smarty_assign('book', $book);
smarty_assign('hasImage', file_exists(util_getRootPath() . "wwwbase/img/diverta/thumb/{$book->sku}.jpg"));
}
smarty_assign('clickurl', str_replace('__', '&', $clickurl));
$output = smarty_fetch("ads/{$provider}.ihtml");
$output = addslashes(str_replace("\n", ' ', $output));
print "document.write(\"{$output}\");";
示例8: define
<?php
require_once __DIR__ . '/../phplib/util.php';
// TODO: Add user pages
// TODO: Add inflection models (from modele-flexiune.php)
define('FILE_SIZE_LIMIT', 9000000);
define('FILE_URL_LIMIT', 45000);
$g_numFiles = 0;
$g_curFileName = null;
$g_curFile = null;
$g_curFileSize = 0;
$g_curFileUrl = 0;
log_scriptLog('Running generateSitemap.php');
chdir(util_getRootPath());
openNewFile();
addOtherUrls();
$query = 'select id, formNoAccent from Lexem order by formNoAccent';
log_scriptLog("Running mysql query: [{$query}]");
$dbResult = db_execute($query);
$rowB = array(null, null);
$rowC = array(null, null);
foreach ($dbResult as $dbRow) {
// Keep a moving window of 3 lexems that we can use to eliminate duplicates
$rowA = $rowB;
$rowB = $rowC;
$rowC = $dbRow;
if ($rowB[1] && $rowB[1] != $rowA[1]) {
// If 2 or more lexems have identical forms, only add a definition URL for the first one
addUrl('http://dexonline.ro/definitie/' . urlencode($rowB[1]));
}
if ($rowB[0] && ($rowB[1] == $rowA[1] || $rowB[1] == $rowC[1])) {
示例9: dumpAbbrevs
function dumpAbbrevs($remoteFile)
{
global $FTP;
log_scriptLog("dumping abbreviations");
$sources = AdminStringUtil::loadAbbreviationsIndex();
$sectionNames = AdminStringUtil::getAbbrevSectionNames();
$sections = array();
foreach ($sectionNames as $name) {
$raw_section = parse_ini_file(util_getRootPath() . "docs/abbrev/{$name}.conf", true);
$section = array();
foreach ($raw_section[$name] as $short => $long) {
$abbrev_info = array('short' => $short, 'long' => $long, 'ambiguous' => false);
if (substr($short, 0, 1) == "*") {
$abbrev_info['short'] = substr($short, 1);
$abbrev_info['ambiguous'] = true;
}
$section[] = $abbrev_info;
}
$sections[$name] = $section;
}
SmartyWrap::assign('sources', $sources);
SmartyWrap::assign('sections', $sections);
$xml = SmartyWrap::fetch('xml/xmldump/abbrev.tpl');
$FTP->staticServerPutContents(gzencode($xml), $remoteFile);
}
示例10: util_getRootPath
<?php
/*
* Alin Ungureanu, 2013
* alyn.cti@gmail.com
*/
require_once '../phplib/util.php';
require_once util_getRootPath() . 'phplib/AppLog.php';
require_once util_getRootPath() . 'phplib/MemoryManagement.php';
db_init();
$logFile = Config::get('app_log.diacritics_log');
/*
* Builds examples and improves statistics for the diacritics mechanism
*/
class DiacriticsBuilder
{
protected $currOffset;
protected $file;
protected $fileEndOffset;
protected static $diacritics;
protected static $nonDiacritics;
protected static $paddingNumber;
protected static $paddingChar;
private $globalCount;
private $localCount;
private $currentFolder;
private $folderCount;
/*
* initialises instance variables
*/
function __construct()
示例11: define
define('DATABASE_TMPFILE_GZIP', DATABASE_TMPFILE . '.gz');
$doDatabaseCopy = true;
$doCodeUpdate = true;
for ($i = 1; $i < count($argv); $i++) {
$arg = $argv[$i];
if ($arg == "-nc") {
$doCodeUpdate = false;
} else {
if ($arg == '-nd') {
$doDatabaseCopy = false;
} else {
OS::errorAndExit("Unknown flag: {$arg}");
}
}
}
log_scriptLog('Running updateMirror.php with databaseCopy:' . ($doDatabaseCopy ? 'yes' : 'no') . ' codeUpdate:' . ($doCodeUpdate ? 'yes' : 'no'));
if ($doDatabaseCopy) {
$wget = sprintf("wget -q -O %s %s", DATABASE_TMPFILE_GZIP, DATABASE_URL);
OS::executeAndAssert($wget);
$gzip = sprintf("gunzip %s", DATABASE_TMPFILE_GZIP);
OS::executeAndAssert($gzip);
$parts = db_splitDsn();
$mysql = sprintf("mysql -h %s -u %s --password='%s' %s < %s", $parts['host'], $parts['user'], $parts['password'], $parts['database'], DATABASE_TMPFILE);
OS::executeAndAssert($mysql);
$rm = sprintf("rm -f %s", DATABASE_TMPFILE);
OS::executeAndAssert($rm);
}
if ($doCodeUpdate) {
OS::executeAndAssert('cd ' . util_getRootPath() . '; /usr/bin/git pull --quiet');
}
log_scriptLog('updateMirror.php completed successfully (against all odds)');
示例12: util_requireOtherFiles
function util_requireOtherFiles()
{
$root = util_getRootPath();
require_once StringUtil::portable("{$root}/phplib/smarty/Smarty.class.php");
require_once StringUtil::portable("{$root}/phplib/idiorm/idiorm.php");
require_once StringUtil::portable("{$root}/phplib/idiorm/paris.php");
require_once StringUtil::portable("{$root}/phplib/db.php");
require_once StringUtil::portable("{$root}/phplib/logging.php");
require_once StringUtil::portable("{$root}/phplib/session.php");
require_once StringUtil::portable("{$root}/phplib/memcache.php");
}
示例13: date
<?php
require_once "../phplib/util.php";
$TODAY = date("Y-m-d");
$FOLDER = util_getRootPath() . '/wwwbase/download/xmldump';
$URL = 'http://dexonline.ro/download/xmldump';
if (count($_GET) == 0) {
util_redirect("http://wiki.dexonline.ro/wiki/Update4Instructions");
}
$lastDump = getLastDumpDate($TODAY, $FOLDER);
smarty_assign('lastDump', $lastDump);
smarty_assign('url', $URL);
$lastClientUpdate = util_getRequestParameterWithDefault('last', '0');
if ($lastClientUpdate == '0') {
// Dump the freshest full dump we have
// TODO: return an error if there is no full dump
smarty_assign('serveFullDump', true);
$lastClientUpdate = $lastDump;
}
smarty_assign('diffs', getDiffsBetween($lastClientUpdate, $TODAY, $FOLDER));
header('Content-type: text/xml');
print smarty_fetch('common/update4.ihtml');
/**************************************************************************/
// Do not return a dump for today, in case it is still being built
function getLastDumpDate($today, $folder)
{
$files = scandir($folder, 1);
// descending
foreach ($files as $file) {
$matches = array();
if (preg_match('/^(\\d\\d\\d\\d-\\d\\d-\\d\\d)-abbrevs.xml.gz$/', $file, $matches)) {
示例14: init
public static function init()
{
self::$DEFAULT_IMAGE = "generic.jpg";
self::$IMAGE_CREDITS_DIR = util_getRootPath() . 'docs/imageCredits';
}
示例15: session_getUser
<?php
require_once "../phplib/util.php";
$user = session_getUser();
if (!$user) {
FlashMessage::add('Nu puteți alege o imagine de profil dacă nu sunteți autentificat.');
util_redirect(util_getWwwRoot());
}
define('AVATAR_RESOLUTION', 48);
define('AVATAR_QUALITY', 100);
$AVATAR_REMOTE_FILE = "/img/user/{$user->id}.jpg";
$AVATAR_RAW_GLOB = util_getRootPath() . "wwwbase/img/generated/{$user->id}_raw.*";
$x0 = util_getRequestParameter('x0');
$y0 = util_getRequestParameter('y0');
$side = util_getRequestParameter('side');
$delete = util_getRequestParameter('delete');
if ($delete) {
$f = new FtpUtil();
$f->staticServerDelete($AVATAR_REMOTE_FILE);
$user->hasAvatar = 0;
$user->save();
FlashMessage::add('Imaginea a fost ștearsă.', 'info');
util_redirect('preferinte');
}
$rawFileList = glob($AVATAR_RAW_GLOB);
if (empty($rawFileList)) {
FlashMessage::add('Imaginea dumneavoastră de profil nu mai există. Vă rugăm să o reîncărcați.');
util_redirect(util_getWwwRoot());
}
$rawFileName = $rawFileList[0];
$canvas = imagecreatetruecolor(AVATAR_RESOLUTION, AVATAR_RESOLUTION);