function ccenter_com_approve(&$comment)
{
    global $xoopsDB, $xoopsUser, $xoopsModule, $xoopsConfig;
    $msgid = $comment->getVar('com_itemid');
    $res = $xoopsDB->query("SELECT uid, touid, email, onepass, fidref, title, status FROM " . CCMES . ", " . FORMS . " WHERE msgid={$msgid} AND formid=fidref");
    $comid = $comment->getVar('com_id');
    if ($res && $xoopsDB->getRowsNum($res)) {
        $data = $xoopsDB->fetchArray($res);
        $email = $data['email'];
        $s = $data['status'];
        $uid = is_object($xoopsUser) ? $xoopsUser->getVar('uid') : 0;
        $msg = _CC_LOG_COMMENT;
        $status = '';
        // new status
        $now = time();
        $values = array('mtime=' . $now);
        if ($uid && $uid == $data['touid']) {
            // comment by charge
            // status to replyed
            if ($s == _STATUS_ACCEPT) {
                $status = _STATUS_REPLY;
            }
            $msg .= _CC_LOG_BYCHARGE;
        } elseif ($uid == 0 || $uid == $data['uid']) {
            // comment by order person
            // status back to contacting
            if ($s == _STATUS_REPLY || $s == _STATUS_CLOSE) {
                $status = _STATUS_ACCEPT;
            }
            $values[] = 'atime=' . $now;
        }
        if ($status && $status != $s) {
            global $msg_status;
            $msg .= "\n" . sprintf(_CC_LOG_STATUS, $msg_status[$s], $msg_status[$status]);
            $values[] = 'status=' . $xoopsDB->quoteString($status);
        }
        $xoopsDB->query("UPDATE " . CCMES . " SET " . join(',', $values) . " WHERE msgid={$msgid}");
        cc_log_message($data['fidref'], $msg . " (comid={$comid})", $msgid);
        // notification for guest contact
        if (is_object($xoopsUser) && $data['uid'] == 0 && $email) {
            $subj = $data['title'];
            $url = XOOPS_URL . "/modules/" . basename(dirname(__FILE__)) . "/message.php?id={$msgid}&p=" . urlencode($data['onepass']) . "#comment{$comid}";
            $tags = array('X_MODULE' => $xoopsModule->getVar('name'), 'X_ITEM_TYPE' => '', 'X_ITEM_NAME' => $subj, 'X_COMMENT_URL' => $url, 'FROM_EMAIL' => $email, 'SUBJECT' => $subj);
            $xoopsMailer =& getMailer();
            $xoopsMailer->useMail();
            $xoopsMailer->setFromEmail($xoopsConfig['adminmail']);
            $xoopsMailer->setFromName($xoopsModule->getVar('name'));
            $xoopsMailer->setSubject(_MD_NOTIFY_SUBJ);
            $xoopsMailer->assign($tags);
            $tpl = 'guest_notify.tpl';
            $xoopsMailer->setTemplateDir(template_dir($tpl));
            $xoopsMailer->setTemplate($tpl);
            $xoopsMailer->setToEmails($email);
            $xoopsMailer->send();
        }
    }
}
Esempio n. 2
0
function template_file($template, $template_dir = NULL)
{
    if (template_has_absolute_path($template)) {
        $template_dir = '';
    } else {
        $template_dir = template_dir($template_dir, templates_dir(), php_self_dir());
    }
    $template_dir = !empty($template_dir) ? rtrim($template_dir, '/\\') . DIRECTORY_SEPARATOR : $template_dir;
    $template = rtrim($template, '/\\');
    return slashes_to_directory_separator("{$template_dir}{$template}.php");
}
Esempio n. 3
0
function user_notify($eid)
{
    global $xoopsDB, $xoopsConfig;
    $result = $xoopsDB->query("SELECT title,edate,expire,status,topicid FROM " . EGTBL . " WHERE eid={$eid}");
    if (!$result || $xoopsDB->getRowsNum($result) == 0) {
        echo "<div class='error'>Not found Event(eid='{$eid}')</div>\n";
        return;
    }
    $data = $xoopsDB->fetchArray($result);
    $title = $data['title'];
    $edate = $data['edate'];
    $expire = $data['expire'];
    // using XOOPS2 notification system
    if (!$GLOBALS['xoopsModuleConfig']['user_notify'] || ($expire > $edate ? $expire < time() : $edate + $expire < time()) || $data['status'] != STAT_NORMAL) {
        return false;
    }
    $tags = array('EVENT_TITLE' => $title, 'EVENT_DATE' => eventdate($edate, _MD_TIME_FMT), 'EVENT_NOTE' => '', 'EVENT_URL' => EGUIDE_URL . "/event.php?eid={$eid}");
    $notification_handler =& xoops_gethandler('notification');
    $notification_handler->triggerEvent('global', 0, 'new', $tags);
    $notification_handler->triggerEvent('category', $data['topicid'], 'new', $tags);
    $result = $xoopsDB->query("SELECT rvid, email, confirm FROM " . RVTBL . " WHERE eid=0");
    while ($data = $xoopsDB->fetchArray($result)) {
        $xoopsMailer =& getMailer();
        $xoopsMailer->useMail();
        $xoopsMailer->setSubject(_MD_NEWSUB);
        $tpl = 'notify_user_new.tpl';
        $xoopsMailer->setTemplateDir(template_dir($tpl));
        $xoopsMailer->setTemplate($tpl);
        $xoopsMailer->setFromEmail($xoopsConfig['adminmail']);
        $xoopsMailer->setFromName(eguide_from_name());
        $xoopsMailer->assign($tags);
        $xoopsMailer->assign("CANCEL_URL", EGUIDE_URL . "/reserv.php?op=cancel&rvid=" . $data['rvid'] . "&key=" . $data['confirm']);
        $xoopsMailer->setToEmails($data['email']);
        if (!$xoopsMailer->send()) {
            echo "<div class='error'>" . $xoopsMailer->getErrors() . "</div>\n";
        }
    }
}
Esempio n. 4
0
function order_notify($data, $email, $value)
{
    global $xoopsModuleConfig, $xoopsUser, $xoopsModule;
    $poster = new XoopsUser($data['uid']);
    $eid = $data['eid'];
    $exid = $data['exid'];
    $url = EGUIDE_URL . '/event.php?eid=' . $eid . ($exid ? "&sub={$exid}" : '');
    $xoopsMailer =& getMailer();
    $xoopsMailer->useMail();
    $tplname = $data['autoaccept'] ? "accept%s.tpl" : "order%s.tpl";
    $extra = eguide_form_options('reply_extension');
    $tplfile = sprintf($tplname, '');
    // default template name
    $tmpdir = template_dir($tplfile);
    if ($extra) {
        $vals = unserialize_text($value);
        if (isset($vals[$extra])) {
            $extpl = sprintf($tplname, $vals[$extra]);
            if (file_exists("{$tmpdir}{$extpl}")) {
                $tplfile = $extpl;
            }
        }
    } else {
        $extra = eguide_form_options('reply_tpl_suffix');
        if ($extra) {
            $extpl = sprintf($tplname, $extra);
            if (file_exists("{$tmpdir}{$extpl}")) {
                $tplfile = $extpl;
            }
        }
    }
    $xoopsMailer->setTemplateDir($tmpdir);
    $xoopsMailer->setTemplate($tplfile);
    if ($xoopsModuleConfig['member_only'] && is_object($xoopsUser)) {
        $user = $xoopsUser;
        if (isset($data['reserv_uid'])) {
            $ruid = $data['reserv_uid'];
            $user = new XoopsUser($ruid);
        } else {
            $xoopsMailer->setToUsers($user);
        }
        $uinfo = sprintf("%s: %s (%s)\n", _MD_UNAME, $user->getVar('uname'), $user->getVar('name'));
    } else {
        if (!empty($email)) {
            $xoopsMailer->setToEmails($email);
        }
        $uinfo = "";
    }
    if ($email) {
        $uinfo .= sprintf("%s: %s\n", _MD_EMAIL, $email);
    }
    $rvid = $data['rvid'];
    $conf = $data['confirm'];
    $edate = eventdate($data['edate']);
    $tags = array("EVENT_URL" => $url, "RVID" => $rvid, "CANCEL_KEY" => $conf, "CANCEL_URL" => EGUIDE_URL . "/reserv.php?op=cancel&rvid={$rvid}&key={$conf}", "INFO" => $uinfo . $value, "TITLE" => $edate . " " . $data['title'], "EVENT_DATE" => $edate, "EVENT_TITLE" => $data['title'], "SUMMARY" => strip_tags($data['summary']));
    $subj = eguide_form_options('reply_subject', _MD_SUBJECT);
    $xoopsMailer->assign($tags);
    $xoopsMailer->setSubject($subj);
    $xoopsMailer->setFromEmail($poster->getVar('email'));
    $xoopsMailer->setFromName(eguide_from_name());
    $ret = $xoopsMailer->send();
    // send to order person
    if (!$ret) {
        return $ret;
    }
    $xoopsMailer->reset();
    $xoopsMailer->useMail();
    $xoopsMailer->setTemplateDir(template_dir($tplfile));
    $xoopsMailer->setTemplate($tplfile);
    $xoopsMailer->assign($tags);
    $xoopsMailer->setSubject($subj);
    $xoopsMailer->setFromEmail($poster->getVar('email'));
    $xoopsMailer->setFromName(eguide_from_name());
    if ($data['notify']) {
        if (!in_array($xoopsModuleConfig['notify_group'], $poster->groups())) {
            $xoopsMailer->setToUsers($poster);
        }
        $member_handler =& xoops_gethandler('member');
        $notify_group = $member_handler->getGroup($xoopsModuleConfig['notify_group']);
        $xoopsMailer->setToGroups($notify_group);
        $xoopsMailer->send();
    }
    return $ret;
}
Esempio n. 5
0
 public function get_config($template = false)
 {
     if ($template == false) {
         $dir = template_dir();
         $file = $dir . 'config.php';
         if (is_file($file)) {
             include $file;
             if (isset($config)) {
                 return $config;
             }
             return false;
         }
     }
 }
