本文整理汇总了PHP中util_getRootPath函数的典型用法代码示例。如果您正苦于以下问题:PHP util_getRootPath函数的具体用法?PHP util_getRootPath怎么用?PHP util_getRootPath使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了util_getRootPath函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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";
}
开发者ID:nastasie-octavian,项目名称:DEXonline,代码行数:12,代码来源:util.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;
}
}
}
}
开发者ID:florinp,项目名称:dexonline,代码行数:17,代码来源:adsModule.php
示例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'));
}
开发者ID:florinp,项目名称:dexonline,代码行数:19,代码来源:SmartyWrap.php
示例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;
}
开发者ID:florinp,项目名称:dexonline,代码行数:22,代码来源:WotdArtist.php
示例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;
}
开发者ID:nastasie-octavian,项目名称:DEXonline,代码行数:22,代码来源:smarty.php
示例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'));
}
开发者ID:Jobava,项目名称:mirror-dexonline,代码行数:24,代码来源:SmartyWrap.php
示例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}\");";
开发者ID:nastasie-octavian,项目名称:DEXonline,代码行数:31,代码来源:custom-ad.php
示例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])) {
开发者ID:Jobava,项目名称:mirror-dexonline,代码行数:31,代码来源:generateSitemap.php
示例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);
}
开发者ID:florinp,项目名称:dexonline,代码行数:25,代码来源:dumpDatabaseXml.php
示例10: util_getRootPath
<?php
/*
* Alin Ungureanu, 2013
* [email protected]
*/
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()
开发者ID:florinp,项目名称:dexonline,代码行数:31,代码来源:DiacriticsBuilder.php
示例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)');
开发者ID:florinp,项目名称:dexonline,代码行数:31,代码来源:updateMirror.php
示例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");
}
开发者ID:Jobava,项目名称:mirror-dexonline,代码行数:11,代码来源:util.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)) {
开发者ID:nastasie-octavian,项目名称:DEXonline,代码行数:31,代码来源:update4.php
示例14: init
public static function init()
{
self::$DEFAULT_IMAGE = "generic.jpg";
self::$IMAGE_CREDITS_DIR = util_getRootPath() . 'docs/imageCredits';
}
开发者ID:florinp,项目名称:dexonline,代码行数:5,代码来源:WordOfTheDay.php
示例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);
开发者ID:florinp,项目名称:dexonline,代码行数:31,代码来源:salvare-avatar.php
示例16: ini_set
<?php
ini_set('include_path', util_getRootPath() . '/phplib' . PATH_SEPARATOR . ini_get('include_path'));
require_once 'Auth/OpenID/Consumer.php';
require_once 'Auth/OpenID/FileStore.php';
require_once 'Auth/OpenID/SReg.php';
require_once 'Auth/OpenID/AX.php';
if (!isset($_SESSION)) {
session_start();
}
class OpenID
{
private static function getStore()
{
$store_path = '/tmp/dex_openidStorePath';
if (!file_exists($store_path) && !mkdir($store_path)) {
print "Could not create the FileStore directory '{$store_path}'";
exit(0);
}
return new Auth_OpenID_FileStore($store_path);
}
private static function getConsumer()
{
return new Auth_OpenID_Consumer(self::getStore());
}
private static function getReturnTo()
{
return util_getFullServerUrl() . "auth/revenireOpenid";
}
/**
* Returns null and sets a flash message on all errors.
开发者ID:nastasie-octavian,项目名称:DEXonline,代码行数:31,代码来源:OpenID.php
示例17: util_getRootPath
<?php
WordOfTheMonth::$IMAGE_CREDITS_DIR = util_getRootPath() . 'docs/imageCredits';
class WordOfTheMonth extends BaseObject
{
public static $_table = 'WordOfTheMonth';
public static $DEFAULT_IMAGE = 'generic.jpg';
public static $IMAGE_CREDITS_DIR;
public static function getWotM($date)
{
return Model::factory('WordOfTheMonth')->where_lte('displayDate', $date)->order_by_desc('displayDate')->limit(1)->find_one();
}
public static function getCurrentWotM()
{
return Model::factory('WordOfTheMonth')->where_raw('displayDate <= curdate()')->order_by_desc('displayDate')->limit(1)->find_one();
}
public function getImageUrl()
{
if ($this->image) {
return Config::get('static.url') . 'img/wotd/cuvantul-lunii/' . $this->image;
}
return null;
}
public function getThumbUrl()
{
$pic = $this->image ? $this->image : self::$DEFAULT_IMAGE;
return Config::get('static.url') . 'img/wotd/cuvantul-lunii/thumb/' . $pic;
}
public function getArtist()
{
return $this->image ? WotdArtist::getByDate($this->displayDate, true) : null;
开发者ID:florinp,项目名称:dexonline,代码行数:31,代码来源:WordOfTheMonth.php
示例18: loadRawAbbreviations
static function loadRawAbbreviations()
{
return parse_ini_file(util_getRootPath() . "docs/abbrev.conf", true);
}
开发者ID:nastasie-octavian,项目名称:DEXonline,代码行数:4,代码来源:AdminStringUtil.php
示例19: util_getRootPath
<?php
WordOfTheMonth::$IMAGE_DESCRIPTION_DIR = util_getRootPath() . 'docs/imageCredits';
class WordOfTheMonth extends BaseObject
{
public static $_table = 'WordOfTheMonth';
public static $IMAGE_DESCRIPTION_DIR;
public static function getWotM($date)
{
return Model::factory('WordOfTheMonth')->where_lte('displayDate', $date)->order_by_desc('displayDate')->limit(1)->find_one();
}
public static function getCurrentWotM()
{
return Model::factory('WordOfTheMonth')->where_raw('displayDate <= curdate()')->order_by_desc('displayDate')->limit(1)->find_one();
}
public function getImageUrl()
{
if ($this->image) {
return Config::get('static.url') . 'img/wotd/cuvantul-lunii/' . $this->image;
}
return null;
}
public function getThumbUrl()
{
if ($this->image) {
return Config::get('static.url') . 'img/wotd/cuvantul-lunii/thumb/' . $this->image;
}
return null;
}
public function getImageCredits()
{
开发者ID:Jobava,项目名称:mirror-dexonline,代码行数:31,代码来源:WordOfTheMonth.php
示例20: util_getRootPath
<?php
WordOfTheDay::$IMAGE_DIR = util_getRootPath() . "wwwbase/img/wotd";
WordOfTheDay::$THUMB_DIR = util_getRootPath() . "wwwbase/img/wotd/thumb";
WordOfTheDay::$THUMB_SIZE = 48;
class WordOfTheDay extends BaseObject
{
public static $_table = 'WordOfTheDay';
public static $IMAGE_DIR;
public static $THUMB_DIR;
public static $THUMB_SIZE;
public static function getRSSWotD()
{
return Model::factory('WordOfTheDay')->where_gt('displayDate', '2011-01-01')->where_raw('displayDate < NOW()')->order_by_desc('displayDate')->limit(25)->find_many();
}
public static function getArchiveWotD($year, $month)
{
$query = "SELECT displayDate, lexicon, replace(displayDate, '-', '/') linkDate, DAYOFWEEK(displayDate) dayOfWeek, DAYOFMONTH(displayDate) dayOfMonth \n FROM WordOfTheDay W\n JOIN WordOfTheDayRel R ON W.id=R.wotdId\n JOIN Definition D ON R.refId=D.id AND D.status=0 AND R.refType='Definition'\n WHERE MONTH(displayDate)={$month} AND YEAR(displayDate)={$year}\n ORDER BY displayDate";
//TODO
$dbRes = db_execute($query);
$results = array();
foreach ($dbRes as $row) {
$wotda = new WotDArchive();
$wotda->set($row);
$results[] = $wotda;
}
return $results;
}
public static function getTodaysWord()
{
return Model::factory('WordOfTheDay')->where_raw('displayDate = curdate()')->find_one();
开发者ID:nastasie-octavian,项目名称:DEXonline,代码行数:31,代码来源:WordOfTheDay.php
注:本文中的util_getRootPath函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论