Esempio n. 1
47
 /**
  * Parser constructor
  * @param array $options An options array
  * @throws Exception if the required option uniqueNode isn't set
  */
 public function __construct(array $options = array())
 {
     $this->options = array_merge(array("extractContainer" => false), $options);
     if (!isset($this->options["uniqueNode"])) {
         throw new Exception("Required option 'uniqueNode' not set");
     }
 }
/**
 * Expand an IPv6 Address
 *
 * This will take an IPv6 address written in short form and expand it to include all zeros. 
 *
 * @param  string  $addr A valid IPv6 address
 * @return string  The expanded notation IPv6 address
 */
function inet6_expand($addr)
{
    /* Check if there are segments missing, insert if necessary */
    if (strpos($addr, '::') !== false) {
        $part = explode('::', $addr);
        $part[0] = explode(':', $part[0]);
        $part[1] = explode(':', $part[1]);
        $missing = array();
        for ($i = 0; $i < 8 - (count($part[0]) + count($part[1])); $i++) {
            array_push($missing, '0000');
        }
        $missing = array_merge($part[0], $missing);
        $part = array_merge($missing, $part[1]);
    } else {
        $part = explode(":", $addr);
    }
    // if .. else
    /* Pad each segment until it has 4 digits */
    foreach ($part as &$p) {
        while (strlen($p) < 4) {
            $p = '0' . $p;
        }
    }
    // foreach
    unset($p);
    /* Join segments */
    $result = implode(':', $part);
    /* Quick check to make sure the length is as expected */
    if (strlen($result) == 39) {
        return $result;
    } else {
        return false;
    }
    // if .. else
}
/**
 * 全局安全过滤函数
 * 支持SQL注入和跨站脚本攻击
 */
function global_filter()
{
    //APP,ACT 分别为控制器和控制器方法
    $params = array(APP, ACT);
    foreach ($params as $k => $v) {
        if (!preg_match("/^[a-zA-Z0-9_-]+\$/", $v)) {
            header_status_404();
        }
    }
    $arrStr = array('%0d%0a', "'", '<', '>', '$', 'script', 'document', 'eval', 'atestu', 'select', 'insert?into', 'delete?from');
    global_inject_input($_SERVER['HTTP_REFERER'], $arrStr, true);
    global_inject_input($_SERVER['HTTP_USER_AGENT'], $arrStr, true);
    global_inject_input($_SERVER['HTTP_ACCEPT_LANGUAGE'], $arrStr, true);
    global_inject_input($_GET, array_merge($arrStr, array('"')), true);
    //global_inject_input($_COOKIE, array_merge($arrStr, array('"', '&')), true);
    //cookie会有对url的记录(pGClX_last_url)。去掉对&的判断
    global_inject_input($_COOKIE, array_merge($arrStr, array('"')), true);
    global_inject_input($_SERVER, array('%0d%0a'), true);
    //处理跨域POST提交问题
    if ($_SERVER['REQUEST_METHOD'] == 'POST') {
        //处理客户端POST请求处理没有HTTP_REFERER参数问题
        if (isset($_SERVER['HTTP_REFERER'])) {
            $url = parse_url($_SERVER['HTTP_REFERER']);
            $referer_host = !empty($url['port']) && $url['port'] != '80' ? $url['host'] . ':' . $url['port'] : $url['host'];
            if ($referer_host != $_SERVER['HTTP_HOST']) {
                header_status_404();
            }
        }
    }
    global_inject_input($_POST, array('%0d%0a'));
    global_inject_input($_REQUEST, array('%0d%0a'));
}
 public function actionEdit($id)
 {
     $this->pageTitle = Yii::t('app', 'Редактирование категории');
     $model = ShopCategories::model()->findByPk($id);
     if (!$model) {
         throw new CHttpException(404, Yii::t('app', 'Категория не найдена'));
     }
     //var_dump($model->url);die;
     // var_dump($model->path);die;
     //var_dump($model->breadcrumbs);
     //die;
     $this->breadcrumbs = array_merge($this->breadcrumbs, array('Редактирование категории "' . $model->title . '"'));
     $possibleParents = $model->getPossibleParents();
     if (!empty($_POST) && array_key_exists('ShopCategories', $_POST)) {
         $this->performAjaxValidation($model);
         $model->attributes = $_POST['ShopCategories'];
         //var_dump($model->attributes);die;
         if ($model->validate()) {
             if ($model->save()) {
                 Yii::app()->user->setFlash('success', 'Категория "' . $model->title . '" успешно отредактирована');
                 Yii::app()->request->redirect($this->createUrl('index'));
             }
         }
     }
     //var_dump($possibleParents);die;
     $this->render('edit', array('model' => $model, 'possibleParents' => $possibleParents));
 }
