Exemplo n.º 1
0
function mw_stats_track_visit()
{
    if (!isset($_SERVER['HTTP_USER_AGENT']) or stristr($_SERVER['HTTP_USER_AGENT'], 'bot')) {
        return;
    }
    $function_cache_id = false;
    $uip = $_SERVER['REMOTE_ADDR'];
    $function_cache_id = $function_cache_id . $uip . MW_USER_IP;
    $function_cache_id = __FUNCTION__ . crc32($function_cache_id);
    $few_mins_ago_visit_date = date("Y-m-d H:i:s");
    $cookie_name = 'mw-stats' . crc32($function_cache_id);
    $cookie_name_time = 'mw-time' . crc32($function_cache_id);
    $vc1 = 1;
    if (mw()->session->get($cookie_name)) {
        $vc1 = intval(mw()->session->get($cookie_name)) + 1;
        mw()->session->set($cookie_name, $vc1);
    } elseif (!mw()->session->get($cookie_name)) {
        mw()->session->set($cookie_name, $vc1);
    }
    if (!isset($_COOKIE[$cookie_name_time])) {
        if (!headers_sent()) {
            setcookie($cookie_name_time, $few_mins_ago_visit_date, time() + 30);
        }
        $data = array();
        $data['visit_date'] = date("Y-m-d");
        $data['visit_time'] = date("H:i:s");
        $data['user_ip'] = $uip;
        $table = MODULE_DB_USERS_ONLINE;
        $check = db_get("table={$table}&user_ip={$uip}&one=1&limit=1&visit_date=" . $data['visit_date']);
        if ($check != false and is_array($check) and !empty($check) and isset($check['id'])) {
            $data['id'] = $check['id'];
            $vc = 0;
            if (isset($check['view_count'])) {
                $vc = $check['view_count'];
            }
            $vc1 = 0;
            if (mw()->session->get($cookie_name)) {
                $vc1 = intval(mw()->session->get($cookie_name));
            }
            $vc = $vc + $vc1;
            $data['view_count'] = $vc;
        }
        $lp = url_current(true);
        if ($lp == false) {
            if (isset($_SERVER['HTTP_REFERER'])) {
                $lp = $_SERVER['HTTP_REFERER'];
            } else {
                $lp = $_SERVER['PHP_SELF'];
            }
        }
        $data['last_page'] = $lp;
        //$data['skip_cache'] = 1;
        $save = mw()->database_manager->save($table, $data);
        mw()->session->set($cookie_name, 0);
    }
    return true;
}
Exemplo n.º 2
0
    ?>
<div id="mw-admin-container">
<div class="mw-ui-row main-admin-row">
<div class="mw-ui-col main-bar-column">
          <div id="main-bar" class="scroll-height-exception-master">
    <?php 
    $view = url_param('view');
    ?>
    <?php 
    $action = url_param('action');
    ?>
    <a href="<?php 
    print admin_url();
    ?>
" id="main-bar-mw-icon" class="scroll-height-exception <?php 
    if ($view == 'dashboard' or url_current() == admin_url() or url_current() == rtrim(admin_url(), '/')) {
        print 'active';
    }
    ?>
