Ejemplo n.º 1
0
function DAVLibrariesAutoload($className)
{
    if (0 === strpos($className, 'afterlogic') && false !== strpos($className, '\\')) {
        include CApi::LibrariesPath() . 'afterlogic/' . str_replace('\\', '/', substr($className, 11)) . '.php';
    } else {
        if (0 === strpos($className, 'Sabre') && false !== strpos($className, '\\')) {
            include CApi::LibrariesPath() . 'Sabre/' . str_replace('\\', '/', substr($className, 6)) . '.php';
        }
    }
}
Ejemplo n.º 2
0
<?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.
 */
class_exists('CApi') or die;
CApi::Inc('common.plugins.two-factor-auth');
include_once CApi::LibrariesPath() . 'PHPGangsta/GoogleAuthenticator.php';
class TwoFactorAuthenticationPlugin extends AApiTwoFactorAuthPlugin
{
    protected $logs = false;
    protected $discrepancy = 2;
    public static $setAccountIsLoggedIn = false;
    /**
     * @param string $sText
     */
    private function _writeLogs($sText)
    {
        if ($this->logs === true) {
            $this->Log($sText);
        }
    }
    /**
     * @param CApiPluginManager $oPluginManager
     */
    public function __construct(CApiPluginManager $oPluginManager)
    {
        parent::__construct('1.0', $oPluginManager);
Ejemplo n.º 3
0
<?php

include_once __DIR__ . '/libraries/afterlogic/api.php';
include_once CApi::LibrariesPath() . '/ProjectSeven/Notifications.php';
$sContents = file_get_contents('php://input');
$aInputData = array();
if (strlen($sContents) > 0) {
    parse_str($sContents, $aInputData);
} else {
    $aInputData = isset($_REQUEST) && is_array($_REQUEST) ? $_REQUEST : array();
}
//$sMethod = isset($aInputData['method']) ? $aInputData['method'] : '';
$sMethod = strlen($_SERVER['PATH_INFO']) > 0 ? $_SERVER['REQUEST_METHOD'] . ' ' . $_SERVER['PATH_INFO'] : '';
$sToken = isset($aInputData['token']) ? $aInputData['token'] : '';
$aSecret = CApi::DecodeKeyValues($sToken);
$bMethod = in_array($sMethod, array('GET /token', 'POST /account', 'PUT /account/update', 'DELETE /account', 'PUT /account/enable', 'PUT /account/disable', 'PUT /account/password', 'GET /account/list', 'GET /account/exists', 'GET /account', 'POST /domain', 'PUT /domain/update', 'DELETE /domain', 'GET /domain/list', 'GET /domain/exists', 'GET /domain'));
$aResult = array('method' => $sMethod);
if (!CApi::GetConf('labs.rest', true)) {
    $aResult['message'] = 'rest api disabled';
    $aResult['errorCode'] = \ProjectSeven\Notifications::RestApiDisabled;
    $aResult['result'] = false;
} else {
    if (class_exists('CApi') && CApi::IsValid() && $bMethod) {
        /* @var $oApiDomainsManager CApiDomainsManager */
        $oApiDomainsManager = CApi::Manager('domains');
        /* @var $oApiTenantsManager CApiTenantsManager */
        $oApiTenantsManager = CApi::Manager('tenants');
        /* @var $oApiUsersManager CApiUsersManager */
        $oApiUsersManager = CApi::Manager('users');
        /* @var $oApiIntegratorManager CApiIntegratorManager */
        $oApiIntegratorManager = CApi::Manager('integrator');