public function __construct($user = null, $pass = null, $host = 'http://bsews1.ipt.intechnology.co.uk/webservice/services/ProvisioningService', $device_map = [])
 {
     $this->errorControl = CoreFactory::getErrorControl();
     $this->client = CoreFactory::getOCIClient($host, false);
     $this->client->setTimeout(5);
     if (!$this->client->login($user, $pass)) {
         throw new Exception("Unable to login");
     }
     if (empty($device_map)) {
         $this->device_map['Polycom Soundpoint IP 321'] = 'DMS-Polycom-321';
         $this->device_map['Polycom Soundpoint IP 331'] = 'DMS-Polycom-331';
         $this->device_map['Polycom Soundpoint IP 430'] = 'DMS-Polycom-430';
         $this->device_map['Polycom Soundpoint IP 450'] = 'DMS-Polycom-450';
         $this->device_map['Polycom Soundpoint IP 550'] = 'DMS-Polycom-550';
         $this->device_map['Polycom Soundpoint IP 650'] = 'DMS-Polycom-650';
         $this->device_map['Polycom Soundpoint IP 670'] = 'DMS-Polycom-670';
         $this->device_map['Polycom Soundpoint IP 5000'] = 'DMS-Polycom-5000';
         $this->device_map['Polycom Soundpoint IP 6000'] = 'DMS-Polycom-6000';
         $this->device_map['Polycom Soundpoint IP 7000'] = 'DMS-Polycom-7000';
         $this->device_map['Polycom SoundStation IP 5000'] = 'DMS-Polycom-5000';
         $this->device_map['Polycom SoundStation IP 5000'] = 'DMS-Polycom-5000';
     } else {
         $this->device_map = $device_map;
     }
 }
Exemple #2
0
 public function createImageSelector($sourcePath, $width, $height, $className, $caption, $crop = true)
 {
     if ($sourcePath) {
         $application = CoreFactory::getApplication();
         $imageName = $width . "x" . $height . "-" . basename($sourcePath);
         $imageHash = 4294967296.0 + crc32($sourcePath);
         $imageDirectory = $application->registry->get("Cache/Path") . "/" . $imageHash;
         $imagePath = $imageDirectory . "/" . $imageName;
         if (!is_file($imagePath)) {
             @mkdir($imageDirectory, false, true);
             $imageControl = CoreFactory::getImageControl();
             if ($width == null || $height == null) {
                 $crop = false;
             }
             if (substr($sourcePath, 0, 4) == "http") {
                 $tempName = tempnam("/tmp", $imageHash);
                 copy($sourcePath, $tempName);
                 $imageControl->resizeAndCrop($tempName, $imagePath, $width, $height, false, !$crop);
                 unlink($tempName);
             } else {
                 $sourcePath = $application->registry->get("Path") . "/" . $sourcePath;
                 $imageControl->resizeAndCrop($sourcePath, $imagePath, $width, $height, false, !$crop);
             }
         }
         $sourcePath = "/resource/cache/" . $imageHash . "/" . $imageName;
     }
     if ($caption == "") {
         return "<span class=\"{$className}\"><img src=\"{$sourcePath}\" width=\"{$width}\" " . "height=\"{$height}\" alt=\"Linked Image('{$sourcePath}')\" " . "title=\"Linked Image('{$sourcePath}')\" /></span>";
     } else {
         return "<span class=\"{$className}\"><img src=\"{$sourcePath}\" width=\"{$width}\" " . "height=\"{$height}\" alt=\"{$caption}\" title=\"{$caption}\" /><span>{$caption}</span></span>";
     }
 }
Exemple #3
0
 static function getSEFPath($non_sef)
 {
     if (self::$sef_path !== false) {
         return self::$sef_path;
     }
     $db = CoreFactory::getDB();
     $config = CoreConfig::getInstance();
     $urls_db_table = $config->get('urls_db_table');
     $query = "\n\t\t\t\tSELECT sef FROM `{$urls_db_table}` WHERE non_sef = '{$non_sef}'\n\t\t\t";
     self::$sef_path = $db->setQuery($query)->getResult();
     return self::$sef_path;
 }
Exemple #4
0
 static function build($non_sef, $alias, $is_add_base_url = 0)
 {
     $alias = Route::buildAlias($alias);
     //trim($path, '/\\')
     //		return '/'.$alias.'/';
     $non_sef = trim($non_sef, " \t./\\");
     $sef_url = trim($alias, " \t./\\") . '.html';
     $config = CoreConfig::getInstance();
     $is_use_sef_urls = $config->get('is_use_sef_urls');
     if (!$is_use_sef_urls) {
         if ($is_add_base_url) {
             return base_url() . $non_sef . '/';
         }
         return $non_sef . '/';
     }
     $db = CoreFactory::getDB();
     $urls_db_table = $config->get('urls_db_table');
     $query = "\n\t\t\tSELECT non_sef FROM `{$urls_db_table}` WHERE sef = '{$sef_url}'\n\t\t";
     $current_non_sef = $db->setQuery($query)->getResult();
     if ($current_non_sef && $current_non_sef == $non_sef) {
         if ($is_add_base_url) {
             return base_url() . $sef_url;
         }
         return $sef_url;
     }
     $query = "\n\t\t\tSELECT sef FROM `{$urls_db_table}` WHERE non_sef = '{$non_sef}'\n\t\t";
     $cur_sef_url = $db->setQuery($query)->getResult();
     if ($cur_sef_url) {
         $sef_url = $cur_sef_url;
     } else {
         $query = "\n\t\t\t\tINSERT INTO `{$urls_db_table}` SET sef = '{$sef_url}', non_sef = '{$non_sef}'\n\t\t\t";
         $db->setQuery($query)->execute();
     }
     if ($is_add_base_url) {
         return base_url() . $sef_url;
     }
     return $sef_url;
 }
