Esempio n. 1
0
    $group_perms=phorum_convert_getUserGroups($oldlink);
    $res = phorum_convert_selectUsers($oldlink);

    if (!$res) {
        echo "No users found, All done now.{$CONVERT['lbr']}";
        flush();
        exit;
    }

    // there are users...
    $count = 0;
    $userdata["date_added"] = time();
    $cur_time = time();
    while ($cur_user = phorum_convert_getNextUser($res)) {
        if (isset($cur_user['user_id'])) {
            phorum_user_add($cur_user, -1);
            $user_groups=$group_perms[$cur_user['user_id']];
            if(count($user_groups)) { // setting the user's group-memberships
            phorum_db_user_save_groups($cur_user['user_id'],$user_groups);
            }
            $count++;
        }
    }
    unset($users);
    print "$count users converted{$CONVERT['lbr']}";
}
echo "{$CONVERT['lbr']}Done.{$CONVERT['lbr']}";
flush();

?>
Esempio n. 2
0
                    if($_POST["admin_pass"]!=$_POST["admin_pass2"]){
                        echo "The password fields do not match<br />";
                        $step=4;
                    } elseif(phorum_user_check_login($_POST["admin_user"], $_POST["admin_pass"])){
                        if($PHORUM["user"]["admin"]){
                            echo "Admin user already exists and has permissions<br />";
                        } else {
                            echo "That user already exists but does not have admin permissions<br />";
                            $step=4;
                        }
                    } else {

                        // add the user
                        $user = array( "username"=>$_POST["admin_user"], "password"=>$_POST["admin_pass"], "email"=>$_POST["admin_email"], "active"=>1, "admin"=>1 );

                        if(!phorum_user_add($user)){

                            echo "There was an error adding the user.<br />";
                            $step=4;
                        }

                        // set the default http_path so we can continue.
                        if(!empty($_SERVER["HTTP_REFERER"])) {
                            $http_path=$_SERVER["HTTP_REFERER"];
                        } elseif(!empty($_SERVER['HTTP_HOST'])) {
                            $http_path="http://".$_SERVER['HTTP_HOST'];
                            $http_path.=$_SERVER['PHP_SELF'];
                        } else {
                            $http_path="http://".$_SERVER['SERVER_NAME'];
                            $http_path.=$_SERVER['PHP_SELF'];
                        }
Esempio n. 3
0
            $userdata["active"] = PHORUM_USER_PENDING_MOD;
        } elseif ($PHORUM["registration_control"]==PHORUM_REGISTER_VERIFY_BOTH) {
            $userdata["password_temp"]=substr(md5(microtime()), 0, 8);
            $userdata["active"] = PHORUM_USER_PENDING_BOTH;
        }

        // Run a hook, so module writers can update and check the userdata.
        $userdata = phorum_hook("before_register", $userdata);

        // Set $error, in case the before_register hook did set an error.
        if (isset($userdata['error'])) {
            $error = $userdata['error'];
            unset($userdata['error']);
        }
        // Try to add the user to the database.
        elseif ($user_id = phorum_user_add($userdata)) {

            // The user was added. Determine what message to show.
            if ($PHORUM["registration_control"] == PHORUM_REGISTER_INSTANT_ACCESS) {
                $PHORUM["DATA"]["MESSAGE"] = $PHORUM["DATA"]["LANG"]["RegThanks"];
            } elseif($PHORUM["registration_control"] == PHORUM_REGISTER_VERIFY_EMAIL ||
                     $PHORUM["registration_control"] == PHORUM_REGISTER_VERIFY_BOTH) {
                $PHORUM["DATA"]["MESSAGE"] = $PHORUM["DATA"]["LANG"]["RegVerifyEmail"];
            } elseif($PHORUM["registration_control"] == PHORUM_REGISTER_VERIFY_MODERATOR) {
                $PHORUM["DATA"]["MESSAGE"] = $PHORUM["DATA"]["LANG"]["RegVerifyMod"];
            }

            // Send a message to the new user in case email verification is required.
            if ($PHORUM["registration_control"] == PHORUM_REGISTER_VERIFY_BOTH ||
                $PHORUM["registration_control"] == PHORUM_REGISTER_VERIFY_EMAIL) {
                $verify_url = phorum_get_url(PHORUM_REGISTER_URL, "approve=".$userdata["password_temp"]."$user_id");