Esempio n. 5
1
 /**
  * @param array $fields
  * @return array|null
  */
 public static function getEndpointFromFields(array $fields)
 {
     $arEndpointList = null;
     $fieldsTmp = array();
     foreach ($fields as $moduleId => $arConnectorSettings) {
         if (is_numeric($moduleId)) {
             $moduleId = '';
         }
         foreach ($arConnectorSettings as $connectorCode => $arConnectorFields) {
             foreach ($arConnectorFields as $k => $arFields) {
                 if (isset($fieldsTmp[$moduleId][$connectorCode][$k]) && is_array($arFields)) {
                     $fieldsTmp[$moduleId][$connectorCode][$k] = array_merge($fieldsTmp[$moduleId][$connectorCode][$k], $arFields);
                 } else {
                     $fieldsTmp[$moduleId][$connectorCode][$k] = $arFields;
                 }
             }
         }
     }
     foreach ($fieldsTmp as $moduleId => $arConnectorSettings) {
         if (is_numeric($moduleId)) {
             $moduleId = '';
         }
         foreach ($arConnectorSettings as $connectorCode => $arConnectorFields) {
             foreach ($arConnectorFields as $arFields) {
                 $arEndpoint = array();
                 $arEndpoint['MODULE_ID'] = $moduleId;
                 $arEndpoint['CODE'] = $connectorCode;
                 $arEndpoint['FIELDS'] = $arFields;
                 $arEndpointList[] = $arEndpoint;
             }
         }
     }
     return $arEndpointList;
 }
Esempio n. 6
0
 public function test(CqmPatient $patient, $beginDate, $endDate)
 {
     // See if user has been a tobacco user before or simultaneosly to the encounter within two years (24 months)
     $date_array = array();
     foreach ($this->getApplicableEncounters() as $encType) {
         $dates = Helper::fetchEncounterDates($encType, $patient, $beginDate, $endDate);
         $date_array = array_merge($date_array, $dates);
     }
     // sort array to get the most recent encounter first
     $date_array = array_unique($date_array);
     rsort($date_array);
     // go through each unique date from most recent
     foreach ($date_array as $date) {
         // encounters time stamp is always 00:00:00, so change it to 23:59:59 or 00:00:00 as applicable
         $date = date('Y-m-d 23:59:59', strtotime($date));
         $beginMinus24Months = strtotime('-24 month', strtotime($date));
         $beginMinus24Months = date('Y-m-d 00:00:00', $beginMinus24Months);
         // this is basically a check to see if the patient is an reported as an active smoker on their last encounter
         if (Helper::check(ClinicalType::CHARACTERISTIC, Characteristic::TOBACCO_USER, $patient, $beginMinus24Months, $date)) {
             return true;
         } else {
             if (Helper::check(ClinicalType::CHARACTERISTIC, Characteristic::TOBACCO_NON_USER, $patient, $beginMinus24Months, $date)) {
                 return false;
             } else {
                 // nothing reported during this date period, so move on to next encounter
             }
         }
     }
     return false;
 }