Exemple #5
0
 /**
  * 根据全局或者模块配置实例化MemcachedResource对象
  *
  * @access public
  * @param null $persistent_id
  * @param array $config
  * @return \Memcached
  * @throws \MemcachedException
  */
 public static function memcached($persistent_id = NULL, $config = array())
 {
     if (self::$memcached && self::$memcached instanceof MemcachedResource) {
         return self::$memcached;
     } else {
         if (!empty($config)) {
         } else {
             if (Registry::get("config") && Registry::get("config")->memcached_config instanceof Simple && ($config = Registry::get("config")->memcached_config->toArray())) {
             } else {
                 if (isset(Application::app()->getConfig()->application->memcached)) {
                     $config = Application::app()->getConfig()->application->memcached->toArray();
                 }
             }
         }
         if ($persistent_id) {
             self::$memcached = new MemcachedResource((string) $persistent_id);
         } else {
             self::$memcached = new MemcachedResource();
         }
         $look_host = false;
         if (array_key_exists(0, $config)) {
             self::$memcached->addServers($config);
             $look_host = true;
         } else {
             if ($config['host']) {
                 self::$memcached->addServer($config['host'], isset($config['port']) ? (int) $config['port'] : 11211, isset($config['weight']) ? (int) $config['weight'] : 0);
                 $look_host = true;
             }
         }
         if ($look_host) {
             if (self::$memcached->getResultCode() == MemcachedResource::RES_HOST_LOOKUP_FAILURE) {
                 throw new MemcachedException("Add Server To Memcached Failed", MemcachedResource::RES_HOST_LOOKUP_FAILURE);
             }
         }
         return self::$memcached;
     }
 }
Exemple #6
0
 /**
  * Checks and sets the template file location passed
  *
  * @param string $filename to be set at the Template File
  * @return sets template or returns error if file not found.
  */
 public function setTemplateFile($filename)
 {
     $application =& CoreFactory::getApplication();
     if (file_exists($application->registry->get("Path") . $filename)) {
         $this->setTemplate(file_get_contents($application->registry->get("Path") . $filename));
     } else {
         if (file_exists($filename)) {
             $this->setTemplate(file_get_contents($filename));
         } else {
             trigger_error("Unable to open template file '" . realpath($filename) . "', file not found");
         }
     }
 }
Exemple #7
0
include_once CORE_FOLDER . 'factory.php';
include_once CORE_FOLDER . 'base.php';
include_once CORE_FOLDER . 'config.php';
include_once CORE_FOLDER . 'controller.php';
include_once CORE_FOLDER . 'url.php';
include_once CORE_FOLDER . 'db/mysqli.php';
include_once CORE_FOLDER . 'db/active_record.php';
include_once CORE_FOLDER . 'db/statement.php';
include_once CORE_FOLDER . 'views_loader.php';
include_once CORE_FOLDER . 'models_loader.php';
include_once CORE_FOLDER . 'model.php';
include_once CORE_FOLDER . 'input.php';
include_once CORE_FOLDER . 'route.php';
include_once CORE_FOLDER . 'session.php';
include_once CORE_FOLDER . 'files_upload.php';
$db = CoreFactory::getDB();
//$db->setQuery('SET NAMES "utf8"')->execute();
$config = CoreConfig::getInstance();
$controller = URL::segment(1);
if (!$controller) {
    if (!$config->get('default_controller')) {
        error('No default controller assigned');
        exit;
    }
    $controller = $config->get('default_controller');
}
$controller = strtolower($controller);
$controller_file = APPLICATION_FOLDER . 'controllers/' . $controller . '.php';
if (!file_exists($controller_file)) {
    error('Controller file does not exist', 404);
    exit;
Exemple #8
0
 function __construct()
 {
     $this->db = CoreFactory::getDB();
 }
<?php

require_once '../Broadworks_OCI-P/common.php';
Factory::getOCISchemaServiceProvider();
Factory::getOCISchemaGroup();
if (!isset($argv[1])) {
    die("Provide service provider id as second argument.");
}
$mongo = new MongoClient('mongodb://pillock.net:27017');
$collection = $mongo->selectDB($argv[1])->selectCollection('GroupGetRequest14sp7');
$client = CoreFactory::getOCIClient('http://bsews1.ipt.intechnology.co.uk/webservice/services/ProvisioningService');
$client->login('luke_script', 'waiodjjAWDOAWdlaiojhawiopjh4');
$client->send(OCISchemaGroup::GroupGetListInServiceProviderRequest($argv[1]));
if ($client->getResponse()) {
    foreach ($client->getResponse()->groupTable['row'] as $row) {
        $client->send(OCISchemaGroup::GroupGetRequest14sp7($argv[1], $row['col'][0]));
        $collection->insert([$row['col'][0] => $client->getResponse()]);
    }
}
Exemple #10
0
 function write()
 {
     //		$session_table = Sessions::getInstance();
     //		$session_table->where('id', $this->sess_info['id']);
     //		$session_table->user_data = addslashes(serialize($this->data));
     //		$session_table->update();
     $config = CoreConfig::getInstance();
     $db = CoreFactory::getDB();
     $query = "\n\t\t\tUPDATE `" . $config->get('sess_db_table') . "`\n\t\t\tSET\n\t\t\t\t`user_data` = '" . addslashes(serialize($this->data)) . "'\n\t\t\tWHERE `id` = '{$this->sess_info['id']}'\n\t\t";
     $db->setQuery($query)->execute();
 }