function can_process()
{
    $Auth_Result = hook_authenticate($_SESSION["wa_current_user"]->username, $_POST['cur_password']);
    if (!isset($Auth_Result)) {
        // if not used external login: standard method
        $Auth_Result = get_user_auth($_SESSION["wa_current_user"]->username, md5($_POST['cur_password']));
    }
    if (!$Auth_Result) {
        display_error(_("Invalid password entered."));
        set_focus('cur_password');
        return false;
    }
    if (strlen($_POST['password']) < 4) {
        display_error(_("The password entered must be at least 4 characters long."));
        set_focus('password');
        return false;
    }
    if (strstr($_POST['password'], $_SESSION["wa_current_user"]->username) != false) {
        display_error(_("The password cannot contain the user login."));
        set_focus('password');
        return false;
    }
    if ($_POST['password'] != $_POST['passwordConfirm']) {
        display_error(_("The passwords entered are not the same."));
        set_focus('password');
        return false;
    }
    return true;
}
Example #2
0
 public function index()
 {
     $GLOBALS['tmpl']->caching = true;
     $GLOBALS['tmpl']->cache_lifetime = 600;
     $cache_id = md5(MODULE_NAME . ACTION_NAME . trim($_REQUEST['id']) . intval($_REQUEST['p']));
     if (!$GLOBALS['tmpl']->is_cached('page/space_index.html', $cache_id)) {
         $this->init();
         $title = sprintf($GLOBALS['lang']['WHOS_SPACE'], $this->space_user['user_name']);
         $site_nav[] = array('name' => $GLOBALS['lang']['HOME_PAGE'], 'url' => APP_ROOT . "/");
         $site_nav[] = array('name' => $title, 'url' => url("index", "space", array("id" => $this->space_user['id'])));
         $site_nav[] = array('name' => $GLOBALS['lang']['SPACE_HOME'], 'url' => url("index", "space", array("id" => $this->space_user['id'])));
         $GLOBALS['tmpl']->assign("site_nav", $site_nav);
         $GLOBALS['tmpl']->assign("page_title", $title);
         $GLOBALS['tmpl']->assign("page_keyword", $title . ",");
         $GLOBALS['tmpl']->assign("page_description", $title . ",");
         //输出发言列表
         $page = intval($_REQUEST['p']);
         if ($page == 0) {
             $page = 1;
         }
         $limit = ($page - 1) * app_conf("PAGE_SIZE") . "," . app_conf("PAGE_SIZE");
         $result = get_topic_list($limit, " (user_id = " . $this->space_user['id'] . " OR (fav_id = " . $this->space_user['id'] . " AND type='focus') OR (l_user_id =" . $this->space_user['id'] . " AND type='message' )) ");
         $GLOBALS['tmpl']->assign("topic_list", $result['list']);
         $page = new Page($result['total'], app_conf("PAGE_SIZE"));
         //初始化分页对象
         $p = $page->show();
         $GLOBALS['tmpl']->assign('pages', $p);
         $list_html = $GLOBALS['tmpl']->fetch("inc/topic_col_list.html");
         $GLOBALS['tmpl']->assign("list_html", $list_html);
         $GLOBALS['tmpl']->assign('user_auth', get_user_auth());
     }
     $GLOBALS['tmpl']->display("page/space_index.html", $cache_id);
 }
 public function index()
 {
     global $tmpl;
     $rel_table = addslashes(trim($_REQUEST['act']));
     $message_type = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "message_type where type_name='" . $rel_table . "' and type_name <> 'supplier'");
     if (!$message_type || $message_type['is_fix'] == 0) {
         app_redirect(APP_ROOT . "/");
     }
     $rel_table = $message_type['type_name'];
     $condition = '';
     $id = intval($_REQUEST['id']);
     if ($rel_table == 'deal') {
         $deal = get_deal($id);
         if ($deal['buy_type'] != 1) {
             $GLOBALS['tmpl']->assign("deal", $deal);
         }
         $id = $deal['id'];
     }
     require APP_ROOT_PATH . 'app/Lib/side.php';
     if ($id > 0) {
         $condition = "rel_table = '" . $rel_table . "' and rel_id = " . $id;
     } else {
         $condition = "rel_table = '" . $rel_table . "'";
     }
     if (app_conf("USER_MESSAGE_AUTO_EFFECT") == 0) {
         $condition .= " and user_id = " . intval($GLOBALS['user_info']['id']);
     } else {
         if ($message_type['is_effect'] == 0) {
             $condition .= " and user_id = " . intval($GLOBALS['user_info']['id']);
         }
     }
     $condition .= " and is_buy = " . intval($_REQUEST['is_buy']);
     //message_form 变量输出
     $GLOBALS['tmpl']->assign("post_title", $message_type['show_name']);
     $GLOBALS['tmpl']->assign("page_title", $message_type['show_name']);
     $GLOBALS['tmpl']->assign('rel_id', $id);
     $GLOBALS['tmpl']->assign('rel_table', $rel_table);
     $GLOBALS['tmpl']->assign('is_buy', intval($_REQUEST['is_buy']));
     if (intval($_REQUEST['is_buy']) == 1) {
         $GLOBALS['tmpl']->assign("post_title", $GLOBALS['lang']['AFTER_BUY']);
         $GLOBALS['tmpl']->assign("page_title", $GLOBALS['lang']['AFTER_BUY']);
     }
     if (!$GLOBALS['user_info']) {
         $GLOBALS['tmpl']->assign("message_login_tip", sprintf($GLOBALS['lang']['MESSAGE_LOGIN_TIP'], url("shop", "user#login"), url("shop", "user#register")));
     }
     //分页
     $page = intval($_REQUEST['p']);
     if ($page == 0) {
         $page = 1;
     }
     $limit = ($page - 1) * app_conf("PAGE_SIZE") . "," . app_conf("PAGE_SIZE");
     $message = get_message_list($limit, $condition);
     $page = new Page($message['count'], app_conf("PAGE_SIZE"));
     //初始化分页对象
     $p = $page->show();
     $GLOBALS['tmpl']->assign('pages', $p);
     $GLOBALS['tmpl']->assign("message_list", $message['list']);
     $GLOBALS['tmpl']->assign("user_auth", get_user_auth());
     $GLOBALS['tmpl']->display("message.html");
 }
 private static function init_user_info()
 {
     $userinit = get_user_auth();
     if (empty($userinit['id'])) {
         //注册用户
         $userinit = empty(self::$weixin_post['fromusername']) ? wx_error('Sorry!用户标识为空') : register_weixin(true, self::$weixin_post['fromusername']);
     }
     //用户关注状态
     if (empty($userinit['follow'])) {
         change_user_follow($userinit['fromusername']);
     }
     //注册用户昵称
     if (preg_match("/^我叫/", self::$weixin_post['content'])) {
         $str = str_replace(" ", '', self::$weixin_post['content']);
         $nickname = str_replace('我叫', '', $str);
         set_nickname(self::$weixin_post['fromusername'], $nickname);
     }
     //强制绑定昵称
     if (empty($userinit['nickname'])) {
         wx_success('发送“我叫”+您的昵称,交朋友更方便哦~');
     }
     if ($userinit['status'] == 0) {
         wx_error('Sorry!您的账号已被冻结,请联系管理员......');
     }
     if ($userinit['followercate_status'] == 0) {
         wx_error('Sorry!您所在的用户组【' . $userinit['followercate_title'] . '】已被冻结,请联系管理员......');
     }
     /*用户资料初始化*/
     global $_P;
     $_P = $userinit;
 }