Esempio n. 7
0
 function index()
 {
     $path = \GCore\C::get('GCORE_ADMIN_PATH') . 'extensions' . DS . 'chronoforms' . DS;
     $files = \GCore\Libs\Folder::getFiles($path, true);
     $strings = array();
     //function to prepare strings
     $prepare = function ($str) {
         /*$path = \GCore\C::get('GCORE_FRONT_PATH');
         		if(strpos($str, $path) !== false AND strpos($str, $path) == 0){
         			return '//'.str_replace($path, '', $str);
         		}*/
         $val = !empty(\GCore\Libs\Lang::$translations[$str]) ? \GCore\Libs\Lang::$translations[$str] : '';
         return 'const ' . trim($str) . ' = "' . str_replace("\n", '\\n', $val) . '";';
     };
     foreach ($files as $file) {
         if (substr($file, -4, 4) == '.php') {
             // AND strpos($file, DS.'extensions'.DS) === TRUE){
             //$strings[] = $file;
             $file_code = file_get_contents($file);
             preg_match_all('/l_\\(("|\')([^(\\))]*?)("|\')\\)/i', $file_code, $langs);
             if (!empty($langs[2])) {
                 $strings = array_merge($strings, $langs[2]);
             }
         }
     }
     $strings = array_unique($strings);
     $strings = array_map($prepare, $strings);
     echo '<textarea rows="20" cols="80">' . implode("\n", $strings) . '</textarea>';
 }
 protected function doDisplay(array $context, array $blocks = array())
 {
     $__internal_cc682477bd8e340c33088229acad33c66b22be441c015fadc635700f3e089b13 = $this->env->getExtension("native_profiler");
     $__internal_cc682477bd8e340c33088229acad33c66b22be441c015fadc635700f3e089b13->enter($__internal_cc682477bd8e340c33088229acad33c66b22be441c015fadc635700f3e089b13_prof = new Twig_Profiler_Profile($this->getTemplateName(), "template", "TwigBundle:Exception:exception_full.html.twig"));
     $this->parent->display($context, array_merge($this->blocks, $blocks));
     $__internal_cc682477bd8e340c33088229acad33c66b22be441c015fadc635700f3e089b13->leave($__internal_cc682477bd8e340c33088229acad33c66b22be441c015fadc635700f3e089b13_prof);
 }
 protected function _init()
 {
     $app = App::i();
     $config = array_merge(['timeout' => '24 hours', 'salt' => 'LT_SECURITY_SALT_SECURITY_SALT_SECURITY_SALT_SECURITY_SALT_SECU', 'login_url' => 'https://www.google.com/accounts/o8/id', 'path' => preg_replace('#^https?\\:\\/\\/[^\\/]*(/.*)#', '$1', $app->createUrl('auth'))], $this->_config);
     $opauth_config = ['Strategy' => ['OpenID' => ['identifier_form' => THEMES_PATH . 'active/views/auth-form.php', 'url' => $config['login_url']]], 'security_salt' => $config['salt'], 'security_timeout' => $config['timeout'], 'path' => $config['path'], 'callback_url' => $app->createUrl('auth', 'response')];
     $opauth = new \Opauth($opauth_config, false);
     $this->opauth = $opauth;
     if ($config['logout_url']) {
         $app->hook('auth.logout:after', function () use($app, $config) {
             $app->redirect($config['logout_url'] . '?next=' . $app->baseUrl);
         });
     }
     // add actions to auth controller
     $app->hook('GET(auth.index)', function () use($app) {
         $app->redirect($this->createUrl('openid'));
     });
     $app->hook('<<GET|POST>>(auth.openid)', function () use($opauth, $config) {
         $_POST['openid_url'] = $config['login_url'];
         $opauth->run();
     });
     $app->hook('GET(auth.response)', function () use($app) {
         $app->auth->processResponse();
         if ($app->auth->isUserAuthenticated()) {
             $app->redirect($app->auth->getRedirectPath());
         } else {
             if ($app->config['app.mode'] === 'production') {
                 $app->redirect($this->createUrl('error'));
             } else {
                 echo '<pre>';
                 var_dump($this->data, $_POST, $_GET, $_REQUEST, $_SESSION);
                 die;
             }
         }
     });
 }
