Esempio n. 1
0
 function Follow()
 {
     if (!$GLOBALS['_J']['config']['acceleration_mode']) {
         $follow_ary = get_def_follow_group();
     }
     $tmp = jconf::get('follow');
     if (empty($tmp) && !$GLOBALS['_J']['config']['acceleration_mode']) {
         jconf::set('follow', $follow_ary);
     } else {
         $follow_ary = $tmp;
     }
     include template('admin/setting_follow');
 }
Esempio n. 2
0
 function register($nickname, $password, $email, $username = '', $ucuid = 0, $role_id = 0)
 {
     $rets = jsg_member_register_check_status();
     if ($rets['error']) {
         return 0;
     }
     $ip = $GLOBALS['_J']['client_ip'];
     $ret = $this->register_check_ip($ip);
     if (!$ret) {
         return -7;
     }
     $nickname = trim(strip_tags($nickname));
     $jsg_result = $this->checkname($nickname, 1, $ucuid);
     if ($jsg_result < 1) {
         return $jsg_result;
     }
     $username = trim(strip_tags($username));
     if ($username) {
         $jsg_result = $this->checkname($username, 0, $ucuid);
         if ($jsg_result < 1) {
             return $jsg_result;
         }
     }
     $jsg_result = $this->checkemail($email, $ucuid);
     if ($jsg_result < 1) {
         return $jsg_result;
     }
     if (true === UCENTER && $ucuid < 1) {
         $uc_result = uc_user_register($nickname, $password, $email);
         if ($uc_result < 1) {
             return $uc_result;
         }
         $ucuid = $uc_result;
     } elseif (true === PWUCENTER && $ucuid < 1) {
         define('P_W', 'admincp');
         include_once ROOT_PATH . 'api/pw_api/security.php';
         include_once ROOT_PATH . 'api/pw_api/pw_common.php';
         include_once ROOT_PATH . './api/pw_client/uc_client.php';
         $uc_result = uc_user_register($nickname, md5($password), $email);
         if ($uc_result < 1) {
             return $uc_result;
         }
         $ucuid = $uc_result;
     }
     $timestamp = time();
     $sql_datas = array();
     $sql_datas['ucuid'] = $ucuid;
     $sql_datas['salt'] = jsg_member_salt();
     $sql_datas['password'] = jsg_member_password($password, $sql_datas['salt']);
     $sql_datas['nickname'] = $nickname;
     $sql_datas['username'] = $username ? $username : '';
     $sql_datas['email'] = $email;
     $sql_datas['role_type'] = 'normal';
     $sql_datas['role_id'] = (int) ($GLOBALS['_J']['config']['reg_email_verify'] ? $GLOBALS['_J']['config']['no_verify_email_role_id'] : $GLOBALS['_J']['config']['normal_default_role_id']);
     $sql_datas['invitecode'] = substr(md5(random(32)), -16);
     $sql_datas['regdate'] = $sql_datas['lastactivity'] = $timestamp;
     $sql_datas['regip'] = $sql_datas['lastip'] = $ip;
     $sql_datas['reg_ip_port'] = $sql_datas['last_ip_port'] = $GLOBALS['_J']['client_ip_port'];
     if ($GLOBALS['_J']['config']['extcredits_enable']) {
         $credits = jconf::get('credits');
         foreach ($credits['ext'] as $_k => $_v) {
             if ($_v['enable'] && $_v['default']) {
                 $sql_datas[$_k] = (int) $_v['default'];
             }
         }
     }
     $uid = jtable('members')->insert($sql_datas, 1);
     if ($uid < 1) {
         jlog('passport_register', $sql_datas, 0);
         return 0;
     }
     if (!$username) {
         DB::query("UPDATE `" . TABLE_PREFIX . "members` SET `username`=`uid` WHERE `username`=''");
     }
     DB::query("insert into `" . TABLE_PREFIX . "memberfields` (`uid`) values ('{$uid}')");
     #if NEDU
     if (defined('NEDU_MOYO')) {
         ndata('sync')->member()->register($uid);
     }
     #endif
     if ($GLOBALS['_J']['config']['reg_email_verify']) {
         jfunc('my');
         my_member_validate($uid, $sql_datas['email'], (int) $GLOBALS['_J']['config']['normal_default_role_id'], 0, 0);
     }
     $ruids = jconf::get('default_regfollow');
     if ($ruids) {
         $ruids = (array) $ruids;
         foreach ($ruids as $v) {
             $v = (int) $v;
             if ($v > 0) {
                 buddy_add($v, $uid);
             }
         }
     }
     $followgroup_ary = jconf::get('follow');
     if (empty($followgroup_ary) && !$GLOBALS['_J']['config']['acceleration_mode']) {
         $followgroup_ary = get_def_follow_group();
     }
     if (!empty($followgroup_ary)) {
         foreach ($followgroup_ary as $value) {
             jtable('buddy_follow_group')->add($value, $uid);
         }
     }
     $pmLogic = jlogic('pm');
     if (($sendmsgname = $GLOBALS['_J']['config']['notice_to_new_user']) && $GLOBALS['_J']['config']['notice_to_new_user_news']) {
         $pm_post = array('message' => $GLOBALS['_J']['config']['notice_to_new_user_news'], 'to_user' => $nickname);
         $admin_info = DB::fetch_first("select `uid`,`username`,`nickname` from `" . TABLE_PREFIX . "members` where `nickname` = '{$sendmsgname}'");
         if ($admin_info) {
             $pmLogic->pmSend($pm_post, $admin_info['uid'], $admin_info['username'], $admin_info['nickname']);
         }
     }
     if (trim($sql_datas['role_id']) == 5) {
         $first_admin = DB::fetch_first("select `uid`,`username`,`nickname` from `" . TABLE_PREFIX . "members` where `uid` = 1");
         $pm_post_touser = array('message' => $GLOBALS['_J']['config']['notice_to_waitvalidate_user'] ? $GLOBALS['_J']['config']['notice_to_waitvalidate_user'] : "******", 'to_user' => $sql_datas['nickname']);
         $return = $pmLogic->pmSend($pm_post_touser, $first_admin['uid'], $first_admin['username'], $first_admin['nickname']);
         if ($sendmsgname = $GLOBALS['_J']['config']['notice_to_admin']) {
             $pm_post_toadmin = array('message' => "有新注册用户进入待验证会员组,<a href='admin.php?mod=member&code=waitvalidate' target='_blank'>点击进入审核</a>。", 'to_user' => str_replace('|', ',', $sendmsgname));
             $pmLogic->pmSend($pm_post_toadmin, $first_admin['uid'], $first_admin['username'], $first_admin['nickname']);
         }
     }
     if ($GLOBALS['_J']['plugins']['func']['reg']) {
         hookscript('reg', 'funcs', array('param' => array($uid), 'step' => 'reg'), 'reg');
     }
     return $uid;
 }