本文整理汇总了PHP中mw_var函数的典型用法代码示例。如果您正苦于以下问题:PHP mw_var函数的具体用法?PHP mw_var怎么用?PHP mw_var使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了mw_var函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: mw_var
<?php
/*
type: layout
content_type: static
name: Home
position: 11
description: Home layout
*/
mw_var('photon_layout', 'photon-default');
include THIS_TEMPLATE_DIR . "header.php";
?>
<style type="text/css">
#main-content-holder{
max-width: none;
}
</style>
<div data-mw="main">
<module
data-type="posts"
data-limit="0"
id="home-posts"
data-description-length="100"
data-show="thumbnail"
data-hide-paging="true"
data-template="justified" />
</div>
<?php
include THIS_TEMPLATE_DIR . "footer.php";
示例2: send_forgot_password
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!');
}
}
}
}
示例3: module
//.........这里部分代码省略.........
$possible_layout = templates_path() . $t;
$possible_layout = normalize_path($possible_layout, false);
if (is_file($possible_layout)) {
$l = new \Microweber\View($possible_layout);
$layout = $l->__toString();
$layout = $this->app->parser->process($layout, $options = false);
echo $layout;
return;
}
}
}
$has_id = false;
if (isset($data) and is_array($data)) {
foreach ($data as $k => $v) {
if ($k != 'ondrop') {
if ($k == 'id') {
$has_id = true;
}
if (is_array($v)) {
$v1 = $this->app->format->array_to_base64($v);
$tags .= "{$k}=\"{$v1}\" ";
} else {
$v = $this->app->format->clean_html($v);
//$v = $this->app->database_manager->escape_string($v);
$tags .= "{$k}=\"{$v}\" ";
}
}
}
}
if ($has_id == false) {
// $mod_n = $this->app->url_manager->slug($mod_n) . '-' . date("YmdHis");
// $tags .= "id=\"$mod_n\" ";
}
$tags = "<module {$tags} />";
$opts = array();
if ($_REQUEST) {
$opts = $_REQUEST;
}
if (isset($_REQUEST['live_edit'])) {
event_trigger('mw.live_edit');
}
$opts['admin'] = $admin;
if ($admin == 'admin') {
event_trigger('mw_backend');
event_trigger('mw.admin');
} else {
event_trigger('mw_frontend');
event_trigger('mw.front');
}
if (isset($_SERVER['HTTP_REFERER']) and $_SERVER['HTTP_REFERER'] != false) {
$get_arr_from_ref = $_SERVER['HTTP_REFERER'];
if (strstr($get_arr_from_ref, $this->app->url_manager->site())) {
$get_arr_from_ref_arr = parse_url($get_arr_from_ref);
if (isset($get_arr_from_ref_arr['query']) and $get_arr_from_ref_arr['query'] != '') {
$restore_get = parse_str($get_arr_from_ref_arr['query'], $get_array);
if (is_array($get_array)) {
mw_var('mw_restore_get', $get_array);
}
//
}
}
}
$res = $this->app->parser->process($tags, $opts);
$res = preg_replace('~<(?:!DOCTYPE|/?(?:html|head|body))[^>]*>\\s*~i', '', $res);
if ($embed != false) {
$p_index = mw_includes_path() . 'api/index.php';
$p_index = normalize_path($p_index, false);
$l = new \Microweber\View($p_index);
$layout = $l->__toString();
$res = str_replace('{content}', $res, $layout);
}
$aj = $this->app->url_manager->is_ajax();
if (isset($_REQUEST['live_edit']) and $aj == false) {
$p_index = mw_includes_path() . DS . 'toolbar' . DS . 'editor_tools' . DS . 'module_settings' . DS . 'index.php';
$p_index = normalize_path($p_index, false);
$l = new \Microweber\View($p_index);
$l->params = $data;
$layout = $l->__toString();
$res = str_replace('{content}', $res, $layout);
$res = $this->app->parser->process($res, $options = false);
}
$res = execute_document_ready($res);
if (!defined('MW_NO_OUTPUT')) {
$res = $this->app->url_manager->replace_site_url_back($res);
echo $res;
}
if ($url_last != __FUNCTION__) {
if (function_exists($url_last)) {
//
$this->api($url_last);
} elseif (isset($url_prev) and function_exists($url_prev)) {
$this->api($url_last);
} elseif (class_exists($url_last, false)) {
$this->api($url_last);
} elseif (isset($url_prev) and class_exists($url_prev, false)) {
$this->api($url_prev);
}
}
return;
}
示例4: stats_insert_cookie_based
function stats_insert_cookie_based()
{
$function_cache_id = false;
$uip = $_SERVER['REMOTE_ADDR'];
$function_cache_id = $function_cache_id . $uip . MW_USER_IP;
$cookie_name = 'mw-stats' . crc32($function_cache_id);
$cookie_name_time = 'mw-time' . crc32($function_cache_id);
$vc1 = 1;
$few_mins_ago_visit_date = date("Y-m-d H:i:s");
if (isset($_COOKIE[$cookie_name])) {
$vc1 = intval($_COOKIE[$cookie_name]) + 1;
// mw()->session->get($cookie_name) = $vc1;
setcookie($cookie_name, $vc1, time() + 99);
// return true;
} elseif (!isset($_COOKIE[$cookie_name])) {
setcookie($cookie_name, $vc1, time() + 99);
//mw()->session->get($cookie_name) = $vc1;
// return true;
}
if (!isset($_COOKIE[$cookie_name_time])) {
setcookie($cookie_name_time, $few_mins_ago_visit_date, time() + 90);
$data = array();
$data['visit_date'] = date("Y-m-d", strtotime("now"));
$data['visit_time'] = date("H:i:s", strtotime("now"));
$table = MODULE_DB_USERS_ONLINE;
$check = db_get("no_cache=1&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 (isset($_COOKIE[$cookie_name])) {
$vc1 = intval($_COOKIE[$cookie_name]);
}
$vc = $vc + $vc1;
$data['view_count'] = $vc;
}
if (isset($_SERVER['HTTP_REFERER'])) {
$lp = $_SERVER['HTTP_REFERER'];
} else {
$lp = $_SERVER['PHP_SELF'];
}
$data['last_page'] = $lp;
$data['skip_cache'] = 1;
if (mw()->user_manager->session_id() and !(mw()->user_manager->session_all() == false)) {
$data['session_id'] = mw()->user_manager->session_id();
}
mw_var('FORCE_SAVE', $table);
mw_var('apc_no_clear', 1);
$save = mw()->database_manager->save($table, $data);
setcookie($cookie_name, 0, time() + 99);
}
return true;
}
示例5: mw_var
<?php
/*
type: layout
content_type: dynamic
name: Online Shop
is_shop: y
description: shop layout
position: 4
*/
mw_var('photon_layout', 'photon-inner');
include THIS_TEMPLATE_DIR . "header.php";
?>
<style>
body.photon-inner #main-content-holder{
background-color: transparent;
}
</style>
<section id="content">
<div class="container">
<div class="mw-ui-row" id="shop-products-conteiner">
<div class="mw-ui-col">
<div class="mw-ui-col-container">
<module type="shop/products" template="" limit="6" description-length="160" hide-paging="n" />
</div>
</div>
</div>
</div>
</section>
<?php
include THIS_TEMPLATE_DIR . "footer.php";
示例6: post
public function post($params)
{
$adm = $this->app->user_manager->is_admin();
if (defined("MW_API_CALL")) {
// $validate_token = $this->app->user_manager->csrf_validate($params);
// if (!$adm) {
// if ($validate_token == false) {
// return array('error' => 'Invalid token!');
// }
// }
}
$before_process = $this->app->event_manager->trigger('mw.forms_manager.before_post', $params);
if (is_array($before_process) and !empty($before_process)) {
foreach ($before_process as $before_process_item) {
if ($before_process_item === false) {
return;
}
}
}
$table = MW_DB_TABLE_FORMS_DATA;
mw_var('FORCE_SAVE', $table);
if (isset($params['id'])) {
if ($adm == false) {
return array('error' => 'Error: Only admin can edit forms!');
}
}
$for = 'module';
if (isset($params['for'])) {
$for = $params['for'];
}
if (isset($params['for_id'])) {
$for_id = $params['for_id'];
} else {
if (isset($params['data-id'])) {
$for_id = $params['data-id'];
} else {
if (isset($params['id'])) {
$for_id = $params['id'];
}
}
}
if (isset($params['rel_id'])) {
$for_id = $params['rel_id'];
}
if (!isset($for_id)) {
return array('error' => 'Please provide for_id parameter with module id');
}
$dis_cap = $this->app->option_manager->get('disable_captcha', $for_id) == 'y';
if ($dis_cap == false) {
if (!isset($params['captcha'])) {
return array('error' => 'Please enter the captcha answer!');
} else {
if ($for_id != false) {
$validate_captcha = mw()->captcha->validate($params['captcha'], $for_id);
} else {
$validate_captcha = mw()->captcha->validate($params['captcha']);
}
if (!$validate_captcha) {
if ($adm == false) {
return array('error' => 'Invalid captcha answer!', 'captcha_error' => true);
}
}
}
}
// if ($for=='module'){
$list_id = $this->app->option_manager->get('list_id', $for_id);
// }
$email_to = $this->app->option_manager->get('email_to', $for_id);
$email_bcc = $this->app->option_manager->get('email_bcc', $for_id);
$email_autorespond = $this->app->option_manager->get('email_autorespond', $for_id);
$email_autorespond_subject = $this->app->option_manager->get('email_autorespond_subject', $for_id);
if (!isset($list_id) or $list_id == false) {
$list_id = 0;
}
$to_save = array();
$fields_data = array();
$get_fields = array();
$get_fields['rel_type'] = $for;
$get_fields['rel_id'] = $for_id;
$get_fields['return_full'] = true;
$more = $this->app->fields_manager->get($get_fields);
$cf_to_save = array();
if (!empty($more)) {
foreach ($more as $item) {
if (isset($item['name'])) {
$cfn = $item['name'];
$cfn2 = str_replace(' ', '_', $cfn);
if (isset($params[$cfn2]) and $params[$cfn2] != false) {
$fields_data[$cfn2] = $params[$cfn2];
$item['value'] = $params[$cfn2];
$cf_to_save[$cfn] = $item;
} elseif (isset($params[$cfn]) and $params[$cfn] != false) {
$fields_data[$cfn] = $params[$cfn];
$item['value'] = $params[$cfn2];
$cf_to_save[$cfn] = $item;
}
}
}
} else {
$cf_to_save = $params;
//.........这里部分代码省略.........
示例7: save
public function save($params)
{
$force = false;
if (defined('MW_FORCE_USER_SAVE')) {
$force = MW_FORCE_USER_SAVE;
} elseif ($this->force_save) {
$force = $this->force_save;
} elseif (mw_var('force_save_user')) {
$force = mw_var('force_save_user');
}
if (!$force) {
if (defined('MW_API_CALL') and mw_is_installed() == true) {
if (isset($params['is_admin']) and $this->is_admin() == false and !is_null(User::first())) {
unset($params['is_admin']);
}
}
}
if ($force == false) {
if (isset($params['id']) and $params['id'] != 0) {
$adm = $this->is_admin();
if ($adm == false) {
$is_logged = user_id();
if ($is_logged == false or $is_logged == 0) {
return array('error' => 'You must be logged to save user');
} elseif (intval($is_logged) == intval($params['id']) and intval($params['id']) != 0) {
// the user is editing their own profile
} else {
return array('error' => 'You must be logged to as admin save this user');
}
}
} else {
if (defined('MW_API_CALL') and mw_is_installed() == true) {
$adm = $this->is_admin();
if ($adm == false) {
$params['id'] = $this->id();
$is_logged = user_id();
if (intval($params['id']) != 0 and $is_logged != $params['id']) {
return array('error' => 'You must be logged save your settings');
}
} else {
if (!isset($params['id'])) {
$params['id'] = $this->id();
}
}
}
}
}
$data_to_save = $params;
if (isset($data_to_save['id']) and $data_to_save['id'] != 0 and isset($data_to_save['email']) and $data_to_save['email'] != false) {
$old_user_data = $this->get_by_id($data_to_save['id']);
if (isset($old_user_data['email']) and $old_user_data['email'] != false) {
if ($data_to_save['email'] != $old_user_data['email']) {
if (isset($old_user_data['password_reset_hash']) and $old_user_data['password_reset_hash'] != false) {
$hash_cache_id = md5(serialize($old_user_data)) . uniqid() . rand();
$data_to_save['password_reset_hash'] = $hash_cache_id;
}
}
}
}
if (isset($data_to_save['email']) and isset($data_to_save['id'])) {
$email = trim($data_to_save['email']);
if (filter_var($email, FILTER_VALIDATE_EMAIL)) {
$check_existing = array();
$check_existing['email'] = $email;
$check_existing['single'] = 1;
$check_existing = $this->get_all($check_existing);
if (isset($check_existing['id']) and $check_existing['id'] != $data_to_save['id']) {
return array('error' => 'User with this email already exists! Try different email address!');
}
}
}
if (isset($params['id']) and intval($params['id']) != 0) {
$user = User::find($params['id']);
} else {
$user = new User();
}
$id_to_return = false;
$data_to_save = $this->app->format->clean_xss($data_to_save);
if ($user->validateAndFill($data_to_save)) {
$save = $user->save();
if (isset($user->id)) {
$data_to_save['id'] = $params['id'] = $user->id;
}
if (isset($data_to_save['username']) and $data_to_save['username'] != false and isset($data_to_save['id']) and $data_to_save['id'] != false) {
$check_existing = array();
$check_existing['username'] = $data_to_save['username'];
$check_existing['single'] = 1;
$check_existing = $this->get_all($check_existing);
if (isset($check_existing['id']) and $check_existing['id'] != $data_to_save['id']) {
return array('error' => 'User with this username already exists! Try different username!');
}
}
if (isset($params['attributes']) or isset($params['data_fields'])) {
$params['extended_save'] = true;
}
if (isset($params['extended_save'])) {
if (isset($data_to_save['password'])) {
unset($data_to_save['password']);
}
if (isset($data_to_save['id'])) {
//.........这里部分代码省略.........
示例8: mw_var
<?php
$is_new = mw_var('new_page');
$data = array();
$data['id'] = 0;
$data['content_type'] = 'page';
$data['title'] = 'Title';
$data['url'] = '';
$data['thumbnail'] = '';
$data['is_active'] = 1;
$data['is_home'] = 0;
$data['is_shop'] = 0;
$data['subtype'] = 'static';
$data['description'] = '';
$data['active_site_template'] = '';
$data['subtype_value'] = '';
$data['parent'] = 0;
$data['layout_name'] = '';
$data['layout_file'] = '';
if ($is_new != false) {
foreach ($is_new as $k => $v) {
$data[$k] = $v;
}
}
示例9: mw_includes_path
<div class="mw-admin-editor <?php
print $mainclass;
?>
" id="the_admin_editor">
<?php
//include mw_includes_path() . DS . 'toolbar' . DS ."wysiwyg_admin.php";
?>
<?php
include mw_includes_path() . DS . 'toolbar' . DS . "wysiwyg_tiny.php";
?>
<div class="mw-admin-editor-area" id="mw-iframe-editor-area" tabindex="0" >{content}</div>
</div>
<?php
mw_var('plain_modules', false);
?>
<span class="mw-plus-top">+</span>
<span class="mw-plus-bottom">+</span>
<div style="display: none" id="plus-modules-list">
<input type="text" class="mw-ui-searchfield" />
<div class="mw-ui-btn-nav mw-ui-btn-nav-tabs pull-left">
<span class="mw-ui-btn active"><span class="mw-icon-module"></span><?php
_e("Modules");
?>
</span>
<span class="mw-ui-btn"><span class="mw-icon-template"></span><?php
_e("Layouts");
?>
</span>
示例10: load
//.........这里部分代码省略.........
$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'] = 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->css_class($module_name);
$config['url_to_module'] = $this->app->url_manager->link_to_file($config['path_to_module']);
$get_module_template_settings_from_options = mw_var('get_module_template_settings_from_options');
if (isset($attrs['id'])) {
$attrs['id'] = str_replace('__MODULE_CLASS_NAME__', $config['module_class'], $attrs['id']);
$template = false;
}
$lic = $this->license($module_name);
// $lic = 'valid';
if ($lic != false) {
$config['license'] = $lic;
}
if (!isset($attrs['id']) and 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);
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);
示例11: mw_var
<meta name="keywords" content="{content_meta_keywords}">
<meta name="description" content="{content_meta_description}">
<!-- Site Open Graph Meta Data -->
<meta property="og:title" content="{content_meta_title}">
<meta property="og:type" content="{og_type}">
<meta property="og:url" content="{content_url}">
<meta property="og:image" content="{content_image}">
<meta property="og:description" content="{og_description}">
<meta property="og:site_name" content="{og_site_name}">
<?php
include 'header_scripts.php';
?>
</head>
<body class="<?php
print mw_var('photon_layout');
?>
">
<div id="site-main">
<module type="shop/cart" template="small" id="header-cart">
<div id="sidenav" class="active">
<div id="side-nav-content">
<div class="edit" rel="global" field="header">
<module type="logo" id="logo" />
<module type="menu" name="header_menu" id="main-navigation" template="photon" />
<hr>
<module type="social_links" id="nav-social-links">
</div>
<div id="copyright" class="edit" field="copyright" rel="global">
<a href="<?php
示例12: post_comment
function post_comment($data)
{
$adm = is_admin();
$table = MODULE_DB_COMMENTS;
mw_var('FORCE_SAVE', $table);
if (isset($data['id'])) {
if ($adm == false) {
error('Error: Only admin can edit comments!');
}
}
if (defined("MW_API_CALL")) {
if (!$adm) {
$validate_token = mw()->user_manager->csrf_validate($data);
if ($validate_token == false) {
return array('error' => 'Invalid token!');
}
}
}
if (isset($data['action']) and isset($data['id'])) {
if ($adm == false) {
error('Error: Only admin can edit comments!');
} else {
$action = strtolower($data['action']);
switch ($action) {
case 'publish':
$data['is_moderated'] = 1;
break;
case 'unpublish':
$data['is_moderated'] = 0;
break;
case 'spam':
$data['is_moderated'] = 0;
break;
case 'delete':
$del = mw()->database_manager->delete_by_id($table, $id = intval($data['id']), $field_name = 'id');
return array('success' => 'Deleted comment with id:' . $id);
return $del;
break;
default:
break;
}
}
} else {
if (isset($data['rel'])) {
$data['rel_type'] = $data['rel'];
}
if (!isset($data['rel_type'])) {
return array('error' => 'Error: invalid data');
}
if (!isset($data['rel_id'])) {
return array('error' => 'Error: invalid data');
} else {
if (trim($data['rel_id']) == '') {
return array('error' => 'Error: invalid data');
}
}
if (!isset($data['captcha'])) {
return array('error' => 'Please enter the captcha answer!');
} else {
$cap = mw()->user_manager->session_get('captcha');
if (isset($data['module_id'])) {
$captcha_sid = 'captcha_' . $data['module_id'];
$cap_sid = mw()->user_manager->session_get($captcha_sid);
if ($cap_sid != false) {
$cap = $cap_sid;
}
}
if ($cap == false) {
return array('error' => 'You must load a captcha first!');
}
if (intval($data['captcha']) != $cap) {
if ($adm == false) {
return array('error' => 'Invalid captcha answer!');
}
}
}
}
if (!isset($data['id']) and isset($data['comment_body'])) {
if (!isset($data['comment_email']) and user_id() == 0) {
return array('error' => 'You must type your email or be logged in order to comment.');
}
$ref = mw()->url_manager->current(1);
if ($ref != false and $ref != '') {
$data['from_url'] = htmlentities(strip_tags(mw()->url_manager->current(1)));
}
}
if ($adm == true and !isset($data['id']) and !isset($data['is_moderated'])) {
$data['is_moderated'] = '1';
} else {
$require_moderation = get_option('require_moderation', 'comments');
if ($require_moderation != 'y') {
$data['is_moderated'] = '0';
}
}
if (!isset($data['id'])) {
$data['is_new'] = '1';
}
$data['allow_html'] = true;
$data = mw()->format->clean_xss($data);
$saved_data = mw()->database_manager->save($table, $data);
//.........这里部分代码省略.........
示例13: ob_start
// $restore->debug = 1;
ob_start();
$rest = $restore->exec_restore();
ob_get_clean();
__mw_install_log('Default content is installed');
}
}
}
if (isset($to_save['default_template']) and $to_save['default_template'] != false and $to_save['default_template'] != '{default_template}') {
$templ = $to_save['default_template'];
$templ = str_replace('..', '', $templ);
$option = array();
$option['option_value'] = trim($templ);
$option['option_key'] = 'current_template';
$option['option_group'] = 'template';
mw_var('FORCE_SAVE', get_table_prefix() . 'options');
$option = mw('option')->save($option);
mw()->cache_manager->delete('options');
}
__mw_install_log('Clearing cache after install');
mw()->cache_manager->clear();
// mw()->content_manager->create_default_content('install');
if ($auto_install != false) {
$done = true;
$f = mw_includes_path() . 'install' . DIRECTORY_SEPARATOR . 'main.php';
include $f;
exit;
} else {
print 'done';
}
__mw_install_log('done');
示例14: mark_as_old
static function mark_as_old($data)
{
only_admin_access();
if (isset($data['content_id'])) {
$table = MODULE_DB_COMMENTS;
mw_var('FORCE_SAVE', $table);
$data['is_new'] = 1;
$get_comm = get_comments($data);
if (!empty($get_comm)) {
foreach ($get_comm as $get_com) {
$upd = array();
$upd['is_new'] = 0;
$upd['id'] = $get_com['id'];
$upd['rel_type'] = 'content';
$upd['rel_id'] = mw()->database_manager->escape_string($data['content_id']);
mw()->database_manager->save($table, $upd);
}
}
return $get_comm;
}
}
示例15: user_id_from_url
<? $dashboard_user = user_id_from_url();
?>
<div id="sidebar">
<microweber module="users/new" dashboard_user="<? mw_var($dashboard_user) ?>" limit="12"></microweber>
<microweber module="users/new" dashboard_user="<? mw_var($dashboard_user) ?>" limit="3"></microweber>
<p align="right"><a class="mw_blue_link" href="<?php
print site_url('dashboard/action:find-friends');
?>
">Find New Friends</a> | <a href="<?php
print site_url('dashboard/action:my-friends');
?>
" class="mw_blue_link">See your friends</a></p>
<br />
<br />
<? include(TEMPLATE_DIR.'banner_side.php') ; ?>
<br />
<br />
<?
$var_params= array();