Esempio n. 1
0
 function show()
 {
     $id = preg_replace('~[^a-z0-9_-]+~ims', '', $_GET['id']);
     if (strlen($id)) {
         if (substr($id, 0, strlen('table2_')) === 'table2_') {
             return _class($id, YF_PATH . '.dev/samples/table2/')->show();
         } else {
             return _class('docs')->_show_for($this);
         }
     }
     $ext = '.class.php';
     $ext_len = strlen($ext);
     $globs = ['yf_dev' => YF_PATH . '.dev/samples/table2/*' . $ext];
     $names = [];
     foreach ($globs as $glob) {
         foreach (glob($glob) as $cls) {
             $cls = basename($cls);
             if ($cls == __CLASS__ || false === strpos($cls, __FUNCTION__)) {
                 #					continue;
             }
             $name = substr($cls, 0, -$ext_len);
             $names[$name] = $name;
         }
     }
     $links = [];
     foreach ($names as $name) {
         $data[$name] = ['name' => $name, 'link' => url('/@object/@action/' . $name)];
     }
     return html()->li($data);
 }
Esempio n. 2
0
 function _site_map_items($sm_obj)
 {
     if (!is_object($sm_obj)) {
         return false;
     }
     $shop_cats = _class('cats')->_get_items_array('shop_cats');
     foreach ((array) $shop_cats as $cid => $c) {
         if (!$c['parent_id']) {
             $top_level[$cid] = $cid;
         }
     }
     foreach ((array) $top_level as $cid) {
         $c =& $shop_cats[$cid];
         if (!$c['active']) {
             unset($shop_cats[$cid]);
             continue;
         }
         $sm_obj->_store_item(['url' => url('/shop/products/' . $cid)]);
     }
     $q = db()->query('SELECT id FROM ' . db('shop_products') . ' WHERE active="1" AND image="1"');
     while ($a = db()->fetch_assoc($q)) {
         $sm_obj->_store_item(['url' => url('/shop/product/' . $a['id'])]);
     }
     return true;
 }
