Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixed 'fm_' prefix for users table #4

Merged
merged 4 commits into from Apr 5, 2012
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 4 additions & 1 deletion system/Controller/Users/Edituser.php
Expand Up @@ -25,6 +25,9 @@ public function index() {
}

$err = array();
if ($_POST["quota_val"] != $data["quota"]) {
if ($txt = $validate->quota_val($_POST["quota_val"])) { $err[] = $txt; };
}
if ($_POST["login"] != $data["login"]) {
if ($txt = $validate->login($_POST["login"])) { $err[] = $txt; };
}
Expand Down Expand Up @@ -76,4 +79,4 @@ public function index() {
}
}
}
?>
?>
14 changes: 7 additions & 7 deletions system/Model/File.php
Expand Up @@ -102,10 +102,10 @@ public function attachFromName($filename, $curdir) {

// FM AJAX
function getDirParams($did) {
$sql = "SELECT fd.id, fd.uid, fd.name AS `name`, fdc.right, users.login AS owner
$sql = "SELECT fd.id, fd.uid, fd.name AS `name`, fdc.right, fm_users.login AS owner
FROM fm_dirs AS fd
LEFT JOIN fm_dirs_chmod AS fdc ON (fdc.did = fd.id)
LEFT JOIN users ON (users.id = fd.uid)
LEFT JOIN fm_users ON (fm_users.id = fd.uid)
WHERE fd.id = :did
LIMIT 1";

Expand Down Expand Up @@ -570,18 +570,18 @@ function addFileText($fid, $text) {

function getFileChmod() {
$sql = "SELECT ug.id AS pid, ug.name AS pname, usg.id AS sid, usg.name AS sname
FROM users_group AS ug
LEFT JOIN users_subgroup AS usg ON (usg.pid = ug.id)
FROM fm_users_group AS ug
LEFT JOIN fm_users_subgroup AS usg ON (usg.pid = ug.id)
ORDER BY ug.id";

$res = $this->registry['db']->prepare($sql);
$res->execute();
$this->_groups = $res->fetchAll(PDO::FETCH_ASSOC);

$sql = "SELECT u.id, ug.id AS gid, ug.name AS gname
FROM users AS u
LEFT JOIN users_priv AS up ON (up.id = u.id)
LEFT JOIN users_subgroup AS ug ON (ug.id = up.group)
FROM fm_users AS u
LEFT JOIN fm_users_priv AS up ON (up.id = u.id)
LEFT JOIN fm_users_subgroup AS ug ON (ug.id = up.group)
GROUP BY up.id";

$res = $this->registry['db']->prepare($sql);
Expand Down
17 changes: 17 additions & 0 deletions system/Model/Validate.php
Expand Up @@ -32,5 +32,22 @@ public function password($password) {
return $err;
}
}

public function quota_val($quota_val) {
$err = null;


if ( preg_match( '/^0$/', $quota_val ) ) {
$err = 'Quota value should be a positive value';
}
elseif ( !preg_match( '/^[0-9]+$/', $quota_val ) ) {
$err = 'Quota value should consist of numeric characters';
}

if ($err != null) {
return $err;
}
}

}
?>