本文整理汇总了PHP中CApi::DataPath方法的典型用法代码示例。如果您正苦于以下问题:PHP CApi::DataPath方法的具体用法?PHP CApi::DataPath怎么用?PHP CApi::DataPath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CApi
的用法示例。
在下文中一共展示了CApi::DataPath方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct(CApiGlobalManager $oApiGlobalManager)
{
$this->_aHooks = array();
$this->_aServiceHooks = array();
$this->_aJsFiles = array();
$this->_aJsonHooks = array();
$this->_aCssFiles = array();
$this->_aPlugins = array();
$this->_aTemplates = array();
$this->_aAddTemplates = array();
$this->_mState = null;
$this->_oApiGlobalManager = $oApiGlobalManager;
$this->_oActions = null;
$this->bIsEnabled = (bool) CApi::GetConf('plugins', false);
if ($this->bIsEnabled) {
$sPluginsPath = CApi::DataPath() . '/plugins/';
if (@is_dir($sPluginsPath)) {
if (false !== ($rDirHandle = @opendir($sPluginsPath))) {
while (false !== ($sFile = @readdir($rDirHandle))) {
if (0 < strlen($sFile) && '.' !== $sFile[0] && preg_match('/^[a-z0-9\\-]+$/', $sFile) && (CApi::GetConf('plugins.config.include-all', false) || CApi::GetConf('plugins.' . $sFile, false)) && @file_exists($sPluginsPath . $sFile . '/index.php')) {
$oPlugin = (include $sPluginsPath . $sFile . '/index.php');
if ($oPlugin instanceof AApiPlugin) {
$oPlugin->SetName($sFile);
$oPlugin->SetPath($sPluginsPath . $sFile);
$oPlugin->Init();
// $oPlugin->Log('INIT > '.get_class($oPlugin));
$this->_aPlugins[] = $oPlugin;
}
}
}
@closedir($rDirHandle);
}
}
}
}
示例2: __construct
public function __construct()
{
$this->Path = \CApi::DataPath() . '/sessions';
$oSession = \MailSo\Cache\CacheClient::NewInstance();
$oSessionDriver = \MailSo\Cache\Drivers\File::NewInstance($this->Path);
$oSessionDriver->bRootDir = true;
$oSession->SetDriver($oSessionDriver);
$oSession->SetCacheIndex(\CApi::Version());
$this->Session = $oSession;
}
示例3: __construct
/**
* @param CApiGlobalManager &$oManager
*/
public function __construct(CApiGlobalManager &$oManager, $sForcedStorage = '')
{
parent::__construct('logger', $oManager);
$sS = CApi::GetConf('log.custom-full-path', '');
$sPrePath = empty($sS) ? CApi::DataPath() . '/logs/' : rtrim(trim($sS), '\\/') . '/';
$this->sLogFileName = CApi::GetConf('log.log-file', 'log.txt');
$this->sLogFile = $sPrePath . $this->sLogFileName;
$this->sCurrentUserLogFileName = CApi::GetConf('log.event-file', 'event.txt');
$this->sCurrentUserLogFile = $sPrePath . $this->sCurrentUserLogFileName;
}
示例4: __construct
public function __construct()
{
$oSettings =& CApi::GetSettings();
$this->aAccounts = array();
$this->aCalendars = array();
$this->sCurRunFilePath = CApi::DataPath() . '/reminder-run';
$this->sLang = $oSettings->GetConf('Common/DefaultLanguage');
$this->oApiUsersManager = CApi::Manager('users');
$this->oApiCalendarManager = CApi::Manager('calendar');
$this->oApiMailManager = CApi::Manager('mail');
}
示例5: CApiSettings
/**
* @return CApiSettings
*/
public function &GetSettings()
{
if (null === $this->oSettings) {
CApi::Inc('settings');
try {
$this->oSettings = new CApiSettings(\CApi::DataPath() . '/settings/config.json');
} catch (CApiBaseException $oException) {
$this->oSettings = false;
}
}
return $this->oSettings;
}
示例6: api_Settings
/**
* @return api_Settings
*/
public function &GetSettings()
{
if (null === $this->oSettings) {
CApi::Inc('common.settings');
try {
$this->oSettings = new api_Settings(CApi::DataPath());
} catch (CApiBaseException $oException) {
$this->oSettings = false;
}
}
return $this->oSettings;
}
示例7: __construct
public function __construct()
{
$bErrorCreateDir = false;
/* Public files folder */
$publicDir = \CApi::DataPath() . Constants::FILESTORAGE_PATH_ROOT;
if (!file_exists($publicDir)) {
if (!@mkdir($publicDir)) {
$bErrorCreateDir = true;
}
}
$publicDir .= Constants::FILESTORAGE_PATH_CORPORATE;
if (!file_exists($publicDir)) {
if (!@mkdir($publicDir)) {
$bErrorCreateDir = true;
}
}
$personalDir = \CApi::DataPath() . Constants::FILESTORAGE_PATH_ROOT . Constants::FILESTORAGE_PATH_PERSONAL;
if (!file_exists($personalDir)) {
if (!@mkdir($personalDir)) {
$bErrorCreateDir = true;
}
}
$sharedDir = \CApi::DataPath() . Constants::FILESTORAGE_PATH_ROOT . Constants::FILESTORAGE_PATH_SHARED;
if (!file_exists($sharedDir)) {
if (!@mkdir($sharedDir)) {
$bErrorCreateDir = true;
}
}
if ($bErrorCreateDir) {
throw new \Sabre\DAV\Exception('Can\'t create directory in ' . \CApi::DataPath() . Constants::FILESTORAGE_PATH_ROOT, 500);
}
$this->aTree = array(new RootPersonal($personalDir));
$oApiCapaManager = \CApi::GetSystemManager('capability');
if ($oApiCapaManager->isCollaborationSupported()) {
array_push($this->aTree, new RootPublic($publicDir));
}
if (\CApi::GetConf('labs.files-sharing', false)) {
array_push($this->aTree, new RootShared($sharedDir));
}
}
示例8: __construct
public function __construct($baseUri = '/')
{
$this->debugExceptions = false;
self::$exposeVersion = false;
$this->setBaseUri($baseUri);
date_default_timezone_set('GMT');
if (\CApi::GetPDO()) {
/* Authentication Plugin */
$this->addPlugin(new \Sabre\DAV\Auth\Plugin(Backends::Auth(), 'SabreDAV'));
/* Logs Plugin */
$this->addPlugin(new Logs\Plugin());
/* DAV ACL Plugin */
$aclPlugin = new \Sabre\DAVACL\Plugin();
$aclPlugin->hideNodesFromListings = true;
$aclPlugin->defaultUsernamePath = Constants::PRINCIPALS_PREFIX;
$mAdminPrincipal = \CApi::GetConf('labs.dav.admin-principal', false);
if ($mAdminPrincipal !== false) {
$aclPlugin->adminPrincipals = array(Constants::PRINCIPALS_PREFIX . '/' . $mAdminPrincipal);
}
$this->addPlugin($aclPlugin);
$bIsOwncloud = false;
/* Directory tree */
$aTree = array($bIsOwncloud ? new CardDAV\AddressBookRoot(Backends::Principal(), Backends::GetBackend('carddav-owncloud')) : new CardDAV\AddressBookRoot(Backends::Principal(), Backends::Carddav()), new CalDAV\CalendarRootNode(Backends::Principal(), Backends::Caldav()), new CardDAV\GAddressBooks('gab', Constants::GLOBAL_CONTACTS));
$this->oApiCapaManager = \CApi::Manager('capability');
/* Files folder */
if ($this->oApiCapaManager->IsFilesSupported()) {
$bErrorCreateDir = false;
/* Public files folder */
$publicDir = \CApi::DataPath() . Constants::FILESTORAGE_PATH_ROOT;
if (!file_exists($publicDir)) {
if (!@mkdir($publicDir)) {
$bErrorCreateDir = true;
}
}
$publicDir .= Constants::FILESTORAGE_PATH_CORPORATE;
if (!file_exists($publicDir)) {
if (!@mkdir($publicDir)) {
$bErrorCreateDir = true;
}
}
$personalDir = \CApi::DataPath() . Constants::FILESTORAGE_PATH_ROOT . Constants::FILESTORAGE_PATH_PERSONAL;
if (!file_exists($personalDir)) {
if (!@mkdir($personalDir)) {
$bErrorCreateDir = true;
}
}
$sharedDir = \CApi::DataPath() . Constants::FILESTORAGE_PATH_ROOT . Constants::FILESTORAGE_PATH_SHARED;
if (!file_exists($sharedDir)) {
if (!@mkdir($sharedDir)) {
$bErrorCreateDir = true;
}
}
if ($bErrorCreateDir) {
throw new \Sabre\DAV\Exception('Can\'t create directory in ' . \CApi::DataPath() . Constants::FILESTORAGE_PATH_ROOT, 500);
}
$aFilesTree = array(new FS\RootPersonal($personalDir), new FS\RootPublic($publicDir));
if (\CApi::GetConf('labs.files-sharing', false)) {
array_push($aFilesTree, new FS\RootShared($sharedDir));
}
array_push($aTree, new \Sabre\DAV\SimpleCollection('files', $aFilesTree));
$this->addPlugin(new FS\Plugin());
// Automatically guess (some) contenttypes, based on extesion
$this->addPlugin(new \Sabre\DAV\Browser\GuessContentType());
}
$oPrincipalColl = new \Sabre\DAVACL\PrincipalCollection(Backends::Principal());
$oPrincipalColl->disableListing = true;
array_push($aTree, $oPrincipalColl);
/* Initializing server */
parent::__construct($aTree);
$this->httpResponse->setHeader("X-Server", Constants::DAV_SERVER_NAME);
/* Reminders Plugin */
$this->addPlugin(new Reminders\Plugin(Backends::Reminders()));
/* Contacts Plugin */
$this->addPlugin(new Contacts\Plugin());
if ($this->oApiCapaManager->IsMobileSyncSupported()) {
/* CalDAV Plugin */
$this->addPlugin(new \Sabre\CalDAV\Plugin());
/* CardDAV Plugin */
$this->addPlugin(new \Sabre\CardDAV\Plugin());
/* ICS Export Plugin */
$this->addPlugin(new \Sabre\CalDAV\ICSExportPlugin());
/* VCF Export Plugin */
$this->addPlugin(new \Sabre\CardDAV\VCFExportPlugin());
}
/* Calendar Sharing Plugin */
$this->addPlugin(new \Sabre\CalDAV\SharingPlugin());
/* HTML Frontend Plugin */
if (\CApi::GetConf('labs.dav.use-browser-plugin', false) !== false) {
$this->addPlugin(new \Sabre\DAV\Browser\Plugin(false, false));
}
/* Locks Plugin */
// $this->addPlugin(new \Sabre\DAV\Locks\Plugin(new \Sabre\DAV\Locks\Backend\File(\CApi::DataPath() . '/locks.dat')));
$this->subscribeEvent('beforeGetProperties', array($this, 'beforeGetProperties'), 90);
}
}
示例9: getRootPath
public function getRootPath()
{
return \CApi::DataPath() . '/' . Plugin::getPersonalPath() . '/' . $this->getOwner();
}
示例10: getRootPath
public function getRootPath($sType = \EFileStorageTypeStr::Personal)
{
$sRootPath = '';
$iUserId = $this->getUser();
if ($sType === \EFileStorageTypeStr::Corporate) {
$sRootPath = \CApi::DataPath() . \Afterlogic\DAV\Constants::FILESTORAGE_PATH_ROOT . \Afterlogic\DAV\Constants::FILESTORAGE_PATH_CORPORATE . '/' . 0;
} else {
if ($sType === \EFileStorageTypeStr::Shared) {
$sRootPath = \CApi::DataPath() . \Afterlogic\DAV\Constants::FILESTORAGE_PATH_ROOT . \Afterlogic\DAV\Constants::FILESTORAGE_PATH_SHARED . '/' . $iUserId;
} else {
$sRootPath = \CApi::DataPath() . \Afterlogic\DAV\Constants::FILESTORAGE_PATH_ROOT . \Afterlogic\DAV\Constants::FILESTORAGE_PATH_PERSONAL . '/' . $iUserId;
}
}
return $sRootPath;
}
示例11: ClearTempFiles
/**
* @return bool
*/
public function ClearTempFiles()
{
$sTempPath = CApi::DataPath() . '/temp';
if (@is_dir($sTempPath)) {
$iNow = time();
$iTime2Run = CApi::GetConf('temp.cron-time-to-run', 10800);
$iTime2Kill = CApi::GetConf('temp.cron-time-to-kill', 10800);
$sDataFile = CApi::GetConf('temp.cron-time-file', '.clear.dat');
$iFiletTime = -1;
if (@file_exists(CApi::DataPath() . '/' . $sDataFile)) {
$iFiletTime = (int) @file_get_contents(CApi::DataPath() . '/' . $sDataFile);
}
if ($iFiletTime === -1 || $iNow - $iFiletTime > $iTime2Run) {
$this->recTimeDirRemove($sTempPath, $iTime2Kill, $iNow);
@file_put_contents(CApi::DataPath() . '/' . $sDataFile, $iNow);
}
}
return true;
}
示例12: __construct
/**
* @return void
*/
public function __construct()
{
// TODO hc
$this->oDriver = new \ProjectCore\Storage\Drivers\Files(\CApi::DataPath());
}
示例13: compileLanguage
/**
* @param string $sLanguage
*
* @return string
*/
private function compileLanguage($sLanguage)
{
$sLanguage = $this->validatedLanguageValue($sLanguage);
$sCacheFileName = '';
if (CApi::GetConf('labs.cache.i18n', $this->bCache)) {
$sCacheFileName = 'i18n-' . $sLanguage . '-' . md5(CApi::Version()) . '.cache';
$sCacheFullFileName = CApi::DataPath() . '/cache/' . $sCacheFileName;
if (file_exists($sCacheFullFileName)) {
return file_get_contents($sCacheFullFileName);
}
}
$aResultLang = array();
$sMomentLanguage = api_Utils::ConvertLanguageNameToShort($sLanguage);
$sFileName = CApi::WebMailPath() . 'i18n/' . $sLanguage . '.ini';
if ($sLanguage === 'Arabic' || $sLanguage === 'Persian') {
$sMoment = 'window.moment && window.moment.locale && window.moment.locale(\'en\');';
} else {
$sMoment = 'window.moment && window.moment.locale && window.moment.locale(\'' . $sMomentLanguage . '\');';
}
$aLang = null;
$sData = @file_get_contents($sFileName);
if (false !== $sData) {
$aLang = @parse_ini_string(trim($sData), true);
}
if (is_array($aLang)) {
foreach ($aLang as $sKey => $mValue) {
if (is_array($mValue)) {
foreach ($mValue as $sSecKey => $mSecValue) {
$aResultLang[$sKey . '/' . $sSecKey] = $mSecValue;
}
} else {
$aResultLang[$sKey] = $mValue;
}
}
}
CApi::Plugin()->ParseLangs($sLanguage, $aResultLang);
$sLangJs = '';
$aLangKeys = array_keys($aResultLang);
foreach ($aLangKeys as $sKey) {
$sString = isset($aResultLang[$sKey]) ? $aResultLang[$sKey] : $sKey;
$sLangJs .= '"' . str_replace('"', '\\"', str_replace('\\', '\\\\', $sKey)) . '":' . '"' . str_replace(array("\r", "\n", "\t"), array('\\r', '\\n', '\\t'), str_replace('"', '\\"', str_replace('\\', '\\\\', $sString))) . '",';
}
$sResult = empty($sLangJs) ? 'null' : '{' . substr($sLangJs, 0, -1) . '}';
$sResult = '<script>window.pSevenLang=\'' . $sLanguage . '\';window.pSevenI18N=' . $sResult . ';' . $sMoment . '</script>';
if (CApi::GetConf('labs.cache.i18n', $this->bCache)) {
if (!is_dir(dirname($sCacheFullFileName))) {
mkdir(dirname($sCacheFullFileName), 0777);
}
$sResult = '<!-- ' . $sCacheFileName . ' -->' . $sResult;
@file_put_contents($sCacheFullFileName, $sResult);
}
return $sResult;
}
示例14: fopen
$sStorageTo = $sStorageFrom;
$sStorageFrom = $sStorageTmp;
}
$iItemsPerPage = 20;
$iCurDomainId = -1;
$iCurUsersPage = 1;
$iCurUserId = 0;
/* @var $oApiDomainsManager CApiDomainsManager */
$oApiDomainsManager = CApi::Manager('domains');
/* @var $oApiUsersManager CApiUsersManager */
$oApiUsersManager = CApi::Manager('users');
/* @var $oApiContactsManagerFrom CApiContactsManager */
$oApiContactsManagerFrom = CApi::Manager('maincontacts', $sStorageFrom);
/* @var $oApiContactsManagerTo CApiContactsManager */
$oApiContactsManagerTo = CApi::Manager('maincontacts', $sStorageTo);
$sFilePath = CApi::DataPath() . '/migration';
if (file_exists($sFilePath)) {
$handle = fopen($sFilePath, 'r');
$sLine = fgets($handle);
$aLine = explode(':', $sLine);
if (isset($aLine[0]) && is_numeric($aLine[0])) {
$iCurDomainId = (int) $aLine[0];
}
if (isset($aLine[1]) && is_numeric($aLine[1])) {
$iCurUsersPage = (int) $aLine[1];
}
if (isset($aLine[2]) && is_numeric($aLine[2])) {
$iCurUserId = (int) $aLine[2];
}
}
CApi::Log('From storage: ' . $sStorageFrom, ELogLevel::Full, 'migration-');
示例15: __construct
/**
* @param CApiGlobalManager &$oManager
*/
public function __construct(CApiGlobalManager &$oManager)
{
parent::__construct('file', $oManager);
$this->sDataPath = rtrim(trim(CApi::DataPath()), '\\/');
}