Ejemplo n.º 1
0
 public function startQuery($sql, array $params = null, array $types = null)
 {
     \PC::debug($sql, 'sql');
     if ($params) {
         \PC::debug($params, 'params');
     }
 }
Ejemplo n.º 2
0
 protected function appDebug()
 {
     if (DEBUG and (!defined('ARTISAN') and !defined('TESTING'))) {
         $this->app->error(function (\Exception $e) {
             Request::ajax() and \PC::debug($e);
         });
     }
 }
Ejemplo n.º 3
0
 public function action_index()
 {
     require_once APPPATH . "classes/Controller/Widgets/Menu.php";
     $menu = new Controller_Widgets_Menu($this->request, $this->response);
     $menu->get_config();
     PC::debug($menu->module_config);
     PC::debug($menu->request);
     PC::debug($menu->response);
 }
Ejemplo n.º 4
0
 public function dispatchLoopShutdown(Yaf\Request_Abstract $request, Yaf\Response_Abstract $response)
 {
     /**
      * phpConsole调试(需要安装google扩展)
      */
     PC::debug(Core\ServiceLocator::db()->log(), 'sql.trace');
     PC::debug(Core\ServiceLocator::db()->error(), 'sql.error');
     $performance = ['memory_usage' => memory_get_usage() - APP_MEMORY_START, 'time_usage' => microtime(true) - APP_MICROTIME_START];
     PC::debug($performance, 'performance.info');
 }
Ejemplo n.º 5
0
 public function get_page_path_of($block)
 {
     $query_str = "select be_page_versions.path from be_blocks LEFT JOIN be_page_versions on be_blocks.version=be_page_versions.id where be_blocks.name='{$block}' ORDER BY be_page_versions.id DESC LIMIT 1";
     $query = $this->db->query($query_str);
     $result = $query->result();
     if ($result) {
         PC::debug("Page path of block {$block}: " . $result[0]->path);
         return $result[0]->path;
     } else {
         PC::debug("!!!! No page path");
         return false;
     }
 }
Ejemplo n.º 6
0
 public function reg($name, $pass, $role)
 {
     PC::debug(array($name, $pass, $role), "reg");
     $myuser = new Model_Myuser();
     $auth = Auth::instance();
     $hash_pass = $auth->hash($pass);
     //Создаем пользователя
     $myuser->username = $name;
     $myuser->email = $name;
     $myuser->password = $hash_pass;
     try {
         $myuser->save();
         //Узнаем id пользователя
         //$usertmp = ORM::factory('user', array('username'=>$name));
         $adduserid = DB::select()->from('users')->where('username', '=', $name)->execute()->as_array()[0]["id"];
         $adduser = new Model_Addrole();
         $adduser->user_id = $adduserid;
         $adduser->role_id = $role;
         $adduser->save();
         //добавляем запись для активации
         $token = substr($auth->hash($adduserid . $name), 0, 20);
         $addtoken = new Model_Addtoken();
         $addtoken->user_id = $adduserid;
         $addtoken->token = $token;
         $addtoken->save();
         //отправляем пользователю сообщение для авторизации
         $config = Kohana::$config->load('email');
         $mbase = new Model_Base();
         $options = $mbase->getOptions();
         Email::connect($config);
         $to = $name;
         $subject = 'Добро пожаловать на сайт ' . $options['sitename'];
         $from = $config['options']['username'];
         $message = '<h2>Вы успешно зарегистрировались на сайте <a href="' . Kohana::$base_url . '">' . $options['sitename'] . '</a>!</h2><hr>';
         $message .= '<p>Перед входом пожалуйста подтвердите свою учётную запись, для этого перейдите по <a href="' . Kohana::$base_url . 'user/activate?token=' . $token . '&user='******'">этой ссылке</a>.</p><hr>';
         $message .= '<h3>Ваши реквизиты для входа:<h3>';
         $message .= '<p><small>Логин:&nbsp;&nbsp;<input type="text" value="' . $name . '"></small></p>';
         $message .= '<p><small>Пароль:&nbsp;<input type="text" value="' . $pass . '"></small></p>';
         $message .= '<hr>Спасибо за то, что пользуетесь услугами нашего портала. По всем вопросам обращайтесь в техподдержку: ' . $config['options']['username'];
         Email::send($to, $from, $subject, $message, $html = true);
         return true;
     } catch (ORM_Validation_Exception $e) {
         $this->errors = $e->errors('validation');
         return false;
     }
 }
Ejemplo n.º 7
0
 /**
  * 适配默认后台样式的菜单列表
  * @param $userInfo
  * @param $currentRequet 当前请求权限节点
  * @return string
  */
 public static function builtMenu($userInfo, $currentRequet)
 {
     //TODO::可以根据业务实现缓存菜单文件
     $rbacManage = \Core\ServiceLocator::getInstance()->get('rbacManage');
     $itemGroup = $rbacManage->getItemsGroup('*', null);
     $userPermissionIds = [];
     foreach ($rbacManage->userPermissions as $ps) {
         $userPermissionIds[] = $ps['item_id'];
     }
     $menuHtml = '';
     PC::debug($itemGroup);
     foreach ($itemGroup as $item) {
         if (!isset($item['sub'])) {
             continue;
         }
         $shtml = '';
         $liActive = '';
         foreach ($item['sub'] as $subNode) {
             //管理员显示所有菜单
             if (!$rbacManage->isAdmin($userInfo['name'])) {
                 if (!in_array($subNode['id'], $userPermissionIds)) {
                     continue;
                 }
             }
             if ($subNode['show'] == RbacItemModel::ITEM_SHOW_NOT) {
                 continue;
             }
             $subLiActive = '';
             if ($currentRequet == strtolower($subNode['title'])) {
                 $liActive = $subLiActive = 'active';
             }
             $shtml .= "<li class='{$subLiActive}'><a href=\"{$subNode['title']}\"><i class=\"fa fa-circle-o text-aqua\"></i><span>{$subNode['desc']}</span></a></li>";
         }
         if (!$shtml) {
             continue;
         }
         $menuHtml .= "<li class=\"treeview {$liActive}\">\n                            <a href=\"#\"><i class=\"fa fa-th\"></i><span>{$item['desc']}</span><i class=\"fa fa-angle-left pull-right\"></i></a>\n                                <ul class=\"treeview-menu\">" . $shtml . "</ul>\n                          </li>";
     }
     return $menuHtml;
 }
Ejemplo n.º 8
0
 public function action_index($options = array())
 {
     $breadcrumbs = new Model_Widgets_Breadcrumb();
     $paths[] = array("title" => "Главная", "path" => "/");
     $uri = Request::detect_uri();
     $dirs = explode("/", $uri);
     array_shift($dirs);
     foreach ($dirs as $dir) {
         $path = $breadcrumbs->getPath($dir);
         if ($path != FALSE) {
             $paths[] = array("title" => $path["name"], "path" => $path["path"]);
         }
     }
     $cnt = count($paths) - 1;
     $paths[$cnt]["path"] = "";
     // --- Не удалять!!! --------------------------------------------------
     $node = $paths[count($paths) - 1];
     $paths[0]["path"] = "";
     unset($paths[count($paths) - 1]);
     // --- /Не удалять!!! -------------------------------------------------
     $model = array("nodes" => $paths, "node" => $node);
     PC::debug($model, "breadcrumb");
     $this->set_template("/widgets/w_breadcrumb.php", "twig")->render($model)->body();
 }