Esempio n. 10
0
 function art_load_config()
 {
     static $moduleConfig;
     if (isset($moduleConfig[$GLOBALS["artdirname"]])) {
         return $moduleConfig[$GLOBALS["artdirname"]];
     }
     //load_functions("config");
     //$moduleConfig[$GLOBALS["artdirname"]] = mod_loadConfig($GLOBALS["artdirname"]);
     if (isset($GLOBALS["xoopsModule"]) && is_object($GLOBALS["xoopsModule"]) && $GLOBALS["xoopsModule"]->getVar("dirname", "n") == $GLOBALS["artdirname"]) {
         if (!empty($GLOBALS["xoopsModuleConfig"])) {
             $moduleConfig[$GLOBALS["artdirname"]] =& $GLOBALS["xoopsModuleConfig"];
         } else {
             return null;
         }
     } else {
         $module_handler =& xoops_gethandler('module');
         $module = $module_handler->getByDirname($GLOBALS["artdirname"]);
         $config_handler =& xoops_gethandler('config');
         $criteria = new CriteriaCompo(new Criteria('conf_modid', $module->getVar('mid')));
         $configs =& $config_handler->getConfigs($criteria);
         foreach (array_keys($configs) as $i) {
             $moduleConfig[$GLOBALS["artdirname"]][$configs[$i]->getVar('conf_name')] = $configs[$i]->getConfValueForOutput();
         }
         unset($configs);
     }
     if ($customConfig = @(include XOOPS_ROOT_PATH . "/modules/" . $GLOBALS["artdirname"] . "/include/plugin.php")) {
         $moduleConfig[$GLOBALS["artdirname"]] = array_merge($moduleConfig[$GLOBALS["artdirname"]], $customConfig);
     }
     return $moduleConfig[$GLOBALS["artdirname"]];
 }
 protected function doDisplay(array $context, array $blocks = array())
 {
     $__internal_2244c2cd5141591972784638e830194acb5ce99972608bffd8f180da59b80d32 = $this->env->getExtension("native_profiler");
     $__internal_2244c2cd5141591972784638e830194acb5ce99972608bffd8f180da59b80d32->enter($__internal_2244c2cd5141591972784638e830194acb5ce99972608bffd8f180da59b80d32_prof = new Twig_Profiler_Profile($this->getTemplateName(), "template", "FOSUserBundle:Security:login.html.twig"));
     $this->parent->display($context, array_merge($this->blocks, $blocks));
     $__internal_2244c2cd5141591972784638e830194acb5ce99972608bffd8f180da59b80d32->leave($__internal_2244c2cd5141591972784638e830194acb5ce99972608bffd8f180da59b80d32_prof);
 }
 /**
  * Get crosssell items
  *
  * @return array
  */
 public function getItems()
 {
     $items = $this->getData('items');
     if (is_null($items)) {
         $items = array();
         $ninProductIds = $this->_getCartProductIds();
         if ($ninProductIds) {
             $lastAdded = (int) $this->_getLastAddedProductId();
             if ($lastAdded) {
                 $collection = $this->_getCollection()->addProductFilter($lastAdded);
                 if (!empty($ninProductIds)) {
                     $collection->addExcludeProductFilter($ninProductIds);
                 }
                 $collection->setPositionOrder()->load();
                 foreach ($collection as $item) {
                     $ninProductIds[] = $item->getId();
                     $items[] = $item;
                 }
             }
             if (count($items) < $this->_maxItemCount) {
                 $filterProductIds = array_merge($this->_getCartProductIds(), $this->_getCartProductIdsRel());
                 $collection = $this->_getCollection()->addProductFilter($filterProductIds)->addExcludeProductFilter($ninProductIds)->setPageSize($this->_maxItemCount - count($items))->setGroupBy()->setPositionOrder()->load();
                 foreach ($collection as $item) {
                     $items[] = $item;
                 }
             }
         }
         $this->setData('items', $items);
     }
     return $items;
 }
Esempio n. 13
0
 public function __construct(Session $session, $conf = array())
 {
     $this->session = $session;
     $this->config = array('width' => 100, 'height' => 20, 'bg_red' => 238, 'bg_green' => 255, 'bg_blue' => 255, 'bg_transparent' => true, 'bg_img' => false, 'bg_border' => false, 'char_red' => 0, 'char_green' => 0, 'char_blue' => 0, 'char_random_color' => true, 'char_random_color_lvl' => 2, 'char_transparent' => 10, 'char_px_spacing' => 20, 'char_min_size' => 14, 'char_max_size' => 14, 'char_max_rot_angle' => 30, 'char_vertical_offset' => true, 'char_fonts' => array('luggerbu.ttf'), 'char_fonts_dir' => __DIR__ . '/Resources/fonts', 'chars_used' => 'ABCDEFGHKLMNPRTWXYZ234569', 'easy_captcha' => false, 'easy_captcha_vowels' => 'AEIOUY', 'easy_captcha_consonants' => 'BCDFGHKLMNPRTVWXZ', 'easy_captcha_bool' => rand(0, 1), 'case_sensitive' => false, 'min_chars' => 3, 'max_chars' => 4, 'brush_size' => 1, 'format' => 'png', 'hash_algo' => 'sha1', 'flood_timer' => 0, 'max_refresh' => 1000, 'effect_blur' => false, 'effect_greyscale' => false, 'noise_min_px' => 0, 'noise_max_px' => 0, 'noise_min_lines' => 0, 'noise_max_lines' => 0, 'noise_min_circles' => 0, 'noise_max_circles' => 0, 'noise_color' => 3, 'noise_on_top' => false, 'error_images_dir' => __DIR__ . '/Resources/error', 'test_queries_flood' => false);
     if (count($conf)) {
         $this->config = array_merge($this->config, $conf);
     }
     if (true === $this->config['test_queries_flood']) {
         if ($this->testQueries() && $this->testLastRequest()) {
             $this->config['constructor_test'] = true;
         } else {
             $this->config['constructor_test'] = false;
             if (!$this->testQueries()) {
                 $this->config['constructor_error_reason'] = 'Error - too many queries';
                 $this->config['constructor_error_message'] = 'too_many';
             } elseif (!$this->testLastRequest()) {
                 $this->config['constructor_error_reason'] = 'Error - refreshing too fast';
                 $this->config['constructor_error_message'] = 'refresh';
             } else {
                 $this->config['constructor_error_reason'] = 'Error - unknown reason';
                 $this->config['constructor_error_message'] = 'unknown';
             }
             return false;
         }
     } else {
         $this->config['constructor_test'] = true;
     }
 }
 public function getJSClassParams()
 {
     if (!isset($this->_JSClassParams)) {
         $this->_JSClassParams = array_merge(parent::getJSClassParams(), array('connectedContainerSelector' => '.' . $this->connectedContainerClass));
     }
     return $this->_JSClassParams;
 }
