コード例 #1
0
 public function index()
 {
     $is_installed = mw_is_installed();
     if (!$is_installed) {
         if (!$is_installed) {
             $installer = new InstallController();
             return $installer->index();
         }
     } else {
         if (defined('MW_VERSION')) {
             $config_version = Config::get('microweber.version');
             if ($config_version != MW_VERSION) {
                 $this->app->update->post_update(MW_VERSION);
             }
         }
     }
     if (!defined('MW_BACKEND')) {
         define('MW_BACKEND', true);
     }
     //create_mw_default_options();
     mw()->content_manager->define_constants();
     if (defined('TEMPLATE_DIR')) {
         $load_template_functions = TEMPLATE_DIR . 'functions.php';
         if (is_file($load_template_functions)) {
             include_once $load_template_functions;
         }
     }
     event_trigger('mw.admin');
     event_trigger('mw_backend');
     $view = modules_path() . 'admin/';
     $hasNoAdmin = User::where('is_admin', 1)->limit(1)->count();
     if (!$hasNoAdmin) {
         $this->hasNoAdmin();
     }
     $view .= (!$hasNoAdmin ? 'create' : 'index') . '.php';
     $layout = new View($view);
     $layout = $layout->__toString();
     $layout = mw()->parser->process($layout);
     event_trigger('on_load');
     $layout = execute_document_ready($layout);
     event_trigger('mw.admin.header');
     $apijs_loaded = mw()->template->get_apijs_url();
     $apijs_settings_loaded = mw()->template->get_apijs_settings_url();
     $default_css = '<link rel="stylesheet" href="' . mw_includes_url() . 'default.css" type="text/css" />';
     if (!stristr($layout, $apijs_loaded)) {
         $rep = 0;
         $default_css = $default_css . "\r\n" . '<script src="' . $apijs_settings_loaded . '"></script>' . "\r\n";
         $default_css = $default_css . "\r\n" . '<script src="' . $apijs_loaded . '"></script>' . "\r\n";
         $layout = str_ireplace('<head>', '<head>' . $default_css, $layout, $rep);
     }
     $template_headers_src = mw()->template->admin_head(true);
     if ($template_headers_src != false and $template_headers_src != '') {
         $layout = str_ireplace('</head>', $template_headers_src . '</head>', $layout, $one);
     }
     return $layout;
 }