Ejemplo n.º 9
0
 public function addGood($orderId, $itemId, $itemCount)
 {
     PC::debug("add_good", "add_good");
     $vData = array("orderId" => $orderId, "itemId" => $itemId, "itemCount" => $itemCount);
     $validation = Validation::factory($vData);
     $validation->rule("orderId", "not_empty");
     $validation->rule("itemId", "not_empty");
     $validation->rule("itemCount", "not_empty");
     if (!$validation->check()) {
         $this->errors = $validation->errors("ordersErrors");
         return FALSE;
     }
     try {
         //проверяем есть ли такой товар в этом заказе
         $items = DB::select("cnt")->from("order_materials")->where("order_id", "=", $orderId)->and_where("mid", "=", $itemId)->execute()->get("cnt");
         if (!$items) {
             $ordermat = ORM::factory("OrderMaterials");
             $ordermat->order_id = $orderId;
             $ordermat->mid = $itemId;
             $ordermat->cnt = $itemCount;
             $ordermat->save();
         } else {
             $newCount = $items + $itemCount;
             DB::update("order_materials")->set(array("cnt" => $newCount))->where("mid", "=", $itemId)->and_where("order_id", "=", $orderId)->execute();
         }
         return $orderId;
     } catch (ORM_Validation_Exception $e) {
         $this->errors = $e->errors("validation");
         return false;
     }
 }
Ejemplo n.º 10
0
 public function action_index()
 {
     $category = new Model_Category('tree');
     $widgets = new Model_Widget();
     $data['categories'] = $category->getTree();
     if (isset($_POST['add_category'])) {
         $categoryName = Arr::get($_POST, 'categoryName', '');
         $categoryUrl = Arr::get($_POST, 'categoryUrl', '');
         $parentId = Arr::get($_POST, 'parentId', '');
         $previousId = Arr::get($_POST, 'previousId', '');
         $res = $category->catInsert($parentId, $previousId, array('name' => $categoryName, 'url' => $categoryUrl));
         if ($res) {
             Controller::redirect('admin/structure');
         } else {
             $data['errors'] = $category->getErrors();
         }
     }
     if (isset($_POST['save_category'])) {
         $categoryName = Arr::get($_POST, 'categoryName', '');
         $categoryKeywords = Arr::get($_POST, 'categoryKeywords', '');
         $categoryDescription = Arr::get($_POST, 'categoryDescription', '');
         $url = $this->request->param('id');
         $categoryId = $category->getCategoryIdByUrl($url);
         $res = $category->catUpdate($categoryId, array('name' => $categoryName, 'keywords' => $categoryKeywords, 'description' => $categoryDescription));
         if ($res) {
             Controller::redirect('admin/structure/' . $url);
         } else {
             $data['errors'] = $category->getErrors();
         }
     }
     if (isset($_POST['create_from_groups'])) {
         $groupId = Arr::get($_POST, 'groupId', '');
         $parentId = Arr::get($_POST, 'parentId', '');
         $include_content = Arr::get($_POST, 'include_content', '');
         $category->createFromGroups($parentId, $groupId);
         if ($include_content == 'on') {
         }
     }
     if (isset($_POST['addWidget'])) {
         $widgets->addWidget($_POST);
     }
     if (isset($_POST['checked_del'])) {
         $delArr = Arr::get($_POST, 'check_name', array());
         $widgets->deleteWidgets($delArr);
     }
     $url = $this->request->param('id');
     $widgetId = $this->request->param('widget');
     if ($url != NULL) {
         $data['thisCategory'] = $category->getCategory($category->getCategoryIdByUrl($url));
         //получаем виджеты для категории
         $data['widgets'] = $widgets->getWidgets($category->getCategoryIdByUrl($url));
         $data['widgetsTypes'] = $widgets->getWidgetTypes();
         $data['positions'] = Kohana::$config->load('main')->positions;
         $data['templates'] = $this->getTemplates();
     }
     if ($widgetId) {
         if (isset($_POST['save_widget'])) {
             PC::debug($_POST, "post");
             //сохраняем данные виджета
             $data['errors'] = $widgets->saveWidget($_POST);
         }
         $data['widget'] = $widgets->getWidget($widgetId);
         $data['widgetTypes'] = $widgets->getWidgetTypes();
         if ($data['widget']['template'] && $data['widget']['template'] != '') {
             $template = $data['widget']['template'];
         } else {
             $template = $data['widget']['def_template'];
         }
         $lessfile = DOCROOT . 'css/' . $data['widget']['name'] . '.less';
         $jsfile = DOCROOT . 'js/' . $data['widget']['name'] . '.js';
         if ($template) {
             $filename = DOCROOT . 'application/views/widgets/' . $template . '.php';
             if (is_file($filename) && is_readable($filename) && filesize($filename) > 0) {
                 $fh = fopen($filename, "r");
                 $file = fread($fh, filesize($filename));
                 $data['file'] = $file;
                 fclose($fh);
             }
         }
         if (is_file($lessfile) && is_readable($lessfile) && filesize($lessfile) > 0) {
             $fh = fopen($lessfile, "r");
             $file = fread($fh, filesize($lessfile));
             $data['less'] = $file;
             fclose($fh);
         }
         if (is_file($jsfile) && is_readable($jsfile) && filesize($jsfile) > 0) {
             $fh = fopen($jsfile, "r");
             $file = fread($fh, filesize($jsfile));
             $data['js'] = $file;
             fclose($fh);
         }
         $num_backups = 10;
         $template .= '.php';
         $lname = $data['widget']['name'] . '.less';
         $jname = $data['widget']['name'] . '.js';
         for ($n = 1; $n <= $num_backups; ++$n) {
             $name1 = str_replace($template, str_replace(".", "_" . $n . ".", $template), $template);
             $res = str_replace($template, 'backups/' . $name1, $filename);
             if (is_file($res)) {
                 $data['template_backups'][$n]['file'] = $res;
                 $data['template_backups'][$n]['name'] = $name1;
             }
             $namel = str_replace($lname, str_replace(".", "_" . $n . ".", $lname), $lname);
             $namej = str_replace($jname, str_replace(".", "_" . $n . ".", $jname), $jname);
             $lres = str_replace($lname, 'backups/' . $namel, $lessfile);
             if (is_file($lres)) {
                 $data['less_backups'][$n]['file'] = $lres;
                 $data['less_backups'][$n]['name'] = $namel;
             }
             $jres = str_replace($jname, 'backups/' . $namej, $jsfile);
             if (is_file($jres)) {
                 $data['js_backups'][$n]['file'] = $jres;
                 $data['js_backups'][$n]['name'] = $namej;
             }
         }
     }
     if (isset($_POST['imgUpload'])) {
         //get uploadDir
         $uploadDir = DOCROOT . 'img/user/menu';
         $name = $_POST['filename'];
         //перебираем массив файлов
         for ($i = 0; $i < count($_FILES['file']['name']); ++$i) {
             if ($_FILES['file']['size'][$i] > 11100000) {
                 echo 'Файл не должен быть больше 10 Мб';
             } else {
                 $ext = explode('.', $_FILES['file']['name'][$i]);
                 $extension = array_pop($ext);
                 $base = new Model_Base();
                 $extarr = explode('.', $_FILES['file']['name'][$i]);
                 $ext = array_pop($extarr);
                 $filename = $name . '.' . $ext;
                 //$filename = substr(md5(microtime() * time()),0,rand(20,10)).'.'.$extension;
                 if (copy($_FILES['file']['tmp_name'][$i], $uploadDir . "/" . $filename)) {
                     $base = new Model_Base();
                     $options = $base->getOptions();
                     $size = explode(',', Arr::get($options, 'structure_photos_size'));
                     //изменяем картинку
                     //открываем изображение
                     $image = Image::factory($uploadDir . "/" . $filename);
                     //начинаем работу с нужной картинкой. Путь указан от корня приложения
                     //меняем размер картинки
                     if (count($size) == 2) {
                         $image->resize($size[0], $size[1]);
                     }
                     //сохраняем новое изображение
                     $image->save(NULL, 90);
                     //первый параметр - путь, имя и формат изображения. Второй - качество изображения
                     unset($image);
                 }
             }
         }
     }
     //Получаем группу пользователя
     $auth = Auth::instance();
     $user = $auth->get_user();
     //  echo '<pre>';
     $this->template->content = View::factory('admin/admIndex', array('data' => $data, 'user' => $this->user, 'request' => $this->request, 'response' => $this->response));
 }