Esempio n. 15
0
 /**
  * Initialize the provider
  *
  * @return void
  */
 public function initialize()
 {
     $this->options = array_merge($this->defaultConfig, $this->options);
     date_default_timezone_set($this->options['log.timezone']);
     // Finally, create a formatter
     $formatter = new LineFormatter($this->options['log.outputformat'], $this->options['log.dateformat'], false);
     // Create a new directory
     $logPath = realpath($this->app->config('bono.base.path')) . '/' . $this->options['log.path'];
     if (!is_dir($logPath)) {
         mkdir($logPath, 0755);
     }
     // Create a handler
     $stream = new StreamHandler($logPath . '/' . date($this->options['log.fileformat']) . '.log');
     // Set our formatter
     $stream->setFormatter($formatter);
     // Create LogWriter
     $logger = new LogWriter(array('name' => $this->options['log.name'], 'handlers' => array($stream), 'processors' => array(new WebProcessor())));
     // Bind our logger to Bono Container
     $this->app->container->singleton('log', function ($c) {
         $log = new Log($c['logWriter']);
         $log->setEnabled($c['settings']['log.enabled']);
         $log->setLevel($c['settings']['log.level']);
         $env = $c['environment'];
         $env['slim.log'] = $log;
         return $log;
     });
     // Set the writer
     $this->app->config('log.writer', $logger);
 }