">
            <?php 
    if (mw()->ui->admin_logo != false) {
        ?>
            <img src="<?php 
        print mw()->ui->admin_logo;
        ?>
" style="max-width:36px;" />
            <?php 
    } else {
        ?>
            <span class="mw-icon-mw"></span>
Exemplo n.º 3
0
 public function load($module_name, $attrs = array())
 {
     $is_element = false;
     $custom_view = false;
     if (isset($attrs['view'])) {
         $custom_view = $attrs['view'];
         $custom_view = trim($custom_view);
         $custom_view = str_replace('\\', '/', $custom_view);
         $attrs['view'] = $custom_view = str_replace('..', '', $custom_view);
     }
     if ($custom_view != false and strtolower($custom_view) == 'admin') {
         if ($this->app->user_manager->is_admin() == false) {
             mw_error('Not logged in as admin');
         }
     }
     $module_name = trim($module_name);
     $module_name = str_replace('\\', '/', $module_name);
     $module_name = str_replace('..', '', $module_name);
     // prevent hack of the directory
     $module_name = reduce_double_slashes($module_name);
     $module_namei = $module_name;
     if (strstr($module_name, 'admin')) {
         $module_namei = str_ireplace('\\admin', '', $module_namei);
         $module_namei = str_ireplace('/admin', '', $module_namei);
     }
     //$module_namei = str_ireplace($search, $replace, $subject)e
     $uninstall_lock = $this->app->modules->get('one=1&ui=any&module=' . $module_namei);
     if (isset($uninstall_lock["installed"]) and $uninstall_lock["installed"] != '' and intval($uninstall_lock["installed"]) != 1) {
         return '';
     }
     if (!defined('ACTIVE_TEMPLATE_DIR')) {
         $this->app->content_manager->define_constants();
     }
     $module_in_template_dir = ACTIVE_TEMPLATE_DIR . 'modules/' . $module_name . '';
     $module_in_template_dir = normalize_path($module_in_template_dir, 1);
     $module_in_template_file = ACTIVE_TEMPLATE_DIR . 'modules/' . $module_name . '.php';
     $module_in_template_file = normalize_path($module_in_template_file, false);
     $try_file1 = false;
     $mod_d = $module_in_template_dir;
     $mod_d1 = normalize_path($mod_d, 1);
     $try_file1zz = $mod_d1 . 'index.php';
     $in_dir = false;
     if ($custom_view == true) {
         $try_file1zz = $mod_d1 . trim($custom_view) . '.php';
     } else {
         $try_file1zz = $mod_d1 . 'index.php';
     }
     if (is_dir($module_in_template_dir) and is_file($try_file1zz)) {
         $try_file1 = $try_file1zz;
         $in_dir = true;
     } elseif (is_file($module_in_template_file)) {
         $try_file1 = $module_in_template_file;
         $in_dir = false;
     } else {
         $module_in_default_dir = modules_path() . $module_name . '';
         $module_in_default_dir = normalize_path($module_in_default_dir, 1);
         // d($module_in_default_dir);
         $module_in_default_file = modules_path() . $module_name . '.php';
         $module_in_default_file_custom_view = modules_path() . $module_name . '_' . $custom_view . '.php';
         $element_in_default_file = elements_path() . $module_name . '.php';
         $element_in_default_file = normalize_path($element_in_default_file, false);
         //
         $module_in_default_file = normalize_path($module_in_default_file, false);
         if (is_file($module_in_default_file)) {
             $in_dir = false;
             if ($custom_view == true and is_file($module_in_default_file_custom_view)) {
                 $try_file1 = $module_in_default_file_custom_view;
             } else {
                 $try_file1 = $module_in_default_file;
             }
         } else {
             if (is_dir($module_in_default_dir)) {
                 $in_dir = true;
                 $mod_d1 = normalize_path($module_in_default_dir, 1);
                 if ($custom_view == true) {
                     $try_file1 = $mod_d1 . trim($custom_view) . '.php';
                 } else {
                     $try_file1 = $mod_d1 . 'index.php';
                 }
             } elseif (is_file($element_in_default_file)) {
                 $in_dir = false;
                 $is_element = true;
                 $try_file1 = $element_in_default_file;
             }
         }
     }
     //
     if (isset($try_file1) != false and $try_file1 != false and is_file($try_file1)) {
         if (isset($attrs) and is_array($attrs) and !empty($attrs)) {
             $attrs2 = array();
             foreach ($attrs as $attrs_k => $attrs_v) {
                 $attrs_k2 = substr($attrs_k, 0, 5);
                 if (strtolower($attrs_k2) == 'data-') {
                     $attrs_k21 = substr($attrs_k, 5);
                     $attrs2[$attrs_k21] = $attrs_v;
                 } elseif (!isset($attrs['data-' . $attrs_k])) {
                     $attrs2['data-' . $attrs_k] = $attrs_v;
                 }
                 $attrs2[$attrs_k] = $attrs_v;
             }
             $attrs = $attrs2;
         }
         $config['path_to_module'] = $config['mp'] = $config['path'] = normalize_path(dirname($try_file1) . '/', true);
         $config['the_module'] = $module_name;
         $config['module'] = $module_name;
         $module_name_dir = dirname($module_name);
         $config['module_name'] = $module_name_dir;
         $config['module_name_url_safe'] = $this->module_name_encode($module_name);
         $find_base_url = $this->app->url_manager->current(1);
         if ($pos = strpos($find_base_url, ':' . $module_name) or $pos = strpos($find_base_url, ':' . $config['module_name_url_safe'])) {
             $find_base_url = substr($find_base_url, 0, $pos) . ':' . $config['module_name_url_safe'];
         }
         $config['url'] = $find_base_url;
         $config['url_main'] = $config['url_base'] = strtok($find_base_url, '?');
         if ($in_dir != false) {
             $mod_api = str_replace('/admin', '', $module_name);
         } else {
             $mod_api = str_replace('/admin', '', $module_name_dir);
         }
         $config['module_api'] = $this->app->url_manager->site('api/' . $mod_api);
         $config['module_view'] = $this->app->url_manager->site('module/' . $module_name);
         $config['ns'] = str_replace('/', '\\', $module_name);
         $config['module_class'] = $this->module_css_class($module_name);
         $config['url_to_module'] = $this->app->url_manager->link_to_file($config['path_to_module']);
         if (isset($attrs['id'])) {
             $attrs['id'] = str_replace('__MODULE_CLASS_NAME__', $config['module_class'], $attrs['id']);
             $template = false;
         }
         //$config['url_to_module'] = rtrim($config['url_to_module'], '///');
         $lic = $this->app->modules->license($module_name);
         //  $lic = 'valid';
         if ($lic != false) {
             $config['license'] = $lic;
         }
         if (isset($attrs['module-id']) and $attrs['module-id'] != false) {
             $attrs['id'] = $attrs['module-id'];
         }
         if (!isset($attrs['id'])) {
             global $mw_mod_counter;
             $mw_mod_counter++;
             //  $seg_clean = $this->app->url_manager->segment(0);
             $seg_clean = $this->app->url_manager->segment(0, url_current());
             if (defined('IS_HOME')) {
                 $seg_clean = '';
             }
             $seg_clean = str_replace('%20', '-', $seg_clean);
             $seg_clean = str_replace(' ', '-', $seg_clean);
             $seg_clean = str_replace('.', '', $seg_clean);
             $attrs1 = crc32(serialize($attrs) . $seg_clean . $mw_mod_counter);
             $attrs1 = str_replace('%20', '-', $attrs1);
             $attrs1 = str_replace(' ', '-', $attrs1);
             $attrs['id'] = $config['module_class'] . '-' . $attrs1;
         }
         if (isset($attrs['id']) and strstr($attrs['id'], '__MODULE_CLASS_NAME__')) {
             $attrs['id'] = str_replace('__MODULE_CLASS_NAME__', $config['module_class'], $attrs['id']);
             //$attrs['id'] = ('__MODULE_CLASS__' . '-' . $attrs1);
         }
         $l1 = new \Microweber\View($try_file1);
         $l1->config = $config;
         $l1->app = $this->app;
         if (!isset($attrs['module'])) {
             $attrs['module'] = $module_name;
         }
         if (!isset($attrs['parent-module'])) {
             $attrs['parent-module'] = $module_name;
         }
         if (!isset($attrs['parent-module-id'])) {
             $attrs['parent-module-id'] = $attrs['id'];
         }
         //            $mw_restore_get = mw_var('mw_restore_get');
         //            if ($mw_restore_get != false and is_array($mw_restore_get)) {
         //                $l1->_GET = $mw_restore_get;
         //                $_GET = $mw_restore_get;
         //            }
         if (defined('MW_MODULE_ONDROP')) {
             if (!isset($attrs['ondrop'])) {
                 $attrs['ondrop'] = true;
             }
         }
         $l1->params = $attrs;
         if ($config) {
             $this->current_module = $config;
         }
         if ($attrs) {
             $this->current_module_params = $attrs;
         }
         if (isset($attrs['view']) && trim($attrs['view']) == 'empty') {
             $module_file = EMPTY_MOD_STR;
         } elseif (isset($attrs['view']) && trim($attrs['view']) == 'admin') {
             $module_file = $l1->__toString();
         } else {
             if (isset($attrs['display']) && trim($attrs['display']) == 'custom') {
                 $module_file = $l1->__get_vars();
                 return $module_file;
             } else {
                 if (isset($attrs['format']) && trim($attrs['format']) == 'json') {
                     $module_file = $l1->__get_vars();
                     header("Content-type: application/json");
                     exit(json_encode($module_file));
                 } else {
                     $module_file = $l1->__toString();
                 }
             }
         }
         //	$l1 = null;
         unset($l1);
         if ($lic != false and isset($lic["error"]) and $lic["error"] == 'no_license_found') {
             $lic_l1_try_file1 = MW_ADMIN_VIEWS_DIR . 'activate_license.php';
             $lic_l1 = new \Microweber\View($lic_l1_try_file1);
             $lic_l1->config = $config;
             $lic_l1->params = $attrs;
             $lic_l1e_file = $lic_l1->__toString();
             unset($lic_l1);
             $module_file = $lic_l1e_file . $module_file;
         }
         // $mw_loaded_mod_memory[$function_cache_id] = $module_file;
         return $module_file;
     } else {
         //define($cache_content, FALSE);
         // $mw_loaded_mod_memory[$function_cache_id] = false;
         return false;
     }
 }
Exemplo n.º 4
0
  <?php 
    }
    ?>
  <?php 
} else {
    ?>
  <div class="alert alert-warining text-center"><?php 
    _e("You must click on the password reset link sent on your email");
    ?>
.<br /><br />
<a class="btn btn-default  btn-info" href="<?php 
    print url_current(true, true);
    ?>
"><?php 
    _e("Go back");
    ?>
</a>  </div>
  <?php 
}
?>
  <div class="reset-pass-form-wrap-success" style="display:none"> <a class="btn btn-default  btn-primary" href="<?php 
