本文整理汇总了PHP中Tinebase_Core::getHostname方法的典型用法代码示例。如果您正苦于以下问题:PHP Tinebase_Core::getHostname方法的具体用法?PHP Tinebase_Core::getHostname怎么用?PHP Tinebase_Core::getHostname使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tinebase_Core
的用法示例。
在下文中一共展示了Tinebase_Core::getHostname方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setFromArray
/**
* (non-PHPdoc)
* @see Tinebase/Record/Tinebase_Record_Abstract#setFromArray($_data)
*/
public function setFromArray(array $_data)
{
parent::setFromArray($_data);
// always set url here (or is there a better place?)
if ($this->getId()) {
$this->url = Tinebase_Core::getHostname() . '/download/show/' . $this->getId();
}
}
示例2: testAccountDeactivationNotification
/**
* test send deactivation notification
*
* @see 0009956: send mail on account deactivation
*/
public function testAccountDeactivationNotification()
{
$smtpConfig = Tinebase_Config::getInstance()->get(Tinebase_Config::SMTP);
if (!isset($smtpConfig->from) && !isset($smtpConfig->primarydomain)) {
$this->markTestSkipped('no notification service address configured.');
}
Tinebase_Config::getInstance()->set(Tinebase_Config::ACCOUNT_DEACTIVATION_NOTIFICATION, true);
$userArray = $this->testSaveAccount();
self::flushMailer();
$this->_json->setAccountState(array($userArray['accountId']), 'disabled');
$messages = self::getMessages();
$this->assertEquals(1, count($messages), 'did not get notification message');
$message = $messages[0];
$bodyText = $message->getBodyText(true);
$translate = Tinebase_Translation::getTranslation('Tinebase');
$this->assertEquals($translate->_('Your Tine 2.0 account has been deactivated'), $message->getSubject());
// @todo make this work. currently it does not work in de translation as the user name is cropped (tine20phpuni=)
//$this->assertContains($userArray['accountLoginName'], $bodyText);
$this->assertContains(Tinebase_Core::getHostname(), $bodyText);
}
示例3: sendDeactivationNotification
/**
* send deactivation email to user
*
* @param mixed $accountId
*/
public function sendDeactivationNotification($accountId)
{
if (!Tinebase_Config::getInstance()->get(Tinebase_Config::ACCOUNT_DEACTIVATION_NOTIFICATION)) {
if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) {
Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ . ' Deactivation notification disabled.');
}
return;
}
try {
$user = $this->getFullUserById($accountId);
if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) {
Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ . ' Send deactivation notification to user ' . $user->accountLoginName);
}
$translate = Tinebase_Translation::getTranslation('Tinebase');
$view = new Zend_View();
$view->setScriptPath(dirname(__FILE__) . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'views');
$view->translate = $translate;
$view->accountLoginName = $user->accountLoginName;
// TODO add this?
//$view->deactivationDate = $user->deactivationDate;
$view->tine20Url = Tinebase_Core::getHostname();
$messageBody = $view->render('deactivationNotification.php');
$messageSubject = $translate->_('Your Tine 2.0 account has been deactivated');
$recipient = Addressbook_Controller_Contact::getInstance()->getContactByUserId($user->getId(), true);
Tinebase_Notification::getInstance()->send(null, array($recipient), $messageSubject, $messageBody);
} catch (Exception $e) {
Tinebase_Exception::log($e);
}
}
示例4: testSaveDownloadLinkDirectory
/**
* testSaveDownloadLinkDirectory
*
* @return array Filemanager_Model_DownloadLink
*/
public function testSaveDownloadLinkDirectory()
{
$downloadLinkData = $this->_getDownloadLinkData();
$result = $this->_json->saveDownloadLink($downloadLinkData);
$this->assertTrue(!empty($result['url']));
$this->assertEquals(Tinebase_Core::getHostname() . '/download/show/' . $result['id'], $result['url']);
return $result;
}
示例5: _convertVevent
//.........这里部分代码省略.........
// NOTE: we might miss a attachment here for the following reasons
// 1. client reuses a managed id (we are server):
// We havn't observerd this yet. iCal client reuse manged id's
// from base events in exceptions but this is covered as we
// initialize new exceptions with base event attachments
//
// When a client reuses a managed id it's not clear yet if
// this managed id needs to be in the same series/calendar/server
//
// As we use the object hash the managed id might be used in the
// same files with different names. We need to evaluate the name
// (if attached) in this case as well.
//
// 2. server send his managed id (we are client)
// * we need to download the attachment (here?)
// * we need to have a mapping externalid / internalid (where?)
if (!$attachment) {
$readFromURL = true;
$url = $property->getValue();
} else {
$attachments->addRecord($attachment);
}
} elseif ('URI' === $value) {
/*
* ATTACH;VALUE=URI:https://server.com/calendars/__uids__/0AA0
3A3B-F7B6-459A-AB3E-4726E53637D0/dropbox/4971F93F-8657-412B-841A-A0FD913
9CD61.dropbox/Canada.png
*/
$url = $property->getValue();
$urlParts = parse_url($url);
$host = $urlParts['host'];
$name = pathinfo($urlParts['path'], PATHINFO_BASENAME);
// iCal 10.7 places URI before uploading
if (parse_url(Tinebase_Core::getHostname(), PHP_URL_HOST) != $host) {
$readFromURL = true;
}
} else {
// @TODO: implement (check if add / update / update is needed)
if (Tinebase_Core::isLogLevel(Zend_Log::WARN)) {
Tinebase_Core::getLogger()->warn(__METHOD__ . '::' . __LINE__ . ' attachment found that could not be imported due to missing managed id');
}
}
if ($readFromURL) {
if (preg_match('#^(https?://)(.*)$#', str_replace(array("\n", "\r"), '', $url), $matches)) {
// we are client and found an external hosted attachment that we need to import
$userCredentialCache = Tinebase_Core::getUserCredentialCache();
$url = $matches[1] . $userCredentialCache->username . ':' . $userCredentialCache->password . '@' . $matches[2];
$attachmentInfo = $matches[1] . $matches[2] . ' ' . $name . ' ' . $managedId;
if (Tinebase_Helper::urlExists($url)) {
if (Tinebase_Core::isLogLevel(Zend_Log::INFO)) {
Tinebase_Core::getLogger()->info(__METHOD__ . '::' . __LINE__ . ' Downloading attachment: ' . $attachmentInfo);
}
$stream = fopen($url, 'r');
$attachment = new Tinebase_Model_Tree_Node(array('name' => rawurldecode($name), 'type' => Tinebase_Model_Tree_Node::TYPE_FILE, 'contenttype' => (string) $property['FMTTYPE'], 'tempFile' => $stream), true);
$attachments->addRecord($attachment);
} else {
if (Tinebase_Core::isLogLevel(Zend_Log::WARN)) {
Tinebase_Core::getLogger()->warn(__METHOD__ . '::' . __LINE__ . ' Url not found (got 404): ' . $attachmentInfo . ' - Skipping attachment');
}
}
} else {
if (Tinebase_Core::isLogLevel(Zend_Log::WARN)) {
Tinebase_Core::getLogger()->warn(__METHOD__ . '::' . __LINE__ . ' Attachment found with malformed url: ' . $url);
}
}
}