本文整理汇总了PHP中Tinebase_Core::isLogLevel方法的典型用法代码示例。如果您正苦于以下问题:PHP Tinebase_Core::isLogLevel方法的具体用法?PHP Tinebase_Core::isLogLevel怎么用?PHP Tinebase_Core::isLogLevel使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tinebase_Core
的用法示例。
在下文中一共展示了Tinebase_Core::isLogLevel方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _group2ldap
/**
* convert objects with user data to ldap data array
*
* @param Tinebase_Model_FullUser $_user
* @param array $_ldapData the data to be written to ldap
*/
protected function _group2ldap(Tinebase_Model_Group $_group, array &$_ldapData)
{
if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) {
Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ . ' ENCRYPT ' . print_r($_ldapData, true));
}
if (isset($_ldapData['objectclass'])) {
$_ldapData['objectclass'] = array_unique(array_merge($_ldapData['objectclass'], $this->_requiredObjectClass));
}
if (isset($_ldapData['gidnumber'])) {
$gidNumber = $_ldapData['gidnumber'];
} else {
$gidNumber = $this->_getGidNumber($_group->getId());
}
// when we try to add a group, $_group has no id which leads to Tinebase_Exception_InvalidArgument in $this->_getGroupMetaData
try {
$metaData = $this->_getGroupMetaData($_group);
} catch (Tinebase_Exception_InvalidArgument $teia) {
$metaData = array();
}
if (!isset($metaData['sambasid'])) {
$_ldapData['sambasid'] = $this->_options[Tinebase_Group_Ldap::PLUGIN_SAMBA]['sid'] . '-' . (2 * $gidNumber + 1001);
$_ldapData['sambagrouptype'] = 2;
}
$_ldapData['displayname'] = $_group->name;
}
示例2: handle
/**
* process the XML file and add, change, delete or fetches data
*
* @todo can we get rid of LIBXML_NOWARNING
* @return resource
*/
public function handle()
{
$controller = ActiveSync_Controller::getInstance();
$this->_folderStateBackend = new ActiveSync_Backend_FolderState();
$xml = new SimpleXMLElement($this->_inputDom->saveXML(), LIBXML_NOWARNING);
#$xml = simplexml_import_dom($this->_inputDom);
foreach ($xml->Collections->Collection as $xmlCollection) {
// fetch values from a different namespace
$airSyncValues = $xmlCollection->children('uri:AirSync');
$collectionData = array('syncKey' => (int) $airSyncValues->SyncKey, 'syncKeyValid' => true, 'class' => (string) $xmlCollection->Class, 'collectionId' => (string) $xmlCollection->CollectionId, 'filterType' => isset($airSyncValues->FilterType) ? (int) $airSyncValues->FilterType : 0);
if (Tinebase_Core::isLogLevel(Zend_Log::INFO)) {
Tinebase_Core::getLogger()->info(__METHOD__ . '::' . __LINE__ . " synckey is {$collectionData['syncKey']} class: {$collectionData['class']} collectionid: {$collectionData['collectionId']} filtertype: {$collectionData['filterType']}");
}
if ($collectionData['syncKey'] === 0) {
$collectionData['syncState'] = new ActiveSync_Model_SyncState(array('device_id' => $this->_device->getId(), 'counter' => 0, 'type' => $collectionData['class'] . '-' . $collectionData['collectionId'], 'lastsync' => $this->_syncTimeStamp));
}
if (($collectionData['syncState'] = $controller->validateSyncKey($this->_device, $collectionData['syncKey'], $collectionData['class'], $collectionData['collectionId'])) === false) {
if (Tinebase_Core::isLogLevel(Zend_Log::WARN)) {
Tinebase_Core::getLogger()->warn(__METHOD__ . '::' . __LINE__ . " invalid synckey {$collectionData['syncKey']} provided");
}
$collectionData['syncKeyValid'] = false;
$collectionData['syncState'] = new ActiveSync_Model_SyncState(array('device_id' => $this->_device->getId(), 'counter' => 0, 'type' => $collectionData['class'] . '-' . $collectionData['collectionId'], 'lastsync' => $this->_syncTimeStamp));
}
$this->_collections[$collectionData['class']][$collectionData['collectionId']] = $collectionData;
}
}
示例3: handle
/**
* (non-PHPdoc)
* @see Tinebase_Server_Interface::handle()
*/
public function handle(\Zend\Http\Request $request = null, $body = null)
{
$method = $this->getRequestMethod();
if (!in_array($method, array('Tinebase.monitoringCheckDB', 'Tinebase.monitoringCheckConfig'))) {
Tinebase_Core::initFramework();
if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) {
Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ . ' Is cli request. method: ' . $method);
}
}
// prevents problems with missing request uri (@see Sabre\HTTP\Request->getUri())
if (!isset($_SERVER['REQUEST_URI'])) {
$_SERVER['REQUEST_URI'] = '';
}
$tinebaseServer = new Tinebase_Frontend_Cli();
$opts = Tinebase_Core::get('opts');
if (!in_array($method, self::getAnonymousMethods($method))) {
$tinebaseServer->authenticate($opts->username, $opts->password);
}
$result = $tinebaseServer->handle($opts);
//@todo remove cli session path
// convert function result to shell return code
if ($result === NULL || $result === TRUE || !is_int($result)) {
$result = 0;
} else {
if ($result === FALSE) {
$result = 1;
}
}
// finish profiling here - we won't run in Tinebase_Core again
Tinebase_Core::finishProfiling();
Tinebase_Core::getDbProfiling();
exit($result);
}
示例4: __construct
/**
* the constructor
*/
public function __construct()
{
if (Sales_Config::getInstance()->featureEnabled(Sales_Config::FEATURE_INVOICES_MODULE)) {
$this->_relatableModels[] = 'Sales_Model_Invoice';
$this->_configuredModels[] = 'InvoicePosition';
$this->_configuredModels[] = 'Invoice';
} else {
if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) {
Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ . ' Invoices module disabled');
}
}
if (Sales_Config::getInstance()->featureEnabled(Sales_Config::FEATURE_OFFERS_MODULE)) {
$this->_relatableModels[] = 'Sales_Model_Offer';
$this->_configuredModels[] = 'Offer';
}
if (Sales_Config::getInstance()->featureEnabled(Sales_Config::FEATURE_SUPPLIERS_MODULE)) {
$this->_relatableModels[] = 'Sales_Model_Supplier';
$this->_configuredModels[] = 'Supplier';
}
if (Sales_Config::getInstance()->featureEnabled(Sales_Config::FEATURE_PURCHASE_INVOICES_MODULE)) {
$this->_relatableModels[] = 'Sales_Model_PurchaseInvoice';
$this->_configuredModels[] = 'PurchaseInvoice';
}
if (Sales_Config::getInstance()->featureEnabled(Sales_Config::FEATURE_ORDERCONFIRMATIONS_MODULE)) {
$this->_relatableModels[] = 'Sales_Model_OrderConfirmation';
$this->_configuredModels[] = 'OrderConfirmation';
}
}
示例5: _handleEvent
/**
* event handler function
*
* all events get routed through this function
*
* @param Tinebase_Event_Abstract $_eventObject the eventObject
*
* @todo write test
*/
protected function _handleEvent(Tinebase_Event_Abstract $_eventObject)
{
if (Tinebase_Core::isLogLevel(Zend_Log::TRACE)) {
Tinebase_Core::getLogger()->trace(__METHOD__ . ' (' . __LINE__ . ') handle event of type ' . get_class($_eventObject));
}
switch (get_class($_eventObject)) {
case 'Admin_Event_AddAccount':
$this->createPersonalFolder($_eventObject->account);
break;
case 'Tinebase_Event_User_DeleteAccount':
/**
* @var Tinebase_Event_User_DeleteAccount $_eventObject
*/
if ($_eventObject->deletePersonalContainers()) {
$this->deletePersonalFolder($_eventObject->account);
}
//make to be deleted accounts (user) contact a normal contact
if ($_eventObject->keepAsContact()) {
$contact = Addressbook_Controller_Contact::getInstance()->get($_eventObject->account->contact_id);
$contact->type = Addressbook_Model_Contact::CONTACTTYPE_CONTACT;
Addressbook_Controller_Contact::getInstance()->update($contact);
} else {
//or just delete it
$contactsBackend = Addressbook_Backend_Factory::factory(Addressbook_Backend_Factory::SQL);
$contactsBackend->delete($_eventObject->account->contact_id);
}
break;
}
}
示例6: handle
/**
* handler for command line scripts
*
* @return boolean
*/
public function handle()
{
try {
$opts = new Zend_Console_Getopt(array('help|h' => 'Display this help Message', 'verbose|v' => 'Output messages', 'config|c=s' => 'Path to config.inc.php file', 'setconfig' => 'Update config. To specify the key and value, append \' -- configKey="your_key" configValue="your config value"\'
Examples:
setup.php --setconfig -- configkey=sample1 configvalue=value11
setup.php --setconfig -- configkey=sample2 configvalue=arrayKey1:Value1,arrayKey2:value2', 'check_requirements' => 'Check if all requirements are met to install and run tine20', 'create_admin' => 'Create new admin user (or reactivate if already exists)', 'install-s' => 'Install applications [All] or comma separated list;' . ' To specify the login name and login password of the admin user that is created during installation, append \' -- adminLoginName="admin" adminPassword="password"\'' . ' To add imap or smtp settings, append (for example) \' -- imap="host:mail.example.org,port:143,dbmail_host:localhost" smtp="ssl:tls"\'', 'update-s' => 'Update applications [All] or comma separated list', 'uninstall-s' => 'Uninstall application [All] or comma separated list', 'list-s' => 'List installed applications', 'sync_accounts_from_ldap' => 'Import user and groups from ldap', 'egw14import' => 'Import user and groups from egw14
Examples:
setup.php --egw14import egwdbhost egwdbuser egwdbpass egwdbname latin1
setup.php --egw14import egwdbhost egwdbuser egwdbpass egwdbname utf8'));
$opts->parse();
} catch (Zend_Console_Getopt_Exception $e) {
echo "Invalid usage: {$e->getMessage()}\n\n";
echo $e->getUsageMessage();
exit;
}
if (count($opts->toArray()) === 0 || $opts->h || empty($opts->install) && empty($opts->update) && empty($opts->uninstall) && empty($opts->list) && empty($opts->sync_accounts_from_ldap) && empty($opts->egw14import) && empty($opts->check_requirements) && empty($opts->create_admin) && empty($opts->setconfig)) {
echo $opts->getUsageMessage();
exit;
}
if ($opts->config) {
// add path to config.inc.php to include path
$path = strstr($opts->config, 'config.inc.php') !== false ? dirname($opts->config) : $opts->config;
set_include_path($path . PATH_SEPARATOR . get_include_path());
}
Setup_Core::initFramework();
if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) {
Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ . ' Is cli request. method: ' . (isset($opts->mode) ? $opts->mode : 'EMPTY'));
}
$setupServer = new Setup_Frontend_Cli();
#$setupServer->authenticate($opts->username, $opts->password);
return $setupServer->handle($opts);
}
示例7: resetSyncForUser
/**
* reset sync for user
*
* @param mixed $user
* @param array|string $classesToReset
* @return boolean
*/
public function resetSyncForUser($user, $classesToReset)
{
if (is_string($classesToReset)) {
$classesToReset = array($classesToReset);
}
if (!$user instanceof Tinebase_Model_User) {
try {
$user = Tinebase_User::getInstance()->getFullUserById($user);
} catch (Tinebase_Exception_NotFound $tenf) {
$user = Tinebase_User::getInstance()->getUserByPropertyFromSqlBackend('accountLoginName', $user);
}
}
if (Tinebase_Core::isLogLevel(Zend_Log::INFO)) {
Tinebase_Core::getLogger()->info(__METHOD__ . '::' . __LINE__ . ' Resetting sync for user ' . $user->accountDisplayName . ' collections: ' . print_r($classesToReset, true));
}
self::initSyncrotonRegistry();
$devices = $this->_getDevicesForUser($user->getId());
foreach ($devices as $device) {
if (Tinebase_Core::isLogLevel(Zend_Log::INFO)) {
Tinebase_Core::getLogger()->info(__METHOD__ . '::' . __LINE__ . ' Resetting device' . $device->friendlyname . ' / id: ' . $device->getId());
}
foreach ($classesToReset as $class) {
$folderToReset = $this->_getFoldersForDeviceAndClass($device, $class);
if (Tinebase_Core::isLogLevel(Zend_Log::INFO)) {
Tinebase_Core::getLogger()->info(__METHOD__ . '::' . __LINE__ . ' Resetting ' . count($folderToReset) . ' folder(s) for class ' . $class);
}
foreach ($folderToReset as $folderState) {
Syncroton_Registry::getSyncStateBackend()->resetState($device->getId(), $folderState->id);
}
}
}
return true;
}
示例8: _importRecord
protected function _importRecord($_recordData, &$_result)
{
//if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ . ' ' . print_r($_recordData, true));
$record = new $this->_modelName($_recordData, TRUE);
if ($record->isValid()) {
if (!$this->_options['dryrun']) {
if ($record->__get('change_sign') == 'A') {
$record = call_user_func(array($this->_controller, $this->_createMethod), $record);
} else {
try {
$record = $this->_controller->getByRecordNumber((int) trim($record->__get('record_number')));
$record->setFromArray($_recordData);
$record = $this->_controller->update($record);
} catch (Tinebase_Exception_NotFound $e) {
$record = call_user_func(array($this->_controller, $this->_createMethod), $record);
}
if ($record->__get('change_sign') == 'D') {
$this->_controller->delete($record->getId());
}
}
} else {
$_result['results']->addRecord($record);
}
$_result['totalcount']++;
} else {
if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) {
Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ . ' ' . print_r($record->toArray(), true));
}
throw new Tinebase_Exception_Record_Validation('Imported record is invalid.');
}
}
示例9: repairGroups
/**
* repair groups
*
* * add missing lists
* * checks if list container has been deleted (and hides groups if that's the case)
*
* @see 0010401: add repair script for groups without list_ids
*/
public function repairGroups()
{
$count = 0;
$be = new Tinebase_Group_Sql();
$listBackend = new Addressbook_Backend_List();
$groups = $be->getGroups();
foreach ($groups as $group) {
if ($group->list_id == null) {
$list = Addressbook_Controller_List::getInstance()->createByGroup($group);
$group->list_id = $list->getId();
$group->visibility = Tinebase_Model_Group::VISIBILITY_DISPLAYED;
if (Tinebase_Core::isLogLevel(Zend_Log::INFO)) {
Tinebase_Core::getLogger()->info(__METHOD__ . '::' . __LINE__ . ' Add missing list for group ' . $group->name);
}
$be->updateGroupInSqlBackend($group);
$count++;
} else {
if ($group->visibility === Tinebase_Model_Group::VISIBILITY_DISPLAYED) {
try {
$list = $listBackend->get($group->list_id);
$listContainer = Tinebase_Container::getInstance()->get($list->container_id);
} catch (Tinebase_Exception_NotFound $tenf) {
if (Tinebase_Core::isLogLevel(Zend_Log::INFO)) {
Tinebase_Core::getLogger()->info(__METHOD__ . '::' . __LINE__ . ' Hide group ' . $group->name . ' without list / list container.');
}
$group->visibility = Tinebase_Model_Group::VISIBILITY_HIDDEN;
$be->updateGroupInSqlBackend($group);
$count++;
}
}
}
}
echo $count . " groups repaired!\n";
}
示例10: getGrantsForRecords
/**
* get grants for records
*
* @param Tinebase_Record_RecordSet $records
*/
public function getGrantsForRecords(Tinebase_Record_RecordSet $records)
{
$recordIds = $records->getArrayOfIds();
if (empty($recordIds)) {
return;
}
$select = $this->_getAclSelectByRecordIds($recordIds)->group(array('record_id', 'account_type', 'account_id'));
Tinebase_Backend_Sql_Abstract::traitGroup($select);
if (Tinebase_Core::isLogLevel(Zend_Log::TRACE)) {
Tinebase_Core::getLogger()->trace(__METHOD__ . '::' . __LINE__ . ' ' . $select);
}
$stmt = $this->_db->query($select);
$grantsData = $stmt->fetchAll(Zend_Db::FETCH_ASSOC);
if (Tinebase_Core::isLogLevel(Zend_Log::TRACE)) {
Tinebase_Core::getLogger()->trace(__METHOD__ . '::' . __LINE__ . ' grantsData: ' . print_r($grantsData, true));
}
foreach ($grantsData as $grantData) {
$givenGrants = explode(',', $grantData['account_grants']);
foreach ($givenGrants as $grant) {
$grantData[$grant] = TRUE;
}
$recordGrant = new $this->_modelName($grantData, true);
unset($recordGrant->account_grant);
$record = $records->getById($recordGrant->record_id);
if (!$record->grants instanceof Tinebase_Record_RecordSet) {
$record->grants = new Tinebase_Record_RecordSet($this->_modelName);
}
$record->grants->addRecord($recordGrant);
}
if (Tinebase_Core::isLogLevel(Zend_Log::TRACE)) {
Tinebase_Core::getLogger()->trace(__METHOD__ . '::' . __LINE__ . ' Records with grants: ' . print_r($records->toArray(), true));
}
}
示例11: appendFilterSql
/**
* appends sql to given select statement
*
* @param Zend_Db_Select $_select
* @param Tinebase_Backend_Sql_Abstract $_backend
*/
public function appendFilterSql($_select, $_backend)
{
$db = $_backend->getAdapter();
// prepare value
$value = $this->_value ? 1 : 0;
if ($value) {
// nothing to do -> show all contacts!
if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) {
Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ . ' Query all account contacts.');
}
} else {
if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) {
Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ . ' Only query visible and enabled account contacts.');
}
if (Tinebase_Core::getUser() instanceof Tinebase_Model_FullUser) {
$where = '/* is no user */ ' . Tinebase_Backend_Sql_Command::getIfIsNull($db, $db->quoteIdentifier('accounts.id'), 'true', 'false') . ' OR /* is user */ (' . Tinebase_Backend_Sql_Command::getIfIsNull($db, $db->quoteIdentifier('accounts.id'), 'false', 'true') . ' AND ' . $db->quoteInto($db->quoteIdentifier('accounts.status') . ' = ?', 'enabled') . " AND " . '(' . $db->quoteInto($db->quoteIdentifier('accounts.visibility') . ' = ?', 'displayed') . ' OR ' . $db->quoteInto($db->quoteIdentifier('accounts.id') . ' = ?', Tinebase_Core::getUser()->getId()) . ')' . ")";
} else {
$where = '/* is no user */ ' . Tinebase_Backend_Sql_Command::getIfIsNull($db, $db->quoteIdentifier('accounts.id'), 'true', 'false') . ' OR /* is user */ (' . Tinebase_Backend_Sql_Command::getIfIsNull($db, $db->quoteIdentifier('accounts.id'), 'false', 'true') . ' AND ' . $db->quoteInto($db->quoteIdentifier('accounts.status') . ' = ?', 'enabled') . " AND " . $db->quoteInto($db->quoteIdentifier('accounts.visibility') . ' = ?', 'displayed') . ")";
}
$_select->where($where);
$select = $_select instanceof Zend_Db_Select ? $_select : $_select->getSelect();
$select = Tinebase_Backend_Sql_Abstract::traitGroup($db, $_backend->getTablePrefix(), $select);
$_select instanceof Zend_Db_Select ? $_select = $select : $_select->setSelect($select);
if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) {
Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ . ' contacts query ' . $_select->assemble());
}
}
}
示例12: appendFilterSql
/**
* appends sql to given select statement
*
* @param Zend_Db_Select $_select
* @param Tinebase_Backend_Sql_Abstract $_backend
* @throws Tinebase_Exception_UnexpectedValue
*/
public function appendFilterSql($_select, $_backend)
{
// don't take empty filter into account
if (empty($this->_value) || !is_array($this->_value) || !isset($this->_value['cfId']) || empty($this->_value['cfId']) || !isset($this->_value['value'])) {
return;
} else {
if ($this->_operator == 'in') {
throw new Tinebase_Exception_UnexpectedValue('Operator "in" not supported.');
}
}
// make sure $correlationName is a string
$correlationName = Tinebase_Record_Abstract::generateUID() . $this->_value['cfId'] . 'cf';
if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) {
Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ . ' Adding custom field filter: ' . print_r($this->_value, true));
}
$db = Tinebase_Core::getDb();
$idProperty = $db->quoteIdentifier($this->_options['idProperty']);
// per left join we add a customfield column named as the customfield and filter this joined column
// NOTE: we name the column we join like the customfield, to be able to join multiple customfield criteria (multiple invocations of this function)
$what = array($correlationName => SQL_TABLE_PREFIX . 'customfield');
$on = $db->quoteIdentifier("{$correlationName}.record_id") . " = {$idProperty} AND " . $db->quoteIdentifier("{$correlationName}.customfield_id") . " = " . $db->quote($this->_value['cfId']);
$_select->joinLeft($what, $on, array());
$valueIdentifier = $db->quoteIdentifier("{$correlationName}.value");
if ($this->_value['value'] === '') {
$where = $db->quoteInto($valueIdentifier . ' IS NULL OR ' . $valueIdentifier . ' = ?', $this->_value['value']);
} else {
$value = $this->_replaceWildcards($this->_value['value']);
$where = $db->quoteInto($valueIdentifier . $this->_opSqlMap[$this->_operator]['sqlop'], $value);
}
$_select->where($where . ' /* add cf filter */');
}
示例13: _updateForeignKeys
/**
* update foreign key values
*
* @param string $_mode create|update
* @param Tinebase_Record_Interface $_record
*
* @todo support update mode
*/
protected function _updateForeignKeys($_mode, Tinebase_Record_Interface $_record)
{
if ($_mode == 'create') {
foreach ($this->_foreignTables as $key => $foreign) {
if (!isset($_record->{$key}) || empty($_record->{$key})) {
continue;
}
if (Tinebase_Core::isLogLevel(Zend_Log::TRACE)) {
Tinebase_Core::getLogger()->trace(__METHOD__ . '::' . __LINE__ . ' ' . $key . ': ' . print_r($_record->{$key}, TRUE));
}
foreach ($_record->{$key} as $data) {
if ($key == 'flags') {
$data = array('flag' => $data, 'folder_id' => $_record->folder_id);
} else {
// need to filter input as 'name' could contain invalid chars (emojis, ...) here
foreach ($data as $field => $value) {
$data[$field] = Tinebase_Core::filterInputForDatabase($data[$field]);
}
}
$data['message_id'] = $_record->getId();
$this->_db->insert($this->_tablePrefix . $foreign['table'], $data);
}
}
}
}
示例14: parseUserAgent
/**
* parse iseragent and return backend and version
*
* @return array
*/
public static function parseUserAgent($_userAgent)
{
// MacOS X
if (preg_match(Calendar_Convert_Event_VCalendar_MacOSX::HEADER_MATCH, $_userAgent, $matches)) {
$backend = Calendar_Convert_Event_VCalendar_Factory::CLIENT_MACOSX;
$version = $matches['version'];
// iPhone
} elseif (preg_match(Calendar_Convert_Event_VCalendar_Iphone::HEADER_MATCH, $_userAgent, $matches)) {
$backend = Calendar_Convert_Event_VCalendar_Factory::CLIENT_IPHONE;
$version = $matches['version'];
// KDE
} elseif (preg_match(Calendar_Convert_Event_VCalendar_KDE::HEADER_MATCH, $_userAgent, $matches)) {
$backend = Calendar_Convert_Event_VCalendar_Factory::CLIENT_KDE;
$version = $matches['version'];
// Thunderbird
} elseif (preg_match(Calendar_Convert_Event_VCalendar_Thunderbird::HEADER_MATCH, $_userAgent, $matches)) {
$backend = Calendar_Convert_Event_VCalendar_Factory::CLIENT_THUNDERBIRD;
$version = $matches['version'];
} else {
$backend = Calendar_Convert_Event_VCalendar_Factory::CLIENT_GENERIC;
$version = null;
}
if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) {
Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ . " backend: {$backend} version: {$version}");
}
return array($backend, $version);
}
示例15: handle
/**
* handler for command line scripts
*
* @return boolean
*/
public function handle()
{
Tinebase_Core::initFramework();
#if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ .' is Asterisk curl request: ' . print_r($_REQUEST, true));
if (Tinebase_Controller::getInstance()->login($_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW'], $_SERVER['REMOTE_ADDR'], 'TineAsterisk') === true) {
$server = new Tinebase_Http_Server();
$server->setClass('Voipmanager_Frontend_Asterisk_SipPeers', 'Voipmanager_SipPeers');
$server->setClass('Voipmanager_Frontend_Asterisk_SipRegs', 'Voipmanager_SipRegs');
$server->setClass('Voipmanager_Frontend_Asterisk_CallForward', 'Voipmanager_CallForward');
$server->setClass('Voipmanager_Frontend_Asterisk_MeetMe', 'Voipmanager_MeetMe');
list($class, $method) = explode('.', $_REQUEST['method']);
// ugly hack to parse requests from res_config_curl
if ($method == 'handleResConfig') {
// set method to a usefull value
$pos = strpos($_REQUEST['action'], '?');
if ($pos !== false) {
$action = substr($_REQUEST['action'], 0, $pos);
list($key, $value) = explode('=', substr($_REQUEST['action'], $pos + 1));
$_REQUEST[$key] = $value;
} else {
$action = $_REQUEST['action'];
}
#if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ .' action: ' . $action);
$method = ucfirst(substr($action, 1));
$_REQUEST['method'] = $class . '.handle' . $method;
}
#if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ .' action: ' . print_r($_REQUEST, true));
$server->handle($_REQUEST);
Tinebase_Controller::getInstance()->logout($_SERVER['REMOTE_ADDR']);
} else {
if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) {
Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ . ' auth failed ');
}
}
}