Esempio n. 6
0
 public function send_forgot_password($params)
 {
     if (!isset($params['captcha'])) {
         return array('error' => 'Please enter the captcha answer!');
     } else {
         $validate_captcha = $this->app->captcha->validate($params['captcha']);
         if ($validate_captcha == false) {
             return array('error' => 'Invalid captcha answer!', 'captcha_error' => true);
         }
     }
     if (isset($params['email'])) {
         //return array('error' => 'Enter username or email!');
     } else {
         if (!isset($params['username']) or trim($params['username']) == '') {
             return array('error' => 'Enter username or email!');
         }
     }
     $data_res = false;
     $data = false;
     if (isset($params) and !empty($params)) {
         $user = isset($params['username']) ? $params['username'] : false;
         $email = isset($params['email']) ? $params['email'] : false;
         $data = array();
         if (trim($user != '')) {
             $data1 = array();
             $data1['username'] = $user;
             $data = array();
             if (trim($user != '')) {
                 $data = $this->get_all($data1);
                 if ($data == false) {
                     $data1 = array();
                     $data1['email'] = $user;
                     $data = $this->get_all($data1);
                 }
             }
         } elseif (trim($email != '')) {
             $data1 = array();
             $data1['email'] = $email;
             $data = array();
             if (trim($email != '')) {
                 $data = $this->get_all($data1);
             }
         }
         if (isset($data[0])) {
             $data_res = $data[0];
         }
         if (!is_array($data_res)) {
             return array('error' => 'Enter right username or email!');
         } else {
             $to = $data_res['email'];
             if (isset($to) and filter_var($to, FILTER_VALIDATE_EMAIL)) {
                 $subject = "Password reset!";
                 $content = "Hello, {$data_res['username']} <br> ";
                 $content .= "You have requested a password reset link from IP address: " . MW_USER_IP . "<br><br> ";
                 $security = array();
                 $security['ip'] = MW_USER_IP;
                 //  $security['hash'] = $this->app->format->array_to_base64($data_res);
                 $function_cache_id = md5(rand()) . uniqid() . rand() . str_random(40);
                 if (isset($data_res['id'])) {
                     $data_to_save = array();
                     $data_to_save['id'] = $data_res['id'];
                     $data_to_save['password_reset_hash'] = $function_cache_id;
                     $table = $this->tables['users'];
                     mw_var('FORCE_SAVE', $table);
                     $save = $this->app->database_manager->save($table, $data_to_save);
                 }
                 $base_link = $this->app->url_manager->current(1);
                 $cur_template = template_dir();
                 $cur_template_file = normalize_path($cur_template . 'login.php', false);
                 $cur_template_file2 = normalize_path($cur_template . 'forgot_password.php', false);
                 if (is_file($cur_template_file)) {
                     $base_link = site_url('login');
                 } elseif (is_file($cur_template_file2)) {
                     $base_link = site_url('forgot_password');
                 }
                 $pass_reset_link = $base_link . '?reset_password_link=' . $function_cache_id;
                 $notif = array();
                 $notif['module'] = "users";
                 $notif['rel_type'] = 'users';
                 $notif['rel_id'] = $data_to_save['id'];
                 $notif['title'] = "Password reset link sent";
                 $content_notif = "User with id: {$data_to_save['id']} and email: {$to}  has requested a password reset link";
                 $notif['description'] = $content_notif;
                 $this->app->log_manager->save($notif);
                 $content .= "Click here to reset your password  <a href='{$pass_reset_link}'>" . $pass_reset_link . "</a><br><br> ";
                 $sender = new \Microweber\Utils\MailSender();
                 $sender->send($to, $subject, $content);
                 return array('success' => 'Your password reset link has been sent to ' . $to);
             } else {
                 return array('error' => 'Error: the user doesn\'t have a valid email address!');
             }
         }
     }
 }
