예제 #1
0
파일: key.php 프로젝트: HaldunA/phpwebsite
/**
 * unregisters deleted keys from menu
 *
 * @author Matthew McNaney <mcnaney at gmail dot com>
 * @version $Id$
 */
function menu_unregister_key(Key $key)
{
    PHPWS_Core::initModClass('menu', 'Menu_Link.php');
    if (empty($key) || empty($key->id)) {
        return FALSE;
    }
    $db = new PHPWS_DB('menu_links');
    $db->addWhere('key_id', $key->id);
    $result = $db->delete();
    if (PHPWS_Error::isError($result)) {
        PHPWS_Error::log($result);
    }
    $db2 = new PHPWS_DB('menu_assoc');
    $db2->addWhere('key_id', $key->id);
    $result = $db2->delete();
    if (PHPWS_Error::isError($result)) {
        PHPWS_Error::log($result);
    }
    $db3 = new PHPWS_DB('menus');
    $db3->addWhere('assoc_key', $key->id);
    $db3->addValue('assoc_key', 0);
    $db3->addValue('assoc_url', null);
    $db3->update();
    return true;
}
예제 #2
0
 public function save()
 {
     $result = parent::save();
     if (PHPWS_Error::isError($result)) {
         return $result;
     }
     $db = new PHPWS_DB('analytics_tracker_piwik');
     $db->addWhere('id', $this->id);
     $result = $db->select();
     if (PHPWS_Error::logIfError($result)) {
         return $result;
     }
     $db = new PHPWS_DB('analytics_tracker_piwik');
     $db->addValue('id', $this->id);
     $db->addValue('piwik_url', $this->piwik_url);
     $db->addValue('piwik_id', $this->piwik_id);
     if (count($result) < 1) {
         $result = $db->insert(false);
     } else {
         $result = $db->update();
     }
     if (PHPWS_Error::logIfError($result)) {
         return $result;
     }
 }
예제 #3
0
/**
 * @author Matthew McNaney <mcnaney at gmail dot com>
 * @version $Id$
 */
function layout_install(&$content, $branchInstall = FALSE)
{
    $page_title = 'Change this Site Name in Layout Meta Tags';
    $default_theme = 'bootstrap';
    if (!isset($error)) {
        $db = new PHPWS_DB('layout_config');
        $db->addValue('default_theme', $default_theme);
        $db->addValue('page_title', $page_title);
        $db->update();
        $content[] = dgettext('layout', 'Layout settings updated.');
        return true;
    } else {
        return $error;
    }
}
 public static function saveObject(DbStorable $o)
 {
     $vars = $o->extractVars();
     $tableName = $o::getTableName();
     // Check if the key already exists
     $query = "SELECT * FROM {$tableName} WHERE id = {$vars['id']}";
     $result = \PHPWS_DB::getAll($query);
     if (count($result) > 0) {
         $exists = true;
     } else {
         $exists = false;
     }
     $db = new \PHPWS_DB($o->getTableName());
     foreach ($vars as $key => $value) {
         $db->addValue($key, $value);
     }
     if ($exists) {
         $db->addWhere('id', $vars['id']);
         $result = $db->update();
     } else {
         $result = $db->insert(false);
     }
     if (\PHPWS_Error::logIfError($result)) {
         throw new \Exception($result->toString());
     }
 }
예제 #5
0
 /**
  * Saves the current activity log object to the db.
  * Returns TRUE upon succes or a PEAR error object otherwise.
  */
 public function save()
 {
     if ($this->id != 0) {
         return FALSE;
     }
     $db = new PHPWS_DB('hms_activity_log');
     $db->addValue('user_id', $this->get_user_id());
     $db->addValue('timestamp', $this->get_timestamp());
     $db->addValue('activity', $this->get_activity());
     $db->addValue('actor', $this->get_actor());
     $db->addValue('notes', $this->get_notes());
     $result = $db->insert();
     if (PHPWS_Error::logIfError($result)) {
         throw new DatabaseException($result->toString());
     } else {
         return TRUE;
     }
 }
예제 #6
0
/**
 * @version $Id$
 * @author Matthew McNaney <mcnaney at gmail dot com>
 */
function filecabinet_unregister($module, &$content)
{
    $db = new PHPWS_DB('folders');
    $db->addValue('module_created', null);
    $db->addWhere('module_created', $module);
    PHPWS_Error::logIfError($db->update());
    $content[] = dgettext('filecabinet', 'Unregistered from File Cabinet.');
    return true;
}
 public function save()
 {
     $result = parent::save();
     if (PHPWS_Error::isError($result)) {
         return $result;
     }
     $db = new PHPWS_DB('analytics_tracker_owa');
     $db->addWhere('id', $this->id);
     $result = $db->select();
     if (PHPWS_Error::logIfError($result)) {
         return $result;
     }
     $db = new PHPWS_DB('analytics_tracker_owa');
     $db->addValue('id', $this->id);
     $db->addValue('owa_url', $this->owa_url);
     $db->addValue('owa_site_id', $this->owa_site_id);
     $db->addValue('owa_track_page_view', $this->owa_track_page_view);
     $db->addValue('owa_track_clicks', $this->owa_track_clicks);
     $db->addValue('owa_track_domstream', $this->owa_track_domstream);
     if (count($result) < 1) {
         $result = $db->insert(false);
     } else {
         $result = $db->update();
     }
     if (PHPWS_Error::logIfError($result)) {
         return $result;
     }
 }
예제 #8
0
 public function addUser($username, $classname, $instance = null)
 {
     $db = new PHPWS_DB('users');
     $db->addWhere('username', $username);
     $result = $db->select('row');
     if (PHPWS_Error::logIfError($result)) {
         throw new DatabaseException($result->toString());
     }
     if (is_null($result['id'])) {
         throw new InvalidArgumentException('User name "' . $username . '" does not exist.');
     }
     $user_id = $result['id'];
     $db = new PHPWS_DB('hms_user_role');
     $db->addValue('user_id', $user_id);
     $db->addValue('role', $this->id);
     $db->addValue('class', strtolower($classname));
     $db->addValue('instance', $instance);
     $result = $db->insert();
     if (PHPWS_Error::logIfError($result)) {
         throw new DatabaseException($result->toString());
     }
     return true;
 }