Example #5
0
 public function index()
 {
     global_run();
     init_app_page();
     $GLOBALS['tmpl']->assign("no_nav", true);
     //无分类下拉
     $id = intval($_REQUEST['id']);
     require_once APP_ROOT_PATH . 'system/model/topic.php';
     $topic = get_topic_item($id);
     if ($id > 0 && !empty($topic)) {
         //
     } else {
         app_redirect(url("index"));
     }
     if ($topic['group_id'] > 0) {
         $GLOBALS['tmpl']->assign('topic_group', get_topic_group($topic['group_id']));
     }
     $title = $topic['forum_title'];
     $content = decode_topic($topic['content']);
     $is_fav = $GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "topic where  (fav_id = " . $id . " or (origin_id = " . $id . " and fav_id <> 0))  and user_id = " . intval($GLOBALS['user_info']['id']));
     $GLOBALS['tmpl']->assign("topic", $topic);
     $GLOBALS['tmpl']->assign("title", $title);
     $GLOBALS['tmpl']->assign("content", $content);
     $GLOBALS['tmpl']->assign("is_fav", $is_fav);
     $GLOBALS['tmpl']->assign("page_title", $title);
     $GLOBALS['tmpl']->assign("page_keyword", $title . ",");
     $GLOBALS['tmpl']->assign("page_description", $title . ",");
     $GLOBALS['tmpl']->assign('user_auth', get_user_auth());
     $GLOBALS['tmpl']->display("topic_index.html");
 }
Example #6
0
/**
 * Get user authentication name.
 *
 * @param int $authType
 *
 * @return string
 */
function user_auth_type2str($authType)
{
    if ($authType === null) {
        $authType = get_user_auth(CWebUser::$data['userid']);
    }
    $authUserType = array(GROUP_GUI_ACCESS_SYSTEM => _('System default'), GROUP_GUI_ACCESS_INTERNAL => _x('Internal', 'user type'), GROUP_GUI_ACCESS_DISABLED => _('Disabled'));
    return isset($authUserType[$authType]) ? $authUserType[$authType] : _('Unknown');
}
 public function init_main()
 {
     //		$user_info = $GLOBALS['db']->getRow("select * from ".DB_PREFIX."user where id = ".intval($GLOBALS['user_info']['id']));
     //		require_once APP_ROOT_PATH."system/extend/ip.php";
     //		$iplocation = new iplocate();
     //		$address=$iplocation->getaddress($user_info['login_ip']);
     //		$user_info['from'] = $address['area1'].$address['area2'];
     $GLOBALS['tmpl']->assign('user_auth', get_user_auth());
 }
function user_auth_type2str($auth_type)
{
    if (is_null($auth_type)) {
        $auth_type = get_user_auth(CWebUser::$data['userid']);
    }
    $auth_user_type[GROUP_GUI_ACCESS_SYSTEM] = _('System default');
    $auth_user_type[GROUP_GUI_ACCESS_INTERNAL] = _('Internal');
    $auth_user_type[GROUP_GUI_ACCESS_DISABLED] = _('Disabled');
    if (isset($auth_user_type[$auth_type])) {
        return $auth_user_type[$auth_type];
    }
    return _('Unknown');
}
Example #9
0
function user_auth_type2str($auth_type)
{
    if (is_null($auth_type)) {
        global $USER_DETAILS;
        $auth_type = get_user_auth($USER_DETAILS['userid']);
    }
    $auth_user_type[GROUP_GUI_ACCESS_SYSTEM] = S_SYSTEM_DEFAULT;
    $auth_user_type[GROUP_GUI_ACCESS_INTERNAL] = S_INTERNAL_S;
    $auth_user_type[GROUP_GUI_ACCESS_DISABLED] = S_DISABLED;
    if (isset($auth_user_type[$auth_type])) {
        return $auth_user_type[$auth_type];
    }
    return S_UNKNOWN;
}
Example #10
0
 public function forum()
 {
     global_run();
     init_app_page();
     $GLOBALS['tmpl']->assign("no_nav", true);
     //无分类下拉
     $group_id = intval($_REQUEST['id']);
     $group_item = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "topic_group where is_effect = 1 and id = " . $group_id);
     if (!$group_item) {
         showErr("不存在的小组");
     }
     $GLOBALS['tmpl']->assign("group_info", $group_item);
     $title = $group_item['name'];
     $site_nav[] = array('name' => $GLOBALS['lang']['HOME_PAGE'], 'url' => url("index", "index"));
     $site_nav[] = array('name' => $GLOBALS['lang']['GROUP_FORUM'], 'url' => url("index", "group"));
     $site_nav[] = array('name' => $title, 'url' => url("index", "group#forum", array("id" => $group_id)));
     $GLOBALS['tmpl']->assign("site_nav", $site_nav);
     $GLOBALS['tmpl']->assign("page_title", $title);
     $GLOBALS['tmpl']->assign("page_keyword", $title . ",");
     $GLOBALS['tmpl']->assign("page_description", $title . ",");
     //输出是否加入组
     $user_id = intval($GLOBALS['user_info']['id']);
     if ($user_id == 0) {
         $is_join = 0;
     } else {
         $is_admin = 0;
         if ($group_item['user_id'] == $user_id) {
             $is_admin = 1;
         }
         if ($is_admin == 0) {
             $join_data = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "user_topic_group where user_id = " . $user_id . " and group_id = " . $group_item['id']);
             if ($join_data) {
                 $is_join = 1;
                 $is_admin = $join_data['type'];
             } else {
                 $is_join = 0;
             }
         } else {
             $is_join = 1;
         }
     }
     $GLOBALS['tmpl']->assign('is_join', $is_join);
     $GLOBALS['tmpl']->assign('is_admin', $is_admin);
     //输出列表
     $page_size = app_conf("PAGE_SIZE");
     $page = intval($_REQUEST['p']);
     if ($page <= 0) {
         $page = 1;
     }
     $limit = ($page - 1) * $page_size . "," . $page_size;
     $condition = " group_id = " . $group_item['id'];
     $sortby = "is_top desc,create_time desc";
     $sortkey = "ordery_sort";
     $filter = intval($_REQUEST['filter']);
     //0全部 1推荐
     $sort = intval($_REQUEST['sort']);
     //0创建时间 1回复时间
     $url_param = array("filter" => $filter, "sort" => $sort, "p" => $page, "id" => $group_id);
     if ($filter == 1) {
         $condition .= " and is_best = 1 ";
     }
     if ($sort == 1) {
         $sortby = " is_top desc,last_time desc ";
         $sortkey = "last_time_sort";
     }
     $tmp_url_param = $url_param;
     $tmp_url_param['filter'] = 0;
     $urls['all'] = url("index", "group#forum", $tmp_url_param);
     $tmp_url_param = $url_param;
     $tmp_url_param['filter'] = 1;
     $urls['is_best'] = url("index", "group#forum", $tmp_url_param);
     $tmp_url_param = $url_param;
     $tmp_url_param['sort'] = 0;
     $urls['create_time'] = url("index", "group#forum", $tmp_url_param);
     $tmp_url_param = $url_param;
     $tmp_url_param['sort'] = 1;
     $urls['last_time'] = url("index", "group#forum", $tmp_url_param);
     $GLOBALS['tmpl']->assign("urls", $urls);
     //		$sql = "select * from ".DB_PREFIX."topic use index($sortkey) where is_effect = 1 and is_delete = 0  $condition order by $sortby limit ".$limit;
     //		$sql_count = "select count(*) from ".DB_PREFIX."topic use index($sortkey) where is_effect = 1 and is_delete = 0 $condition ";
     //		$list = $GLOBALS['db']->getAll($sql);
     //		$count = $GLOBALS['db']->getOne($sql_count);
     $list = get_topic_list($limit, array("cid" => 0, "tag" => ""), "", $condition, $sortby);
     $list = $list['list'];
     $count = count($list);
     $GLOBALS['tmpl']->assign("list", $list);
     $page = new Page($count, $page_size);
     //初始化分页对象
     $p = $page->show();
     $GLOBALS['tmpl']->assign('pages', $p);
     $join_url = url("index", "group#joingroup", array("id" => $group_id));
     $exit_url = url("index", "group#exitgroup", array("id" => $group_id));
     $edit_url = url("index", "group#edit", array("id" => $group_id));
     $GLOBALS['tmpl']->assign("join_url", $join_url);
     $GLOBALS['tmpl']->assign("exit_url", $exit_url);
     $GLOBALS['tmpl']->assign("edit_url", $edit_url);
     //输出组员
     $user_list = $GLOBALS['db']->getAll("select user_id as id,type from " . DB_PREFIX . "user_topic_group where group_id = " . $group_item['id'] . " order by type desc limit 10 ");
     $GLOBALS['tmpl']->assign('user_list', $user_list);
     $GLOBALS['tmpl']->assign('user_auth', get_user_auth());
     $GLOBALS['tmpl']->display("group_forum.html");
 }