Esempio n. 16
0
 public function getFormattedMapping($data, $sep = '')
 {
     $return = array();
     if ($sep != '') {
         $sep .= '/';
     }
     if (!is_array($data)) {
         return $data;
     }
     foreach ($data as $key => $value) {
         if (!is_array($value)) {
             $return[$sep . $key] = $value;
         } elseif (count($value) == 0) {
             $return[$sep . $key . '/...'] = array();
         } elseif (isset($value[0])) {
             if (is_string($value[0])) {
                 $return[$sep . $key] = $value[0];
             } else {
                 $return = array_merge($return, $this->getFormattedMapping($value[0], $sep . $key . '/...'));
             }
         } else {
             $return = array_merge($return, $this->getFormattedMapping($value, $sep . $key));
         }
     }
     return $return;
 }
 /**
  *
  * @param array $params
  * @param string $posts
  */
 public function processRequest(array $params = null, $posts = null)
 {
     if (is_array($posts)) {
         $params = array_merge($params, $posts);
     }
     return $this->fetchContent($params);
 }
 protected function doClean($values)
 {
     $username = isset($values[$this->getOption('username_field')]) ? $values[$this->getOption('username_field')] : '';
     $password = isset($values[$this->getOption('password_field')]) ? $values[$this->getOption('password_field')] : '';
     $allowEmail = sfConfig::get('app_sf_guard_plugin_allow_login_with_email', true);
     $method = $allowEmail ? 'retrieveByUsernameOrEmailAddress' : 'retrieveByUsername';
     // don't allow to sign in with an empty username
     if ($username) {
         if ($callable = sfConfig::get('app_sf_guard_plugin_retrieve_by_username_callable')) {
             $user = call_user_func_array($callable, array($username));
         } else {
             $user = $this->getTable()->retrieveByUsername($username);
         }
         // user exists?
         if ($user) {
             // password is ok?
             if ($user->getIsActive() && $user->checkPassword($password)) {
                 return array_merge($values, array('user' => $user));
             }
         }
     }
     if ($this->getOption('throw_global_error')) {
         throw new sfValidatorError($this, 'invalid');
     }
     throw new sfValidatorErrorSchema($this, array($this->getOption('username_field') => new sfValidatorError($this, 'invalid')));
 }
 public function block_toolbar($context, array $blocks = array())
 {
     // line 4
     echo "    ";
     ob_start();
     // line 5
     echo "        <span>\n            <img width=\"13\" height=\"28\" alt=\"Memory Usage\" src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA0AAAAcBAMAAABITyhxAAAAJ1BMVEXNzc3///////////////////////8/Pz////////////+NjY0/Pz9lMO+OAAAADHRSTlMAABAgMDhAWXCvv9e8JUuyAAAAQ0lEQVQI12MQBAMBBmLpMwoMDAw6BxjOOABpHyCdAKRzsNDp5eXl1KBh5oHBAYY9YHoDQ+cqIFjZwGCaBgSpBrjcCwCZgkUHKKvX+wAAAABJRU5ErkJggg==\" />\n            <span>";
     // line 7
     echo twig_escape_filter($this->env, sprintf("%.1f", $this->getAttribute(isset($context["collector"]) ? $context["collector"] : $this->getContext($context, "collector"), "memory") / 1024 / 1024), "html", null, true);
     echo " MB</span>\n        </span>\n    ";
     $context["icon"] = '' === ($tmp = ob_get_clean()) ? '' : new Twig_Markup($tmp, $this->env->getCharset());
     // line 10
     echo "    ";
     ob_start();
     // line 11
     echo "        <div class=\"sf-toolbar-info-piece\">\n            <b>Memory usage</b>\n            <span>";
     // line 13
     echo twig_escape_filter($this->env, sprintf("%.1f", $this->getAttribute(isset($context["collector"]) ? $context["collector"] : $this->getContext($context, "collector"), "memory") / 1024 / 1024), "html", null, true);
     echo " / ";
     echo $this->getAttribute(isset($context["collector"]) ? $context["collector"] : $this->getContext($context, "collector"), "memoryLimit") == -1 ? "&infin;" : twig_escape_filter($this->env, sprintf("%.1f", $this->getAttribute(isset($context["collector"]) ? $context["collector"] : $this->getContext($context, "collector"), "memoryLimit") / 1024 / 1024));
     echo " MB</span>\n        </div>\n    ";
     $context["text"] = '' === ($tmp = ob_get_clean()) ? '' : new Twig_Markup($tmp, $this->env->getCharset());
     // line 16
     echo "    ";
     $this->env->loadTemplate("@WebProfiler/Profiler/toolbar_item.html.twig")->display(array_merge($context, array("link" => false)));
 }
 protected function doDisplay(array $context, array $blocks = array())
 {
     $__internal_6011e44fda209c22bd3a3f9e0022a24cfc2874076efa8f001603f24a1733d3fe = $this->env->getExtension("native_profiler");
     $__internal_6011e44fda209c22bd3a3f9e0022a24cfc2874076efa8f001603f24a1733d3fe->enter($__internal_6011e44fda209c22bd3a3f9e0022a24cfc2874076efa8f001603f24a1733d3fe_prof = new Twig_Profiler_Profile($this->getTemplateName(), "template", "FSPBundle:Theme:cours.html.twig"));
     $this->parent->display($context, array_merge($this->blocks, $blocks));
     $__internal_6011e44fda209c22bd3a3f9e0022a24cfc2874076efa8f001603f24a1733d3fe->leave($__internal_6011e44fda209c22bd3a3f9e0022a24cfc2874076efa8f001603f24a1733d3fe_prof);
 }
Esempio n. 21
-1
 /**
  * @depends testCreateMessage
  */
 function testUpdateMessage($stack)
 {
     try {
         $message = array('title' => $this->getRandom(100), 'message' => $this->getRandom(256), 'deviceType' => 'ios', 'deviceToken' => $this->hexadecimal(64), 'userId' => $this->getRandom(16), 'group' => $this->getRandom(64), 'lang' => 'en', 'deliveryDateTime' => date(DATE_RFC1123, strtotime('15 min')), 'deliveryExpiration' => '1 day', 'badgeIncrement' => false, 'contentAvailable' => false);
         /** @var Model $model */
         $model = $this->getClient()->updateMessage(array_merge(array('pushId' => $stack['PushId']), $message));
         $this->assertNotEmpty($model['result']['updatedDate']);
         usleep(10000);
         $model = $this->getClient()->getMessage(array('pushId' => $stack['PushId']));
         $updated = $model['result'];
         foreach (array('title', 'message', 'deviceType', 'deviceToken', 'userId', 'group', 'lang', 'deliveryExpiration') as $name) {
             $this->assertArrayHasKey($name, $updated);
             $this->assertEquals($message[$name], $updated[$name], sprintf('assertEquals %s', $name));
         }
         $this->assertArrayHasKey('deliveryDateTime', $updated);
         $this->assertEquals($updated['deliveryDateTime'], date('Y-m-d H:i:00', strtotime('15 min')));
         $this->assertArrayHasKey('badgeIncrement', $updated);
         $this->assertEquals(false, $updated['badgeIncrement']);
         $this->assertArrayHasKey('contentAvailable', $updated);
         $this->assertEquals(false, $updated['contentAvailable']);
     } catch (\Guzzle\Http\Exception\BadResponseException $e) {
         $response = $e->getResponse()->json();
         $this->fail(sprintf('Unexpected exception: %s', $response['error_message']));
     } catch (\Exception $e) {
         throw $e;
     }
     return $stack;
 }