Esempio n. 3
0
 function product_details()
 {
     if (!$_GET["id"]) {
         return is_redirect("./?object=shop");
     }
     // Get products from database
     if (is_numeric($_GET["id"])) {
         $add_sql = "id= '" . intval($_GET["id"]);
     } else {
         $add_sql = "url='" . _es($_GET['id']);
     }
     $sql = "SELECT * FROM " . db('shop_products') . " WHERE active='1' AND " . $add_sql . "'";
     $product_info = db()->query_fetch($sql);
     // Required for comments
     module("shop")->_comments_params["object_id"] = $product_info["id"];
     module("shop")->_comments_params["objects_ids"] = $product_info["id"];
     $N = module("shop")->_get_num_comments();
     $N = $N[$product_info["id"]];
     if ($N == "") {
         $N = 0;
     }
     $dirs = sprintf("%06s", $product_info["id"]);
     $dir2 = substr($dirs, -3, 3);
     $dir1 = substr($dirs, -6, 3);
     $mpath = $dir1 . "/" . $dir2 . "/";
     $group_prices = module("shop")->_get_group_prices($product_info["id"]);
     $product_info["_group_price"] = $group_prices[module("shop")->USER_GROUP];
     module("shop")->_product_info = $product_info;
     $atts = module("shop")->_products_get_attributes($product_info["id"]);
     $thumb_path = $product_info["url"] . "_" . $product_info["id"] . "_" . $product_info["image"] . module("shop")->THUMB_SUFFIX . ".jpg";
     $img_path = $product_info["url"] . "_" . $product_info["id"] . "_" . $product_info["image"] . module("shop")->FULL_IMG_SUFFIX . ".jpg";
     if ($product_info["image"] == 0) {
         $image = "";
     } else {
         $image_files = _class('dir')->scan_dir(module("shop")->products_img_dir . $mpath, true, "/" . $product_info["url"] . "_" . $product_info["id"] . ".+?_small\\.jpg" . "/");
         $reg = "/" . $product_info["url"] . "_" . $product_info["id"] . "_(?P<content>[\\d]+)_small\\.jpg/";
         foreach ((array) $image_files as $filepath) {
             preg_match($reg, $filepath, $rezult);
             $i = $rezult["content"];
             if ($i != $product_info["image"]) {
                 $thumb_temp = module("shop")->products_img_webdir . $mpath . $product_info["url"] . "_" . $product_info["id"] . "_" . $i . module("shop")->THUMB_SUFFIX . ".jpg";
                 $img_temp = module("shop")->products_img_webdir . $mpath . $product_info["url"] . "_" . $product_info["id"] . "_" . $i . module("shop")->FULL_IMG_SUFFIX . ".jpg";
                 $replace2 = ["thumb_path" => $thumb_temp, "img_path" => $img_temp, "name" => $product_info["url"]];
                 $image .= tpl()->parse("shop/image_items", $replace2);
             }
         }
     }
     $URL_PRODUCT_ID = module("shop")->_product_id_url($product_info);
     $sql_man = "SELECT * FROM " . db('shop_manufacturers') . " WHERE id = " . $product_info["manufacturer_id"];
     $manufacturer = db()->query_fetch($sql_man);
     if (module("shop")->SHOW_products_similar_by_price == true) {
         $products_similar_by_price = module("shop")->products_similar_by_price($product_info["price"], $product_info["id"]);
     }
     if (module("shop")->products_similar_by_basket == true) {
         $products_similar_by_basket = module("shop")->products_similar_by_basket($product_info["id"]);
     }
     $replace = ["name" => _prepare_html($product_info["name"]), "model" => _prepare_html($product_info["model"]), "desc" => $product_info["description"], "manufacturer" => _prepare_html(module("shop")->_manufacturer[$product_info["manufacturer_id"]]["name"]), "url_manufacturer" => process_url("./?object=shop&action=products_show&id=" . module("shop")->_manufacturer[$product_info["manufacturer_id"]]["url"]), "date" => _format_date($product_info["add_date"], "long"), "price" => module("shop")->_format_price(module("shop")->_product_get_price($product_info)), "currency" => _prepare_html(module("shop")->CURRENCY), "thumb_path" => file_exists(module("shop")->products_img_dir . $mpath . $img_path) ? module("shop")->products_img_webdir . $mpath . $img_path : "", "img_path" => file_exists(module("shop")->products_img_dir . $mpath . $img_path) ? module("shop")->products_img_webdir . $mpath . $img_path : "", "image" => $image, "basket_add_url" => $product_info["external_url"] ? $product_info["external_url"] : process_url("./?object=shop&action=basket_add&id=" . $URL_PRODUCT_ID), "external_url" => intval((bool) $product_info["external_url"]), "back_url" => process_url("./?object=shop"), "show_basket_url" => process_url("./?object=shop&action=basket"), "dynamic_atts" => module("shop")->_get_select_attributes($atts), "cats_block" => module("shop")->_categories_show(), "cat_name" => _prepare_html(module("shop")->_shop_cats[$product_info["cat_id"]]), "cat_url" => process_url("./?object=shop&action=product_details&id=" . module("shop")->_shop_cats_all[$product_info["cat_id"]]['url']), 'comments' => module("shop")->_view_comments(), "N" => $N, "products_similar_by_price" => $products_similar_by_price, "products_similar_by_basket" => $products_similar_by_basket, "product_related" => module("shop")->products_related($product_info["id"])];
     db()->query("UPDATE " . db('shop_products') . " SET viewed = viewed+1 , last_viewed_date = " . time() . "  WHERE " . $add_sql . "'");
     return tpl()->parse("shop/details", $replace);
 }