Example #11
0
 /**
  * 载入主题评论
  */
 public function load_topic_reply_list()
 {
     global_run();
     if ($GLOBALS['user_info']) {
         $GLOBALS['tmpl']->assign("user_info", $GLOBALS['user_info']);
     }
     $topic_id = $_POST['topic_id'];
     require_once APP_ROOT_PATH . 'system/model/topic.php';
     require_once APP_ROOT_PATH . "app/Lib/page.php";
     //分页
     $page_size = 5;
     $page = intval($_REQUEST['p']);
     if ($page == 0) {
         $page = 1;
     }
     $limit = ($page - 1) * $page_size . "," . $page_size;
     $reply_list = get_topic_reply_list($topic_id, $limit);
     foreach ($reply_list as $k => $v) {
         $reply_list[$k]['content'] = decode_topic_without_img($v['content']);
     }
     $total = $GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "topic_reply where is_effect=1 and is_delete=0 and topic_id=" . $topic_id);
     $page = new Page($total, $page_size);
     //初始化分页对象
     $p = $page->show();
     $GLOBALS['tmpl']->assign('pages', $p);
     $GLOBALS['tmpl']->assign('reply_list', $reply_list);
     $GLOBALS['tmpl']->assign('user_auth', get_user_auth());
     $data['html'] = $GLOBALS['tmpl']->fetch("inc/topic_reply_list.html");
     ajax_return($data);
 }
 $frmAuth->addVar('form_refresh_ldap', $form_refresh_ldap);
 $cmbConfig = new CCombobox('config', ZBX_AUTH_LDAP, 'submit()');
 $cmbConfig->addItem(ZBX_AUTH_INTERNAL, S_INTERNAL_S);
 $cmbConfig->addItem(ZBX_AUTH_LDAP, S_LDAP);
 $cmbConfig->addItem(ZBX_AUTH_HTTP, S_HTTP);
 $frmAuth->addRow(S_DEFAULT_AUTHENTICATION, $cmbConfig);
 $frmAuth->addRow(S_LDAP . SPACE . S_HOST, new CTextBox('ldap_host', $config['ldap_host'], 64));
 $frmAuth->addRow(S_PORT, new CNumericBox('ldap_port', $config['ldap_port'], 5));
 $frmAuth->addRow(S_BASE_DN, new CTextBox('ldap_base_dn', $config['ldap_base_dn'], 64));
 $frmAuth->addRow(S_SEARCH_ATTRIBUTE, new CTextBox('ldap_search_attribute', empty($config['ldap_search_attribute']) ? 'uid' : $config['ldap_search_attribute']));
 $frmAuth->addRow(S_BIND_DN . '*', new CTextBox('ldap_bind_dn', $config['ldap_bind_dn'], 64));
 $frmAuth->addRow(S_BIND_PASSWORD . '*', new CPassBox('ldap_bind_password', $config['ldap_bind_password']));
 $action = "javascript: if(confirm('" . S_SWITCHING_LDAP . "')) return true; else return false;";
 $frmAuth->addRow(S_LDAP . SPACE . S_AUTHENTICATION . SPACE . S_ENABLED, new CCheckBox('authentication_type', $config['authentication_type'], $action, ZBX_AUTH_LDAP));
 $frmAuth->addRow(S_TEST . SPACE . S_AUTHENTICATION, ' [' . S_MUST_BE_VALID_SMALL . SPACE . S_LDAP . SPACE . S_USER . ']');
 if (GROUP_GUI_ACCESS_INTERNAL == get_user_auth($USER_DETAILS['userid'])) {
     $usr_test = new CComboBox('user', $USER_DETAILS['alias']);
     $sql = 'SELECT u.alias, u.userid ' . ' FROM users u ' . ' WHERE ' . DBin_node('u.userid') . ' ORDER BY alias ASC';
     $u_res = DBselect($sql);
     while ($db_user = Dbfetch($u_res)) {
         if (check_perm2login($db_user['userid']) && check_perm2system($db_user['userid'])) {
             $usr_test->addItem($db_user['alias'], $db_user['alias']);
         }
     }
 } else {
     $usr_test = new CTextBox('user', $USER_DETAILS['alias'], null, 'yes');
 }
 $frmAuth->addRow(S_LOGIN, $usr_test);
 $frmAuth->addRow(S_USER . SPACE . S_PASSWORD, new CPassBox('user_password'));
 $frmAuth->addItemToBottomRow(new CButton('save', S_SAVE));
 $frmAuth->addItemToBottomRow(new CButton('test', S_TEST));
 public function search()
 {
     //获取可以相关的用户
     $user_list = get_rand_user(4);
     $user_id = intval($GLOBALS['user_info']['id']);
     $ids = array(0);
     foreach ($user_list as $k => $v) {
         $ids[] = $v['id'];
     }
     $focus_data = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "user_focus where focus_user_id = " . $user_id . " and focused_user_id in (" . implode(",", $ids) . ")");
     foreach ($user_list as $k => $v) {
         foreach ($focus_data as $kk => $vv) {
             if ($vv['focused_user_id'] == $v['id']) {
                 $user_list[$k]['focused'] = 1;
                 break;
             }
         }
         if ($v['city_id'] != 0 && $v['city_id'] == $GLOBALS['deal_city']['id']) {
             $user_list[$k]['same_city'] = 1;
         } else {
             $user_list[$k]['same_city'] = 0;
         }
     }
     $GLOBALS['tmpl']->assign("user_list", $user_list);
     convert_req($_REQUEST);
     $type = intval($_REQUEST['type']);
     $filter = intval($_REQUEST['filter']);
     $keyword = addslashes(htmlspecialchars(trim($_REQUEST['keyword'])));
     $GLOBALS['tmpl']->assign("keyword", $keyword);
     $GLOBALS['tmpl']->assign("type", $type);
     $GLOBALS['tmpl']->assign("filter", $filter);
     $url_param = array("type" => $type, "filter" => $filter, "keyword" => $keyword);
     if ($type == 0) {
         unset($url_param['type']);
     }
     if ($filter == 0) {
         unset($url_param['filter']);
     }
     if (intval($_REQUEST['is_redirect']) == 1) {
         if ($type > 0) {
             app_redirect(url("shop", "topic#search", $url_param));
         } else {
             app_redirect(url("shop", "topic#search", $url_param));
         }
     }
     $type_navs = array(array("type" => 0, "name" => $GLOBALS['lang']['TOPIC_TYPE_ALL']), array("type" => 1, "name" => $GLOBALS['lang']['TOPIC_TYPE_DEAL']), array("type" => 2, "name" => $GLOBALS['lang']['TOPIC_TYPE_STORE']), array("type" => 3, "name" => $GLOBALS['lang']['TOPIC_TYPE_RECOMMEND']));
     foreach ($type_navs as $k => $v) {
         $tmp_url_param = $url_param;
         if ($v['type'] != 0) {
             $tmp_url_param['type'] = $v['type'];
         } else {
             unset($tmp_url_param['type']);
         }
         $type_navs[$k]['url'] = url("shop", "topic#search", $tmp_url_param);
         if ($v['type'] == $type) {
             $type_navs[$k]['act'] = true;
         }
     }
     $filter_navs = array(array("filter" => 0, "name" => $GLOBALS['lang']['TOPIC_FILTER_ALL']), array("filter" => 1, "name" => $GLOBALS['lang']['TOPIC_FILTER_MYFOCUS']), array("filter" => 2, "name" => $GLOBALS['lang']['TOPIC_FILTER_DAREN']), array("filter" => 3, "name" => $GLOBALS['lang']['TOPIC_FILTER_MERCHANT']));
     foreach ($filter_navs as $k => $v) {
         $tmp_url_param = $url_param;
         if ($v['filter'] != 0) {
             $tmp_url_param['filter'] = $v['filter'];
         } else {
             unset($tmp_url_param['filter']);
         }
         $filter_navs[$k]['url'] = url("shop", "topic#search", $tmp_url_param);
         if ($v['filter'] == $filter) {
             $filter_navs[$k]['act'] = true;
         }
     }
     $condition = " 1=1 ";
     if ($type == 0) {
         //所有分享
         $condition .= "";
         $search_title = $GLOBALS['lang']['TOPIC_TYPE_ALL'];
     } elseif ($type == 1) {
         $condition .= " and (t.type='tuancomment' or t.type='shopcomment' or t.type='youhuicomment' ) ";
         $search_title = $GLOBALS['lang']['TOPIC_TYPE_DEAL'];
     } elseif ($type == 2) {
         $condition .= " and t.type='slocationcomment' ";
         $search_title = $GLOBALS['lang']['TOPIC_TYPE_STORE'];
     } elseif ($type == 3) {
         $condition .= " and t.title like '" . $keyword . "' ";
         $search_title = $GLOBALS['lang']['TOPIC_TYPE_RECOMMEND'];
     }
     if ($filter == 0) {
         //全部
         //$search_title.= " - ".$GLOBALS['lang']['TOPIC_FILTER_ALL'];
     } elseif ($filter == 1) {
         $search_title .= " - " . $GLOBALS['lang']['TOPIC_FILTER_MYFOCUS'];
         $condition .= " and uf.focus_user_id =  " . intval($GLOBALS['user_info']['id']);
     } elseif ($filter == 2) {
         $search_title .= " - " . $GLOBALS['lang']['TOPIC_FILTER_DAREN'];
         $condition .= " and u.is_daren = 1 ";
     } elseif ($filter == 3) {
         $search_title .= " - " . $GLOBALS['lang']['TOPIC_FILTER_MERCHANT'];
         $condition .= " and u.is_merchant = 1 ";
     }
     if ($keyword) {
         $search_title .= " - " . $keyword;
         $kws_div = div_str($keyword);
         foreach ($kws_div as $k => $item) {
             $kw[$k] = str_to_unicode_string($item);
         }
         $ukeyword = implode(" ", $kw);
         $condition .= " and match(t.keyword_match) against('" . $ukeyword . "'  IN BOOLEAN MODE) ";
     }
     $GLOBALS['tmpl']->assign("kws_div", $kws_div);
     $GLOBALS['tmpl']->assign("page_title", $search_title);
     $GLOBALS['tmpl']->assign("page_keyword", $search_title . ",");
     $GLOBALS['tmpl']->assign("page_description", $search_title . ",");
     //分页
     $page = intval($_REQUEST['p']);
     if ($page == 0) {
         $page = 1;
     }
     $limit = ($page - 1) * app_conf("PAGE_SIZE") . "," . app_conf("PAGE_SIZE");
     //		$result = get_topic_list($limit,$condition,"",$kws_div);
     $orderby = 't.create_time desc';
     $condition = " and " . $condition;
     $list = $GLOBALS['db']->getAll("select t.* from " . DB_PREFIX . "topic as t left join " . DB_PREFIX . "user as u on t.user_id = u.id left join " . DB_PREFIX . "user_focus as uf on uf.focused_user_id = t.user_id where t.is_effect = 1 and t.is_delete = 0 " . $condition . " group by t.id order by " . $orderby . " limit " . $limit);
     $total = $GLOBALS['db']->getOne("select count(distinct(t.id)) from " . DB_PREFIX . "topic as t left join " . DB_PREFIX . "user as u on t.user_id = u.id left join " . DB_PREFIX . "user_focus as uf on uf.focused_user_id = t.user_id where t.is_effect = 1 and t.is_delete = 0  " . $condition);
     foreach ($list as $k => $v) {
         $list[$k] = get_topic_item($v, $kws_div);
         if (msubstr(preg_replace("/<[^>]+>/i", "", $list[$k]['content']), 0, 50) != preg_replace("/<[^>]+>/i", "", $list[$k]['content'])) {
             $list[$k]['short_content'] = msubstr(preg_replace("/<[^>]+>/i", "", $list[$k]['content']), 0, 50);
         } else {
             $list[$k]['short_content'] = preg_replace("/<br[^>]+>/i", "", $list[$k]['content']);
         }
         if ($list[$k]['origin']) {
             if (msubstr(preg_replace("/<[^>]+>/i", "", $list[$k]['origin']['content']), 0, 50) != preg_replace("/<[^>]+>/i", "", $list[$k]['origin']['content'])) {
                 $list[$k]['origin']['short_content'] = msubstr(preg_replace("/<[^>]+>/i", "", $list[$k]['origin']['content']), 0, 50);
             } else {
                 $list[$k]['origin']['short_content'] = preg_replace("/<br[^>]+>/i", "", $list[$k]['origin']['content']);
             }
         }
     }
     $result = array('list' => $list, 'total' => $total);
     if ($result['total'] > 0) {
         if (check_ipop_limit(get_client_ip(), "topic_search", 10, $keyword)) {
             $GLOBALS['db']->query("update " . DB_PREFIX . "topic_tag set count = count + 1 where name = '" . $keyword . "'");
         }
     }
     //$result['list'] = div_to_col($result['list']);
     $GLOBALS['tmpl']->assign("topic_list", $result['list']);
     $page = new Page($result['total'], app_conf("PAGE_SIZE"));
     //初始化分页对象
     $p = $page->show();
     $GLOBALS['tmpl']->assign('pages', $p);
     $GLOBALS['tmpl']->assign('user_auth', get_user_auth());
     $list_html = load_topic_list();
     //$list_html = decode_topic_without_img($GLOBALS['tmpl']->fetch("inc/topic_col_list.html"));
     $GLOBALS['tmpl']->assign("list_html", $list_html);
     $GLOBALS['tmpl']->assign("type_navs", $type_navs);
     $GLOBALS['tmpl']->assign("filter_navs", $filter_navs);
     $res = load_dynamic_cache("topic_search_hot");
     if ($res === false) {
         $res['hot_tag_list'] = $GLOBALS['db']->getAll("select name,color from " . DB_PREFIX . "topic_tag where is_recommend = 1 order by sort desc, count desc limit 10");
         $res['hot_title_list'] = $GLOBALS['db']->getAll("select name,color from " . DB_PREFIX . "topic_title where is_recommend = 1 order by sort desc,count desc limit 10");
         set_dynamic_cache("topic_search_hot", $res);
     }
     //输出搜索热词
     $GLOBALS['tmpl']->assign("hot_tag_list", $res['hot_tag_list']);
     $GLOBALS['tmpl']->assign("hot_title_list", $res['hot_title_list']);
     //输出推荐分享
     $recommend_topic = load_auto_cache("recommend_uc_topic");
     $GLOBALS['tmpl']->assign("recommend_topic", $recommend_topic);
     $GLOBALS['tmpl']->display("topic_search.html");
 }