Esempio n. 7
0
function cc_notify_mail($tpl, $tags, $users, $from = "")
{
    // return: error count
    global $xoopsConfig, $xoopsModuleConfig, $xoopsUser, $xoopsModule;
    $xoopsMailer =& getMailer();
    if (is_array($users)) {
        $err = 0;
        foreach ($users as $u) {
            $err += cc_notify_mail($tpl, $tags, $u, $from);
        }
        return $err;
    }
    if (is_object($users)) {
        switch ($users->getVar('notify_method')) {
            case XOOPS_NOTIFICATION_METHOD_PM:
                $xoopsMailer->usePM();
                $sender = is_object($xoopsUser) ? $xoopsUser : new XoopsUser();
                $xoopsMailer->setFromUser($sender);
                break;
            case XOOPS_NOTIFICATION_METHOD_EMAIL:
                $xoopsMailer->useMail();
                break;
            case XOOPS_NOTIFICATION_METHOD_DISABLE:
                return 0;
            default:
                return 1;
        }
        $xoopsMailer->setToUsers($users);
    } else {
        if (empty($users)) {
            return 0;
        }
        $xoopsMailer->useMail();
        $xoopsMailer->setToEmails($users);
    }
    $xoopsMailer->setFromEmail($from ? $from : $xoopsConfig['adminmail']);
    $xoopsMailer->setFromName($xoopsModule->getVar('name'));
    $xoopsMailer->setSubject(_CC_NOTIFY_SUBJ);
    $comment = get_attr_value(null, 'reply_comment', '');
    if (get_attr_value(null, 'reply_use_comtpl')) {
        $xoopsMailer->setBody($comment);
    } else {
        $xoopsMailer->assign('REPLY_COMMENT', $comment);
        $xoopsMailer->setTemplateDir(template_dir($tpl));
        $xoopsMailer->setTemplate($tpl);
    }
    $xoopsMailer->assign($tags);
    return $xoopsMailer->send() ? 0 : 1;
}
 public function frontend()
 {
     if (isset($_GET['debug'])) {
         if ($this->app->make('config')->get('app.debug')) {
             DB::enableQueryLog();
         }
     }
     event_trigger('mw.controller.index');
     if ($this->render_this_url == false and $this->app->url_manager->is_ajax() == false) {
         $page_url = $this->app->url_manager->string();
     } elseif ($this->render_this_url == false and $this->app->url_manager->is_ajax() == true) {
         $page_url = $this->app->url_manager->string(1);
     } else {
         $page_url = $this->render_this_url;
         $this->render_this_url = false;
     }
     if ($this->page_url != false) {
         $page_url = $this->page_url;
     }
     if (strtolower($page_url) == 'index.php') {
         $page_url = '';
     }
     if ($this->create_new_page == true and $this->page_url != false) {
         $page_url = $this->page_url;
     }
     $page = false;
     if ($page == false and !empty($this->page)) {
         $page = $this->page;
     }
     $page_url = rtrim($page_url, '/');
     $is_admin = $this->app->user_manager->is_admin();
     $page_url_orig = $page_url;
     $simply_a_file = false;
     $show_404_to_non_admin = false;
     // if this is a file path it will load it
     if (isset($_REQUEST['view'])) {
         $is_custom_view = $_REQUEST['view'];
     } else {
         $is_custom_view = $this->app->url_manager->param('view');
         if ($is_custom_view and $is_custom_view != false) {
             $is_custom_view = str_replace('..', '', $is_custom_view);
             $page_url = $this->app->url_manager->param_unset('view', $page_url);
         }
     }
     $is_editmode = $this->app->url_manager->param('editmode');
     $is_no_editmode = $this->app->url_manager->param('no_editmode');
     $is_quick_edit = $this->app->url_manager->param('mw_quick_edit');
     if ($is_quick_edit != false) {
         $page_url = $this->app->url_manager->param_unset('mw_quick_edit', $page_url);
     }
     $is_preview_template = $this->app->url_manager->param('preview_template');
     if (!$is_preview_template) {
         $is_preview_template = false;
         if ($this->return_data == false) {
             if (!defined('MW_FRONTEND')) {
                 define('MW_FRONTEND', true);
             }
         }
         if (mw()->user_manager->session_id() and $is_editmode and $is_no_editmode == false) {
             if ($is_editmode == 'n') {
                 $is_editmode = false;
                 $page_url = $this->app->url_manager->param_unset('editmode', $page_url);
                 $this->app->user_manager->session_set('back_to_editmode', true);
                 $this->app->user_manager->session_set('editmode', false);
                 return $this->app->url_manager->redirect($this->app->url_manager->site_url($page_url));
             } else {
                 $editmode_sess = $this->app->user_manager->session_get('editmode');
                 $page_url = $this->app->url_manager->param_unset('editmode', $page_url);
                 if ($is_admin == true) {
                     if ($editmode_sess == false) {
                         $this->app->user_manager->session_set('editmode', true);
                         $this->app->user_manager->session_set('back_to_editmode', false);
                         $is_editmode = false;
                     }
                     return $this->app->url_manager->redirect($this->app->url_manager->site_url($page_url));
                 } else {
                     $is_editmode = false;
                 }
             }
         }
         if (mw()->user_manager->session_id() and !$is_no_editmode) {
             $is_editmode = $this->app->user_manager->session_get('editmode');
         } else {
             $is_editmode = false;
             $page_url = $this->app->url_manager->param_unset('no_editmode', $page_url);
         }
     } else {
         $is_editmode = false;
         $page_url = $this->app->url_manager->param_unset('preview_template', $page_url);
     }
     if ($is_quick_edit == true) {
         $is_editmode = true;
     }
     $preview_module = false;
     $preview_module_template = false;
     $preview_module_id = false;
     $template_relative_layout_file_from_url = false;
     $is_preview_module = $this->app->url_manager->param('preview_module');
     if ($is_preview_module != false) {
         if ($this->app->user_manager->is_admin()) {
             $is_preview_module = module_name_decode($is_preview_module);
             if (is_module($is_preview_module)) {
                 $is_preview_module_skin = $this->app->url_manager->param('preview_module_template');
                 $preview_module_id = $this->app->url_manager->param('preview_module_id');
                 $preview_module = $is_preview_module;
                 if ($is_preview_module_skin != false) {
                     $preview_module_template = module_name_decode($is_preview_module_skin);
                     $is_editmode = false;
                 }
             }
         }
     }
     $is_layout_file = $this->app->url_manager->param('preview_layout');
     if (!$is_layout_file) {
         $is_layout_file = false;
     } else {
         $page_url = $this->app->url_manager->param_unset('preview_layout', $page_url);
     }
     if (isset($_REQUEST['content_id']) and intval($_REQUEST['content_id']) != 0) {
         $page = $this->app->content_manager->get_by_id($_REQUEST['content_id']);
     }
     if ($is_quick_edit or $is_preview_template == true or isset($_REQUEST['isolate_content_field']) or $this->create_new_page == true) {
         if (isset($_REQUEST['content_id']) and intval($_REQUEST['content_id']) != 0) {
             $page = $this->app->content_manager->get_by_id($_REQUEST['content_id']);
         } else {
             $page['id'] = 0;
             $page['content_type'] = 'page';
             if (isset($_REQUEST['content_type'])) {
                 $page['content_type'] = $this->app->database_manager->escape_string($_REQUEST['content_type']);
             }
             if (isset($_REQUEST['subtype'])) {
                 $page['subtype'] = $this->app->database_manager->escape_string($_REQUEST['subtype']);
             }
             template_var('new_content_type', $page['content_type']);
             $page['parent'] = '0';
             if (isset($_REQUEST['parent_id']) and $_REQUEST['parent_id'] != 0) {
                 $page['parent'] = intval($_REQUEST['parent_id']);
             }
             //$page['url'] = $this->app->url_manager->string();
             if (isset($is_preview_template) and $is_preview_template != false) {
                 $page['active_site_template'] = $is_preview_template;
             } else {
             }
             if (isset($is_layout_file) and $is_layout_file != false) {
                 $page['layout_file'] = $is_layout_file;
             }
             if (isset($_REQUEST['inherit_template_from']) and $_REQUEST['inherit_template_from'] != 0) {
                 $page['parent'] = intval($_REQUEST['inherit_template_from']);
                 $inherit_from = $this->app->content_manager->get_by_id($_REQUEST["inherit_template_from"]);
                 //$page['parent'] =  $inherit_from ;
                 if (isset($inherit_from["layout_file"]) and $inherit_from["layout_file"] == 'inherit') {
                     $inherit_from_id = $this->app->content_manager->get_inherited_parent($inherit_from["id"]);
                     $inherit_from = $this->app->content_manager->get_by_id($inherit_from_id);
                 }
                 if (is_array($inherit_from) and isset($inherit_from['active_site_template'])) {
                     $page['active_site_template'] = $inherit_from['active_site_template'];
                     $is_layout_file = $page['layout_file'] = $inherit_from['layout_file'];
                 }
             }
             if (isset($_REQUEST['content_type']) and $_REQUEST['content_type'] != false) {
                 $page['content_type'] = $_REQUEST['content_type'];
             }
             if ($this->content_data != false) {
                 $page = $this->content_data;
             }
             template_var('new_page', $page);
         }
     }
     $output_cache_timeout = false;
     if (isset($is_preview_template) and $is_preview_template != false) {
         if (!defined('MW_NO_SESSION')) {
             define('MW_NO_SESSION', true);
         }
     }
     if (isset($_REQUEST['recart']) and $_REQUEST['recart'] != false) {
         event_trigger('recover_shopping_cart', $_REQUEST['recart']);
     }
     if ($output_cache_timeout != false) {
         $output_cache_id = __FUNCTION__ . crc32($_SERVER['REQUEST_URI']);
         $output_cache_group = 'content/preview';
         $output_cache_content = $this->app->cache_manager->get($output_cache_id, $output_cache_group, $output_cache_timeout);
         if ($output_cache_content != false) {
             print $output_cache_content;
             return;
         }
     }
     $the_active_site_template = $this->app->option_manager->get('current_template', 'template');
     $date_format = $this->app->option_manager->get('date_format', 'website');
     if ($date_format == false) {
         $date_format = "Y-m-d H:i:s";
     }
     if ($page == false or $this->create_new_page == true) {
         if (trim($page_url) == '' and $preview_module == false) {
             $page = $this->app->content_manager->homepage();
         } else {
             $found_mod = false;
             $page = $this->app->content_manager->get_by_url($page_url);
             $page_exact = $this->app->content_manager->get_by_url($page_url, true);
             $page_url_segment_1 = $this->app->url_manager->segment(0, $page_url);
             if ($preview_module != false) {
                 $page_url = $preview_module;
             }
             if ($the_active_site_template == false or $the_active_site_template == '') {
                 $the_active_site_template = 'default';
             }
             if ($page_exact == false and $found_mod == false and $this->app->modules->is_installed($page_url) and $page_url != 'settings' and $page_url != 'admin') {
                 $found_mod = true;
                 $page['id'] = 0;
                 $page['content_type'] = 'page';
                 $page['parent'] = '0';
                 $page['url'] = $this->app->url_manager->string();
                 $page['active_site_template'] = $the_active_site_template;
                 template_var('no_edit', 1);
                 $mod_params = '';
                 if ($preview_module_template != false) {
                     $mod_params = $mod_params . " template='{$preview_module_template}' ";
                 }
                 if ($preview_module_id != false) {
                     $mod_params = $mod_params . " id='{$preview_module_id}' ";
                 }
                 $found_mod = $page_url;
                 $page['content'] = '<microweber module="' . $page_url . '" ' . $mod_params . '  />';
                 //  $page['simply_a_file'] = 'clean.php';
                 $page['layout_file'] = 'clean.php';
                 template_var('content', $page['content']);
                 template_var('new_page', $page);
             }
             if ($found_mod == false) {
                 if (empty($page)) {
                     $the_new_page_file = false;
                     $page_url_segment_1 = $this->app->url_manager->segment(0, $page_url);
                     $td = templates_path() . $page_url_segment_1;
                     $td_base = $td;
                     $page_url_segment_2 = $this->app->url_manager->segment(1, $page_url);
                     $directly_to_file = false;
                     $page_url_segment_3 = $this->app->url_manager->segment(-1, $page_url);
                     $page_url_segment_1 = $the_active_site_template = $this->app->option_manager->get('current_template', 'template');
                     $td_base = templates_path() . $the_active_site_template . DS;
                     $page_url_segment_3_str = implode(DS, $page_url_segment_3);
                     if ($page_url_segment_3_str != '') {
                         $page_url_segment_3_str = rtrim($page_url_segment_3_str, DS);
                         $page_url_segment_3_str = rtrim($page_url_segment_3_str, '\\');
                         $page_url_segment_3_str_copy = $page_url_segment_3_str;
                         $is_ext = get_file_extension($page_url_segment_3_str);
                         if ($is_ext == false or $is_ext != 'php') {
                             $page_url_segment_3_str = $page_url_segment_3_str . '.php';
                         }
                         $td_f = $td_base . DS . $page_url_segment_3_str;
                         $td_fd = $td_base . DS . $page_url_segment_3_str_copy;
                         $td_fd2 = $td_base . DS . $page_url_segment_3[0];
                         if (is_file($td_f)) {
                             $the_new_page_file = $page_url_segment_3_str;
                             $simply_a_file = $directly_to_file = $td_f;
                         } else {
                             if (is_dir($td_fd)) {
                                 $td_fd_index = $td_fd . DS . 'index.php';
                                 if (is_file($td_fd_index)) {
                                     $the_new_page_file = $td_fd_index;
                                     $simply_a_file = $directly_to_file = $td_fd_index;
                                 }
                             } else {
                                 $is_ext = get_file_extension($td_fd);
                                 if ($is_ext == false or $is_ext != 'php') {
                                     $td_fd = $td_fd . '.php';
                                 }
                                 $is_ext = get_file_extension($td_fd2);
                                 if ($is_ext == false or $is_ext != 'php') {
                                     $td_fd2 = $td_fd2 . '.php';
                                 }
                                 if (is_file($td_fd)) {
                                     $the_new_page_file = $td_fd;
                                     $simply_a_file = $directly_to_file = $td_fd;
                                 } else {
                                     if (is_file($td_fd2)) {
                                         $the_new_page_file = $td_fd2;
                                         $simply_a_file = $directly_to_file = $td_fd2;
                                     } else {
                                         $td_basedef = templates_path() . 'default' . DS . $page_url_segment_3_str;
                                         if (is_file($td_basedef)) {
                                             $the_new_page_file = $td_basedef;
                                             $simply_a_file = $directly_to_file = $td_basedef;
                                         }
                                     }
                                 }
                             }
                         }
                     }
                     $fname1 = 'index.php';
                     $fname2 = $page_url_segment_2 . '.php';
                     $fname3 = $page_url_segment_2;
                     $tf1 = $td . DS . $fname1;
                     $tf2 = $td . DS . $fname2;
                     $tf3 = $td . DS . $fname3;
                     if ($directly_to_file == false and is_dir($td)) {
                         if (is_file($tf1)) {
                             $simply_a_file = $tf1;
                             $the_new_page_file = $fname1;
                         }
                         if (is_file($tf2)) {
                             $simply_a_file = $tf2;
                             $the_new_page_file = $fname2;
                         }
                         if (is_file($tf3)) {
                             $simply_a_file = $tf3;
                             $the_new_page_file = $fname3;
                         }
                         if ($simply_a_file != false) {
                             $simply_a_file = str_replace('..', '', $simply_a_file);
                             $simply_a_file = normalize_path($simply_a_file, false);
                         }
                     }
                     if ($simply_a_file == false) {
                         //$page = $this->app->content_manager->homepage();
                         $page = false;
                         if (!is_array($page)) {
                             $page = array();
                             $page['id'] = 0;
                             $page['content_type'] = 'page';
                             $page['parent'] = '0';
                             $page['url'] = $this->app->url_manager->string();
                             //  $page['active_site_template'] = $page_url_segment_1;
                             $page['simply_a_file'] = 'clean.php';
                             $page['layout_file'] = 'clean.php';
                             $show_404_to_non_admin = true;
                         }
                         if (is_array($page_url_segment_3)) {
                             foreach ($page_url_segment_3 as $mvalue) {
                                 if ($found_mod == false and $this->app->modules->is_installed($mvalue)) {
                                     $found_mod = true;
                                     $page['id'] = 0;
                                     $page['content_type'] = 'page';
                                     $page['parent'] = '0';
                                     $page['url'] = $this->app->url_manager->string();
                                     $page['active_site_template'] = $page_url_segment_1;
                                     $page['content'] = '<module type="' . $mvalue . '" />';
                                     $page['simply_a_file'] = 'clean.php';
                                     $page['layout_file'] = 'clean.php';
                                     template_var('content', $page['content']);
                                     template_var('new_page', $page);
                                     $show_404_to_non_admin = false;
                                 }
                             }
                         }
                     } else {
                         if (!is_array($page)) {
                             $page = array();
                         }
                         $page['id'] = 0;
                         if (isset($page_data) and isset($page_data['id'])) {
                             //  $page['id'] = $page_data['id'];
                         }
                         $page['content_type'] = 'page';
                         $page['parent'] = '0';
                         $page['url'] = $this->app->url_manager->string();
                         $page['active_site_template'] = $page_url_segment_1;
                         $page['layout_file'] = $the_new_page_file;
                         $page['simply_a_file'] = $simply_a_file;
                         template_var('new_page', $page);
                         template_var('simply_a_file', $simply_a_file);
                     }
                 }
             }
         }
     }
     if ($page['id'] != 0) {
         // if(!isset($page['layout_file']) or $page['layout_file'] == false){
         $page = $this->app->content_manager->get_by_id($page['id']);
         // }
         if ($page['content_type'] == "post" and isset($page['parent'])) {
             $content = $page;
             $page = $this->app->content_manager->get_by_id($page['parent']);
         } else {
             $content = $page;
         }
     } else {
         $content = $page;
     }
     if (isset($content['created_at']) and trim($content['created_at']) != '') {
         $content['created_at'] = date($date_format, strtotime($content['created_at']));
     }
     if (isset($content['updated_at']) and trim($content['updated_at']) != '') {
         $content['updated_at'] = date($date_format, strtotime($content['updated_at']));
     }
     if ($is_preview_template != false) {
         $is_preview_template = str_replace('____', DS, $is_preview_template);
         $is_preview_template = str_replace('..', '', $is_preview_template);
         $content['active_site_template'] = $is_preview_template;
     }
     if ($is_layout_file != false and $is_admin == true) {
         $is_layout_file = str_replace('____', DS, $is_layout_file);
         if ($is_layout_file == 'inherit') {
             if (isset($_REQUEST['inherit_template_from']) and intval($_REQUEST['inherit_template_from']) != 0) {
                 $inherit_layout_from_this_page = $this->app->content_manager->get_by_id($_REQUEST['inherit_template_from']);
                 if (isset($inherit_layout_from_this_page['layout_file']) and $inherit_layout_from_this_page['layout_file'] != 'inherit') {
                     $is_layout_file = $inherit_layout_from_this_page['layout_file'];
                 }
                 if (isset($inherit_layout_from_this_page['layout_file']) and $inherit_layout_from_this_page['layout_file'] != 'inherit') {
                     $is_layout_file = $inherit_layout_from_this_page['layout_file'];
                 }
             }
         }
         $content['layout_file'] = $is_layout_file;
     }
     if ($is_custom_view and $is_custom_view != false) {
         $content['custom_view'] = $is_custom_view;
     }
     if (isset($content['is_active']) and ($content['is_active'] == 'n' or $content['is_active'] == 0)) {
         if ($this->app->user_manager->is_admin() == false) {
             $page_non_active = array();
             $page_non_active['id'] = 0;
             $page_non_active['content_type'] = 'page';
             $page_non_active['parent'] = '0';
             $page_non_active['url'] = $this->app->url_manager->string();
             $page_non_active['content'] = 'This page is not published!';
             $page_non_active['simply_a_file'] = 'clean.php';
             $page_non_active['layout_file'] = 'clean.php';
             $page_non_active['page_non_active'] = true;
             template_var('content', $page_non_active['content']);
             $content = $page_non_active;
         }
     } else {
         if (isset($content['is_deleted']) and $content['is_deleted'] == 1) {
             if ($this->app->user_manager->is_admin() == false) {
                 $page_non_active = array();
                 $page_non_active['id'] = 0;
                 $page_non_active['content_type'] = 'page';
                 $page_non_active['parent'] = '0';
                 $page_non_active['url'] = $this->app->url_manager->string();
                 $page_non_active['content'] = 'This page is deleted!';
                 $page_non_active['simply_a_file'] = 'clean.php';
                 $page_non_active['layout_file'] = 'clean.php';
                 $page_non_active['page_is_deleted'] = true;
                 template_var('content', $page_non_active['content']);
                 $content = $page_non_active;
             }
         }
     }
     if (isset($content['require_login']) and $content['require_login'] == 1) {
         if ($this->app->user_manager->id() == 0) {
             $page_non_active = array();
             $page_non_active['id'] = 0;
             $page_non_active['content_type'] = 'page';
             $page_non_active['parent'] = '0';
             $page_non_active['url'] = $this->app->url_manager->string();
             $page_non_active['content'] = ' <module type="users/login" class="user-require-login-on-view" /> ';
             $page_non_active['simply_a_file'] = 'clean.php';
             $page_non_active['layout_file'] = 'clean.php';
             $page_non_active['page_require_login'] = true;
             template_var('content', $page_non_active['content']);
             $content = $page_non_active;
         }
     }
     if (!defined('IS_HOME')) {
         if (isset($content['is_home']) and $content['is_home'] == 1) {
             define('IS_HOME', true);
         }
     }
     $this->app->content_manager->define_constants($content);
     event_trigger('mw.front', $content);
     event_trigger('mw_frontend', $content);
     $render_file = $this->app->template->get_layout($content);
     $content['render_file'] = $render_file;
     if (defined('TEMPLATE_DIR')) {
         $load_template_functions = TEMPLATE_DIR . 'functions.php';
         if (is_file($load_template_functions)) {
             include_once $load_template_functions;
         }
     }
     if ($this->return_data != false) {
         return $content;
     }
     if (isset($content['original_link']) and $content['original_link'] != '') {
         $content['original_link'] = str_ireplace('{site_url}', $this->app->url_manager->site(), $content['original_link']);
         $redirect = $this->app->format->prep_url($content['original_link']);
         if ($redirect != '') {
             return $this->app->url_manager->redirect($redirect);
         }
     }
     if (!isset($page['title'])) {
         $page['title'] = 'New page';
     }
     if (!isset($content['title'])) {
         $content['title'] = 'New content';
     }
     $category = false;
     if (defined('CATEGORY_ID')) {
         $category = $this->app->category_manager->get_by_id(CATEGORY_ID);
     }
     if ($render_file) {
         $render_params = array();
         if ($show_404_to_non_admin) {
             if (!is_admin()) {
                 $load_template_404 = template_dir() . '404.php';
                 if (is_file($load_template_404)) {
                     $render_file = $load_template_404;
                 }
             }
         }
         $render_params['render_file'] = $render_file;
         $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['content'] = $content;
         $render_params['category'] = $category;
         $render_params['page'] = $page;
         $l = $this->app->template->render($render_params);
         if (is_object($l)) {
             return $l;
         }
         // used for preview from the admin wysiwyg
         if (isset($_REQUEST['isolate_content_field'])) {
             require_once MW_PATH . 'Utils' . DIRECTORY_SEPARATOR . 'lib' . DIRECTORY_SEPARATOR . 'phpQuery.php';
             $pq = \phpQuery::newDocument($l);
             $isolated_head = pq('head')->eq(0)->html();
             $found_field = false;
             if (isset($_REQUEST['isolate_content_field'])) {
                 foreach ($pq['[field=content]'] as $elem) {
                     $isolated_el = $l = pq($elem)->htmlOuter();
                 }
             }
             $is_admin = $this->app->user_manager->is_admin();
             if ($is_admin == true and isset($isolated_el) != false) {
                 $tb = mw_includes_path() . DS . 'toolbar' . DS . 'editor_tools' . DS . 'wysiwyg' . DS . 'index.php';
                 //$layout_toolbar = file_get_contents($filename);
                 $layout_toolbar = new \Microweber\View($tb);
                 $layout_toolbar = $layout_toolbar->__toString();
                 if ($layout_toolbar != '') {
                     if (strstr($layout_toolbar, '{head}')) {
                         if ($isolated_head != false) {
                             $layout_toolbar = str_replace('{head}', $isolated_head, $layout_toolbar);
                         }
                     }
                     if (strpos($layout_toolbar, '{content}')) {
                         $l = str_replace('{content}', $l, $layout_toolbar);
                     }
                     //$layout_toolbar = mw()->parser->process($layout_toolbar, $options = array('no_apc' => 1));
                 }
             }
         }
         $modify_content = event_trigger('on_load', $content);
         if ($is_editmode == true and !defined('IN_EDIT')) {
             define('IN_EDIT', true);
         }
         if (isset($is_quick_edit) and $is_quick_edit == true and !defined('QUICK_EDIT')) {
             define('QUICK_EDIT', true);
         }
         $l = $this->app->parser->process($l, $options = false);
         if ($preview_module_id != false) {
             $_REQUEST['embed_id'] = $preview_module_id;
         }
         if (isset($_REQUEST['embed_id'])) {
             $find_embed_id = trim($_REQUEST['embed_id']);
             $l = $this->app->parser->get_by_id($find_embed_id, $l);
         }
         $apijs_loaded = $this->app->template->get_apijs_url();
         //$apijs_loaded = $this->app->template->get_apijs_url() . '?id=' . CONTENT_ID;
         $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 != '') {
                 $l = str_ireplace('</head>', $template_headers_append . '</head>', $l, $one);
             }
         }
         $template_headers_src = $this->app->template->head(true);
         $template_footer_src = $this->app->template->foot(true);
         $template_headers_src_callback = $this->app->template->head_callback($page);
         if (is_array($template_headers_src_callback) and !empty($template_headers_src_callback)) {
             foreach ($template_headers_src_callback as $template_headers_src_callback_str) {
                 if (is_string($template_headers_src_callback_str)) {
                     $template_headers_src = $template_headers_src . "\n" . $template_headers_src_callback_str;
                 }
             }
         }
         if (isset($page['created_by'])) {
             $author = $this->app->user_manager->get_by_id($page['created_by']);
             if (is_array($author) and isset($author['profile_url']) and $author['profile_url'] != false) {
                 $template_headers_src = $template_headers_src . "\n" . '<link rel="author" href="' . trim($author['profile_url']) . '" />' . "\n";
             }
         }
         if ($template_headers_src != false and is_string($template_headers_src)) {
             $l = str_ireplace('</head>', $template_headers_src . '</head>', $l, $one);
         }
         if ($template_footer_src != false and is_string($template_footer_src)) {
             $l = str_ireplace('</body>', $template_footer_src . '</body>', $l, $one);
         }
         $l = str_ireplace('<head>', '<head>' . $default_css, $l);
         if (!stristr($l, $apijs_loaded)) {
             //$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();
             $apijs_settings_script = "\r\n" . '<script src="' . $apijs_settings_loaded . '"></script>' . "\r\n";
             $apijs_settings_script .= '<script src="' . $apijs_loaded . '"></script>' . "\r\n";
             $l = str_ireplace('<head>', '<head>' . $apijs_settings_script, $l);
         }
         if (isset($content['active_site_template']) and $content['active_site_template'] == 'default' and $the_active_site_template != 'default' and $the_active_site_template != 'mw_default') {
             $content['active_site_template'] = $the_active_site_template;
         }
         if (isset($content['active_site_template']) and trim($content['active_site_template']) != '' and $content['active_site_template'] != 'default') {
             if (!defined('CONTENT_TEMPLATE')) {
                 define('CONTENT_TEMPLATE', $content['active_site_template']);
             }
             $custom_live_edit = TEMPLATES_DIR . DS . $content['active_site_template'] . DS . 'live_edit.css';
             $live_edit_css_folder = userfiles_path() . 'css' . DS . $content['active_site_template'] . DS;
             $live_edit_url_folder = userfiles_url() . 'css/' . $content['active_site_template'] . '/';
             $custom_live_edit = $live_edit_css_folder . DS . 'live_edit.css';
         } else {
             if (!defined('CONTENT_TEMPLATE')) {
                 define('CONTENT_TEMPLATE', $the_active_site_template);
             }
             //                if ($the_active_site_template == 'mw_default') {
             //                    $the_active_site_template = 'default';
             //                }
             $custom_live_edit = TEMPLATE_DIR . DS . 'live_edit.css';
             $live_edit_css_folder = userfiles_path() . 'css' . DS . $the_active_site_template . DS;
             $live_edit_url_folder = userfiles_url() . 'css/' . $the_active_site_template . '/';
             $custom_live_edit = $live_edit_css_folder . 'live_edit.css';
         }
         $custom_live_edit = normalize_path($custom_live_edit, false);
         if (is_file($custom_live_edit)) {
             $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" />';
             $l = str_ireplace('</head>', $liv_ed_css . '</head>', $l);
         }
         $liv_ed_css = $this->app->template->get_custom_css_url();
         if ($liv_ed_css != false) {
             $liv_ed_css = '<link rel="stylesheet" href="' . $liv_ed_css . '" id="mw-custom-user-css" type="text/css" />';
             $l = str_ireplace('</head>', $liv_ed_css . '</head>', $l);
         }
         $website_head_tags = $this->app->option_manager->get('website_head', 'website');
         $rep_count = 1;
         if ($website_head_tags != false) {
             $l = str_ireplace('</head>', $website_head_tags . '</head>', $l, $rep_count);
         }
         if (defined('MW_VERSION')) {
             $generator_tag = "\n" . '<meta name="generator" content="Microweber" />' . "\n";
             $l = str_ireplace('</head>', $generator_tag . '</head>', $l, $rep_count);
         }
         if ($is_editmode == true and $this->isolate_by_html_id == false and !isset($_REQUEST['isolate_content_field'])) {
             if ($is_admin == true) {
                 $tb = mw_includes_path() . DS . 'toolbar' . DS . 'toolbar.php';
                 $layout_toolbar = new \Microweber\View($tb);
                 $is_editmode_basic = false;
                 $user_data = $this->app->user_manager->get();
                 if (isset($user_data['basic_mode']) and trim($user_data['basic_mode'] == 'y')) {
                     $is_editmode_basic = true;
                 }
                 if (isset($is_editmode_basic) and $is_editmode_basic == true) {
                     $layout_toolbar->assign('basic_mode', true);
                 } else {
                     $layout_toolbar->assign('basic_mode', false);
                 }
                 event_trigger('mw.live_edit');
                 $layout_toolbar = $layout_toolbar->__toString();
                 if ($layout_toolbar != '') {
                     $layout_toolbar = $this->app->parser->process($layout_toolbar, $options = array('no_apc' => 1));
                     $c = 1;
                     $l = str_ireplace('</body>', $layout_toolbar . '</body>', $l, $c);
                 }
                 $custom_live_edit = TEMPLATES_DIR . DS . TEMPLATE_NAME . DS . 'live_edit.php';
                 $custom_live_edit = normalize_path($custom_live_edit, false);
                 if (is_file($custom_live_edit)) {
                     $layout_live_edit = new \Microweber\View($custom_live_edit);
                     $layout_live_edit = $layout_live_edit->__toString();
                     if ($layout_live_edit != '') {
                         $l = str_ireplace('</body>', $layout_live_edit . '</body>', $l, $c);
                     }
                 }
             }
         } else {
             if ($is_editmode == false and $is_admin == true and mw()->user_manager->session_id() and !(mw()->user_manager->session_all() == false) and mw()->user_manager->session_get('back_to_editmode')) {
                 if (!isset($_REQUEST['isolate_content_field']) and !isset($_REQUEST['content_id'])) {
                     $back_to_editmode = $this->app->user_manager->session_get('back_to_editmode');
                     if ($back_to_editmode == true) {
                         $tb = mw_includes_path() . DS . 'toolbar' . DS . 'toolbar_back.php';
                         $layout_toolbar = new \Microweber\View($tb);
                         $layout_toolbar = $layout_toolbar->__toString();
                         if ($layout_toolbar != '') {
                             $layout_toolbar = $this->app->parser->process($layout_toolbar, $options = array('no_apc' => 1));
                             $c = 1;
                             $l = str_ireplace('</body>', $layout_toolbar . '</body>', $l, $c);
                         }
                     }
                 }
             }
         }
         $l = str_replace('{TEMPLATE_URL}', TEMPLATE_URL, $l);
         $l = str_replace('{THIS_TEMPLATE_URL}', THIS_TEMPLATE_URL, $l);
         $l = str_replace('{DEFAULT_TEMPLATE_URL}', DEFAULT_TEMPLATE_URL, $l);
         $l = str_replace('%7BTEMPLATE_URL%7D', TEMPLATE_URL, $l);
         $l = str_replace('%7BTHIS_TEMPLATE_URL%7D', THIS_TEMPLATE_URL, $l);
         $l = str_replace('%7BDEFAULT_TEMPLATE_URL%7D', DEFAULT_TEMPLATE_URL, $l);
         $meta = array();
         $meta['content_image'] = '';
         $meta['description'] = '';
         if (is_home()) {
             $meta['content_url'] = site_url();
         } else {
             $meta['content_url'] = $this->app->url_manager->current(1);
         }
         $meta['og_description'] = $this->app->option_manager->get('website_description', 'website');
         $meta['og_type'] = 'website';
         $meta_content_id = PAGE_ID;
         if (CONTENT_ID > 0) {
             $meta_content_id = CONTENT_ID;
         }
         if ($meta_content_id > 0) {
             $meta = $this->app->content_manager->get_by_id($meta_content_id);
             $content_image = $this->app->media_manager->get_picture($meta_content_id);
             if ($content_image) {
                 $meta['content_image'] = $content_image;
             } else {
                 $meta['content_image'] = '';
             }
             $meta['content_url'] = $this->app->content_manager->link($meta_content_id);
             $meta['og_type'] = $meta['content_type'];
             if ($meta['og_type'] != 'page' and trim($meta['subtype']) != '') {
                 $meta['og_type'] = $meta['subtype'];
             }
             if ($meta['description'] != false and trim($meta['description']) != '') {
                 $meta['description'] = $meta['description'];
             } else {
                 if ($meta['content'] != false and trim($meta['content']) != '') {
                     $meta['description'] = str_replace("\n", ' ', $this->app->format->limit($this->app->format->clean_html(strip_tags($meta['content'])), 500));
                 }
             }
             if (isset($meta['description']) and $meta['description'] != '') {
                 $meta['og_description'] = $meta['description'];
             } else {
                 $meta['og_description'] = trim($this->app->format->limit($this->app->format->clean_html(strip_tags($meta['content'])), 500));
             }
         } else {
             $meta['title'] = $this->app->option_manager->get('website_title', 'website');
             $meta['description'] = $this->app->option_manager->get('website_description', 'website');
             $meta['content_meta_keywords'] = $this->app->option_manager->get('website_keywords', 'website');
         }
         $meta['og_site_name'] = $this->app->option_manager->get('website_title', 'website');
         if (!empty($meta)) {
             if (isset($meta['content_meta_title']) and $meta['content_meta_title'] != '') {
                 $meta['title'] = $meta['content_meta_title'];
             } else {
                 if (isset($meta['title']) and $meta['title'] != '') {
                 } else {
                     $meta['title'] = $this->app->option_manager->get('website_title', 'website');
                 }
             }
             if (isset($meta['description']) and $meta['description'] != '') {
             } else {
                 $meta['description'] = $this->app->option_manager->get('website_description', 'website');
             }
             if (isset($meta['description']) and $meta['description'] != '') {
                 $meta['content_meta_description'] = strip_tags($meta['description']);
                 unset($meta['description']);
             } else {
                 if (isset($meta['content']) and $meta['content'] != '') {
                     $meta['content_meta_description'] = strip_tags($meta['content']);
                 } else {
                     if (isset($meta['title']) and $meta['title'] != '') {
                         $meta['content_meta_description'] = strip_tags($meta['title']);
                     }
                 }
             }
             if (isset($meta['title']) and $meta['title'] != '') {
                 $meta['content_meta_title'] = strip_tags($meta['title']);
             } elseif (isset($found_mod) and $found_mod != false) {
                 $meta['content_meta_title'] = ucwords(str_replace('/', ' ', $found_mod));
             } else {
                 $meta['content_meta_title'] = ucwords(str_replace('/', ' ', $this->app->url_manager->segment(0)));
             }
             if (isset($meta['content_meta_keywords']) and $meta['content_meta_keywords'] != '') {
             } else {
                 $meta['content_meta_keywords'] = $this->app->option_manager->get('website_keywords', 'website');
             }
             if (is_array($meta)) {
                 foreach ($meta as $key => $item) {
                     if (is_string($item)) {
                         $item = html_entity_decode($item);
                         $item = strip_tags($item);
                         $item = str_replace('&amp;zwnj;', ' ', $item);
                         $item = str_replace('"', ' ', $item);
                         $item = str_replace("'", ' ', $item);
                         $item = str_replace('>', '', $item);
                         $item = str_replace('&amp;quot;', ' ', $item);
                         $item = str_replace('quot;', ' ', $item);
                         $item = str_replace('&amp;', ' ', $item);
                         $item = str_replace('amp;', ' ', $item);
                         $item = str_replace('nbsp;', ' ', $item);
                         $item = str_replace('#039;', ' ', $item);
                         $item = str_replace('&amp;nbsp;', ' ', $item);
                         $item = str_replace('&', ' ', $item);
                         $item = str_replace(";", ' ', $item);
                         $item = str_replace('  ', ' ', $item);
                         $item = str_replace(' ', ' ', $item);
                         $l = str_replace('{' . $key . '}', $item, $l);
                     } elseif ($item == false) {
                         $l = str_replace('{' . $key . '}', '', $l);
                     }
                 }
             }
         }
         if ($page != false and empty($this->page)) {
             $this->page = $page;
         }
         $l = execute_document_ready($l);
         event_trigger('frontend');
         $is_embed = $this->app->url_manager->param('embed');
         if ($is_embed != false) {
             $this->isolate_by_html_id = $is_embed;
         }
         if ($this->isolate_by_html_id != false) {
             $id_sel = $this->isolate_by_html_id;
             $this->isolate_by_html_id = false;
             require_once MW_PATH . 'Utils' . DIRECTORY_SEPARATOR . 'lib' . DIRECTORY_SEPARATOR . 'phpQuery.php';
             $pq = \phpQuery::newDocument($l);
             foreach ($pq['#' . $id_sel] as $elem) {
                 $l = pq($elem)->htmlOuter();
             }
         }
         if (mw()->user_manager->session_id() and !(mw()->user_manager->session_all() == false) and $is_editmode) {
             session_set('last_content_id', CONTENT_ID);
         }
         if ($output_cache_timeout != false) {
             $this->app->cache_manager->save($l, $output_cache_id, $output_cache_group);
         }
         //            print $l;
         //            unset($l);
         if (isset($_REQUEST['debug'])) {
             if ($this->app->make('config')->get('app.debug')) {
                 $is_admin = $this->app->user_manager->is_admin();
                 if ($is_admin == true) {
                     include mw_includes_path() . 'debug.php';
                 }
             }
         }
         return $l;
     } else {
         print 'Error! Page is not found? Please login in the admin and make a page.';
         $this->app->cache_manager->clear();
         return;
     }
 }
    <h1>Concerto Config</h1>
    <ul>
      <li>Config access: <?php 