Esempio n. 4
0
 public function test_patterns_t()
 {
     $var = 'While searching %num folders found';
     $translation = 'В процессе поиска {Найдено %num папок|0:Папок не найдено|1:Найдена %num папка|2,3,4:Найдено %num папки|11-14:Найдено %num папок|Найдено %num папок}';
     _class('i18n')->TR_VARS['ru'][strtolower(str_replace(' ', '_', $var))] = $translation;
     _class('i18n')->_loaded['ru'] = true;
     $this->assertEquals('В процессе поиска Папок не найдено', t($var, ['%num' => '0'], 'ru'));
     $this->assertEquals('В процессе поиска Найдена 1 папка', t($var, ['%num' => '1'], 'ru'));
     $this->assertEquals('В процессе поиска Найдено 2 папки', t($var, ['%num' => '2'], 'ru'));
     $this->assertEquals('В процессе поиска Найдено 3 папки', t($var, ['%num' => '3'], 'ru'));
     $this->assertEquals('В процессе поиска Найдено 4 папки', t($var, ['%num' => '4'], 'ru'));
     $this->assertEquals('В процессе поиска Найдено 5 папок', t($var, ['%num' => '5'], 'ru'));
     $this->assertEquals('В процессе поиска Найдено 6 папок', t($var, ['%num' => '6'], 'ru'));
     $this->assertEquals('В процессе поиска Найдено 7 папок', t($var, ['%num' => '7'], 'ru'));
     $this->assertEquals('В процессе поиска Найдено 8 папок', t($var, ['%num' => '8'], 'ru'));
     $this->assertEquals('В процессе поиска Найдено 9 папок', t($var, ['%num' => '9'], 'ru'));
     $this->assertEquals('В процессе поиска Найдено 10 папок', t($var, ['%num' => '10'], 'ru'));
     $this->assertEquals('В процессе поиска Найдено 11 папок', t($var, ['%num' => '11'], 'ru'));
     $this->assertEquals('В процессе поиска Найдено 12 папок', t($var, ['%num' => '12'], 'ru'));
     $this->assertEquals('В процессе поиска Найдено 13 папок', t($var, ['%num' => '13'], 'ru'));
     $this->assertEquals('В процессе поиска Найдено 14 папок', t($var, ['%num' => '14'], 'ru'));
     $this->assertEquals('В процессе поиска Найдено 15 папок', t($var, ['%num' => '15'], 'ru'));
     $this->assertEquals('В процессе поиска Найдено 100 папок', t($var, ['%num' => '100'], 'ru'));
     $this->assertEquals('В процессе поиска Найдено 1222 папки', t($var, ['%num' => '1222'], 'ru'));
 }
Esempio n. 5
0
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     init_yf();
     $params = [];
     // Parse arguments like that: k1=v1 k2=v2 into array('k1' => 'v1', 'k2' => 'v2')
     foreach ((array) $input->getArgument('params') as $p) {
         list($k, $v) = explode('=', trim($p));
         $k = trim($k);
         $v = trim($v);
         if (strlen($k) && strlen($v)) {
             $params[$k] = $v;
         }
     }
     $method = $input->getArgument('method');
     $methods = get_class_methods(_class('core_api'));
     $methods = array_combine($methods, $methods);
     foreach ($methods as $name) {
         if ($name[0] == '_') {
             unset($methods[$name]);
         }
     }
     if ($method && in_array($method, $methods)) {
         $text = _class('core_api')->{$method}($params);
         $output->writeln($text);
     } else {
         $table = $this->getHelperSet()->get('table');
         $rows = [];
         foreach ($methods as $name) {
             $rows[] = [$name];
         }
         $table->setHeaders(['API method'])->setRows($rows);
         $table->render($output);
     }
 }
Esempio n. 6
0
 public static function tearDownAfterClass()
 {
     if (false !== strpos(strtolower(get_called_class()), 'compiled')) {
         tpl()->COMPILE_TEMPLATES = self::$_bak;
         _class('dir')->delete_dir(STORAGE_PATH . 'stpls_compiled/', $delete_start_dir = true);
     }
 }
 function pics_browser()
 {
     if (isset($_GET['active']) && $_GET['active'] == 1) {
         $active = ' AND p.active = \'1\' ';
     } elseif (isset($_GET['active']) && $_GET['active'] == 0) {
         $active = ' AND p.active = \'\' ';
     } else {
         $active = '';
     }
     if (main()->is_post()) {
         foreach ($_POST['delete'] as $k => $v) {
             list($id, $product_id) = explode("_", $k);
             module('manage_shop')->_product_image_delete($id, $product_id);
         }
     }
     $cats_list = _class('_shop_categories', 'modules/shop/')->recursive_get_child_ids(62521);
     $sql = "SELECT `i`.`product_id`,`i`.`id` FROM `" . db('shop_products') . "` AS `p`, `" . db('shop_product_images') . "` AS `i` WHERE `p`.`id`=`i`.`product_id` AND `p`.`cat_id` IN ('" . implode("','", $cats_list) . "')" . $active;
     list($add_sql, $pages, $total_records, $page_current, $pages_total, $pages_limited) = common()->divide_pages($sql);
     $R = db()->query($sql . $add_sql);
     $items = [];
     while ($A = db()->fetch_assoc($R)) {
         $_cls_products = _class('_shop_products', 'modules/shop/');
         $image = $_cls_products->_product_image($A['product_id'], true);
         $items[] = ['id' => $A['product_id'], 'image_id' => $A['id'], 'image' => $image['big']];
     }
     $replace = ['items' => $items, 'total' => $total_records, 'pages' => $pages];
     $tpl_name = 'manage_shop/pics_browser';
     return tpl()->parse($tpl_name, $replace);
 }
