当前位置: 首页>>代码示例>>PHP>>正文


PHP CApi::GetPDO方法代码示例

本文整理汇总了PHP中CApi::GetPDO方法的典型用法代码示例。如果您正苦于以下问题:PHP CApi::GetPDO方法的具体用法?PHP CApi::GetPDO怎么用?PHP CApi::GetPDO使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CApi的用法示例。


在下文中一共展示了CApi::GetPDO方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: __construct

 /**
  * Sets up the backend.
  */
 public function __construct()
 {
     $oPdo = \CApi::GetPDO();
     $dbPrefix = \CApi::GetSettings()->GetConf('Common/DBPrefix');
     $this->oApiUsersManager = \CApi::Manager('users');
     parent::__construct($oPdo, $dbPrefix . Constants::T_PRINCIPALS, $dbPrefix . Constants::T_GROUPMEMBERS);
 }
开发者ID:pkdevboxy,项目名称:webmail-lite,代码行数:10,代码来源:PDOExt.php

示例2: CheckPrincipals

    public static function CheckPrincipals($sUserName)
    {
        if (trim($sUserName) !== '') {
            $oPdo = \CApi::GetPDO();
            $dbPrefix = \CApi::GetSettingsConf('Common/DBPrefix');
            $sPrincipal = \afterlogic\DAV\Constants::PRINCIPALS_PREFIX . '/' . $sUserName;
            $oStmt = $oPdo->prepare('SELECT id FROM ' . $dbPrefix . Constants::T_PRINCIPALS . ' WHERE uri = ? LIMIT 1');
            $oStmt->execute(array($sPrincipal));
            if (count($oStmt->fetchAll()) === 0) {
                $oStmt = $oPdo->prepare('INSERT INTO ' . $dbPrefix . Constants::T_PRINCIPALS . '
						(uri,email,displayname) VALUES (?, ?, ?)');
                try {
                    $oStmt->execute(array($sPrincipal, $sUserName, ''));
                } catch (Exception $e) {
                }
            }
            $oStmt = $oPdo->prepare('SELECT principaluri FROM ' . $dbPrefix . Constants::T_CALENDARS . '
					WHERE principaluri = ?');
            $oStmt->execute(array($sPrincipal));
            if (count($oStmt->fetchAll()) === 0) {
                $oStmt = $oPdo->prepare('INSERT INTO ' . $dbPrefix . Constants::T_CALENDARS . '
						(principaluri, displayname, uri, description, components, ctag, calendarcolor)
						VALUES (?, ?, ?, ?, ?, 1, ?)');
                $oAccount = self::GetAccountByLogin($sUserName);
                $oStmt->execute(array($sPrincipal, \CApi::ClientI18N('CALENDAR/CALENDAR_DEFAULT_NAME', $oAccount), \Sabre\DAV\UUIDUtil::getUUID(), '', 'VEVENT,VTODO', Constants::CALENDAR_DEFAULT_COLOR));
            }
            $oStmt = $oPdo->prepare('SELECT principaluri FROM ' . $dbPrefix . Constants::T_CALENDARS . '
					WHERE principaluri = ? and uri = ? LIMIT 1');
            $oStmt->execute(array($sPrincipal, Constants::CALENDAR_DEFAULT_NAME));
            if (count($oStmt->fetchAll()) !== 0) {
                $oStmt = $oPdo->prepare('UPDATE ' . $dbPrefix . Constants::T_CALENDARS . '
						SET uri = ? WHERE principaluri = ? and uri = ?');
                $oStmt->execute(array(\Sabre\DAV\UUIDUtil::getUUID(), $sPrincipal, Constants::CALENDAR_DEFAULT_NAME));
            }
            $oStmt = $oPdo->prepare('SELECT principaluri FROM ' . $dbPrefix . Constants::T_ADDRESSBOOKS . '
					WHERE principaluri = ? and uri = ? LIMIT 1');
            $oStmt->execute(array($sPrincipal, Constants::ADDRESSBOOK_DEFAULT_NAME));
            $bHasDefaultAddressbooks = count($oStmt->fetchAll()) != 0;
            $oStmt->execute(array($sPrincipal, Constants::ADDRESSBOOK_DEFAULT_NAME_OLD));
            $bHasOldDefaultAddressbooks = count($oStmt->fetchAll()) != 0;
            $oStmt->execute(array($sPrincipal, Constants::ADDRESSBOOK_COLLECTED_NAME));
            $bHasCollectedAddressbooks = count($oStmt->fetchAll()) != 0;
            $stmt1 = $oPdo->prepare('INSERT INTO ' . $dbPrefix . Constants::T_ADDRESSBOOKS . '
					(principaluri, displayname, uri, description, ctag)
					VALUES (?, ?, ?, ?, 1)');
            if (!$bHasDefaultAddressbooks) {
                if ($bHasOldDefaultAddressbooks) {
                    $oStmt = $oPdo->prepare('UPDATE ' . $dbPrefix . Constants::T_ADDRESSBOOKS . '
							SET uri = ? WHERE principaluri = ? and uri = ?');
                    $oStmt->execute(array(Constants::ADDRESSBOOK_DEFAULT_NAME, $sPrincipal, Constants::ADDRESSBOOK_DEFAULT_NAME_OLD));
                } else {
                    $stmt1->execute(array($sPrincipal, Constants::ADDRESSBOOK_DEFAULT_DISPLAY_NAME, Constants::ADDRESSBOOK_DEFAULT_NAME, Constants::ADDRESSBOOK_DEFAULT_DISPLAY_NAME));
                }
            }
            if (!$bHasCollectedAddressbooks) {
                $stmt1->execute(array($sPrincipal, Constants::ADDRESSBOOK_COLLECTED_DISPLAY_NAME, Constants::ADDRESSBOOK_COLLECTED_NAME, Constants::ADDRESSBOOK_COLLECTED_DISPLAY_NAME));
            }
        }
    }
开发者ID:BertLasker,项目名称:Catch-design,代码行数:59,代码来源:Utils.php

示例3: __construct

 /**
  * Creates the backend object. 
  *
  * @return void
  */
 public function __construct()
 {
     $dBPrefix = \CApi::GetSettings()->GetConf('Common/DBPrefix');
     $this->pdo = \CApi::GetPDO();
     $this->table = $dBPrefix . Constants::T_REMINDERS;
     $this->calendarTbl = $dBPrefix . Constants::T_CALENDARS;
     $this->principalsTbl = $dBPrefix . Constants::T_PRINCIPALS;
 }
开发者ID:pkdevboxy,项目名称:webmail-lite,代码行数:13,代码来源:PDO.php

示例4: __construct

    /**
     * Constructor 
     */
    public function __construct() {

		$oPdo = \CApi::GetPDO();
		$dbPrefix = \CApi::GetSettings()->GetConf('Common/DBPrefix');
		
		parent::__construct($oPdo, $dbPrefix.Constants::T_LOCKS);

    }
开发者ID:pombredanne,项目名称:ArcherSys,代码行数:11,代码来源:PDO.php

示例5: __construct

 /**
  * Sets up the object
  */
 public function __construct()
 {
     parent::__construct(\CApi::GetPDO());
     $sDbPrefix = \CApi::GetSettings()->GetConf('Common/DBPrefix');
     $this->cardsTableName = $sDbPrefix . Constants::T_CARDS;
     $this->addressBooksTableName = $sDbPrefix . Constants::T_ADDRESSBOOKS;
     $this->addressBookChangesTableName = $sDbPrefix . Constants::T_ADDRESSBOOKCHANGES;
 }
开发者ID:afterlogic,项目名称:dav,代码行数:11,代码来源:PDO.php

示例6: __construct

	/**
     * Sets up the object
     */
    public function __construct() {

		$oPdo = \CApi::GetPDO();
		$sDbPrefix = \CApi::GetSettings()->GetConf('Common/DBPrefix');

		parent::__construct($oPdo, $sDbPrefix.Constants::T_ADDRESSBOOKS, $sDbPrefix.Constants::T_CARDS);

    }
开发者ID:pombredanne,项目名称:ArcherSys,代码行数:11,代码来源:PDO.php

示例7: __construct

 /**
  * Creates the backend
  */
 public function __construct()
 {
     $oPdo = \CApi::GetPDO();
     $sDbPrefix = \CApi::GetSettings()->GetConf('Common/DBPrefix');
     $this->dBPrefix = $sDbPrefix;
     parent::__construct($oPdo, $sDbPrefix . Constants::T_CALENDARS, $sDbPrefix . Constants::T_CALENDAROBJECTS);
     $this->calendarSharesTableName = $sDbPrefix . Constants::T_CALENDARSHARES;
     $this->principalsTableName = $sDbPrefix . Constants::T_PRINCIPALS;
     $this->notificationsTableName = $sDbPrefix . Constants::T_NOTIFICATIONS;
 }
开发者ID:hallnewman,项目名称:webmail-lite,代码行数:13,代码来源:PDO.php

示例8: __construct

 /**
  * Creates the backend
  */
 public function __construct()
 {
     parent::__construct(\CApi::GetPDO());
     $this->dBPrefix = \CApi::GetSettings()->GetConf('Common/DBPrefix');
     $this->calendarTableName = $this->dBPrefix . Constants::T_CALENDARS;
     $this->calendarChangesTableName = $this->dBPrefix . Constants::T_CALENDARCHANGES;
     $this->calendarObjectTableName = $this->dBPrefix . Constants::T_CALENDAROBJECTS;
     $this->calendarSharesTableName = $this->dBPrefix . Constants::T_CALENDARSHARES;
     $this->schedulingObjectTableName = $this->dBPrefix . Constants::T_SCHEDULINGOBJECTS;
     $this->calendarSubscriptionsTableName = $this->dBPrefix . Constants::T_CALENDARSUBSCRIPTIONS;
 }
开发者ID:afterlogic,项目名称:dav,代码行数:14,代码来源:PDO.php

示例9: __construct

 /**
  * @param CApiGlobalManager &$oManager
  */
 public function __construct(CApiGlobalManager &$oManager)
 {
     parent::__construct('carddav', $oManager);
     CApi::Inc('common.dav.client');
     $this->Dav = null;
     $this->Settings = CApi::GetSettings();
     $this->Pdo = CApi::GetPDO();
     $this->User = null;
     $this->Account = null;
     $this->Connected = false;
     $this->aAddressBooksCache = array();
     $this->aGroupItemsCache = array();
     $this->ContactsCache = array();
     $this->GroupsCache = array();
     $this->DbPrefix = $this->Settings->GetConf('Common/DBPrefix');
     $this->ApiUsersManager = CApi::Manager('users');
     $this->ApiDavManager = CApi::Manager('dav');
 }
开发者ID:pkdevboxy,项目名称:webmail-lite,代码行数:21,代码来源:storage.php

示例10: __construct

 /**
  * Constructor 
  */
 public function __construct()
 {
     parent::__construct(\CApi::GetPDO());
     $dbPrefix = \CApi::GetSettings()->GetConf('Common/DBPrefix');
     $this->tableName = $dbPrefix . Constants::T_LOCKS;
 }
开发者ID:afterlogic,项目名称:dav,代码行数:9,代码来源:PDO.php

示例11: __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);
     }
 }
开发者ID:hallnewman,项目名称:webmail-lite,代码行数:95,代码来源:Server.php

示例12: dirname

<?php

/*
 * Copyright 2004-2015, AfterLogic Corp.
 * Licensed under AGPLv3 license or AfterLogic license
 * if commercial version of the product was purchased.
 * See the LICENSE file for a full license statement.
 */
// remove the following line for real use
//exit('remove this line');
require_once dirname(__FILE__) . '/../libraries/afterlogic/api.php';
/* Get WebMail Settings */
$oSettings =& \CApi::GetSettings();
$sDbPrefix = $oSettings->GetConf('Common/DBPrefix');
/* Database */
$oPdo = \CApi::GetPDO();
$sCalendarSharesTableName = $sDbPrefix . \afterlogic\DAV\Constants::T_CALENDARSHARES;
$stmt1 = $oPdo->prepare("SELECT * FROM " . $sDbPrefix . "adav_delegates");
$stmt1->execute();
while ($aRow1 = $stmt1->fetch(\PDO::FETCH_ASSOC)) {
    $stmt2 = $oPdo->prepare("SELECT * FROM " . $sCalendarSharesTableName . " WHERE calendarid = ? and member = ?");
    $stmt2->execute(array($aRow1['calendarid'], $aRow1['principalid']));
    if (count($stmt2->fetchAll()) === 0) {
        $stmt3 = $oPdo->prepare("INSERT INTO " . $sCalendarSharesTableName . "(calendarid, member, readonly) VALUES (?, ?, ?)");
        $stmt3->execute(array($aRow1['calendarid'], $aRow1['principalid'], (int) $aRow1['mode'] === \ECalendarPermission::Read));
    }
}
开发者ID:BertLasker,项目名称:Catch-design,代码行数:27,代码来源:calendar-sharing.php

示例13: __construct

 public function __construct($baseUri = '/')
 {
     $this->debugExceptions = true;
     self::$exposeVersion = false;
     $this->setBaseUri($baseUri);
     date_default_timezone_set('GMT');
     if (\CApi::GetPDO()) {
         /* Authentication Plugin */
         $this->addPlugin(new \Afterlogic\DAV\Auth\Plugin(Backend::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);
         $aclPlugin->adminPrincipals = $mAdminPrincipal !== false ? array(Constants::PRINCIPALS_PREFIX . '/' . $mAdminPrincipal) : array();
         $this->addPlugin($aclPlugin);
         $bIsOwncloud = false;
         /* Directory tree */
         $aTree = array($bIsOwncloud ? new CardDAV\AddressBookRoot(Backend::Principal(), Backend::getBackend('carddav-owncloud')) : new CardDAV\AddressBookRoot(Backend::Principal(), Backend::Carddav()), new CalDAV\CalendarRoot(Backend::Principal(), Backend::Caldav()), new CardDAV\GAB\AddressBooks('gab', Constants::GLOBAL_CONTACTS));
         $this->oApiCapaManager = \CApi::GetSystemManager('capability');
         /* Files folder */
         if ($this->oApiCapaManager->isFilesSupported()) {
             array_push($aTree, new \Afterlogic\DAV\FS\FilesRoot());
             $this->addPlugin(new FS\Plugin());
             // Automatically guess (some) contenttypes, based on extesion
             $this->addPlugin(new \Sabre\DAV\Browser\GuessContentType());
         }
         $oPrincipalColl = new \Sabre\DAVACL\PrincipalCollection(Backend::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(Backend::Reminders()));
         $this->addPlugin(new \Sabre\CalDAV\Schedule\Plugin());
         $this->addPlugin(new \Sabre\CalDAV\Schedule\IMipPlugin('test@local.host'));
         /* 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());
         /* DAV Sync Plugin */
         $this->addPlugin(new \Sabre\DAV\Sync\Plugin());
         /* HTML Frontend Plugin */
         if (\CApi::GetConf('labs.dav.use-browser-plugin', false) !== false) {
             $this->addPlugin(new \Sabre\DAV\Browser\Plugin());
         }
         /* Locks Plugin */
         //			$this->addPlugin(new \Sabre\DAV\Locks\Plugin());
         $this->on('beforeGetProperties', array($this, 'beforeGetProperties'), 90);
     }
 }
开发者ID:afterlogic,项目名称:dav,代码行数:64,代码来源:Server.php


注:本文中的CApi::GetPDO方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。