sasha-code Mailing List for SASHA
Brought to you by:
gphemsley
You can subscribe to this list here.
| 2008 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(4) |
Aug
(3) |
Sep
|
Oct
(2) |
Nov
(3) |
Dec
(4) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2009 |
Jan
(1) |
Feb
|
Mar
(1) |
Apr
|
May
(5) |
Jun
(9) |
Jul
(2) |
Aug
(18) |
Sep
(4) |
Oct
|
Nov
(1) |
Dec
(1) |
| 2010 |
Jan
(9) |
Feb
(2) |
Mar
(1) |
Apr
|
May
|
Jun
(4) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2011 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(1) |
Nov
|
Dec
(4) |
|
From: <gph...@us...> - 2011-12-20 00:20:52
|
Revision: 97
http://sasha.svn.sourceforge.net/sasha/?rev=97&view=rev
Author: gphemsley
Date: 2011-12-20 00:20:46 +0000 (Tue, 20 Dec 2011)
Log Message:
-----------
Merge r96 to trunk.
Revision Links:
--------------
http://sasha.svn.sourceforge.net/sasha/?rev=96&view=rev
Modified Paths:
--------------
trunk/SASHA/inc/lib/lib.base.php
Modified: trunk/SASHA/inc/lib/lib.base.php
===================================================================
--- trunk/SASHA/inc/lib/lib.base.php 2011-12-20 00:16:54 UTC (rev 96)
+++ trunk/SASHA/inc/lib/lib.base.php 2011-12-20 00:20:46 UTC (rev 97)
@@ -924,6 +924,8 @@
$instructors[$id] = "$last_name, $first_initial.";
}
}
+
+ $instructors[$id] = htmlentities( $instructors[$id], ENT_QUOTES, 'UTF-8' );
}
return implode( $glue, $instructors );
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <gph...@us...> - 2011-12-20 00:17:00
|
Revision: 96
http://sasha.svn.sourceforge.net/sasha/?rev=96&view=rev
Author: gphemsley
Date: 2011-12-20 00:16:54 +0000 (Tue, 20 Dec 2011)
Log Message:
-----------
Patch part of XSS vulnerability reported by g13net and henrisalo in issue 13.
Modified Paths:
--------------
branches/SASHA_0.2/SASHA/inc/lib/lib.base.php
Modified: branches/SASHA_0.2/SASHA/inc/lib/lib.base.php
===================================================================
--- branches/SASHA_0.2/SASHA/inc/lib/lib.base.php 2011-12-20 00:01:08 UTC (rev 95)
+++ branches/SASHA_0.2/SASHA/inc/lib/lib.base.php 2011-12-20 00:16:54 UTC (rev 96)
@@ -924,6 +924,8 @@
$instructors[$id] = "$last_name, $first_initial.";
}
}
+
+ $instructors[$id] = htmlentities( $instructors[$id], ENT_QUOTES, 'UTF-8' );
}
return implode( $glue, $instructors );
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <gph...@us...> - 2011-12-20 00:01:15
|
Revision: 95
http://sasha.svn.sourceforge.net/sasha/?rev=95&view=rev
Author: gphemsley
Date: 2011-12-20 00:01:08 +0000 (Tue, 20 Dec 2011)
Log Message:
-----------
Backport changes from r93 regarding UTF-8 support, security fixes, and miscellaneous changes.
Revision Links:
--------------
http://sasha.svn.sourceforge.net/sasha/?rev=93&view=rev
Modified Paths:
--------------
branches/SASHA_0.2/SASHA/inc/database/database.mysql.php
branches/SASHA_0.2/SASHA/inc/lib/lib.assignments.php
branches/SASHA_0.2/SASHA/inc/lib/lib.base.php
branches/SASHA_0.2/SASHA/inc/lib/lib.forms.php
branches/SASHA_0.2/SASHA/inc/lib/lib.schedule.php
branches/SASHA_0.2/SASHA/inc/lib/lib.sessions.php
branches/SASHA_0.2/SASHA/inc/lib/lib.tests.php
branches/SASHA_0.2/SASHA/inc/lib/lib.user.php
Modified: branches/SASHA_0.2/SASHA/inc/database/database.mysql.php
===================================================================
--- branches/SASHA_0.2/SASHA/inc/database/database.mysql.php 2011-12-19 23:50:07 UTC (rev 94)
+++ branches/SASHA_0.2/SASHA/inc/database/database.mysql.php 2011-12-20 00:01:08 UTC (rev 95)
@@ -238,7 +238,7 @@
*/
function has_result( $result )
{
- if( $this->num_rows( $result ) > 0 )
+ if( $result && ( $this->num_rows( $result ) > 0 ) )
{
return TRUE;
}
Modified: branches/SASHA_0.2/SASHA/inc/lib/lib.assignments.php
===================================================================
--- branches/SASHA_0.2/SASHA/inc/lib/lib.assignments.php 2011-12-19 23:50:07 UTC (rev 94)
+++ branches/SASHA_0.2/SASHA/inc/lib/lib.assignments.php 2011-12-20 00:01:08 UTC (rev 95)
@@ -152,7 +152,7 @@
}
elseif( $due_date < $assigned_date )
{
- print_message( 'bad', 'Due date cannot be before assigned date.', 'Update failed.' );
+ print_message( 'bad', 'Due date cannot be before assigned date.', 'Update failed.' );
}
else
{
@@ -183,7 +183,7 @@
WHERE a.schedule_id = s.schedule_id
AND s.user_id = {$User->user_info['id']}
AND s.semester = '$semester'
- AND a.assignment_id = $assignment_id";
+ AND a.assignment_id = $assignment_id";
$result = $Database->query( $sql );
$assignment = $Database->fetch_assoc( $result );
Modified: branches/SASHA_0.2/SASHA/inc/lib/lib.base.php
===================================================================
--- branches/SASHA_0.2/SASHA/inc/lib/lib.base.php 2011-12-19 23:50:07 UTC (rev 94)
+++ branches/SASHA_0.2/SASHA/inc/lib/lib.base.php 2011-12-20 00:01:08 UTC (rev 95)
@@ -991,7 +991,7 @@
*/
public function print_sub_navigation( $sub_nav )
{
- if( !is_array( $sub_nav ) )
+ if( empty( $sub_nav ) || !is_array( $sub_nav ) )
{
return FALSE;
}
Modified: branches/SASHA_0.2/SASHA/inc/lib/lib.forms.php
===================================================================
--- branches/SASHA_0.2/SASHA/inc/lib/lib.forms.php 2011-12-19 23:50:07 UTC (rev 94)
+++ branches/SASHA_0.2/SASHA/inc/lib/lib.forms.php 2011-12-20 00:01:08 UTC (rev 95)
@@ -418,7 +418,7 @@
{
$selected = ( ( $row['instructor_id'] == @$current_instructor_ids[$i] ) || ( $row['instructor_key'] == @$current_instructor_ids[$i] ) ) ? ' selected="selected"' : '';
- print "\t\t\t\t\t" . '<option value="' . $row['instructor_id'] . '"' . $selected . '>' . htmlentities( $row['last_name'] ) . ', ' . htmlentities( $row['first_name'] ) . ' ' . htmlentities( $row['middle_name'] ) . ' — ' . $SASHA->format_instructor_type( $row['type'], $row['type_description'] ) . '</option>' . "\n";
+ print "\t\t\t\t\t" . '<option value="' . $row['instructor_id'] . '"' . $selected . '>' . htmlentities( $row['last_name'], ENT_QUOTES, 'UTF-8' ) . ', ' . htmlentities( $row['first_name'], ENT_QUOTES, 'UTF-8' ) . ' ' . htmlentities( $row['middle_name'], ENT_QUOTES, 'UTF-8' ) . ' — ' . $SASHA->format_instructor_type( $row['type'], $row['type_description'] ) . '</option>' . "\n";
}
$Database->reset_result( $result );
@@ -677,6 +677,11 @@
foreach( $form_data as $id => $id_data )
{
+ if( empty( $id_data ) )
+ {
+ continue;
+ }
+
$form_data[$id]['name'] = $id_data['name'] = ( isset( $id_data['name'] ) ) ? $id_data['name'] : 'r_' . md5( rand() . microtime() );
$form_data[$id]['id'] = $id_data['id'] = ( isset( $id_data['id'] ) ) ? $id_data['id'] : $id_data['name']; //'r_' . md5( rand() . microtime() );
Modified: branches/SASHA_0.2/SASHA/inc/lib/lib.schedule.php
===================================================================
--- branches/SASHA_0.2/SASHA/inc/lib/lib.schedule.php 2011-12-19 23:50:07 UTC (rev 94)
+++ branches/SASHA_0.2/SASHA/inc/lib/lib.schedule.php 2011-12-20 00:01:08 UTC (rev 95)
@@ -98,7 +98,7 @@
print "\t" . '<p style="text-align: left;"><strong>Institution:</strong> ' . $this->format_institution( $institution ) . '<br />' . "\n";
print "\t" . '<strong>Semester:</strong> ' . $this->format_semester( $semester ) . '<br />' . "\n";
print "\t" . '<strong>Course:</strong> ' . $this->format_course( $this->subject, $this->course, $institution, ' ' ) . ' (' . $this->section . ')<br />' . "\n";
- print "\t" . '<strong>Course Title:</strong> ' . htmlentities( $this->get_course_title( $institution, $this->subject, $this->course ) ) . '<br />' . "\n";
+ print "\t" . '<strong>Course Title:</strong> ' . htmlentities( $this->get_course_title( $institution, $this->subject, $this->course ), ENT_QUOTES, 'UTF-8' ) . '<br />' . "\n";
print "\t" . '<strong>Schedule Type:</strong> ' . $this->format_schedule_type( $this->schedule_type ) . '<br />' . "\n";
print "\t" . '<strong>Days:</strong> ' . $this->format_days( $this->schedule_days, 'array', 'html' ) . '<br />' . "\n";
print "\t" . '<strong>Time:</strong> ' . $this->format_time( $this->start_time, TRUE, 'array', 'html' ) . '–' . $this->format_time( $this->end_time, TRUE, 'array', 'html' ) . '</p>' . "\n";
@@ -512,7 +512,7 @@
print "\t" . '<p style="text-align: left;"><strong>Institution:</strong> ' . $this->format_institution( $institution ) . '<br />' . "\n";
print "\t" . '<strong>Semester:</strong> ' . $this->format_semester( $semester ) . '<br />' . "\n";
print "\t" . '<strong>Course:</strong> ' . $this->format_course( $this->subject, $this->course, $institution, ' ' ) . ' (' . $this->section . ')<br />' . "\n";
- print "\t" . '<strong>Course Title:</strong> ' . htmlentities( $this->get_course_title( $institution, $this->subject, $this->course ) ) . '<br />' . "\n";
+ print "\t" . '<strong>Course Title:</strong> ' . htmlentities( $this->get_course_title( $institution, $this->subject, $this->course ), ENT_QUOTES, 'UTF-8' ) . '<br />' . "\n";
print "\t" . '<strong>Schedule Type:</strong> ' . $this->format_schedule_type( $this->schedule_type ) . '<br />' . "\n";
print "\t" . '<strong>Days:</strong> ' . $this->format_days( $this->schedule_days, 'array', 'html' ) . '<br />' . "\n";
print "\t" . '<strong>Time:</strong> ' . $this->format_time( $this->start_time, TRUE, 'array', 'html' ) . '–' . $this->format_time( $this->end_time, TRUE, 'array', 'html' ) . '</p>' . "\n";
Modified: branches/SASHA_0.2/SASHA/inc/lib/lib.sessions.php
===================================================================
--- branches/SASHA_0.2/SASHA/inc/lib/lib.sessions.php 2011-12-19 23:50:07 UTC (rev 94)
+++ branches/SASHA_0.2/SASHA/inc/lib/lib.sessions.php 2011-12-20 00:01:08 UTC (rev 95)
@@ -359,10 +359,10 @@
while( $row = $Database->fetch_assoc( $result ) )
{
// Hash of given password must match password hash in user table.
- if( sha1( $password ) == $row['password'] )
+ if( sha1( $password ) === $row['password'] )
{
// The current user's session must be updated to match their new user ID.
- if( $this->update_session( $this->get_session(), $row['user_id'], (bool) $secure ) )
+ if( $this->update_session( $this->get_session(), (int) $row['user_id'], (bool) $secure ) )
{
$this->logged_in = TRUE;
}
Modified: branches/SASHA_0.2/SASHA/inc/lib/lib.tests.php
===================================================================
--- branches/SASHA_0.2/SASHA/inc/lib/lib.tests.php 2011-12-19 23:50:07 UTC (rev 94)
+++ branches/SASHA_0.2/SASHA/inc/lib/lib.tests.php 2011-12-20 00:01:08 UTC (rev 95)
@@ -156,7 +156,7 @@
if( $end_date <= $start_date )
{
- print_message( 'bad', 'End date must come after start date.', 'Update failed.' );
+ print_message( 'bad', 'End date must come after start date.', 'Update failed.' );
}
elseif( $test_name )
{
Modified: branches/SASHA_0.2/SASHA/inc/lib/lib.user.php
===================================================================
--- branches/SASHA_0.2/SASHA/inc/lib/lib.user.php 2011-12-19 23:50:07 UTC (rev 94)
+++ branches/SASHA_0.2/SASHA/inc/lib/lib.user.php 2011-12-20 00:01:08 UTC (rev 95)
@@ -89,9 +89,9 @@
{
global $Database;
- $sql = "SELECT username
- FROM users
- WHERE username = '" . $Database->escape( $username ) . "'";
+ $sql = "SELECT u.username
+ FROM u.users
+ WHERE u.username = '" . $Database->escape( $username ) . "'";
$result = $Database->query( $sql );
$username = $Database->fetch_assoc( $result );
@@ -162,9 +162,9 @@
{
global $Database;
- $sql = "SELECT email_address
- FROM users
- WHERE email_address = '" . $Database->escape( $email_address ) . "'";
+ $sql = "SELECT u.email_address
+ FROM u.users
+ WHERE u.email_address = '" . $Database->escape( $email_address ) . "'";
$result = $Database->query( $sql );
$email_address = $Database->fetch_assoc( $result );
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <gph...@us...> - 2011-12-19 23:50:18
|
Revision: 94
http://sasha.svn.sourceforge.net/sasha/?rev=94&view=rev
Author: gphemsley
Date: 2011-12-19 23:50:07 +0000 (Mon, 19 Dec 2011)
Log Message:
-----------
Bump version number to 0.2.1-dev.
Modified Paths:
--------------
branches/SASHA_0.2/SASHA/config/config.default.php
Modified: branches/SASHA_0.2/SASHA/config/config.default.php
===================================================================
--- branches/SASHA_0.2/SASHA/config/config.default.php 2011-10-04 19:51:20 UTC (rev 93)
+++ branches/SASHA_0.2/SASHA/config/config.default.php 2011-12-19 23:50:07 UTC (rev 94)
@@ -50,6 +50,6 @@
* Version information.
*/
-define( 'SASHA_VERSION', '0.2.0' );
+define( 'SASHA_VERSION', '0.2.1-dev' );
?>
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <gph...@us...> - 2011-10-04 19:51:26
|
Revision: 93
http://sasha.svn.sourceforge.net/sasha/?rev=93&view=rev
Author: gphemsley
Date: 2011-10-04 19:51:20 +0000 (Tue, 04 Oct 2011)
Log Message:
-----------
Committing a bunch of changes from over a year ago.
Improve support for UTF-8 in some places.
Add 'upload'/'file' and 'boolean' form types.
Patch a few security concerns.
Miscellaneous formatting changes.
Modified Paths:
--------------
trunk/SASHA/inc/database/database.mysql.php
trunk/SASHA/inc/lib/lib.assignments.php
trunk/SASHA/inc/lib/lib.base.php
trunk/SASHA/inc/lib/lib.forms.php
trunk/SASHA/inc/lib/lib.schedule.php
trunk/SASHA/inc/lib/lib.sessions.php
trunk/SASHA/inc/lib/lib.tests.php
trunk/SASHA/inc/lib/lib.user.php
Modified: trunk/SASHA/inc/database/database.mysql.php
===================================================================
--- trunk/SASHA/inc/database/database.mysql.php 2010-06-12 07:39:33 UTC (rev 92)
+++ trunk/SASHA/inc/database/database.mysql.php 2011-10-04 19:51:20 UTC (rev 93)
@@ -238,7 +238,7 @@
*/
function has_result( $result )
{
- if( $this->num_rows( $result ) > 0 )
+ if( $result && ( $this->num_rows( $result ) > 0 ) )
{
return TRUE;
}
Modified: trunk/SASHA/inc/lib/lib.assignments.php
===================================================================
--- trunk/SASHA/inc/lib/lib.assignments.php 2010-06-12 07:39:33 UTC (rev 92)
+++ trunk/SASHA/inc/lib/lib.assignments.php 2011-10-04 19:51:20 UTC (rev 93)
@@ -152,7 +152,7 @@
}
elseif( $due_date < $assigned_date )
{
- print_message( 'bad', 'Due date cannot be before assigned date.', 'Update failed.' );
+ print_message( 'bad', 'Due date cannot be before assigned date.', 'Update failed.' );
}
else
{
@@ -183,7 +183,7 @@
WHERE a.schedule_id = s.schedule_id
AND s.user_id = {$User->user_info['id']}
AND s.semester = '$semester'
- AND a.assignment_id = $assignment_id";
+ AND a.assignment_id = $assignment_id";
$result = $Database->query( $sql );
$assignment = $Database->fetch_assoc( $result );
Modified: trunk/SASHA/inc/lib/lib.base.php
===================================================================
--- trunk/SASHA/inc/lib/lib.base.php 2010-06-12 07:39:33 UTC (rev 92)
+++ trunk/SASHA/inc/lib/lib.base.php 2011-10-04 19:51:20 UTC (rev 93)
@@ -991,7 +991,7 @@
*/
public function print_sub_navigation( $sub_nav )
{
- if( !is_array( $sub_nav ) )
+ if( empty( $sub_nav ) || !is_array( $sub_nav ) )
{
return FALSE;
}
Modified: trunk/SASHA/inc/lib/lib.forms.php
===================================================================
--- trunk/SASHA/inc/lib/lib.forms.php 2010-06-12 07:39:33 UTC (rev 92)
+++ trunk/SASHA/inc/lib/lib.forms.php 2011-10-04 19:51:20 UTC (rev 93)
@@ -418,7 +418,7 @@
{
$selected = ( ( $row['instructor_id'] == @$current_instructor_ids[$i] ) || ( $row['instructor_key'] == @$current_instructor_ids[$i] ) ) ? ' selected="selected"' : '';
- print "\t\t\t\t\t" . '<option value="' . $row['instructor_id'] . '"' . $selected . '>' . htmlentities( $row['last_name'] ) . ', ' . htmlentities( $row['first_name'] ) . ' ' . htmlentities( $row['middle_name'] ) . ' — ' . $SASHA->format_instructor_type( $row['type'], $row['type_description'] ) . '</option>' . "\n";
+ print "\t\t\t\t\t" . '<option value="' . $row['instructor_id'] . '"' . $selected . '>' . htmlentities( $row['last_name'], ENT_QUOTES, 'UTF-8' ) . ', ' . htmlentities( $row['first_name'], ENT_QUOTES, 'UTF-8' ) . ' ' . htmlentities( $row['middle_name'], ENT_QUOTES, 'UTF-8' ) . ' — ' . $SASHA->format_instructor_type( $row['type'], $row['type_description'] ) . '</option>' . "\n";
}
$Database->reset_result( $result );
@@ -662,9 +662,10 @@
* @param string $form_name Form name
* @param string $form_action URL to send form data
* @param array $form_data Parameters used to propagate form
+ * @param bool $form_multipart Multipart form?
* @return void Prints a complete HTML form
*/
- public static function create_form( $form_name, $form_action, $form_data )
+ public static function create_form( $form_name, $form_action, $form_data, $form_multipart = FALSE )
{
global $SASHA;
@@ -673,10 +674,17 @@
return FALSE;
}
- print "\t" . '<form id="' . $form_name . '" action="' . $form_action . '" method="post" accept-charset="UTF-8" style="text-align: left;">' . "\n";
+ $enctype = ( $form_multipart ) ? ' enctype="multipart/form-data"' : '';
+ print "\t" . '<form id="' . $form_name . '" action="' . $form_action . '" method="post"' . $enctype . ' accept-charset="UTF-8" style="text-align: left;">' . "\n";
+
foreach( $form_data as $id => $id_data )
{
+ if( empty( $id_data ) )
+ {
+ continue;
+ }
+
$form_data[$id]['name'] = $id_data['name'] = ( isset( $id_data['name'] ) ) ? $id_data['name'] : 'r_' . md5( rand() . microtime() );
$form_data[$id]['id'] = $id_data['id'] = ( isset( $id_data['id'] ) ) ? $id_data['id'] : $id_data['name']; //'r_' . md5( rand() . microtime() );
@@ -726,6 +734,37 @@
print "</p>\n";
break;
+ case 'upload':
+ case 'file':
+ print "\t\t<p>";
+
+ if( isset( $id_data['label'] ) )
+ {
+ print '<label>' . htmlentities( $id_data['label'], ENT_QUOTES, 'UTF-8' ) . ':<br />';
+ }
+
+ print '<input id="' . $id_data['id'] . '" name="' . $id_data['name'] . '" type="file"';
+
+ if( isset( $id_data['data']['accept'] ) )
+ {
+ print ' accept="' . htmlentities( implode( $id_data['data']['accept'], ',' ), ENT_QUOTES, 'UTF-8' ) . '"';
+ }
+
+ if( isset( $id_data['data']['multiple'] ) && $id_data['data']['multiple'] )
+ {
+ print ' multiple="multiple"';
+ }
+
+ print ' />';
+
+ if( isset( $id_data['label'] ) )
+ {
+ print '</label>';
+ }
+
+ print "</p>\n";
+ break;
+
case 'hidden':
print "\t\t<p>";
@@ -799,6 +838,12 @@
print "</p>\n";
break;
+ case 'boolean':
+ print "\t\t<p>";
+ print '<label><input id="' . $id_data['id'] . '" name="' . $id_data['name'] . '" type="checkbox" value="1" />' . htmlentities( $id_data['label'], ENT_QUOTES, 'UTF-8' ) . '</label>';
+ print "</p>\n";
+ break;
+
case 'date':
print "\t\t" . '<p>' . htmlentities( $id_data['label'], ENT_QUOTES, 'UTF-8' ) . ': ' . "\n";
Forms::_create_date_selector( $id_data['name'], @$id_data['data'][0] );
Modified: trunk/SASHA/inc/lib/lib.schedule.php
===================================================================
--- trunk/SASHA/inc/lib/lib.schedule.php 2010-06-12 07:39:33 UTC (rev 92)
+++ trunk/SASHA/inc/lib/lib.schedule.php 2011-10-04 19:51:20 UTC (rev 93)
@@ -98,7 +98,7 @@
print "\t" . '<p style="text-align: left;"><strong>Institution:</strong> ' . $this->format_institution( $institution ) . '<br />' . "\n";
print "\t" . '<strong>Semester:</strong> ' . $this->format_semester( $semester ) . '<br />' . "\n";
print "\t" . '<strong>Course:</strong> ' . $this->format_course( $this->subject, $this->course, $institution, ' ' ) . ' (' . $this->section . ')<br />' . "\n";
- print "\t" . '<strong>Course Title:</strong> ' . htmlentities( $this->get_course_title( $institution, $this->subject, $this->course ) ) . '<br />' . "\n";
+ print "\t" . '<strong>Course Title:</strong> ' . htmlentities( $this->get_course_title( $institution, $this->subject, $this->course ), ENT_QUOTES, 'UTF-8' ) . '<br />' . "\n";
print "\t" . '<strong>Schedule Type:</strong> ' . $this->format_schedule_type( $this->schedule_type ) . '<br />' . "\n";
print "\t" . '<strong>Days:</strong> ' . $this->format_days( $this->schedule_days, 'array', 'html' ) . '<br />' . "\n";
print "\t" . '<strong>Time:</strong> ' . $this->format_time( $this->start_time, TRUE, 'array', 'html' ) . '–' . $this->format_time( $this->end_time, TRUE, 'array', 'html' ) . '</p>' . "\n";
@@ -512,7 +512,7 @@
print "\t" . '<p style="text-align: left;"><strong>Institution:</strong> ' . $this->format_institution( $institution ) . '<br />' . "\n";
print "\t" . '<strong>Semester:</strong> ' . $this->format_semester( $semester ) . '<br />' . "\n";
print "\t" . '<strong>Course:</strong> ' . $this->format_course( $this->subject, $this->course, $institution, ' ' ) . ' (' . $this->section . ')<br />' . "\n";
- print "\t" . '<strong>Course Title:</strong> ' . htmlentities( $this->get_course_title( $institution, $this->subject, $this->course ) ) . '<br />' . "\n";
+ print "\t" . '<strong>Course Title:</strong> ' . htmlentities( $this->get_course_title( $institution, $this->subject, $this->course ), ENT_QUOTES, 'UTF-8' ) . '<br />' . "\n";
print "\t" . '<strong>Schedule Type:</strong> ' . $this->format_schedule_type( $this->schedule_type ) . '<br />' . "\n";
print "\t" . '<strong>Days:</strong> ' . $this->format_days( $this->schedule_days, 'array', 'html' ) . '<br />' . "\n";
print "\t" . '<strong>Time:</strong> ' . $this->format_time( $this->start_time, TRUE, 'array', 'html' ) . '–' . $this->format_time( $this->end_time, TRUE, 'array', 'html' ) . '</p>' . "\n";
Modified: trunk/SASHA/inc/lib/lib.sessions.php
===================================================================
--- trunk/SASHA/inc/lib/lib.sessions.php 2010-06-12 07:39:33 UTC (rev 92)
+++ trunk/SASHA/inc/lib/lib.sessions.php 2011-10-04 19:51:20 UTC (rev 93)
@@ -359,10 +359,10 @@
while( $row = $Database->fetch_assoc( $result ) )
{
// Hash of given password must match password hash in user table.
- if( sha1( $password ) == $row['password'] )
+ if( sha1( $password ) === $row['password'] )
{
// The current user's session must be updated to match their new user ID.
- if( $this->update_session( $this->get_session(), $row['user_id'], (bool) $secure ) )
+ if( $this->update_session( $this->get_session(), (int) $row['user_id'], (bool) $secure ) )
{
$this->logged_in = TRUE;
}
Modified: trunk/SASHA/inc/lib/lib.tests.php
===================================================================
--- trunk/SASHA/inc/lib/lib.tests.php 2010-06-12 07:39:33 UTC (rev 92)
+++ trunk/SASHA/inc/lib/lib.tests.php 2011-10-04 19:51:20 UTC (rev 93)
@@ -156,7 +156,7 @@
if( $end_date <= $start_date )
{
- print_message( 'bad', 'End date must come after start date.', 'Update failed.' );
+ print_message( 'bad', 'End date must come after start date.', 'Update failed.' );
}
elseif( $test_name )
{
Modified: trunk/SASHA/inc/lib/lib.user.php
===================================================================
--- trunk/SASHA/inc/lib/lib.user.php 2010-06-12 07:39:33 UTC (rev 92)
+++ trunk/SASHA/inc/lib/lib.user.php 2011-10-04 19:51:20 UTC (rev 93)
@@ -89,9 +89,9 @@
{
global $Database;
- $sql = "SELECT username
- FROM users
- WHERE username = '" . $Database->escape( $username ) . "'";
+ $sql = "SELECT u.username
+ FROM u.users
+ WHERE u.username = '" . $Database->escape( $username ) . "'";
$result = $Database->query( $sql );
$username = $Database->fetch_assoc( $result );
@@ -162,9 +162,9 @@
{
global $Database;
- $sql = "SELECT email_address
- FROM users
- WHERE email_address = '" . $Database->escape( $email_address ) . "'";
+ $sql = "SELECT u.email_address
+ FROM u.users
+ WHERE u.email_address = '" . $Database->escape( $email_address ) . "'";
$result = $Database->query( $sql );
$email_address = $Database->fetch_assoc( $result );
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <gph...@us...> - 2010-06-12 07:39:40
|
Revision: 92
http://sasha.svn.sourceforge.net/sasha/?rev=92&view=rev
Author: gphemsley
Date: 2010-06-12 07:39:33 +0000 (Sat, 12 Jun 2010)
Log Message:
-----------
Bump version number to 0.3.0-dev.
Modified Paths:
--------------
trunk/SASHA/config/config.default.php
Modified: trunk/SASHA/config/config.default.php
===================================================================
--- trunk/SASHA/config/config.default.php 2010-06-12 07:27:41 UTC (rev 91)
+++ trunk/SASHA/config/config.default.php 2010-06-12 07:39:33 UTC (rev 92)
@@ -50,6 +50,6 @@
* Version information.
*/
-define( 'SASHA_VERSION', '0.2.0-dev' );
+define( 'SASHA_VERSION', '0.3.0-dev' );
?>
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <gph...@us...> - 2010-06-12 07:27:47
|
Revision: 91
http://sasha.svn.sourceforge.net/sasha/?rev=91&view=rev
Author: gphemsley
Date: 2010-06-12 07:27:41 +0000 (Sat, 12 Jun 2010)
Log Message:
-----------
Tagging SASHA 0.2.0.
Added Paths:
-----------
tags/SASHA_0.2.0/
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <gph...@us...> - 2010-06-12 07:27:22
|
Revision: 90
http://sasha.svn.sourceforge.net/sasha/?rev=90&view=rev
Author: gphemsley
Date: 2010-06-12 07:27:12 +0000 (Sat, 12 Jun 2010)
Log Message:
-----------
Bump version number to 0.2.0 final.
Modified Paths:
--------------
branches/SASHA_0.2/SASHA/config/config.default.php
Modified: branches/SASHA_0.2/SASHA/config/config.default.php
===================================================================
--- branches/SASHA_0.2/SASHA/config/config.default.php 2010-06-12 07:24:23 UTC (rev 89)
+++ branches/SASHA_0.2/SASHA/config/config.default.php 2010-06-12 07:27:12 UTC (rev 90)
@@ -50,6 +50,6 @@
* Version information.
*/
-define( 'SASHA_VERSION', '0.2.0-dev' );
+define( 'SASHA_VERSION', '0.2.0' );
?>
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <gph...@us...> - 2010-06-12 07:24:30
|
Revision: 89
http://sasha.svn.sourceforge.net/sasha/?rev=89&view=rev
Author: gphemsley
Date: 2010-06-12 07:24:23 +0000 (Sat, 12 Jun 2010)
Log Message:
-----------
Branching SASHA 0.2.
Added Paths:
-----------
branches/SASHA_0.2/
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <gph...@us...> - 2010-03-28 18:53:27
|
Revision: 88
http://sasha.svn.sourceforge.net/sasha/?rev=88&view=rev
Author: gphemsley
Date: 2010-03-28 18:53:20 +0000 (Sun, 28 Mar 2010)
Log Message:
-----------
Allow multiple global messages.
Remove extra margins from welcome message.
Modified Paths:
--------------
trunk/SASHA/config/config.default.php
trunk/SASHA/index.php
trunk/SASHA/style/default/header.php
Modified: trunk/SASHA/config/config.default.php
===================================================================
--- trunk/SASHA/config/config.default.php 2010-02-10 22:27:14 UTC (rev 87)
+++ trunk/SASHA/config/config.default.php 2010-03-28 18:53:20 UTC (rev 88)
@@ -38,9 +38,13 @@
/**
* Global message, displayed on every page.
*/
-$config['message']['type'] = '';
-$config['message']['title'] = '';
-$config['message']['message'] = '';
+$config['message'] = array(
+ array(
+ 'type' => '',
+ 'title' => '',
+ 'message' => ''
+ )
+);
/**
* Version information.
Modified: trunk/SASHA/index.php
===================================================================
--- trunk/SASHA/index.php 2010-02-10 22:27:14 UTC (rev 87)
+++ trunk/SASHA/index.php 2010-03-28 18:53:20 UTC (rev 88)
@@ -46,7 +46,7 @@
?>
-<p style="text-align: center;">Welcome<?php print ( ( !empty( $User->user_info['preferred_name'] ) ) ? ', <strong>' . $User->user_info['preferred_name'] . '</strong>' : ' to SASHA' ); ?>!</p>
+<p style="text-align: center; margin: 0em auto;">Welcome<?php print ( ( !empty( $User->user_info['preferred_name'] ) ) ? ', <strong>' . $User->user_info['preferred_name'] . '</strong>' : ' to SASHA' ); ?>!</p>
<div id="left-column">
<?php
Modified: trunk/SASHA/style/default/header.php
===================================================================
--- trunk/SASHA/style/default/header.php 2010-02-10 22:27:14 UTC (rev 87)
+++ trunk/SASHA/style/default/header.php 2010-03-28 18:53:20 UTC (rev 88)
@@ -108,10 +108,18 @@
<?php
-if( !empty( $config['message']['message'] ) )
+if( exists( $config['message'][0]['message'] ) )
{
print '<div id="global-msg">' . "\n";
- print_message( $config['message']['type'], $config['message']['message'], $config['message']['title'] );
+
+ foreach( $config['message'] as $message )
+ {
+ if( !empty( $message['message'] ) )
+ {
+ print_message( $message['type'], $message['message'], $message['title'] );
+ }
+ }
+
print '</div>' . "\n\n";
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <gph...@us...> - 2010-02-10 22:27:20
|
Revision: 87
http://sasha.svn.sourceforge.net/sasha/?rev=87&view=rev
Author: gphemsley
Date: 2010-02-10 22:27:14 +0000 (Wed, 10 Feb 2010)
Log Message:
-----------
Improve sorting for assignments and tests.
Modified Paths:
--------------
trunk/SASHA/inc/lib/lib.assignments.php
trunk/SASHA/inc/lib/lib.home.php
trunk/SASHA/inc/lib/lib.tests.php
Modified: trunk/SASHA/inc/lib/lib.assignments.php
===================================================================
--- trunk/SASHA/inc/lib/lib.assignments.php 2010-02-06 04:51:45 UTC (rev 86)
+++ trunk/SASHA/inc/lib/lib.assignments.php 2010-02-10 22:27:14 UTC (rev 87)
@@ -331,7 +331,7 @@
AND a.schedule_id = s.schedule_id
AND s.semester = '$semester'
$institution_where
- ORDER BY a.due_date DESC, a.assigned_date DESC, s.start_time ASC, s.end_time ASC, a.assignment_id ASC";
+ ORDER BY a.due_date DESC, a.assigned_date DESC, s.start_time ASC, s.end_time ASC, a.assignment_name ASC, a.assignment_id ASC";
$result = $Database->query( $sql );
Modified: trunk/SASHA/inc/lib/lib.home.php
===================================================================
--- trunk/SASHA/inc/lib/lib.home.php 2010-02-06 04:51:45 UTC (rev 86)
+++ trunk/SASHA/inc/lib/lib.home.php 2010-02-10 22:27:14 UTC (rev 87)
@@ -63,7 +63,7 @@
AND a.due_date < $end_date
$where_upper_status
$where_lower_status
- ORDER BY a.due_date ASC, s.start_time ASC, s.end_time ASC, a.assigned_date ASC, a.assignment_id ASC";
+ ORDER BY a.due_date ASC, s.start_time ASC, s.end_time ASC, a.assigned_date ASC, a.assignment_name ASC, a.assignment_id ASC";
$result = $Database->query( $sql );
@@ -124,7 +124,7 @@
t.possible_score = 0
OR t.possible_score IS NULL
)
- ORDER BY t.start_date ASC, t.end_date ASC, s.start_time ASC, s.end_time ASC, t.test_name ASC";
+ ORDER BY t.start_date ASC, t.end_date ASC, s.start_time ASC, s.end_time ASC, t.test_name ASC, t.test_id ASC";
$result = $Database->query( $sql );
Modified: trunk/SASHA/inc/lib/lib.tests.php
===================================================================
--- trunk/SASHA/inc/lib/lib.tests.php 2010-02-06 04:51:45 UTC (rev 86)
+++ trunk/SASHA/inc/lib/lib.tests.php 2010-02-10 22:27:14 UTC (rev 87)
@@ -381,7 +381,7 @@
AND s.user_id = {$User->user_info['id']}
AND s.semester = '$semester'
$institution_where
- ORDER BY t.start_date DESC, t.end_date ASC, s.start_time ASC, s.end_time ASC, t.test_name ASC";
+ ORDER BY t.start_date DESC, t.end_date ASC, s.start_time ASC, s.end_time ASC, t.test_name ASC, t.test_id ASC";
$result = $Database->query( $sql );
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <gph...@us...> - 2010-02-06 04:51:51
|
Revision: 86
http://sasha.svn.sourceforge.net/sasha/?rev=86&view=rev
Author: gphemsley
Date: 2010-02-06 04:51:45 +0000 (Sat, 06 Feb 2010)
Log Message:
-----------
Revert "fix" from r80 that actually broke days when editing schedule items.
Add user ID to 'assignments' table.
Update SQL schema to synchronize format of 'user_id' fields.
Fix minor style bug that occurred with multiple adjacent message boxes.
Modified Paths:
--------------
trunk/SASHA/inc/lib/lib.assignments.php
trunk/SASHA/inc/lib/lib.schedule.php
trunk/SASHA/install/schema/mysql.sql
trunk/SASHA/style/default/screen.css
Modified: trunk/SASHA/inc/lib/lib.assignments.php
===================================================================
--- trunk/SASHA/inc/lib/lib.assignments.php 2010-01-26 18:16:09 UTC (rev 85)
+++ trunk/SASHA/inc/lib/lib.assignments.php 2010-02-06 04:51:45 UTC (rev 86)
@@ -53,8 +53,8 @@
}
else
{
- $sql = "INSERT INTO assignments ( schedule_id, assignment_name, description, assigned_date, due_date )
- VALUES ( $schedule_id, '" . $Database->escape( $assignment_name ) . "', '" . $Database->escape( $description ) . "', $assigned_date, $due_date )";
+ $sql = "INSERT INTO assignments ( user_id, schedule_id, assignment_name, description, assigned_date, due_date )
+ VALUES ( {$User->user_info['id']}, $schedule_id, '" . $Database->escape( $assignment_name ) . "', '" . $Database->escape( $description ) . "', $assigned_date, $due_date )";
$result = $Database->query( $sql );
Modified: trunk/SASHA/inc/lib/lib.schedule.php
===================================================================
--- trunk/SASHA/inc/lib/lib.schedule.php 2010-01-26 18:16:09 UTC (rev 85)
+++ trunk/SASHA/inc/lib/lib.schedule.php 2010-02-06 04:51:45 UTC (rev 86)
@@ -483,7 +483,7 @@
{
case 3:
$sql = "UPDATE schedules
- SET institution = '$institution', semester = '$semester', subject = '" . $Database->escape( $this->subject ) . "', course = {$this->course}, section = '" . $Database->escape( $this->section ) . "', section_title = '" . $Database->escape( $this->section_title ) . "', schedule_type = {$this->schedule_type}, days = b'" . $this->format_days( $this->schedule_days, NULL, 'binary' ) . "', start_time = {$this->start_time}, end_time = {$this->end_time}, instructors = '" . $this->prepare_instructors( $this->instructors ) . "', parent_schedule_id = {$this->parent_schedule_id}
+ SET institution = '$institution', semester = '$semester', subject = '" . $Database->escape( $this->subject ) . "', course = {$this->course}, section = '" . $Database->escape( $this->section ) . "', section_title = '" . $Database->escape( $this->section_title ) . "', schedule_type = {$this->schedule_type}, days = b'" . $this->format_days( $this->schedule_days, 'decimal', 'binary' ) . "', start_time = {$this->start_time}, end_time = {$this->end_time}, instructors = '" . $this->prepare_instructors( $this->instructors ) . "', parent_schedule_id = {$this->parent_schedule_id}
WHERE schedule_id = $schedule_id";
$sql = str_replace( array( "= '',", "= '' ", '= ,', '= ', "= \n" ), array( '= NULL,', '= NULL ', '= NULL,', '= NULL ', "= NULL\n" ), $sql );
@@ -491,7 +491,7 @@
if( $result )
{
- print_message( 'good', 'Schedule for ' . $this->format_course( $this->subject, $this->course, $institution, ' ' ) . ' ' . $this->section . ' at ' . $this->format_institution( $institution ) . ' (' . $this->format_instructors( $this->instructors, '; ' ) . ' — ' . $this->format_schedule_type( $this->schedule_type ) . ': ' . $this->format_days( $this->schedule_days, NULL, 'html' ) . ') updated successfully.', 'Update successful.' );
+ print_message( 'good', 'Schedule for ' . $this->format_course( $this->subject, $this->course, $institution, ' ' ) . ' ' . $this->section . ' at ' . $this->format_institution( $institution ) . ' (' . $this->format_instructors( $this->instructors, '; ' ) . ' — ' . $this->format_schedule_type( $this->schedule_type ) . ': ' . $this->format_days( $this->schedule_days, 'decimal', 'html' ) . ') updated successfully.', 'Update successful.' );
$this->list_schedule();
Modified: trunk/SASHA/install/schema/mysql.sql
===================================================================
--- trunk/SASHA/install/schema/mysql.sql 2010-01-26 18:16:09 UTC (rev 85)
+++ trunk/SASHA/install/schema/mysql.sql 2010-02-06 04:51:45 UTC (rev 86)
@@ -14,6 +14,7 @@
CREATE TABLE assignments (
assignment_id int(10) unsigned NOT NULL auto_increment,
+ user_id bigint(10) NOT NULL,
schedule_id int(10) unsigned NOT NULL,
assignment_name varchar(255) NOT NULL,
description text NOT NULL,
@@ -21,7 +22,7 @@
due_date int(10) unsigned NOT NULL,
`status` int(4) NOT NULL default '0',
PRIMARY KEY (assignment_id),
- KEY schedule_id (schedule_id),
+ KEY user_id (user_id,schedule_id),
KEY assigned_date (assigned_date),
KEY due_date (due_date),
KEY `status` (`status`)
@@ -150,7 +151,7 @@
CREATE TABLE tests (
test_id int(10) unsigned NOT NULL auto_increment,
- user_id int(10) unsigned NOT NULL,
+ user_id bigint(10) NOT NULL,
schedule_id int(10) unsigned NOT NULL,
test_type int(3) NOT NULL,
test_name varchar(255) NOT NULL,
Modified: trunk/SASHA/style/default/screen.css
===================================================================
--- trunk/SASHA/style/default/screen.css 2010-01-26 18:16:09 UTC (rev 85)
+++ trunk/SASHA/style/default/screen.css 2010-02-06 04:51:45 UTC (rev 86)
@@ -284,7 +284,7 @@
margin-top: 0em;
}
-#global-msg + #page-content > * > *:first-child {
+#global-msg + #page-content > * > #sub-nav {
margin-top: 2em;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <gph...@us...> - 2010-01-26 18:16:23
|
Revision: 85
http://sasha.svn.sourceforge.net/sasha/?rev=85&view=rev
Author: gphemsley
Date: 2010-01-26 18:16:09 +0000 (Tue, 26 Jan 2010)
Log Message:
-----------
Add breadcrumbs to all pages.
Fix title of Home page.
Modified Paths:
--------------
trunk/SASHA/assignments.php
trunk/SASHA/index.php
trunk/SASHA/login.php
trunk/SASHA/register.php
trunk/SASHA/schedule.php
trunk/SASHA/style/default/header.php
trunk/SASHA/style/default/screen.css
trunk/SASHA/tests.php
Modified: trunk/SASHA/assignments.php
===================================================================
--- trunk/SASHA/assignments.php 2010-01-21 01:26:56 UTC (rev 84)
+++ trunk/SASHA/assignments.php 2010-01-26 18:16:09 UTC (rev 85)
@@ -20,7 +20,7 @@
/**
* Specify the title of the page and the tab currently highlighted.
*/
-$page_title = 'Assignments';
+$page_title = array( 'Assignments' );
$tab = 'assignments';
require( ROOT . 'inc/inc.main.php' );
@@ -33,16 +33,16 @@
switch( $mode )
{
case 'add':
- $page_title .= ' :: Add Assignment';
+ $page_title[] = 'Add Assignment';
break;
case 'edit':
- $page_title .= ' :: Edit Assignment';
+ $page_title[] = 'Edit Assignment';
break;
case 'view':
default:
- $page_title .= ' :: View Assignments';
+ $page_title[] = 'View Assignments';
break;
}
Modified: trunk/SASHA/index.php
===================================================================
--- trunk/SASHA/index.php 2010-01-21 01:26:56 UTC (rev 84)
+++ trunk/SASHA/index.php 2010-01-26 18:16:09 UTC (rev 85)
@@ -20,7 +20,7 @@
/**
* Specify the title of the page and the tab currently highlighted.
*/
-$page_title = 'Index';
+$page_title = array( 'Home' );
$tab = 'home';
require( ROOT . 'inc/inc.main.php' );
Modified: trunk/SASHA/login.php
===================================================================
--- trunk/SASHA/login.php 2010-01-21 01:26:56 UTC (rev 84)
+++ trunk/SASHA/login.php 2010-01-26 18:16:09 UTC (rev 85)
@@ -21,7 +21,7 @@
/**
* Specify the title of the page and the tab currently highlighted.
*/
-$page_title = 'Login';
+$page_title = array( 'Login' );
$tab = 'login';
require( ROOT . 'inc/inc.main.php' );
Modified: trunk/SASHA/register.php
===================================================================
--- trunk/SASHA/register.php 2010-01-21 01:26:56 UTC (rev 84)
+++ trunk/SASHA/register.php 2010-01-26 18:16:09 UTC (rev 85)
@@ -21,7 +21,7 @@
/**
* Specify the title of the page and the tab currently highlighted.
*/
-$page_title = 'Register';
+$page_title = array( 'Register' );
$tab = 'register';
require( ROOT . 'inc/inc.main.php' );
Modified: trunk/SASHA/schedule.php
===================================================================
--- trunk/SASHA/schedule.php 2010-01-21 01:26:56 UTC (rev 84)
+++ trunk/SASHA/schedule.php 2010-01-26 18:16:09 UTC (rev 85)
@@ -20,7 +20,7 @@
/**
* Specify the title of the page and the tab currently highlighted.
*/
-$page_title = 'Schedule';
+$page_title = array( 'Schedule' );
$tab = 'schedule';
require( ROOT . 'inc/inc.main.php' );
@@ -33,16 +33,16 @@
switch( $mode )
{
case 'add':
- $page_title .= ' :: Add Schedule';
+ $page_title[] = 'Add Schedule';
break;
case 'edit':
- $page_title .= ' :: Edit Schedule';
+ $page_title[] = 'Edit Schedule';
break;
case 'view':
default:
- $page_title .= ' :: View Schedules';
+ $page_title[] = 'View Schedules';
break;
}
Modified: trunk/SASHA/style/default/header.php
===================================================================
--- trunk/SASHA/style/default/header.php 2010-01-21 01:26:56 UTC (rev 84)
+++ trunk/SASHA/style/default/header.php 2010-01-26 18:16:09 UTC (rev 85)
@@ -55,7 +55,7 @@
<html lang="en-US">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
- <title>SASHA :: <?php print $page_title; ?></title>
+ <title>SASHA :: <?php print implode( ' :: ', $page_title ); ?></title>
<link rel="stylesheet" type="text/css" href="<?php print ROOT; ?>style/default/screen.css" media="screen" />
@@ -102,6 +102,10 @@
</ul>
</div>
+<div id="breadcrumbs">
+ <p><?php print implode( ' → ', $page_title ); ?></p>
+</div>
+
<?php
if( !empty( $config['message']['message'] ) )
Modified: trunk/SASHA/style/default/screen.css
===================================================================
--- trunk/SASHA/style/default/screen.css 2010-01-21 01:26:56 UTC (rev 84)
+++ trunk/SASHA/style/default/screen.css 2010-01-26 18:16:09 UTC (rev 85)
@@ -269,11 +269,25 @@
color: white;
}
+#breadcrumbs {
+ width: 96%;
+ margin: 0em auto;
+ font-size: smaller;
+}
+
#global-msg, #page-content {
width: 96%;
margin: 0% auto;
}
+#global-msg p.message {
+ margin-top: 0em;
+}
+
+#global-msg + #page-content > * > *:first-child {
+ margin-top: 2em;
+}
+
#schedule, #assignments, #tests {
margin: 0% auto;
}
@@ -282,13 +296,9 @@
width: 96%;
text-align: center;
margin: auto;
- padding: 0.5em 0em 1em;
+ padding: 0em 0em 1em;
}
-#global-msg + #page-content > #sub-nav {
- margin-top: -1em;
-}
-
#sub-nav ul {
margin: 1em auto;
padding: 0em;
Modified: trunk/SASHA/tests.php
===================================================================
--- trunk/SASHA/tests.php 2010-01-21 01:26:56 UTC (rev 84)
+++ trunk/SASHA/tests.php 2010-01-26 18:16:09 UTC (rev 85)
@@ -20,7 +20,7 @@
/**
* Specify the title of the page and the tab currently highlighted.
*/
-$page_title = 'Tests';
+$page_title = array( 'Tests' );
$tab = 'tests';
require( ROOT . 'inc/inc.main.php' );
@@ -33,16 +33,16 @@
switch( $mode )
{
case 'add':
- $page_title .= ' :: Add Test';
+ $page_title[] = 'Add Test';
break;
case 'edit':
- $page_title .= ' :: Edit Test';
+ $page_title[] = 'Edit Test';
break;
case 'view':
default:
- $page_title .= ' :: View Tests';
+ $page_title[] = 'View Tests';
break;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <gph...@us...> - 2010-01-21 01:27:03
|
Revision: 84
http://sasha.svn.sourceforge.net/sasha/?rev=84&view=rev
Author: gphemsley
Date: 2010-01-21 01:26:56 +0000 (Thu, 21 Jan 2010)
Log Message:
-----------
Fix a slight security bug that caused the course selector to show every user's schedule items.
Only show registration errors in the proper contexts.
Properly sort courses on schedule list that aren't in the 'courses' table.
Show a message when leaving fields blank on the add schedule item page, instead of just failing silently. (Remember input, too.)
Prevent empty session hashes from being stored in the database.
Minor styling changes to improve usability and font selection on Windows.
Fix syntax error in SQL schema.
Modified Paths:
--------------
trunk/SASHA/inc/lib/lib.forms.php
trunk/SASHA/inc/lib/lib.schedule.php
trunk/SASHA/inc/lib/lib.sessions.php
trunk/SASHA/inc/lib/lib.user.php
trunk/SASHA/install/schema/mysql.sql
trunk/SASHA/style/default/screen.css
Modified: trunk/SASHA/inc/lib/lib.forms.php
===================================================================
--- trunk/SASHA/inc/lib/lib.forms.php 2010-01-20 05:26:26 UTC (rev 83)
+++ trunk/SASHA/inc/lib/lib.forms.php 2010-01-21 01:26:56 UTC (rev 84)
@@ -390,7 +390,8 @@
*/
final private static function _create_instructor_selector( $selector_id, $current_instructor_ids = FALSE, $institution = FALSE )
{
- global $Database, $SASHA;
+ global $SASHA;
+ global $Database;
if( !is_array( $current_instructor_ids ) )
{
@@ -522,7 +523,8 @@
*/
final private static function _create_institution_selector( $selector_id, $institution = FALSE )
{
- global $Database, $SASHA;
+ global $SASHA;
+ global $Database;
$institution = ( $institution ) ? (string) $institution : $SASHA->institution;
@@ -618,7 +620,8 @@
*/
final private static function _create_course_selector( $selector_id, $current_schedule_id = FALSE, $semester = FALSE, $institution = FALSE )
{
- global $Database, $SASHA;
+ global $SASHA;
+ global $Database, $User;
$semester = ( $semester ) ? (string) $semester : $SASHA->semester;
@@ -628,7 +631,8 @@
FROM schedules s
LEFT JOIN ( institutions i )
ON ( s.institution = i.institution )
- WHERE s.semester = '$semester'
+ WHERE s.user_id = {$User->user_info['id']}
+ AND s.semester = '$semester'
$institution_where
ORDER BY i.name ASC, s.subject ASC, s.course ASC, s.section ASC, s.instructors ASC, s.days DESC";
Modified: trunk/SASHA/inc/lib/lib.schedule.php
===================================================================
--- trunk/SASHA/inc/lib/lib.schedule.php 2010-01-20 05:26:26 UTC (rev 83)
+++ trunk/SASHA/inc/lib/lib.schedule.php 2010-01-21 01:26:56 UTC (rev 84)
@@ -82,6 +82,10 @@
{
print_message( 'good', 'Schedule for ' . $this->format_course( $this->subject, $this->course, $institution, ' ' ) . ' ' . $this->section . ' at ' . $this->format_institution( $institution ) . ' (' . $this->format_instructors( $this->instructors, '; ' ) . ' — ' . $this->format_schedule_type( $this->schedule_type ) . ': ' . $this->format_days( $this->schedule_days, 'array', 'html' ) . ') added successfully.', 'Addition successful.' );
}
+ else
+ {
+ print_message( 'bad', 'All fields in Step 1 are required. Check to see if you left any blank.', 'Addition failed.' );
+ }
}
elseif( $next )
{
@@ -118,7 +122,8 @@
'label' => 'Section Title',
'data' => array(
'size' => 75,
- 'maxlength' => 255
+ 'maxlength' => 255,
+ 'value' => $this->section_title
)
),
array(
@@ -316,7 +321,8 @@
'label' => 'Subject',
'data' => array(
'size' => 5,
- 'maxlength' => 5
+ 'maxlength' => 5,
+ 'value' => $this->subject
)
),
array(
@@ -325,7 +331,9 @@
'label' => 'Course',
'data' => array(
'size' => 4,
- 'maxlength' => 4
+ 'maxlength' => 4,
+ 'value' => $this->course
+
)
),
array(
@@ -334,7 +342,9 @@
'label' => 'Section',
'data' => array(
'size' => 5,
- 'maxlength' => 5
+ 'maxlength' => 5,
+ 'value' => $this->section
+
)
),
array(
@@ -351,6 +361,62 @@
),
array(
'type' => 'hidden',
+ 'name' => 'parent_schedule_id',
+ 'data' => array(
+ 'value' => $this->parent_schedule_id
+ )
+ ),
+ array(
+ 'type' => 'hidden',
+ 'name' => 'instructors[0]',
+ 'data' => array(
+ 'value' => $this->instructors[0]
+ )
+ ),
+ array(
+ 'type' => 'hidden',
+ 'name' => 'instructors[1]',
+ 'data' => array(
+ 'value' => $this->instructors[1]
+ )
+ ),
+ array(
+ 'type' => 'hidden',
+ 'name' => 'instructors[2]',
+ 'data' => array(
+ 'value' => $this->instructors[2]
+ )
+ ),
+ array(
+ 'type' => 'hidden',
+ 'name' => 'instructors[3]',
+ 'data' => array(
+ 'value' => $this->instructors[3]
+ )
+ ),
+ array(
+ 'type' => 'hidden',
+ 'name' => 'instructors[4]',
+ 'data' => array(
+ 'value' => $this->instructors[4]
+ )
+ ),
+ array(
+ 'type' => 'hidden',
+ 'name' => 'instructors[5]',
+ 'data' => array(
+ 'value' => $this->instructors[5]
+ )
+ ),
+ array(
+ 'type' => 'hidden',
+ 'name' => 'section_title',
+ 'data' => array(
+ 'value' => $this->section_title
+ )
+ ),
+ array(
+ 'type' => 'hidden',
'name' => 'step',
'data' => array(
'value' => 1
@@ -386,6 +452,14 @@
$semester = ( exists( $_POST['semester'] ) ) ? ( ( is_array( $_POST['semester'] ) ) ? $_POST['semester']['year'] . $_POST['semester']['season'] : $_POST['semester'] ) : $semester;
$this_step = ( exists( $_POST['step'] ) ) ? (int) $_POST['step'] : 1;
+
+ if( ( $this_step > 1 ) && ( empty( $this->subject ) || empty( $this->course ) || empty( $this->section ) ) )
+ {
+ print_message( 'bad', 'All fields in Step 1 are required. Do not leave any blank.', 'Addition failed.' );
+
+ $this_step = 1;
+ }
+
$prev_step = ( $this_step ) ? (int) ( $this_step - 1 ) : 0;
$next_step = ( $this_step ) ? (int) ( $this_step + 1 ) : 0;
@@ -423,6 +497,10 @@
return;
}
+ else
+ {
+ print_message( 'bad', 'Check all fields and try again.', 'Addition failed.' );
+ }
$form_data = array();
break;
@@ -749,15 +827,17 @@
$sql = "SELECT s.*, c.course_title
FROM schedules s
- LEFT JOIN ( institutions i, courses c )
- ON ( i.institution = c.institution
+ LEFT JOIN ( institutions i1 )
+ ON ( s.institution = i1.institution )
+ LEFT JOIN ( institutions i2, courses c )
+ ON ( i2.institution = c.institution
AND s.institution = c.institution
AND s.subject = c.subject
AND s.course = c.course )
WHERE s.user_id = {$User->user_info['id']}
AND s.semester = '$semester'
$institution_where
- ORDER BY s.semester ASC, i.name ASC, s.days DESC, s.start_time ASC, s.end_time ASC, s.subject ASC, s.course ASC, s.section ASC";
+ ORDER BY s.semester ASC, i1.name ASC, s.days DESC, s.start_time ASC, s.end_time ASC, s.subject ASC, s.course ASC, s.section ASC";
$result = $Database->query( $sql );
Modified: trunk/SASHA/inc/lib/lib.sessions.php
===================================================================
--- trunk/SASHA/inc/lib/lib.sessions.php 2010-01-20 05:26:26 UTC (rev 83)
+++ trunk/SASHA/inc/lib/lib.sessions.php 2010-01-21 01:26:56 UTC (rev 84)
@@ -129,6 +129,20 @@
}
$session_hash = $this->generate_hash();
+
+ // Check to make sure we actually got a good hash.
+ if( empty( $session_hash ) || !$this->validate_hash( $session_hash ) )
+ {
+ // If we don't have a good hash, try again.
+ $session_hash = $this->generate_hash();
+
+ // If we still don't have a good hash, don't attempt to create the session.
+ if( empty( $session_hash ) || !$this->validate_hash( $session_hash ) )
+ {
+ return FALSE;
+ }
+ }
+
$time_now = time();
$time_then = ( $user_id <= USER_ANONYMOUS ) ? $time_now + DAT_WEEK : $time_now + DAT_MONTH;
Modified: trunk/SASHA/inc/lib/lib.user.php
===================================================================
--- trunk/SASHA/inc/lib/lib.user.php 2010-01-20 05:26:26 UTC (rev 83)
+++ trunk/SASHA/inc/lib/lib.user.php 2010-01-21 01:26:56 UTC (rev 84)
@@ -203,7 +203,7 @@
$error = FALSE;
// Make sure username is valid.
- if( !$this->_validate_username( $username ) )
+ if( empty( $username ) || !$this->_validate_username( $username ) )
{
print_message( 'bad', 'Please enter a valid username. Usernames may only contain letters, numbers, hyphens, and underscores.', 'Invalid username.' );
@@ -211,7 +211,7 @@
}
// Make sure username is available.
- if( !$this->_check_username_availability( $username ) )
+ if( !empty( $username ) && !$this->_check_username_availability( $username ) )
{
print_message( 'bad', 'Sorry, that username is taken. Please choose a different username.', 'Username taken.' );
@@ -227,7 +227,7 @@
}
// Make sure password is strong enough.
- if( !$this->_check_password_strength( $password ) )
+ if( empty( $password ) || !$this->_check_password_strength( $password ) )
{
print_message( 'bad', 'Please enter a stronger password, with at least 6 characters. It is recommended that you use uppercase and lowercase letters, numbers, and symbols for the best security.', 'Weak password.' );
@@ -235,7 +235,7 @@
}
// Make sure e-mail address is valid.
- if( !$this->_validate_email_address( $email_address ) )
+ if( empty( $email_address ) || !$this->_validate_email_address( $email_address ) )
{
print_message( 'bad', 'Please enter a valid e-mail address.', 'Invalid e-mail address.' );
@@ -243,7 +243,7 @@
}
// Make sure e-mail address is available.
- if( !$this->_check_email_address_availability( $email_address ) )
+ if( !empty( $email_address ) && !$this->_check_email_address_availability( $email_address ) )
{
print_message( 'bad', 'Sorry, that e-mail address is already in use. Please use a different e-mail address.', 'E-mail address in use.' );
@@ -251,7 +251,7 @@
}
// Make sure institution is valid.
- if( !$SASHA->validate_institution( $default_institution ) )
+ if( empty( $default_institution ) || !$SASHA->validate_institution( $default_institution ) )
{
print_message( 'bad', 'Please select a valid institution.', 'Invalid institution.' );
Modified: trunk/SASHA/install/schema/mysql.sql
===================================================================
--- trunk/SASHA/install/schema/mysql.sql 2010-01-20 05:26:26 UTC (rev 83)
+++ trunk/SASHA/install/schema/mysql.sql 2010-01-21 01:26:56 UTC (rev 84)
@@ -38,7 +38,7 @@
`subject` varchar(5) NOT NULL,
course smallint(4) unsigned zerofill NOT NULL,
course_title varchar(255) NOT NULL,
- PRIMARY KEY (institution,`subject`,course),
+ PRIMARY KEY (institution,`subject`,course)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
# ############################
Modified: trunk/SASHA/style/default/screen.css
===================================================================
--- trunk/SASHA/style/default/screen.css 2010-01-20 05:26:26 UTC (rev 83)
+++ trunk/SASHA/style/default/screen.css 2010-01-21 01:26:56 UTC (rev 84)
@@ -15,7 +15,7 @@
body {
background-color: #FFEEFF;
color: black;
- font-family: "Lucida Grande", "Lucida Sans Unicode", "Lucida Sans", "Trebuchet MS", Verdana, Helvetica, Tahoma, "Arial Unicode MS", Arial, sans-serif;
+ font-family: "Lucida Grande", "Trebuchet MS", "Lucida Sans Unicode", "Lucida Sans", Verdana, Helvetica, Tahoma, "Arial Unicode MS", Arial, sans-serif;
font-size: 10pt; /* 12pt; */
}
@@ -59,14 +59,14 @@
h2 {
background-color: inherit;
- color: #660066;
+ color: #770077;
font-size: 133.333%; /* 16pt; */
- text-decoration: underline;
+/* text-decoration: underline;*/
}
h3 {
background-color: inherit;
- color: #990099;
+ color: #AA00AA;
font-size: 116.667%; /* 14pt;*/
}
@@ -101,6 +101,10 @@
text-transform: capitalize;
}
+p.message a {
+ font-weight: bolder;
+}
+
p.message.good {
background-color: #C0FFCB; /* green counterpart of pink */
color: black;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <gph...@us...> - 2010-01-20 05:26:36
|
Revision: 83
http://sasha.svn.sourceforge.net/sasha/?rev=83&view=rev
Author: gphemsley
Date: 2010-01-20 05:26:26 +0000 (Wed, 20 Jan 2010)
Log Message:
-----------
Escape text used in SQL queries using Database::escape(), rather than addslashes().
Fix another BIT-related bug in Forms::_create_course_selector().
Modified Paths:
--------------
trunk/SASHA/inc/lib/lib.assignments.php
trunk/SASHA/inc/lib/lib.forms.php
trunk/SASHA/inc/lib/lib.tests.php
Modified: trunk/SASHA/inc/lib/lib.assignments.php
===================================================================
--- trunk/SASHA/inc/lib/lib.assignments.php 2010-01-20 03:06:18 UTC (rev 82)
+++ trunk/SASHA/inc/lib/lib.assignments.php 2010-01-20 05:26:26 UTC (rev 83)
@@ -34,8 +34,8 @@
if( $submit )
{
$schedule_id = (int) $_POST['schedule_id'];
- $assignment_name = ( exists( $_POST['assignment_name'] ) ) ? addslashes( (string) $_POST['assignment_name'] ) : FALSE;
- $description = ( exists( $_POST['description'] ) ) ? addslashes( (string) $_POST['description'] ) : NULL;
+ $assignment_name = ( exists( $_POST['assignment_name'] ) ) ? $_POST['assignment_name'] : FALSE;
+ $description = ( exists( $_POST['description'] ) ) ? $_POST['description'] : NULL;
$assigned_date = mktime( 0, 0, 0, (int) $_POST['assigned_date']['month'], (int) $_POST['assigned_date']['day'], (int) $_POST['assigned_date']['year'] );
$due_date = mktime( 0, 0, 0, (int) $_POST['due_date']['month'], (int) $_POST['due_date']['day'], (int) $_POST['due_date']['year'] );
@@ -54,13 +54,13 @@
else
{
$sql = "INSERT INTO assignments ( schedule_id, assignment_name, description, assigned_date, due_date )
- VALUES ( $schedule_id, '$assignment_name', '$description', $assigned_date, $due_date )";
+ VALUES ( $schedule_id, '" . $Database->escape( $assignment_name ) . "', '" . $Database->escape( $description ) . "', $assigned_date, $due_date )";
$result = $Database->query( $sql );
if( $result )
{
- print_message( 'good', 'Assignment "' . htmlentities( stripslashes( $assignment_name ), ENT_QUOTES, 'UTF-8' ) . '" (due ' . date( 'F j, Y', $due_date ) . ') added successfully.', 'Addition succeeded.' );
+ print_message( 'good', 'Assignment "' . htmlentities( $assignment_name, ENT_QUOTES, 'UTF-8' ) . '" (due ' . date( 'F j, Y', $due_date ) . ') added successfully.', 'Addition succeeded.' );
}
}
}
@@ -136,8 +136,8 @@
if( $submit )
{
$schedule_id = (int) $_POST['schedule_id'];
- $assignment_name = ( exists( $_POST['assignment_name'] ) ) ? addslashes( (string) $_POST['assignment_name'] ) : FALSE;
- $description = ( exists( $_POST['description'] ) ) ? addslashes( (string) $_POST['description'] ) : NULL;
+ $assignment_name = ( exists( $_POST['assignment_name'] ) ) ? $_POST['assignment_name'] : FALSE;
+ $description = ( exists( $_POST['description'] ) ) ? $_POST['description'] : NULL;
$assigned_date = mktime( 0, 0, 0, (int) $_POST['assigned_date']['month'], (int) $_POST['assigned_date']['day'], (int) $_POST['assigned_date']['year'] );
$due_date = mktime( 0, 0, 0, (int) $_POST['due_date']['month'], (int) $_POST['due_date']['day'], (int) $_POST['due_date']['year'] );
$status = (int) $_POST['status'];
@@ -157,14 +157,14 @@
else
{
$sql = "UPDATE assignments
- SET schedule_id = $schedule_id, assignment_name = '$assignment_name', description = '$description', assigned_date = $assigned_date, due_date = $due_date, status = $status
+ SET schedule_id = $schedule_id, assignment_name = '" . $Database->escape( $assignment_name ) . "', description = '" . $Database->escape( $description ) . "', assigned_date = $assigned_date, due_date = $due_date, status = $status
WHERE assignment_id = $assignment_id";
$result = $Database->query( $sql );
if( $result )
{
- print_message( 'good', 'Assignment "' . htmlentities( stripslashes( $assignment_name ), ENT_QUOTES, 'UTF-8' ) . '" (due ' . date( 'F j, Y', $due_date ) . ') updated successfully.', 'Update succeeded.' );
+ print_message( 'good', 'Assignment "' . htmlentities( $assignment_name, ENT_QUOTES, 'UTF-8' ) . '" (due ' . date( 'F j, Y', $due_date ) . ') updated successfully.', 'Update succeeded.' );
$this->list_assignments();
Modified: trunk/SASHA/inc/lib/lib.forms.php
===================================================================
--- trunk/SASHA/inc/lib/lib.forms.php 2010-01-20 03:06:18 UTC (rev 82)
+++ trunk/SASHA/inc/lib/lib.forms.php 2010-01-20 05:26:26 UTC (rev 83)
@@ -641,7 +641,7 @@
{
$selected = ( $row['schedule_id'] == $current_schedule_id ) ? ' selected="selected"' : '';
- print "\t\t\t\t" . '<option value="' . $row['schedule_id'] . '"' . $selected . '>' . $SASHA->format_institution( $row['institution'] ) . ' — ' . $SASHA->format_course( $row['subject'], $row['course'], $row['institution'] ) . ' (' . $row['section'] . ') — ' . $SASHA->format_instructors( $row['instructors'], '; ' ) . ' (' . $SASHA->format_schedule_type( $row['schedule_type'] ) . ': ' . $SASHA->format_days( $row['days'], 'binary', 'html' ) . ')</option>' . "\n";
+ print "\t\t\t\t" . '<option value="' . $row['schedule_id'] . '"' . $selected . '>' . $SASHA->format_institution( $row['institution'] ) . ' — ' . $SASHA->format_course( $row['subject'], $row['course'], $row['institution'] ) . ' (' . $row['section'] . ') — ' . $SASHA->format_instructors( $row['instructors'], '; ' ) . ' (' . $SASHA->format_schedule_type( $row['schedule_type'] ) . ': ' . $SASHA->format_days( $row['days'], NULL, 'html' ) . ')</option>' . "\n";
}
$Database->free_result( $result );
Modified: trunk/SASHA/inc/lib/lib.tests.php
===================================================================
--- trunk/SASHA/inc/lib/lib.tests.php 2010-01-20 03:06:18 UTC (rev 82)
+++ trunk/SASHA/inc/lib/lib.tests.php 2010-01-20 05:26:26 UTC (rev 83)
@@ -38,8 +38,8 @@
$schedule_id = (int) $_POST['schedule_id'];
$test_type = (int) $_POST['test_type'];
- $test_name = ( exists( $_POST['test_name'] ) ) ? addslashes( (string) $_POST['test_name'] ) : FALSE;
- $description = ( exists( $_POST['description'] ) ) ? addslashes( (string) $_POST['description'] ) : NULL;
+ $test_name = ( exists( $_POST['test_name'] ) ) ? $_POST['test_name'] : FALSE;
+ $description = ( exists( $_POST['description'] ) ) ? $_POST['description'] : NULL;
$start_date = mktime( (int) $start_date_time['hour'], (int) $start_date_time['minute'], 0, (int) $_POST['start_date']['month'], (int) $_POST['start_date']['day'], (int) $_POST['start_date']['year'] );
$end_date = mktime( (int) $end_date_time['hour'], (int) $end_date_time['minute'], 0, (int) $_POST['end_date']['month'], (int) $_POST['end_date']['day'], (int) $_POST['end_date']['year'] );
@@ -50,13 +50,13 @@
elseif( $test_name )
{
$sql = "INSERT INTO tests ( user_id, schedule_id, test_type, test_name, description, start_date, end_date )
- VALUES ( {$User->user_info['id']}, $schedule_id, $test_type, '$test_name', '$description', $start_date, $end_date )";
+ VALUES ( {$User->user_info['id']}, $schedule_id, $test_type, '" . $Database->escape( $test_name ) . "', '" . $Database->escape( $description ) . "', $start_date, $end_date )";
$result = $Database->query( $sql );
if( $result )
{
- print_message( 'good', 'Test "' . htmlentities( stripslashes( $test_name ), ENT_QUOTES, 'UTF-8' ) . '" (on ' . date( 'F j, Y', $start_date ) . ') added successfully.', 'Addition successful.' );
+ print_message( 'good', 'Test "' . htmlentities( $test_name, ENT_QUOTES, 'UTF-8' ) . '" (on ' . date( 'F j, Y', $start_date ) . ') added successfully.', 'Addition successful.' );
}
}
else
@@ -145,8 +145,8 @@
$schedule_id = (int) $_POST['schedule_id'];
$test_type = (int) $_POST['test_type'];
- $test_name = ( exists( $_POST['test_name'] ) ) ? addslashes( (string) $_POST['test_name'] ) : FALSE;
- $description = ( exists( $_POST['description'] ) ) ? addslashes( (string) $_POST['description'] ) : NULL;
+ $test_name = ( exists( $_POST['test_name'] ) ) ? $_POST['test_name'] : FALSE;
+ $description = ( exists( $_POST['description'] ) ) ? $_POST['description'] : NULL;
$start_date = mktime( (int) $start_date_time['hour'], (int) $start_date_time['minute'], 0, (int) $_POST['start_date']['month'], (int) $_POST['start_date']['day'], (int) $_POST['start_date']['year'] );
$end_date = mktime( (int) $end_date_time['hour'], (int) $end_date_time['minute'], 0, (int) $_POST['end_date']['month'], (int) $_POST['end_date']['day'], (int) $_POST['end_date']['year'] );
$received_score = ( exists( $_POST['received_score'] ) ) ? (float) $_POST['received_score'] : NULL;
@@ -161,7 +161,7 @@
elseif( $test_name )
{
$sql = "UPDATE tests
- SET schedule_id = $schedule_id, test_type = $test_type, test_name = '$test_name', description = '$description', start_date = $start_date, end_date = $end_date
+ SET schedule_id = $schedule_id, test_type = $test_type, test_name = '" . $Database->escape( $test_name ) . "', description = '" . $Database->escape( $description ) . "', start_date = $start_date, end_date = $end_date
$score
WHERE test_id = $test_id";
@@ -169,7 +169,7 @@
if( $result )
{
- print_message( 'good', 'Test "' . htmlentities( stripslashes( $test_name ), ENT_QUOTES, 'UTF-8' ) . '" (on ' . date( 'F j, Y', $start_date ) . ') updated successfully.', 'Update successful.' );
+ print_message( 'good', 'Test "' . htmlentities( $test_name, ENT_QUOTES, 'UTF-8' ) . '" (on ' . date( 'F j, Y', $start_date ) . ') updated successfully.', 'Update successful.' );
$this->list_tests();
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <gph...@us...> - 2010-01-20 03:06:27
|
Revision: 82
http://sasha.svn.sourceforge.net/sasha/?rev=82&view=rev
Author: gphemsley
Date: 2010-01-20 03:06:18 +0000 (Wed, 20 Jan 2010)
Log Message:
-----------
Add and implement Base::print_sub_navigation(), which automatically generates sub-navigation from an array of data.
Minor indentation changes for Base::print_*() and pages that use those methods.
Modified Paths:
--------------
trunk/SASHA/assignments.php
trunk/SASHA/inc/lib/lib.base.php
trunk/SASHA/schedule.php
trunk/SASHA/tests.php
Modified: trunk/SASHA/assignments.php
===================================================================
--- trunk/SASHA/assignments.php 2010-01-20 02:43:12 UTC (rev 81)
+++ trunk/SASHA/assignments.php 2010-01-20 03:06:18 UTC (rev 82)
@@ -60,8 +60,8 @@
$assignment_id = ( exists( $_REQUEST['assignment_id'] ) ) ? (int) $_REQUEST['assignment_id'] : FALSE;
-$institution_url = ( $SASHA->institution ) ? '&institution=' . $SASHA->institution : '';
-$semester_url = ( $SASHA->semester ) ? '&semester=' . $SASHA->semester : '';
+$institution_url = ( $SASHA->institution ) ? '&institution=' . $SASHA->institution : '';
+$semester_url = ( $SASHA->semester ) ? '&semester=' . $SASHA->semester : '';
$sub_nav = array(
'view' => array(
@@ -75,17 +75,11 @@
);
?>
-
-<div id="sub-nav">
- <ul>
- <li><a href="<?php print ROOT; ?>assignments.php?mode=view<?php print $institution_url . $semester_url; ?>">View</a></li>
- <li><a href="<?php print ROOT; ?>assignments.php?mode=add<?php print $institution_url . $semester_url; ?>">Add</a></li>
- </ul>
-</div>
-
-<div id="assignments">
+ <div id="assignments">
<?php
+$SASHA->print_sub_navigation( $sub_nav );
+
switch( $mode )
{
case 'add':
@@ -103,7 +97,7 @@
}
?>
-</div>
+ </div>
<?php
/**
Modified: trunk/SASHA/inc/lib/lib.base.php
===================================================================
--- trunk/SASHA/inc/lib/lib.base.php 2010-01-20 02:43:12 UTC (rev 81)
+++ trunk/SASHA/inc/lib/lib.base.php 2010-01-20 03:06:18 UTC (rev 82)
@@ -981,6 +981,36 @@
}
/**
+ * Base::print_sub_navigation()
+ *
+ * Print page-specific navigation.
+ *
+ * @access public
+ * @param array $sub_nav Navigation link data.
+ * @return bool Status of printing sub-navigation.
+ */
+ public function print_sub_navigation( $sub_nav )
+ {
+ if( !is_array( $sub_nav ) )
+ {
+ return FALSE;
+ }
+
+ print "\t\t" . '<div id="sub-nav">' . "\n";
+ print "\t\t\t" . '<ul>' . "\n";
+
+ foreach( $sub_nav as $link_id => $link )
+ {
+ print "\t\t\t\t" . '<li><a href="' . htmlentities( $link['url'], ENT_QUOTES, 'UTF-8' ) . '">' . htmlentities( $link['title'], ENT_QUOTES, 'UTF-8' ) . '</a></li>' . "\n";
+ }
+
+ print "\t\t\t" . '</ul>' . "\n";
+ print "\t\t" . '</div>' . "\n";
+
+ return TRUE;
+ }
+
+ /**
* Base::print_semester_navigation()
*
* Print semester navigation for previous and next semesters.
@@ -1043,9 +1073,9 @@
$next = $next_year . $next_month;
$only_institution = ( $institution ) ? 'institution=' . $institution . '&' : '';
- print "\t" . '<div class="semester-nav">' . "\n";
- print "\t\t" . '<div class="left-column"><a href="' . $file . '?' . $only_institution . 'semester=' . $previous . '">← ' . $this->format_semester( $previous ) . '</a></div>' . "\n";
- print "\t\t" . '<div class="center-column">';
+ print "\t\t" . '<div class="semester-nav">' . "\n";
+ print "\t\t\t" . '<div class="left-column"><a href="' . $file . '?' . $only_institution . 'semester=' . $previous . '">← ' . $this->format_semester( $previous ) . '</a></div>' . "\n";
+ print "\t\t\t" . '<div class="center-column">';
if( $institution )
{
@@ -1053,8 +1083,8 @@
}
print $this->format_semester( $semester ) . ( ( $institution ) ? '</a>' : '' ) . '</div>' . "\n";
- print "\t\t" . '<div class="right-column"><a href="' .$file . '?' . $only_institution . 'semester=' . $next . '">' . $this->format_semester( $next ) . ' →</a></div>' . "\n";
- print "\t" . '</div>' . "\n";
+ print "\t\t\t" . '<div class="right-column"><a href="' .$file . '?' . $only_institution . 'semester=' . $next . '">' . $this->format_semester( $next ) . ' →</a></div>' . "\n";
+ print "\t\t" . '</div>' . "\n";
return TRUE;
}
@@ -1077,13 +1107,13 @@
$this->print_semester_navigation( $semester, $nav_file, $this->institution );
- print "\t" . '<table class="list">' . "\n";
+ print "\t\t" . '<table class="list">' . "\n";
- print "\t\t" . '<colgroup>' . "\n";
+ print "\t\t\t" . '<colgroup>' . "\n";
foreach( $columns as $col )
{
- print "\t\t\t" . '<col';
+ print "\t\t\t\t" . '<col';
if( exists( $col['span'] ) )
{
@@ -1103,20 +1133,20 @@
print ' />' . "\n";
}
- print "\t\t" . '</colgroup>' . "\n";
+ print "\t\t\t" . '</colgroup>' . "\n";
for( $top = 1; $top >= 0; $top-- )
{
if( $top )
{
- print "\t\t" . '<thead style="border-bottom: 3px solid black;">' . "\n";
+ print "\t\t\t" . '<thead style="border-bottom: 3px solid black;">' . "\n";
}
else
{
- print "\t\t" . '<tfoot style="border-top: 3px solid black;">' . "\n";
+ print "\t\t\t" . '<tfoot style="border-top: 3px solid black;">' . "\n";
}
- print "\t\t\t" . '<tr>' . "\n";
+ print "\t\t\t\t" . '<tr>' . "\n";
foreach( $headers as $head )
{
@@ -1125,7 +1155,7 @@
$head['content'] = ' ';
}
- print "\t\t\t\t" . '<th';
+ print "\t\t\t\t\t" . '<th';
if( exists( $head['colspan'] ) )
{
@@ -1145,23 +1175,23 @@
print '>' . $head['content'] . '</th>' . "\n";
}
- print "\t\t\t" . '</tr>' . "\n";
+ print "\t\t\t\t" . '</tr>' . "\n";
if( $top )
{
- print "\t\t" . '</thead>' . "\n";
+ print "\t\t\t" . '</thead>' . "\n";
}
else
{
- print "\t\t" . '</tfoot>' . "\n";
+ print "\t\t\t" . '</tfoot>' . "\n";
}
}
- print "\t\t" . '<tbody>' . "\n";
+ print "\t\t\t" . '<tbody>' . "\n";
foreach( $rows as $row_id => $row )
{
- print "\t\t\t" . '<tr';
+ print "\t\t\t\t" . '<tr';
if( exists( $row['class'] ) )
{
@@ -1187,7 +1217,7 @@
$cell['content'] = ' ';
}
- print "\t\t\t\t" . '<td';
+ print "\t\t\t\t\t" . '<td';
if( exists( $cell['colspan'] ) )
{
@@ -1207,11 +1237,11 @@
print '>' . $cell['content'] . '</td>' . "\n";
}
- print "\t\t\t" . '</tr>' . "\n";
+ print "\t\t\t\t" . '</tr>' . "\n";
}
- print "\t\t" . '</tbody>' . "\n";
+ print "\t\t\t" . '</tbody>' . "\n";
- print "\t" . '</table>' . "\n";
+ print "\t\t" . '</table>' . "\n";
$this->print_semester_navigation( $semester, $nav_file, $this->institution );
Modified: trunk/SASHA/schedule.php
===================================================================
--- trunk/SASHA/schedule.php 2010-01-20 02:43:12 UTC (rev 81)
+++ trunk/SASHA/schedule.php 2010-01-20 03:06:18 UTC (rev 82)
@@ -60,8 +60,8 @@
$schedule_id = ( exists( $_REQUEST['schedule_id'] ) ) ? (int) $_REQUEST['schedule_id'] : FALSE;
-$institution_url = ( $SASHA->institution ) ? '&institution=' . $SASHA->institution : '';
-$semester_url = ( $SASHA->semester ) ? '&semester=' . $SASHA->semester : '';
+$institution_url = ( $SASHA->institution ) ? '&institution=' . $SASHA->institution : '';
+$semester_url = ( $SASHA->semester ) ? '&semester=' . $SASHA->semester : '';
$sub_nav = array(
'view' => array(
@@ -75,17 +75,11 @@
);
?>
-
-<div id="sub-nav">
- <ul>
- <li><a href="<?php print ROOT; ?>schedule.php?mode=view<?php print $institution_url . $semester_url; ?>">View</a></li>
- <li><a href="<?php print ROOT; ?>schedule.php?mode=add<?php print $institution_url . $semester_url; ?>">Add</a></li>
- </ul>
-</div>
-
-<div id="schedule">
+ <div id="schedule">
<?php
+$SASHA->print_sub_navigation( $sub_nav );
+
switch( $mode )
{
case 'add':
@@ -103,7 +97,7 @@
}
?>
-</div>
+ </div>
<?php
/**
Modified: trunk/SASHA/tests.php
===================================================================
--- trunk/SASHA/tests.php 2010-01-20 02:43:12 UTC (rev 81)
+++ trunk/SASHA/tests.php 2010-01-20 03:06:18 UTC (rev 82)
@@ -60,8 +60,8 @@
$test_id = ( exists( $_REQUEST['test_id'] ) ) ? (int) $_REQUEST['test_id'] : FALSE;
-$institution_url = ( $SASHA->institution ) ? '&institution=' . $SASHA->institution : '';
-$semester_url = ( $SASHA->semester ) ? '&semester=' . $SASHA->semester : '';
+$institution_url = ( $SASHA->institution ) ? '&institution=' . $SASHA->institution : '';
+$semester_url = ( $SASHA->semester ) ? '&semester=' . $SASHA->semester : '';
$sub_nav = array(
'view' => array(
@@ -75,17 +75,11 @@
);
?>
-
-<div id="sub-nav">
- <ul>
- <li><a href="<?php print ROOT; ?>tests.php?mode=view<?php print $institution_url . $semester_url; ?>">View</a></li>
- <li><a href="<?php print ROOT; ?>tests.php?mode=add<?php print $institution_url . $semester_url; ?>">Add</a></li>
- </ul>
-</div>
-
-<div id="tests">
+ <div id="tests">
<?php
+$SASHA->print_sub_navigation( $sub_nav );
+
switch( $mode )
{
case 'add':
@@ -103,7 +97,7 @@
}
?>
-</div>
+ </div>
<?php
/**
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <gph...@us...> - 2010-01-20 02:43:19
|
Revision: 81
http://sasha.svn.sourceforge.net/sasha/?rev=81&view=rev
Author: gphemsley
Date: 2010-01-20 02:43:12 +0000 (Wed, 20 Jan 2010)
Log Message:
-----------
Fix bug that caused the wrong semester list to be displayed after editing a time-shifted test.
Add messages preventing the use of an edit form without specifying an item ID.
Adjust some column widths on lists.
Modified Paths:
--------------
trunk/SASHA/inc/lib/lib.assignments.php
trunk/SASHA/inc/lib/lib.schedule.php
trunk/SASHA/inc/lib/lib.tests.php
Modified: trunk/SASHA/inc/lib/lib.assignments.php
===================================================================
--- trunk/SASHA/inc/lib/lib.assignments.php 2010-01-19 21:47:11 UTC (rev 80)
+++ trunk/SASHA/inc/lib/lib.assignments.php 2010-01-20 02:43:12 UTC (rev 81)
@@ -120,6 +120,13 @@
{
global $Database, $User;
+ if( !$assignment_id )
+ {
+ print_message( 'bad', 'Please specify which assignment you want to edit.', 'Assignment ID not specified.' );
+
+ return FALSE;
+ }
+
$institution = ( $this->institution ) ? $this->institution : $this->default_institution;
$semester = ( $this->semester ) ? $this->semester : $this->default_semester;
@@ -266,7 +273,7 @@
if( !$institution_where )
{
$columns[1] = array(
- 'style' => 'width: 10%;'
+ 'style' => 'width: 7.5%;'
);
$headers[1] = array(
'content' => 'Institution'
Modified: trunk/SASHA/inc/lib/lib.schedule.php
===================================================================
--- trunk/SASHA/inc/lib/lib.schedule.php 2010-01-19 21:47:11 UTC (rev 80)
+++ trunk/SASHA/inc/lib/lib.schedule.php 2010-01-20 02:43:12 UTC (rev 81)
@@ -374,6 +374,8 @@
if( !$schedule_id )
{
+ print_message( 'bad', 'Please specify which schedule you want to edit.', 'Schedule ID not specified.' );
+
return FALSE;
}
@@ -677,7 +679,7 @@
$institution_where = ( $this->institution ) ? "AND s.institution = '{$this->institution}'" : '';
$columns[0] = array(
- 'style' => 'width: 5%;'
+ 'style' => 'width: 5%; border-right: 2px solid black;'
);
$headers[0] = array();
@@ -695,7 +697,7 @@
'style' => 'width: 10%;'
);
$headers[2] = array(
- 'content' => 'Course Number'
+ 'content' => 'Course'
);
$columns[3] = array(
Modified: trunk/SASHA/inc/lib/lib.tests.php
===================================================================
--- trunk/SASHA/inc/lib/lib.tests.php 2010-01-19 21:47:11 UTC (rev 80)
+++ trunk/SASHA/inc/lib/lib.tests.php 2010-01-20 02:43:12 UTC (rev 81)
@@ -126,6 +126,13 @@
{
global $Database, $User;
+ if( !$test_id )
+ {
+ print_message( 'bad', 'Please specify which test you want to edit.', 'Test ID not specified.' );
+
+ return FALSE;
+ }
+
$institution = ( $this->institution ) ? $this->institution : FALSE;
$semester = ( $this->semester ) ? $this->semester : $this->default_semester;
@@ -260,6 +267,20 @@
),
array(
'type' => 'hidden',
+ 'name' => 'institution',
+ 'data' => array(
+ 'value' => $institution
+ )
+ ),
+ array(
+ 'type' => 'hidden',
+ 'name' => 'semester',
+ 'data' => array(
+ 'value' => $semester
+ )
+ ),
+ array(
+ 'type' => 'hidden',
'name' => 'test_id',
'data' => array(
'value' => $test_id
@@ -295,7 +316,7 @@
if( !$institution_where )
{
$columns[1] = array(
- 'style' => 'width: 10%;'
+ 'style' => 'width: 7.5%;'
);
$headers[1] = array(
'content' => 'Institution'
@@ -329,14 +350,14 @@
);
$columns[6] = array(
- 'style' => 'width: 15%;'
+ 'style' => 'width: 12.5%;'
);
$headers[6] = array(
'content' => 'Start Time'
);
$columns[7] = array(
- 'style' => 'width: 15%;'
+ 'style' => 'width: 12.5%;'
);
$headers[7] = array(
'content' => 'End Time'
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <gph...@us...> - 2010-01-19 21:47:17
|
Revision: 80
http://sasha.svn.sourceforge.net/sasha/?rev=80&view=rev
Author: gphemsley
Date: 2010-01-19 21:47:11 +0000 (Tue, 19 Jan 2010)
Log Message:
-----------
Add link to institution-specific views to get back to full semester view.
Don't force cut off of course subjects or numbers based on maximum length values.
Fix bug that caused unspecified days to turn into Sunday.
Fix bug that made default times after edit revert to AM, even if PM was specified.
Add an extra check to Base::format_days() to ensure proper array handling.
Change column widths for some columns in schedules list.
Modified Paths:
--------------
trunk/SASHA/inc/lib/lib.base.php
trunk/SASHA/inc/lib/lib.schedule.php
Modified: trunk/SASHA/inc/lib/lib.base.php
===================================================================
--- trunk/SASHA/inc/lib/lib.base.php 2010-01-19 00:44:45 UTC (rev 79)
+++ trunk/SASHA/inc/lib/lib.base.php 2010-01-19 21:47:11 UTC (rev 80)
@@ -634,7 +634,7 @@
{
$days_array = array();
- if( $input === TRUE )
+ if( ( $input === TRUE ) || is_array( $days ) )
{
$input = 'array';
}
@@ -958,10 +958,13 @@
$course_format = $Database->fetch_assoc( $result );
$course_max_length = $course_format['course_max_length'];
- $course = ( strlen( $course ) < $course_max_length ) ? str_pad( $course, $course_max_length, '0', STR_PAD_LEFT ) : $course;
- $subject = substr( $subject, 0, $course_format['subject_max_length'] );
- $course = substr( $course, -$course_max_length, $course_max_length );
+ // Don't force the lengths; use them only as a guide
+ $course = ltrim( $course, '0' );
+ $course = ( strlen( $course ) > $course_max_length ) ? $course : str_pad( $course, $course_max_length, '0', STR_PAD_LEFT );
+
+// $subject = substr( $subject, 0, $course_format['subject_max_length'] );
+// $course = substr( $course, -$course_max_length, $course_max_length );
}
$Database->free_result( $result );
@@ -1046,10 +1049,10 @@
if( $institution )
{
- print $this->format_institution( $institution, TRUE ) . ' – ';
+ print $this->format_institution( $institution, TRUE ) . ' – <a href="' . $file . '?semester=' . $semester . '">';
}
- print $this->format_semester( $semester ) . '</div>' . "\n";
+ print $this->format_semester( $semester ) . ( ( $institution ) ? '</a>' : '' ) . '</div>' . "\n";
print "\t\t" . '<div class="right-column"><a href="' .$file . '?' . $only_institution . 'semester=' . $next . '">' . $this->format_semester( $next ) . ' →</a></div>' . "\n";
print "\t" . '</div>' . "\n";
Modified: trunk/SASHA/inc/lib/lib.schedule.php
===================================================================
--- trunk/SASHA/inc/lib/lib.schedule.php 2010-01-19 00:44:45 UTC (rev 79)
+++ trunk/SASHA/inc/lib/lib.schedule.php 2010-01-19 21:47:11 UTC (rev 80)
@@ -60,6 +60,9 @@
$institution = ( $this->institution ) ? $this->institution : $this->default_institution;
$semester = ( $this->semester ) ? $this->semester : $this->default_semester;
+ $start_time = $this->convert_hour( TRUE, $this->start_time['hour'], $this->start_time );
+ $end_time = $this->convert_hour( TRUE, $this->end_time['hour'], $this->end_time );
+
$this_step = ( exists( $_POST['step'] ) ) ? (int) $_POST['step'] : FALSE;
$prev_step = ( $this_step ) ? (int) ( $this_step - 1 ) : FALSE;
$next_step = ( $this_step ) ? (int) ( $this_step + 1 ) : FALSE;
@@ -338,13 +341,13 @@
'type' => 'time',
'name' => 'start_time',
'label' => 'Start Time',
- 'data' => array( mktime( $this->start_time['hour'], $this->start_time['minute'], 0 ) )
+ 'data' => array( mktime( $start_time['hour'], $start_time['minute'], 0 ) )
),
array(
'type' => 'time',
'name' => 'end_time',
'label' => 'End Time',
- 'data' => array( mktime( $this->end_time['hour'], $this->end_time['minute'], 0 ) )
+ 'data' => array( mktime( $end_time['hour'], $end_time['minute'], 0 ) )
),
array(
'type' => 'hidden',
@@ -404,7 +407,7 @@
{
case 3:
$sql = "UPDATE schedules
- SET institution = '$institution', semester = '$semester', subject = '" . $Database->escape( $this->subject ) . "', course = {$this->course}, section = '" . $Database->escape( $this->section ) . "', section_title = '" . $Database->escape( $this->section_title ) . "', schedule_type = {$this->schedule_type}, days = b'" . $this->format_days( $this->schedule_days, 'decimal', 'binary' ) . "', start_time = {$this->start_time}, end_time = {$this->end_time}, instructors = '" . $this->prepare_instructors( $this->instructors ) . "', parent_schedule_id = {$this->parent_schedule_id}
+ SET institution = '$institution', semester = '$semester', subject = '" . $Database->escape( $this->subject ) . "', course = {$this->course}, section = '" . $Database->escape( $this->section ) . "', section_title = '" . $Database->escape( $this->section_title ) . "', schedule_type = {$this->schedule_type}, days = b'" . $this->format_days( $this->schedule_days, NULL, 'binary' ) . "', start_time = {$this->start_time}, end_time = {$this->end_time}, instructors = '" . $this->prepare_instructors( $this->instructors ) . "', parent_schedule_id = {$this->parent_schedule_id}
WHERE schedule_id = $schedule_id";
$sql = str_replace( array( "= '',", "= '' ", '= ,', '= ', "= \n" ), array( '= NULL,', '= NULL ', '= NULL,', '= NULL ', "= NULL\n" ), $sql );
@@ -412,7 +415,7 @@
if( $result )
{
- print_message( 'good', 'Schedule for ' . $this->format_course( $this->subject, $this->course, $institution, ' ' ) . ' ' . $this->section . ' at ' . $this->format_institution( $institution ) . ' (' . $this->format_instructors( $this->instructors, '; ' ) . ' — ' . $this->format_schedule_type( $this->schedule_type ) . ': ' . $this->format_days( $this->schedule_days, 'decimal', 'html' ) . ') updated successfully.', 'Update successful.' );
+ print_message( 'good', 'Schedule for ' . $this->format_course( $this->subject, $this->course, $institution, ' ' ) . ' ' . $this->section . ' at ' . $this->format_institution( $institution ) . ' (' . $this->format_instructors( $this->instructors, '; ' ) . ' — ' . $this->format_schedule_type( $this->schedule_type ) . ': ' . $this->format_days( $this->schedule_days, NULL, 'html' ) . ') updated successfully.', 'Update successful.' );
$this->list_schedule();
@@ -681,7 +684,7 @@
if( !$institution_where )
{
$columns[1] = array(
- 'style' => 'width: 10%;'
+ 'style' => 'width: 7.5%;'
);
$headers[1] = array(
'content' => 'Institution'
@@ -729,14 +732,14 @@
);
$columns[8] = array(
- 'style' => 'width: 10%;'
+ 'style' => 'width: 7.5%;'
);
$headers[8] = array(
'content' => 'Start Time'
);
$columns[9] = array(
- 'style' => 'width: 10%;'
+ 'style' => 'width: 7.5%;'
);
$headers[9] = array(
'content' => 'End Time'
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <gph...@us...> - 2010-01-19 01:00:46
|
Revision: 79
http://sasha.svn.sourceforge.net/sasha/?rev=79&view=rev
Author: gphemsley
Date: 2010-01-19 00:44:45 +0000 (Tue, 19 Jan 2010)
Log Message:
-----------
Work around MySQL backwards-compatibility issue with the BIT type, which returns as binary from 5.0, but decimal from 5.1.
Fix a copyright year that got lost in the shuffle.
Modified Paths:
--------------
trunk/SASHA/docs/LICENSE
trunk/SASHA/inc/lib/lib.base.php
trunk/SASHA/inc/lib/lib.schedule.php
Modified: trunk/SASHA/docs/LICENSE
===================================================================
--- trunk/SASHA/docs/LICENSE 2010-01-04 23:32:19 UTC (rev 78)
+++ trunk/SASHA/docs/LICENSE 2010-01-19 00:44:45 UTC (rev 79)
@@ -1,14 +1,14 @@
------------------------------------------------------------------------------
SASHA :: docs/LICENSE
-
+
The BSD license.
-
- Copyright (C) 2006-2009 Gordon P. Hemsley
+
+ Copyright (C) 2006-2010 Gordon P. Hemsley
License: docs/LICENSE (BSD License)
$Id$
------------------------------------------------------------------------------
-Copyright (C) 2006–2009, Gordon P. Hemsley
+Copyright (C) 2006-2010, Gordon P. Hemsley
All rights reserved.
Redistribution and use in source and binary forms, with or without
Modified: trunk/SASHA/inc/lib/lib.base.php
===================================================================
--- trunk/SASHA/inc/lib/lib.base.php 2010-01-04 23:32:19 UTC (rev 78)
+++ trunk/SASHA/inc/lib/lib.base.php 2010-01-19 00:44:45 UTC (rev 79)
@@ -640,7 +640,15 @@
}
elseif( ( in_array( $input, array( 'array', NULL ) ) ) && !is_array( $days ) )
{
- $input = 'binary';
+ // MySQL 5.0 returns bit as binary, while MySQL 5.1 returns decimal
+ if( $days == chr( ord( $days ) ) )
+ {
+ $input = 'binary';
+ }
+ else
+ {
+ $input = 'decimal';
+ }
}
switch( $input )
Modified: trunk/SASHA/inc/lib/lib.schedule.php
===================================================================
--- trunk/SASHA/inc/lib/lib.schedule.php 2010-01-04 23:32:19 UTC (rev 78)
+++ trunk/SASHA/inc/lib/lib.schedule.php 2010-01-19 00:44:45 UTC (rev 79)
@@ -403,7 +403,6 @@
switch( $this_step )
{
case 3:
- // @TODO: MySQL 5.1 returns bit as binary; MySQL 5.0 returns decimal
$sql = "UPDATE schedules
SET institution = '$institution', semester = '$semester', subject = '" . $Database->escape( $this->subject ) . "', course = {$this->course}, section = '" . $Database->escape( $this->section ) . "', section_title = '" . $Database->escape( $this->section_title ) . "', schedule_type = {$this->schedule_type}, days = b'" . $this->format_days( $this->schedule_days, 'decimal', 'binary' ) . "', start_time = {$this->start_time}, end_time = {$this->end_time}, instructors = '" . $this->prepare_instructors( $this->instructors ) . "', parent_schedule_id = {$this->parent_schedule_id}
WHERE schedule_id = $schedule_id";
@@ -814,7 +813,7 @@
'content' => $this->format_instructors( $row['instructors'], '<br />' )
),
7 => array(
- 'content' => $this->format_days( $row['days'], 'binary', 'html' )
+ 'content' => $this->format_days( $row['days'], NULL, 'html' )
),
8 => array(
'content' => $this->format_time( $row['start_time'], TRUE, '24-hour', 'html' )
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <gph...@us...> - 2010-01-04 23:32:30
|
Revision: 78
http://sasha.svn.sourceforge.net/sasha/?rev=78&view=rev
Author: gphemsley
Date: 2010-01-04 23:32:19 +0000 (Mon, 04 Jan 2010)
Log Message:
-----------
Update copyright notices for 2010.
Modified Paths:
--------------
trunk/SASHA/assignments.php
trunk/SASHA/config/config.default.php
trunk/SASHA/docs/INSTALL
trunk/SASHA/inc/inc.constants.php
trunk/SASHA/inc/inc.main.php
trunk/SASHA/inc/inc.misc.php
trunk/SASHA/inc/lib/lib.assignments.php
trunk/SASHA/inc/lib/lib.base.php
trunk/SASHA/inc/lib/lib.calendar.php
trunk/SASHA/inc/lib/lib.forms.php
trunk/SASHA/inc/lib/lib.home.php
trunk/SASHA/inc/lib/lib.schedule.php
trunk/SASHA/inc/lib/lib.sessions.php
trunk/SASHA/inc/lib/lib.tests.php
trunk/SASHA/inc/lib/lib.user.php
trunk/SASHA/index.php
trunk/SASHA/install/index.php
trunk/SASHA/install/schema/mysql.sql
trunk/SASHA/login.php
trunk/SASHA/register.php
trunk/SASHA/schedule.php
trunk/SASHA/style/default/header.php
trunk/SASHA/style/default/screen.css
trunk/SASHA/tests.php
Modified: trunk/SASHA/assignments.php
===================================================================
--- trunk/SASHA/assignments.php 2010-01-04 23:28:21 UTC (rev 77)
+++ trunk/SASHA/assignments.php 2010-01-04 23:32:19 UTC (rev 78)
@@ -6,7 +6,7 @@
* Manage assignments.
*
* @package SASHA
- * @copyright (C) 2006-2009 Gordon P. Hemsley
+ * @copyright (C) 2006-2010 Gordon P. Hemsley
* @license docs/LICENSE BSD License
* @version $Id$
*/
Modified: trunk/SASHA/config/config.default.php
===================================================================
--- trunk/SASHA/config/config.default.php 2010-01-04 23:28:21 UTC (rev 77)
+++ trunk/SASHA/config/config.default.php 2010-01-04 23:32:19 UTC (rev 78)
@@ -6,7 +6,7 @@
* Default configuration file.
*
* @package SASHA
- * @copyright (C) 2006-2009 Gordon P. Hemsley
+ * @copyright (C) 2006-2010 Gordon P. Hemsley
* @license docs/LICENSE BSD License
* @version $Id$
*/
Modified: trunk/SASHA/docs/INSTALL
===================================================================
--- trunk/SASHA/docs/INSTALL 2010-01-04 23:28:21 UTC (rev 77)
+++ trunk/SASHA/docs/INSTALL 2010-01-04 23:32:19 UTC (rev 78)
@@ -3,7 +3,7 @@
Installation instructions.
- Copyright (C) 2006-2009 Gordon P. Hemsley
+ Copyright (C) 2006-2010 Gordon P. Hemsley
License: docs/LICENSE (BSD License)
$Id$
------------------------------------------------------------------------------
Modified: trunk/SASHA/inc/inc.constants.php
===================================================================
--- trunk/SASHA/inc/inc.constants.php 2010-01-04 23:28:21 UTC (rev 77)
+++ trunk/SASHA/inc/inc.constants.php 2010-01-04 23:32:19 UTC (rev 78)
@@ -6,7 +6,7 @@
* Catalog of values that are constant.
*
* @package SASHA
- * @copyright (C) 2006-2009 Gordon P. Hemsley
+ * @copyright (C) 2006-2010 Gordon P. Hemsley
* @license docs/LICENSE BSD License
* @version $Id$
*/
Modified: trunk/SASHA/inc/inc.main.php
===================================================================
--- trunk/SASHA/inc/inc.main.php 2010-01-04 23:28:21 UTC (rev 77)
+++ trunk/SASHA/inc/inc.main.php 2010-01-04 23:32:19 UTC (rev 78)
@@ -6,7 +6,7 @@
* Do the required stuff.
*
* @package SASHA
- * @copyright (C) 2006-2009 Gordon P. Hemsley
+ * @copyright (C) 2006-2010 Gordon P. Hemsley
* @license docs/LICENSE BSD License
* @version $Id$
*/
Modified: trunk/SASHA/inc/inc.misc.php
===================================================================
--- trunk/SASHA/inc/inc.misc.php 2010-01-04 23:28:21 UTC (rev 77)
+++ trunk/SASHA/inc/inc.misc.php 2010-01-04 23:32:19 UTC (rev 78)
@@ -6,7 +6,7 @@
* Miscellaneous functions.
*
* @package SASHA
- * @copyright (C) 2006-2009 Gordon P. Hemsley
+ * @copyright (C) 2006-2010 Gordon P. Hemsley
* @license docs/LICENSE BSD License
* @version $Id$
*/
Modified: trunk/SASHA/inc/lib/lib.assignments.php
===================================================================
--- trunk/SASHA/inc/lib/lib.assignments.php 2010-01-04 23:28:21 UTC (rev 77)
+++ trunk/SASHA/inc/lib/lib.assignments.php 2010-01-04 23:32:19 UTC (rev 78)
@@ -6,7 +6,7 @@
* This contains all of the assignments functions.
*
* @package SASHA
- * @copyright (C) 2006-2009 Gordon P. Hemsley
+ * @copyright (C) 2006-2010 Gordon P. Hemsley
* @license docs/LICENSE BSD License
* @version $Id$
*/
Modified: trunk/SASHA/inc/lib/lib.base.php
===================================================================
--- trunk/SASHA/inc/lib/lib.base.php 2010-01-04 23:28:21 UTC (rev 77)
+++ trunk/SASHA/inc/lib/lib.base.php 2010-01-04 23:32:19 UTC (rev 78)
@@ -6,7 +6,7 @@
* This contains the functions common to all child classes of SASHA.
*
* @package SASHA
- * @copyright (C) 2006-2009 Gordon P. Hemsley
+ * @copyright (C) 2006-2010 Gordon P. Hemsley
* @license docs/LICENSE BSD License
* @version $Id$
*/
Modified: trunk/SASHA/inc/lib/lib.calendar.php
===================================================================
--- trunk/SASHA/inc/lib/lib.calendar.php 2010-01-04 23:28:21 UTC (rev 77)
+++ trunk/SASHA/inc/lib/lib.calendar.php 2010-01-04 23:32:19 UTC (rev 78)
@@ -6,7 +6,7 @@
* This contains all of the calendar classes.
*
* @package SASHA
- * @copyright (C) 2006-2009 Gordon P. Hemsley
+ * @copyright (C) 2006-2010 Gordon P. Hemsley
* @license docs/LICENSE BSD License
* @version $Id$
*/
Modified: trunk/SASHA/inc/lib/lib.forms.php
===================================================================
--- trunk/SASHA/inc/lib/lib.forms.php 2010-01-04 23:28:21 UTC (rev 77)
+++ trunk/SASHA/inc/lib/lib.forms.php 2010-01-04 23:32:19 UTC (rev 78)
@@ -6,7 +6,7 @@
* This contains the methods required to generate a form.
*
* @package SASHA
- * @copyright (C) 2006-2009 Gordon P. Hemsley
+ * @copyright (C) 2006-2010 Gordon P. Hemsley
* @license docs/LICENSE BSD License
* @version $Id$
*/
Modified: trunk/SASHA/inc/lib/lib.home.php
===================================================================
--- trunk/SASHA/inc/lib/lib.home.php 2010-01-04 23:28:21 UTC (rev 77)
+++ trunk/SASHA/inc/lib/lib.home.php 2010-01-04 23:32:19 UTC (rev 78)
@@ -6,7 +6,7 @@
* This contains all of the home functions.
*
* @package SASHA
- * @copyright (C) 2006-2009 Gordon P. Hemsley
+ * @copyright (C) 2006-2010 Gordon P. Hemsley
* @license docs/LICENSE BSD License
* @version $Id$
*/
Modified: trunk/SASHA/inc/lib/lib.schedule.php
===================================================================
--- trunk/SASHA/inc/lib/lib.schedule.php 2010-01-04 23:28:21 UTC (rev 77)
+++ trunk/SASHA/inc/lib/lib.schedule.php 2010-01-04 23:32:19 UTC (rev 78)
@@ -6,7 +6,7 @@
* This contains all of the schedule functions.
*
* @package SASHA
- * @copyright (C) 2006-2009 Gordon P. Hemsley
+ * @copyright (C) 2006-2010 Gordon P. Hemsley
* @license docs/LICENSE BSD License
* @version $Id$
*/
Modified: trunk/SASHA/inc/lib/lib.sessions.php
===================================================================
--- trunk/SASHA/inc/lib/lib.sessions.php 2010-01-04 23:28:21 UTC (rev 77)
+++ trunk/SASHA/inc/lib/lib.sessions.php 2010-01-04 23:32:19 UTC (rev 78)
@@ -6,7 +6,7 @@
* This contains all of the sessions classes.
*
* @package SASHA
- * @copyright (C) 2006-2009 Gordon P. Hemsley
+ * @copyright (C) 2006-2010 Gordon P. Hemsley
* @license docs/LICENSE BSD License
* @version $Id$
*/
Modified: trunk/SASHA/inc/lib/lib.tests.php
===================================================================
--- trunk/SASHA/inc/lib/lib.tests.php 2010-01-04 23:28:21 UTC (rev 77)
+++ trunk/SASHA/inc/lib/lib.tests.php 2010-01-04 23:32:19 UTC (rev 78)
@@ -6,7 +6,7 @@
* This contains all of the tests functions.
*
* @package SASHA
- * @copyright (C) 2006-2009 Gordon P. Hemsley
+ * @copyright (C) 2006-2010 Gordon P. Hemsley
* @license docs/LICENSE BSD License
* @version $Id$
*/
Modified: trunk/SASHA/inc/lib/lib.user.php
===================================================================
--- trunk/SASHA/inc/lib/lib.user.php 2010-01-04 23:28:21 UTC (rev 77)
+++ trunk/SASHA/inc/lib/lib.user.php 2010-01-04 23:32:19 UTC (rev 78)
@@ -6,7 +6,7 @@
* This contains all of the user classes.
*
* @package SASHA
- * @copyright (C) 2006-2009 Gordon P. Hemsley
+ * @copyright (C) 2006-2010 Gordon P. Hemsley
* @license docs/LICENSE BSD License
* @version $Id$
*/
Modified: trunk/SASHA/index.php
===================================================================
--- trunk/SASHA/index.php 2010-01-04 23:28:21 UTC (rev 77)
+++ trunk/SASHA/index.php 2010-01-04 23:32:19 UTC (rev 78)
@@ -6,7 +6,7 @@
* Home page, where the current tasks are shown.
*
* @package SASHA
- * @copyright (C) 2006-2009 Gordon P. Hemsley
+ * @copyright (C) 2006-2010 Gordon P. Hemsley
* @license docs/LICENSE BSD License
* @version $Id$
*/
Modified: trunk/SASHA/install/index.php
===================================================================
--- trunk/SASHA/install/index.php 2010-01-04 23:28:21 UTC (rev 77)
+++ trunk/SASHA/install/index.php 2010-01-04 23:32:19 UTC (rev 78)
@@ -6,7 +6,7 @@
* This is the main installer.
*
* @package SASHA
- * @copyright (C) 2006-2009 Gordon P. Hemsley
+ * @copyright (C) 2006-2010 Gordon P. Hemsley
* @license docs/LICENSE BSD License
* @version $Id$
*/
Modified: trunk/SASHA/install/schema/mysql.sql
===================================================================
--- trunk/SASHA/install/schema/mysql.sql 2010-01-04 23:28:21 UTC (rev 77)
+++ trunk/SASHA/install/schema/mysql.sql 2010-01-04 23:32:19 UTC (rev 78)
@@ -3,7 +3,7 @@
#
# Database schema for MySQL.
#
-# Copyright (C) 2006-2009 Gordon P. Hemsley
+# Copyright (C) 2006-2010 Gordon P. Hemsley
# License: docs/LICENSE (BSD License)
# $Id$
#
Modified: trunk/SASHA/login.php
===================================================================
--- trunk/SASHA/login.php 2010-01-04 23:28:21 UTC (rev 77)
+++ trunk/SASHA/login.php 2010-01-04 23:32:19 UTC (rev 78)
@@ -6,7 +6,7 @@
* Login interface.
*
* @package SASHA
- * @copyright (C) 2006-2009 Gordon P. Hemsley
+ * @copyright (C) 2006-2010 Gordon P. Hemsley
* @license docs/LICENSE BSD License
* @version $Id$
*/
Modified: trunk/SASHA/register.php
===================================================================
--- trunk/SASHA/register.php 2010-01-04 23:28:21 UTC (rev 77)
+++ trunk/SASHA/register.php 2010-01-04 23:32:19 UTC (rev 78)
@@ -6,7 +6,7 @@
* Registration interface.
*
* @package SASHA
- * @copyright (C) 2006-2009 Gordon P. Hemsley
+ * @copyright (C) 2006-2010 Gordon P. Hemsley
* @license docs/LICENSE BSD License
* @version $Id$
*/
Modified: trunk/SASHA/schedule.php
===================================================================
--- trunk/SASHA/schedule.php 2010-01-04 23:28:21 UTC (rev 77)
+++ trunk/SASHA/schedule.php 2010-01-04 23:32:19 UTC (rev 78)
@@ -6,7 +6,7 @@
* Manage course schedule.
*
* @package SASHA
- * @copyright (C) 2006-2009 Gordon P. Hemsley
+ * @copyright (C) 2006-2010 Gordon P. Hemsley
* @license docs/LICENSE BSD License
* @version $Id$
*/
Modified: trunk/SASHA/style/default/header.php
===================================================================
--- trunk/SASHA/style/default/header.php 2010-01-04 23:28:21 UTC (rev 77)
+++ trunk/SASHA/style/default/header.php 2010-01-04 23:32:19 UTC (rev 78)
@@ -6,7 +6,7 @@
* This is the style header for all pages.
*
* @package SASHA
- * @copyright (C) 2006-2009 Gordon P. Hemsley
+ * @copyright (C) 2006-2010 Gordon P. Hemsley
* @license docs/LICENSE BSD License
* @version $Id$
*/
Modified: trunk/SASHA/style/default/screen.css
===================================================================
--- trunk/SASHA/style/default/screen.css 2010-01-04 23:28:21 UTC (rev 77)
+++ trunk/SASHA/style/default/screen.css 2010-01-04 23:32:19 UTC (rev 78)
@@ -4,7 +4,7 @@
* Style information for screen media.
*
* @package SASHA
- * @copyright (C) 2006-2009 Gordon P. Hemsley
+ * @copyright (C) 2006-2010 Gordon P. Hemsley
* @license docs/LICENSE BSD License
* @version $Id$
*/
Modified: trunk/SASHA/tests.php
===================================================================
--- trunk/SASHA/tests.php 2010-01-04 23:28:21 UTC (rev 77)
+++ trunk/SASHA/tests.php 2010-01-04 23:32:19 UTC (rev 78)
@@ -6,7 +6,7 @@
* Manage tests.
*
* @package SASHA
- * @copyright (C) 2006-2009 Gordon P. Hemsley
+ * @copyright (C) 2006-2010 Gordon P. Hemsley
* @license docs/LICENSE BSD License
* @version $Id$
*/
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <gph...@us...> - 2010-01-04 23:28:32
|
Revision: 77
http://sasha.svn.sourceforge.net/sasha/?rev=77&view=rev
Author: gphemsley
Date: 2010-01-04 23:28:21 +0000 (Mon, 04 Jan 2010)
Log Message:
-----------
Add global message for making announcements on every page.
Add 'system' message type, for system-wide messages. (They're blue.)
Add checks to ensure that date ranges are correct (e.g. start date comes before end date, etc.).
Fix long-standing bug(s) in DBAL that prevented properly freeing query results.
Remove "feature" from DBAL that allowed multiple queries to be passed to $Database::query() in one string.
Properly free all SELECT query results. (May improve page-load times.)
Require all files in inc/ (as opposed to just including them).
Ensure header and footer are only called within actual pages (with ROOT defined and inc.main.php loaded).
Include SQL schema for registration date, added in r76.
Modified Paths:
--------------
trunk/SASHA/assignments.php
trunk/SASHA/config/config.default.php
trunk/SASHA/inc/database/database.mysql.php
trunk/SASHA/inc/inc.main.php
trunk/SASHA/inc/inc.misc.php
trunk/SASHA/inc/lib/lib.assignments.php
trunk/SASHA/inc/lib/lib.base.php
trunk/SASHA/inc/lib/lib.forms.php
trunk/SASHA/inc/lib/lib.home.php
trunk/SASHA/inc/lib/lib.schedule.php
trunk/SASHA/inc/lib/lib.sessions.php
trunk/SASHA/inc/lib/lib.tests.php
trunk/SASHA/inc/lib/lib.user.php
trunk/SASHA/index.php
trunk/SASHA/install/index.php
trunk/SASHA/install/schema/mysql.sql
trunk/SASHA/login.php
trunk/SASHA/register.php
trunk/SASHA/schedule.php
trunk/SASHA/style/default/footer.php
trunk/SASHA/style/default/header.php
trunk/SASHA/style/default/screen.css
trunk/SASHA/tests.php
Modified: trunk/SASHA/assignments.php
===================================================================
--- trunk/SASHA/assignments.php 2009-12-30 22:48:00 UTC (rev 76)
+++ trunk/SASHA/assignments.php 2010-01-04 23:28:21 UTC (rev 77)
@@ -23,7 +23,7 @@
$page_title = 'Assignments';
$tab = 'assignments';
-include( ROOT . 'inc/inc.main.php' );
+require( ROOT . 'inc/inc.main.php' );
$mode = ( exists( $_REQUEST['mode'] ) ) ? (string) $_REQUEST['mode'] : 'view';
@@ -54,7 +54,7 @@
/**
* Output current user's assignments.
*/
-include( ROOT . 'inc/lib/lib.assignments.php' );
+require( ROOT . 'inc/lib/lib.assignments.php' );
$SASHA = new Assignments();
Modified: trunk/SASHA/config/config.default.php
===================================================================
--- trunk/SASHA/config/config.default.php 2009-12-30 22:48:00 UTC (rev 76)
+++ trunk/SASHA/config/config.default.php 2010-01-04 23:28:21 UTC (rev 77)
@@ -36,6 +36,13 @@
$config['default_institution'] = 'uvm';
/**
+ * Global message, displayed on every page.
+ */
+$config['message']['type'] = '';
+$config['message']['title'] = '';
+$config['message']['message'] = '';
+
+/**
* Version information.
*/
Modified: trunk/SASHA/inc/database/database.mysql.php
===================================================================
--- trunk/SASHA/inc/database/database.mysql.php 2009-12-30 22:48:00 UTC (rev 76)
+++ trunk/SASHA/inc/database/database.mysql.php 2010-01-04 23:28:21 UTC (rev 77)
@@ -6,7 +6,7 @@
* Functions to use when manipulating a MySQL database.
*
* @package DBAL
- * @copyright (C) 2003-2007 CMSformE, 2006-2009 SASHA
+ * @copyright (C) 2003-2007 CMSformE, 2006-2010 Gordon P. Hemsley
* @license docs/LICENSE BSD License
* @version $Id$
*/
@@ -32,8 +32,10 @@
*/
class Database
{
- var $ident_link, $connected, $result;
+ var $ident_link, $connected;
var $query_count = 0;
+ var $results = array();
+ var $free_count = 0;
var $errors = array();
/**
@@ -48,13 +50,32 @@
$this->username = $username;
$this->password = $password;
$this->database = $database;
-
+
$this->connect();
$this->query( 'SET NAMES utf8' );
}
/**
+ * Database::__destruct()
+ *
+ * Ensure loose ends are tied up.
+ */
+ function __destruct()
+ {
+ if( count( $this->results ) != $this->free_count )
+ {
+ print 'WARNING: NOT ALL RESULTS HAVE BEEN FREED!' . "\n";
+ print 'RESULTS RETURNED: ' . count( $this->results ) . '; RESULTS FREED: ' . $this->free_count . "\n";
+ }
+
+ if( $this->connected )
+ {
+ $this->disconnect();
+ }
+ }
+
+ /**
* Database::verbose_name()
*
* Get verbose name of database
@@ -103,6 +124,8 @@
$this->ident_link = NULL;
}
+ $this->connected = FALSE;
+
return TRUE;
}
@@ -132,20 +155,15 @@
{
foreach( $query as $single_query )
{
- $more_queries = explode( ";\n", $single_query );
-
- foreach( $more_queries as $another_single_query )
- {
- $queries[] = $another_single_query;
- }
+ $queries[] = $single_query;
}
}
else
{
- $queries = explode( ";\n", $query );
+ $queries = array( $query );
}
- $this->result = ( count( $queries ) > 1 ) ? array() : NULL;
+ $results = array();
foreach( $queries as $query )
{
@@ -153,25 +171,23 @@
{
$result = $db->query( $query );
- if( count( $queries ) > 1 )
- {
- $this->result[] = $result;
- }
- else
- {
- $this->result = $result;
- }
+ $this->query_count++;
if( !$result )
{
$this->error();
}
- $this->query_count++;
+ $results[$this->query_count] = $result;
+
+ if( !is_bool( $result ) )
+ {
+ $this->results[$this->query_count] = $result;
+ }
}
}
- return $this->result;
+ return ( ( count( $results ) > 1 ) ? $results : $results[$this->query_count] );
}
}
@@ -267,9 +283,11 @@
*
* Free up memory
*/
- function free_result()
+ function free_result( $result )
{
- return mysqli_free_result( $this->result );
+ $this->free_count++;
+
+ return mysqli_free_result( $result );
}
/**
Modified: trunk/SASHA/inc/inc.main.php
===================================================================
--- trunk/SASHA/inc/inc.main.php 2009-12-30 22:48:00 UTC (rev 76)
+++ trunk/SASHA/inc/inc.main.php 2010-01-04 23:28:21 UTC (rev 77)
@@ -46,7 +46,7 @@
// Who is this user, anyway?
$User = new User( $Sessions->get_user() );
-include( ROOT . 'inc/lib/lib.base.php' );
+require( ROOT . 'inc/lib/lib.base.php' );
// If user is not logged in, override page and display login form.
// Just make sure that they're not already trying to log in.
Modified: trunk/SASHA/inc/inc.misc.php
===================================================================
--- trunk/SASHA/inc/inc.misc.php 2009-12-30 22:48:00 UTC (rev 76)
+++ trunk/SASHA/inc/inc.misc.php 2010-01-04 23:28:21 UTC (rev 77)
@@ -60,6 +60,10 @@
$type_class = ' bad';
break;
+ case 'system':
+ $type_class = ' system';
+ break;
+
case NULL:
default:
$type_class = '';
Modified: trunk/SASHA/inc/lib/lib.assignments.php
===================================================================
--- trunk/SASHA/inc/lib/lib.assignments.php 2009-12-30 22:48:00 UTC (rev 76)
+++ trunk/SASHA/inc/lib/lib.assignments.php 2010-01-04 23:28:21 UTC (rev 77)
@@ -47,6 +47,10 @@
{
print_message( 'bad', 'Assignment must have a valid, non-empty name.', 'Addition failed.' );
}
+ elseif( $due_date < $assigned_date )
+ {
+ print_message( 'bad', 'Due date cannot be before assigned date.', 'Addition failed.' );
+ }
else
{
$sql = "INSERT INTO assignments ( schedule_id, assignment_name, description, assigned_date, due_date )
@@ -139,6 +143,10 @@
{
print_message( 'bad', 'Assignment must have a valid, non-empty name.', 'Update failed.' );
}
+ elseif( $due_date < $assigned_date )
+ {
+ print_message( 'bad', 'Due date cannot be before assigned date.', 'Update failed.' );
+ }
else
{
$sql = "UPDATE assignments
@@ -172,6 +180,7 @@
$result = $Database->query( $sql );
$assignment = $Database->fetch_assoc( $result );
+ $Database->free_result( $result );
print "\t" . '<h2>Edit Assignment</h2>' . "\n";
@@ -390,6 +399,8 @@
);
}
+ $Database->free_result( $result );
+
$this->print_list_table( ROOT . 'assignments.php', $columns, $headers, $rows );
}
}
Modified: trunk/SASHA/inc/lib/lib.base.php
===================================================================
--- trunk/SASHA/inc/lib/lib.base.php 2009-12-30 22:48:00 UTC (rev 76)
+++ trunk/SASHA/inc/lib/lib.base.php 2010-01-04 23:28:21 UTC (rev 77)
@@ -377,8 +377,10 @@
AND course = '$course'";
$result = $Database->query( $sql );
+ $course = $Database->fetch_assoc( $result );
+ $Database->free_result( $result );
- if( $course = $Database->fetch_assoc( $result ) )
+ if( $course )
{
return $course['course_title'];
}
@@ -492,6 +494,7 @@
$result = $Database->query( $sql );
$instructor = $Database->fetch_assoc( $result );
+ $Database->free_result( $result );
$instructors[$id] = @$instructor['instructor_key'];
}
@@ -791,6 +794,7 @@
$result = $Database->query( $sql );
$names = $Database->fetch_assoc( $result );
+ $Database->free_result( $result );
return ( ( $names['short_name'] && !$full ) ? $names['short_name'] : $names['name'] );
}
@@ -899,6 +903,8 @@
}
}
}
+
+ $Database->free_result( $result );
}
else
{
@@ -950,6 +956,8 @@
$course = substr( $course, -$course_max_length, $course_max_length );
}
+ $Database->free_result( $result );
+
if( $glue === FALSE )
{
return array(
Modified: trunk/SASHA/inc/lib/lib.forms.php
===================================================================
--- trunk/SASHA/inc/lib/lib.forms.php 2009-12-30 22:48:00 UTC (rev 76)
+++ trunk/SASHA/inc/lib/lib.forms.php 2010-01-04 23:28:21 UTC (rev 77)
@@ -425,6 +425,8 @@
print "\t\t\t\t" . '</select></li>' . "\n";
}
+ $Database->free_result( $result );
+
print "\t\t\t" . '</ol>' . "\n";
}
@@ -540,6 +542,8 @@
print "\t\t\t" . '<option value="' . $row['institution'] . '"' . $selected . '>' . $row['country'] . ' — ' . $row['subdivision'] . ' — ' . $row['name'] . '</option>' . "\n";
}
+ $Database->free_result( $result );
+
print "\t\t" . '</select>' . "\n";
}
@@ -640,6 +644,8 @@
print "\t\t\t\t" . '<option value="' . $row['schedule_id'] . '"' . $selected . '>' . $SASHA->format_institution( $row['institution'] ) . ' — ' . $SASHA->format_course( $row['subject'], $row['course'], $row['institution'] ) . ' (' . $row['section'] . ') — ' . $SASHA->format_instructors( $row['instructors'], '; ' ) . ' (' . $SASHA->format_schedule_type( $row['schedule_type'] ) . ': ' . $SASHA->format_days( $row['days'], 'binary', 'html' ) . ')</option>' . "\n";
}
+ $Database->free_result( $result );
+
print "\t\t\t" . '</select>' . "\n";
}
Modified: trunk/SASHA/inc/lib/lib.home.php
===================================================================
--- trunk/SASHA/inc/lib/lib.home.php 2009-12-30 22:48:00 UTC (rev 76)
+++ trunk/SASHA/inc/lib/lib.home.php 2010-01-04 23:28:21 UTC (rev 77)
@@ -84,6 +84,8 @@
print "\t</ul>\n";
print "\n";
}
+
+ $Database->free_result( $result );
}
/**
@@ -169,6 +171,8 @@
print "\t</ul>\n";
print "\n";
}
+
+ $Database->free_result( $result );
}
}
Modified: trunk/SASHA/inc/lib/lib.schedule.php
===================================================================
--- trunk/SASHA/inc/lib/lib.schedule.php 2009-12-30 22:48:00 UTC (rev 76)
+++ trunk/SASHA/inc/lib/lib.schedule.php 2010-01-04 23:28:21 UTC (rev 77)
@@ -396,6 +396,7 @@
$result = $Database->query( $sql );
$schedule = $Database->fetch_assoc( $result );
+ $Database->free_result( $result );
$course = $this->format_course( $schedule['subject'], $schedule['course'], $institution, FALSE );
@@ -825,6 +826,8 @@
);
}
+ $Database->free_result( $result );
+
$this->print_list_table( ROOT . 'schedule.php', $columns, $headers, $rows );
}
}
Modified: trunk/SASHA/inc/lib/lib.sessions.php
===================================================================
--- trunk/SASHA/inc/lib/lib.sessions.php 2009-12-30 22:48:00 UTC (rev 76)
+++ trunk/SASHA/inc/lib/lib.sessions.php 2010-01-04 23:28:21 UTC (rev 77)
@@ -75,6 +75,8 @@
if( !$Database->has_result( $result ) )
{
+ $Database->free_result( $result );
+
return FALSE;
}
@@ -86,6 +88,8 @@
$hash_pieces[1 - $first] = rand();
}
+ $Database->free_result( $result );
+
return sha1( implode( $hash_pieces ) );
}
@@ -232,6 +236,8 @@
$this->user_id = USER_ANONYMOUS;
$this->logged_in = FALSE;
+ $Database->free_result( $result );
+
return $this->create_session();
}
@@ -241,6 +247,8 @@
$this->logged_in = ( $row['user_id'] > USER_ANONYMOUS ) ? TRUE : FALSE;
}
+ $Database->free_result( $result );
+
return $session_hash;
}
@@ -329,6 +337,8 @@
if( !$Database->has_result( $result ) )
{
+ $Database->free_result( $result );
+
return FALSE;
}
@@ -345,6 +355,8 @@
}
}
+ $Database->free_result( $result );
+
return $this->logged_in;
}
Modified: trunk/SASHA/inc/lib/lib.tests.php
===================================================================
--- trunk/SASHA/inc/lib/lib.tests.php 2009-12-30 22:48:00 UTC (rev 76)
+++ trunk/SASHA/inc/lib/lib.tests.php 2010-01-04 23:28:21 UTC (rev 77)
@@ -43,8 +43,12 @@
$start_date = mktime( (int) $start_date_time['hour'], (int) $start_date_time['minute'], 0, (int) $_POST['start_date']['month'], (int) $_POST['start_date']['day'], (int) $_POST['start_date']['year'] );
$end_date = mktime( (int) $end_date_time['hour'], (int) $end_date_time['minute'], 0, (int) $_POST['end_date']['month'], (int) $_POST['end_date']['day'], (int) $_POST['end_date']['year'] );
- if( $test_name )
+ if( $end_date <= $start_date )
{
+ print_message( 'bad', 'End date must come after start date.', 'Addition failed.' );
+ }
+ elseif( $test_name )
+ {
$sql = "INSERT INTO tests ( user_id, schedule_id, test_type, test_name, description, start_date, end_date )
VALUES ( {$User->user_info['id']}, $schedule_id, $test_type, '$test_name', '$description', $start_date, $end_date )";
@@ -143,8 +147,12 @@
$score = ( $possible_score ) ? ( ( ( $received_score ) ? ', received_score = ' . $received_score : '' ) . ', possible_score = ' . $possible_score ) : '';
- if( $test_name )
+ if( $end_date <= $start_date )
{
+ print_message( 'bad', 'End date must come after start date.', 'Update failed.' );
+ }
+ elseif( $test_name )
+ {
$sql = "UPDATE tests
SET schedule_id = $schedule_id, test_type = $test_type, test_name = '$test_name', description = '$description', start_date = $start_date, end_date = $end_date
$score
@@ -181,6 +189,7 @@
$result = $Database->query( $sql );
$test = $Database->fetch_assoc( $result );
+ $Database->free_result( $result );
print "\t" . '<h2>Edit Test</h2>' . "\n";
@@ -429,6 +438,8 @@
);
}
+ $Database->free_result( $result );
+
$this->print_list_table( ROOT . 'tests.php', $columns, $headers, $rows );
}
}
Modified: trunk/SASHA/inc/lib/lib.user.php
===================================================================
--- trunk/SASHA/inc/lib/lib.user.php 2009-12-30 22:48:00 UTC (rev 76)
+++ trunk/SASHA/inc/lib/lib.user.php 2010-01-04 23:28:21 UTC (rev 77)
@@ -71,6 +71,8 @@
}
}
+ $Database->free_result( $result );
+
return $this->user_info;
}
@@ -93,6 +95,7 @@
$result = $Database->query( $sql );
$username = $Database->fetch_assoc( $result );
+ $Database->free_result( $result );
if( !empty( $username ) )
{
@@ -165,6 +168,7 @@
$result = $Database->query( $sql );
$email_address = $Database->fetch_assoc( $result );
+ $Database->free_result( $result );
if( !empty( $email_address ) )
{
Modified: trunk/SASHA/index.php
===================================================================
--- trunk/SASHA/index.php 2009-12-30 22:48:00 UTC (rev 76)
+++ trunk/SASHA/index.php 2010-01-04 23:28:21 UTC (rev 77)
@@ -23,14 +23,14 @@
$page_title = 'Index';
$tab = 'home';
-include( ROOT . 'inc/inc.main.php' );
+require( ROOT . 'inc/inc.main.php' );
/**
* Include the style header, required for proper page output.
*/
include( ROOT . 'style/default/header.php' );
-include( ROOT . 'inc/lib/lib.home.php' );
+require( ROOT . 'inc/lib/lib.home.php' );
$SASHA = new Home();
@@ -82,7 +82,7 @@
/**
* Output this month's calendar by default.
*/
-include( ROOT . 'inc/lib/lib.calendar.php' );
+require( ROOT . 'inc/lib/lib.calendar.php' );
$Calendar = new Calendar_Monthly( date( 'Y' ), date( 'n' ), date( 'j' ) );
Modified: trunk/SASHA/install/index.php
===================================================================
--- trunk/SASHA/install/index.php 2009-12-30 22:48:00 UTC (rev 76)
+++ trunk/SASHA/install/index.php 2010-01-04 23:28:21 UTC (rev 77)
@@ -15,7 +15,7 @@
header( 'Content-Type: text/html; charset=UTF-8' );
-include( ROOT . 'inc/inc.main.php' );
+require( ROOT . 'inc/inc.main.php' );
// Number of steps in installation
$steps = 10;
Modified: trunk/SASHA/install/schema/mysql.sql
===================================================================
--- trunk/SASHA/install/schema/mysql.sql 2009-12-30 22:48:00 UTC (rev 76)
+++ trunk/SASHA/install/schema/mysql.sql 2010-01-04 23:28:21 UTC (rev 77)
@@ -180,6 +180,7 @@
full_name tinytext NOT NULL,
preferred_name tinytext NOT NULL,
default_institution varchar(63) NOT NULL,
+ registration_date int(10) unsigned zerofill NOT NULL,
user_type int(11) NOT NULL,
PRIMARY KEY (user_id),
UNIQUE KEY username (username),
Modified: trunk/SASHA/login.php
===================================================================
--- trunk/SASHA/login.php 2009-12-30 22:48:00 UTC (rev 76)
+++ trunk/SASHA/login.php 2010-01-04 23:28:21 UTC (rev 77)
@@ -24,7 +24,7 @@
$page_title = 'Login';
$tab = 'login';
-include( ROOT . 'inc/inc.main.php' );
+require( ROOT . 'inc/inc.main.php' );
/**
* Include the style header, required for proper page output.
Modified: trunk/SASHA/register.php
===================================================================
--- trunk/SASHA/register.php 2009-12-30 22:48:00 UTC (rev 76)
+++ trunk/SASHA/register.php 2010-01-04 23:28:21 UTC (rev 77)
@@ -24,7 +24,7 @@
$page_title = 'Register';
$tab = 'register';
-include( ROOT . 'inc/inc.main.php' );
+require( ROOT . 'inc/inc.main.php' );
/**
* Include the style header, required for proper page output.
Modified: trunk/SASHA/schedule.php
===================================================================
--- trunk/SASHA/schedule.php 2009-12-30 22:48:00 UTC (rev 76)
+++ trunk/SASHA/schedule.php 2010-01-04 23:28:21 UTC (rev 77)
@@ -23,7 +23,7 @@
$page_title = 'Schedule';
$tab = 'schedule';
-include( ROOT . 'inc/inc.main.php' );
+require( ROOT . 'inc/inc.main.php' );
$mode = ( exists( $_REQUEST['mode'] ) ) ? $_REQUEST['mode'] : 'view';
@@ -54,7 +54,7 @@
/**
* Output current user's schedule.
*/
-include( ROOT . 'inc/lib/lib.schedule.php' );
+require( ROOT . 'inc/lib/lib.schedule.php' );
$SASHA = new Schedule();
Modified: trunk/SASHA/style/default/footer.php
===================================================================
--- trunk/SASHA/style/default/footer.php 2009-12-30 22:48:00 UTC (rev 76)
+++ trunk/SASHA/style/default/footer.php 2010-01-04 23:28:21 UTC (rev 77)
@@ -6,18 +6,24 @@
* This is the style footer for all pages.
*
* @package SASHA
- * @copyright (C) 2006-2009 Gordon P. Hemsley
+ * @copyright (C) 2006-2010 Gordon P. Hemsley
* @license docs/LICENSE BSD License
* @version $Id$
*/
+if( !defined( 'ROOT' ) )
+{
+ exit;
+}
+
+@require_once( ROOT . 'inc/inc.main.php' );
+
?>
-
</div>
<div id="copyright">
<p><a href="http://sasha.sourceforge.net/">Student Assignment, Scheduling, and Homework Assistant</a></p>
- <p>Copyright © 2006–2009 <a href="mailto:gph...@us...">Gordon P. Hemsley</a></p>
+ <p>Copyright © 2006–2010 <a href="mailto:gph...@us...">Gordon P. Hemsley</a></p>
</div>
<div id="debug">
Modified: trunk/SASHA/style/default/header.php
===================================================================
--- trunk/SASHA/style/default/header.php 2009-12-30 22:48:00 UTC (rev 76)
+++ trunk/SASHA/style/default/header.php 2010-01-04 23:28:21 UTC (rev 77)
@@ -11,6 +11,13 @@
* @version $Id$
*/
+if( !defined( 'ROOT' ) )
+{
+ exit;
+}
+
+@require_once( ROOT . 'inc/inc.main.php' );
+
header( 'Content-Type: text/html; charset=UTF-8' );
if( !isset( $tab ) )
@@ -95,4 +102,14 @@
</ul>
</div>
+<?php
+
+if( !empty( $config['message']['message'] ) )
+{
+ print '<div id="global-msg">' . "\n";
+ print_message( $config['message']['type'], $config['message']['message'], $config['message']['title'] );
+ print '</div>' . "\n\n";
+}
+
+?>
<div id="page-content">
Modified: trunk/SASHA/style/default/screen.css
===================================================================
--- trunk/SASHA/style/default/screen.css 2009-12-30 22:48:00 UTC (rev 76)
+++ trunk/SASHA/style/default/screen.css 2010-01-04 23:28:21 UTC (rev 77)
@@ -113,6 +113,12 @@
border: 1px solid red;
}
+p.message.system {
+ background-color: #C0CBFF; /* blue counterpart of pink */
+ color: black;
+ border: 1px solid blue;
+}
+
p.message.good strong {
background-color: transparent;
color: darkgreen;
@@ -123,6 +129,11 @@
color: darkred;
}
+p.message.system strong {
+ background-color: transparent;
+ color: darkblue;
+}
+
table {
padding: 0px;
border: 1px solid black;
@@ -254,7 +265,7 @@
color: white;
}
-#page-content {
+#global-msg, #page-content {
width: 96%;
margin: 0% auto;
}
@@ -270,6 +281,10 @@
padding: 0.5em 0em 1em;
}
+#global-msg + #page-content > #sub-nav {
+ margin-top: -1em;
+}
+
#sub-nav ul {
margin: 1em auto;
padding: 0em;
Modified: trunk/SASHA/tests.php
===================================================================
--- trunk/SASHA/tests.php 2009-12-30 22:48:00 UTC (rev 76)
+++ trunk/SASHA/tests.php 2010-01-04 23:28:21 UTC (rev 77)
@@ -23,7 +23,7 @@
$page_title = 'Tests';
$tab = 'tests';
-include( ROOT . 'inc/inc.main.php' );
+require( ROOT . 'inc/inc.main.php' );
$mode = ( exists( $_REQUEST['mode'] ) ) ? $_REQUEST['mode'] : 'view';
@@ -54,7 +54,7 @@
/**
* Output current user's tests.
*/
-include( ROOT . 'inc/lib/lib.tests.php' );
+require( ROOT . 'inc/lib/lib.tests.php' );
$SASHA = new Tests();
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <gph...@us...> - 2009-12-30 22:48:06
|
Revision: 76
http://sasha.svn.sourceforge.net/sasha/?rev=76&view=rev
Author: gphemsley
Date: 2009-12-30 22:48:00 +0000 (Wed, 30 Dec 2009)
Log Message:
-----------
Add ability to keep track of user registration date.
Make usernames case-insensitive.
Add rounded corners for tabs, buttons, and headers (in browsers that support them).
Clean up some redundant CSS.
Modified Paths:
--------------
trunk/SASHA/inc/lib/lib.sessions.php
trunk/SASHA/inc/lib/lib.user.php
trunk/SASHA/style/default/screen.css
Modified: trunk/SASHA/inc/lib/lib.sessions.php
===================================================================
--- trunk/SASHA/inc/lib/lib.sessions.php 2009-11-21 21:55:46 UTC (rev 75)
+++ trunk/SASHA/inc/lib/lib.sessions.php 2009-12-30 22:48:00 UTC (rev 76)
@@ -323,7 +323,7 @@
$sql = "SELECT user_id, username, password
FROM users
- WHERE username = '" . $Database->escape( $username ) . "'";
+ WHERE username = '" . $Database->escape( strtolower( $username ) ) . "'";
$result = $Database->query( $sql );
Modified: trunk/SASHA/inc/lib/lib.user.php
===================================================================
--- trunk/SASHA/inc/lib/lib.user.php 2009-11-21 21:55:46 UTC (rev 75)
+++ trunk/SASHA/inc/lib/lib.user.php 2009-12-30 22:48:00 UTC (rev 76)
@@ -260,8 +260,8 @@
return FALSE;
}
- $sql = "INSERT INTO users ( username, password, email_address, full_name, preferred_name, default_institution )
- VALUES ( '" . $Database->escape( $username ) . "', '" . sha1( $password ) . "', '" . $Database->escape( $email_address ) . "', '" . $Database->escape( $full_name ) . "', '" . $Database->escape( $preferred_name ) . "', '" . $Database->escape( $default_institution ) . "' )";
+ $sql = "INSERT INTO users ( username, password, email_address, full_name, preferred_name, default_institution, registration_date, user_type )
+ VALUES ( '" . $Database->escape( strtolower( $username ) ) . "', '" . sha1( $password ) . "', '" . $Database->escape( $email_address ) . "', '" . $Database->escape( $full_name ) . "', '" . $Database->escape( $preferred_name ) . "', '" . $Database->escape( $default_institution ) . "', " . time() . ', ' . UT_STUDENT . ' )';
if( $result = $Database->query( $sql ) )
{
Modified: trunk/SASHA/style/default/screen.css
===================================================================
--- trunk/SASHA/style/default/screen.css 2009-11-21 21:55:46 UTC (rev 75)
+++ trunk/SASHA/style/default/screen.css 2009-12-30 22:48:00 UTC (rev 76)
@@ -153,11 +153,17 @@
/**
* Header on every page
*/
-div#header {
+#header {
background-color: #660066;
color: white;
width: 96%;
margin: auto;
+ border-top-left-radius: 1%;
+ border-top-right-radius: 1%;
+ -moz-border-radius-topleft: 1%;
+ -moz-border-radius-topright: 1%;
+ -webkit-border-top-left-radius: 1%;
+ -webkit-border-top-right-radius: 1%;
padding: 0.5em 0em;
text-align: center;
}
@@ -220,6 +226,12 @@
padding: 0em;
height: 100%;
border: 1px solid black;
+ border-top-left-radius: 1em;
+ border-top-right-radius: 1em;
+ -moz-border-radius-topleft: 1em;
+ -moz-border-radius-topright: 1em;
+ -webkit-border-top-left-radius: 1em;
+ -webkit-border-top-right-radius: 1em;
background-color: #FF99FF;
color: black;
}
@@ -228,6 +240,12 @@
height: 100%;
width: 100%;
margin: 0px;
+ border-top-left-radius: 1em;
+ border-top-right-radius: 1em;
+ -moz-border-radius-topleft: 1em;
+ -moz-border-radius-topright: 1em;
+ -webkit-border-top-left-radius: 1em;
+ -webkit-border-top-right-radius: 1em;
padding: 0em 2em;
}
@@ -264,6 +282,9 @@
padding: 0.5em 0em;
height: 100%;
border: 1px solid black;
+ border-radius: 0.5em;
+ -moz-border-radius: 0.5em;
+ -webkit-border-radius: 0.5em;
background-color: #FFDDFF;
color: black;
}
@@ -272,6 +293,9 @@
height: 100%;
width: 100%;
margin: 0px;
+ border-radius: 0.5em;
+ -moz-border-radius: 0.5em;
+ -webkit-border-radius: 0.5em;
padding: 0.5em 2em;
}
@@ -407,35 +431,35 @@
/**
* Footer on every page
*/
-div#copyright, div#debug {
+#copyright, #debug {
clear: both;
text-align: center;
margin: auto;
padding-top: 1em;
}
-div#copyright {
+#copyright {
font-size: small;
}
-div#debug {
+#debug {
font-size: x-small;
}
-div#copyright p, div#debug p {
+#copyright p, #debug p {
margin: 0px;
}
/**
* Home page styling (task lists)
*/
-div#left-column, div#center-column, div#right-column {
+#left-column, #center-column, #right-column {
float: left;
width: 31.698%;
border-left: 1px solid #7F007F;
padding: 0% 0.75%;
}
-div#right-column {
+#right-column {
float: right;
}
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <gph...@us...> - 2009-11-21 21:55:54
|
Revision: 75
http://sasha.svn.sourceforge.net/sasha/?rev=75&view=rev
Author: gphemsley
Date: 2009-11-21 21:55:46 +0000 (Sat, 21 Nov 2009)
Log Message:
-----------
Remove colors from 'courses' table. (They're already available in the 'schedules' table.)
Add $config['server'] variables to specify domain and path of installations. (Currently only path is used, for cookies.)
Improve UI for view/add link buttons.
Assume that tests that already have a grade have been completed, so don't show them on the Home page.
Add hover/focus indicator for navigation links.
Add fallback styling for table rows if browser doesn't support counters.
Fix bold styling for h4 headers.
Modified Paths:
--------------
trunk/SASHA/assignments.php
trunk/SASHA/config/config.default.php
trunk/SASHA/inc/lib/lib.assignments.php
trunk/SASHA/inc/lib/lib.home.php
trunk/SASHA/inc/lib/lib.schedule.php
trunk/SASHA/inc/lib/lib.sessions.php
trunk/SASHA/inc/lib/lib.tests.php
trunk/SASHA/install/schema/mysql.sql
trunk/SASHA/schedule.php
trunk/SASHA/style/default/screen.css
trunk/SASHA/tests.php
Modified: trunk/SASHA/assignments.php
===================================================================
--- trunk/SASHA/assignments.php 2009-09-30 15:29:30 UTC (rev 74)
+++ trunk/SASHA/assignments.php 2009-11-21 21:55:46 UTC (rev 75)
@@ -35,7 +35,7 @@
case 'add':
$page_title .= ' :: Add Assignment';
break;
-
+
case 'edit':
$page_title .= ' :: Edit Assignment';
break;
@@ -63,9 +63,25 @@
$institution_url = ( $SASHA->institution ) ? '&institution=' . $SASHA->institution : '';
$semester_url = ( $SASHA->semester ) ? '&semester=' . $SASHA->semester : '';
+$sub_nav = array(
+ 'view' => array(
+ 'title' => 'View Assignments',
+ 'url' => ROOT . 'assignments.php?mode=view' . $institution_url . $semester_url
+ ),
+ 'add' => array(
+ 'title' => 'Add Assignment',
+ 'url' => ROOT . 'assignments.php?mode=add' . $institution_url . $semester_url
+ )
+);
+
?>
-<p style="text-align: center;"><a href="<?php print ROOT; ?>assignments.php?mode=view<?php print $institution_url . $semester_url; ?>">View</a> | <a href="<?php print ROOT; ?>assignments.php?mode=add<?php print $institution_url . $semester_url; ?>">Add</a></p>
+<div id="sub-nav">
+ <ul>
+ <li><a href="<?php print ROOT; ?>assignments.php?mode=view<?php print $institution_url . $semester_url; ?>">View</a></li>
+ <li><a href="<?php print ROOT; ?>assignments.php?mode=add<?php print $institution_url . $semester_url; ?>">Add</a></li>
+ </ul>
+</div>
<div id="assignments">
<?php
@@ -75,7 +91,7 @@
case 'add':
$SASHA->add_assignment();
break;
-
+
case 'edit':
$SASHA->edit_assignment( $assignment_id );
break;
Modified: trunk/SASHA/config/config.default.php
===================================================================
--- trunk/SASHA/config/config.default.php 2009-09-30 15:29:30 UTC (rev 74)
+++ trunk/SASHA/config/config.default.php 2009-11-21 21:55:46 UTC (rev 75)
@@ -25,6 +25,12 @@
$config['db']['database'] = 'sasha';
/**
+ * Information about the server setup.
+ */
+$config['server']['domain'] = 'localhost';
+$config['server']['path'] = '/';
+
+/**
* Global default institution, in case user-specific information is not available.
*/
$config['default_institution'] = 'uvm';
Modified: trunk/SASHA/inc/lib/lib.assignments.php
===================================================================
--- trunk/SASHA/inc/lib/lib.assignments.php 2009-09-30 15:29:30 UTC (rev 74)
+++ trunk/SASHA/inc/lib/lib.assignments.php 2009-11-21 21:55:46 UTC (rev 75)
@@ -158,7 +158,7 @@
}
}
- $sql = "SELECT a.*, s.*, c.course_title, c.bg_color, c.text_color
+ $sql = "SELECT a.*, s.*, c.course_title
FROM assignments a, schedules s
LEFT JOIN ( institutions i, courses c )
ON ( i.institution = c.institution
@@ -304,7 +304,7 @@
'content' => 'Status'
);
- $sql = "SELECT a.*, s.*, c.course_title, c.bg_color, c.text_color
+ $sql = "SELECT a.*, s.*, c.course_title
FROM assignments a, schedules s
LEFT JOIN ( institutions i, courses c )
ON ( i.institution = c.institution
Modified: trunk/SASHA/inc/lib/lib.home.php
===================================================================
--- trunk/SASHA/inc/lib/lib.home.php 2009-09-30 15:29:30 UTC (rev 74)
+++ trunk/SASHA/inc/lib/lib.home.php 2009-11-21 21:55:46 UTC (rev 75)
@@ -50,7 +50,7 @@
$where_lower_status = "AND a.status >= $lower_status";
}
- $sql = "SELECT a.*, s.*, c.course_title, c.bg_color, c.text_color
+ $sql = "SELECT a.*, s.*, c.course_title
FROM assignments a, schedules s
LEFT JOIN ( institutions i, courses c )
ON ( i.institution = c.institution
@@ -102,7 +102,7 @@
{
global $Database, $User;
- $sql = "SELECT t.*, s.*, c.course_title, c.bg_color, c.text_color
+ $sql = "SELECT t.*, s.*, c.course_title
FROM tests t, schedules s
LEFT JOIN ( institutions i, courses c )
ON ( i.institution = c.institution
@@ -118,6 +118,10 @@
OR ( t.end_date <= $end_date
AND t.end_date > $begin_date )
)
+ AND (
+ t.possible_score = 0
+ OR t.possible_score IS NULL
+ )
ORDER BY t.start_date ASC, t.end_date ASC, s.start_time ASC, s.end_time ASC, t.test_name ASC";
$result = $Database->query( $sql );
Modified: trunk/SASHA/inc/lib/lib.schedule.php
===================================================================
--- trunk/SASHA/inc/lib/lib.schedule.php 2009-09-30 15:29:30 UTC (rev 74)
+++ trunk/SASHA/inc/lib/lib.schedule.php 2009-11-21 21:55:46 UTC (rev 75)
@@ -742,7 +742,7 @@
'content' => 'End Time'
);
- $sql = "SELECT s.*, c.course_title, c.bg_color, c.text_color
+ $sql = "SELECT s.*, c.course_title
FROM schedules s
LEFT JOIN ( institutions i, courses c )
ON ( i.institution = c.institution
Modified: trunk/SASHA/inc/lib/lib.sessions.php
===================================================================
--- trunk/SASHA/inc/lib/lib.sessions.php 2009-09-30 15:29:30 UTC (rev 74)
+++ trunk/SASHA/inc/lib/lib.sessions.php 2009-11-21 21:55:46 UTC (rev 75)
@@ -116,6 +116,7 @@
final protected function create_session( $user_id = USER_ANONYMOUS, $secure = 0 )
{
global $Database;
+ global $config;
// A secure session requires expiration of older, existing sessions.
if( $secure )
@@ -132,7 +133,8 @@
if( $result = $Database->query( $sql ) )
{
- setcookie( 'SASHA_session_hash', $session_hash, $time_then, '', '', FALSE, TRUE );
+// setcookie( 'SASHA_session_hash', $session_hash, $time_then, $config['server']['path'], $config['server']['domain'], FALSE, TRUE );
+ setcookie( 'SASHA_session_hash', $session_hash, $time_then, $config['server']['path'], '', FALSE, TRUE );
$this->user_id = $user_id;
$this->logged_in = ( $user_id > USER_ANONYMOUS ) ? TRUE : FALSE;
@@ -161,6 +163,7 @@
final protected function update_session( $session_hash, $user_id, $secure = FALSE )
{
global $Database;
+ global $config;
if( !$this->validate_hash( $session_hash ) )
{
@@ -182,7 +185,8 @@
if( $result = $Database->query( $sql ) )
{
- setcookie( 'SASHA_session_hash', $session_hash, $time_then, '', '', FALSE, TRUE );
+// setcookie( 'SASHA_session_hash', $session_hash, $time_then, $config['server']['path'], $config['server']['domain'], FALSE, TRUE );
+ setcookie( 'SASHA_session_hash', $session_hash, $time_then, $config['server']['path'], '', FALSE, TRUE );
$this->user_id = $user_id;
$this->logged_in = ( $user_id > USER_ANONYMOUS ) ? TRUE : FALSE;
Modified: trunk/SASHA/inc/lib/lib.tests.php
===================================================================
--- trunk/SASHA/inc/lib/lib.tests.php 2009-09-30 15:29:30 UTC (rev 74)
+++ trunk/SASHA/inc/lib/lib.tests.php 2009-11-21 21:55:46 UTC (rev 75)
@@ -167,7 +167,7 @@
}
}
- $sql = "SELECT t.*, s.*, c.course_title, c.bg_color, c.text_color
+ $sql = "SELECT t.*, s.*, c.course_title
FROM tests t, schedules s
LEFT JOIN ( institutions i, courses c )
ON ( i.institution = c.institution
@@ -340,7 +340,7 @@
'content' => 'Score'
);
- $sql = "SELECT t.*, s.*, c.course_title, c.bg_color, c.text_color
+ $sql = "SELECT t.*, s.*, c.course_title
FROM tests t, schedules s
LEFT JOIN ( institutions i, courses c )
ON ( i.institution = c.institution
Modified: trunk/SASHA/install/schema/mysql.sql
===================================================================
--- trunk/SASHA/install/schema/mysql.sql 2009-09-30 15:29:30 UTC (rev 74)
+++ trunk/SASHA/install/schema/mysql.sql 2009-11-21 21:55:46 UTC (rev 75)
@@ -38,10 +38,7 @@
`subject` varchar(5) NOT NULL,
course smallint(4) unsigned zerofill NOT NULL,
course_title varchar(255) NOT NULL,
- text_color char(6) default NULL,
- bg_color char(6) default NULL,
PRIMARY KEY (institution,`subject`,course),
- KEY colors (text_color,bg_color)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
# ############################
Modified: trunk/SASHA/schedule.php
===================================================================
--- trunk/SASHA/schedule.php 2009-09-30 15:29:30 UTC (rev 74)
+++ trunk/SASHA/schedule.php 2009-11-21 21:55:46 UTC (rev 75)
@@ -35,7 +35,7 @@
case 'add':
$page_title .= ' :: Add Schedule';
break;
-
+
case 'edit':
$page_title .= ' :: Edit Schedule';
break;
@@ -63,9 +63,25 @@
$institution_url = ( $SASHA->institution ) ? '&institution=' . $SASHA->institution : '';
$semester_url = ( $SASHA->semester ) ? '&semester=' . $SASHA->semester : '';
+$sub_nav = array(
+ 'view' => array(
+ 'title' => 'View Schedule',
+ 'url' => ROOT . 'schedule.php?mode=view' . $institution_url . $semester_url
+ ),
+ 'add' => array(
+ 'title' => 'Add Schedule Item',
+ 'url' => ROOT . 'schedule.php?mode=add' . $institution_url . $semester_url
+ )
+);
+
?>
-<p style="text-align: center;"><a href="<?php print ROOT; ?>schedule.php?mode=view<?php print $institution_url . $semester_url; ?>">View</a> | <a href="<?php print ROOT; ?>schedule.php?mode=add<?php print $institution_url . $semester_url; ?>">Add</a></p>
+<div id="sub-nav">
+ <ul>
+ <li><a href="<?php print ROOT; ?>schedule.php?mode=view<?php print $institution_url . $semester_url; ?>">View</a></li>
+ <li><a href="<?php print ROOT; ?>schedule.php?mode=add<?php print $institution_url . $semester_url; ?>">Add</a></li>
+ </ul>
+</div>
<div id="schedule">
<?php
@@ -75,7 +91,7 @@
case 'add':
$SASHA->add_schedule();
break;
-
+
case 'edit':
$SASHA->edit_schedule( $schedule_id );
break;
Modified: trunk/SASHA/style/default/screen.css
===================================================================
--- trunk/SASHA/style/default/screen.css 2009-09-30 15:29:30 UTC (rev 74)
+++ trunk/SASHA/style/default/screen.css 2009-11-21 21:55:46 UTC (rev 75)
@@ -72,7 +72,7 @@
h4 {
font-size: 100%; /* 12pt; */
- font-weight: stronger;
+ font-weight: bolder;
text-decoration: underline;
}
@@ -197,7 +197,7 @@
color: white;
}
-div#navigation {
+#navigation {
background-color: #660066;
color: white;
width: 96%;
@@ -207,13 +207,13 @@
border-bottom: 1px solid black;
}
-div#navigation ul {
+#navigation ul {
margin: 0px auto;
padding: 0px;
width: 75%;
}
-div#navigation ul li {
+#navigation ul li {
display: inline;
white-space: nowrap;
margin: 0px;
@@ -224,14 +224,14 @@
color: black;
}
-div#navigation ul li a {
+#navigation ul li a {
+ height: 100%;
+ width: 100%;
margin: 0px;
padding: 0em 2em;
- height: 100%;
- width: 100%;
}
-div#navigation ul li.selected a {
+#navigation ul li.selected a, #navigation ul li:hover a, #navigation ul li:focus a {
background-color: #990099;
color: white;
}
@@ -245,6 +245,41 @@
margin: 0% auto;
}
+#sub-nav {
+ width: 96%;
+ text-align: center;
+ margin: auto;
+ padding: 0.5em 0em 1em;
+}
+
+#sub-nav ul {
+ margin: 1em auto;
+ padding: 0em;
+}
+
+#sub-nav ul li {
+ display: inline;
+ white-space: nowrap;
+ margin: 0em 0.25em;
+ padding: 0.5em 0em;
+ height: 100%;
+ border: 1px solid black;
+ background-color: #FFDDFF;
+ color: black;
+}
+
+#sub-nav ul li a {
+ height: 100%;
+ width: 100%;
+ margin: 0px;
+ padding: 0.5em 2em;
+}
+
+#sub-nav ul li.selected a, #sub-nav ul li:hover a, #sub-nav ul li:focus a {
+ background-color: #994499;
+ color: white;
+}
+
/**
* Semester navigation
*/
@@ -348,6 +383,11 @@
padding: 0.25em;
}
+table.list td.edit {
+ background-color: #FFEEFF;
+ color: black;
+}
+
table.list tr:nth-child(odd), table.list tr:nth-child(odd) td.edit {
background-color: #FFEEFF;
color: black;
Modified: trunk/SASHA/tests.php
===================================================================
--- trunk/SASHA/tests.php 2009-09-30 15:29:30 UTC (rev 74)
+++ trunk/SASHA/tests.php 2009-11-21 21:55:46 UTC (rev 75)
@@ -35,7 +35,7 @@
case 'add':
$page_title .= ' :: Add Test';
break;
-
+
case 'edit':
$page_title .= ' :: Edit Test';
break;
@@ -63,9 +63,25 @@
$institution_url = ( $SASHA->institution ) ? '&institution=' . $SASHA->institution : '';
$semester_url = ( $SASHA->semester ) ? '&semester=' . $SASHA->semester : '';
+$sub_nav = array(
+ 'view' => array(
+ 'title' => 'View Tests',
+ 'url' => ROOT . 'tests.php?mode=view' . $institution_url . $semester_url
+ ),
+ 'add' => array(
+ 'title' => 'Add Test',
+ 'url' => ROOT . 'tests.php?mode=add' . $institution_url . $semester_url
+ )
+);
+
?>
-<p style="text-align: center;"><a href="<?php print ROOT; ?>tests.php?mode=view<?php print $institution_url . $semester_url; ?>">View</a> | <a href="<?php print ROOT; ?>tests.php?mode=add<?php print $institution_url . $semester_url; ?>">Add</a></p>
+<div id="sub-nav">
+ <ul>
+ <li><a href="<?php print ROOT; ?>tests.php?mode=view<?php print $institution_url . $semester_url; ?>">View</a></li>
+ <li><a href="<?php print ROOT; ?>tests.php?mode=add<?php print $institution_url . $semester_url; ?>">Add</a></li>
+ </ul>
+</div>
<div id="tests">
<?php
@@ -75,7 +91,7 @@
case 'add':
$SASHA->add_test();
break;
-
+
case 'edit':
$SASHA->edit_test( $test_id );
break;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <gph...@us...> - 2009-09-30 15:29:37
|
Revision: 74
http://sasha.svn.sourceforge.net/sasha/?rev=74&view=rev
Author: gphemsley
Date: 2009-09-30 15:29:30 +0000 (Wed, 30 Sep 2009)
Log Message:
-----------
Fix copy-and-paste error that made User::_check_email_address_availability() fail.
Make note about compatibility issues regarding the 'bit' field type between MySQL 5.0 and 5.1.
Round off test opacity so that there aren't (as) rediculously light tests before they disappear.
Force list tables to fill up the full container space so that the table width doesn't vary as much.
Modified Paths:
--------------
trunk/SASHA/inc/lib/lib.home.php
trunk/SASHA/inc/lib/lib.schedule.php
trunk/SASHA/inc/lib/lib.user.php
trunk/SASHA/style/default/screen.css
Modified: trunk/SASHA/inc/lib/lib.home.php
===================================================================
--- trunk/SASHA/inc/lib/lib.home.php 2009-09-12 17:42:48 UTC (rev 73)
+++ trunk/SASHA/inc/lib/lib.home.php 2009-09-30 15:29:30 UTC (rev 74)
@@ -150,7 +150,7 @@
$test_length = $row['end_date'] - $row['start_date'];
$time_elapsed = $now - $row['start_date'];
- $opacity = 'opacity: ' . ( 1 - ( $time_elapsed / $test_length ) ) . ';';
+ $opacity = 'opacity: ' . round( ( 1 - ( $time_elapsed / $test_length ) ), 3 ) . ';';
}
$li_style .= trim( implode( array( $bg_color, $blink, $opacity ), ' ' ) );
Modified: trunk/SASHA/inc/lib/lib.schedule.php
===================================================================
--- trunk/SASHA/inc/lib/lib.schedule.php 2009-09-12 17:42:48 UTC (rev 73)
+++ trunk/SASHA/inc/lib/lib.schedule.php 2009-09-30 15:29:30 UTC (rev 74)
@@ -402,6 +402,7 @@
switch( $this_step )
{
case 3:
+ // @TODO: MySQL 5.1 returns bit as binary; MySQL 5.0 returns decimal
$sql = "UPDATE schedules
SET institution = '$institution', semester = '$semester', subject = '" . $Database->escape( $this->subject ) . "', course = {$this->course}, section = '" . $Database->escape( $this->section ) . "', section_title = '" . $Database->escape( $this->section_title ) . "', schedule_type = {$this->schedule_type}, days = b'" . $this->format_days( $this->schedule_days, 'decimal', 'binary' ) . "', start_time = {$this->start_time}, end_time = {$this->end_time}, instructors = '" . $this->prepare_instructors( $this->instructors ) . "', parent_schedule_id = {$this->parent_schedule_id}
WHERE schedule_id = $schedule_id";
Modified: trunk/SASHA/inc/lib/lib.user.php
===================================================================
--- trunk/SASHA/inc/lib/lib.user.php 2009-09-12 17:42:48 UTC (rev 73)
+++ trunk/SASHA/inc/lib/lib.user.php 2009-09-30 15:29:30 UTC (rev 74)
@@ -164,7 +164,7 @@
WHERE email_address = '" . $Database->escape( $email_address ) . "'";
$result = $Database->query( $sql );
- $username = $Database->fetch_assoc( $result );
+ $email_address = $Database->fetch_assoc( $result );
if( !empty( $email_address ) )
{
Modified: trunk/SASHA/style/default/screen.css
===================================================================
--- trunk/SASHA/style/default/screen.css 2009-09-12 17:42:48 UTC (rev 73)
+++ trunk/SASHA/style/default/screen.css 2009-09-30 15:29:30 UTC (rev 74)
@@ -131,6 +131,7 @@
table.list {
clear: both;
+ width: 100%;
margin: 1em auto;
padding: 0.25em;
text-align: center;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <gph...@us...> - 2009-09-12 17:42:56
|
Revision: 73
http://sasha.svn.sourceforge.net/sasha/?rev=73&view=rev
Author: gphemsley
Date: 2009-09-12 17:42:48 +0000 (Sat, 12 Sep 2009)
Log Message:
-----------
Update installation instructions to better reflect the current state of SASHA.
Include updated schema for database.
Modified Paths:
--------------
trunk/SASHA/docs/INSTALL
trunk/SASHA/install/schema/mysql.sql
Modified: trunk/SASHA/docs/INSTALL
===================================================================
--- trunk/SASHA/docs/INSTALL 2009-09-12 06:39:10 UTC (rev 72)
+++ trunk/SASHA/docs/INSTALL 2009-09-12 17:42:48 UTC (rev 73)
@@ -1,8 +1,8 @@
------------------------------------------------------------------------------
SASHA :: docs/INSTALL
-
+
Installation instructions.
-
+
Copyright (C) 2006-2009 Gordon P. Hemsley
License: docs/LICENSE (BSD License)
$Id$
@@ -34,15 +34,14 @@
present in config.default.php. Use this file as your template, if you'd like,
but please do not edit it directly.
-3. Add user 1 to database.
+3. Add anonymous user to database.
The current setup of SASHA, in some places, assumes the presence of the user
-with the user_id of 1. As such, it is important that this user be present in
-the database. The password field is not currently used, but it is likely
-designed for use with SHA-1 hashed passwords. The preferred_name field is
-your preferred first name or nickname, for use with greetings along the lines
-of "Hello, John!" or "Welcome back, Liz!" Most of the information in this
-table is not currently used at all.
+with the user_id of -1. As such, it is important that this user be present in
+the database. The password field is designed for use with SHA-1 hashed
+passwords, but the Anonymous user should leave that field blank. It doesn't
+matter much what the fields contain for the anonymous user, but the username
+should be "Anonymous", and the other values should be related to that word.
4. Install institution package.
@@ -51,8 +50,16 @@
data. If you do go through that effort, though, package donations are greatly
appreciated.
-5. Add schedule, assignments, and tests.
+5. Register and log in
+Use the built-in user registration form to create a user. The purpose of each
+field should be fairly straight-forward. The preferred_name field is your
+preferred first name or nickname, for use with greetings along the lines of
+"Hello, John!" or "Welcome back, Liz!". Once registration is complete, you
+may log in.
+
+6. Add schedule, assignments, and tests.
+
These are up to you. They are the whole point of SASHA. Eventually, the plan
is for your course instructors to have these already available to you.
For now, though, you'll have to worry about them yourself.
Modified: trunk/SASHA/install/schema/mysql.sql
===================================================================
--- trunk/SASHA/install/schema/mysql.sql 2009-09-12 06:39:10 UTC (rev 72)
+++ trunk/SASHA/install/schema/mysql.sql 2009-09-12 17:42:48 UTC (rev 73)
@@ -19,13 +19,13 @@
description text NOT NULL,
assigned_date int(10) unsigned NOT NULL,
due_date int(10) unsigned NOT NULL,
- "status" int(4) NOT NULL default '0',
+ `status` int(4) NOT NULL default '0',
PRIMARY KEY (assignment_id),
KEY schedule_id (schedule_id),
KEY assigned_date (assigned_date),
KEY due_date (due_date),
- KEY "status" ("status")
-);
+ KEY `status` (`status`)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
# ############################
@@ -35,14 +35,14 @@
CREATE TABLE courses (
institution varchar(63) NOT NULL,
- "subject" varchar(5) NOT NULL,
+ `subject` varchar(5) NOT NULL,
course smallint(4) unsigned zerofill NOT NULL,
course_title varchar(255) NOT NULL,
text_color char(6) default NULL,
bg_color char(6) default NULL,
- PRIMARY KEY (institution,"subject",course),
+ PRIMARY KEY (institution,`subject`,course),
KEY colors (text_color,bg_color)
-);
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
# ############################
@@ -55,7 +55,7 @@
subject_max_length tinyint(4) NOT NULL,
course_max_length tinyint(3) NOT NULL,
PRIMARY KEY (institution)
-);
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
# ############################
@@ -65,13 +65,13 @@
CREATE TABLE institutions (
institution varchar(63) NOT NULL,
- "name" varchar(255) NOT NULL,
+ `name` varchar(255) NOT NULL,
short_name varchar(100) default NULL,
subdivision char(2) NOT NULL,
country char(2) NOT NULL default 'US',
PRIMARY KEY (institution),
KEY subdivision (subdivision,country)
-);
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
# ############################
@@ -86,14 +86,14 @@
last_name varchar(255) NOT NULL,
first_name varchar(255) NOT NULL,
middle_name varchar(255) NOT NULL,
- "type" varchar(11) NOT NULL,
+ `type` varchar(11) NOT NULL,
type_description varchar(255) default NULL,
PRIMARY KEY (instructor_id),
UNIQUE KEY instructor_key (instructor_key),
KEY institution (institution),
- KEY "type" ("type"),
- KEY "name" (last_name(30),first_name(20),middle_name(2))
-);
+ KEY `type` (`type`),
+ KEY `name` (last_name(30),first_name(20),middle_name(2))
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
# ############################
@@ -103,9 +103,9 @@
CREATE TABLE schedules (
schedule_id int(10) unsigned NOT NULL auto_increment,
- user_id int(10) unsigned NOT NULL,
+ user_id bigint(10) NOT NULL,
institution varchar(36) NOT NULL,
- "subject" varchar(5) NOT NULL,
+ `subject` varchar(5) NOT NULL,
course smallint(4) unsigned zerofill NOT NULL,
semester char(6) NOT NULL,
section varchar(5) NOT NULL,
@@ -120,12 +120,12 @@
text_color char(6) default NULL,
PRIMARY KEY (schedule_id),
KEY institution (institution,course,section),
- KEY "type" (schedule_type),
+ KEY `type` (schedule_type),
KEY user_id (user_id),
KEY semester (semester),
KEY parent_schedule_id (parent_schedule_id),
KEY colors (bg_color,text_color)
-);
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
# ############################
@@ -135,7 +135,7 @@
CREATE TABLE sessions (
session_hash char(40) NOT NULL,
- user_id int(10) unsigned NOT NULL default '0',
+ user_id bigint(10) NOT NULL default '-1',
creation_date int(10) unsigned NOT NULL,
expiration_date int(10) unsigned NOT NULL,
secure tinyint(1) NOT NULL default '0',
@@ -143,7 +143,7 @@
KEY user_id (user_id),
KEY creation (creation_date),
KEY expiration (expiration_date)
-);
+) ENGINE=MEMORY DEFAULT CHARSET=utf8;
# ############################
@@ -167,7 +167,7 @@
KEY score (received_score,possible_score),
KEY test_type (test_type),
KEY test_time (start_date,end_date)
-);
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
# ############################
@@ -176,13 +176,15 @@
#
CREATE TABLE users (
- user_id int(10) unsigned NOT NULL auto_increment,
+ user_id bigint(10) NOT NULL auto_increment,
username varchar(255) NOT NULL,
- "password" varchar(40) NOT NULL,
+ `password` varchar(40) NOT NULL,
+ email_address varchar(320) NOT NULL,
full_name tinytext NOT NULL,
preferred_name tinytext NOT NULL,
default_institution varchar(63) NOT NULL,
+ user_type int(11) NOT NULL,
PRIMARY KEY (user_id),
UNIQUE KEY username (username),
KEY default_institution (default_institution)
-);
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|