Ejemplo n.º 11
0
 private function load_block_directly($block)
 {
     PC::debug("Loading block directly.");
     $page_path = $this->blocks->get_page_path_of($block->name);
     PC::debug("versions::load_block_directly() Page Path: {$page_path}");
     if ($page_path === false) {
         PC::error("Coudn't find page path of block name '{$block->name}'");
         return;
     }
     $pending_version = $this->get_pending_or_active_page_version_id($page_path);
     PC::debug("Loading block from version {$pending_version}", "versions::load_block_directly");
     $this->db->where("version", $pending_version);
     $this->db->where("`name` = '{$block->name}'");
     $query = $this->db->get("blocks");
     $result = $query->result_array();
     if ($result) {
         $this->db->where("version", $result[0]['version']);
         $this->db->where("parent", $result[0]['name']);
         $this->db->order_by('sort_order ASC');
         $query = $this->db->get("block_relations");
         $children_result = $query->result();
         if ($children_result) {
             $children = array();
             foreach ($children_result as $entry) {
                 array_push($children, $entry->child);
             }
             $result[0]['children'] = $children;
         } else {
             $result[0]['children'] = array();
         }
         $result[0] = (object) $result[0];
         $block->initialize($result[0]);
         return true;
     } else {
         return false;
     }
 }