예제 #9
0
function purgeProperties()
{
    $last_purge = \PHPWS_Settings::get('properties', 'last_purge') + 86400;
    $current_time = time();
    if ($last_purge < $current_time) {
        \PHPWS_Settings::set('properties', 'last_purge', $current_time);
        \PHPWS_Settings::save('properties');
        $db = new PHPWS_DB('properties');
        $db->addWhere('timeout', time(), '<');
        $db->addValue('active', 0);
        $db->update();
        $db = new PHPWS_DB('prop_roommate');
        $db->addWhere('timeout', time(), '<');
        $db->delete();
    }
}
예제 #10
0
 public function fixDocumentDirectories()
 {
     $directory = PHPWS_Settings::get('filecabinet', 'base_doc_directory');
     $db = new PHPWS_DB('documents');
     $db->addColumn('id');
     $db->addColumn('file_directory');
     $result = $db->select();
     if (empty($result) || PHPWS_Error::logIfError($result)) {
         return;
     }
     foreach ($result as $doc) {
         $db->reset();
         $db->addWhere('id', $doc['id']);
         $old_dir = $doc['file_directory'];
         $old_dir_array = explode('/', $old_dir);
         // space usually at end of array, but just in case
         $last_dir = array_pop($old_dir_array);
         if (empty($last_dir)) {
             $last_dir = array_pop($old_dir_array);
         }
         $new_dir = $directory . $last_dir . '/';
         if (!empty($last_dir)) {
             $db->addWhere('id', $doc['id']);
             $db->addValue('file_directory', $new_dir);
             PHPWS_Error::logIfError($db->update());
         }
     }
 }
예제 #11
0
function createLocalAuthScript()
{
    /*
        if (PHPWS_Settings::get('users', 'local_script')) {
       return true;
        }
    * 
    */
    $db = new PHPWS_DB('users_auth_scripts');
    $db->addValue('display_name', dgettext('users', 'Local'));
    $db->addValue('filename', 'local.php');
    $authorize_id = $db->insert();
    if (PHPWS_Error::logIfError($authorize_id)) {
        return false;
    }
    PHPWS_Settings::set('users', 'default_authorization', $authorize_id);
    PHPWS_Settings::set('users', 'local_script', $authorize_id);
    PHPWS_Settings::save('users');
    return true;
}
예제 #12
0
 public function lottery_reserve($username, $requestor, $timestamp)
 {
     if ($this->is_lottery_reserved()) {
         return FALSE;
     }
     $db = new PHPWS_DB('hms_lottery_reservation');
     $db->addValue('asu_username', $username);
     $db->addValue('requestor', $requestor);
     $db->addValue('term', $this->term);
     $db->addValue('bed_id', $this->id);
     $db->addValue('expires_on', $timestamp);
     $result = $db->insert();
     if (PHPWS_Error::logIfError($result)) {
         throw new DatabaseException($result->toString());
     } else {
         return TRUE;
     }
 }
예제 #13
0
/**
 * @author Matthew McNaney <mcnaney at gmail dot com>
 * @version $Id$
 */