Esempio n. 22
-1
 protected function doFilter($filters, $options)
 {
     $userService = $this->getUserService();
     /** @var Paginator $userPaginator */
     $userPaginator = $userService->search(array_merge($filters, array('options' => $options)));
     return $userPaginator;
 }
 function showControlFrame()
 {
     global $g_oSec;
     if (!$g_oSec->HasPerm(DCL_ENTITY_PERSONNEL, DCL_PERM_VIEW)) {
         return PrintPermissionDenied();
     }
     if (isset($_REQUEST['multiple']) && $_REQUEST['multiple'] == 'true') {
         $this->oSmarty->assign('VAL_MULTIPLE', 'true');
     } else {
         $this->oSmarty->assign('VAL_MULTIPLE', 'false');
     }
     $this->oSmarty->assign('VAL_LETTERS', array_merge(array('All'), range('A', 'Z')));
     $filterActive = '';
     if (isset($_REQUEST['filterActive'])) {
         $filterActive = $_REQUEST['filterActive'];
     }
     $filterStartsWith = '';
     if (isset($_REQUEST['filterStartsWith'])) {
         $filterStartsWith = $_REQUEST['filterStartsWith'];
     }
     $filterID = '';
     if (isset($_REQUEST['filterID'])) {
         $filterID = $_REQUEST['filterID'];
     }
     $this->oSmarty->assign('VAL_FILTERACTIVE', $filterActive);
     $this->oSmarty->assign('VAL_FILTERSTART', $filterStartsWith);
     $this->oSmarty->assign('VAL_FILTERID', $filterID);
     SmartyDisplay($this->oSmarty, 'htmlPersonnelSelectorControl.tpl');
     exit;
 }
Esempio n. 24
-1
 function get_form($step, $data = array(), $files = array(), $opts = array())
 {
     $opts['prefix'] = $this->prefix_for_step($step);
     $opts = array_merge($opts, $this->get_form_opts($step));
     $f = new $this->steps[$step]($data, $files, $opts);
     return $f;
 }
Esempio n. 25
-1
 /**
  * Factory method to return a preconfigured Zend_Service_StrikeIron_*
  * instance.
  *
  * @param  null|string  $options  Service options
  * @return object       Zend_Service_StrikeIron_* instance
  * @throws Zend_Service_StrikeIron_Exception
  */
 public function getService($options = array())
 {
     $class = isset($options['class']) ? $options['class'] : 'Base';
     unset($options['class']);
     if (strpos($class, '_') === false) {
         $class = "Zend_Service_StrikeIron_{$class}";
     }
     try {
         if (!class_exists($class)) {
             // require_once 'Zend/Loader.php';
             @Zend_Loader::loadClass($class);
         }
         if (!class_exists($class, false)) {
             throw new Exception('Class file not found');
         }
     } catch (Exception $e) {
         $msg = "Service '{$class}' could not be loaded: " . $e->getMessage();
         /**
          * @see Zend_Service_StrikeIron_Exception
          */
         // require_once 'Zend/Service/StrikeIron/Exception.php';
         throw new Zend_Service_StrikeIron_Exception($msg, $e->getCode(), $e);
     }
     // instantiate and return the service
     $service = new $class(array_merge($this->_options, $options));
     return $service;
 }
/**
 * Removes the *author* column and adds the *duration* column do the *profiling* post type. This function is called by
 * the manage_*profiling*_posts_columns hook.
 *
 * @since 3.0.0
 *
 * @param array $columns An array of existing columns.
 *
 * @return array The new array of columns.
 */
