Changeset 258

Show
Ignore:
Timestamp:
02/19/06 00:47:29 (3 years ago)
Author:
benoit
Message:

created new function to create users (units/users/function_create_user.php) and modified exising code to use this function instead of individual queries

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • devel/units/admin/admin_actions.php

    r255 r258  
    141141                                                                                        $md5password = md5($password); 
    142142                                                                                         
    143                                                                                         db_query("insert into users set username = '" . $new_username[$i] . "', name = '" . $new_name[$i] . "', email = '" . $new_email[$i] . "', password = '".$md5password."', active = 'yes', user_type = 'person'"); 
    144                                                                                         $newid = db_id(); 
    145                                                                                          
    146                                                                                         // Calendar code shouldn't go here! But its here anyways so just checking 
    147                                                                                         // the global function array to check to see if calendar module is loaded. 
    148                                                                                          
    149                                                                                         global $function; 
    150                                                                                         if(isset($function["calendar:init"]))   
    151                                                                                                 db_query("insert into calendar(owner) values({$newid})"); 
     143                                                                                        $newid = run("users:create", array("username" => $new_username[$i],  
     144                                                                                                                                          "name" => $new_name[$i], 
     145                                                                                                                                          "email" => $new_email[$i], 
     146                                                                                                                                          "active" => "yes", 
     147                                                                                                                                          "user_type" => "person")); 
    152148                                                                                         
    153149                                                                                        $rssresult = run("weblogs:rss:publish", array($newid, false)); 
  • devel/units/invite/invite_actions.php

    r255 r258  
    5050                                                                                $from_email = $_SESSION['email']; 
    5151                                                                        } 
    52                                                                         $emailmessage = sprintf(gettext("Dear %s,\n\n%s %s\n\nTo join, visit the following URL:\n\n\t%s\n\nYour email address has not been passed onto any third parties, and will be removed from our system within seven days.\n\nRegards,\n\nThe %s team."),$strippedname,$greetingstext,$invitetext,$url, $sitename); 
     52                                                                        $emailmessage = sprintf(gettext("Dear %s,\n\n%s %s\n\nTo join, visit the following URL:\n\n\t%s\n\nYour email address has not been passed onto any third parties, and will be removed from our system within seven days.\n\nRegards,\n\nThe %s team."),$strippedname,$greetingstext,$invitetext,$url, $sitename);                                                                       
    5353                                                                        $emailmessage = wordwrap($emailmessage); 
    5454                                                                        $messages[] = sprintf(gettext("Your invitation was sent to %s at %s. It will be valid for seven days."),$strippedname,$email); 
     
    105105                                                                        $details = $details[0]; 
    106106                                                                        $email = $details->email; 
    107                                                                         db_query("insert into users set name = '$name', 
    108                                                                                                                                 password='$password', 
    109                                                                                                                                 username = '$username', 
    110                                                                                                                                 email = '$email'"); 
    111                                                                         $ident = db_id(); 
     107                                                                        $ident = run("users:create", array("name" => $name, 
     108                                                                                                                                           "password" => $password, 
     109                                                                                                                                           "username" => $username, 
     110                                                                                                                                           "email" => $email)); 
    112111                                                                         
    113                                                                          
    114                                                                         //      Calendar code is in the wrong place! 
    115                                                                         global $function; 
    116                                                                         if(isset($function["calendar:init"])) 
    117                                                                                 db_query("INSERT INTO calendar SET owner = {$ident}"); 
    118112                                                                                         
    119113                                                                         
  • devel/units/users/main.php

    r45 r258  
    6666        // Permissions checker 
    6767                $function['permissions:check'][] = path . "units/users/permissions_check.php"; 
     68         
     69        // Create user 
     70                $function['users:create'][] = path . "units/users/function_create_user.php"; 
    6871                 
    6972        // Flag functions: