summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--dash/css/dash.css22
-rw-r--r--dash/dash_employee.php27
-rw-r--r--dash/dash_employer.php8
-rw-r--r--dash/dash_functions.php24
-rw-r--r--dash/footer.php1
-rw-r--r--dash/headless.php24
-rw-r--r--dash/settings.php71
-rw-r--r--inc/config.php6
-rw-r--r--inc/config.sample.php32
-rw-r--r--inc/dash_fatal.tpl1
10 files changed, 126 insertions, 90 deletions
diff --git a/dash/css/dash.css b/dash/css/dash.css
index f6f390d..8792c52 100644
--- a/dash/css/dash.css
+++ b/dash/css/dash.css
@@ -209,11 +209,11 @@ body {
#fjfright {
text-align: center;
}
-#fulljob a {
+#fulljob a, .errbox a {
text-decoration: none;
color: #fb4d00;
}
-#fulljob a:hover {
+#fulljob a:hover, .errbox a:hover {
color: #fb7700;
}
#fulljob #ebio {
@@ -222,7 +222,7 @@ body {
}
#fulljob.fjsettings {
margin: 2em auto 0 auto;
- height: 500px;
+ height: 455px;
border-radius: 5px;
}
.fjsettings #fjbody {
@@ -234,7 +234,7 @@ body {
.fjsettings #fjbody p {
margin: 0;
}
-.fjsettings form {
+.fjsettings .pseudoform {
margin-bottom: 1em;
}
.fjsettings input, .fjsettings select {
@@ -271,3 +271,17 @@ body {
.fjsettings input[type=submit]:hover {
background-color: #fb7700;
}
+.errbox {
+ width: 512px;
+ margin: 2em auto;
+ background-color: #ffffff;
+ padding: 1em;
+ box-shadow: 0px 0px 5px rgba(0,0,0,0.75);
+ border-radius: 5px;
+ text-align: center;
+ word-break: break-all;
+}
+#setchgbtn {
+ margin: 0;
+ text-align: center;
+}
diff --git a/dash/dash_employee.php b/dash/dash_employee.php
index 0c7e47c..d4a3df1 100644
--- a/dash/dash_employee.php
+++ b/dash/dash_employee.php
@@ -3,32 +3,9 @@ if (!defined('HEIRARCHY')) die;
$title = 'Dashboard / Bulletin';
require('header.php');
$page = 1;
-if (!empty($_GET['p'])) $page = max(1, intval($_GET['p']));
+// if (!empty($_GET['p'])) $page = max(1, intval($_GET['p']));
$result = $db->query('SELECT ads.*, categories.cat_name, SUM(ratings.stars) / COUNT(ratings.stars) AS rating FROM ads LEFT JOIN categories ON ads.cat = categories.id LEFT JOIN ratings ON ads.uid = ratings.rated GROUP BY ads.id LIMIT ' . $b_config['ads_per_page']*($page-1) . ', '.$b_config['ads_per_page']) or fatal($db->error);
-while ($row = $result->fetch_assoc()) {
-?>
- <div class="job">
- <a href="#" class="jobxbtn"></a>
- <p class="jobtitle"><a href="ads.php?id=<?=$row['id'];?>"><?=htmlentities($row['title']);?></a></p>
-<?php
- if (is_null($row['cat_name']))
- echo ' <p class="jobcat">Uncategorized</p>'.PHP_EOL;
- else
- echo ' <p class="jobcat">'.htmlentities($row['cat_name']).'</p>'.PHP_EOL;
-?>
- <p class="joblocation"><?=htmlentities($row['location']);?></p>
-<?php
- if (is_null($row['rating']))
- echo ' <p class="jobstars">Employer Not Rated</p>'.PHP_EOL;
- else
- echo ' <p class="jobstars">'.intval($row['rating']).' Star Employer</p>'.PHP_EOL;
-?>
- <p class="jobpay">Pays $<?=number_format($row['pay'], 2);?></p>
- <p class="jobblurb"><?=htmlentities(substr($row['description'], 0, min(strlen($row['description']), 160)));?> <a href="ads.php?id=<?=$row['id'];?>">[...]</a></p>
- </p>
- </div>
-<?php
-}
+while ($row = $result->fetch_assoc()) draw_ad($row);
$result->free();
require('footer.php');
?>
diff --git a/dash/dash_employer.php b/dash/dash_employer.php
index 28c5ed1..78debfd 100644
--- a/dash/dash_employer.php
+++ b/dash/dash_employer.php
@@ -2,8 +2,10 @@
if (!defined('HEIRARCHY')) die;
$title = 'Dashboard / Bulletin';
require('header.php');
-?>
- <p></p>
-<?php
+$page = 1;
+if (!empty($_GET['p'])) $page = max(1, intval($_GET['p']));
+$result = $db->query('SELECT ads.*, categories.cat_name, SUM(ratings.stars) / COUNT(ratings.stars) AS rating FROM ads LEFT JOIN categories ON ads.cat = categories.id LEFT JOIN ratings ON ads.uid = ratings.rated GROUP BY ads.id LIMIT ' . $b_config['ads_per_page']*($page-1) . ', '.$b_config['ads_per_page']) or fatal($db->error);
+while ($row = $result->fetch_assoc()) draw_ad($row);
+$result->free();
require('footer.php');
?>
diff --git a/dash/dash_functions.php b/dash/dash_functions.php
index 49664a3..b9fd9db 100644
--- a/dash/dash_functions.php
+++ b/dash/dash_functions.php
@@ -6,4 +6,28 @@ function dash_fatal ($msg = null, $link = null, $label = null) {
require('footer.php');
die;
}
+function draw_ad ($row) {
+?>
+ <div class="job">
+ <a href="#" class="jobxbtn"></a>
+ <p class="jobtitle"><a href="ads.php?id=<?=$row['id'];?>"><?=htmlentities($row['title']);?></a></p>
+<?php
+ if (is_null($row['cat_name']))
+ echo ' <p class="jobcat">Uncategorized</p>'.PHP_EOL;
+ else
+ echo ' <p class="jobcat">'.htmlentities($row['cat_name']).'</p>'.PHP_EOL;
+?>
+ <p class="joblocation"><?=htmlentities($row['location']);?></p>
+<?php
+ if (is_null($row['rating']))
+ echo ' <p class="jobstars">Employer Not Rated</p>'.PHP_EOL;
+ else
+ echo ' <p class="jobstars">'.intval($row['rating']).' Star Employer</p>'.PHP_EOL;
+?>
+ <p class="jobpay">Pays $<?=number_format($row['pay'], 2);?></p>
+ <p class="jobblurb"><?=htmlentities(substr($row['description'], 0, min(strlen($row['description']), 160)));?> <a href="ads.php?id=<?=$row['id'];?>">[...]</a></p>
+ </p>
+ </div>
+<?php
+}
?>
diff --git a/dash/footer.php b/dash/footer.php
index 963d525..11e6462 100644
--- a/dash/footer.php
+++ b/dash/footer.php
@@ -1,5 +1,6 @@
<?php
if (!defined('HEIRARCHY')) die;
+global $db;
$db->close();
?>
</div>
diff --git a/dash/headless.php b/dash/headless.php
index bc321f2..ca090aa 100644
--- a/dash/headless.php
+++ b/dash/headless.php
@@ -6,29 +6,7 @@ $db = new bdb();
$result = $db->query('SELECT ads.*, categories.cat_name, SUM(ratings.stars) / COUNT(ratings.stars) AS rating FROM ads LEFT JOIN categories ON ads.cat = categories.id LEFT JOIN ratings ON ads.uid = ratings.rated GROUP BY ads.id LIMIT '.($clicks+$b_config['ads_per_page']).', 1') or die();
if ($result->num_rows) {
$row = $result->fetch_assoc();
-?>
- <div class="job">
- <a href="#" class="jobxbtn"></a>
- <p class="jobtitle"><a href="ads.php?id=<?=$row['id'];?>"><?=htmlentities($row['title']);?></a></p>
-<?php
- if (is_null($row['cat_name']))
- echo ' <p class="jobcat">Uncategorized</p>'.PHP_EOL;
- else
- echo ' <p class="jobcat">'.htmlentities($row['cat_name']).'</p>'.PHP_EOL;
-?>
- <p class="joblocation"><?=htmlentities($row['location']);?></p>
-<?php
- if (is_null($row['rating']))
- echo ' <p class="jobstars">Employer Not Rated</p>'.PHP_EOL;
- else
- echo ' <p class="jobstars">'.intval($row['rating']).' Star Employer</p>'.PHP_EOL;
-?>
- <p class="jobpay">Pays $<?=number_format($row['pay'], 2);?></p>
- <p class="jobblurb"><?=htmlentities(substr($row['description'], 0, min(strlen($row['description']), 160)));?> <a href="ads.php?id=<?=$row['id'];?>">[...]</a></p>
- </p>
-
- </div>
-<?php
+ draw_ad($row);
}
$result->free();
$db->close();
diff --git a/dash/settings.php b/dash/settings.php
index 5dc2e3d..9a7179a 100644
--- a/dash/settings.php
+++ b/dash/settings.php
@@ -2,16 +2,25 @@
define('HEIRARCHY', 1);
require('dash_common.php');
+global $b_config, $b_user;
$title = 'Account Settings / Bulletin';
require('header.php');
-if (!empty($_POST['changepass'])) {
+if (!empty($_POST['oldpass'])) {
if ($b_user['password'] != hash('sha512', $_POST['oldpass'])) dash_fatal('The password you entered does not match your current password.');
- if ($_POST['newpass1'] != $_POST['newpass2']) dash_fatal('Your new passwords do not match.');
- $db->query('UPDATE users SET password = \''.hash('sha512', $_POST['newpass1']).'\' WHERE id = '.$b_user['id']) or dash_fatal($db->error);
- if ($db->affected_rows < 1) dash_fatal('No user with your ID is in the database');
- dash_fatal('Password changed successfully.');
-} else if (!empty($_POST['changetype'])) {
- if ($b_user['password'] != hash('sha512', $_POST['curpass'])) dash_fatal('The password you entered does not match your current password.');
+ if (!empty($_POST['newpass1'])) {
+ if ($_POST['newpass1'] != $_POST['newpass2']) dash_fatal('Your new passwords do not match.');
+ $db->query('UPDATE users SET password = \''.hash('sha512', $_POST['newpass1']).'\' WHERE id = '.$b_user['id']) or dash_fatal($db->error);
+ if ($db->affected_rows < 1) dash_fatal('Your password could not be changed.');
+ }
+
+ $type = $b_user['type'];
+ if ($_POST['newtype'] == 0) $type = 'EMPLOYEE';
+ else if ($_POST['newtype'] == 1) $type = 'EMPLOYER';
+ if ($type != $b_user['type']) {
+ $db->query('UPDATE users SET type = \''.$type.'\' WHERE id = '.$b_user['id']) or dash_fatal($db->error);
+ if ($db->affected_rows < 1) dash_fatal('Your account type could not be changed.');
+ }
+ dash_fatal('Account settings successfully updated.');
}
?>
<div id="fulljob" class="fjsettings">
@@ -19,31 +28,31 @@ if (!empty($_POST['changepass'])) {
<h3 id="fjhtitle">Account Settings</h3>
<p id="fjhdesc">Adjusting for <?=htmlentities($b_user['email']);?></p>
</div>
- <div id="fjbody">
- <h4>Current Password</h4>
- <p>Your current password is needed to change your account settings.</p>
- <p><input id="inpoldpass" type="password" name="oldpass" placeholder="Current password" /></p>
- </div>
- <div id="fjfooter">
- <form action="/dash/settings.php" method="post">
- <h4>Change Password</h4>
- <p><input id="inpnp1" type="password" name="newpass1" placeholder="New password" /></p>
- <p><input id="inpnp2" type="password" name="newpass2" placeholder="Confirm new password" /></p>
- <p><input id="inpcp" type="submit" name="changepass" value="Change Password" /></p>
- </form>
- <form action="/dash/settings.php" method="post">
- <h4>Change Account Type</h4>
- <p>
- <select id="inpnt" name="newtype">
- <option<?php if ($b_user['type'] == 'EMPLOYEE') echo ' selected="selected"'; ?> value="0">Job Seeker</option>
- <option<?php if ($b_user['type'] == 'EMPLOYER') echo ' selected="selected"'; ?> value="1">Job Provider</option>
- </select>
- </p>
- <p><input id="inpct" type="submit" name="changetype" value="Change Account Type" /></p>
- </form>
- </div>
+ <form action="/dash/settings.php" method="post">
+ <div id="fjbody">
+ <h4>Current Password</h4>
+ <p>Your current password is needed to change your account settings.</p>
+ <p><input id="inpoldpass" type="password" name="oldpass" placeholder="Current password" /></p>
+ </div>
+ <div id="fjfooter">
+ <div class="pseudoform">
+ <h4>Change Password</h4>
+ <p><input id="inpnp1" type="password" name="newpass1" placeholder="New password" /></p>
+ <p><input id="inpnp2" type="password" name="newpass2" placeholder="Confirm new password" /></p>
+ </div>
+ <div class="pseudoform">
+ <h4>Change Account Type</h4>
+ <p>
+ <select id="inpnt" name="newtype">
+ <option<?php if ($b_user['type'] == 'EMPLOYEE') echo ' selected="selected"'; ?> value="0">Job Seeker</option>
+ <option<?php if ($b_user['type'] == 'EMPLOYER') echo ' selected="selected"'; ?> value="1">Job Provider</option>
+ </select>
+ </p>
+ </div>
+ <p id="setchgbtn"><input id="inpchg" type="submit" name="change" value="Update Settings" /></p>
+ </div>
+ </form>
</div>
<?php
-if (!empty($result)) $result->free();
require('footer.php');
?>
diff --git a/inc/config.php b/inc/config.php
index 76783c3..b7d21a4 100644
--- a/inc/config.php
+++ b/inc/config.php
@@ -1,11 +1,11 @@
<?php
$b_config = array(
- 'base_url' => 'https://www.bulletinalpha.tk/',
+ 'base_url' => 'http://www.bulletin.com/',
'c_name' => 'bulletin',
'c_expire' => 31536000,
- 'c_dom' => '.bulletinalpha.tk',
+ 'c_dom' => '.bulletin.com',
'c_path' => '/',
- 'c_sec' => true,
+ 'c_sec' => false,
'c_http' => true,
'db_host' => 'localhost',
'db_name' => 'bulletin',
diff --git a/inc/config.sample.php b/inc/config.sample.php
new file mode 100644
index 0000000..1be5151
--- /dev/null
+++ b/inc/config.sample.php
@@ -0,0 +1,32 @@
+<?php
+$b_config = array(
+
+ // Site URL with trailing slash
+ 'base_url' => 'https://www.bulletinalpha.tk/',
+
+ // Cookies Information
+ 'c_name' => 'bulletin', // Cookie name
+ 'c_expire' => 31536000, // Expiration time (seconds, default: 1 year)
+ 'c_dom' => '.bulletinalpha.tk', // Domain
+ 'c_path' => '/', // Path
+ 'c_sec' => true, // Serve cookies only over https
+ 'c_http' => true, // Don't serve cookies to javascript
+
+ // Database Information
+ 'db_host' => 'localhost',
+ 'db_name' => '',
+ 'db_user' => '',
+ 'db_pass' => '',
+
+ // Send emails from this address
+ 'mail_from' => 'Bulletin <noreply@bulletinalpha.tk>',
+
+ // Mobile site configuration
+ 'mobile_base' => 'https://m.bulletinalpha.tk/',
+ 'moblie_host' => 'm.bulletinalpha.tk',
+
+ // Number of ads per page in the employee dashboard
+ 'ads_per_page' => 10,
+
+);
+?>
diff --git a/inc/dash_fatal.tpl b/inc/dash_fatal.tpl
index 31106a2..db7d7fa 100644
--- a/inc/dash_fatal.tpl
+++ b/inc/dash_fatal.tpl
@@ -1,6 +1,5 @@
<div class="errbox">
<p>[tpl:message]</p>
- <div class="hr"></div>
<p class="back">
<a href="[tpl:link]">
[tpl:label]