function calendar_update(&$content, $version)
{
    switch ($version) {
        case version_compare($version, '1.2.2', '<'):
            $content[] = 'This package will not update any versions prior to 1.2.2.';
            return false;
        case version_compare($version, '1.3.0', '<'):
            $result = PHPWS_DB::importFile(PHPWS_SOURCE_DIR . 'mod/calendar/boost/sql_update_130.sql');
            if (PHPWS_Error::isError($result)) {
                PHPWS_Error::log($result);
                $content[] = '+ Unable to import new suggestion table.';
                return false;
            } else {
                $files = array('templates/admin/forms/edit_event.tpl', 'templates/view/day.tpl', 'templates/view/week.tpl', 'templates/view/month/grid.tpl', 'templates/view/month/list.tpl', 'templates/style.css', 'templates/user_main.tpl', 'templates/admin/approval.tpl', 'conf/config.php');
                if (PHPWS_Boost::updateFiles($files, 'calendar')) {
                    $content[] = '+ Template files updated successfully.';
                } else {
                    $content[] = '+ Unable to copy template files locally.';
                    $content[] = '<pre>' . implode("\n", $files) . '</pre>';
                }
                $content[] = '+ Suggestion table import successful';
                $content[] = '<pre>
1.3.0 Changes
-------------
+ Added ability to for anonymous users to make event suggestions.
+ Fixed some issues with javascript disabled users unable to make events.
+ First public schedule is made the default on creation.
</pre>';
            }
        case version_compare($version, '1.4.0', '<'):
            $content[] = "<pre>1.4.0 Changes\n-------------";
            $files = array('templates/admin/settings.tpl', 'conf/config.php');
            if (PHPWS_Boost::updateFiles($files, 'calendar')) {
                $content[] = '+ Successfully copied these files locally:';
            } else {
                $content[] = '+ Could not copy these files locally:';
            }
            $content[] = '    ' . implode("\n    ", $files);
            $content[] = '+ Bug #1648965. Clicking Day or Week from grid view pulls correct day
+ Changed "Today" link to view appropiate description to prevent
  confusion
+ Changed time defaults to %p to work with more installs
+ If start date is greater than end date, the event will be saved to
  the save day.
+ Bug #1648963. Fixed mini month not showing days with events.
+ Made event count linkable in grid view
+ Labeled some permissions "unrestricted only"
+ Added permissions checks for editing and deleting
+ Created checkPermissions function in schedule class to simplify code
+ Removed commented legacy code from Schedule.php
+ Added missing suggestion tables to install and uninstall
+ Fixed caching logic
+ Fixed default schedule loading in Calendar class
+ Fixed inability to create more than one schedule
+ Added option to disable month view caching
+ Caching now works on public calendars only.
+ Added translate functions.
+ Updated message translation files.</pre>';
        case version_compare($version, '1.4.1', '<'):
            $content[] = "<pre>1.4.1 Changes\n-------------";
            $files = array('templates/admin/forms/edit_event.tpl', 'javascript/check_date/head.js');
            if (PHPWS_Boost::updateFiles($files, 'calendar')) {
                $content[] = '+ Successfully updated the following files:';
            } else {
                $content[] = '+ Unable to update the following files:';
            }
            $content[] = '    ' . implode("\n    ", $files);
            $content[] = '+ Made noon the default time for new events.
+ Fixed Daylight Saving Time breaking repeats.
+ Delete event links made secure.
+ Days made linkable in month list view.
+ Added a sync dates button on the edit event form.';
        case version_compare($version, '1.5.0', '<'):
            $db = new PHPWS_DB('calendar_schedule');
            $result = $db->addTableColumn('show_upcoming', 'SMALLINT NOT NULL DEFAULT 0');
            if (PHPWS_Error::logIfError($result)) {
                $content[] = '--- Could not create show_upcoming column in calendar_schedule table.';
                return false;
            }
            $content[] = '<pre>';
            $files = array('img/calendar.png', 'conf/config.php', 'templates/admin/forms/edit_schedule.tpl', 'templates/style.css', 'templates/view/upcoming.tpl');
            if (PHPWS_Boost::updateFiles($files, 'calendar')) {
                $content[] = '-- Successfully updated the following files:';
            } else {
                $content[] = '-- Unable to update the following files:';
            }
            $content[] = '    ' . implode("\n    ", $files);
            $content[] = '
1.5.0 Changes
---------------------
+ Can now choose to show upcoming events.
+ Removed schedule created message when using javascript popup
+ Moved getEvents function in the Schedule class
+ Increase calendar event form\'s popup height
+ Reformated schedule form
+ Bug # 1699659 - Calendar will not show "Add Event" link if a
  schedule has not been created. Instead, the "Create schedule" link
  will appear.
+ Updated language format
</pre>';
        case version_compare($version, '1.5.1', '<'):
            $db = new PHPWS_DB('calendar_schedule');
            if (!$db->isTableColumn('show_upcoming')) {
                $result = $db->addTableColumn('show_upcoming', 'SMALLINT NOT NULL DEFAULT 0');
                if (PHPWS_Error::logIfError($result)) {
                    $content[] = '--- Could not create show_upcoming column in calendar_schedule table.</pre>';
                    return false;
                }
            }
            $content[] = '<pre>';
            $files = array('conf/config.php', 'templates/view/month/list.tpl', 'templates/view/day.tpl', 'templates/view/week.tpl');
            if (PHPWS_Boost::updateFiles($files, 'calendar')) {
                $content[] = '-- Successfully updated the following files:';
            } else {
                $content[] = '-- Unable to update the following files:';
            }
            $content[] = '    ' . implode("\n    ", $files);
            $content[] = '
1.5.1 Changes
---------------------
+ 1.5.0 installations sql import was missing the show_upcoming column.
+ Added define to prevent day month year printing on same day events.
+ "Add event" links added to some views.
+ Changed the default hour format to "I" (eye) from l (ell) in
  config.php. Some php configurations do not recognize it.
</pre>';
        case version_compare($version, '1.5.2', '<'):
            $content[] = '<pre>';
            calendarUpdateFiles(array('templates/style.css'), $content);
            $content[] = '1.5.2 changes
-----------
+ Removed calendar colors that matched default theme.
+ Added Spanish translation.</pre>';
        case version_compare($version, '1.5.3', '<'):
            $content[] = '<pre>';
            calendarUpdateFiles(array('templates/style.css'), $content);
            $content[] = '1.5.3 change
-----------
+ Fixed issues with js_calendar.</pre>';
        case version_compare($version, '1.6.0', '<'):
            $content[] = '<pre>';
            $files = array('templates/style.css', 'templates/admin/forms/blog.tpl', 'templates/admin/settings.tpl', 'templates/view/day.tpl', 'templates/view/event.tpl', 'templates/view/month/grid.tpl', 'templates/view/month/list.tpl');
            calendarUpdateFiles($files, $content);
            $content[] = '1.6.0 changes
-------------------
+ Month grid view can be set to show events
+ Calendar events can be posted in the blog
+ Paragraph tag around day message
+ Fixed comment in event tpl preventing bar from disappearing in user
  mode
+ Removed extra message tag from month list view.
+ Applied patch #1813081 from aDarkling</pre>';
        case version_compare($version, '1.6.1', '<'):
            $content[] = '<pre>
1.6.1 changes
-------------
+ Fixed call to absent function in Event.php</pre>';
        case version_compare($version, '1.6.2', '<'):
            $content[] = '<pre>';
            calendarUpdateFiles(array('conf/config.php', 'javascript/check_date/head.js'), $content);
            $content[] = '1.6.2 changes
-------------
+ Added a upcoming date format
+ Fixed: Day view doesn\'t allow you to add an event until you create a schedule.
+ Deleting the default public calendar resets the selection.
+ Fixed: Bug #1879356 - Events spanning multiple days do not autocorrect time.
</pre>';
        case version_compare($version, '1.6.3', '<'):
            $content[] = '<pre>1.6.3 changes
-------------
+ Added missing repeatYearly function.</pre>';
        case version_compare($version, '1.6.4', '<'):
            $content[] = '<pre>';
            calendarUpdateFiles(array('templates/admin/schedules.tpl'), $content);
            $content[] = '1.6.4 changes
-------------
+ Added missing pager navigation tags to schedule listing.</pre>';
        case version_compare($version, '1.7.0', '<'):
            $db = new PHPWS_DB('calendar_schedule');
            $db->addColumn('id');
            $schedules = $db->select('col');
            if (!empty($schedules)) {
                foreach ($schedules as $id) {
                    $event_db = new PHPWS_DB('calendar_event_' . $id);
                    $event_db->addColumn('key_id');
                    $keys = $event_db->select('col');
                    if (!empty($keys)) {
                        $key_db = new PHPWS_DB('phpws_key');
                        $key_db->addWhere('id', $keys);
                        $key_db->addValue('item_name', 'event' . $id);
                        PHPWS_Error::logIfError($key_db->update());
                    }
                }
            }
            $content[] = '<pre>';
            $files = array('img/', 'templates/admin/schedules.tpl', 'templates/view/month/grid.tpl', 'templates/view/month/list.tpl', 'templates/view/day.tpl', 'templates/view/event.tpl', 'templates/view/week.tpl', 'templates/ical.tpl', 'templates/style.css', 'templates/upload.tpl', 'templates/admin/settings.tpl');
            calendarUpdateFiles($files, $content);
            $content[] = '1.7.0 changes
-------------
+ Added ability to hide the mini grid calendar.
+ Increased edit event popup default size.
+ Moved some frequent functions closer to top of switch
+ Added ability to upload and download events using iCal format
+ Fixed: Calendar was saving all events from all schedules using the same item name.
+ Deleting a schedule will remove event keys as well.
+ Deleting an event clears the cache to prevent ghosts in grid view.
+ If a non existing event is accessed, calendar forwards to day view instead of 404.
+ Added check that removes the default public calendar if it is
  changed to private.
+ Fixed events showing on multiple schedules.
+ php 5 formatted.
</pre>';
        case version_compare($version, '1.7.1', '<'):
            $content[] = '<pre>';
            $files = array('templates/admin/settings.tpl');
            calendarUpdateFiles($files, $content);
            $content[] = '1.7.1 changes
------------------
+ Added option to enable rel="nofollow" on date links</pre>';
        case version_compare($version, '1.7.2', '<'):
            $content[] = '<pre>1.7.2 changes
------------------
+ Fixed event ical download</pre>';
        case version_compare($version, '1.7.3', '<'):
            $content[] = '<pre>1.7.3 changes
------------------
+ Fixed empty events check in Upcoming Events
+ PHP 5 strict fixes.</pre>';
        case version_compare($version, '1.7.4', '<'):
            $content[] = '<pre>1.7.4 changes
------------------
+ RSS added.</pre>';
        case version_compare($version, '1.7.5', '<'):
            $content[] = '<pre>1.7.5 changes
------------------
+ Added an explicit require for Time.php in Calendar, in an attempt to move off of the older autoload</pre>';
        case version_compare($version, '1.7.6', '<'):
            $content[] = '<pre>1.7.6 changes
------------------
+ Bootstrap styling added
+ Updated Font Awesome icons
+ Fixed schedule select with last Form updates
+ Fixed users not seeing public calendars
</pre>';
        case version_compare($version, '1.8.0', '<'):
            $content[] = <<<EOF
<pre>1.8.0
-------------
+ Added END_TIME_HOUR, END_TIME_MONTH, and END_TIME_YEAR
  template tags to the event view.
+ Added Bootstrap icons and navigation buttons.
+ Administrative forms switched over to modal windows.
+ Using new datetimepicker javascript.</pre>
EOF;
        case version_compare($version, '1.8.1', '<'):
            $content[] = <<<EOF
<pre>1.8.1
-------------
+ Rolled back array call specific to PHP 5.4.
+ Increased specificity of .date-label CSS class.
</pre>
EOF;
    }
    // end of switch
    return true;
}
예제 #14
0
 public function saveDependencies()
 {
     if (!$this->_dependency) {
         return true;
     }
     $db = new PHPWS_DB('dependencies');
     $db->addWhere('source_mod', $this->title);
     $db->delete();
     $db->reset();
     $dep_list = $this->getDependencies();
     if (empty($dep_list)) {
         return null;
     }
     foreach ($dep_list['MODULE'] as $stats) {
         $db->addValue('source_mod', $this->title);
         $db->addValue('depended_on', $stats['TITLE']);
         $db->addValue('version', $stats['VERSION']);
         $result = $db->insert();
         if (PHPWS_Error::isError($result)) {
             return $result;
         }
     }
 }