コード例 #2
0
ファイル: settings.php プロジェクト: hyrmedia/microweber
.avatartype-mysteryman {
    background: url(<?php 
print mw_includes_url();
?>
img/avatars.jpg) no-repeat;
}
.avatartype-randomcolor {
	background: #9F41AA;
	transition: background-color 0.2s;
	-moz-transition: background-color 0.2s;
	-webkit-transition: background-color 0.2s;
	-o-transition: background-color 0.2;
}
.avatartype-mwuser {
    background: url(<?php 
print mw_includes_url();
?>
img/avatars.jpg) no-repeat 0 -70px;
}
.avatartype-upload {
	width:30px;
	height: 30px;
	border: 1px solid #CACACA;
	background-repeat: no-repeat;
	background-size: cover;
    background-image: url(<?php 
print get_option('avatartype_custom', 'comments');
?>
);
}
.avatars-holder {
コード例 #3
0
 public function editor_tools()
 {
     if (!defined('IN_ADMIN') and is_admin()) {
         define('IN_ADMIN', true);
     }
     if (!defined('IN_EDITOR_TOOLS')) {
         define('IN_EDITOR_TOOLS', true);
     }
     if (mw_is_installed() == true) {
         //event_trigger('mw_db_init');
         //  event_trigger('mw_cron');
     }
     $tool = $this->app->url_manager->segment(1);
     if ($tool) {
     } else {
         $tool = 'index';
     }
     $page = false;
     if (isset($_REQUEST['content_id'])) {
         if (intval($_REQUEST['content_id']) == 0) {
             $this->create_new_page = true;
             $custom_content_data_req = $_REQUEST;
             $custom_content_data = array();
             if (isset($custom_content_data_req['content_type'])) {
                 //    $custom_content_data['content_type'] = $custom_content_data_req['content_type'];
             }
             if (isset($custom_content_data_req['content_type'])) {
                 $custom_content_data['content_type'] = $custom_content_data_req['content_type'];
             }
             if (isset($custom_content_data_req['subtype'])) {
                 $custom_content_data['subtype'] = $custom_content_data_req['subtype'];
             }
             if (isset($custom_content_data_req['parent_page']) and is_numeric($custom_content_data_req['parent_page'])) {
                 $custom_content_data['parent'] = intval($custom_content_data_req['parent_page']);
             }
             if (isset($custom_content_data_req['preview_layout'])) {
                 //  $custom_content_data['preview_layout'] =($custom_content_data_req['preview_layout']);
             }
             if (!empty($custom_content_data)) {
                 $custom_content_data['id'] = 0;
                 $this->content_data = $custom_content_data;
             }
             $this->return_data = 1;
             $page = $this->frontend();
         } else {
             $page = $this->app->content_manager->get_by_id($_REQUEST['content_id']);
         }
     } elseif (isset($_SERVER['HTTP_REFERER'])) {
         $url = $_SERVER['HTTP_REFERER'];
         $url = explode('?', $url);
         $url = $url[0];
         if (trim($url) == '' or trim($url) == $this->app->url_manager->site()) {
             //$page = $this->app->content_manager->get_by_url($url);
             $page = $this->app->content_manager->homepage();
         } else {
             $page = $this->app->content_manager->get_by_url($url);
         }
     } else {
         $url = $this->app->url_manager->string();
     }
     if (!isset($page['active_site_template'])) {
         $page['active_site_template'] = 'default';
     }
     if (isset($_GET['preview_template'])) {
         $page['active_site_template'] = $_GET['preview_template'];
     }
     if (isset($_GET['content_type'])) {
         $page['content_type'] = $_GET['content_type'];
     }
     if (isset($_GET['preview_layout']) and $_GET['preview_layout'] != 'inherit') {
         $page['layout_file'] = $_GET['preview_layout'];
     }
     $this->app->content_manager->define_constants($page);
     $page['render_file'] = $this->app->template->get_layout($page);
     if (defined('TEMPLATE_DIR')) {
         $load_template_functions = TEMPLATE_DIR . 'functions.php';
         if (is_file($load_template_functions)) {
             include_once $load_template_functions;
         }
     }
     $params = $_REQUEST;
     $tool = str_replace('..', '', $tool);
     $p_index = mw_includes_path() . 'toolbar/editor_tools/index.php';
     $p_index = normalize_path($p_index, false);
     $standalone_edit = true;
     $p = mw_includes_path() . 'toolbar/editor_tools/' . $tool . '/index.php';
     $standalone_edit = false;
     if ($tool == 'plupload') {
         $standalone_edit = true;
     }
     if ($tool == 'plupload') {
         $standalone_edit = true;
     }
     if ($tool == 'imageeditor') {
         $standalone_edit = true;
     }
     if ($tool == 'rte_image_editor') {
         $standalone_edit = true;
     }
     if ($tool == 'editor_toolbar') {
         $standalone_edit = true;
     }
     if ($tool == 'wysiwyg') {
         $standalone_edit = false;
         $ed_file_from_template = TEMPLATE_DIR . 'editor.php';
         if (is_file($ed_file_from_template)) {
             $p_index = $ed_file_from_template;
         }
         if (isset($page['content_type']) and $page['content_type'] != 'post' and $page['content_type'] != 'page' and $page['content_type'] != 'product') {
             if (isset($page['subtype']) and ($page['subtype'] != 'post' and $page['subtype'] != 'product')) {
                 $standalone_edit = true;
             }
         } elseif (isset($page['content_type']) and $page['content_type'] == 'post') {
             if (isset($page['subtype']) and ($page['subtype'] != 'post' and $page['subtype'] != 'product')) {
                 $standalone_edit = true;
             }
         }
         if ($standalone_edit) {
             if (!isset($page['content'])) {
                 $page['content'] = '<div class="element"></div>';
             }
             $page['content'] = '<div class="edit" field="content" rel="content" contenteditable="true">' . $page['content'] . '</div>';
             $page['render_file'] = false;
         }
         //
         //  $page['content'] = '<div class="edit" field="content" rel="content" contenteditable="true">' . $page['content'] . '</div>';
     }
     $default_css = '';
     $apijs_settings_loaded = '';
     $apijs_loaded = '';
     $p = normalize_path($p, false);
     $l = new \Microweber\View($p_index);
     $l->params = $params;
     $layout = $l->__toString();
     $apijs_loaded = false;
     if ($layout != false) {
         //$apijs_loaded = $this->app->template->get_apijs_url() . '?id=' . CONTENT_ID;
         $apijs_loaded = $this->app->template->get_apijs_url();
         // $apijs_settings_loaded = $this->app->template->get_apijs_settings_url() . '?id=' . CONTENT_ID . '&category_id=' . CATEGORY_ID;
         $apijs_settings_loaded = $this->app->template->get_apijs_settings_url();
         // $is_admin = $this->app->user_manager->is_admin();
         $default_css = '<link rel="stylesheet" href="' . mw_includes_url() . 'default.css" type="text/css" />';
         $headers = event_trigger('site_header', TEMPLATE_NAME);
         $template_headers_append = '';
         $one = 1;
         if (is_array($headers)) {
             foreach ($headers as $modify) {
                 if ($modify != false and is_string($modify) and $modify != '') {
                     $template_headers_append = $template_headers_append . $modify;
                 }
             }
             if ($template_headers_append != false and $template_headers_append != '') {
                 $layout = str_ireplace('</head>', $template_headers_append . '</head>', $l, $one);
             }
         }
         if (function_exists('template_headers_src')) {
             $template_headers_src = template_headers_src();
             if ($template_headers_src != false and $template_headers_src != '') {
                 $layout = str_ireplace('</head>', $template_headers_src . '</head>', $l, $one);
             }
         }
         if (isset($page['active_site_template'])) {
             if ($page['active_site_template'] == '') {
                 $page['active_site_template'] = 'default';
             }
             if ($page['active_site_template'] == 'default') {
                 $active_site_template = $this->app->option_manager->get('current_template', 'template');
             } else {
                 $active_site_template = $page['active_site_template'];
                 if ($active_site_template == 'mw_default') {
                     $active_site_template = 'default';
                 }
             }
             $live_edit_css_folder = userfiles_path() . 'css' . DS . $active_site_template . DS;
             $custom_live_edit = $live_edit_css_folder . DS . 'live_edit.css';
             if (is_file($custom_live_edit)) {
                 $live_edit_url_folder = userfiles_url() . 'css/' . $active_site_template . '/';
                 $custom_live_editmtime = filemtime($custom_live_edit);
                 $liv_ed_css = '<link rel="stylesheet" href="' . $live_edit_url_folder . 'live_edit.css?version=' . $custom_live_editmtime . '" id="mw-template-settings" type="text/css" />';
                 $layout = str_ireplace('</head>', $liv_ed_css . '</head>', $l);
             }
         }
     }
     if (isset($_REQUEST['plain'])) {
         if (is_file($p)) {
             $p = new \Microweber\View($p);
             $p->params = $params;
             $layout = $p->__toString();
             echo $layout;
             return;
         }
     } elseif (is_file($p)) {
         $p = new \Microweber\View($p);
         $p->params = $params;
         $layout_tool = $p->__toString();
         $layout = str_replace('{content}', $layout_tool, $layout);
     } else {
         $layout = str_replace('{content}', 'Not found!', $layout);
     }
     $category = false;
     if (defined('CATEGORY_ID')) {
         $category = $this->app->category_manager->get_by_id(CATEGORY_ID);
     }
     //    $page['render_file'] = $render_file;
     if (!$standalone_edit) {
         if (isset($page['render_file'])) {
             event_trigger('mw.front', $page);
             $l = new \Microweber\View($page['render_file']);
             $l->page_id = PAGE_ID;
             $l->content_id = CONTENT_ID;
             $l->post_id = POST_ID;
             $l->category_id = CATEGORY_ID;
             $l->content = $page;
             $l->category = $category;
             $l->params = $params;
             $l->page = $page;
             $l->application = $this->app;
             $l = $l->__toString();
             //
             //
             //                $render_params = array();
             //                $render_params['render_file'] = $p;
             //                $render_params['page_id'] = PAGE_ID;
             //                $render_params['content_id'] = CONTENT_ID;
             //                $render_params['post_id'] = POST_ID;
             //                $render_params['category_id'] = CATEGORY_ID;
             //                $render_params['page'] = $page;
             //                $render_params['params'] = $params;
             //                $render_params['application'] = $this->app;
             //  $l = $this->app->template->render($render_params);
             if (is_object($l)) {
                 return $l;
             }
             $l = $this->app->parser->process($l, $options = false);
             //                if(isset($page['content']) and $page['content'] != false){
             //
             //                if($page['content'] == ''){
             //                    unset($page['content']);
             //                }
             //                } else {
             //                    $page['content'] = $l;
             //                }
             $editable = $this->app->parser->isolate_content_field($l, true);
             if ($editable != false) {
                 $page['content'] = $editable;
             } else {
                 if ($tool == 'wysiwyg') {
                     $err = 'no editable content region found';
                     if (isset($page['layout_file'])) {
                         $file = $page['layout_file'];
                         $file = str_replace('__', '/', $page['layout_file']);
                         $err = $err . ' in file ' . $file;
                     }
                     if (isset($page['active_site_template'])) {
                         $err = $err . ' (' . $page['active_site_template'] . ' template)';
                     }
                     return $err;
                 }
             }
         }
     }
     if (!stristr($layout, $apijs_loaded)) {
         $rep = 0;
         $default_css = $default_css . "\r\n" . '<script src="' . $apijs_settings_loaded . '"></script>' . "\r\n";
         $default_css = $default_css . "\r\n" . '<script src="' . $apijs_loaded . '"></script>' . "\r\n";
         $layout = str_ireplace('<head>', '<head>' . $default_css, $layout, $rep);
     }
     if (isset($page['content'])) {
         if ($standalone_edit) {
             if (!isset($render_file)) {
                 if (stristr($page['content'], 'field="content"') or stristr($page['content'], 'field=\'content\'')) {
                     $page['content'] = '<div class="edit" field="content" rel="content" contenteditable="true">' . $page['content'] . '</div>';
                 }
             }
         }
         $layout = str_replace('{content}', $page['content'], $layout);
     }
     $layout = mw()->template->process_meta($layout);
     $layout = $this->app->parser->process($layout, $options = false);
     $layout = execute_document_ready($layout);
     $layout = str_replace('{head}', '', $layout);
     $layout = str_replace('{content}', '', $layout);
     echo $layout;
     return;
 }
コード例 #4
0
ファイル: index.php プロジェクト: minhkiller/microweber
<?php

$path = mw_includes_url() . "toolbar/editor_tools/rte_image_editor/";
?>

<script type="text/javascript">
     parent.mw.require("external_callbacks.js");
     mw.require("events.js");
     mw.require("forms.js");
     mw.require("files.js");
     mw.require("tools.js");
     mw.require("url.js");
</script>

<?php 
if (array_key_exists('types', $_GET)) {
    $types = explode(',', $_GET['types']);
} else {
    $types = array('files', 'images', 'videos');
}
?>
<script type="text/javascript">

    var hash = window.location.hash;
    var hash = hash.replace(/#/g, "");

    hash = hash!=='' ? hash : 'insert_html';

    afterMediaIsInserted = function(url, todo, eventType){   /* what to do after image is uploaded (depending on the hash in the url)    */

      if(typeof todo =='undefined'){var todo = false;}
コード例 #5
0
ファイル: index.php プロジェクト: minhkiller/microweber
<?php

$uid = uniqid();
$here = mw_includes_url() . 'toolbar/editor_tools/plupload/';
?>

<script>mw.require('tools.js');</script>
<script>mw.require('url.js');</script>
<script>mw.require('events.js');</script>
<style type="text/css">
    html, body, #container, #pickfiles_<?php 
print $uid;
?>
 {
        position: absolute;
        width: 100%;
        height: 100%;
        top: 0;
        left: 0;
        background: transparent;
    }

    * {
        cursor: pointer;
    }

    .plupload.html5 {
        /* IE does not scales it correctly when visibility is set to hidden  */
        width: 100% !important;
        height: 100% !important;
    }
コード例 #6
0
ファイル: Ui.php プロジェクト: microweber/microweber
 public function __construct()
 {
     $this->admin_logo_login = mw_includes_url() . 'images/logo-login.svg';
     $this->defaults();
 }
コード例 #7
0
ファイル: install.php プロジェクト: microweber/microweber
?>
css/ui.css"/>
    <link type="text/css" rel="stylesheet" media="all" href="<?php 
echo mw_includes_url();
?>
css/admin.css"/>
    <link type="text/css" rel="stylesheet" media="all" href="<?php 
echo mw_includes_url();
?>
css/components.css"/>
    <link type="text/css" rel="stylesheet" media="all" href="<?php 
echo mw_includes_url();
?>
css/install.css"/>
    <script type="text/javascript" src="<?php 
echo mw_includes_url();
?>
api/jquery.js"></script>
    <?php 
$rand = uniqid();
$ua = $_SERVER['HTTP_USER_AGENT'];
$defhost = strpos($_SERVER['HTTP_USER_AGENT'], 'Linux') ? 'localhost' : '127.0.0.1';
?>
    <script type="text/javascript">
        function prefix_add(el) {
            var val = el.value.replace(/ /g, '').replace(/[^\w\s]/gi, '');
            el.value = val;
            if (val != '') {
                var last = val.slice(-1);
                if (last != '_') {
                    el.value = el.value + '_';