diff --git a/.gitignore b/.gitignore index 48d831a..9023c17 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ data/*.db data/*.db-shm data/*.db-wal +uploads/* +!uploads/.gitkeep diff --git a/.htaccess b/.htaccess new file mode 100644 index 0000000..8ef5afe --- /dev/null +++ b/.htaccess @@ -0,0 +1,3 @@ +RewriteEngine On +RewriteRule ^forum/?$ forum.php [L,QSA] +RewriteRule ^forum/([^/]+)/?$ forum.php?topic=$1 [L,QSA] diff --git a/account.php b/account.php index 97b5f19..265696f 100644 --- a/account.php +++ b/account.php @@ -7,6 +7,7 @@ $errors = []; if (isPost()) { csrfCheck(); $em = ps('email'); $pw = ps('password'); $pw2 = ps('password2'); + $avatarPath = (string)($u['avatar_path'] ?? ''); if ($em && !filter_var($em,FILTER_VALIDATE_EMAIL)) $errors[] = 'Invalid email address.'; if ($pw) { if (strlen($pw) < 6) $errors[] = 'Password must be at least 6 characters.'; @@ -14,11 +15,18 @@ if (isPost()) { } if (!$errors && $em && $em !== $u['email'] && qval("SELECT id FROM users WHERE email=? AND id!=?",[$em,uid()])) $errors[] = 'Email already in use.'; if (!$errors) { - if ($pw) qrun("UPDATE users SET email=?,password=? WHERE id=?",[$em?:null,password_hash($pw,PASSWORD_BCRYPT),uid()]); - else qrun("UPDATE users SET email=? WHERE id=?",[$em?:null,uid()]); + if (p('remove_avatar','0') === '1') $avatarPath = ''; + $avatar = storeAvatarUpload('avatar', mbToBytes(setting('avatar_upload_max_mb','3'), 3)); + if (!$avatar['ok']) $errors[] = $avatar['error']; + elseif (!empty($avatar['path'])) $avatarPath = (string)$avatar['path']; + } + if (!$errors) { + if ($pw) qrun("UPDATE users SET email=?,avatar_path=?,password=? WHERE id=?",[$em?:null,$avatarPath,password_hash($pw,PASSWORD_BCRYPT),uid()]); + else qrun("UPDATE users SET email=?,avatar_path=? WHERE id=?",[$em?:null,$avatarPath,uid()]); flash('Account updated successfully!','success'); go('/account.php'); } $u['email'] = $em; + $u['avatar_path'] = $avatarPath; } include __DIR__.'/includes/header.php'; ?> @@ -27,13 +35,35 @@ include __DIR__.'/includes/header.php';
Manage your Discover Keyser WV account
| Name | Description | Topics | Status | Order | Actions |
|---|---|---|---|---|---|
| =e($cat['name'])?> | +=e($cat['description'])?> | +=$cat['topic_count']?> | +=$cat['is_active']?'Active':'Inactive'?> | +=$cat['sort_order']?> | +
+
+
+
+ Edit+ + |
+
| Topic | Category | By | Replies | Status | Actions |
|---|---|---|---|---|---|
| =e($topic['title'])?> =ago($topic['updated_at'])?> |
+ =e($topic['category_name'])?> | +=e($topic['username'])?> | +=$topic['reply_count']?> | ++ Pinned + Locked + | +
+
+
+
+
+
+ |
+
| No forum topics yet. | |||||
| TOPIC | CATEGORY | BY | REPLIES | |
|---|---|---|---|---|
| =e($topic['title'])?> =ago($topic['updated_at'])?> |
+ =e($topic['category_name'])?> | +=e($topic['username'])?> | +=$topic['reply_count']?> | +Moderate | +
| ITEM NAME | DESCRIPTION | PRICE | AVAIL. | ORDER | ||
|---|---|---|---|---|---|---|
| ITEM NAME | IMAGE | DESCRIPTION | PRICE | AVAIL. | ORDER | |
| =e($item['name'])?> | +=e(substr($item['description'],0,80))?> | =$item['price']>0?money($item['price']):'β'?> | =$item['is_available']?'Yes':'No'?> | @@ -132,12 +172,25 @@ if ($biz) {