예제 #15
0
/**
 * @version $Id$
 * @author Matthew McNaney <mcnaney at gmail dot com>
 */
function checkin_update(&$content, $current_version)
{
    switch (1) {
        case version_compare($current_version, '1.0.1', '<'):
            $content[] = '<pre>';
            $db = new PHPWS_DB('checkin_staff');
            if (PHPWS_Error::logIfError($db->addTableColumn('view_order', 'smallint not null default 0'))) {
                $content[] = 'Unable to create checkin_staff.view_order column.</pre>';
                return false;
            } else {
                $content[] = 'Created checkin_staff.view_order column.';
            }
            $db->addColumn('id');
            $staff_list = $db->select('col');
            if (!empty($staff_list)) {
                $count = 1;
                foreach ($staff_list as $staff_id) {
                    $db->reset();
                    $db->addWhere('id', $staff_id);
                    $db->addValue('view_order', $count);
                    PHPWS_Error::logIfError($db->update());
                    $count++;
                }
            }
            checkinUpdateFiles(array('templates/visitors.tpl', 'templates/waiting.tpl', 'templates/queue.tpl', 'templates/settings.tpl'), $content);
            $content[] = '1.0.1 changes
------------------
+ Fixed bug with pulling current staff member
+ Added refresh link to waiting and assignment page
+ Fixed report
</pre>';
        case version_compare($current_version, '1.0.2', '<'):
            $content[] = '<pre>';
            checkinUpdateFiles(array('templates/visitors.tpl', 'templates/waiting.tpl', 'templates/style.css'), $content);
            $content[] = '1.0.2 changes
--------------------
+ Fixed translation typo.
+ Added "Send back" condition</pre>';
        case version_compare($current_version, '1.0.3', '<'):
            $content[] = '<pre>';
            checkinUpdateFiles(array('templates/report.tpl'), $content);
            $content[] = '1.0.3 changes
--------------------
+ Removed error message from report if no reasons created
+ Added the time of arrival to the report
+ Changed report date entry interface
+ Upper cased names.
</pre>';
        case version_compare($current_version, '1.0.4', '<'):
            $content[] = '<pre>1.0.4 changes
---------------------
+ Fixed waiting time setting</pre>';
        case version_compare($current_version, '1.1.0', '<'):
            $content[] = '<pre>1.1.0 changes
---------------------
+ Added code to prevent refreshed duplicates
+ Fixed possible error in admin view
+ Added monthly and student reports
+ Added report for number of times a visitor has visited within 30 days.
+ PHP 5 Strict changes</pre>';
        case version_compare($current_version, '1.1.1', '<'):
            $content[] = '<pre>1.1.1 changes
---------------------
+ Reports limited to admins</pre>';
        case version_compare($current_version, '1.2', '<'):
            $db = new PHPWS_DB('checkin_staff');
            $db->addTableColumn('active', 'smallint not null default 1');
            $content[] = '<pre>1.2 changes
--------------
+ Fixed blue button on admin menu
+ Staff can now be deactivated so they appear on reports but do not receive visitors</pre>';
        case version_compare($current_version, '1.3', '<'):
            $db = new PHPWS_DB('checkin_visitor');
            $db->addTableColumn('email', 'varchar(255) NULL');
            $content[] = '<pre>1.3 changes
---------------
+ Option to collect visitor email addresses.</pre>';
        case version_compare($current_version, '1.4.0', '<'):
            $content[] = '<pre>1.4.0 changes
---------------
+ May now report by visitor name.</pre>';
        case version_compare($current_version, '1.5.0', '<'):
            $content[] = '<pre>';
            // Make changes to checkin_visitor table
            $db = new PHPWS_DB('checkin_visitor');
            if (PHPWS_Error::logIfError($db->addTableColumn('gender', 'varchar(20) default NULL'))) {
                $content[] = 'Unable to create checkin_visitor.gender column.</pre>';
                return false;
            } else {
                $content[] = 'Created checkin_visitor.gender column.';
            }
            if (PHPWS_Error::logIfError($db->addTableColumn('birthdate', 'varchar(20) default NULL'))) {
                $content[] = 'Unable to create checkin_visitor.birthdate column.</pre>';
                return false;
            } else {
                $content[] = 'Created checkin_visitor.birthdate column.';
            }
            // Make changes to checkin_staff table
            $db = new PHPWS_DB('checkin_staff');
            if (PHPWS_Error::logIfError($db->addTableColumn('birthdate_filter_end', 'varchar(20) default NULL', 'f_regexp'))) {
                $content[] = 'Unable to create checkin_staff.birthdate_filter_end column.</pre>';
                return false;
            } else {
                $content[] = 'Created checkin_staff.birthdate_filter_end column.';
            }
            if (PHPWS_Error::logIfError($db->addTableColumn('birthdate_filter_start', 'varchar(20) default NULL', 'f_regexp'))) {
                $content[] = 'Unable to create checkin_staff.birthdate_filter_start column.</pre>';
                return false;
            } else {
                $content[] = 'Created checkin_staff.birthdate_filter_start column.';
            }
            if (PHPWS_Error::logIfError($db->addTableColumn('gender_filter', 'varchar(20) default NULL', 'f_regexp'))) {
                $content[] = 'Unable to create checkin_staff.gender_filter column.</pre>';
                return false;
            } else {
                $content[] = 'Created checkin_staff.gender_filter column.';
            }
            if (PHPWS_Error::logIfError($db->query('ALTER TABLE checkin_staff CHANGE filter lname_filter varchar(255) default NULL'))) {
                $content[] = 'Unable to rename checkin_staff.filter column.</pre>';
                return false;
            } else {
                $content[] = 'Renamed checkin_staff.filter to checkin_staff.lname_filter.';
            }
            if (PHPWS_Error::logIfError($db->query('ALTER TABLE checkin_staff CHANGE f_regexp lname_regexp varchar(255) default NULL'))) {
                $content[] = 'Unable to rename checkin_staff.f_regexp column.</pre>';
                return false;
            } else {
                $content[] = 'Renamed checkin_staff.f_regexp to checkin_staff.lname_regexp.';
            }
            $content[] = '1.5.0 changes
---------------
+ Fixed the "print view" for daily reports.
+ Option to collect visitor gender.
+ Option to collect visitor birthdate.
+ Added staff filters for gender and birthdate.
+ Staff can now have more than one filter.</pre>';
        case version_compare($current_version, '1.5.1', '<'):
            $content[] = '<pre>1.5.1 changes
----------------
+ Fixed some bugs and notices</pre>';
    }
    return true;
}
예제 #16
0
 public function update()
 {
     $this->updated = time();
     $this->timeout = $this->updated + 86400 * 30;
     $db = new \PHPWS_DB('properties');
     $db->addValue('updated', $this->updated);
     $db->addValue('timeout', $this->timeout);
     $db->addWhere('id', $this->id);
     $db->update();
 }
