当前位置: 首页>>代码示例>>PHP>>正文


PHP Backend::create_user方法代码示例

本文整理汇总了PHP中Backend::create_user方法的典型用法代码示例。如果您正苦于以下问题:PHP Backend::create_user方法的具体用法?PHP Backend::create_user怎么用?PHP Backend::create_user使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Backend的用法示例。


在下文中一共展示了Backend::create_user方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: action_registeruser

 function action_registeruser()
 {
     global $user, $db, $fs;
     if (!Post::val('user_pass')) {
         return array(ERROR_RECOVER, L('formnotcomplete'));
     }
     if (Post::val('user_pass') != Post::val('user_pass2')) {
         return array(ERROR_RECOVER, L('nomatchpass'));
     }
     if (strlen(Post::val('user_pass')) < MIN_PW_LENGTH) {
         return array(ERROR_RECOVER, L('passwordtoosmall'));
     }
     //die(Post::val('magic_url'));
     // Check that the user entered the right confirmation code
     $reg_details = $db->x->getRow('SELECT * FROM {registrations} WHERE magic_url = ?', null, array(Post::val('magic_url')));
     if (!$reg_details) {
         return array(ERROR_RECOVER, L('confirmwrong'));
     }
     $uid = Backend::create_user($reg_details['user_name'], Post::val('user_pass'), $reg_details['real_name'], $reg_details['jabber_id'], $reg_details['email_address'], $reg_details['notify_type'], $reg_details['time_zone'], $fs->prefs['anon_group']);
     if (!$uid) {
         return array(ERROR_RECOVER, L('usernametaken'));
     }
     $db->x->execParam('DELETE FROM {registrations} WHERE magic_url = ?', array(Post::val('magic_url')));
     return array(SUBMIT_OK, L('accountcreated'), CreateUrl('register', array('regdone' => 1)));
 }
开发者ID:negram,项目名称:flyspray,代码行数:25,代码来源:register.php

