public static function connect()
 {
     global $api_client;
     if (isset($GLOBALS['api_user']) && $GLOBALS['api_user'] != "" && isset($GLOBALS['api_pass']) && $GLOBALS['api_pass'] != "") {
         require_once 'lib/vtwsclib/Vtiger/WSClient.php';
         $client = new Vtiger_WSClient($GLOBALS['vtiger_path']);
         $login = $client->doLogin($GLOBALS['api_user'], $GLOBALS['api_pass']);
         if (!$login) {
             $api_client = 'API_LOGIN_FAILED';
         } else {
             $api_client = $client;
             MYCWSApi::connect();
         }
     } else {
         $api_client = "NOT_CONFIGURED";
     }
     return $api_client;
 }
Example #2
0
/* * *******************************************************************************
 * The content of this file is subject to the MYC Vtiger Customer Portal license.
 * ("License"); You may not use this file except in compliance with the License
 * The Initial Developer of the Original Code is Proseguo s.l. - MakeYourCloud
 * Portions created by Proseguo s.l. - MakeYourCloud are Copyright(C) Proseguo s.l. - MakeYourCloud
 * All Rights Reserved.
 * ****************************************************************************** */
require_once "config.class.php";
session_start();
define('ROOT_PATH', realpath(__DIR__ . '/../'));
if (ConfigEditor::checkLogin()) {
    $config = ConfigEditor::read('config.php');
    if (isset($config) && is_array($config) && count($config) > 0) {
        PortalConfig::load();
        MYCWSApi::connect();
    }
    $apimodules = ConfigEditor::read('apimodules.php');
    $timezones = ConfigEditor::read('timezones.php');
    if (isset($_POST['updateconfig'])) {
        unset($_POST['updateconfig']);
        $newconfig = $_POST;
        if (!isset($_POST['hiddenmodules']) && !isset($config['hiddenmodules'])) {
            $newconfig['hiddenmodules'] = array();
        }
        if (!isset($_POST['enabled_api_modules']) && !isset($config['enabled_api_modules'])) {
            $newconfig['enabled_api_modules'] = array();
        }
        if ($_FILES['portal_logo']['name'] != "" || !isset($config['portal_logo']) || $config['portal_logo'] == "") {
            $ext = pathinfo($_FILES['portal_logo']['name'], PATHINFO_EXTENSION);
            $newfilename = Router::slugify(str_replace("." . $ext, "", $_FILES['portal_logo']['name'])) . "." . $ext;