예제 #17
0
파일: Key.php 프로젝트: HaldunA/phpwebsite
 public static function registerModule($module)
 {
     $db = new PHPWS_DB('phpws_key_register');
     $db->addValue('module', $module);
     return $db->insert();
 }
예제 #18
0
 public function save()
 {
     if (empty($this->key_id) || empty($this->keywords)) {
         return FALSE;
     }
     $db = new PHPWS_DB('search');
     $db->addWhere('key_id', $this->key_id);
     $db->delete();
     $db->reset();
     $key = new Key($this->key_id);
     $db->addValue('key_id', $key->id);
     $db->addValue('module', $key->module);
     $db->addValue('created', $key->create_date);
     if (is_array($this->keywords)) {
         $keywords = implode(' ', $this->keywords);
     } else {
         $keywords = $this->keywords;
     }
     $db->addValue('keywords', $keywords);
     return $db->insert();
 }
예제 #19
0
 public function updateCore()
 {
     PHPWS_Core::initModClass('boost', 'Boost.php');
     $content[] = dgettext('boost', 'Updating core');
     require_once PHPWS_SOURCE_DIR . 'core/boost/update.php';
     $ver_info = PHPWS_Core::getVersionInfo(false);
     $content[] = dgettext('boost', 'Processing update file.');
     $result = core_update($content, $ver_info['version']);
     if ($result === true) {
         $db = new PHPWS_DB('core_version');
         $file_ver = PHPWS_Core::getVersionInfo();
         $db->addValue('version', $file_ver['version']);
         $result = $db->update();
         if (PHPWS_Error::isError($result)) {
             PHPWS_Error::log($result);
             $content[] = dgettext('boost', 'An error occurred updating the core.');
         } else {
             $content[] = dgettext('boost', 'Core successfully updated.');
         }
     } elseif (PHPWS_Error::isError($result)) {
         PHPWS_Error::log($result);
         $content[] = dgettext('boost', 'An error occurred updating the core.');
     } else {
         $content[] = dgettext('boost', 'An error occurred updating the core.');
     }
     return implode('<br />', $content);
 }
예제 #20
0
 public function create_core()
 {
     $db = new PHPWS_DB();
     $loaddb = \PHPWS_DB::loadDB($this->getDSN(), $this->dbprefix);
     if (PHPWS_Error::isError($loaddb)) {
         return $loaddb;
     }
     $result = $db->importFile(PHPWS_SOURCE_DIR . 'core/boost/install.sql');
     if ($result == TRUE) {
         $db->setTable('core_version');
         include PHPWS_SOURCE_DIR . 'core/boost/boost.php';
         $db->addValue('version', $version);
         $result = $db->insert();
         if (PHPWS_Error::isError($result)) {
             PHPWS_Error::log($result);
             return $result;
         }
         Branch::loadHubDB();
         return true;
     } else {
         Branch::loadHubDB();
         return $result;
     }
 }
예제 #21
0
 public function setRegistered($module, $registered)
 {
     $db = new PHPWS_DB('registered');
     $db->addValue('registered_to', $registered);
     $db->addValue('module', $module);
     $result = $db->insert();
     if (PHPWS_Error::logIfError($result)) {
         return $result;
     } else {
         return (bool) $result;
     }
 }
예제 #22
0
 public static function menuFix()
 {
     $db = new PHPWS_DB('access_shortcuts');
     $sc = $db->select();
     if (empty($sc)) {
         return;
     }
     $menu_db = new PHPWS_DB('menu_links');
     foreach ($sc as $shortcut) {
         extract($shortcut);
         $url = str_replace(':', '/', $url);
         $menu_db->addWhere('url', $url);
         $menu_db->addWhere('url', "./{$url}", '=', 'or');
         $menu_db->addValue('url', './' . $keyword);
         $menu_db->update();
         $menu_db->reset();
     }
 }
