public function testInsert() { for ($i = 0; $i < self::NUM_ROWS; $i++) { $data = array('title' => "'" . 'title-' . $i . "'", 'lastmodified' => time()); array_push($this->insert_data, $data); $this->assertTrue((bool) TlonData::insert($this->table, array_values($data))); } }
/** * add(): Add a new user to TABLE, auto-generating password-hash and salt, and automatically * adding her to the 'all' group and to a group with the name '${username}_grp'. * @param string $username Username. * @param string $password Unhashed password. * @param string $realname Real name. * @return bool */ public static function add($username, $password, $realname) { list($hash, $salt) = TlonHash::password($password); if (!(TlonUserGroup::add($username, TlonGroup::EVERYONE, TlonRights::READ, TlonGroup::EVERYONEINFO) && TlonUserGroup::add($username, TlonGroup::userGroupname($username), TlonRights::READ_WRITE, $realname))) { return false; } return TlonData::insert(self::$TABLE, array($username, $hash, $realname, $salt, null)); }
public static function add($groupname, $document_id, $rights = TlonRights::READ_WRITE, $groupinfo = '') { if (!TlonGroup::exists($groupname)) { if (!TlonGroup::add($groupname, $groupinfo)) { return false; } } return TlonData::insert(self::$TABLE, array($groupname, $document_id, $rights)); }
/** * add(): Make a new nonce, insert in the TABLE, and return it. * @return string New nonce, or false if add failed. */ public static function add() { self::clean(); $nonce = TlonHash::hash(TlonHash::salt(), $_SERVER['REMOTE_ADDR']); if (TlonData::insert(self::$TABLE, array($nonce, time()))) { return $nonce; } else { return false; } }
public static function add($username, $groupname, $rights = TlonRights::READ_WRITE, $groupinfo = '') { if (!TlonGroup::exists($groupname)) { if (!TlonGroup::add($groupname, $groupinfo)) { return false; } } if (self::getByUsernameGroupname($username, $groupname)) { return self::edit($username, $groupname, $rights); } else { return TlonData::insert(self::$TABLE, array($username, $groupname, $rights)); } }
public static function add($groupname, $info) { return TlonData::insert(self::$TABLE, array($groupname, $info)); }
public static function add($username, $document_id) { self::delete($username, $document_id); return TlonData::insert(self::$TABLE, array(null, $username, $document_id, 0)); }
public static function add($title, $content, $parent = -1) { return TlonData::insert(self::$TABLE, array(null, $title, $content, time(), $parent)); }
public static function add($username, $document_id, $operations, $applied = false) { return TlonData::insert(self::$TABLE, array(null, $username, $document_id, time(), $operations, $applied ? 1 : 0)); }