示例2: COUNT

     $user_name = Post::val('user_name' . $i);
     $real_name = Post::val('real_name' . $i);
     $email_address = Post::val('email_address' . $i);
     if ($user_name == '' || $real_name == '' || $email_address == '') {
         continue;
     } else {
         $noUsers = false;
     }
     $enabled = 1;
     // Avoid dups
     $sql = $db->Query("SELECT COUNT(*) FROM {users} WHERE email_address = ?", array($email_address));
     if ($db->fetchOne($sql)) {
         $error .= "\n" . L('emailtakenbulk') . ": {$email_address}\n";
         continue;
     }
     if (!Backend::create_user($user_name, Post::val('user_pass'), $real_name, '', $email_address, Post::num('notify_type'), Post::num('time_zone'), $group_in, $enabled, '', '', '')) {
         $error .= "\n" . L('usernametakenbulk') . ": {$user_name}\n";
         continue;
     } else {
         $success .= ' ' . $user_name . ' ';
     }
 }
 if ($error != '') {
     Flyspray::show_error($error);
 } else {
     if ($noUsers == true) {
         Flyspray::show_error(L('nouserstoadd'));
     } else {
         $_SESSION['SUCCESS'] = L('created') . $success;
         if (!$user->perms('is_admin')) {
             define('NO_DO', true);
开发者ID:kandran,项目名称:flyspray,代码行数:31,代码来源:modify.inc.php

示例3: rand

    $user_name . '@foo.bar.baz.org';
    $group = rand(11, 12);
    Backend::create_user($user_name, $password, $real_name, '', $email, 0, $time_zone, $group, 1);
}
// That's why we need some more global groups with different viewing rights
// And 100000 users just viewing our progress
for ($i = 1; $i <= $maxindividualusers; $i++) {
    $user_name = "basic{$i}";
    $real_name = "Basic {$i}";
    $password = $user_name;
    $time_zone = 0;
    // Assign different ones!
    $email = $email = null;
    $user_name . '@foo.bar.baz.org';
    $group = 4;
    Backend::create_user($user_name, $password, $real_name, '', $email, 0, $time_zone, $group, 1);
}
// But that was not enough for all needed permission, so in practice, every
// project also has between 1 AND 20 project groups.
//
// Must recreate, so rights for new projects get loaded. Otherwise,
// even first user in database can't create tasks.
$user = new User(1);
// And that's why we've got 1000000 tasks opened within the last 10 years
for ($i = 1; $i <= $maxtasks; $i++) {
    $project = rand(2, $maxproducts);
    // Find someone who is allowed to open a task, do not use global groups
    $sql = $db->Query("SELECT uig.user_id\n                         FROM {users_in_groups} uig\n                         JOIN {groups} g ON g.group_id = uig.group_id AND g.open_new_tasks = 1\n                          AND (g.project_id = 0 OR g.project_id = ?)\n                        WHERE g.group_id NOT IN (1, 2, 7, 8, 9)\n                     ORDER BY {$RANDOP} LIMIT 1", array($project));
    $reporter = $db->FetchOne($sql);
    $sql = $db->Query("SELECT category_id FROM {list_category} WHERE project_id = ? AND category_name <> 'root' ORDER BY {$RANDOP} LIMIT 1", array($project));
    $category = $db->FetchOne($sql);
开发者ID:kandran,项目名称:flyspray,代码行数:31,代码来源:CreateTestData.php

示例4: COUNT

         Flyspray::show_error(L('passwordtoosmall'));
         break;
     }
     if ($user->perms('is_admin')) {
         $group_in = Post::val('group_in');
     } else {
         $group_in = $fs->prefs['anon_group'];
     }
     if (!$user->perms('is_admin')) {
         $sql = $db->Query("SELECT COUNT(*) FROM {users} WHERE\n                           jabber_id = ? AND jabber_id != ''\n                           OR email_address = ? AND email_address != ''", array(Post::val('jabber_id'), Post::val('email_address')));
         if ($db->fetchOne($sql)) {
             Flyspray::show_error(L('emailtaken'));
             break;
         }
     }
     if (!Backend::create_user(Post::val('user_name'), Post::val('user_pass'), Post::val('real_name'), Post::val('jabber_id'), Post::val('email_address'), Post::num('notify_type'), Post::num('time_zone'), $group_in)) {
         Flyspray::show_error(L('usernametaken'));
         break;
     }
     $_SESSION['SUCCESS'] = L('newusercreated');
     if (!$user->perms('is_admin')) {
         define('NO_DO', true);
         $page->pushTpl('register.ok.tpl');
     }
     break;
     // ##################
     //  adding a new group
     // ##################
 // ##################
 //  adding a new group
 // ##################
开发者ID:manishkhanchandani,项目名称:mkgxy,代码行数:31,代码来源:modify.inc.php

示例5: action_newuser

 function action_newuser()
 {
     global $fs, $db, $proj, $user, $page;
     if (!Post::val('user_name') || !Post::val('real_name') || !Post::val('email_address')) {
         // If the form wasn't filled out correctly, show an error
         return array(ERROR_RECOVER, L('registererror'));
     }
     if (Post::val('user_pass') != Post::val('user_pass2')) {
         return array(ERROR_RECOVER, L('nomatchpass'));
     }
     if (strlen(Post::val('user_pass')) && strlen(Post::val('user_pass')) < MIN_PW_LENGTH) {
         return array(ERROR_RECOVER, L('passwordtoosmall'));
     }
     if ($user->perms('is_admin')) {
         $group_in = Post::val('group_in');
     } else {
         $group_in = $fs->prefs['anon_group'];
     }
     if (!$user->perms('is_admin')) {
         $taken = $db->x->getOne("SELECT count(*)\n                                      FROM {users}\n                                     WHERE jabber_id = ? AND ? != NULL\n                                           OR email_address = ? AND ? != NULL", null, array(Post::val('jabber_id'), Post::val('jabber_id'), Post::val('email_address'), Post::val('email_address')));
         if ($taken) {
             return array(ERROR_RECOVER, L('emailtaken'));
         }
     }
     if (!Backend::create_user(Post::val('user_name'), Post::val('user_pass'), Post::val('real_name'), Post::val('jabber_id'), Post::val('email_address'), Post::num('notify_type'), Post::num('time_zone'), $group_in)) {
         return array(ERROR_RECOVER, L('usernametaken'));
     }
     if (!$user->perms('is_admin')) {
         $page->pushTpl('register.ok.tpl');
         $page->finish('footer.tpl');
     }
     return array(SUBMIT_OK, L('newusercreated'));
 }
开发者ID:negram,项目名称:flyspray,代码行数:33,代码来源:admin.php

示例6: createTestData

function createTestData()
{
    # quick safety
    exit;
    if (PHP_SAPI !== 'cli') {
        die('Please call it only from commandline');
    }
    global $db, $fs, $proj, $user, $notify;
    // Use this only on a new test installation, code does not work on
    // an existing one, and never will.
    ### Simulation Settings ###
    # Set conservative data as default, setup bigger values for further performance tests.
    # maybe setting moved out of this function to make performance graphs with multiple runs..
    // Borg Inc. is a big multinational company delivering
    $maxproducts = 3;
    # =projects
    $maxversions = 3;
    // both to it's
    $maxcorporateusers = 5;
    // working in
    $maxcorporates = 3;
    // and
    $maxindividualusers = 5;
    // who are all happy to report to us about
    $maxtasks = 10;
    // There are many problems in our products. And then there are also
    $maxviewers = 10;
    // who just like to watch what's going on here at Borg Inc.
    // Our users are also keen to add attachments to their reports and comments, so there are
    $maxattachments = 5;
    // in our database;
    // Our users are also very active with commenting.
    $maxcomments = 20;
    // To handle all the resulting work, we need
    $maxadmins = 2;
    $maxmanagers = 2;
    $maxdevelopers = 3;
    // people working together all over the globe to care for their needs.
    ### End of Simulation Settings ###
    // We also have both a very innovative and standardized naming scheme for our products.
    // And we have also made one big invention offered only to our customers in the world:
    // Time travel! You can comment on tasks and other comments in them even before the task
    // is even opened or the original comment made.
    // Add more according to your taste...
    $subjects[] = "%s sucks!";
    $subjects[] = "%s is utterly crap!";
    $subjects[] = "Developers of %s should be hanged!";
    $subjects[] = "Developers of %s should be strangled!";
    $subjects[] = "Developers of %s should be eaten alive by zombies!";
    $subjects[] = "Developers of %s should be thrown in a pit of snakes!";
    $subjects[] = "Who is the idiot responsible for %s?";
    error_reporting(E_ALL);
    // die('Enable me by commenting this out by editing and read the contents first!'.basename(__FILE__).' at line '.__LINE__);
    define('IN_FS', 1);
    require_once dirname(__FILE__) . '/../includes/fix.inc.php';
    require_once dirname(__FILE__) . '/../includes/class.flyspray.php';
    require_once dirname(__FILE__) . '/../includes/constants.inc.php';
    require_once dirname(__FILE__) . '/../includes/i18n.inc.php';
    require_once dirname(__FILE__) . '/../includes/class.tpl.php';
    require_once dirname(__FILE__) . '/../vendor/autoload.php';
    $conf = parse_ini_file('../flyspray.conf.php', true) or die('Cannot open config file.');
    $db = new Database();
    $db->dbOpenFast($conf['database']);
    $RANDOP = 'RAND()';
    if ($db->dblink->dataProvider == 'postgres') {
        $RANDOP = 'RANDOM()';
    }
    #die();
    $fs = new Flyspray();
    $user = new User(1);
    $proj = new Project(1);
    $notify = new Notifications();
    load_translations();
    for ($i = 1; $i <= $maxadmins; $i++) {
        $user_name = "admin{$i}";
        $real_name = "Administrator {$i}";
        $password = $user_name;
        $time_zone = 0;
        // Assign different one!
        $email = null;
        // $user_name . '@example.com';
        Backend::create_user($user_name, $password, $real_name, '', $email, 0, $time_zone, 1, 1);
    }
    for ($i = 1; $i <= $maxmanagers; $i++) {
        $user_name = "pm{$i}";
        $real_name = "Project Manager {$i}";
        $password = $user_name;
        $time_zone = 0;
        // Assign different one!
        $email = null;
        // $user_name . '@example.com';
        Backend::create_user($user_name, $password, $real_name, '', $email, 0, $time_zone, 2, 1);
    }
    $db->Query('UPDATE {projects} SET project_is_active = 0 WHERE project_id = 1');
    // Show more columns by default, trying to make database or flyspray crash under stress.
    $db->Query("UPDATE {prefs} SET pref_value = 'id project category tasktype severity summary status openedby dateopened progress comments attachments votes' WHERE pref_name = 'visible_columns'");
    // Add 3 different Global developer groups with different
    // view rights first, then assign developers to them at random.
    // Borg Inc. has a strict hierarchy on who can see and do what.
    // Somewhat more relaxed with our own developers.
//.........这里部分代码省略.........
开发者ID:krayon,项目名称:flyspray,代码行数:101,代码来源:CreateTestData.php

示例7: serialize

$uid = $user_details->uid;
if (Post::has('username')) {
    $username = Post::val('username');
} else {
    $username = $user_details->nickname;
}
// First time logging in
if (!Flyspray::checkForOauthUser($uid, $provider)) {
    if (!$user_details->email) {
        Flyspray::show_error(27);
    }
    $success = false;
    if ($username) {
        $group_in = $fs->prefs['anon_group'];
        $name = $user_details->name ?: $username;
        $success = Backend::create_user($username, null, $name, '', $user_details->email, 0, 0, $group_in, 1, $uid, $provider);
    }
    // username taken or not provided, ask for it
    if (!$success) {
        $_SESSION['oauth_token'] = serialize($token);
        $_SESSION['oauth_provider'] = $provider;
        $page->assign('provider', ucfirst($provider));
        $page->assign('username', $username);
        $page->pushTpl('register.oauth.tpl');
        return;
    }
}
if (($user_id = Flyspray::checkLogin($user_details->email, null, 'oauth')) < 1) {
    Flyspray::show_error(23);
    // account disabled
}
开发者ID:canneverbe,项目名称:flyspray,代码行数:31,代码来源:oauth.php

示例8: createTestData

function createTestData()
{
    # quick safety
    exit;
    if (PHP_SAPI !== 'cli') {
        die('');
    }
    // Use this only on a new test installation, code does not work on
    // an existing one, and never will.
    // Borg Inc. is a big multinational company delivering
    $maxproducts = 50;
    // both to it's
    $maxcorporateusers = 450;
    // working in
    $maxcorporates = 50;
    // and
    $maxindividualusers = 10;
    // who are all happy to report to us about
    $maxtasks = 150;
    // the many problems in our products. And then there are also
    $maxviewers = 50;
    // who just like to watch what's going on here at Borg Inc.
    // Our users are also keen to add attachments to their reports and comments, so there are
    $maxattachments = 500;
    // in our database;
    // Our users are also very active with commenting.
    $maxcomments = 750;
    // To handle all the resulting work, we need
    $maxadmins = 3;
    $maxmanagers = 5;
    $maxdevelopers = 50;
    // people working together all over the globe to care for their needs.
    // We also have both a very innovative and standardized naming scheme for our products.
    // And we have also made one big invention offered only to our customers in the world:
    // Time travel! You can comment on tasks and other comments in them even before the task
    // is even opened or the original comment made.
    // Add more according to your taste...
    $subjects[] = "%s sucks!";
    $subjects[] = "%s is utterly crap!";
    $subjects[] = "Developers of %s should be hanged!";
    $subjects[] = "Developers of %s should be strangled!";
    $subjects[] = "Developers of %s should be eaten alive by zombies!";
    $subjects[] = "Developers of %s should be thrown in a pit of snakes!";
    $subjects[] = "Who is the idiot responsible for %s?";
    error_reporting(E_ALL);
    // die('Enable me by commenting this out by editing and read the contents first!'.basename(__FILE__).' at line '.__LINE__);
    define('IN_FS', 1);
    require_once dirname(__FILE__) . '/../includes/fix.inc.php';
    require_once dirname(__FILE__) . '/../includes/class.flyspray.php';
    require_once dirname(__FILE__) . '/../includes/constants.inc.php';
    require_once dirname(__FILE__) . '/../includes/i18n.inc.php';
    require_once dirname(__FILE__) . '/../includes/class.tpl.php';
    require_once dirname(__FILE__) . '/../vendor/autoload.php';
    $conf = @parse_ini_file('../flyspray.conf.php', true) or die('Cannot open config file.');
    $db = new Database();
    $db->dbOpenFast($conf['database']);
    $RANDOP = 'RAND()';
    if ($db->dblink->dataProvider == 'postgres') {
        $RANDOP = 'RANDOM()';
    }
    $fs = new Flyspray();
    $user = new User(1);
    $proj = new Project(1);
    $notify = new Notifications();
    load_translations();
    for ($i = 1; $i <= $maxadmins; $i++) {
        $user_name = "admin{$i}";
        $real_name = "Administrator {$i}";
        $password = $user_name;
        $time_zone = 0;
        // Assign different one!
        $email = null;
        // $user_name . '@foo.bar.baz.org';
        Backend::create_user($user_name, $password, $real_name, '', $email, 0, $time_zone, 1, 1);
    }
    for ($i = 1; $i <= $maxmanagers; $i++) {
        $user_name = "pm{$i}";
        $real_name = "Project Manager {$i}";
        $password = $user_name;
        $time_zone = 0;
        // Assign different one!
        $email = null;
        // $user_name . '@foo.bar.baz.org';
        Backend::create_user($user_name, $password, $real_name, '', $email, 0, $time_zone, 2, 1);
    }
    $db->Query('UPDATE {projects} SET project_is_active = 0 WHERE project_id = 1');
    // Show more columns by default, trying to make database or flyspray crash under stress.
    $db->Query("UPDATE {prefs} SET pref_value = 'id project category tasktype severity summary status openedby dateopened progress comments attachments votes' WHERE pref_name = 'visible_columns'");
    // Add 3 different Global developer groups with different
    // view rights first, then assign developers to them at random.
    // Borg Inc. has a strict hierarchy on who can see and do what.
    // Somewhat more relaxed with our own developers.
    $db->Query("INSERT INTO {groups} " . "(group_name,group_desc,project_id,group_open,view_comments,manage_project,view_tasks, view_groups_tasks, view_own_tasks,open_new_tasks,modify_own_tasks) " . "VALUES('Developer Group 1', 'Developer Group 1', 0, 1, 1, 0, 1, 1, 1, 1, 1)");
    $db->Query("INSERT INTO {groups} " . "(group_name,group_desc,project_id,group_open,view_comments,manage_project,view_tasks, view_groups_tasks, view_own_tasks,open_new_tasks,modify_own_tasks) " . "VALUES('Developer Group 2', 'Developer Group 2', 0, 1, 1, 0, 0, 1, 1, 1, 1)");
    $db->Query("INSERT INTO {groups} " . "(group_name,group_desc,project_id,group_open,view_comments,manage_project,view_tasks, view_groups_tasks, view_own_tasks,open_new_tasks,modify_own_tasks) " . "VALUES('Developer Group 3', 'Developer Group 3', 0, 1, 1, 0, 0, 0, 1, 1, 1)");
    // Add also general groups for corporate users, individual users and viewers.
    // Allow only login. Not so relaxed with them bastards.
    $db->Query("INSERT INTO {groups} " . "(group_name,group_desc,project_id,group_open) " . "VALUES('Corporate Users', 'Corporate Users', 0, 1)");
    $db->Query("INSERT INTO {groups} " . "(group_name,group_desc,project_id,group_open) " . "VALUES('Trusted Users', 'Trusted Users', 0, 1)");
    $db->Query("INSERT INTO {groups} " . "(group_name,group_desc,project_id,group_open) " . "VALUES('Non-trusted Users', 'Non-trusted Users', 0, 1)");
//.........这里部分代码省略.........
开发者ID:canneverbe,项目名称:flyspray,代码行数:101,代码来源:CreateTestData.php


注:本文中的Backend::create_user方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。