예제 #23
0
 public static function lockBlock($block_id, $key_id)
 {
     $block_id = (int) $block_id;
     $key_id = (int) $key_id;
     unset($_SESSION['Pinned_Blocks'][$block_id]);
     $values['block_id'] = $block_id;
     $values['key_id'] = $key_id;
     $db = new PHPWS_DB('block_pinned');
     $db->addWhere($values);
     $result = $db->delete();
     $db->addValue($values);
     return $db->insert();
 }
예제 #24
0
function properties_update(&$content, $currentVersion)
{
    switch ($currentVersion) {
        case version_compare($currentVersion, '1.1.0', '<'):
            $db = new PHPWS_DB('properties');
            $result = $db->addTableColumn('efficiency', 'smallint not null default 0');
            if (PHPWS_Error::isError($result)) {
                PHPWS_Error::log($result);
                $content[] = 'ERROR - could not add efficiency column';
                return false;
            }
            $content[] = '<pre>1.1.0 updates
---------------
+ Added efficiency option</pre>';
        case version_compare($currentVersion, '1.1.1', '<'):
            $db = new PHPWS_DB('prop_contacts');
            $result = $db->addTableColumn('company_url', 'VARCHAR( 255 ) NULL');
            if (PHPWS_Error::isError($result)) {
                PHPWS_Error::log($result);
                $content[] = 'ERROR - could not add company_url column';
                return false;
            }
            $content[] = '<pre>1.1.1 updates
---------------
+ Added company url
+ Property listing divided into tabs.</pre>';
        case version_compare($currentVersion, '1.2.0', '<'):
            $db = new PHPWS_DB('properties');
            $db->addWhere('pets_allowed', 1);
            $db->addColumn('id');
            $db->addColumn('pet_type');
            $db->setIndexBy('id');
            $cols = $db->select('col');
            if (!empty($cols)) {
                foreach ($cols as $id => $pets) {
                    if (empty($pets)) {
                        continue;
                    }
                    $db->reset();
                    $pets_array = null;
                    $pets_array = @unserialize($pets);
                    if (!is_array($pets_array)) {
                        continue;
                    } else {
                        $pets = implode(', ', $pets_array);
                    }
                    $db->addWhere('id', $id);
                    $db->addValue('pet_type', $pets);
                    $db->update();
                }
            }
            $db->reset();
            $result = $db->addTableColumn('pet_fee', 'int not null default 0');
            if (PHPWS_Error::isError($result)) {
                PHPWS_Error::log($result);
                $content[] = 'ERROR - could not add pet_fee column';
                return false;
            }
            $db->reset();
            $result = $db->addTableColumn('airconditioning', 'smallint not null default 0');
            if (PHPWS_Error::isError($result)) {
                PHPWS_Error::log($result);
                $content[] = 'ERROR - could not add airconditioning column';
                return false;
            }
            $db->reset();
            $result = $db->addTableColumn('heat_type', 'varchar(255) default null');
            if (PHPWS_Error::isError($result)) {
                PHPWS_Error::log($result);
                $content[] = 'ERROR - could not add heat_type column';
                return false;
            }
        case version_compare($currentVersion, '1.2.1', '<'):
            $content[] = '<pre>1.2.1 updates
---------------
- Improved look with Bootstrapping.</pre>';
        case version_compare($currentVersion, '1.2.2', '<'):
            $content[] = '<pre>1.2.2 updates
---------------
+ Added gas heat and fiber internet/tv.
</pre>';
        case version_compare($currentVersion, '1.3.0', '<'):
            $content[] = <<<EOF
<pre>1.3.0 updates
-----------------
+ Changed login box for IE users
+ Added ability to view properties by contact.
+ Contacts list compacted. Email links to contact name.
+ Fixed bad function call on error page.
+ Added error checks in case 1) the property does not exists or not active or
  2) the image files are not present.
+ Test for incactive properties preventing error.
+ Added Bootstrap styling and overhauled to work on mobile devices.
+ Last logged defaults to creation date.
+ Fixed Shared Bedroom and Bathroom settings on roommates page.
+ Fixed active/inactive buttons.
</pre>
EOF;
        case version_compare($currentVersion, '1.4.0', '<'):
            if (!is_file(PHPWS_SOURCE_DIR . 'lib/vendor/autoload.php')) {
                $content[] = 'Composer is not installed. Be sure to run `composer install` in your installation\'s lib directory.';
                return false;
            }
            $db = \Database::getDB();
            $t1 = $db->addTable('prop_contacts');
            $dt = $t1->addDataType('private', 'smallint');
            $dt->setDefault(0);
            $dt->add();
            $dt2 = $t1->addDataType('approved', 'smallint');
            $dt2->setDefault(1);
            $dt2->add();
            $t1->addFieldConditional('company_name', 'private%', 'like');
            $t1->addValue('private', 1);
            $db->update();
            $old = $t1->getDataType('company_name');
            $new = clone $old;
            $new->setIsNull(true);
            $t1->alter($old, $new);
            $content[] = <<<EOF
<pre>1.4.0 updates
-----------------
+ Added Private Renter designation.
+ Added new manager signup.
</pre>
EOF;
        case version_compare($currentVersion, '1.4.1', '<'):
            $content[] = <<<EOF
<pre>1.4.1 updates
-----------------
+ New user signup requires all email settings to be set.
+ Invalid and duplicate email addresses are now checked on signup.
</pre>
EOF;
        case version_compare($currentVersion, '1.4.2', '<'):
            $content[] = <<<EOF