Example #14
0
function insert_load_comment($param)
{
    require_once APP_ROOT_PATH . "app/Lib/message.php";
    require_once APP_ROOT_PATH . 'app/Lib/page.php';
    $rel_id = intval($_REQUEST['id']);
    //关联数据的ID
    $rel_table = $param['rel_table'];
    $is_effect = $param['is_effect'];
    $is_image = $param['is_image'];
    $width = $param['width'];
    $height = $param['height'];
    $GLOBALS['tmpl']->assign("height", $height);
    $GLOBALS['tmpl']->assign("width", $width);
    $GLOBALS['tmpl']->assign("rel_id", $rel_id);
    $GLOBALS['tmpl']->assign("rel_table", $rel_table);
    $GLOBALS['tmpl']->assign("is_effect", $is_effect);
    $GLOBALS['tmpl']->assign("is_image", $is_image);
    //分页
    $page = intval($_REQUEST['p']);
    if ($page == 0) {
        $page = 1;
    }
    $limit = ($page - 1) * app_conf("PAGE_SIZE") . "," . app_conf("PAGE_SIZE");
    $result = get_message_list_shop($limit, " rel_table='" . $rel_table . "' and rel_id = " . $rel_id . " and is_effect = 1");
    $GLOBALS['tmpl']->assign("message_list", $result['list']);
    $page = new Page($result['count'], app_conf("PAGE_SIZE"));
    //初始化分页对象
    $p = $page->show();
    $GLOBALS['tmpl']->assign('pages', $p);
    $GLOBALS['tmpl']->assign("user_auth", get_user_auth());
    if (!$GLOBALS['user_info']) {
        $GLOBALS['tmpl']->assign("message_login_tip", sprintf($GLOBALS['lang']['MESSAGE_LOGIN_TIP'], url("shop", "user#login"), url("shop", "user#register")));
    }
    return $GLOBALS['tmpl']->fetch("inc/inc_comment_list.html");
}
Example #15
0
 $passwd = get_request('password', '');
 $password = md5($passwd);
 $sql = 'SELECT u.userid,u.attempt_failed, u.attempt_clock, u.attempt_ip ' . ' FROM users u ' . ' WHERE u.alias=' . zbx_dbstr($name);
 //SQL to BLOCK attempts
 //					.' AND ( attempt_failed<'.ZBX_LOGIN_ATTEMPTS.
 //							' OR (attempt_failed>'.(ZBX_LOGIN_ATTEMPTS-1).
 //									' AND ('.time().'-attempt_clock)>'.ZBX_LOGIN_BLOCK.'))';
 $login = $attempt = DBfetch(DBselect($sql));
 if ($name != ZBX_GUEST_USER && zbx_empty($passwd)) {
     $login = $attempt = false;
 }
 if ($login) {
     if ($login['attempt_failed'] >= ZBX_LOGIN_ATTEMPTS) {
         sleep(ZBX_LOGIN_BLOCK);
     }
     switch (get_user_auth($login['userid'])) {
         case GROUP_GUI_ACCESS_INTERNAL:
             $authentication_type = ZBX_AUTH_INTERNAL;
             break;
         case GROUP_GUI_ACCESS_SYSTEM:
         case GROUP_GUI_ACCESS_DISABLED:
         default:
             break;
     }
     switch ($authentication_type) {
         case ZBX_AUTH_LDAP:
             $login = ldap_authentication($name, get_request('password', ''));
             break;
         case ZBX_AUTH_HTTP:
             $login = true;
             break;
 public function load_topic()
 {
     $GLOBALS['tmpl']->assign('user_auth', get_user_auth());
     $cid = intval($_REQUEST['cid']);
     $tag = addslashes(htmlspecialchars(trim($_REQUEST['tag'])));
     $page = intval($_REQUEST['page']);
     if ($page == 0) {
         $page = 1;
     }
     $step = intval($_REQUEST['step']);
     $step_size = intval($_REQUEST['step_size']);
     $limit = ($page - 1) * PAGE_SIZE + ($step - 1) * SECTOR . "," . SECTOR;
     if ($step == 0 || $step > $step_size) {
         //超出
         $result['doms'] = array();
         $result['step'] = 0;
         $result['status'] = 0;
         $result['info'] = 'end';
         ajax_return($result);
     }
     if ($cid > 0) {
         $cate_name = $GLOBALS['db']->getOne("select name from " . DB_PREFIX . "topic_tag_cate where id = " . $cid);
         if ($cate_name) {
             $unicode_cate_name = str_to_unicode_string($cate_name);
             $condition .= " and match(cate_match) against('" . $unicode_cate_name . "'  IN BOOLEAN MODE) ";
         }
     }
     if ($tag != "") {
         $unicode_tag = str_to_unicode_string($tag);
         $condition .= " and match(keyword_match) against('" . $unicode_tag . "'  IN BOOLEAN MODE) ";
     }
     $sql = "select * from " . DB_PREFIX . "topic where is_effect = 1 and is_delete = 0  and fav_id = 0 and relay_id = 0 and type in ('share','sharetuan','sharegoods','sharefyouhui','sharebyouhui','shareevent') " . $condition . " order by create_time desc limit " . $limit;
     $result_list = $GLOBALS['db']->getAll($sql);
     if ($result_list) {
         $result['doms'] = array();
         foreach ($result_list as $k => $v) {
             $topic = get_topic_item($v);
             if (msubstr(preg_replace("/<[^>]+>/i", "", $topic['content']), 0, 50) != preg_replace("/<[^>]+>/i", "", $topic['content'])) {
                 $topic['short_content'] = msubstr(preg_replace("/<[^>]+>/i", "", $topic['content']), 0, 50);
             } else {
                 $topic['short_content'] = preg_replace("/<br[^>]+>/i", "", $topic['content']);
             }
             if ($topic['origin']) {
                 if (msubstr(preg_replace("/<[^>]+>/i", "", $topic['origin']['content']), 0, 50) != preg_replace("/<[^>]+>/i", "", $topic['origin']['content'])) {
                     $topic['origin']['short_content'] = msubstr(preg_replace("/<[^>]+>/i", "", $topic['origin']['content']), 0, 50);
                 } else {
                     $topic['origin']['short_content'] = preg_replace("/<br[^>]+>/i", "", $topic['origin']['content']);
                 }
             }
             $GLOBALS['tmpl']->assign("message_item", $topic);
             $result['doms'][] = decode_topic_without_img($GLOBALS['tmpl']->fetch("inc/discover_item.html"));
         }
         if ($step == 0 || $step >= $step_size) {
             //超出
             $result['step'] = 0;
             $result['status'] = 0;
             $result['info'] = 'end';
             ajax_return($result);
         } else {
             $result['status'] = 1;
             $result['step'] = $step + 1;
             $result['info'] = 'next';
             ajax_return($result);
         }
     } else {
         $result['doms'] = array();
         $result['step'] = 0;
         $result['status'] = 0;
         $result['info'] = 'end';
         //			$result['sql'] = $sql;
         ajax_return($result);
     }
 }
Example #17
0
 /**
  * Authenticate user
  *
  * {@source}
  * @access public
  * @static
  * @since 1.8
  * @version 1
  *
  * @param _array $user
  * @param array $user['user'] User alias
  * @param array $user['password'] User password
  * @return string session ID
  */
 public static function authenticate($user)
 {
     global $USER_DETAILS, $ZBX_LOCALNODEID;
     $name = $user['user'];
     $passwd = $user['password'];
     $auth_type = $user['auth_type'];
     $password = md5($passwd);
     $sql = 'SELECT u.userid,u.attempt_failed, u.attempt_clock, u.attempt_ip ' . ' FROM users u ' . ' WHERE u.alias=' . zbx_dbstr($name);
     //SQL to BLOCK attempts
     //					.' AND ( attempt_failed<'.ZBX_LOGIN_ATTEMPTS.
     //							' OR (attempt_failed>'.(ZBX_LOGIN_ATTEMPTS-1).
     //									' AND ('.time().'-attempt_clock)>'.ZBX_LOGIN_BLOCK.'))';
     $login = $attempt = DBfetch(DBselect($sql));
     if ($login) {
         if ($login['attempt_failed'] >= ZBX_LOGIN_ATTEMPTS) {
             if (time() - $login['attempt_clock'] < ZBX_LOGIN_BLOCK) {
                 $_REQUEST['message'] = S_CUSER_ERROR_ACCOUNT_IS_BLOCKED_FOR_XX_SECONDS_FIRST_PART . ' ' . (ZBX_LOGIN_BLOCK - (time() - $login['attempt_clock'])) . ' ' . S_CUSER_ERROR_ACCOUNT_IS_BLOCKED_FOR_XX_SECONDS_SECOND_PART;
                 return false;
             } else {
                 DBexecute('UPDATE users SET attempt_clock=' . time() . ' WHERE alias=' . zbx_dbstr($name));
             }
         }
         if ($auth_type != ZBX_AUTH_HTTP) {
             switch (get_user_auth($login['userid'])) {
                 case GROUP_GUI_ACCESS_INTERNAL:
                     $auth_type = ZBX_AUTH_INTERNAL;
                     break;
                 case GROUP_GUI_ACCESS_SYSTEM:
                 case GROUP_GUI_ACCESS_DISABLED:
                 default:
                     break;
             }
         }
         switch ($auth_type) {
             case ZBX_AUTH_LDAP:
                 $login = self::ldapLogin($user);
                 break;
             case ZBX_AUTH_HTTP:
                 $login = true;
                 break;
             case ZBX_AUTH_INTERNAL:
             default:
                 $login = true;
         }
     }
     if ($login) {
         $sql = 'SELECT u.* ' . ' FROM users u' . ' WHERE u.alias=' . zbx_dbstr($name) . (ZBX_AUTH_INTERNAL == $auth_type ? ' AND u.passwd=' . zbx_dbstr($password) : '') . ' AND ' . DBin_node('u.userid', $ZBX_LOCALNODEID);
         $login = $user = DBfetch(DBselect($sql));
     }
     /* update internal pass if it's different
     	if($login && ($row['passwd']!=$password) && (ZBX_AUTH_INTERNAL!=$auth_type)){
     		DBexecute('UPDATE users SET passwd='.zbx_dbstr(md5($password)).' WHERE userid='.$row['userid']);
     	}
     */
     if ($login) {
         $login = check_perm2login($user['userid']) && check_perm2system($user['userid']);
     }
     if ($login) {
         $sessionid = zbx_session_start($user['userid'], $name, $password);
         add_audit(AUDIT_ACTION_LOGIN, AUDIT_RESOURCE_USER, 'Correct login [' . $name . ']');
         if (empty($user['url'])) {
             $user['url'] = CProfile::get('web.menu.view.last', 'index.php');
         }
         $USER_DETAILS = $user;
         $login = $sessionid;
     } else {
         $user = NULL;
         $_REQUEST['message'] = S_CUSER_ERROR_LOGIN_OR_PASSWORD_INCORRECT;
         add_audit(AUDIT_ACTION_LOGIN, AUDIT_RESOURCE_USER, 'Login failed [' . $name . ']');
         if ($attempt) {
             $ip = isset($_SERVER['HTTP_X_FORWARDED_FOR']) && !empty($_SERVER['HTTP_X_FORWARDED_FOR']) ? $_SERVER['HTTP_X_FORWARDED_FOR'] : $_SERVER['REMOTE_ADDR'];
             $attempt['attempt_failed']++;
             $sql = 'UPDATE users ' . ' SET attempt_failed=' . $attempt['attempt_failed'] . ',' . ' attempt_clock=' . time() . ',' . ' attempt_ip=' . zbx_dbstr($ip) . ' WHERE userid=' . $attempt['userid'];
             DBexecute($sql);
         }
     }
     return $login;
 }
Example #18
0
function get_user_system_auth($userid)
{
    $result = ZBX_AUTH_INTERNAL;
    $user_auth = get_user_auth($userid);
    switch ($user_auth) {
        case GROUP_GUI_ACCESS_SYSTEM:
            $config = select_config();
            $result = $config['authentication_type'];
            break;
        case GROUP_GUI_ACCESS_INTERNAL:
        case GROUP_GUI_ACCESS_DISABLED:
        default:
            break;
    }
    return $result;
}
 public function init_main()
 {
     $GLOBALS['tmpl']->assign('user_auth', get_user_auth());
 }
Example #20
0
} elseif (isset($_REQUEST['del_user_media'])) {
    $user_medias_to_del = get_request('user_medias_to_del', array());
    foreach ($user_medias_to_del as $mediaid) {
        if (isset($_REQUEST['user_medias'][$mediaid])) {
            unset($_REQUEST['user_medias'][$mediaid]);
        }
    }
} elseif (isset($_REQUEST['cancel'])) {
    $url = get_profile('web.menu.view.last', 'index.php');
    redirect($url);
} elseif (isset($_REQUEST['save'])) {
    $_REQUEST['password1'] = get_request('password1', null);
    $_REQUEST['password2'] = get_request('password2', null);
    if ($config['authentication_type'] != ZBX_AUTH_INTERNAL && zbx_empty($_REQUEST['password1'])) {
        if ($config['authentication_type'] == ZBX_AUTH_LDAP && isset($_REQUEST['userid'])) {
            if (GROUP_GUI_ACCESS_INTERNAL != get_user_auth($_REQUEST['userid'])) {
                //					$_REQUEST['password1'] = $_REQUEST['password2'] = 'zabbix';
            }
        } else {
            $_REQUEST['password1'] = $_REQUEST['password2'] = 'zabbix';
        }
    }
    if ($_REQUEST['password1'] != $_REQUEST['password2']) {
        show_error_message(S_CANNOT_UPDATE_USER_BOTH_PASSWORDS);
    } else {
        if (isset($_REQUEST['password1']) && $USER_DETAILS['alias'] == ZBX_GUEST_USER && !zbx_empty($_REQUEST['password1'])) {
            show_error_message(S_FOR_GUEST_PASSWORD_MUST_BE_EMPTY);
        } else {
            if (isset($_REQUEST['password1']) && $USER_DETAILS['alias'] != ZBX_GUEST_USER && zbx_empty($_REQUEST['password1'])) {
                show_error_message(S_PASSWORD_SHOULD_NOT_BE_EMPTY);
            } else {
Example #21
0
 * Display
 */
$data['config'] = $_REQUEST['config'];
$data['config_data'] = $config;
$data['is_authentication_type_changed'] = $isAuthenticationTypeChanged;
$data['user'] = get_request('user', CWebUser::$data['alias']);
$data['user_password'] = get_request('user_password', '');
$data['user_list'] = null;
// get tab title
switch ($data['config']) {
    case ZBX_AUTH_INTERNAL:
        $data['tab_title'] = _('Zabbix internal authentication');
        break;
    case ZBX_AUTH_LDAP:
        $data['tab_title'] = _('LDAP authentication');
        break;
    case ZBX_AUTH_HTTP:
        $data['tab_title'] = _('HTTP authentication');
        break;
    default:
        $data['tab_title'] = '';
}
// get user list
if (get_user_auth(CWebUser::$data['userid']) == GROUP_GUI_ACCESS_INTERNAL) {
    $data['user_list'] = DBfetchArray(DBselect('SELECT u.alias,u.userid' . ' FROM users u' . whereDbNode('u.userid') . ' ORDER BY u.alias'));
}
// render view
$authenticationView = new CView('administration.authentication.edit', $data);
$authenticationView->render();
$authenticationView->show();
require_once dirname(__FILE__) . '/include/page_footer.php';
 public function index()
 {
     $this->init();
     $title = sprintf($GLOBALS['lang']['WHOS_SPACE'], $this->space_user['user_name']);
     $site_nav[] = array('name' => $GLOBALS['lang']['HOME_PAGE'], 'url' => APP_ROOT . "/");
     $site_nav[] = array('name' => $title, 'url' => url("shop", "space", array("id" => $this->space_user['id'])));
     $site_nav[] = array('name' => $GLOBALS['lang']['SPACE_HOME'], 'url' => url("shop", "space", array("id" => $this->space_user['id'])));
     $GLOBALS['tmpl']->assign("site_nav", $site_nav);
     $GLOBALS['tmpl']->assign("page_title", $title);
     $GLOBALS['tmpl']->assign("page_keyword", $title . ",");
     $GLOBALS['tmpl']->assign("page_description", $title . ",");
     $page = intval($_REQUEST['p']);
     if ($page == 0) {
         $page = 1;
     }
     $limit = ($page - 1) * app_conf("PAGE_SIZE") . "," . app_conf("PAGE_SIZE");
     $result = get_topic_list($limit, "user_id = " . $this->space_user['id']);
     //$result['list'] = div_to_col($result['list']);
     $GLOBALS['tmpl']->assign("topic_list", $result['list']);
     $page = new Page($result['total'], app_conf("PAGE_SIZE"));
     //初始化分页对象
     $p = $page->show();
     $GLOBALS['tmpl']->assign('pages', $p);
     $GLOBALS['tmpl']->assign('user_auth', get_user_auth());
     $GLOBALS['tmpl']->assign("inc_file", "inc/space/space_index.html");
     $GLOBALS['tmpl']->display("space.html");
 }
Example #23
0
function get_user_system_auth($userid)
{
    $config = select_config();
    $result = get_user_auth($userid);
    switch ($result) {
        case GROUP_GUI_ACCESS_SYSTEM:
            $result = $config['authentication_type'];
            break;
        case GROUP_GUI_ACCESS_INTERNAL:
            if ($config['authentication_type'] == ZBX_AUTH_HTTP) {
                $result = ZBX_AUTH_HTTP;
            } else {
                $result = ZBX_AUTH_INTERNAL;
            }
            break;
        case GROUP_GUI_ACCESS_DISABLED:
            $result = $config['authentication_type'];
        default:
            break;
    }
    return $result;
}
        }
    }
}
show_messages();
/*
 * Display
 */
$data = array('form_refresh' => get_request('form_refresh'), 'config' => $config, 'is_authentication_type_changed' => $isAuthenticationTypeChanged, 'user' => get_request('user', $USER_DETAILS['alias']), 'user_password' => get_request('user_password', ''), 'user_list' => null, 'change_bind_password' => get_request('change_bind_password'));
// get tab title
switch ($config['authentication_type']) {
    case ZBX_AUTH_INTERNAL:
        $data['title'] = _('Zabbix internal authentication');
        break;
    case ZBX_AUTH_LDAP:
        $data['title'] = _('LDAP authentication');
        break;
    case ZBX_AUTH_HTTP:
        $data['title'] = _('HTTP authentication');
        break;
    default:
        $data['title'] = '';
}
// get user list
if (get_user_auth($USER_DETAILS['userid']) == GROUP_GUI_ACCESS_INTERNAL) {
    $data['user_list'] = DBfetchArray(DBselect('SELECT u.alias,u.userid' . ' FROM users u' . ' WHERE ' . DBin_node('u.userid') . ' ORDER BY alias'));
}
// render view
$authenticationView = new CView('administration.authentication.edit', $data);
$authenticationView->render();
$authenticationView->show();
require_once 'include/page_footer.php';
Example #25
0
     }
     foreach ($userids as $id => $userid) {
         $user =& $users[$userid];
         //Log Out 10min or Autologout time
         $online_time = $user['autologout'] == 0 || ZBX_USER_ONLINE_TIME < $user['autologout'] ? ZBX_USER_ONLINE_TIME : $user['autologout'];
         $online = new CCol(S_NO, 'disabled');
         if (isset($users_sessions[$userid])) {
             $session =& $users_sessions[$userid];
             if (ZBX_SESSION_ACTIVE == $session['status'] && $session['lastaccess'] + $online_time >= time()) {
                 $online = new CCol(S_YES . ' (' . date('r', $session['lastaccess']) . ')', 'enabled');
             } else {
                 $online = new CCol(S_NO . ' (' . date('r', $session['lastaccess']) . ')', 'disabled');
             }
         }
         $user['users_status'] = check_perm2system($userid);
         $user['gui_access'] = get_user_auth($userid);
         $users_status = $user['users_status'] ? S_ENABLED : S_DISABLED;
         $gui_access = user_auth_type2str($user['gui_access']);
         $users_status = new CSpan($users_status, $user['users_status'] ? 'green' : 'red');
         $gui_access = new CSpan($gui_access, $user['gui_access'] == GROUP_GUI_ACCESS_DISABLED ? 'orange' : 'green');
         $action = get_user_actionmenu($userid);
         $table->addRow(array(array(new CCheckBox('group_userid[' . $userid . ']', NULL, NULL, $userid), new CLink($user['alias'], 'users.php?form=update' . url_param('config') . '&userid=' . $userid . '#form', 'action')), $user['name'], $user['surname'], user_type2str($user['type']), isset($users_groups[$userid]) ? $users_groups[$userid] : '', $online, $gui_access, $users_status, $action));
         $row_count++;
     }
     $table->SetFooter(new CCol(new CButtonQMessage('delete_selected', S_DELETE_SELECTED, S_DELETE_SELECTED_USERS_Q)));
     $form->AddItem($table);
     $form->show();
     $jsmenu = new CPUMenu(null, 270);
     $jsmenu->InsertJavaScript();
     set_users_jsmenu_array();
 }
 public function load_topic_replys()
 {
     require_once APP_ROOT_PATH . 'app/Lib/page.php';
     $topic_id = intval($_REQUEST['id']);
     //输出回复
     //分页
     $page = intval($_REQUEST['p']);
     if ($page == 0) {
         $page = 1;
     }
     $limit = ($page - 1) * app_conf("PAGE_SIZE") . "," . app_conf("PAGE_SIZE");
     $list = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "topic_reply where topic_id = " . $topic_id . " and is_effect = 1 and is_delete = 0 order by create_time asc limit " . $limit);
     $count = $GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "topic_reply where topic_id = " . $topic_id . " and is_effect = 1 and is_delete = 0");
     $GLOBALS['tmpl']->assign("reply_list", $list);
     $page = new Page($count, app_conf("PAGE_SIZE"));
     //初始化分页对象
     $p = $page->show();
     $GLOBALS['tmpl']->assign('pages', $p);
     $GLOBALS['tmpl']->assign('topic_id', $topic_id);
     if (!$GLOBALS['user_info']) {
         $GLOBALS['tmpl']->assign("message_login_tip", sprintf($GLOBALS['lang']['MESSAGE_LOGIN_TIP'], url("shop", "user#login"), url("shop", "user#register")));
     }
     $GLOBALS['tmpl']->assign('user_auth', get_user_auth());
     $GLOBALS['tmpl']->display("inc/topic_page_reply.html");
 }
 public function index()
 {
     global $tmpl;
     //获取当前页的团购商品
     $id = addslashes(trim($_REQUEST['id']));
     $uname = addslashes(trim($_REQUEST['id']));
     $preview = intval($_REQUEST['preview']);
     if ($id == 0 && $uname == '') {
         app_redirect(url("tuan", "index"));
     }
     //获取当前页的团购商品
     if ($preview > 0) {
         $deal = get_deal_show($id, 0, 0, $preview);
         $adm_session = es_session::get(md5(app_conf("AUTH_KEY")));
         $adm_name = $adm_session['adm_name'];
         $adm_id = intval($adm_session['adm_id']);
         if ($adm_id == 0) {
             //验证是否当前的商家(不是后台管理员)
             $s_account_info = es_session::get("account_info");
             if ($s_account_info) {
                 foreach ($s_account_info['location_ids'] as $id) {
                     $location = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "supplier_location where id = " . $id);
                     if ($location) {
                         $locations[] = $location;
                     }
                 }
                 $deal_test = $GLOBALS['db']->getRow("select d.* from " . DB_PREFIX . "deal as d left join " . DB_PREFIX . "deal_location_link as l on l.deal_id = d.id where d.id = " . intval($deal['id']) . " and l.location_id in (" . implode(",", $s_account_info['location_ids']) . ")");
                 if (!$deal_test) {
                     showErr("产品不存在或者没有预览该产品的权限", 0, APP_ROOT . "/");
                 }
             } else {
                 showErr("您不是系统管理员或者商家会员,无法预览", 0, APP_ROOT . "/");
             }
         }
     } else {
         $deal = get_deal_show($id);
     }
     jump_deal($deal, MODULE_NAME);
     if ($deal['buy_type'] == 1) {
         app_redirect(url("tuan", "index"));
     }
     if ($deal['is_effect'] == 0 && $preview == 0 && $adm_id == 0) {
         app_redirect(url("tuan", "index"));
     }
     $GLOBALS['tmpl']->assign("deal", $deal);
     //供应商的地址列表
     $GLOBALS['tmpl']->assign("json_location", $deal['json_location']);
     $GLOBALS['tmpl']->assign("locations", $deal['locations']);
     require_once './app/Lib/side.php';
     //读取边栏信息,需放在deal数据的分配之后
     $coupon_data = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "deal_coupon where deal_id = " . intval($deal['id']) . " and is_new = 0 and is_valid = 1 and user_id = " . intval($GLOBALS['user_info']['id']));
     $GLOBALS['tmpl']->assign("coupon_data", $coupon_data);
     if (app_conf("SHOW_DEAL_CATE") == 1) {
         $deal_cate_id = intval($deal['cate_id']);
         $GLOBALS['tmpl']->assign("is_index", 1);
         $GLOBALS['tmpl']->assign("hide_sort", 1);
         $cache_param = array("id" => $deal_cate_id, "tid" => 0, "qid" => 0, "city_id" => intval($GLOBALS['deal_city']['id']));
         $filter_nav_data = load_auto_cache("tuan_filter_nav_cache", $cache_param);
         $GLOBALS['tmpl']->assign('bquan_list', $filter_nav_data['bquan_list']);
         //开始输出分类
         $GLOBALS['tmpl']->assign("bcate_list", $filter_nav_data['bcate_list']);
     }
     //输出促销
     if ($deal['allow_promote'] == 1) {
         $promote = load_auto_cache("cache_promote");
         $GLOBALS['tmpl']->assign("promote", $promote);
     }
     //输出团购的留言
     $rel_table = "deal";
     $condition = '';
     $condition = "rel_table = '" . $rel_table . "' and rel_id = " . $id;
     if (app_conf("USER_MESSAGE_AUTO_EFFECT") == 0) {
         $condition .= " and user_id = " . intval($GLOBALS['user_info']['id']);
     } else {
         if ($message_type['is_effect'] == 0) {
             $condition .= " and user_id = " . intval($GLOBALS['user_info']['id']);
         }
     }
     $before_sale_condition = $condition . " and is_buy = 0";
     $after_sale_condition = $condition . " and is_buy = 1";
     $limit = "15";
     $before_sale_message = get_message_list($limit, $before_sale_condition);
     $after_sale_message = get_message_list($limit, $after_sale_condition);
     $GLOBALS['tmpl']->assign("user_auth", get_user_auth());
     $GLOBALS['tmpl']->assign("message_list", $before_sale_message['list']);
     $before_message_html = load_message_list();
     $GLOBALS['tmpl']->assign("message_list", $after_sale_message['list']);
     $after_message_html = load_message_list();
     $GLOBALS['tmpl']->assign("before_message_html", $before_message_html);
     $GLOBALS['tmpl']->assign("after_message_html", $after_message_html);
     //end 留言
     if ($deal) {
         $GLOBALS['tmpl']->assign("page_title", $deal['seo_title'] != '' ? $deal['seo_title'] : $deal['name']);
         $GLOBALS['tmpl']->assign("page_keyword", $deal['seo_keyword'] != '' ? $deal['seo_keyword'] : $deal['name']);
         $GLOBALS['tmpl']->assign("page_description", $deal['seo_description'] != '' ? $deal['seo_description'] : $deal['name']);
         $GLOBALS['tmpl']->display("deal.html");
     } else {
         $GLOBALS['tmpl']->assign("page_title", "没有相关的团购");
         $GLOBALS['tmpl']->assign("page_keyword", "没有相关的团购");
         $GLOBALS['tmpl']->assign("page_description", "没有相关的团购");
         $GLOBALS['tmpl']->display("no_deal.html");
     }
 }
 public function detail()
 {
     $dp_id = intval($_REQUEST['id']);
     $page = intval($_REQUEST['p']);
     $review_item = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "supplier_location_dp where id = " . $dp_id);
     if (!$review_item) {
         app_redirect(url("index", "index"));
     }
     //验证是否为当前商家会员管理的点评
     $s_account_info = es_session::get("account_info");
     if (in_array($review_item['supplier_location_id'], $s_account_info['location_ids']) && $review_item['from_data'] != "") {
         $is_admin = 1;
         $GLOBALS['tmpl']->assign("is_admin", $is_admin);
     }
     $review_item = sys_get_dp_detail($review_item);
     $store_info = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "supplier_location where id = " . $review_item['supplier_location_id']);
     //供应商的地址列表
     //定义location_id
     $locations = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "supplier_location where id = " . $review_item['supplier_location_id']);
     $json_location = array();
     $location_ids = array(0);
     foreach ($locations as $litem) {
         $location_ids[] = $litem['id'];
         $arr = array();
         $arr['title'] = $litem['name'];
         $arr['address'] = $litem['address'];
         $arr['tel'] = $litem['tel'];
         $arr['lng'] = $litem['xpoint'];
         $arr['lat'] = $litem['ypoint'];
         $json_location[] = $arr;
     }
     $GLOBALS['tmpl']->assign("json_location", json_encode($json_location));
     $GLOBALS['tmpl']->assign("locations", $locations);
     $GLOBALS['tmpl']->assign("store_info", $store_info);
     //输出回应列表
     $sql_count = "select count(*) from " . DB_PREFIX . "supplier_location_dp_reply  where dp_id = " . $dp_id;
     $count = $GLOBALS['db']->getOne($sql_count);
     $page_size = app_conf("PAGE_SIZE");
     if ($page == 0) {
         $page = 1;
     }
     $limit = ($page - 1) * $page_size . "," . $page_size;
     $sql = "select * from " . DB_PREFIX . "supplier_location_dp_reply where dp_id = " . $dp_id . "  order by create_time desc limit " . $limit;
     $reply_list = $GLOBALS['db']->getAll($sql);
     foreach ($reply_list as $k => $v) {
         $reply_list[$k]['user_name'] = $GLOBALS['db']->getOne("select user_name from " . DB_PREFIX . "user where id = " . $v['user_id']);
         $reply_list[$k]['create_time_format'] = pass_date($v['create_time']);
     }
     $page = new Page($count, $page_size);
     //初始化分页对象
     $p = $page->show();
     $GLOBALS['tmpl']->assign('pages', $p);
     $GLOBALS['tmpl']->assign('reply_list', $reply_list);
     $GLOBALS['tmpl']->assign('user_auth', get_user_auth());
     $review_list_html = decode_topic($GLOBALS['tmpl']->fetch('inc/review/reply_list.html'));
     $GLOBALS['tmpl']->assign('review_list_html', $review_list_html);
     $GLOBALS['tmpl']->assign('review_item', $review_item);
     $GLOBALS['tmpl']->display('review_detail.html');
 }