Esempio n. 8
0
 function show()
 {
     if ($_GET['id']) {
         return _class('docs')->_show_for($this);
     }
     $docs = _class('docs');
     asset('font-awesome4');
     foreach ($this->_get_assets() as $a) {
         $name = $a['name'];
         $sub = [];
         $sub[] = $docs->_github_link($a['path']);
         $content = $a['content'];
         $info = is_array($content) ? $content['info'] : [];
         if ($info['name']) {
             $sub[] = '<b>' . t('name') . '</b>: ' . $info['name'];
         }
         if ($info['desc']) {
             $sub[] = '<b>' . t('desc') . '</b>: ' . $info['desc'];
         }
         if ($info['url']) {
             $sub[] = '<b>' . t('url') . '</b>: <a href="' . _prepare_html($info['url']) . '">' . _prepare_html($info['url']) . '</a>';
         }
         if ($info['git']) {
             $sub[] = '<b>' . t('git') . '</b>: <a href="' . $info['git'] . '">' . $info['git'] . '</a>';
         }
         $data[$name] = ['name' => $name, 'link' => url('/@object/@action/#' . $name), 'sub' => $sub, 'id' => $name];
     }
     return html()->li($data);
 }
 function _init()
 {
     $payment_api =& $this->payment_api;
     $manage_lib =& $this->manage_payment_lib;
     $provider_name =& $this->provider_name;
     $provider_class =& $this->provider_class;
     // class
     $payment_api = _class('payment_api');
     $manage_payment_lib = module('manage_payment_lib');
     // provider
     $provider_class = $payment_api->provider_class(['provider_name' => $provider_name]);
     // property
     $object =& $this->object;
     $action =& $this->action;
     $id =& $this->id;
     $filter_name =& $this->filter_name;
     $filter =& $this->filter;
     $url =& $this->url;
     // setup property
     $object = $_GET['object'];
     $action = $_GET['action'];
     $id = $_GET['id'];
     $filter_name = $object . '__' . $action;
     $filter = $_SESSION[$filter_name];
     // url
     $url = ['list' => url_admin(['is_full_url' => true, 'object' => $object, 'action' => 'show']), 'authorize' => url_admin(['is_full_url' => true, 'object' => $object, 'action' => 'authorize']), 'request_interkassa' => url_admin(['object' => $object, 'action' => 'request_interkassa', 'operation_id' => '%operation_id'])];
 }
Esempio n. 10
0
 public function test_captcha()
 {
     ob_start();
     _class('captcha')->show_image($no_header = true, $no_exit = true);
     $img = ob_get_clean();
     $this->assertNotEmpty($img);
     $this->assertGreaterThan(2000, strlen($img));
 }
Esempio n. 11
0
 /**
  */
 function form_render_out($content, $extra = [], $replace = [], $obj)
 {
     $css_framework = $extra['css_framework'] ?: conf('css_framework');
     if (!$css_framework) {
         $css_framework = $this->DEFAULT_CSS_FRAMEWORK;
     }
     return _class('html5fw_' . $css_framework, 'classes/html5fw/')->form_render_out($content, $extra, $replace, $obj);
 }
Esempio n. 12
0
 /**
  * Do connect to the low level driver
  */
 function connect()
 {
     if (!$this->_connection) {
         $this->_connection = _class('pubsub_driver_' . $this->driver, 'classes/pubsub/');
         $this->_connection->connect();
     }
     return $this->_connection;
 }
