/** * function for inserting user * @param array $values * @return boolean $res */ function useradd_db_insert($values) { $database = admin::getDbInfo(); if (!$database) { return db_no_url(); } admin::changeDB($database['dbname']); $db = new db(); $res = $db->insert('account', $values); return $res; }
/** * Method for creating the modules main menu items * @return boolean $res true on success false on failure */ public function insertMenuItem() { $res = null; $db = new db(); moduleloader::setModuleIniSettings($this->installInfo['NAME']); if (!empty($this->installInfo['MAIN_MENU_ITEM'])) { $values = $this->installInfo['MAIN_MENU_ITEM']; $values['title'] = $values['title']; $res = $db->insert('menus', $values); } if (!empty($this->installInfo['MAIN_MENU_ITEMS'])) { foreach ($this->installInfo['MAIN_MENU_ITEMS'] as $val) { $val['title'] = $val['title']; $res = $db->insert('menus', $val); } } return $res; }
/** * function that alllows the install to add a user */ function web_install_add_user() { $layout = new layout('zimpleza'); $errors = array(); if (isset($_POST['submit'])) { $_POST = html::specialEncode($_POST); if (empty($_POST['pass1'])) { $errors[] = 'Please enter a password'; } if ($_POST['pass1'] != $_POST['pass2']) { $errors[] = 'Not same passwords'; } if (empty($_POST['email'])) { $errors[] = 'Please enter an email'; } if (!empty($errors)) { html::errors($errors); } else { $db = new db(); $_POST = html::specialDecode($_POST); $values = array(); $values['email'] = $_POST['email']; $values['password'] = md5($_POST['pass1']); // MD5 $values['username'] = $_POST['email']; $values['verified'] = 1; $values['admin'] = 1; $values['super'] = 1; $values['type'] = 'email'; $db->insert('account', $values); http::locationHeader("/account/login/index", 'Account created. You may log in'); //web_install_add_user(); } } web_install_user_form(); }
/** * function for inserting user * @param array $values * @return boolean $res */ function useradd_db_insert($values) { $database = admin::getDbInfo(conf::getMainIni('url')); if (!$database) { return db_no_url(); } $db = new db(); $res = $db->insert('account', $values); return $res; }
/** * sets a system cookie. * @param int $user_id * @return boolean $res true on success and false on failure. */ public static function setSystemCookie($user_id) { $uniqid = random::md5(); self::setCookie('system_cookie', $uniqid); $db = new db(); // place cookie in system cookie table // last login is auto updated $values = array('account_id' => $user_id, 'cookie_id' => $uniqid, 'last_login' => date::getDateNow(array('hms' => true))); return $db->insert('system_cookie', $values); }