<pre>1.4.2 updates
-----------------
+ Fixed: New managers could log in before approved.
</pre>
EOF;
    }
    return true;
}
 public function execute(CommandContext $context)
 {
     if (!Current_User::allow('hms', 'assignment_notify')) {
         PHPWS_Core::initModClass('hms', 'exception/PermissionException.php');
         throw new PermissionException('You do not have permission to send assignment notifications.');
     }
     PHPWS_Core::initModClass('hms', 'Term.php');
     PHPWS_Core::initModClass('hms', 'HMS_Email.php');
     PHPWS_Core::initModClass('hms', 'HMS_Assignment.php');
     PHPWS_Core::initModClass('hms', 'HMS_Movein_Time.php');
     PHPWS_Core::initModClass('hms', 'StudentFactory.php');
     PHPWS_Core::initModClass('hms', 'HMS_RLC_Assignment.php');
     // Check if any move-in times are set for the selected term
     $moveinTimes = HMS_Movein_Time::get_movein_times_array(Term::getSelectedTerm());
     // If the array of move-in times ONLY has the zero-th element ['None'] then it's no good
     // Or, of course, if the array is null or emtpy it is no good
     if (count($moveinTimes) <= 1 || is_null($moveinTimes) || empty($moveinTimes)) {
         NQ::simple('hms', hms\NotificationView::ERROR, 'There are no move-in times set for ' . Term::getPrintableSelectedTerm());
         $context->goBack();
     }
     // Keep track of floors missing move-in times
     $missingMovein = array();
     $term = Term::getSelectedTerm();
     $db = new PHPWS_DB('hms_assignment');
     $db->addWhere('email_sent', 0);
     $db->addWhere('term', $term);
     $result = $db->getObjects("HMS_Assignment");
     if (PHPWS_Error::logIfError($result)) {
         throw new DatabaseException($result->toString());
     }
     foreach ($result as $assignment) {
         //get the students real name from their asu_username
         $student = StudentFactory::getStudentByUsername($assignment->getUsername(), $term);
         //get the location of their assignment
         PHPWS_Core::initModClass('hms', 'HMS_Bed.php');
         $bed = new HMS_Bed($assignment->getBedId());
         $room = $bed->get_parent();
         $location = $bed->where_am_i() . ' - Bedroom ' . $bed->bedroom_label;
         // Lookup the floor and hall to make sure the
         // assignment notifications flag is true for this hall
         $floor = $room->get_parent();
         $hall = $floor->get_parent();
         if ($hall->assignment_notifications == 0) {
             continue;
         }
         // Get the student type for determining move-in time
         $type = $student->getType();
         // Check for an accepted and confirmed RLC assignment
         $rlcAssignment = HMS_RLC_Assignment::getAssignmentByUsername($student->getUsername(), $term);
         // If there is an assignment, make sure the student "confirmed" the rlc invite
         if (!is_null($rlcAssignment)) {
             if ($rlcAssignment->getStateName() != 'confirmed' && $rlcAssignment->getStateName() != 'selfselect-assigned') {
                 $rlcAssignment = null;
             }
         }
         // Make sure this is re-initialized
         $moveinTimeId = null;
         $rlcSetMoveinTime = false;
         // Determine the move-in time
         if (!is_null($rlcAssignment)) {
             // If there is a 'confirmed' RLC assignment, use the RLC's move-in times
             $rlc = $rlcAssignment->getRlc();
             if ($type == TYPE_CONTINUING) {
                 $moveinTimeId = $rlc->getContinuingMoveinTime();
             } else {
                 if ($type == TYPE_TRANSFER) {
                     $moveinTimeId = $rlc->getTransferMoveinTime();
                 } else {
                     if ($type == TYPE_FRESHMEN) {
                         $moveinTimeId = $rlc->getFreshmenMoveinTime();
                     }
                 }
             }
         }
         // If there's a non-null move-in time ID at this point, then we know the RLC must have set it
         if (!is_null($moveinTimeId)) {
             $rlcSetMoveinTime = true;
         }
         // If the RLC didn't set a movein time, set it according to the floor
         // TODO: Find continuing students by checking the student's application term
         // against the term we're wending assignment notices for
         if (is_null($moveinTimeId)) {
             if ($type == TYPE_CONTINUING) {
                 $moveinTimeId = $assignment->get_rt_movein_time_id();
             } else {
                 if ($type == TYPE_TRANSFER) {
                     $moveinTimeId = $assignment->get_t_movein_time_id();
                 } else {
                     $moveinTimeId = $assignment->get_f_movein_time_id();
                 }
             }
         }
         // Check for missing move-in times
         if ($moveinTimeId == NULL) {
             //test($assignment, 1); // Will only happen if there's no move-in time set for the floor,student type
             // Lets only keep a set of the floors
             if (!in_array($floor, $missingMovein)) {
                 $missingMovein[] = $floor;
             }
             // Missing move-in time, so skip to the next assignment
             continue;
         }
         // TODO: Grab all the move-in times and index them in an array by ID so we don't have to query the DB every single time
         $movein_time_obj = new HMS_Movein_Time($moveinTimeId);
         $movein_time = $movein_time_obj->get_formatted_begin_end();
         // Add a bit of text if the move-in time was for an RLC
         if ($rlcSetMoveinTime) {
             $movein_time .= ' (for the ' . $rlc->get_community_name() . ' Residential Learning Community)';
         }
         //get the list of roommates
         $roommates = array();
         $beds = $room->get_beds();
         foreach ($beds as $bed) {
             $roommate = $bed->get_assignee();
             if ($roommate == false || is_null($roommate) || $roommate->getUsername() == $student->getUsername()) {
                 continue;
             }
             $roommates[] = $roommate->getFullName() . ' (' . $roommate->getUsername() . '@appstate.edu) - Bedroom ' . $bed->bedroom_label;
         }
         // Send the email
         HMS_Email::sendAssignmentNotice($student->getUsername(), $student->getName(), $term, $location, $roommates, $movein_time);
         // Mark the student as having received an email
         $db->reset();
         $db->addWhere('asu_username', $assignment->getUsername());
         $db->addWhere('term', $term);
         $db->addValue('email_sent', 1);
         $rslt = $db->update();
         if (PHPWS_Error::logIfError($rslt)) {
             throw new DatabaseException($result->toString());
         }
     }
     // Check for floors with missing move-in times.
     if (empty($missingMovein) || is_null($missingMovein)) {
         // Ther are none, so show a success message
         NQ::simple('hms', hms\NotificationView::SUCCESS, "Assignment notifications sent.");
     } else {
         // Show a warning for each floor that was missing a move-in time
         foreach ($missingMovein as $floor) {
             $hall = $floor->get_parent();
             $text = $floor->getLink($hall->getHallName() . " floor ") . " move-in times not set.";
             NQ::simple('hms', hms\NotificationView::WARNING, $text);
         }
     }
     $context->goBack();
 }
예제 #26
0
 public static function postMeta()
 {
     $values['page_title'] = strip_tags($_POST['page_title']);
     $values['meta_keywords'] = strip_tags($_POST['meta_keywords']);
     $values['meta_description'] = strip_tags($_POST['meta_description']);
     if (isset($_POST['index'])) {
         $index = 1;
     } else {
         $index = 0;
     }
     if (isset($_POST['follow'])) {
         $follow = 1;
     } else {
         $follow = 0;
     }
     PHPWS_Settings::set('layout', 'use_key_summaries', (int) isset($_POST['use_key_summaries']));
     PHPWS_Settings::save('layout');
     $values['meta_robots'] = $index . $follow;
     if (isset($_POST['key_id'])) {
         $key_id = (int) $_POST['key_id'];
     }
     if (isset($key_id)) {
         $values['key_id'] = $key_id;
         $db = new PHPWS_DB('layout_metatags');
         $db->addWhere('key_id', $key_id);
         $db->delete();
         if (isset($_POST['reset'])) {
             return true;
         }
         $db->reset();
         $db->addValue($values);
         return $db->insert();
     } else {
         $db = new PHPWS_DB('layout_config');
         $db->addValue($values);
         return $db->update();
     }
 }