Ejemplo n.º 12
0
    function block_styler($block_name)
    {
        $page_path = $_GET['page_path'];
        PC::debug("Setting page path to {$page_path}");
        $this->BuilderEngine->set_page_path($page_path);
        $block = new Block($block_name);
        $block->load();
        if ($block->is_global()) {
            PC::WARNING("Block {$block_name} is global so we change page path");
            $this->BuilderEngine->set_page_path('layout');
        }
        PC::debug($block, "ajax::block_styler");
        if (isset($_POST['block_save'])) {
            PC::WARNING($_POST);
            unset($_POST['page_path']);
            unset($_POST['block_save']);
            $block->set_data("style", $_POST, true);
            $block->save();
        }
        echo '
    			<script src="/builderengine/public/js/jquery.js"></script>
				<link href="/themes/dashboard/css/bootstrap/bootstrap.css" rel="stylesheet" />
				<link href="/themes/dashboard/css/bootstrap/bootstrap-responsive.css" rel="stylesheet" />
				<script src="/builderengine/public/js/bootstrap.js"></script> <!-- Bootstrap -->
    			<script>
    			function enable_disable_font_fields()
    			{
    				$("[name=\'color\']").attr(\'disabled\',!$("[name=\'font-color_override\']").attr("checked"));
    				$("[name=\'color\']").spectrum({
	                        preferredFormat: "hex6",
	                        color: $(this).attr("value"),
	                        showInput: true,
	                        showInitial: true,     
	                        clickoutFiresChange: true,
	                        chooseText: "Select",
	                        cancelText: "Close"
                    	});
    				$("[name=\'color_old\']").attr(\'disabled\',!$("[name=\'font-color_override\']").attr("checked"));

    				$("[name=\'font-family\']").attr(\'disabled\',!$("[name=\'font-color_override\']").attr("checked"));
					$("[name=\'font-family-2\']").attr(\'disabled\',!$("[name=\'font-color_override\']").attr("checked"));
					$("[name=\'font-weight\']").attr(\'disabled\',!$("[name=\'font-color_override\']").attr("checked"));
					$("[name=\'font-size\']").attr(\'disabled\',!$("[name=\'font-color_override\']").attr("checked"));
    			}
    			function enable_disable_bg_color_fields()
    			{
    				$("[name=\'background-color\']").attr(\'disabled\',!$("[name=\'background-color_override\']").attr("checked"));
    				$("[name=\'background-color_old\']").attr(\'disabled\',!$("[name=\'background-color_override\']").attr("checked"));

					$("[name=\'background-color\']").spectrum({
	                        preferredFormat: "hex6",
	                        color: $("[name=\'background-color\']").attr("value"),
	                        showInput: true,
	                        showInitial: true,     
	                        clickoutFiresChange: true,
	                        chooseText: "Select",
	                        cancelText: "Close"
                    	});
    				
    			}

    			function enable_disable_border_fields()
    			{
    				$("[name=\'border-color\']").attr(\'disabled\',!$("[name=\'border_override\']").attr("checked"));
    				$("[name=\'border-color_old\']").attr(\'disabled\',!$("[name=\'border_override\']").attr("checked"));
    				$("[name=\'border-style\']").attr(\'disabled\',!$("[name=\'border_override\']").attr("checked"));
					$("[name=\'border-width\']").attr(\'disabled\',!$("[name=\'border_override\']").attr("checked"));

					$("[name=\'border-color\']").spectrum({
	                        preferredFormat: "hex6",
	                        color: $("[name=\'border-color\']").attr("value"),
	                        showInput: true,
	                        showInitial: true,     
	                        clickoutFiresChange: true,
	                        chooseText: "Select",
	                        cancelText: "Close"
                    	});
    				
    			}

    			function enable_disable_bg_image_fields()
    			{
	  
    				$("[name=\'background-image_old\']").attr(\'disabled\',!$("[name=\'background-image_override\']").attr("checked"));
					$("[name=\'background-image\']").attr(\'disabled\',!$("[name=\'background-image_override\']").attr("checked"));
					$("[name=\'background-repeat\']").attr(\'disabled\',!$("[name=\'background-image_override\']").attr("checked"));

    			}
    			$(document).ready(function () {
    				enable_disable_font_fields();
    				enable_disable_bg_color_fields();
    				enable_disable_bg_image_fields();
    				enable_disable_border_fields();

    				$("[name=\'font-color_override\']").click(function(){
						enable_disable_font_fields(); 
					});
					$("[name=\'background-color_override\']").click(function(){
						enable_disable_bg_color_fields(); 
					});

					$("[name=\'background-image_override\']").click(function(){
						enable_disable_bg_image_fields(); 
					});
					$("[name=\'border_override\']").click(function(){
						enable_disable_border_fields(); 
					});

    				$(".color-picker").each(function () {
    					$(this).spectrum({
	                        preferredFormat: "hex6",
	                        color: $(this).attr("value"),
	                        showInput: true,
	                        showInitial: true,     
	                        clickoutFiresChange: true,
	                        chooseText: "Select",
	                        cancelText: "Close"
                    	});
					});

    				$("#block-admin-save").click(function (event){
    					block_name = "' . $block_name . '";

    					$("#block-admin-save").html("Saving...");
    					$.ajax( {
					        url: "/index.php/layout_system/ajax/block_styler/' . $block_name . '?page_path=' . $page_path . '",
					        async: false,
					        type: "post",          
					        data: $("#block-admin-form").serialize(),
					    }).fail(function (data){alert(console.log(data))});
						window.parent.reload_block(\'' . $block_name . '\', window.parent.page_path, true);
						$("#admin-window").remove();
						if(block_name == "be_body_styler"){
							setTimeout(\'var iframe = window.parent.document.getElementById("content-frame");iframe.src = iframe.src;\',1500);
							
            				
						}
					event.preventDefault();
						
    				});
				});
    			</script>
    			<script src="/themes/dashboard/js/plugins/file_manager.js"></script>
    		';
        echo '<div class="container">
    		


    		<form class="form-horizontal" id="block-admin-form" method="post">
    		<input type="hidden" name="block_save" name="">
    		<input type="hidden" name="page_path" value="' . $page_path . '">';
        ?>
			<link href="/themes/dashboard/js/plugins/forms/spectrum/spectrum.css" rel="stylesheet" /> 

            <script src="/themes/dashboard/js/plugins/forms/spectrum/spectrum.js"></script><!--  Color picker -->
			<div style="border-width: 1px;border-color: #ddd;border-radius: 4px 4px 0 0;border-style: solid;">
				<ul id="myTab" class="nav nav-tabs">
				  <li class="active"><a href="#general" data-toggle="tab">General</a></li>
				  <li><a href="#position" data-toggle="tab">Position</a></li>
				  <li><a href="#border" data-toggle="tab">Border</a></li>
				  <li><a href="#font" data-toggle="tab">Font</a></li>
				  <li><a href="#background" data-toggle="tab">Background</a></li>
				  <li><a href="#custom" data-toggle="tab">Advanced</a></li>

				</ul>

				<!-- Tab panes -->
				<div class="tab-content">
				  	<div class="tab-pane active" id="general">
			  			<?php 
        $block->admin_select('display', array("inline" => "Inline (Default)", "block" => "Block", "initial" => "Initial", "inline-block" => "Inline-Block", "inline-table" => "Inline-Table", "list-item" => "List-Item", "run-in" => "Run-In", "table" => "Table", "table-caption" => "Table-Caption", "table-column-group" => "Table-Column-Group", "table-header-group" => "Table-Header-Group", "table-footer-group" => "Table-Footer-Group", "table-row-group" => "Table-Row-Group", "table-cell" => "Table-Cell", "table-column" => "Table-Column", "table-row" => "Table-Row", "none" => "None", "inherit" => "Inherit"), 'Display');
        $block->admin_select('position', array("static" => "Static (Default)", "relative" => "Relative", "initial" => "Initial", "absolute" => "Absolute", "inherit" => "Inherit"), 'Position');
        $block->admin_input('z-index', "text", 'Z-Index');
        ?>

						
					</div>
					<div class="tab-pane" id="position">
						<div class="tabbable tabs-left">
			              <ul class="nav nav-tabs" id="slider-settings">
			                <li class="active"><a href="#positions" data-toggle="tab">Position</a></li>
			                <li><a href="#margin" data-toggle="tab">Margin</a></li>
			                <li><a href="#padding" data-toggle="tab">Padding</a></li>
			              </ul>
			              <div class="tab-content" id="some-tabs" style="height: 240px; overflow-y: scroll">
			                <div class="tab-pane active" id="positions" >
			                	<?php 
        $block->admin_input('top', "text", 'Top', '', 'Sets the top edge position in px, cm, etc. Negative values are allowed.');
        $block->admin_input('right', "text", 'Right', '', 'Sets the right edge position in px, cm, etc. Negative values are allowed.');
        $block->admin_input('bottom', "text", 'Bottom', '', 'Sets the bottom edge position in px, cm, etc. Negative values are allowed.');
        $block->admin_input('left', "text", 'Left', '', 'Sets the top left position in px, cm, etc. Negative values are allowed.');
        ?>
			                </div>
			                <div class="tab-pane" id="position" >
								<?php 
        $block->admin_input('margin-top', "text", 'Top', '', 'Specifies a margin in px, pt, cm, etc. Default value is 0px');
        $block->admin_input('margin-right', "text", 'Right', '', 'Specifies a margin in px, pt, cm, etc. Default value is 0px');
        $block->admin_input('margin-bottom', "text", 'Bottom', '', 'Specifies a margin in px, pt, cm, etc. Default value is 0px');
        $block->admin_input('margin-left', "text", 'Left', '', 'Specifies a margin in px, pt, cm, etc. Default value is 0px');
        ?>
			                </div>
			                <div class="tab-pane" id="margin" >
								<?php 
        $block->admin_input('margin-top', "text", 'Top', '', 'Specifies a margin in px, pt, cm, etc. Default value is 0px');
        $block->admin_input('margin-right', "text", 'Right', '', 'Specifies a margin in px, pt, cm, etc. Default value is 0px');
        $block->admin_input('margin-bottom', "text", 'Bottom', '', 'Specifies a margin in px, pt, cm, etc. Default value is 0px');
        $block->admin_input('margin-left', "text", 'Left', '', 'Specifies a margin in px, pt, cm, etc. Default value is 0px');
        ?>
			                </div>

			                <div class="tab-pane" id="padding" >
			                	<?php 
        $block->admin_input('padding-top', "text", 'Top', '', 'Defines a fixed padding (in pixels, pt, em, etc.)');
        $block->admin_input('padding-right', "text", 'Right', '', 'Defines a fixed padding (in pixels, pt, em, etc.)');
        $block->admin_input('padding-bottom', "text", 'Bottom', '', 'Defines a fixed padding (in pixels, pt, em, etc.)');
        $block->admin_input('padding-left', "text", 'Left', '', 'Defines a fixed padding (in pixels, pt, em, etc.)');
        ?>
			                </div>
			            	

			              </div>
			            </div>
					</div>
					<div class="tab-pane" id="border">
			  			<?php 
        $block->admin_input("border_override", "checkbox", "Enable");
        $block->admin_select('border-style', array("none" => "None", "hidden" => "Hidden", "dotted" => "Dotted", "dashed" => "Dashed", "solid" => "Solid", "double" => "Double", "groove" => "Groove", "ridge" => "Ridge", "inset" => "Inset", "outset" => "Outset", "initial" => "Initial", "inherit" => "Inherit"), 'Border');
        $block->admin_input('border-width', "text", 'Width', '', 'Default value is 0px');
        $block->admin_color_picker("border-color", "Color");
        ?>
					</div>
					<div class="tab-pane" id="font">
			  			<?php 
        $block->admin_input("font-color_override", "checkbox", "Enable");
        $block->admin_color_picker("color", "Color");
        $block->admin_input("font-size", "text", "Font Size", '', 'Font size in pixels. (Example 10px)');
        $block->admin_select('font-family', array("Times New Roman" => "Times New Roman", "Arial" => "Arial", "Verdana" => "Verdana"), 'Family');
        $block->admin_select('font-family-2', array("sans-serif" => "Sans-Serif", "serif" => "Serif", "cursive" => "Cursive", "fantasy" => "Fantasy", "monospace" => "Monospace"), 'Type');
        $block->admin_select('font-weight', array("normal" => "Normal", "bold" => "Bold", "bolder" => "Bolder", "lighter" => "Lighter", "100" => "100", "200" => "200", "300" => "300", "400" => "400", "500" => "500", "600" => "600", "700" => "700", "800" => "800", "900" => "900", "inherit" => "Inherit"), 'Weight');
        ?>
					</div>
					<div class="tab-pane" id="background">
						<div class="tabbable tabs-left">
			              <ul class="nav nav-tabs" id="slider-settings">
			                <li class="active"><a href="#bg-color" data-toggle="tab">Color</a></li>
			                <li><a href="#bg-image" data-toggle="tab">Image</a></li>
			              </ul>
			              <div class="tab-content" id="" style="height: 240px; overflow-y: scroll">
			                <div class="tab-pane active" id="bg-color" >
			                	<?php 
        $block->admin_input("background-color_override", "checkbox", "Enable");
        $block->admin_color_picker("background-color", "Color");
        ?>
			                </div>

			                <div class="tab-pane" id="bg-image" >
								<?php 
        $block->admin_input("background-image_override", "checkbox", "Enable");
        $block->admin_file('background-image', 'Image: ');
        $block->admin_select('background-repeat', array("repeat" => "Repeat", "repeat-x" => "Repeat-X", "repear-y" => "Repeat-Y", "no-repeat" => "No-Repeat", "initial" => "Initial", "inherit" => "Inherit"), 'Repeat: ');
        ?>
			                </div>
			            	

			              </div>
			            </div>
					</div>
					<div class="tab-pane" id="custom">

						<?php 
        $block->admin_input("custom_classes", "text", "Classes");
        $block->admin_textarea('custom', "CSS");
        if ($block->name == "be_body_styler_" . $this->BuilderEngine->get_option('active_frontend_theme')) {
            $block->admin_textarea('custom_code', "Code");
        }
        ?>
					</div>

				</div>
			</div>

<?php 
        echo '

    			<div class=\\"control-group\\">
	            	<div class=\\"controls controls-row\\">
	            		<input id="block-admin-save" type="submit" class="btn btn-primary" value="Save">
            		</div>
            	</div>
	            		';
        echo '</form></div>';
    }
Ejemplo n.º 13
0
 public function initialize($db_result)
 {
     PC::debug($db_result, 'block::initialize');
     //print_r($db_result);
     //echo debug_print_backtrace();
     $this->id = $db_result->id;
     $this->data = json_decode($db_result->data, true);
     $this->global = $db_result->global == 'yes';
     $this->type = $db_result->type;
     $this->html = $this->data('html');
     $this->blocks = array();
     foreach ($db_result->children as $child_name) {
         $child = new Block($child_name);
         $this->add_block($child);
         $child->load();
     }
 }
Ejemplo n.º 14
0
    require_once APPPATH . "classes/Controller/Widgets/{$controller}.php";
    eval('
					        	$module = new Controller_Widgets_' . $controller . '($request, $response); // Подключаем контроллер
					        	$module->action_' . $current_action . '(); // Вызываем текущий экшен
					        ');
    // Получаем конфиг виджета
    $module->get_config();
    $module_config = $module->module_config;
    PC::debug($module_config, "Config виджета");
    $module_controller_options = $module_config["options"];
    // Опции виджета из контроллера
    $module_db_options = json_decode($module_data['options'], true);
    // Опции виджета из БД
    PC::debug($module_data, "Все настройки виджета");
    PC::debug($module_controller_options, "Опции виджета из контроллера");
    PC::debug($module_db_options, "Опции виджета из БД");
    ?>

								<div class="row">
									<div class="col-lg-5">
										<p class="text-primary">Action</p>
									</div>
									<div class='col-lg-7'>
										<input type="hidden" value="<?php 
    echo $current_action;
    ?>
">
										<select class="form-control input-sm action_change" name="action_name">
											<option value="<?php 
    echo $current_action;
    ?>
Ejemplo n.º 15
0
        			$tr_style = ' style="border-left: 6px solid #f1e450;"';
        		break;
        		case '4':
        			$tr_style = ' style="border-left: 6px solid #5090fa;"';
        		break;*/
        case '5':
            $tr_style = ' style="border-left: 6px solid #fc2323;"';
            break;
        case '6':
            $tr_style = ' style="border-left: 6px solid #000;"';
            break;
    }
    ?>

					<?php 
    PC::debug($order_data["name"]);
    ?>

					<tr<?php 
    echo $tr_style;
    ?>
>

						<td><input type="checkbox" form='list-action' name="check_name[]" class="checkbox" value="$order_id" form="change_form">

						<?php 
    // if ($order_data['name']):
    ?>
							<td><a href="/admin/orders/<?php 
    echo $order_id;
    ?>
Ejemplo n.º 16
0
 public function action_finish()
 {
     $email_config = Kohana::$config->load("email");
     $owner_emails = array("*****@*****.**");
     $owner_pushall_ids = array(8189);
     $owner_icq_uins = array(673151743);
     $model_base = new Model_Base();
     $options = $model_base->getOptions();
     $url = URL::base() . 'admin/orders/' . $_POST["order_id"];
     // Ссылка на заказ
     $sitename = $options['sitename'];
     // Название сайта
     $icon_url = URL::base() . '/img/pushall_icon.jpg';
     $title = "Вам поступил заказ в интернет-магазине \"{$sitename}\"!";
     $text = "Кликните для выяснения деталей.";
     PC::debug($sitename);
     $pushall_options = array("type" => 'unicast', "title" => $title, "text" => $text, "url" => $url, "icon" => $icon_url, "priority" => 1);
     // --- Обновление БД -----------------------------------------------------------------------
     // Регистрация пользователя
     $model_user = new Model_User();
     $email = Arr::get($_POST, 'email');
     $user = $model_user->getUser($email);
     // Пользователь не зарегистрирован
     if (!$user) {
         $user_data["username"] = $email;
         $user_data["pass"] = $model_user->generate_pass();
         $user_data["role"] = 4;
         $user_data["name"] = Arr::get($_POST, 'name');
         $user_data["phone"] = Arr::get($_POST, 'phone');
         $add_user_id = $model_user->addUser($user_data);
         $user = $model_user->getUser($email);
     }
     // Регистрация заказа
     $order_params = array("name", "phone", "email", "order_id", "delivery_type", "street", "house", "apartment", "access", "floor", "date", "delivery_time", "delivery_point", "comment", "payment_type", "payment_comment", "user_id");
     $order_data = array();
     foreach ($order_params as $param) {
         $order_data[$param] = Arr::get($_POST, $param);
     }
     $order_data["user_id"] = $user['id'];
     $model_orders = new Model_Orders();
     $model_orders->finishOrder($order_data);
     $model_email = new Model_Email();
     $model_email->addSubscriber($order_data["email"], $order_data["name"]);
     // --- /Обновление БД ----------------------------------------------------------------------
     // --- Отправка уведомлений ----------------------------------------------------------------
     include APPPATH . '/classes/Pushes.class.php';
     $pushes = new Pushes();
     // Уведомление в браузер
     foreach ($owner_pushall_ids as $owner_pushall_id) {
         $pushes->pushall_send(array_merge($pushall_options, array("uid" => $owner_pushall_id)), 'get');
     }
     // Уведомление в аську
     foreach ($owner_icq_uins as $owner_icq_uin) {
         $pushes->icq_send($owner_icq_uin, "Вам поступил заказ в интернет-магазине!\n\tПодробнее: " . $url);
     }
     // Отправка почты
     //$subject = 'Поступила заявка с сайта ' . $sitename . ' от ' .$order_data['name'];
     $subject = 'Поступила заявка с сайта ' . '"' . $sitename . '"';
     $from = $email_config['options']['username'];
     $message = '<h2>Новая заявка</h2>';
     $message .= 'Отправитель: <b>' . $order_data['name'] . ', </b><br>';
     $message .= 'Тел: <b>' . $order_data['phone'] . ', </b><br>';
     $message .= '<em>Отправлено: ' . date("d.m.Y H:i:s") . '</em>';
     $message .= '<p><a href="' . $url . '">Подробнее</a></p>';
     foreach ($owner_emails as $owner_email) {
         $pushes->mail_send($owner_email, $from, $subject, $message);
     }
     $model = array("order_id" => $order_data["order_id"]);
     // Подключение шаблона
     $this->set_template('widgets/w_success_ordering.php')->render($model)->body();
     // --- /Отправка уведомлений ---------------------------------------------------------------
 }
Ejemplo n.º 17
0
 /**
  * Builds the html data for the function calls trace
  */
 protected static function _buildTraceData()
 {
     if (static::$_options['trace_functions']) {
         if (!empty(static::$_finalTraceData)) {
             for ($a = 0; $a < sizeof(static::$_finalTraceData); $a++) {
                 $data = static::$_finalTraceData[$a];
                 // this is just a patch
                 $data = array_unique($data, SORT_REGULAR);
                 //$data = array_map( 'unserialize' , array_unique( array_map( 'serialize' , $data ) ) );
                 @($div .= '<span><b>Trace ' . ($a + 1) . ' result: ');
                 $div .= '<a href="#" onclick="ptc_show_trace_table(\'jsLive-' . $a . '\' , this );return false;">';
                 $div .= sizeof($data) . ' calls &dArr;</a></b></span>';
                 $div .= '<table border="1" style="width:100%;display:none" class="msgTable jsLive-' . $a . '" id="logTable">';
                 $div .= '<tbody><tr><th>#</th><th>function</th><th>file</th>';
                 $div .= '<th>line</th><!--<th>memory</th>--><th>called by</th><th>in</th></tr>';
                 $i = 1;
                 foreach ($data as $k => $v) {
                     $link = @$v['file'] ? static::_buildTraceLink($v['file'], @$v['line']) . $v['file'] . '</a>' : '';
                     $args = @$v['args'] ? @preg_replace('/Array/', '', @static::_formatVar($v['args']), 1) : '( )';
                     $called_by_args = @$v['called_by_args'] ? @preg_replace('/Array/', '', @static::_formatVar($v['called_by_args']), 1) : '';
                     if (!$called_by_args && @$v['called_by']) {
                         @($v['called_by'] = @$v['called_by'] . '( )');
                     }
                     $in = @$v['in'] ? static::_buildTraceLink($v['in'], @$v['on_line']) . $v['in'] : '';
                     $in .= @$v['on_line'] ? ': ' . $v['on_line'] : '';
                     $in .= @$v['in'] ? '</a>' : '';
                     $div .= '<tr class="general">';
                     $div .= '<td class="fixed"><div style="color:black;"># ' . $i . '</div></td>';
                     $div .= '<td class="fixed"><div style="color:darkred;font-weight:bold;">';
                     $div .= $v['function'] . $args . '</div></td>';
                     $div .= '<td class="fixed">' . $link . '</td>';
                     $div .= '<td class="fixed"><div style="color:black;font-weight:bold;">';
                     $div .= @$v['line'] . '</div></td>';
                     //$div .= '<td class="fixed"><div style="color:green;font-weight:bold;">';
                     //$div .= @static::convertMemUsage( $v[ 'memory' ] ) . '</div></td>';
                     $div .= '<td class="fixed"><div style="color:purple;font-weight:bold;">';
                     $div .= @$v['called_by'] . $called_by_args . '</div></td>';
                     $div .= '<td class="fixed">' . $in . '</td>';
                     $div .= '</tr>';
                     $i++;
                 }
                 $div .= '</tbody></table><br>';
                 if (static::$_consoleStarted) {
                     \PC::debug($data, static::$_options['default_category'] . '.traceResult ' . ($a + 1));
                 }
             }
             //static::$_finalTraceData = array( );
         } else {
             $div .= '<span class="vars">no data available</span><br>';
         }
     } else {
         $div .= '<span class="vars">';
         $div .= 'Functions calls tracing is disabled! To use this feature, ';
         $div .= 'set the option [\'trace_functions\'] to \'true\' or \'full\'!';
         $div .= '</span><br>';
     }
     return $div;
 }
Ejemplo n.º 18
0
Archivo: Qiniu.php Proyecto: wuxw/YYF
 /**
  * 七牛操作
  * @method opration
  * @param  string   $op [操作命令]
  * @return bool     	[操作结果]
  * @author NewFuture
  */
 private static function opration($op)
 {
     $token = self::sign($op . PHP_EOL);
     $url = self::QINIU_RS . $op;
     $header = array('Authorization: QBox ' . $token);
     if (($response = Api::connect($url, $header, 'POST')) && $response['header'][0] == 'HTTP/1.1 200 OK') {
         return true;
     } else {
         /*操作出错*/
         if (\Config::get('isdebug')) {
             \PC::debug($response, '七牛请求出错');
         }
         \Log::write('七牛错误' . $url . ':' . json_encode($response, JSON_UNESCAPED_UNICODE), 'ERROR');
         return false;
     }
 }
Ejemplo n.º 19
0
function b()
{
    PC::debug('Message with source & trace detection');
}
Ejemplo n.º 20
0
 /**
  * @deprecated use log($value, true) instead
  */
 public function logTrace($value)
 {
     PC::getConnector()->getDebugDispatcher()->detectTraceAndSource = true;
     PC::debug($value);
     PC::getConnector()->getDebugDispatcher()->detectTraceAndSource = false;
 }
    protected function method1($a, $b)
    {
        $this->method2('some long string argument');
    }
    public function method2($c)
    {
        file_get_contents('not_existed.file');
        // E_WARNING error
    }
}
new ErrorTestClass();
// Trigger JavaScript error
echo '<script type="text/javascript">alert(undefinedVar);</script>';
// Debug some data
class DebugExample
{
    private $privateProperty = 1;
    protected $protectedProperty = 2;
    public $publicProperty = 3;
    public $selfProperty;
    public function __construct()
    {
        $this->selfProperty = $this;
    }
    public function someMethod()
    {
    }
}
PC::debug(array('null' => null, 'boolean' => true, 'longString' => '11111111112222222222333333333344444444445', 'someObject' => new DebugExample(), 'someCallback' => array(new DebugExample(), 'someMethod'), 'someClosure' => function () {
}, 'someResource' => fopen(__FILE__, 'r'), 'manyItemsArray' => array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11), 'deepLevelArray' => array(1 => array(2 => array(3)))), 'some.test');
echo !$connector->isAuthorized() ? 'To access eval terminal you need to authorize. Click on PHP Console "key" icon in address bar and enter the password.' : 'See errors & debug data in JavaScript Console(Ctrl+Shift+J).<br/>Click on PHP Console terminal icon in address bar to access eval terminal and try to execute some PHP code.';
Ejemplo n.º 22
0
 /**
  * 七牛操作
  * @method opration
  * @param  string   $op [操作命令]
  * @return bool     	[操作结果]
  * @author NewFuture
  */
 private static function opration($op, $data = null, $host = self::QINIU_RS)
 {
     $token = self::sign(is_string($data) ? $op . "\n" . $data : $op . "\n");
     $url = $host . $op;
     $header = array('Authorization: QBox ' . $token);
     if ($ch = curl_init($url)) {
         curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
         curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
         curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
         if ($data) {
             curl_setopt($ch, CURLOPT_POST, true);
             curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
         }
         curl_setopt($ch, CURLOPT_HEADER, 1);
         $response = curl_exec($ch);
         $status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
         curl_close($ch);
         if ($status == 200) {
             return true;
         } elseif (\Config::get('isdebug')) {
             /*操作出错*/
             \PC::debug($response, '七牛请求出错');
         }
     }
     \Log::write('[QINIU]七牛错误' . $url . ':' . ($response ?: '请求失败'), 'ERROR');
     return false;
 }
Ejemplo n.º 23
0
 public function debug($model)
 {
     $this->parse_model($model);
     PC::debug($this->model, 'parse model');
 }
Ejemplo n.º 24
0
 public function load_block($block)
 {
     if (empty(self::$page_block)) {
         PC::debug('Block not found!');
         //return $this->load_block_directly($block);
     }
     //print_r(self::$page_block);
     if (array_key_exists($block->name, self::$page_block)) {
         $block->initialize(self::$page_block[$block->name]);
         return true;
     } else {
         return FALSE;
     }
 }
Ejemplo n.º 25
0
 public function action_registration()
 {
     // Уже авторизован
     if (Auth::instance()->logged_in()) {
         HTTP::redirect("/user/cabinet");
     }
     $model = array();
     // Обработка формы
     if ($_POST) {
         $vData = $_POST;
         $validation = Validation::factory($vData);
         $validation->rule('email', 'not_empty');
         $validation->rule('email', 'min_length', array(':value', '2'));
         $validation->rule('email', 'max_length', array(':value', '250'));
         $validation->rule('password', 'not_empty');
         $validation->rule('password', 'min_length', array(':value', '6'));
         $validation->rule('password', 'max_length', array(':value', '50'));
         $validation->rule('password', 'equal_fields', array(':value', $vData['password_confirm']));
         // не прошёл валидацию
         if (!$validation->check()) {
             $errors = $validation->errors('registrationErrors');
             $model = array("error" => "");
             PC::degug($errors, "errors");
             foreach ($errors as $error) {
                 $model["error"] .= '<div class="alert alert-danger"><p>' . $error . '</p></div>';
             }
         } else {
             $email = Arr::get($_POST, 'email', '');
             $password = Arr::get($_POST, 'password', '');
             $confirm_pass = Arr::get($_POST, 'password_confirm', '');
             $model_register = new Model_Register();
             PC::debug($_POST, "registration form");
             // Регистрация прошла успешно
             if ($model_register->reg($email, $password, 4)) {
                 $model = array("success" => '<div class="alert alert-success">Спасибо за регистрацию! На электронный адрес <b>' . $email . '</b> отправлено письмо для активации аккаунта.</div>');
             } else {
                 $errors = $model_register->errors;
                 $model = array("error" => "");
                 foreach ($errors as $error) {
                     $model["error"] .= '<div class="alert alert-danger"><p>' . $error . '</p></div>';
                 }
             }
         }
     }
     $this->title('Регистрация');
     $this->page_title('Регистрация');
     $this->keywords('Регистрация');
     $this->description('Регистрация');
     $this->render('user/cabinet/registration.php', $model, "response");
 }
Ejemplo n.º 26
0
 public function getWidgets($categoryId, $page = '')
 {
     $category = new Model_Category('tree');
     $widgets = $category->getWidgets($categoryId);
     $wdgtarr = array();
     $positions = $category->getWidgetPositions();
     foreach ($positions as $position) {
         if ($this->template->{$position}['position'] != NULL) {
             $oldWidgets = $this->template->{$position}['position'];
             foreach ($oldWidgets as $oldWidget) {
                 $wdgtarr[$position['position']][] = $oldWidget;
             }
         }
     }
     foreach ($widgets as $widget) {
         PC::debug($widget);
         //Виджеты
         if ($widget['name'] == 'catalog' || $widget['name'] == 'catalog2') {
             $page1 = $page;
         } else {
             $page1 = '';
         }
         if (is_file('css/' . $widget['name'] . '.less')) {
             array_push($this->styles, 'css/' . $widget['name'] . '.less');
         }
         if (is_file('js/' . $widget['name'] . '.js')) {
             array_push($this->template->scripts, 'js/' . $widget['name'] . '.js');
         }
         $action = Arr::get($widget, 'action', 'index');
         $wdgt = Request::factory('widgets/' . $widget['name'] . '/' . $action . '/' . $widget['param'] . $page1)->execute();
         if (!isset($wdgtarr[$widget['position']])) {
             $wdgtarr[$widget['position']] = array($wdgt);
         } else {
             array_push($wdgtarr[$widget['position']], $wdgt);
         }
     }
     return $wdgtarr;
     //Вывод в шаблон
 }
Ejemplo n.º 27
0
    function block_admin($block_name, $menu = '')
    {
        $page_path = $_GET['page_path'];
        PC::debug("Setting page path to " . $page_path);
        $this->BuilderEngine->set_page_path($page_path);
        $block = new Block($block_name);
        if ($menu == 'styler') {
            $window_name = 'Styling';
        } else {
            $window_name = 'Settings';
        }
        $block->load();
        PC::debug($block, "ajax::block_admin");
        if (isset($_POST['block_save'])) {
            foreach ($_POST as $key => $value) {
                $block->set_data($key, $value, true);
            }
            $block->save();
        }
        echo '
				<script src="' . base_url('/builderengine/public/js/jquery.js') . '"></script>
				<link href="' . base_url('/themes/dashboard/assets/plugins/font-awesome-4.2.0/css/font-awesome.min.css') . '" rel="stylesheet">
				<link href="' . base_url('/modules/layout_system/views/block_settings_popup_custom.css') . '" rel="stylesheet" />
				<script src="' . base_url('/builderengine/public/js/bootstrap.js') . '"></script> <!-- Bootstrap -->
    			<script>
    			var site_root = "' . home_url("") . '";
    			$(document).ready(function () {
    				$("#block-admin-save").click(function (event){
    					$("#block-admin-save").html("Saving...");
    					$.ajax( {
					        url: site_root + "/index.php/layout_system/ajax/block_admin/' . $block_name . '?page_path=' . $page_path . '",
					        async: false,
					        type: "post",          
					        data: $("#block-admin-form").serialize(),
					    }).fail(function (data){alert(console.log(data))});
					    window.top.notifyChange();
						window.parent.reload_block(\'' . $block_name . '\', window.parent.page_path, true);
						$("#admin-window").remove();

					event.preventDefault();
						
    				});
				});
    			</script>
				<script src="' . base_url('/themes/dashboard/assets/plugins/file_manager.js') . '"></script>
    		';
        echo '<div style="padding-left:25px; padding-right:25px">
    		<h4 style="margin-left: -17px !important;margin-bottom: 30px;color: #fff;"><i class="fa fa-cogs" style="color: #fff;font-size: 18px;padding-right: 6px;"></i>' . str_replace('_', ' ', ucfirst($block->type)) . ' ' . $window_name . '</h4>


    		<form class="form-horizontal" id="block-admin-form" method="post">
    		<input type="hidden" name="block_save" name="">
    		<input type="hidden" name="page_path" value="' . $page_path . '">';
        if ($menu == 'styler') {
            $block->generate_admin('styler');
        } else {
            $block->generate_admin();
        }
        echo '

    			<div class=\\"control-group\\" style="float:right; margin-top:20px;margin-right: -15px;">
	            	<div class=\\"controls controls-row\\">
	            		<input id="block-admin-save" type="submit" class="btn btn-primary" value="Save Changes">
            		</div>
            	</div>
	            		';
        echo '</form></div>';
    }
Ejemplo n.º 28
0
 public function action_general()
 {
     $this->setopt(array("name" => "parent_id", "description" => "Ид каталога", "default" => 4));
     $parent_id = $this->getopt("parent_id");
     $model = array("modules" => array(), "visible" => array(), "menu" => array());
     $model["modules"]["cart_widget"] = Request::factory('widgets/cart/index')->execute();
     //$model["modules"]["cart"] = Request::factory('widgets/cart/index')->execute();
     $model["visible"]["auth_but"] = false;
     $model["visible"]["registration_but"] = false;
     $create_dropdown = true;
     // Создавать выпадающее меню?
     $uri = Request::detect_uri();
     $page_uri = explode('/', $uri);
     $GLOBALS['uri'] = $page_uri;
     $uri = isset($page_uri[1]) ? $page_uri[1] : '';
     $uri2 = isset($page_uri[2]) ? $page_uri[2] : '';
     $model_tree = new Model_Widgets_Menu('tree');
     $items = array();
     $items[] = array("id" => 0, "level" => 2, "name" => "Главная", "url" => "");
     //Получаем список меню
     $items = array_merge($items, $model_tree->menuItems($parent_id, 2));
     if ($create_dropdown) {
         $model["dropdowns"] = array();
     }
     foreach ($items as $key => $mitem) {
         // Добавление пунктов основного меню
         if ($mitem['level'] == 2) {
             $mitem_data = array("href" => '/' . $mitem['url'], "id" => $mitem['id'], "name" => $mitem['name']);
             if ($mitem['url'] == $uri) {
                 $mitem_data["selected"] = " selected";
             }
             if ($create_dropdown) {
                 // Есть дополнительные пункты
                 if (isset($mitem['left_key']) && isset($mitem['right_key'])) {
                     if ($mitem['left_key'] + 1 !== $mitem['right_key']) {
                         $dropdown_box = array("id" => $mitem["id"], "col1" => array(), "col2" => array(), "col3" => array(), "col4" => array());
                         $submenu = $model_tree->menuItems($mitem["id"], 3);
                         $col_n = 1;
                         $col_count = ceil(count($submenu) / 2);
                         $counter = 0;
                         foreach ($submenu as $dropdown_item) {
                             $dropdown_box["col" . $col_n][] = array("href" => '/' . $dropdown_item['parent'] . '/' . $dropdown_item['url'], "name" => $dropdown_item['name'], "id" => $mitem["id"]);
                             if ($counter == $col_count - 1) {
                                 $col_n++;
                             }
                             $counter++;
                         }
                         if (count($submenu) !== 0) {
                             $model["dropdowns"][$mitem["id"]] = $dropdown_box;
                         }
                     }
                 }
             }
             $model["menu"][] = $mitem_data;
         }
     }
     PC::debug($model, "model");
     $this->set_template("widgets/menu/general.php", "twig")->render($model)->body();
 }
<?php

require_once __DIR__ . '/../../src/PhpConsole/__autoload.php';
\PhpConsole\OldVersionAdapter::register();
// register PhpConsole class emulator
// Call old PhpConsole v1 methods as is
PhpConsole::start(true, true, $_SERVER['DOCUMENT_ROOT']);
PhpConsole::debug('Debug using old method PhpConsole::debug()', 'some,tags');
debug('Debug using old function debug()', 'some,tags');
echo $undefinedVar;
PhpConsole::getInstance()->handleException(new Exception('test'));
// Call new PhpConsole methods, if you need :)
\PhpConsole\Connector::getInstance()->setServerEncoding('cp1251');
\PhpConsole\Helper::register();
PC::debug('Debug using new methods');
echo 'So there is an easy way to migrate from PhpConsole v1.x to v3.x without any code changes';
Ejemplo n.º 30
0
 public function action_cart()
 {
     /* Добавление товара в корзину
     					$data:
     							$item_id* - id товара
     							$item_count* - кол-во товара
     							$order_id - id заказа
     			*/
     $methods['add_item'] = function ($data) {
         PC::debug($data, 'add item data');
         $model_orders = new Model_Orders();
         $materials = new Model_Material('groups');
         // Добавление товара к существующему заказу
         if (isset($data['order_id'])) {
             PC::debug(1, 1);
             $res = $model_orders->addGood(Arr::get($data, 'order_id'), Arr::get($data, 'item_id'), Arr::get($data, 'item_count'));
         } else {
             PC::debug(2, 1);
             $item_count = Arr::get($data, 'item_count');
             $res = $model_orders->newOrder(Arr::get($data, 'item_id'), $item_count);
             $new_count = $item_count;
         }
         $material = $materials->getMaterial(Arr::get($data, 'item_id'));
         $fields = $materials->getFields2(Arr::get($data, 'item_id'), TRUE);
         $catalog = new Model_Category('tree');
         $categoryId = $materials->getTreeIdByMid(Arr::get($data, 'item_id'));
         $parents = $catalog->getParents($categoryId);
         $node = '';
         foreach ($parents as $parent) {
             if ($parent['level'] > 1 && $parent['url'] != 'glavnaya') {
                 $node .= $parent['url'] . '/';
             }
         }
         $itemdata = $model_orders->getOrderCount(Arr::get($data, 'order_id'), Arr::get($data, 'item_id'));
         $item[Arr::get($data, 'item_id')] = array_merge($material, $fields);
         if (isset($new_count)) {
             $item[Arr::get($data, 'item_id')]['cnt'] = $new_count;
         } else {
             $item[Arr::get($data, 'item_id')]['cnt'] = $itemdata['cnt'];
         }
         $item[Arr::get($data, 'item_id')]['node'] = $node;
         return array('order_id' => $res, 'item' => $item);
     };
     /* Удаление товара из корзины
     					$data:
     							$order_id* - id заказа
     							$item_id* - id товара
     							$item_count* - кол-во товара
     			*/
     $methods['del_item'] = function ($data) {
         $model_orders = new Model_Orders();
         extract($data);
         // Удаление товара из корзины
         $res = $model_orders->deleteItem(Arr::get($data, 'order_id'), Arr::get($data, 'item_id'), Arr::get($data, 'item_count'));
         return $res;
     };
     /* Получение информации о заказе
     				$data:
     					$order_id* - id заказа
     			*/
     $mathods['get_order'] = function ($data) {
         $model_orders = new Model_Orders();
         $order_data = $model_orders->getOrder($data['order_id']);
         return $order_data;
     };
     /* Удаление заказа
     				$data:
     					$order_id* - id заказа
     			*/
     $mathods['del_order'] = function ($data) {
         PC::debug($data, 'del_order');
         $model_orders = new Model_Orders();
         $res = $model_orders->deleteOrder($data['order_id']);
         return $res;
     };
     /* Получение информации о заказе
     				$data:
     					$order_id* - id заказа
     			*/
     $methods['get_items'] = function ($data) {
         $model_orders = new Model_Orders();
         //extract($data);
         $res = $model_orders->getOrder(Arr::get($data, 'order_id', ''));
         return $res;
     };
     $data = Arr::get($_POST, 'data', '');
     if ($data == '') {
         $data = Arr::get($_GET, 'data', '');
     }
     extract(json_decode($data, true));
     $res = false;
     if (isset($methods[$method])) {
         $res = $methods[$method]($data);
         PC::debug($res, 'Ajax: "' . $method . '"');
     }
     exit(json_encode($res));
 }