Lines Matching +full:continue +full:- +full:on +full:- +full:error
10 * @license GPL 2 http://www.gnu.org/licenses/gpl-2.0.html
33 $this->debugMsg('PDO extension for PHP not found.', -1, __LINE__);
34 $this->success = false;
38 if (!$this->getConf('dsn')) {
39 $this->debugMsg('No DSN specified', -1, __LINE__);
40 $this->success = false;
45 $this->pdo = new PDO(
46 $this->getConf('dsn'),
47 $this->getConf('user'),
48 conf_decodeString($this->getConf('pass')),
52 … PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION, // we want exceptions, not error codes
56 $this->debugMsg($e);
57 msg($this->getLang('connectfail'), -1);
58 $this->success = false;
63 $this->cando['addUser'] = $this->checkConfig(
64 …['select-user', 'select-user-groups', 'select-groups', 'insert-user', 'insert-group', 'join-group']
68 $this->cando['delUser'] = $this->checkConfig(
69 ['select-user', 'select-user-groups', 'select-groups', 'leave-group', 'delete-user']
73 $this->cando['modLogin'] = $this->checkConfig(
74 ['select-user', 'select-user-groups', 'update-user-login']
78 $this->cando['modPass'] = $this->checkConfig(
79 ['select-user', 'select-user-groups', 'update-user-pass']
83 $this->cando['modName'] = $this->checkConfig(
84 ['select-user', 'select-user-groups', 'update-user-info:name']
88 $this->cando['modMail'] = $this->checkConfig(
89 ['select-user', 'select-user-groups', 'update-user-info:mail']
93 $this->cando['modGroups'] = $this->checkConfig(
94 …['select-user', 'select-user-groups', 'select-groups', 'leave-group', 'join-group', 'insert-group']
98 $this->cando['getUsers'] = $this->checkConfig(
99 ['list-users']
103 $this->cando['getUserCount'] = $this->checkConfig(
104 ['count-users']
108 $this->cando['getGroups'] = $this->checkConfig(
109 ['select-groups']
112 $this->success = true;
125 $userdata = $this->selectUser($user);
132 if ($this->checkConfig(['check-pass'])) {
135 $result = $this->query($this->getConf('check-pass'), $userdata);
140 // we do password checking on our own
144 return $passhash->verify_hash($pass, $userdata['hash']);
167 $data = $this->selectUser($user);
174 $data['grps'] = $this->selectUserGroups($data);
184 * Returns false if the user already exists, null when an error
203 if (($info = $this->getUserData($user, false)) !== false) {
204 msg($this->getLang('userexists'), -1);
216 $this->pdo->beginTransaction();
219 $ok = $this->query($this->getConf('insert-user'), $userdata);
221 $userdata = $this->getUserData($user, false);
225 $allgroups = $this->selectGroups();
228 $ok = $this->addGroup($group);
232 $allgroups = $this->selectGroups();
236 $ok = $this->joinGroup($userdata, $allgroups[$group]);
240 $this->pdo->commit();
245 $this->pdo->rollBack();
246 $this->debugMsg('Transaction rolled back', 0, __LINE__);
247 msg($this->getLang('writefail'), -1);
248 return null; // return error
261 $this->pdo->beginTransaction();
263 $olddata = $this->getUserData($user);
269 if ($this->getUserData($changes['user'], false)) goto FAIL;
273 $ok = $this->query($this->getConf('update-user-login'), $params);
283 $ok = $this->query($this->getConf('update-user-pass'), $params);
293 $ok = $this->query($this->getConf('update-user-info'), $params);
299 $allgroups = $this->selectGroups();
304 $ok = $this->leaveGroup($olddata, $allgroups[$group]);
313 $ok = $this->addGroup($group);
319 if ($added > 0) $allgroups = $this->selectGroups();
324 $ok = $this->joinGroup($olddata, $allgroups[$group]);
331 $this->pdo->commit();
336 $this->pdo->rollBack();
337 $this->debugMsg('Transaction rolled back', 0, __LINE__);
338 msg($this->getLang('writefail'), -1);
339 return false; // return error
354 if ($this->deleteUser($user)) $count++;
369 public function retrieveUsers($start = 0, $limit = -1, $filter = null)
386 $result = $this->query($this->getConf('list-users'), $filter);
392 … $this->debugMsg("list-users statement did not return 'user' attribute", -1, __LINE__);
395 $users[] = $this->getUserData($row['user']);
398 $this->debugMsg("list-users statement did not return a list of result", -1, __LINE__);
422 $result = $this->query($this->getConf('count-users'), $filter);
424 $this->debugMsg("Statement did not return 'count' attribute", -1, __LINE__);
437 $sql = $this->getConf('insert-group');
439 $result = $this->query($sql, [':group' => $group]);
440 $this->clearGroupCache();
456 $groups = array_keys($this->selectGroups());
470 * @return bool|array user data, false on error
474 $sql = $this->getConf('select-user');
476 $result = $this->query($sql, [':user' => $user]);
480 $this->debugMsg('Found more than one matching user', -1, __LINE__);
488 $this->debugMsg("Statement did not return 'user' attribute", -1, __LINE__);
491 … if (!isset($data['hash']) && !isset($data['clear']) && !$this->checkConfig(['check-pass'])) {
492 $this->debugMsg("Statement did not return 'clear' or 'hash' attribute", -1, __LINE__);
496 $this->debugMsg("Statement did not return 'name' attribute", -1, __LINE__);
500 $this->debugMsg("Statement did not return 'mail' attribute", -1, __LINE__);
516 $this->pdo->beginTransaction();
518 $userdata = $this->getUserData($user);
520 $allgroups = $this->selectGroups();
525 $this->leaveGroup($userdata, $allgroups[$group]);
529 $ok = $this->query($this->getConf('delete-user'), $userdata);
532 $this->pdo->commit();
536 $this->pdo->rollBack();
544 * @return array|bool list of group names, false on error
549 $sql = $this->getConf('select-user-groups');
550 $result = $this->query($sql, $userdata);
557 … $this->debugMsg("No 'group' field returned in select-user-groups statement", -1, __LINE__);
563 … $this->debugMsg("select-user-groups statement did not return a list of result", -1, __LINE__);
578 if ($this->groupcache) return $this->groupcache;
580 $sql = $this->getConf('select-groups');
581 $result = $this->query($sql);
588 … $this->debugMsg("No 'group' field returned from select-groups statement", -1, __LINE__);
597 … $this->debugMsg("select-groups statement did not return a list of result", -1, __LINE__);
609 $this->groupcache = null;
622 $sql = $this->getConf('join-group');
623 $result = $this->query($sql, $data);
638 $sql = $this->getConf('leave-group');
639 $result = $this->query($sql, $data);
649 …rray|int|bool The result as associative array for SELECTs, affected rows for others, false on error
655 $this->debugMsg('No SQL query given', -1, __LINE__);
661 $sth = $this->pdo->prepare($sql);
664 // prepare parameters - we only use those that exist in the SQL
666 if (is_array($value)) continue;
667 if (is_object($value)) continue;
669 if (strpos($sql, (string) $key) === false) continue; // skip if parameter is missing
672 $sth->bindValue($key, $value, PDO::PARAM_INT);
674 $sth->bindValue($key, $value);
679 $sth->execute();
685 $result = $sth->fetchAll();
687 $result = $sth->rowCount();
694 $hasnextrowset = $sth->nextRowset(); // run next rowset
696 … $hasnextrowset = false; // driver does not support multi-rowset, should be executed in one time
703 $dsql = $this->debugSQL($sql, $params, !defined('DOKU_UNITTEST'));
704 $this->debugMsg($e, -1, $line);
705 $this->debugMsg("SQL: <pre>$dsql</pre>", -1, $line);
707 $sth->closeCursor();
721 if (!$this->getConf('debug')) return;
723 $err = -1;
724 $msg = $message->getMessage();
725 if (!$line) $line = $message->getLine();
750 $sql = trim($this->getConf($key));
775 $val = $this->pdo->quote($val, PDO::PARAM_INT);
777 $val = $this->pdo->quote($val, PDO::PARAM_BOOL);
781 $val = $this->pdo->quote($val);