예제 #27
0
 /**
  * updates the settings table
  */
 public static function save($module)
 {
     if (!PHPWS_Settings::is_set($module)) {
         return false;
     }
     $db = new PHPWS_DB('mod_settings');
     $db->addWhere('module', $module);
     $db->addWhere('setting_name', array_keys($GLOBALS['PHPWS_Settings'][$module]));
     $db->delete();
     $db->reset();
     foreach ($GLOBALS['PHPWS_Settings'][$module] as $key => $value) {
         if (empty($key)) {
             continue;
         }
         $type = PHPWS_Settings::getType($value);
         $db->addValue('module', $module);
         $db->addValue('setting_name', $key);
         $db->addValue('setting_type', $type);
         switch ($type) {
             case 1:
                 $db->addValue('small_num', (int) $value);
                 break;
             case 2:
                 $db->addValue('large_num', (int) $value);
                 break;
             case 3:
                 $db->addValue('small_char', $value);
                 break;
             case 4:
                 $db->addValue('large_char', $value);
                 break;
         }
         $result = $db->insert();
         if (PHPWS_Error::isError($result)) {
             unset($GLOBALS['PHPWS_Settings'][$module]);
             PHPWS_Settings::load($module);
             return $result;
         }
         $db->reset();
     }
     unset($GLOBALS['PHPWS_Settings'][$module]);
     PHPWS_Settings::load($module);
 }
 public function updateSequenceTable()
 {
     $this->addColumn('id', 'max');
     $max_id = $this->select('one');
     if (PHPWS_Error::isError($max_id)) {
         return $max_id;
     }
     if ($max_id > 0) {
         $seq_table = $this->getTable(false) . '_seq';
         if (!$this->isTable($seq_table)) {
             $table = $this->addPrefix($this->getTable(false));
             $GLOBALS['PHPWS_DB']['connection']->nextId($table);
         }
         $seq = new PHPWS_DB($seq_table);
         $result = $seq->select('one');
         if (PHPWS_Error::logIfError($result)) {
             return false;
         }
         $seq->addValue('id', $max_id);
         if (!$result) {
             return $seq->insert(false);
         } else {
             return $seq->update();
         }
     }
     return true;
 }
예제 #29
0
 public function createCore()
 {
     require_once 'File.php';
     $this->content[] = dgettext('core', 'Importing core database file.');
     $db = new PHPWS_DB();
     $result = $db->importFile('core/boost/install.sql');
     if (PHPWS_Error::isError($result)) {
         PHPWS_Error::log($result);
         $this->content[] = dgettext('core', 'Some errors occurred while creating the core database tables.');
         $this->content[] = dgettext('core', 'Please check your error log file.');
         return false;
     }
     if ($result == true) {
         $db = new PHPWS_DB('core_version');
         include PHPWS_SOURCE_DIR . 'core/boost/boost.php';
         $db->addValue('version', $version);
         $result = $db->insert();
         if (PHPWS_Error::isError($result)) {
             PHPWS_Error::log($result);
             $this->content[] = dgettext('core', 'Some errors occurred while creating the core database tables.');
             $this->content[] = dgettext('core', 'Please check your error log file.');
             return false;
         } else {
             $this->content[] = dgettext('core', 'Core installation successful.');
             return true;
         }
     }
 }
예제 #30
0
파일: Form.php 프로젝트: HaldunA/phpwebsite
 function _saveFormData()
 {
     $error = NULL;
     /* Setup start and end values for the elements loop */
     $start = $this->_position;
     if ($this->_position + $this->_pageLimit > sizeof($this->_elements)) {
         $end = $this->_position + (sizeof($this->_elements) - $this->_position);
     } else {
         $end = $this->_position + $this->_pageLimit;
     }
     /* Loop through elements and setup query array for database interaction */
     for ($i = $start; $i < $end; $i++) {
         $elementInfo = explode(':', $this->_elements[$i]);
         $this->element = new $elementInfo[0]($elementInfo[1]);
         if ($this->element->isRequired() && (!isset($_REQUEST['PHAT_' . $this->element->getLabel()]) || $_REQUEST['PHAT_' . $this->element->getLabel()] == NULL)) {
             $error = PHPWS_Error::get(PHATFORM_REQUIRED_MISSING, 'phatform', 'PHAT_Form::_saveFormData');
         }
         if ($this->_editData) {
             $this->_userData[$this->element->getLabel()] = $_REQUEST['PHAT_' . $this->element->getLabel()];
         }
         if (isset($_REQUEST['PHAT_' . $this->element->getLabel()])) {
             if (is_string($_REQUEST['PHAT_' . $this->element->getLabel()]) && strlen($_REQUEST['PHAT_' . $this->element->getLabel()]) > PHAT_MAX_CHARS_TEXT_ENTRY) {
                 $error = PHPWS_Error::get(PHATFORM_TEXT_MAXSIZE_PASSED, 'phatform', 'PHAT_Form::_saveFormData', array($this->element->getLabel()));
             }
             $queryData[$this->element->getLabel()] = $_REQUEST['PHAT_' . $this->element->getLabel()];
         }
     }
     /* If no errors occured, move the user to the next page in this form */
     if (!PHPWS_Error::isError($error)) {
         if ($this->currentPage() != $this->numPages()) {
             $this->_position += $this->_pageLimit;
         } else {
             $this->_position = -1;
         }
     }
     if (!$this->_anonymous) {
         $queryData['user'] = Current_User::getUsername();
     } else {
         $queryData['user'] = '******';
     }
     $queryData['position'] = $this->_position;
     $queryData['updated'] = time();
     /* Check to see if this user has started entering data for this form yet */
     $db = new PHPWS_DB('mod_phatform_form_' . $this->getId());
     $db->addValue($queryData);
     if (isset($this->_dataId)) {
         $db->addWhere('id', $this->_dataId);
         $db->update();
     } else {
         $result = $db->insert();
         if (PHPWS_Error::isError($result)) {
             PHPWS_Error::log($result);
         } else {
             $this->_dataId = $result;
         }
     }
     return $error;
 }