print url_current(true, true);
?>
"><?php 
_e("Click here to login with the new password");
?>
</a> </div>
</div>

</div>
Exemplo n.º 5
0
(function(d, s, id) {
  var js, fjs = d.getElementsByTagName(s)[0];
  if (d.getElementById(id)) return;
  js = d.createElement(s); js.id = id;
  js.src = "//connect.facebook.net/en_US/sdk.js#xfbml=1&appId=<?php 
print $facebook_app_id;
?>
&version=v2.0";
  fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));

</script>



<div class="fb-comments" data-width="100%" data-href="<?php 
print url_current();
?>
" data-numposts="<?php 
print $facebook_number_of_comments;
?>
" data-colorscheme="<?php 
print $facebook_color_scheme;
?>
"></div>


 
 
 
Exemplo n.º 6
0
if ($color == false and isset($params['color'])) {
    $color = $params['color'];
}
if ($show_faces == false and isset($params['show-faces'])) {
    $show_faces = $params['show-faces'];
}
if ($url_to_like == false and isset($params['url-to-like'])) {
    $url_to_like = $params['url-to-like'];
}
if ($layout == false or trim($layout) == '') {
    $layout = "standard";
} else {
    $layout = trim($layout);
}
if ($url_to_like == false or trim($url_to_like) == '') {
    $cur_url = url_current(true);
    $cur_url = urlencode($cur_url);
    $url_to_like = $cur_url;
} else {
    $url_to_like = mw('format')->prep_url(trim($url_to_like));
}
if ($color == false or trim($color) == '') {
    $color = "light";
}
$show_faces_str = '';
if ($show_faces == false or trim($show_faces) != 'n') {
    $show_faces_str = '&amp;show_faces=true';
}
?>

<div class='mwembed'>