Esempio n. 1
0
<?php

$module['moduleID'] = JxCreateID('modules', 'moduleID', 100, 999);
$module['name'] = 'contact';
$module['title'] = 'Contact Us';
$module['description'] = 'A simple and easy to use contact us form';
$module['posted'] = time();
$module['available'] = 1;
$module['groups'] = array(1 => 700, 2 => 500, 3 => 500);
Esempio n. 2
0
 /**
  * create
  *
  * Create a user in the database. It also sets up the default groups for
  * the user and should allow for plugins as well.
  *
  * @author Joe Stump <*****@*****.**>
  * @access public
  * @param mixed $data
  * @return bool
  */
 function create($data)
 {
     if (is_array($data) && count($data)) {
         $data['userID'] = JxCreateID('users', 'userID');
         $sql = "INSERT INTO users\n                    SET ";
         $sets = array();
         $fields = array('userID', 'username', 'fname', 'lname', 'email', 'password', 'available', 'posted', 'admin');
         while (list($key, $val) = each($data)) {
             if (in_array($key, $fields)) {
                 $sets[] = $key . "='" . $val . "'";
             }
         }
         $sql .= implode(",\n", $sets);
         $result = $this->db->query($sql);
         if (!PEAR::isError($result)) {
             // Add user to the default groups
             if (JxGroup::addMember(JX_GRP_REG, $data['userID'])) {
                 return $data['userID'];
             }
         }
     }
     return false;
 }