Esempio n. 13
0
 public function _init()
 {
     if (!$this->ENABLE) {
         return null;
     }
     $this->payment_api = _class('payment_api');
     !empty($this->service_allow) && ($this->description = implode(', ', $this->service_allow));
 }
Esempio n. 14
0
 public static function setUpBeforeClass()
 {
     self::$_bak_settings['REWRITE_MODE'] = $GLOBALS['PROJECT_CONF']['tpl']['REWRITE_MODE'];
     $GLOBALS['PROJECT_CONF']['tpl']['REWRITE_MODE'] = true;
     $_GET = ['object' => 'dynamic', 'action' => 'unit_test_form'];
     $_SERVER['HTTP_HOST'] = self::$host;
     _class('rewrite')->DEFAULT_HOST = self::$host;
 }
Esempio n. 15
0
 public static function setUpBeforeClass()
 {
     $_GET = ['object' => 'dynamic', 'action' => 'unit_test_form', 'id' => 'id/with/slashes'];
     self::$_bak_settings['REWRITE_MODE'] = $GLOBALS['PROJECT_CONF']['tpl']['REWRITE_MODE'];
     $GLOBALS['PROJECT_CONF']['tpl']['REWRITE_MODE'] = true;
     $GLOBALS['CONF']['form2']['CONF_CSRF_PROTECTION'] = false;
     _class('form2')->CONF_CSRF_PROTECTION = false;
 }
Esempio n. 16
0
 /**
  * Do connect to the low level driver
  */
 function connect()
 {
     if (!$this->_connection) {
         $this->_connection = _class('queue_driver_' . $this->driver, 'classes/queue/');
         $this->_connection->connect();
     }
     return $this->_connection;
 }
Esempio n. 17
0
 function read()
 {
     $online_class = _class('online_users', 'classes/');
     $online_class->process();
     main()->NO_GRAPHICS = true;
     db()->query("UPDATE `" . db('notifications_receivers') . "` SET `is_read`=1 WHERE `receiver_id`='" . $online_class->online_user_id . "' AND `receiver_type`='" . $online_class->online_user_type . "' AND `id`=" . intval($_POST['id']));
     echo "OK";
     exit;
 }
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     init_yf();
     if (!defined('PROJECT_PATH') || !strlen(constant('PROJECT_PATH'))) {
         $output->writeln('Error: not inside a project');
         return false;
     }
     _class('manage_assets', 'admin_modules/')->cache_fill();
 }
Esempio n. 19
0
 public static function setUpBeforeClass()
 {
     self::$_bak['DB_DRIVER'] = self::$DB_DRIVER;
     self::$DB_DRIVER = 'pdo_mysql';
     self::_connect();
     self::utils()->truncate_database(self::db_name());
     _class('validate')->_init();
     _class('validate')->db = self::$db;
 }
 public static function tearDownAfterClass()
 {
     self::utils()->truncate_database(self::db_name());
     self::$DB_DRIVER = self::$_bak['DB_DRIVER'];
     $dir = APP_PATH . 'share/db/';
     // Delete only if share path is really temporal and inside framrwork tests
     if (YF_PATH && $dir && substr($dir, 0, strlen(YF_PATH)) === YF_PATH) {
         _class('dir')->delete_dir($dir, $delete_start_dir = true);
     }
 }
 /**
  * Test de création avec des arguments
  */
 public function testCreateParams()
 {
     $foo = _class('fooconstructedclass');
     $this->assertEquals('default', $foo->getVar());
     $foo = _class('fooconstructedclass', array('var1'));
     $this->assertEquals('var1', $foo->getVar());
     $foo = _class('fooconstructedclass', array('var1', 'var2'));
     $this->assertEquals('var1', $foo->getVar());
     $this->assertEquals('var2', $foo->getVar2());
 }
Esempio n. 22
0
 public static function tearDownAfterClass()
 {
     $driver = self::_get_driver_name();
     if ($driver == 'files') {
         $cache_dir = self::_cache()->_driver->CACHE_DIR;
         if ($cache_dir && file_exists($cache_dir)) {
             _class('dir')->delete_dir($cache_dir, $delete_start_dir = true);
         }
     }
 }