function wl_profiling_posts_columns($columns)
{
    unset($columns['author']);
    unset($columns['comments']);
    unset($columns['date']);
    return array_merge($columns, array('duration' => __('Duration', 'wordlift '), 'comments' => __('Comments', 'wordlift '), 'date' => __('Date', 'wordlift ')));
}
 protected function doDisplay(array $context, array $blocks = array())
 {
     $__internal_910fcb47b7564d7538d9f8c75ea80513178bfd9e5b3c72d6bcb90ecb90d61158 = $this->env->getExtension("native_profiler");
     $__internal_910fcb47b7564d7538d9f8c75ea80513178bfd9e5b3c72d6bcb90ecb90d61158->enter($__internal_910fcb47b7564d7538d9f8c75ea80513178bfd9e5b3c72d6bcb90ecb90d61158_prof = new Twig_Profiler_Profile($this->getTemplateName(), "template", "FSPBundle:Theme:cours.html.twig"));
     $this->parent->display($context, array_merge($this->blocks, $blocks));
     $__internal_910fcb47b7564d7538d9f8c75ea80513178bfd9e5b3c72d6bcb90ecb90d61158->leave($__internal_910fcb47b7564d7538d9f8c75ea80513178bfd9e5b3c72d6bcb90ecb90d61158_prof);
 }
Esempio n. 28
-6
 function procesar()
 {
     toba::logger_ws()->debug('Servicio Llamado: ' . $this->info['basica']['item']);
     toba::logger_ws()->set_checkpoint();
     set_error_handler('toba_logger_ws::manejador_errores_recuperables', E_ALL);
     $this->validar_componente();
     //-- Pide los datos para construir el componente, WSF no soporta entregar objetos creados
     $clave = array();
     $clave['proyecto'] = $this->info['objetos'][0]['objeto_proyecto'];
     $clave['componente'] = $this->info['objetos'][0]['objeto'];
     list($tipo, $clase, $datos) = toba_constructor::get_runtime_clase_y_datos($clave, $this->info['objetos'][0]['clase'], false);
     agregar_dir_include_path(toba_dir() . '/php/3ros/wsf');
     $opciones_extension = toba_servicio_web::_get_opciones($this->info['basica']['item'], $clase);
     $wsdl = strpos($_SERVER['REQUEST_URI'], "?wsdl") !== false;
     $sufijo = 'op__';
     $metodos = array();
     $reflexion = new ReflectionClass($clase);
     foreach ($reflexion->getMethods() as $metodo) {
         if (strpos($metodo->name, $sufijo) === 0) {
             $servicio = substr($metodo->name, strlen($sufijo));
             $prefijo = $wsdl ? '' : '_';
             $metodos[$servicio] = $prefijo . $metodo->name;
         }
     }
     $opciones = array();
     $opciones['serviceName'] = $this->info['basica']['item'];
     $opciones['classes'][$clase]['operations'] = $metodos;
     $opciones = array_merge($opciones, $opciones_extension);
     $this->log->debug("Opciones del servidor: " . var_export($opciones, true), 'toba');
     $opciones['classes'][$clase]['args'] = array($datos);
     toba::logger_ws()->set_checkpoint();
     $service = new WSService($opciones);
     $service->reply();
     $this->log->debug("Fin de servicio web", 'toba');
 }
Esempio n. 29
-15
 function onls()
 {
     $logdir = UC_ROOT . 'data/logs/';
     $dir = opendir($logdir);
     $logs = $loglist = array();
     while ($entry = readdir($dir)) {
         if (is_file($logdir . $entry) && strpos($entry, '.php') !== FALSE) {
             $logs = array_merge($logs, file($logdir . $entry));
         }
     }
     closedir($dir);
     $logs = array_reverse($logs);
     foreach ($logs as $k => $v) {
         if (count($v = explode("\t", $v)) > 1) {
             $v[3] = $this->date($v[3]);
             $v[4] = $this->lang[$v[4]];
             $loglist[$k] = $v;
         }
     }
     $page = max(1, intval($_GET['page']));
     $start = ($page - 1) * UC_PPP;
     $num = count($loglist);
     $multipage = $this->page($num, UC_PPP, $page, 'admin.php?m=log&a=ls');
     $loglist = array_slice($loglist, $start, UC_PPP);
     $this->view->assign('loglist', $loglist);
     $this->view->assign('multipage', $multipage);
     $this->view->display('admin_log');
 }
Esempio n. 30
-45
 /**
  * Set all parameters which are needed for the memcache client
  * see defaults for available parameters
  *
  * @param array $params
  * @return void
  */
 public function __construct($params = array())
 {
     $defaults = array('host' => 'localhost', 'port' => 11211, 'prefix' => null);
     $this->options = array_merge($defaults, (array) $params);
     $this->connection = new \Memcached();
     $this->connection->addServer($this->options['host'], $this->options['port']);
 }