echo config_found();
?>
</li><? include('../config.inc.php'); ?>
      <li>Common Directory: <?php 
echo common_dir();
?>
</li>
      <li>Image Upload Directory: <?php 
echo image_dir();
?>
</li>
      <li>Template Upload Directory: <?php 
echo template_dir();
?>
</li>
      <li>MySQL Connection test: <?php 
echo test_mysql();
?>
</li>
    </ul>
  </body>
</html>
<?php 
function php_v()
{
    if (floatval(phpversion()) >= 5.2) {
        return pass(phpversion());
    } else {
Esempio n. 10
0
         
    <script type="text/javascript">
        mw.lib.require("bootstrap3");
        mw.require(mw.settings.template_url + "js/functions.js");
    </script>
    <link rel="stylesheet" href="<?php 
print template_url();
?>
css/style.css" type="text/css" />
    <link rel="stylesheet" href="<?php 
print template_url();
?>
css/fonts.css" type="text/css" />

    <?php 
include template_dir() . 'header_options.php';
?>
   
    </head>
    <body>
<div id="main-container">
<div id="header-master">
      <div class="container">
    <div class="mw-ui-row-nodrop">
          <div class="mw-ui-col" style="width: 200px;">
        <div class="mw-ui-col-container">
              <module type="logo" id="site-logo">
            </div>
      </div>
          <div class="mw-ui-col">
        <div class="mw-ui-col-container"> <span id="mobile-menu"><span></span><span></span><span></span><span></span></span>
Esempio n. 11
0
 }
 if ($email) {
     $uinfo .= sprintf("%s: %s\n", _MD_EMAIL, $email);
 }
 if (is_object($xoopsUser)) {
     $xoopsMailer->assign("REQ_UNAME", $xoopsUser->getVar('uname'));
     $xoopsMailer->assign("REQ_NAME", $xoopsUser->getVar('name'));
 } else {
     $xoopsMailer->assign("REQ_UNAME", '*anonymous*');
     $xoopsMailer->assign("REQ_NAME", $xoopsConfig['anonymous']);
 }
 $tags = array("TITLE" => "{EVENT_DATE} {EVENT_TITLE}", "EVENT_DATE" => eventdate($data['edate']), "EVENT_TITLE" => $data['title'], "EVENT_URL" => $evurl, "RVID" => $rvid, "INFO" => $uinfo . $data['info']);
 $xoopsMailer->assign($tags);
 $xoopsMailer->setSubject(_MD_CANCEL_SUBJ);
 $tpl = 'cancel.tpl';
 $xoopsMailer->setTemplateDir(template_dir($tpl));
 $xoopsMailer->setTemplate($tpl);
 if ($email) {
     $xoopsMailer->setToEmails($email);
 }
 $xoopsMailer->setFromEmail($xoopsConfig['adminmail']);
 $xoopsMailer->setFromName(eguide_from_name());
 if (!in_array($xoopsModuleConfig['notify_group'], $poster->groups())) {
     $xoopsMailer->setToUsers($poster);
 }
 $member_handler =& xoops_gethandler('member');
 if ($xoopsModuleConfig['notify']) {
     $notify_group = $member_handler->getGroup($xoopsModuleConfig['notify_group']);
     $xoopsMailer->setToGroups($notify_group);
 }
 $xoopsMailer->send();
Esempio n. 12
0
<?php

/*
  THIS FILE WILL LOAD WHEN YOU OPEN A POST IN A NON BLOG page
  
  Curently it loads the default layout for post, but you can use it for custom design.
*/
?>

 

<?php 
if (isset($content) and isset($content['subtype']) and $content['content_type'] == 'product') {
    include template_dir() . "layouts/shop_inner.php";
} else {
    include template_dir() . "layouts/blog_inner.php";
}
?>


Esempio n. 13
0
 function admin_notify($subj, $tags)
 {
     global $xoopsModule, $xoopsConfig, $xoopsModuleConfig, $xoopsUser;
     if (!$xoopsModuleConfig['notify_admin']) {
         return false;
     }
     $xoopsMailer =& getMailer();
     $xoopsMailer->useMail();
     $xoopsMailer->setSubject($subj);
     $tags['X_MODULE'] = $xoopsModule->getVar('name');
     $xoopsMailer->assign($tags);
     $tpl = 'notify_admin.tpl';
     $xoopsMailer->setTemplateDir(template_dir($tpl));
     $xoopsMailer->setTemplate($tpl);
     $member_handler =& xoops_gethandler('member');
     $users = $member_handler->getUsersByGroup($xoopsModuleConfig['notify_group'], true);
     $uid = $xoopsUser->getVar('uid');
     foreach ($users as $user) {
         if ($user->getVar('uid') != $uid) {
             $xoopsMailer->setToUsers($user);
         }
     }
     $xoopsMailer->setFromEmail($xoopsConfig['adminmail']);
     $xoopsMailer->setFromName($xoopsModule->getVar('name'));
     return $xoopsMailer->send();
 }
Esempio n. 14
0
<?php

/*
  THIS FILE WILL LOAD WHEN YOU OPEN A CONTENT WITH SUBTYPE PRODUCT 
  
  that is added to a page that does not use the shop layout
  
  
  
  Curently it loads the default layout for the product, but you can use it for custom design.
*/
include template_dir() . "layouts/shop_inner.php";
Esempio n. 15
0
 public function apijs_settings()
 {
     if (!defined('MW_NO_SESSION')) {
         define('MW_NO_SESSION', 1);
     }
     $lastModified = time() - 120;
     $etagFile = md5(serialize($_REQUEST));
     $ifModifiedSince = isset($_SERVER['HTTP_IF_MODIFIED_SINCE']) ? $_SERVER['HTTP_IF_MODIFIED_SINCE'] : false;
     //get the HTTP_IF_NONE_MATCH header if set (etag: unique file hash)
     $etagHeader = isset($_SERVER['HTTP_IF_NONE_MATCH']) ? trim($_SERVER['HTTP_IF_NONE_MATCH']) : false;
     //set last-modified header
     // header("Last-Modified: " . gmdate("D, d M Y H:i:s", $lastModified) . " GMT");
     // header('Cache-Control: public');
     // header("Etag: $etagFile");
     if (@strtotime($_SERVER['HTTP_IF_MODIFIED_SINCE']) == $lastModified || $etagHeader == $etagFile) {
         // header("HTTP/1.1 304 Not Modified");
         // return;
         // exit;
     }
     $ref_page = false;
     if (isset($_REQUEST['id'])) {
         $ref_page = $this->app->content_manager->get_by_id($_REQUEST['id']);
     } elseif (isset($_SERVER['HTTP_REFERER'])) {
         $ref_page = $_SERVER['HTTP_REFERER'];
         if ($ref_page != '') {
             $ref_page = $this->app->content_manager->get_by_url($ref_page);
             $page_id = $ref_page['id'];
         }
     }
     $cat_url = false;
     if (isset($_REQUEST['category_id'])) {
         $cat_url = intval($_REQUEST['category_id']);
     } elseif (isset($_SERVER['HTTP_REFERER'])) {
         $cat_url = mw()->category_manager->get_category_id_from_url($_SERVER['HTTP_REFERER']);
         $cat_url = intval($cat_url);
     }
     if ($cat_url != false) {
         if (!defined('CATEGORY_ID')) {
             define('CATEGORY_ID', intval($cat_url));
         }
     }
     // header("Content-type: text/javascript");
     $file = mw_includes_path() . 'api' . DS . 'api_settings.js';
     $this->app->content_manager->define_constants($ref_page);
     $l = new \Microweber\View($file);
     $l = $l->__toString();
     $compile_assets = \Config::get('microweber.compile_assets');
     if ($compile_assets and defined('MW_VERSION')) {
         $userfiles_dir = userfiles_path();
         $userfiles_cache_dir = normalize_path($userfiles_dir . 'cache' . DS . 'apijs');
         $userfiles_cache_filename = $userfiles_cache_dir . 'api_settings.' . md5(site_url() . template_dir()) . '.' . MW_VERSION . '.js';
         if (!is_file($userfiles_cache_filename)) {
             if (!is_dir($userfiles_cache_dir)) {
                 mkdir_recursive($userfiles_cache_dir);
             }
             if (is_dir($userfiles_cache_dir)) {
                 @file_put_contents($userfiles_cache_filename, $l);
             }
         } else {
             $fmd5 = md5_file($userfiles_cache_filename);
             $fmd = md5($l);
             if ($fmd5 != $fmd) {
                 @file_put_contents($userfiles_cache_filename, $l);
             }
         }
     }
     $response = \Response::make($l);
     $response->header('Content-Type', 'application/javascript');
     return $response;
     // return;
 }
Esempio n. 16
0
<?php

$theme = get_option("bootswatch_theme_css_file", "bootswatch_theme");
$themes = json_decode(file_get_contents(template_dir() . 'css/themes.json'), true);
?>
<script>

$(document).ready(function() {
    $('input[type=radio][name=bootswatch_theme_css_file]').change(function() {
	  
	    if (this.value == '') {
            window.parent.$('head link#bootstrap_theme').attr('href', '<?php 
print template_url();
?>
css/default.css');
        }
        else {
             window.parent.$('head link#bootstrap_theme').attr('href', this.value);
        }
    });
});

</script>

<div class="mw-ui-box">
  <div class="mw-ui-box-header"> <span>Theme Colors</span> </div>
  <ul>
    <li>
      <label class="mw-ui-check">
        <input class="mw_option_field" option-group="bootswatch_theme" type="radio" <?php 
if ($theme == '') {
Esempio n. 17
0
?>
" height="170" />
						<p class="element"><strong>Team Member</strong></p>
						<p class="element"><em>Current Position</em></p>
						<hr class="visible-desktop element">
						<p class="element" align="justify">The following text is ready for edit. Click here and describe your company team members briefly.</p>
						<br>
						<span class="social-icons ement"> <a target="_blank" href="http://www.facebook.com/microweber"><img src="<?php 
print TEMPLATE_URL . "img/mw.soc.fb.png";
?>
" /></a> <a target="_blank" href="http://www.twitter.com/microweber"><img src="<?php 
print TEMPLATE_URL . "img/mw.soc.tw.png";
?>
" /></a> <a target="_blank" href="http://plus.google.com"><img src="<?php 
print TEMPLATE_URL . "img/mw.soc.googplus.png";
?>
" /></a> <a target="_blank" href="http://youtube.com/microweber"><img src="<?php 
print TEMPLATE_URL . "img/mw.soc.yt.png";
?>
" /></a><br>
						</span> </div>
				</div>
			</div>
		</div>
		<p class="element">&nbsp;</p>
	</div>
	<div class="clear"></div>
</div>
<?php 
include template_dir() . "footer.php";
Esempio n. 18
0
     $xoopsTpl->assign('event', edit_eventdata($head));
     $xoopsTpl->assign('items', $items);
     $xoopsTpl->assign('submit', $backanc);
     break;
 default:
     $xoopsOption['template_main'] = EGPREFIX . '_receipt.html';
     $xoopsTpl->assign('lang_title', _MD_RESERVATION);
     $status = 0;
     $pat = $rep = array();
     $pat[] = '{TITLE}';
     $rep[] = $title;
     $pat[] = '{EVENT_URL}';
     $rep[] = EGUIDE_URL . "/event.php?eid={$eid}" . ($exid ? "&sub={$exid}" : '');
     $pat[] = '{REQ_UNAME}';
     $rep[] = $xoopsUser->getVar('uname');
     $template = file_get_contents(template_dir('confirm.tpl') . "/confirm.tpl");
     $mailmsg = htmlspecialchars(str_replace($pat, $rep, $template));
     $max = $xoopsModuleConfig['max_item'];
     $xoopsTpl->assign(array('order_count' => $nrec, 'reserv_num' => sprintf(_MD_RESERV_REG, $nrsv), 'print_date' => formatTimestamp(time(), _MD_POSTED_FMT), 'labels' => array_merge(array($xoopsModuleConfig['member_only'] ? _MD_UNAME : _MD_EMAIL), array_slice($item, 0, $max)), 'reserv_msg' => $mailmsg, 'operations' => array(_RVSTAT_RESERVED => _MD_ACTIVATE, _RVSTAT_REFUSED => _MD_REFUSE)));
     $citem = $list = $nitem = array();
     $confirm = 0;
     while ($order = $xoopsDB->fetchArray($result)) {
         $order['confirm'] = $cf = $order['status'] == _RVSTAT_ORDER;
         if ($cf) {
             $confirm++;
         }
         $order['date'] = formatTimestamp($order['rdate'], _MD_TIME_FMT);
         $order['stat'] = $rv_stats[$order['status']];
         $add = array();
         $ok = $order['status'] == _RVSTAT_RESERVED;
         foreach (unserialize_text($order['info']) as $lab => $v) {