Esempio n. 23
0
 public function test_1()
 {
     $test_array = ['172.19.177.198, 170.51.255.218' => '170.51.255.218', '172.19.177.198, 10.21.0.218' => '', '172.44.141.63, 189.204.26.200' => '189.204.26.200', '100.43.83.158' => '100.43.83.158', '141.63.172.26, 189.204.26.200' => '141.63.172.26', '50.23.132.250, % 188.165.140.51  & .19.177.198, 170.51.255.218 170.51.255.217 | 170.51.255.215 5 . %%%234.123.345.234' => '170.51.255.218', '110.45.192.73,108_168_141_178' => '110.45.192.73', '118.70.127.134,108.168.141.178' => '118.70.127.134', '110.45.192.73 | 94.23.1.212' => '110.45.192.73', '213.186.127.8, 94.23.1.212' => '213.186.127.8', '213.186.127.10 " remote_addr_ip":"94.23.1.212"' => '213.186.127.10', '213.186.127.7","emote_addr_ip":"94.23.1.212"' => '213.186.127.7', '213.86.127.9","remote_addr_ip":"94.23.1.212"' => '213.86.127.9', '213.86.127.13","remote_addr_ip":"94.23.1.212"' => '213.86.127.13', '102.219.202.23, 124.81.238.226' => '124.81.238.226'];
     $ignore_ips = ['172.19.177.198', '172.44.141.63', '50.23.132.250', '188.165.140.51', '102.219.202.23'];
     $ignore_ips = array_combine($ignore_ips, $ignore_ips);
     foreach ((array) $test_array as $test_ip => $expect_ip) {
         $_SERVER['HTTP_X_FORWARDED_FOR'] = $key;
         $this->assertEquals($expect_ip, _class('client_utils', 'classes/common/')->_check_ip($test_ip, $ignore_ips));
     }
 }
Esempio n. 24
0
 public function test_url()
 {
     $host = 'subdomain.test.dev';
     $_GET = ['object' => 'dynamic', 'action' => 'unit_test_form'];
     $_SERVER['HTTP_HOST'] = $host;
     _class('rewrite')->DEFAULT_HOST = $host;
     $this->assertEquals('http://' . $host . '/?object=shop&action=basket', self::_tpl('{url(object=shop;action=basket)}'));
     $this->assertEquals('http://' . $host . '/?object=shop&action=basket', self::_tpl('{url(/shop/basket/)}'));
     $this->assertEquals('http://' . $host . '/?object=shop&action=autocomplete&search_word=%QUERY', self::_tpl('{url(object=shop;action=autocomplete;search_word=%QUERY)}'));
     $this->assertEquals('http://' . $host . '/?object=shop&action=autocomplete&id=&search_word=%QUERY', self::_tpl('{url(/shop/autocomplete/&search_word=%QUERY)}'));
 }
 public function _createContent(&$toReturn)
 {
     $tpl = new CopixTpl();
     $kernel = _class("kernel");
     $toReturn = "";
     $arModulesPath = CopixConfig::instance()->arModulesPath;
     $display = false;
     foreach ($arModulesPath as $modulePath) {
         if (file_exists(COPIX_PROJECT_PATH . "themes/" . $kernel->getTheme() . "/kernel/footer.tpl")) {
             $tpl_file = COPIX_PROJECT_PATH . "themes/" . $kernel->getTheme() . "/kernel/footer.tpl";
         } else {
             $tpl_file = $modulePath . 'kernel/templates/footer.tpl';
         }
         if (!file_exists($tpl_file)) {
             continue;
         }
         $display = true;
         // Récupération des infos de géolocalisation.
         $whereami = Kernel::whereAmI();
         if (isset($whereami['BU_GRVILLE'])) {
             $tpl->assign('grville_id', $whereami['BU_GRVILLE']['id']);
             $tpl->assign('grville_nom', $whereami['BU_GRVILLE']['nom']);
         }
         if (isset($whereami['BU_VILLE'])) {
             $tpl->assign('ville_id', $whereami['BU_VILLE']['id']);
             $tpl->assign('ville_nom', $whereami['BU_VILLE']['nom']);
         }
         if (isset($whereami['BU_ECOLE'])) {
             $tpl->assign('ecole_id', $whereami['BU_ECOLE']['id']);
             $tpl->assign('ecole_nom', $whereami['BU_ECOLE']['nom']);
         }
         if (isset($whereami['BU_CLASSE'])) {
             $tpl->assign('classe_id', $whereami['BU_CLASSE']['id']);
             $tpl->assign('classe_nom', $whereami['BU_CLASSE']['nom']);
         }
         // Récupération des valeurs d'URL.
         if ($module = CopixRequest::get('module')) {
             $tpl->assign('module', $module);
         }
         if ($action = CopixRequest::get('action')) {
             $tpl->assign('action', $action);
         }
         // Récupération des valeurs de sessions (personne).
         if (_currentUser()->getExtra('type')) {
             $tpl->assign('user_type', _currentUser()->getExtra('type'));
             $tpl->assign('user_id', _currentUser()->getExtra('id'));
         }
     }
     // Si le fichier de template n'existe pas, pas d'erreur.
     if ($display) {
         $toReturn = $tpl->fetch('kernel|footer.tpl');
     }
     return true;
 }
