save() public method

* save Saves a new user in the database
public save ( $username, $password )
$username
$password
Beispiel #1
0
        $state =& Pommo_Api::stateInit('mailing', array('fromname' => $mailing['fromname'], 'fromemail' => $mailing['fromemail'], 'frombounce' => $mailing['frombounce'], 'list_charset' => $mailing['charset'], 'mailgroup' => $gid, 'subject' => $mailing['subject'], 'body' => $mailing['body'], 'altbody' => $mailing['altbody']));
        Pommo::redirect(Pommo::$_baseUrl . 'mailings_start.php');
        break;
    case 'delete':
        $currentUser = Pommo::$_auth->_username;
        //	We dont want to delete the current user
        $key = array_search($currentUser, $_GET['users']);
        if ($key !== false) {
            unset($_GET['users'][$key]);
        }
        require_once Pommo::$_baseDir . 'classes/Pommo_User.php';
        $pu = new Pommo_User();
        $deleted = $pu->delete($_GET['users']);
        $logger->addMsg(Pommo::_T('Please Wait') . '...');
        $params = $json->encode(array('users' => $_GET['users']));
        $view->assign('callbackFunction', 'deleteUser');
        $view->assign('callbackParams', $params);
        break;
    case 'add':
        require_once Pommo::$_baseDir . 'classes/Pommo_User.php';
        $pu = new Pommo_User();
        if ($pu->save($_POST['user'], $_POST['password'])) {
            echo $_POST['user'];
            return;
        }
        break;
    default:
        $logger->AddErr('invalid call');
        break;
}
$view->display('admin/rpc');
Beispiel #2
0
 foreach (array_keys($dbo->table) as $key) {
     $table = $dbo->table[$key];
     $sql = 'DROP TABLE IF EXISTS ' . $table;
     $dbo->query($sql);
 }
 if (isset($_REQUEST['debugInstall'])) {
     $dbo->debug(TRUE);
 }
 $install = Pommo_Install::parseSQL();
 if ($install) {
     // installation of DB went OK, set configuration values to user
     // supplied ones
     require_once Pommo::$_baseDir . 'classes/Pommo_User.php';
     $pass = $_POST['admin_password'];
     $user = new Pommo_User();
     $user->save('admin', $pass);
     // Save Mailing List, Name of Website, Website URL
     Pommo_Install::saveUserValues($_POST);
     // generate key to uniquely identify this installation
     $key = Pommo_Helper::makeCode(6);
     Pommo_Api::configUpdate(array('key' => $key), TRUE);
     Pommo::reloadConfig();
     // load configuration [depricated?], set message defaults, load templates
     require_once Pommo::$_baseDir . 'classes/Pommo_Helper_Messages.php';
     Pommo_Helper_Messages::resetDefault('all');
     // install templates
     $file = Pommo::$_baseDir . 'sql/sql.templates.php';
     if (!Pommo_Install::parseSQL(false, $file)) {
         $logger->addErr('Error Loading Default Mailing Templates.');
     }
     $logger->addMsg(Pommo::_T('Installation Complete! You may now login and setup poMMo.'));