Esempio n. 26
0
 public function _init()
 {
     $this->api = _class('api');
     $this->payment_api = _class('payment_api');
     // index
     $index =& $this->index;
     $provider =& $this->provider;
     foreach ($provider as $key => &$item) {
         $id = $item['id'];
         $index['provider']['id'][$id] =& $item;
     }
 }
Esempio n. 27
0
 public function test_exists()
 {
     if ($this->_need_skip_test(__FUNCTION__)) {
         return;
     }
     $table = self::db()->DB_PREFIX . __FUNCTION__;
     $this->assertNotEmpty(self::db()->query($this->create_table_sql($table)));
     $this->assertFalse(_class('validate')->exists('*****@*****.**', ['param' => $table . '.email']));
     $data = [1 => ['id' => 1, 'name' => 'test1', 'email' => '*****@*****.**'], 2 => ['id' => 2, 'name' => 'test2', 'email' => '*****@*****.**']];
     $this->assertNotEmpty(self::db()->insert_safe($table, $data));
     $this->assertTrue(_class('validate')->exists('*****@*****.**', ['param' => $table . '.email']));
     $this->assertFalse(_class('validate')->exists('*****@*****.**', ['param' => $table . '.email']));
 }
Esempio n. 28
0
 /**
  */
 function show()
 {
     if ($_GET['id']) {
         return _class('docs')->_show_for($this);
     }
     !cache()->get('var1') && cache()->set('var1', 'value_core_cache');
     !cache_tmp()->get('var1') && cache_tmp()->set('var1', 'value_tmp');
     !cache_files()->get('var1') && cache_files()->set('var1', 'value_files');
     $cache_db = clone _class('cache');
     $cache_db->_init(['driver' => 'db']);
     !$cache_db->get('var1') && $cache_db->set('var1', 'value_db');
     return $this->_other_func() . ' | ' . $cache_db->get('var1');
 }
Esempio n. 29
0
 /**
  * Extract files from tar archive (local)
  */
 function _local_extract_tar($archive_path = '', $extract_path = '')
 {
     if (empty($archive_path) || empty($extract_path)) {
         return false;
     }
     $archive_path = _class('ssh')->_prepare_path($archive_path);
     $extract_path = _class('ssh')->_prepare_path($extract_path);
     $destination_folder = dirname($extract_path);
     if (!file_exists($destination_folder)) {
         _mkdir_m($destination_folder);
     }
     return false;
 }
 public function _init()
 {
     if (!$this->ENABLE) {
         return null;
     }
     $this->payment_api = _class('payment_api');
     // load api
     require_once __DIR__ . '/payment_provider/privat24/Privat24.php';
     $this->api = new Privat24($this->KEY_PUBLIC, $this->KEY_PRIVATE);
     $this->url_result = url_user('/api/payment/provider?name=privat24&operation=response');
     $this->url_server = url_user('/api/payment/provider?name=privat24&operation=response&server=true');
     // parent
     parent::_init();
 }