/** * Diff * * Main function: Calls the diff and render, then outputs to layout * * @author Greg Meiste <*****@*****.**> */ function diff($oVer, $nVer) { PHPWS_Core::initModClass('wiki', 'OldWikiPage.php'); $olderpage = new OldWikiPage(); $newerpage = new OldWikiPage(); $db = new PHPWS_DB('wiki_pages_version'); $db->addWhere('title', $_REQUEST['page']); $db->addWhere('vr_number', $oVer); $db->loadObject($olderpage); $db->reset(); $db->addWhere('title', $_REQUEST['page']); $db->addWhere('vr_number', $nVer); $db->loadObject($newerpage); // Need to parse the text, but we can't call parseOutput or this module's // transform function. They both do too much parsing and can't be used // for a diff. So, we call what is needed directly: $oPagetext = htmlspecialchars(str_replace("'", "'", $olderpage->getPagetext(FALSE))); $nPagetext = htmlspecialchars(str_replace("'", "'", $newerpage->getPagetext(FALSE))); if (!ALLOW_PROFANITY) { $oPagetext = PHPWS_Text::profanityFilter($oPagetext); $nPagetext = PHPWS_Text::profanityFilter($nPagetext); } // End diff text parsing $oPagetext = explode("\n", $oPagetext); $nPageText = explode("\n", $nPagetext); $diff = new Text_Diff($oPagetext, $nPageText); $this->render($diff); $tags = array(); $tags['TITLE'] = dgettext('wiki', 'Difference between revisions'); $tags['BACK_PAGE'] = PHPWS_Text::moduleLink(dgettext('wiki', 'Back to Page'), 'wiki', array('page' => $_REQUEST['page'])); $tags['BACK_HISTORY'] = PHPWS_Text::moduleLink(dgettext('wiki', 'Back to History'), 'wiki', array('page_op' => 'history', 'page_id' => $newerpage->getSourceId())); $tags['DIFF'] = $this->_output; $tags['OLDER_VERSION'] = $olderpage->getVrNumber(); $tags['NEWER_VERSION'] = $newerpage->getVrNumber(); $tags['OLDER_UPDATED'] = $olderpage->getUpdated(); $tags['NEWER_UPDATED'] = $newerpage->getUpdated(); $tags['VERSION_LABEL'] = dgettext('wiki', 'Version'); return PHPWS_Template::process($tags, 'wiki', 'diff/' . $this->_format . '/diff.tpl'); }
/** * Saves the parameters from this report to the database. * * @throws DatabaseException */ public function saveParams() { $params = $this->getParams(); if (empty($params)) { return; } $db = new PHPWS_DB('hms_report_param'); foreach ($params as $key => $value) { $db->reset(); $db->addValue('report_id', $this->report->getId()); $db->addValue('param_name', $key); $db->addValue('param_value', $value); $result = $db->insert(); if (PHPWS_Error::logIfError($result)) { throw new DatabaseException($result->toString()); } } }
/** * Grant user access to search and manage Department. */ public static function add($username, $departmentId) { if (empty($username)) { return \NQ::simple('intern', NotifyUI::WARNING, 'No username entered.'); } if ($departmentId == -1) { return \NQ::simple('intern', NotifyUI::WARNING, 'No department selected.'); } // First check that the username passed in is a registered user. $db = new \PHPWS_DB('users'); $db->addWhere('username', $username); $db->addColumn('id', $count = true); if (sizeof($db->select()) == 0) { // No user exists with that name. return \NQ::simple('intern', NotifyUI::ERROR, "No user exists with the name <i>{$username}</i>. Please choose a valid username."); } // Deity users automatically see every department. No need to add them to table. $db->reset(); $db->addWhere('username', $username); $db->addWhere('deity', true); $db->addColumn('id', $count = true); if (sizeof($db->select()) >= 1) { // Is a deity. return \NQ::simple('intern', NotifyUI::WARNING, "<i>{$username}</i> can view all internships in all departments."); } $d = new Department($departmentId); // Check if user already has permission. if (self::allowed($username, $departmentId)) { // User permission has already been added. return \NQ::simple('intern', NotifyUI::WARNING, "<i>{$username}</i> can already view internships in <i>{$d->name}</i>."); } $ia = new Admin(); $ia->username = $username; $ia->department_id = $departmentId; $ia->save(); \NQ::simple('intern', NotifyUI::SUCCESS, "<i>{$username}</i> can now view internships for <i>{$d->name}</i>."); }
/** * @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; }
/** * boost install file for users * * @author Matthew McNaney <mcnaney at gmail dot com> * @version $Id$ */ function users_install(&$content) { PHPWS_Core::initModClass('users', 'Users.php'); PHPWS_Core::initModClass('users', 'Action.php'); PHPWS_Core::configRequireOnce('users', 'config.php'); if (isset($_REQUEST['module']) && $_REQUEST['module'] == 'branch') { $db = new PHPWS_DB(); PHPWS_Settings::clear(); if (!createLocalAuthScript()) { $content[] = 'Could not create authorization script.'; return false; } Branch::loadHubDB(); $db = new PHPWS_DB('mod_settings'); $db->addWhere('module', 'users'); $db->addWhere('setting_name', 'site_contact'); $db->addColumn('small_char'); $site_contact = $db->select('one'); $db = new PHPWS_DB('users'); $sql = 'select a.password, b.* from user_authorization as a, users as b where b.deity = 1 and a.username = b.username'; $deities = $db->getAll($sql); if (PHPWS_Error::isError($deities)) { PHPWS_Error::log($deities); $content[] = dgettext('users', 'Could not access hub database.'); Branch::restoreBranchDB(); return FALSE; } elseif (empty($deities)) { $content[] = dgettext('users', 'Could not find any hub deities.'); Branch::restoreBranchDB(); return FALSE; } else { Branch::restoreBranchDB(); PHPWS_Settings::set('users', 'site_contact', $site_contact); PHPWS_Settings::save('users'); $auth_db = new PHPWS_DB('user_authorization'); $user_db = new PHPWS_DB('users'); $group_db = new PHPWS_DB('users_groups'); foreach ($deities as $deity) { $auth_db->addValue('username', $deity['username']); $auth_db->addValue('password', $deity['password']); $result = $auth_db->insert(); if (PHPWS_Error::isError($result)) { PHPWS_Error::log($result); $content[] = dgettext('users', 'Unable to copy deity login to branch.'); continue; } unset($deity['password']); $user_db->addValue($deity); $result = $user_db->insert(); if (PHPWS_Error::isError($result)) { PHPWS_Error::log($result); $content[] = dgettext('users', 'Unable to copy deity users to branch.'); Branch::loadBranchDB(); return FALSE; } $group_db->addValue('active', 1); $group_db->addValue('name', $deity['username']); $group_db->addValue('user_id', $result); if (PHPWS_Error::logIfError($group_db->insert())) { $content[] = dgettext('users', 'Unable to copy deity user group to branch.'); Branch::loadBranchDB(); return FALSE; } $group_db->reset(); $auth_db->reset(); $user_db->reset(); } $content[] = dgettext('users', 'Deity users copied to branch.'); } return TRUE; } if (!createLocalAuthScript()) { $content[] = 'Could not create local authorization script.'; return false; } $authorize_id = PHPWS_Settings::get('users', 'local_script'); $user = new PHPWS_User(); $content[] = '<hr />'; return TRUE; }
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(); } }
/** * 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 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(); }
public function delete() { if ($this->ftype == IMAGE_FOLDER) { $table = 'images'; } elseif ($this->ftype == DOCUMENT_FOLDER) { $table = 'documents'; } elseif ($this->ftype == MULTIMEDIA_FOLDER) { $table = 'multimedia'; } else { return false; } /** * Delete file associations inside folder */ $db = new PHPWS_DB('fc_file_assoc'); $db->addWhere($table . '.folder_id', $this->id); $db->addWhere($table . '.id', 'fc_file_assoc.file_id'); PHPWS_Error::logIfError($db->delete()); /** * Delete the special folder associations to this folder */ $db->reset(); $db->addWhere('file_type', FC_IMAGE_FOLDER, '=', 'or', 1); $db->addWhere('file_type', FC_IMAGE_LIGHTBOX, '=', 'or', 1); $db->addWhere('file_type', FC_IMAGE_RANDOM, '=', 'or', 1); $db->addWhere('file_type', FC_DOCUMENT_FOLDER, '=', 'or', 1); $db->addWhere('file_id', $this->id); PHPWS_Error::logIfError($db->delete()); /** * Delete the files in the folder from the db */ unset($db); $db = new PHPWS_DB($table); $db->addWhere('folder_id', $this->id); PHPWS_Error::logIfError($db->delete()); /** * Delete the folder from the database */ $db = new PHPWS_DB('folders'); $db->addWhere('id', $this->id); PHPWS_Error::logIfError($db->delete()); /** * Delete the key */ $key = new Key($this->key_id); $key->delete(); /** * Delete the physical directory the folder occupies */ $directory = $this->getFullDirectory(); if (is_dir($directory)) { PHPWS_File::rmdir($directory); } return true; }
/** * @author Matthew McNaney * @version $Id$ */ function filecabinet_update(&$content, $version) { $home_dir = PHPWS_Boost::getHomeDir(); switch ($version) { case version_compare($version, '1.0.1', '<'): $content[] = '<pre>File Cabinet versions prior to 1.0.1 are not supported. Please download version 1.0.2.</pre>'; break; case version_compare($version, '1.0.2', '<'): $content[] = '<pre>'; $db = new PHPWS_DB('folders'); if (!$db->isTableColumn('key_id')) { if (PHPWS_Error::logIfError($db->addTableColumn('key_id', 'int NOT NULL default 0'))) { $content[] = '--- An error occurred when trying to add key_id as a column to the folders table.</pre>'; return false; } $content[] = '--- Successfully added key_id column to folders table.'; $db2 = new PHPWS_DB('phpws_key'); $db2->addWhere('module', 'filecabinet'); $db2->delete(); $content[] = '--- Deleted false folder keys.'; $db->reset(); PHPWS_Core::initModClass('filecabinet', 'Folder.php'); $result = $db->getObjects('Folder'); if (!empty($result)) { foreach ($result as $folder) { $folder->saveKey(true); } } } $content[] = ' 1.0.2 changes -------------- + 1.0.0 update was missing key_id column addition to folders table. </pre>'; case version_compare($version, '1.1.0', '<'): $content[] = '<pre>'; if (!checkMultimediaDir($content, $home_dir)) { return false; } if (!is_dir($home_dir . 'files/filecabinet/incoming')) { if (is_writable($home_dir . 'files/filecabinet') && @mkdir($home_dir . 'files/filecabinet/incoming')) { $content[] = '--- "files/filecabinet/incoming" directory created.'; } else { $content[] = 'File Cabinet 1.1.0 is unable to create a "filecabinet/incoming" directory. It is not required but if you want to classify files you will need to create it yourself. Example: mkdir phpwebsite/files/filecabinet/incoming/</pre>'; return false; } } $source_dir = PHPWS_SOURCE_DIR . 'mod/filecabinet/templates/filters/'; $dest_dir = $home_dir . 'templates/filecabinet/filters/'; if (!is_dir($dest_dir)) { if (!PHPWS_File::copy_directory($source_dir, $dest_dir)) { $content[] = '--- FAILED copying templates/filters/ directory locally.</pre>'; return false; } } $files = array('templates/manager/pick.tpl', 'templates/classify_file.tpl', 'templates/classify_list.tpl', 'templates/image_edit.tpl', 'templates/multimedia_edit.tpl', 'templates/multimedia_grid.tpl', 'templates/style.css', 'templates/settings.tpl', 'conf/config.php'); if (PHPWS_Boost::updateFiles($files, 'filecabinet')) { $content[] = '--- Copied the following files:'; } else { $content[] = '--- FAILED copying the following files:'; } $content[] = " " . implode("\n ", $files); $db = new PHPWS_DB('images'); if (!$db->isTableColumn('parent_id')) { if (PHPWS_Error::logIfError($db->addTableColumn('parent_id', 'int NOT NULL default 0'))) { $content[] = 'Could not create parent_id column in images table.</pre>'; return false; } } if (!$db->isTableColumn('url')) { if (PHPWS_Error::logIfError($db->addTableColumn('url', 'varchar(255) NULL'))) { $content[] = 'Could not create url column in images table.</pre>'; return false; } } if (!PHPWS_DB::isTable('multimedia')) { $result = PHPWS_DB::importFile(PHPWS_SOURCE_DIR . 'mod/filecabinet/boost/multimedia.sql'); if (!PHPWS_Error::logIfError($result)) { $content[] = '--- Multimedia table created successfully.'; } else { $content[] = '--- Failed to create multimedia table.</pre>'; return false; } } $content[] = ' 1.1.0 changes -------------- + Fixed authorized check when unpinning folders + Images can now be linked to other pages. + Resized images can now be linked to their parent image. + Clip option moved outside edit_folder permissions when viewing images. + Added writable directory check before allowing new folders to be created. + Fixed some error messages in File_Common. + Commented out ext variable in File_Common. Doesn\'t appear to be in use. + Created setDirectory function for File_Common. Assures trailing forward slash on directory name. + Removed itemname variable from Document_Manager + Added ability to classify uploaded files. + New folder class - Multimedia + Multimedia files can be clipped and pasted via SmartTags. </pre> '; case version_compare($version, '1.2.0', '<'): $content[] = '<pre>'; $files = array('img/no_image.png', 'conf/config.php', 'conf/video_types.php', 'conf/embedded.php', 'javascript/folder_contents/head.js', 'javascript/clear_image/head.js', 'javascript/clear_image/body.js', 'javascript/pick_image/head.js', 'templates/image_folders.tpl', 'templates/settings.tpl', 'templates/style.css', 'templates/image_view.tpl', 'templates/multimedia_view.tpl', 'templates/style.css', 'img/video_generic.png', 'templates/image_edit.tpl', 'conf/error.php'); fc_updatefiles($files, $content); if (!PHPWS_Boost::inBranch()) { $content[] = file_get_contents(PHPWS_SOURCE_DIR . 'mod/filecabinet/boost/changes/1_2_0.txt'); } $content[] = '</pre>'; case version_compare($version, '1.2.1', '<'): $content[] = '<pre>'; if (!PHPWS_DB::isTable('filecabinet_pins')) { $db = new PHPWS_DB('filecabinet_pins'); $db->addValue('key_id', 'int not null default 0'); $db->addValue('folder_id', 'int not null default 0'); if (PHPWS_Error::logIfError($db->createTable())) { $content[] = 'Failed to create filecabinet_pins table.</pre>'; return false; } $content[] = '--- Created filecabinet_pins table.'; } $files = array('templates/settings.tpl'); fc_updatefiles($files, $content); if (!PHPWS_Boost::inBranch()) { $content[] = file_get_contents(PHPWS_SOURCE_DIR . 'mod/filecabinet/boost/changes/1_2_1.txt'); } $content[] = '</pre>'; case version_compare($version, '1.2.2', '<'): $content[] = '<pre>'; $files = array('templates/image_edit.tpl'); fc_updatefiles($files, $content); if (!PHPWS_Boost::inBranch()) { $content[] = file_get_contents(PHPWS_SOURCE_DIR . 'mod/filecabinet/boost/changes/1_2_2.txt'); } $content[] = '</pre>'; case version_compare($version, '1.3.0', '<'): $content[] = '<pre>'; $db = new PHPWS_DB('folders'); if (!$db->isTableColumn('module_created')) { if (PHPWS_Error::logIfError($db->addTableColumn('module_created', 'varchar(40) default null'))) { $content[] = '--- Could not create column module_created on folders table.</pre>'; return false; } else { $content[] = '--- Created module_created column on folders table.'; } } $db = new PHPWS_DB('multimedia'); $result = $db->addTableColumn('thumbnail', 'varchar(255) not null'); if (PHPWS_Error::logIfError($result)) { $content[] = '--- Unable to add thumbnail column to multimedia table.</pre>'; return false; } else { $content[] = '--- Added thumbnail column to multimedia table.'; } $s1 = PHPWS_SOURCE_DIR . 'mod/filecabinet/templates/filters/flash/'; $d1 = $home_dir . 'templates/filecabinet/filters/flash/'; $s2 = PHPWS_SOURCE_DIR . 'mod/filecabinet/img/icons/'; $d2 = $home_dir . 'images/mod/filecabinet/icons/'; if (PHPWS_File::copy_directory($s1, $d1)) { $content[] = "--- Successfully copied {$s1} to {$d1}"; } else { $content[] = "--- Failed to copy {$s1} to {$d1}</pre>"; return false; } if (PHPWS_File::copy_directory($s2, $d2)) { $content[] = "--- Successfully copied {$s2} to {$d2}"; } else { $content[] = "--- Failed to copy {$s2} to {$d2}</pre>"; return false; } $content[] = ''; $files = array('conf/error.php', 'conf/config.php', 'templates/filters/flash.tpl', 'templates/file_list.tpl', 'templates/multimedia_edit.tpl', 'templates/settings.tpl', 'templates/style.css', 'templates/thumbnail.tpl', 'templates/image_edit.tpl', 'javascript/pick_image/head.js', 'templates/folder_list.tpl', 'templates/manager/pick.tpl', 'img/delete.png'); fc_updatefiles($files, $content); if (!PHPWS_Boost::inBranch()) { $content[] = file_get_contents(PHPWS_SOURCE_DIR . 'mod/filecabinet/boost/changes/1_3_0.txt'); } $content[] = '</pre>'; case version_compare($version, '1.4.0', '<'): $content[] = '<pre>'; $files = array('javascript/folder_contents/head.js', 'javascript/folder_contents/scripts.js', 'javascript/pick_image/head.js', 'javascript/pick_image/scripts.js', 'javascript/clear_image/body.js', 'javascript/clear_image/head.js', 'templates/style.css', 'templates/settings.tpl'); fc_updatefiles($files, $content); if (!PHPWS_Boost::inBranch()) { $content[] = file_get_contents(PHPWS_SOURCE_DIR . 'mod/filecabinet/boost/changes/1_4_0.txt'); } $content[] = '</pre>'; case version_compare($version, '1.4.1', '<'): $content[] = '<pre>'; $db = new PHPWS_DB('folders'); if (!$db->isTableColumn('module_created')) { if (PHPWS_Error::logIfError($db->addTableColumn('module_created', 'varchar(40) default null'))) { $content[] = '--- Could not create column module_created on folders table.</pre>'; return false; } else { $content[] = '--- Created module_created column on folders table.'; } } $content[] = '1.4.1 changes -------------- + module_created column missing from > 1.3.0 install. </pre>'; case version_compare($version, '1.4.2', '<'): $content[] = '<pre> 1.4.2 changes -------------- + Removed test echo 1 + moved all defines to one file. </pre>'; case version_compare($version, '2.0.0', '<'): $content[] = '<pre>'; if (PHPWS_File::copy_directory(PHPWS_SOURCE_DIR . 'mod/filecabinet/templates/', $home_dir . 'templates/filecabinet/')) { $content[] = '--- Copied complete templates directory.'; } else { $content[] = '--- Could not copy complete templates directory. Use revert or copy manually.'; } if (PHPWS_File::copy_directory(PHPWS_SOURCE_DIR . 'mod/filecabinet/img/', $home_dir . 'images/mod/filecabinet/')) { $content[] = '--- Copied complete images directory.'; } else { $content[] = '--- Could not copy complete images directory. Use revert or copy manually.'; } if (PHPWS_File::copy_directory(PHPWS_SOURCE_DIR . 'mod/filecabinet/conf/', $home_dir . 'config/filecabinet/')) { $content[] = '--- Copied complete configuration directory.'; } else { $content[] = '--- Could not copy complete configuration directory. Use revert or copy manually.'; } if (PHPWS_File::copy_directory(PHPWS_SOURCE_DIR . 'mod/filecabinet/javascript/', $home_dir . 'javascript/modules/filecabinet/')) { $content[] = '--- Copied complete javascript directory.'; } else { $content[] = '--- Could not copy complete javascript directory. Use revert or copy manually.'; } if (!PHPWS_DB::isTable('fc_convert')) { $result = PHPWS_DB::importFile(PHPWS_SOURCE_DIR . 'mod/filecabinet/boost/fc_convert.sql'); if (!PHPWS_Error::logIfError($result)) { $content[] = '--- File conversion table created successfully.'; } else { $content[] = '--- Failed to create File conversion table.</pre>'; return false; } } if (!PHPWS_DB::isTable('fc_file_assoc')) { $result = PHPWS_DB::importFile(PHPWS_SOURCE_DIR . 'mod/filecabinet/boost/file_assoc.sql'); if (!PHPWS_Error::logIfError($result)) { $content[] = '--- File assoc table created successfully.'; } else { $content[] = '--- Failed to create File assoc table.</pre>'; return false; } } $db = new PHPWS_DB('multimedia'); if (!$db->isTableColumn('duration')) { if (PHPWS_Error::logIfError($db->addTableColumn('duration', 'int not null default 0'))) { $content[] = '--- Failed to create duration column on multimedia table.</pre>'; return false; } else { $content[] = '--- Created duration column on multimedia table.'; } } if (!$db->isTableColumn('embedded')) { if (PHPWS_Error::logIfError($db->addTableColumn('embedded', 'smallint not null default 0'))) { $content[] = 'Failed to create embedded column on multimedia table.</pre>'; return false; } else { $content[] = '--- Created embedded column on multimedia table.'; } } PHPWS_Core::initModClass('filecabinet', 'Multimedia.php'); $result = $db->getObjects('PHPWS_Multimedia'); if ($result) { foreach ($result as $mm) { $mm->loadDimensions(); PHPWS_Error::logIfError($mm->save()); } } $content[] = '--- Durations added to multimedia files.'; fc_update_parent_links(); if (!checkMultimediaDir($content, $home_dir)) { return false; } if (!PHPWS_Boost::inBranch()) { $content[] = file_get_contents(PHPWS_SOURCE_DIR . 'mod/filecabinet/boost/changes/2_0_0.txt'); } $content[] = '</pre>'; case version_compare($version, '2.0.1', '<'): $content[] = '<pre>2.0.1 changes ------------- + Updated youTube import. + Removed unused code.</pre>'; case version_compare($version, '2.1.0', '<'): $content[] = '<pre>'; $files = array('templates/image_view.tpl', 'templates/settings.tpl', 'javascript/pick_file/head.js', 'javascript/pick_file/scripts.js', 'javascript/update_file/head.js', 'templates/file_manager/placeholder.tpl', 'templates/document_edit.tpl', 'templates/image_edit.tpl', 'templates/multimedia_edit.tpl', 'templates/edit_folder.tpl', 'templates/embed_edit.tpl', 'templates/style.css', 'templates/file_manager/folder_content_view.tpl', 'templates/file_manager/resize.tpl'); fc_updatefiles($files, $content); $db = new PHPWS_DB('folders'); $db->begin(); if (PHPWS_Error::logIfError($db->addTableColumn('max_image_dimension', 'smallint not null default 0'))) { $content[] = '--- Unable to add max_image_dimension column to folders table.'; $db->rollback(); return false; } else { $content[] = '--- Added max_image_dimension column to folders table.'; } $db = new PHPWS_DB('fc_file_assoc'); if (PHPWS_Error::logIfError($db->addTableColumn('width', 'smallint NOT NULL default 0'))) { $content[] = '--- Unable to add width column to fc_file_assoc.'; $db->rollback(); return false; } else { $content[] = '--- Added width column to fc_file_assoc table'; } if (PHPWS_Error::logIfError($db->addTableColumn('height', 'smallint NOT NULL default 0'))) { $content[] = '--- Unable to add height column to fc_file_assoc.'; $db->rollback(); return false; } else { $content[] = '--- Added height column to fc_file_assoc table'; } if (PHPWS_Error::logIfError($db->addTableColumn('cropped', 'smallint NOT NULL default 0'))) { $content[] = '--- Unable to add cropped column to fc_file_assoc.'; $db->rollback(); return false; } else { $content[] = '--- Added cropped column to fc_file_assoc table'; } $db->commit(); if (!PHPWS_Boost::inBranch()) { $content[] = file_get_contents(PHPWS_SOURCE_DIR . 'mod/filecabinet/boost/changes/2_1_0.txt'); } $content[] = '</pre>'; case version_compare($version, '2.2.0', '<'): $content[] = '<pre>'; $db = new PHPWS_DB('fc_file_assoc'); if (PHPWS_Error::logIfError($db->addTableColumn('vertical', 'smallint not null default 0'))) { $content[] = 'Unable to create vertical column in fc_file_assoc table.'; return false; } if (PHPWS_Error::logIfError($db->addTableColumn('num_visible', 'smallint not null default 3'))) { $content[] = 'Unable to create num_visible column in fc_file_assoc table.'; return false; } $db->dropTableColumn('cropped'); $db = new PHPWS_DB('modules'); $db->addWhere('title', 'filecabinet'); $db->addValue('unregister', 1); PHPWS_Error::logIfError($db->update()); $content[] = 'Unregister flag set in modules table.'; $files = array('javascript/jcaro_lite/', 'javascript/shutter/', 'javascript/pick_file/', 'javascript/update_file/head.js', 'javascript/update_file/default.php', 'javascript/clear_file/body.js', 'javascript/clear_file/head.js', 'javascript/clear_file/default.php', 'templates/image_view.tpl', 'templates/carousel_horz.tpl', 'templates/carousel_vert.tpl', 'templates/classify_list.tpl', 'templates/ss_box.tpl', 'templates/file_manager/carousel_pick.tpl', 'templates/file_manager/folder_content_view.tpl', 'templates/settings.tpl', 'templates/style.css', 'templates/file_list.tpl', 'templates/folder_list.tpl', 'templates/pinned.tpl', 'img/add.png', 'img/arrow_left.png', 'img/arrow_right.png', 'conf/icons.php', 'conf/config.php'); fc_updatefiles($files, $content); if (!PHPWS_Boost::inBranch()) { $content[] = file_get_contents(PHPWS_SOURCE_DIR . 'mod/filecabinet/boost/changes/2_2_0.txt'); } case version_compare($version, '2.2.1', '<'): $content[] = '<pre> 2.2.1 changes ----------------------- + Fixed folder deletion. + Clipped documents and images now have full pathing. + Fixed document smarttag</pre>'; case version_compare($version, '2.2.2', '<'): $content[] = '<pre>'; $files = array('img/mime_types/', 'templates/document_download.tpl', 'templates/file_view.css', 'templates/multi_doc_download.tpl'); fc_updatefiles($files, $content); $content[] = '2.2.2 changes ----------------------- + Fixed edit icon in document view. Needed to be salted. + Added error check to prevent possible divide by zero error. + Resized mime type icons + Changed the document download windows. Simplified. + Fixed image edit link. + Added pptm to known types. + Fixed permission checks on folders.</pre>'; case version_compare($version, '2.2.3', '<'): $content[] = '<pre>2.2.3 changes ----------------------- + Fixed document delete link</pre>'; case version_compare($version, '2.2.4', '<'): $content[] = '<pre>'; $files = array('templates/fckeditor.tpl', 'templates/fckdocuments.tpl', 'templates/fck.css', 'templates/fckimages.tpl', 'templates/fckfolders.tpl', 'templates/folder_list.tpl', 'templates/settings.tpl', 'img/folder.gif', 'javascript/fckeditor/'); fc_updatefiles($files, $content); $content[] = '2.2.4 changes ----------------------- + Error checking added to document upload. + Fixed multimedia folder pager. + Added method for fixing document directories. + Added file search to folder pager. + Added File Cabinet FCKeditor interaction. + Cleaned up so interface issues. </pre>'; case version_compare($version, '2.2.5', '<'): $content[] = '<pre>2.2.5 changes ----------------------- + Fixed bug that displayed error message on document upload. + Proper error message now on document uploaded to unwritable directory + Directory check on unwritable directory prevents upload link</pre>'; case version_compare($version, '2.2.6', '<'): $content[] = '<pre>'; $files = array('javascript/fckeditor/head.js', 'templates/fck.css'); fc_updatefiles($files, $content); $content[] = '2.2.6 changes ----------------------- + Fixed bug with editing Multimedia. + Fixed bug with File Cabinet in FCKeditor not loading folders properly. </pre>'; case version_compare($version, '2.2.7', '<'): $content[] = '<pre>'; $files = array('javascript/fckeditor/head.js', 'templates/filters/media/mediaplayer.swf', 'templates/filters/media/yt.swf'); fc_updatefiles($files, $content); $content[] = '2.2.7 changes ----------------------- + Added trim to ffmpeg file directory + Added description to search for files + Media player updated to latest version. + FCKeditor media insertion had problems with any media other than YouTube embeds. SmartTag for media is displayed instead.</pre>'; case version_compare($version, '2.3.0', '<'): $content[] = '<pre>2.3.0 changes --------------------- + Icon class implemented. + Video player changed to Flowplayer. + Lightbox option for public folders. + Image carousel switched to jcarousel with Lightbox usage. + Updated to work with core updates.</pre>'; case version_compare($version, '2.3.1', '<'): $content[] = '<pre>2.3.1 changes --------------------- + Setting added to allow direct links to documents + Fixed captioned image template</pre>'; case version_compare($version, '2.3.2', '<'): $content[] = '<pre>2.3.2 changes --------------------- + Changing public flag to private on document folders creates .htaccess file preventing world access + Added mp4/m4v to multimedia class. </pre>'; case version_compare($version, '2.4.0', '<'): $content[] = '<pre>2.4.0 changes --------------------- + Heavy ckeditor modifications. + rtmp support added. + Removed FCK code where found. + Minified some scripts. + Failed image upload will now display an error. + Can now add Access shortcut to a document. + Various bug fixes </pre>'; case version_compare($version, '2.4.1', '<'): $content[] = '<pre>2.4.1 changes ----------------------- + Fixed a possible XSS vulnerability discovered by Jakub Galczyk. + Users must have some File Cabinet permission to use the File Manager. </pre>'; case version_compare($version, '2.4.2', '<'): $content[] = '<pre>2.4.2 changes ----------------------- + Added error logging to image resize. </pre>'; case version_compare($version, '2.4.3', '<'): $content[] = '<pre>2.4.3 changes ----------------------- + Added checkbox in Settings to turn off autofloating of images in the ckeditor. </pre>'; case version_compare($version, '2.4.4', '<'): $content[] = '<pre>2.4.4 changes ----------------------- + Removed clipboard functionality. Confused users and was not + Bootstrap icons and styles added. </pre>'; case version_compare($version, '2.5.0', '<'): $content[] = '<pre>2.5.0 changes ----------------------- + img-responsive added to inserted images to work with Bootstrap + removed image widths and heights + Cropping and resizing removed from manager + Manager made larger. + Manager upload header fixed position </pre>'; case version_compare($version, '2.6.0', '<'): $content[] = <<<EOF <pre>2.6.0 changes ---------------- + Removed call to updateTag as it does not work. + Removed calls to Layout Cache (which was removed) + Updated filecabinet to work with ckeditor 4. + Updated ckeditor 4 filecabinet pop up layout. + Thumbnails of uploaded images are not shown. </pre> EOF; case version_compare($version, '2.7.0', '<'): $db = \Database::newDB(); $t1 = $db->addTable('folders'); $t1->addValue('module_created', null); $db->update(); $content[] = <<<EOF <pre>2.7.0 changes ---------------- + Javascript windows replaced with Bootstrap modal dropdowns. + Fixed thumbnail form. + Removed module_created for all folders. </pre> EOF; case version_compare($version, '2.8.0', '<'): $content[] = <<<EOF <pre>2.8.0 changes ---------------- + Rewrote CKEditor interaction with Filecabinet. Images and documents functional, multimedia uploads not complete. </pre> EOF; return true; } }
/** * * @author theFergus <kevin at tux dot appstate dot edu> */ function hms_update(&$content, $currentVersion) { $files = array(); switch ($currentVersion) { case version_compare($currentVersion, '0.1.2', '<'): $db = new PHPWS_DB(); $result = $db->importFile(PHPWS_SOURCE_DIR . 'mod/hms/boost/updates/0_1_2.sql'); if (PEAR::isError($result)) { return $result; } $files[] = 'templates/student/rlc_signup_form_page2.tmp'; PHPWS_Boost::updateFiles($files, 'hms'); $content[] = _('+ RLC application form template'); $content[] = _('+ RLC application table'); case version_compare($currentVersion, '0.1.3', '<'): $files[] = 'templates/student/rlc_signup_confirmation.tpl'; PHPWS_Boost::updateFiles($files, 'hms'); $content[] = _('+ Complete system for RLC applications'); case version_compare($currentVersion, '0.1.4', '<'): $db = new PHPWS_DB(); $result = $db->importFile(PHPWS_SOURCE_DIR . 'mod/hms/boost/updates/0_1_4.sql'); if (PEAR::isError($result)) { return $result; } $files[] = 'templates/admin/display_final_rlc_assignments.tpl'; $files[] = 'templates/admin/display_rlc_student_detail_form_questions.tpl'; $files[] = 'templates/admin/make_new_rlc_assignments.tpl'; $files[] = 'templates/admin/make_new_rlc_assignments_summary.tpl'; $files[] = 'templates/admin/display_rlc_student_detail.tpl'; $files[] = 'templates/admin/deadlines.tpl'; PHPWS_Boost::updateFiles($files, 'hms'); $content[] = _('+ RLC administration templates'); $content[] = _('+ Deadline for Questionnaire replaced by deadlines for Profile and Application'); $content[] = _('+ Deadline added for editing applications'); $content[] = _('+ Deadline added for submitting RLC applications'); case version_compare($currentVersion, '0.1.5', '<'): $db = new PHPWS_DB(); $result = $db->importFile(PHPWS_SOURCE_DIR . 'mod/hms/boost/updates/0_1_5.sql'); if (PEAR::isError($result)) { return $result; } $files[] = 'templates/admin/deadlines.tpl'; $files[] = 'templates/admin/statistics.tpl'; $files[] = 'templates/student/application_search.tpl'; $files[] = 'templates/student/application_search_pager.tpl'; $files[] = 'templates/student/application_search_results.tpl'; $files[] = 'templates/student/contract.tpl'; $files[] = 'templates/student/student_application.tpl'; $files[] = 'templates/student/student_application_combined.tpl'; $files[] = 'templates/student/student_application_redo.tpl'; PHPWS_Boost::updateFiles($files, 'hms'); $content[] = _('+ Fixed RLC deadline bug in deadlines.tpl'); $content[] = _('+ Added Number of People Assigned'); $content[] = _('+ Added Number of Applications Received'); $content[] = _('+ Added Number of Learning Community Applications Received'); $content[] = _('+ Refactored questionnaire references to application'); $content[] = _('+ Added the contract verbage for when a student first logs in'); $content[] = _('+ Completed Housing applications now go straight into the RLC application if the student said they were interested'); $content[] = _('+ Added link to allow students to go to the RLC application on first login as soon as they complete an application'); $content[] = _('+ Added link to the pdf of the contract for students that want to print it out'); case version_compare($currentVersion, '0.1.6', '<'): $db = new PHPWS_DB(); $result = $db->importFile(PHPWS_SOURCE_DIR . 'mod/hms/boost/updates/0_1_6.sql'); if (PEAR::isError($result)) { return $result; } $files[] = 'templates/admin/maintenance.tpl'; $files[] = 'templates/misc/login.tpl'; PHPWS_Boost::updateFiles($files, 'hms'); $content[] = _('+ Modifying permissions for RLC admins to approve members and assign to rooms'); $content[] = _('+ Added verbage for students to see before they login'); case version_compare($currentVersion, '0.1.7', '<'): $db = new PHPWS_DB(); $result = $db->importFile(PHPWS_SOURCE_DIR . 'mod/hms/boost/updates/0_1_7.sql'); if (PEAR::isError($result)) { return $result; } $files[] = 'templates/admin/make_new_rlc_assignments_summary.tpl'; $files[] = 'templates/admin/rlc_assignments_page.tpl'; $files[] = 'templates/admin/add_floor.tpl'; $files[] = 'templates/admin/display_room_data.tpl'; $files[] = 'templates/admin/display_hall_data.tpl'; $files[] = 'templates/admin/get_hall_floor_room.tpl'; PHPWS_Boost::updateFiles($files, 'hms'); $content[] = '+ Removed capacity_per_room'; $content[] = '+ Added bedrooms_per_room'; $content[] = '+ Added beds_per_bedroom'; $content[] = '+ Added list of existing halls when adding new halls'; $content[] = '+ Room assignments working - assignments now by bed instead of room'; case version_compare($currentVersion, '0.1.8', '<'): $db = new PHPWS_DB(); $result = $db->importFile(PHPWS_SOURCE_DIR . 'mod/hms/boost/updates/0_1_8.sql'); if (PEAR::isError($result)) { return $result; } $files[] = 'templates/admin/display_learning_community_data.tpl'; $files[] = 'templates/admin/maintenance.tpl'; $files[] = 'templates/admin/display_hall_data.tpl'; $files[] = 'templates/admin/add_floor.tpl'; $files[] = 'templates/admin/display_floor_data.tpl'; $files[] = 'templates/student/student_application.tpl'; $files[] = 'templates/admin/select_room_for_delete.tpl'; $files[] = 'templates/admin/display_room_data.tpl'; $files[] = 'templates/admin/verify_delete_room.tpl'; $files[] = 'templates/admin/select_floor_for_delete_room.tpl'; $files[] = 'templates/misc/side_thingie.tpl'; PHPWS_Boost::updateFiles($files, 'hms'); $content[] = '+ Added abbreviation and capacity changes to Add RLC template. They now properly save and delete.'; $content[] = '+ Deleting a building now deletes the bedrooms and beds in that building.'; $content[] = '+ Hid Edit Building temporarily. Bedroom/bed maintenance needs to be finished first.'; $content[] = '+ Editing a floor works again. Can not delete/add rooms from floor maintenance, must go through room menu.'; $content[] = '+ Removed gender option from student_application.tpl'; case version_compare($currentVersion, '0.1.9', '<'): $db = new PHPWS_DB(); $result = $db->importFile(PHPWS_SOURCE_DIR . 'mod/hms/boost/updates/0_1_9.sql'); if (PEAR::isError($result)) { return $result; } $files[] = 'templates/admin/maintenance.tpl'; PHPWS_Boost::updateFiles($files, 'hms'); $content[] = '+ Sync\'d with the current live release.'; case version_compare($currentVersion, '0.1.10', '<'): $files[] = 'templates/admin/assign_floor.tpl'; $files[] = 'templates/admin/bed_and_id.tpl'; $files[] = 'templates/admin/get_hall_floor.tpl'; $files[] = 'templates/admin/maintenance.tpl'; $files[] = 'templates/admin/select_floor_for_edit.tpl'; $files[] = 'templates/admin/select_residence_hall.tpl'; $files[] = 'templates/admin/select_room_for_edit.tpl'; $files[] = 'templates/student/student_application.tpl'; PHPWS_Boost::updateFiles($files, 'hms'); $content[] = '+ Changed templates regarding editing/deleting rooms and floors to be more user friendly'; $content[] = '+ Changed to version 0.1.10 to get all dev sites and production site in sync'; $content[] = '+ Changed HMS_Room so beds are deleted manually instead of through a db object'; $content[] = '+ Added mechanism to handle mass assignment of an entire floor'; $content[] = '+ Added student\'s name and gender to student application template'; $content[] = '+ All locations where usernames are saved have been extended to size 32'; $content[] = '+ All RLC question response lengths have been extended to 2048 characters'; $content[] = '+ WSDL modified to reflect change in Web Services server location'; case version_compare($currentVersion, '0.1.11', '<'): $content[] = '+ Fixed minor glitch where assignment by room range was pulling rooms incorrectly (did not take floor number into account)'; case version_compare($currentVersion, '0.1.12', '<'): $files[] = 'templates/student/contract.tpl'; PHPWS_Boost::updateFiles($files, 'hms'); $content[] = '+ Contract text now shows in a scrollable iframe'; $content[] = '+ PDF of the contract now opens in a new tab/window'; $content[] = '+ Link to Acrobat download, opens in new tab/window'; $content[] = '+ Added link to a FAQ page. We need to make sure there *is* a FAQ page.'; case version_compare($currentVersion, '0.1.13', '<'): $db = new PHPWS_DB(); $result = $db->importFile(PHPWS_SOURCE_DIR . 'mod/hms/boost/updates/0_1_13.sql'); if (PEAR::isError($result)) { return $result; } $files[] = 'templates/admin/maintenance.tpl'; $files[] = 'templates/admin/bed_and_id.tpl'; $files[] = 'templates/misc/side_thingie.tpl'; $files[] = 'templates/student/profile_form.tpl'; PHPWS_Boost::updateFiles($files, 'hms'); $content[] = '+ Jeremy\'s updates to the side bar and various debugging options'; $content[] = '+ Alphabetization of hall drop-downs'; $content[] = '+ Assign by floor should always show ascending room numbers'; $content[] = '+ Fixed bug in assign by floor that kept *all* assignments from going through'; $content[] = '+ At building creation, all deleteds should be set to 0 instead of NULL'; $content[] = '+ Added mechanism to allow viewing of all available and assigned rooms/beds in a hall'; $content[] = '+ Various bug and syntax fixes by Jeremy'; $content[] = '+ Added meal plan option when assigning by an entire floor'; $content[] = '+ Adjusted color of "optionally skipped" items in side thingie'; $content[] = '+ Added a template for the profile form'; case version_compare($currentVersion, '0.1.14', '<'): $db = new PHPWS_DB(); $result = $db->importFile(PHPWS_SOURCE_DIR . 'mod/hms/boost/updates/0_1_14.sql'); if (PEAR::isError($result)) { return $result; } $files[] = 'templates/student/profile_form.tpl'; PHPWS_Boost::updateFiles($files, 'hms'); $content[] = '+ Updated profile_form template'; case version_compare($currentVersion, '0.1.15', '<'): $db = new PHPWS_DB(); $result = $db->importFile(PHPWS_SOURCE_DIR . 'mod/hms/boost/updates/0_1_15.sql'); if (PEAR::isError($result)) { return $result; } $files[] = 'templates/student/student_success_failure_message.tpl'; $files[] = 'templates/admin/deadlines.tpl'; $files[] = 'templates/admin/maintenance.tpl'; $files[] = 'templates/admin/display_final_rlc_assignments.tpl'; $files[] = 'templates/admin/rlc_assignments_pager.tpl'; $files[] = 'templates/admin/make_new_rlc_assignments_summary.tpl'; $files[] = 'templates/student/rlc_application.tpl'; $files[] = 'templates/student/profile_form.tpl'; $files[] = 'templates/student/verify_single_student.tpl'; $files[] = 'templates/admin/get_single_username.tpl'; PHPWS_Boost::updateFiles($files, 'hms'); $content[] = '+ Added success/failure message template'; $content[] = '+ Added unique constraint to user_id column in student profiles.'; $content[] = '+ Added new deadlines (for profiles) to the deadlines page.'; $content[] = '+ Allowed access to RLC assignments on the maintenance page.'; $content[] = '+ Finalized Final RLC Assignments page.'; $content[] = '+ Fixed formatting in the RLC Applicatition assignments pager and the corresponding summary.'; $content[] = '+ Added student viewing of their RLC applications.'; case version_compare($currentVersion, '0.1.16', '<'): $db = new PHPWS_DB(); $result = $db->importFile(PHPWS_SOURCE_DIR . 'mod/hms/boost/updates/0_1_16.sql'); if (PEAR::isError($result)) { return $result; } $files[] = 'templates/student/profile_form.tpl'; PHPWS_Boost::updateFiles($files, 'hms'); $content[] = '+ Added "writing" column to student_profiles table'; $content[] = '+ Adjusted student profile template for reuse in viewing profiles'; $content[] = '+ jtickle\'s additions for ordering RLC applications'; case version_compare($currentVersion, '0.1.17', '<'): $content[] = '+ Added profile editing!'; case version_compare($currentVersion, '0.1.18', '<'): $files[] = 'templates/admin/maintenance.tpl'; $files[] = 'templates/student/profile_form.tpl'; $files[] = 'templates/profile_search.tpl'; $files[] = 'templates/profile_search_pager.tpl'; $files[] = 'templates/profile_search_results.tpl'; PHPWS_Boost::updateFiles($files, 'hms'); $content[] = '+ Yay for searching by student'; PHPWS_Boost::updateFiles($files, 'hms'); $content[] = '+ Added profile searching!'; $content[] = '+ Added code to prevent duplicate RLC Applications'; $content[] = '+ Improved "Side Thingie" to show roomate status/deadlines'; case version_compare($currentVersion, '0.1.19', '<'): $files[] = 'templates/admin/rlc_assignments_pager.tpl'; $files[] = 'templates/admin/make_new_rlc_assignments.tpl'; $files[] = 'templates/student/show_student_info.tpl'; $files[] = 'templates/admin/maintenance.tpl'; $files[] = 'templates/admin/rlc_roster.tpl'; $files[] = 'templates/admin/rlc_roster_table.tpl'; $files[] = 'templates/admin/search_by_rlc.tpl'; $files[] = 'templates/admin/full_name_gender_email.tpl'; PHPWS_Boost::updateFiles($files, 'hms'); $content[] = '+ Minor improvement to RLC Assignments pager'; $content[] = '+ Yay for searching by student actually working'; $content[] = '+ Yay for searching by RLC =)'; case version_compare($currentVersion, '0.1.21', '<'): $db = new PHPWS_DB(); $result = $db->importFile(PHPWS_SOURCE_DIR . 'mod/hms/boost/updates/0_1_21.sql'); if (PEAR::isError($result)) { return $result; } $files[] = 'templates/student/rlc_application.tpl'; PHPWS_Boost::updateFiles($files, 'hms'); $content[] = '* Modified some text when viewing a RLC app for less clutter'; $content[] = 'Roommate preference (or assigned roommate) listed in the RLC application export'; $content[] = '+ Added support for an aggregate value in the application'; $content[] = 'Calculating Aggregates...'; $db = new PHPWS_DB('hms_application'); $db->addColumn('id'); $db->addColumn('term_classification'); $db->addColumn('student_status'); $db->addColumn('preferred_bedtime'); $db->addColumn('room_condition'); $result = $db->select(); if (PEAR::isError($result)) { return $result; } /* * The following is weird, and I just wanted to take a few minutes * to explain exactly what the hell is going on here. Any students * in the database at this point have filled out an application but * do not have the aggregate number that is used to autoassign * roommates. What follows generates the appropriate aggregate * number for each student. The aggregate number is a bitmask that * will end up looking like this: * * Bits Meaning * 43 term_classification * 2 student_status * 1 preferred_bedtime * 0 room_condition * * Unfortunately, this code is duplicated in HMS_Application. * Fortunately, this code should only be needed once. */ $i = 0; foreach ($result as $row) { $aggregate = 0; $aggregate |= $row['term_classification'] - 1 << 3; $aggregate |= $row['student_status'] - 1 << 2; $aggregate |= $row['preferred_bedtime'] - 1 << 1; $aggregate |= $row['room_condition'] - 1; $db->reset(); $db->addWhere('id', $row['id']); $db->addValue('aggregate', $aggregate); $result = $db->update(); if (PEAR::isError($result)) { return $result; } $i++; } $content[] = "+ Calculated {$i} aggregates."; case version_compare($currentVersion, '0.1.22', '<'): $db = new PHPWS_DB(); $result = $db->importFile(PHPWS_SOURCE_DIR . 'mod/hms/boost/updates/0_1_22.sql'); if (PEAR::isError($result)) { return $result; } $files[] = 'templates/admin/display_room_data.tpl'; $files[] = 'templates/student/profile_search_pager.tpl'; PHPWS_Boost::updateFiles($files, 'hms'); $content[] = "* Fixed bug in pagination of student profile results"; $content[] = '** Bug still exists where search values need to be set in $_SESSION'; $content[] = "+ Added 'displayed room number' to room editing"; $content[] = "+ Added 'displayed room number' to the assign by floor/mass assignment page"; $content[] = "+ Fixed bug in assigned RLC members page where address/telephone number were displaying incorrectly or not at all"; case version_compare($currentVersion, '0.1.23', '<'): $db = new PHPWS_DB(); $result = $db->importFile(PHPWS_SOURCE_DIR . 'mod/hms/boost/updates/0_1_23.sql'); if (PEAR::isError($result)) { return $result; } $content[] = '+ Increased length of the asu_username field for RLC assignments'; $content[] = '+ Added stateful pagination when assigning people to RLCs'; $content[] = '+ Corrected count when viewing the Learning Community Assignments'; case version_compare($currentVersion, '0.1.24', '<'): $db = new PHPWS_DB(); $result = $db->importFile(PHPWS_SOURCE_DIR . 'mod/hms/boost/updates/0_1_24.sql'); if (PEAR::isError($result)) { return $result; } $files[] = 'templates/student/show_student_info.tpl'; $files[] = 'templates/admin/add_floor.tpl'; $files[] = 'templates/admin/display_floor_data.tpl'; $files[] = 'templates/admin/display_room_data.tpl'; $files[] = 'templates/admin/display_hall_data.tpl'; $files[] = 'templates/admin/add_room.tpl'; $files[] = 'templates/admin/maintenance.tpl'; PHPWS_Boost::updateFiles($files, 'hms'); $content[] = '+ Added a _deleted_ flag to hms_assignment'; $content[] = '+ Added a timestamp field to hms_assignment'; $content[] = '+ Added a move_student method to move a single student between rooms'; $content[] = '+ Student Housing Application now a link when displaying other student information (results from a search)'; $content[] = '+ Added a flag to hms_room for private rooms'; $content[] = '+ Added a flag to hms_room for ra rooms'; $content[] = '+ Added a flag to hms_room for freshman reserved rooms'; $content[] = '+ Student\'s first, middle and last names now show beside the username at the building overview page of assigned rooms/students'; $content[] = '+ Added method to add a room to a floor'; $content[] = '+ Added pricing tier to the room. Always.'; $content[] = '+ Added roommate status to the student search results.'; case version_compare($currentVersion, '0.1.25', '<'): $db = new PHPWS_DB(); $result = $db->importFile(PHPWS_SOURCE_DIR . 'mod/hms/boost/updates/0_1_25.sql'); if (PEAR::isError($result)) { return $result; } $files[] = 'templates/admin/full_name_gender_email.tpl'; $files[] = 'templates/admin/rlc_roster_table.tpl'; $files[] = 'templates/admin/maintenance.tpl'; $files[] = 'templates/admin/verify_break_roommates.tpl'; $files[] = 'templates/admin/confirm_remove_from_rlc.tpl'; PHPWS_Boost::updateFiles($files, 'hms'); $content[] = '+ Fixed numerous bugs that arrived with the _deleted_ flag'; $content[] = '+ Added the ability to review RLC Applications after assignment'; $content[] = '+ Fixed error reporting for assigning students to nonexistent rooms'; $content[] = '+ Re-instated the ability to create and break roommates'; $content[] = '+ Auto Assignment'; case version_compare($currentVersion, '0.1.26', '<'): $db = new PHPWS_DB(); $result = $db->importFile(PHPWS_SOURCE_DIR . 'mod/hms/boost/updates/0_1_26.sql'); if (PEAR::isError($result)) { return $result; } $content[] = '+ Letters are ready!'; case version_compare($currentVersion, '0.1.27', '<'): $files[] = 'templates/student/show_student_info.tpl'; PHPWS_Boost::updateFiles($files, 'hms'); $content[] = '+ Added ability to change meal plans to student search screen'; case version_compare($currentVersion, '0.1.28', '<'): $files[] = 'templates/admin/display_floor_Data.tpl'; PHPWS_Boost::updateFiles($files, 'hms'); $content[] = '+ Added ability to change movein times per floor'; case version_compare($currentVersion, '0.1.29', '<'): $files[] = 'templates/admin/maintenance.tpl'; $files[] = 'templates/admin/get_hall_floor_room.tpl'; PHPWS_Boost::updatefiles($files, 'hms'); $content[] = '+ OMG BANNER WORKS hopefully'; case version_compare($currentVersion, '0.1.30', '<'): $db = new PHPWS_DB(); $result = $db->importFile(PHPWS_SOURCE_DIR . 'mod/hms/boost/updates/0_1_30.sql'); if (PEAR::isError($result)) { return $result; } $files[] = 'templates/admin/deadlines.tpl'; $files[] = 'templates/student/main_menu_spring.tpl'; $files[] = 'templates/student/main_menu_fall.tpl'; $files[] = 'templates/student/student_application.tpl'; PHPWS_Boost::updatefiles($files, 'hms'); $content[] = '+ Added check to prevent students selecting themselves as roommates'; $content[] = '+ Added check to make sure a requested roommate has a housing application'; $content[] = '+ Cleaned up main menu, added checks for deadlines for menu options'; $content[] = '+ Fixed colors for messages returned when setting deadlines (UI)'; $content[] = '+ Added entry term to hms_application and rlc application tables'; $content[] = '+ Added entry term to student application'; case version_compare($currentVersion, '0.1.31', '<'): $db = new PHPWS_DB(); $result = $db->importFile(PHPWS_SOURCE_DIR . 'mod/hms/boost/updates/0_1_31.sql'); if (PEAR::isError($result)) { return $result; } $files[] = 'templates/student/rlc_signup_form_page1.tpl'; PHPWS_Boost::updatefiles($files, 'hms'); $content[] = '+ Added some verbage and a link to the top of the RLC signup form.'; $content[] = '+ Added activity log table'; case version_compare($currentVersion, '0.1.32', '<'): $files[] = 'templates/admin/display_room_data.tpl'; PHPWS_Boost::updatefiles($files, 'hms'); $content[] = '+ Updated edit room template to disallow room gender changes is someone is assigned.'; case version_compare($currentVersion, '0.1.33', '<'): $files[] = 'templates/admin/display_room_data.tpl'; $files[] = 'templates/admin/maintenance.tpl'; PHPWS_Boost::updatefiles($files, 'hms'); case version_compare($currentVersion, '0.2.0', '<'): $db = new PHPWS_DB(); $result = $db->importFile(PHPWS_SOURCE_DIR . 'mod/hms/boost/updates/0_2_0.sql'); if (PEAR::isError($result)) { return $result; } $files[] = 'templates/admin/maintenance.tpl'; $files[] = 'templates/admin/edit_terms.tpl'; $files[] = 'templates/admin/term_pager.tpl'; PHPWS_Boost::updatefiles($files, 'hms'); $content[] = '+ Added term database and term admin to maintenance panel'; case version_compare($currentVersion, '0.2.1', '<'): $db = new PHPWS_DB(); $result = $db->importFile(PHPWS_SOURCE_DIR . 'mod/hms/boost/updates/0_2_1.sql'); if (PEAR::isError($result)) { return $result; } $content[] = '+ Renamed entry_term column in hms_application to term'; case version_compare($currentVersion, '0.2.2', '<'): $db = new PHPWS_DB(); $result = $db->importFile(PHPWS_SOURCE_DIR . 'mod/hms/boost/updates/0_2_2.sql'); if (PEAR::isError($result)) { return $result; } case version_compare($currentVersion, '0.2.3', '<'): $db = new PHPWS_DB(); $result = $db->importFile(PHPWS_SOURCE_DIR . 'mod/hms/boost/updates/0_2_3.sql'); if (PEAR::isError($result)) { return $result; } $files[] = 'templates/admin/edit_terms.tpl'; $files[] = 'templates/admin/add_term.tpl'; $fiels[] = 'maintenance.tpl'; PHPWS_Boost::updatefiles($files, 'hms'); $content[] = '+ Redesigned hall structure'; $content[] = '+ Massive db update for hall structure changes'; $content[] = '+ Seperated add term and edit term pages'; case version_compare($currentVersion, '0.2.4', '<'): $files[] = 'templates/admin/assign_student.tpl'; $files[] = 'templates/admin/unassign_student.tpl'; $files[] = 'templates/admin/maintenance.tpl'; PHPWS_Boost::updatefiles($files, 'hms'); case version_compare($currentVersion, '0.2.5', '<'): $files[] = 'templates/admin/select_residence_hall.tpl'; PHPWS_Boost::updatefiles($files, 'hms'); case version_compare($currentVersion, '0.2.6', '<'): $files[] = 'templates/admin/assign_student_move_confirm.tpl'; PHPWS_Boost::updatefiles($files, 'hms'); case version_compare($currentVersion, '0.2.7', '<'): $files[] = 'templates/admin/maintenance.tpl'; PHPWS_Boost::updatefiles($files, 'hms'); $content[] = '+ Maintenance template was phoned in, now properly updated'; case version_compare($currentVersion, '0.2.8', '<'): $db = new PHPWS_DB(); $result = $db->importFile(PHPWS_SOURCE_DIR . 'mod/hms/boost/updates/0_2_8.sql'); if (PEAR::isError($result)) { return $result; } $files[] = 'templates/admin/select_room.tpl'; $files[] = 'template/admin/maintenance.tpl'; $files[] = 'templates/admin/edit_room.tpl'; PHPWS_Boost::updatefiles($files, 'hms'); $content[] = '+ Room selection for editing rooms now works'; $content[] = '+ Added Queue system for "offline" editing of assignments'; $content[] = '+ Room editing also works now'; case version_compare($currentVersion, '0.2.9', '<'): $files[] = 'templates/admin/select_room.tpl'; $files[] = 'templates/admin/edit_room.tpl'; $files[] = 'templates/admin/maintenance.tpl'; $files[] = 'template/admin/assignment_pager_by_room.tpl'; $files[] = 'javascript/assign_student/head.js'; $fiels[] = 'javascript/select_room/head.js'; PHPWS_Boost::updatefiles($files, 'hms'); $content[] = '+ Added queue items to Maintenance panel'; $content[] = '+ Removed "move student" link'; $content[] = '+ Added assignment pager to room edit page'; case version_compare($currentVersion, '0.2.10', '<'): $files[] = 'templates/admin/maintenance.tpl'; $files[] = 'templates/admin/edit_room.tpl'; $files[] = 'templates/admin/select_suite.tpl'; $files[] = 'javascript/select_suite/head.js'; $files[] = 'templates/admin/edit_suite.tpl'; $files[] = 'templates/admin/room_pager_by_suite.tpl'; $files[] = 'templates/admin/assignment_pager_by_suite.tpl'; PHPWS_Boost::updatefiles($files, 'hms'); $content[] = '+ Added ability to edit suites.'; $content[] = '+ Fixed "DB Error" in queued assignments'; case version_compare($currentVersion, '0.2.12', '<'): $files[] = 'javascript/autosuggest/autosuggest.js'; $files[] = 'javascript/autosuggest/head.js'; $files[] = 'javascript/autosuggest/zxml.js'; $files[] = '/templates/admin/maintenance.tpl'; PHPWS_Boost::updatefiles($files, 'hms'); $content[] = 'Autoassigner baby!'; $content[] = 'Autocompletion for usernames'; case version_compare($currentVersion, '0.2.13', '<'): $db = new PHPWS_DB(); $result = $db->importFile(PHPWS_SOURCE_DIR . 'mod/hms/boost/updates/0_2_13.sql'); if (PEAR::isError($result)) { return $result; } $files[] = 'templates/admin/movein_time_pager.tpl'; $files[] = 'templates/admin/edit_movein_time.tpl'; $files[] = 'templates/admin/maintenance.tpl'; $files[] = 'javascript/select_floor/head.js'; $files[] = 'templates/admin/select_floor.js'; $files[] = 'templates/admin/display_floor_data.tpl'; $files[] = 'templates/admin/edit_room.tpl'; $files[] = 'templates/admin/select_room.tpl'; PHPWS_Boost::updatefiles($files, 'hms'); case version_compare($currentVersion, '0.2.14', '<'): $db = new PHPWS_DB(); $result = $db->query('ALTER TABLE hms_floor DROP COLUMN ft_movein;'); if (PEAR::isError($result)) { return $result; } $result = $db->query('ALTER TABLE hms_floor DROP COLUMN c_movein;'); if (PEAR::isError($result)) { return $result; } $result = $db->query('ALTER TABLE hms_floor ADD COLUMN ft_movein_time_id smallint REFERENCES hms_movein_time(id);'); if (PEAR::isError($result)) { return $result; } $result = $db->query('ALTER TABLE hms_floor ADD COLUMN rt_movein_time_id smallint REFERENCES hms_movein_time(id);'); if (PEAR::isError($result)) { return $result; } $files[] = 'templates/admin/room_pager_by_floor.tpl'; $files[] = 'templates/admin/edit_floor.tpl'; PHPWS_Boost::updatefiles($files, 'hms'); case version_compare($currentVersion, '0.2.15', '<'): $files[] = 'templates/admin/floor_pager_by_hall.tpl'; $files[] = 'templates/admin/edit_residence_hall.tpl'; $files[] = 'templates/admin/select_residence_hall.tpl'; $files[] = 'templates/admin/maintenance.tpl'; PHPWS_Boost::updatefiles($files, 'hms'); case version_compare($currentVersion, '0.2.16', '<'): $db = new PHPWS_DB(); $result = $db->importFile(PHPWS_SOURCE_DIR . 'mod/hms/boost/updates/0_2_16.sql'); if (PEAR::isError($result)) { return $result; } $files[] = 'templates/admin/edit_room.tpl'; PHPWS_Boost::updatefiles($files, 'hms'); case version_compare($currentVersion, '0.2.17', '<'): $db = new PHPWS_DB(); $result = $db->importFile(PHPWS_SOURCE_DIR . 'mod/hms/boost/updates/0_2_17.sql'); if (PEAR::isError($result)) { return $result; } $files[] = 'templates/admin/select_bed.tpl'; $files[] = 'templates/admin/edit_bed.tpl'; $files[] = 'templates/admin/maintenance.tpl'; $files[] = 'javascript/select_bed/head.js'; $files[] = 'templates/admin/bed_pager_by_room.tpl'; $files[] = 'templates/admin/edit_room.tpl'; $files[] = 'javascript/assign_student/head.js'; $files[] = 'templates/admin/assign_student.tpl'; PHPWS_Boost::updatefiles($files, 'hms'); case version_compare($currentVersion, '0.2.18', '<'): $db = new PHPWS_DB(); $result = $db->importFile(PHPWS_SOURCE_DIR . 'mod/hms/boost/updates/0_2_18.sql'); if (PEAR::isError($result)) { return $result; } $files[] = 'templates/admin/deadlines.tpl'; PHPWS_Boost::updatefiles($files, 'hms'); case version_compare($currentVersion, '0.2.19', '<'): $db = new PHPWS_DB(); $result = $db->importFile(PHPWS_SOURCE_DIR . 'mod/hms/boost/updates/0_2_19.sql'); if (PEAR::isError($result)) { return $result; } $files[] = 'templates/admin/deadlines.tpl'; $files[] = 'templates/student/freshmen_welcome_screen.tpl'; $files[] = 'templates/student/freshmen_welcome_screen.tpl'; PHPWS_Boost::updatefiles($files, 'hms'); case version_compare($currentVersion, '0.2.20', '<'): $db = new PHPWS_DB(); $result = $db->importFIle(PHPWS_SOURCE_DIR . 'mod/hms/boost/updates/0_2_20.sql'); if (PEAR::isError($result)) { return $result; } case version_compare($currentVersion, '0.2.21', '<'): $db = new PHPWS_DB(); $result = $db->importFIle(PHPWS_SOURCE_DIR . 'mod/hms/boost/updates/0_2_21.sql'); if (PEAR::isError($result)) { return $result; } $files[] = 'templates/student/welcome_screen_freshmen.tpl'; $files[] = 'templates/student/welcome_screen_transfer.tpl'; $files[] = 'templates/student/welcome_screen_no_entry_term.tpl'; $files[] = 'templates/student/welcome_screen_deadline_past.tpl'; $files[] = 'templates/student/welcome_screen_non_traditional.tpl'; $files[] = 'templates/student/welcome_screen_too_soon.tpl'; $files[] = 'templates/student/contact_page.tpl'; $files[] = 'templates/student/contact_form_thankyou.tpl'; $files[] = 'templates/student/rlc_signup_form_page1.tpl'; $files[] = 'templates/student/rlc_singup_form_page2.tpl'; $files[] = 'templates/student/rlc_singup_confirmation.tpl'; $files[] = 'templates/student/student_application.tpl'; $files[] = 'templates/student/main_menu_fall.tpl'; $files[] = 'templates/admin/assign_student.tpl'; $files[] = 'templates/admin/deadlines.tpl'; $files[] = 'templates/admin/rlc_assignments_pager.tpl'; PHPWS_Boost::updatefiles($files, 'hms'); case version_compare($currentVersion, '0.2.22', '<'): $db = new PHPWS_DB(); $result = $db->importFile(PHPWS_SOURCE_DIR . 'mod/hms/boost/updates/0_2_22.sql'); if (PEAR::isError($result)) { return $result; } case version_compare($currentVersion, '0.2.23', '<'): $db = new PHPWS_DB(); $result = $db->importFile(PHPWS_SOURCE_DIR . 'mod/hms/boost/updates/0_2_23.sql'); if (PEAR::isError($result)) { return $result; } $files[] = 'templates/student/roommate_accept_reject_form.tpl'; $files[] = 'templates/student/select_roommate.tpl'; $files[] = 'templates/student/requestor_handle_rlc_application.tpl'; $files[] = 'templates/student/select_roommate_confirmation.tpl'; $files[] = 'templates/student/roommate_accept_reject_screen.tpl'; $files[] = 'templates/student/main_menu_fall.tpl'; $files[] = 'templates/student/roommate_accept_done.tpl'; $files[] = 'templates/student/roommate_reject_done.tpl'; $files[] = 'templates/student/requested_roommate_list.tpl'; $files[] = 'templates/student/roommate_accept_confirm.tpl'; PHPWS_Boost::updatefiles($files, 'hms'); case version_compare($currentVersion, '0.2.24', '<'): $db = new PHPWS_DB(); $result = $db->importFile(PHPWS_SOURCE_DIR . 'mod/hms/boost/updates/0_2_24.sql'); if (PEAR::isError($result)) { return $result; } case version_compare($currentVersion, '0.2.25', '<'): $db = new PHPWS_DB(); $result = $db->importFile(PHPWS_SOURCE_DIR . 'mod/hms/boost/updates/0_2_25.sql'); if (PEAR::isError($result)) { return $result; } $files[] = 'templates/admin/edit_floor.tpl'; PHPWS_Boost::updatefiles($files, 'hms'); case version_compare($currentVersion, '0.2.26', '<'): $db = new PHPWS_DB(); $result = $db->importFile(PHPWS_SOURCE_DIR . 'mod/hms/boost/updates/0_2_26.sql'); if (PEAR::isError($result)) { return $result; } $files[] = 'templates/admin/display_final_rlc_assignments.tpl'; $files[] = 'templates/student/show_student_info.tpl'; PHPWS_Boost::updatefiles($files, 'hms'); case version_compare($currentVersion, '0.2.28', '<'): $db = new PHPWS_DB(); $result = $db->importFile(PHPWS_SOURCE_DIR . 'mod/hms/boost/updates/0_2_28.sql'); if (PEAR::isError($result)) { return $result; } $files[] = 'templates/admin/term_pager.tpl'; $files[] = 'templates/admin/maintenance.tpl'; PHPWS_Boost::updateFiles($files, 'hms'); case version_compare($currentVersion, '0.2.29', '<'): PHPWS_Boost::registerMyModule('hms', 'users', $content); $files[] = 'templates/admin/permission_denied.tpl'; $files[] = 'templates/admin/maintenance.tpl'; PHPWS_Boost::updatefiles($files, 'hms'); case version_compare($currentVersion, '0.2.30', '<'): $db = new PHPWS_DB(); $result = $db->importFile(PHPWS_SOURCE_DIR . 'mod/hms/boost/updates/0_2_30.sql'); if (PEAR::isError($result)) { return $result; } $files[] = 'templates/admin/make_new_rlc_assignments.tpl'; $files[] = 'templates/admin/rlc_assignments_pager.tpl'; $files[] = 'templates/admin/view_by_rlc_pager.tpl'; $files[] = 'templates/admin/rlc_roster.tpl'; $files[] = 'templates/admin/maintenance.tpl'; $files[] = 'templates/admin/log_pager.tpl'; PHPWS_Boost::updatefiles($files, 'hms'); case version_compare($currentVersion, '0.2.31', '<'): PHPWS_Boost::registerMyModule('hms', 'users', $content); // ust need to update the permissions // ust need to update the permissions case version_compare($currentVersion, '0.2.32', '<'): $files[] = 'templates/admin/show_confirmed_roommates.tpl'; $files[] = 'templates/admin/roommate_pager.tpl'; $files[] = 'templates/admin/create_roommate_group.tpl'; PHPWS_Boost::updatefiles($files, 'hms'); case version_compare($currentVersion, '0.2.33', '<'): $db = new PHPWS_DB(); $result = $db->importFile(PHPWS_SOURCE_DIR . 'mod/hms/boost/updates/0_2_33.sql'); if (PEAR::isError($result)) { return $result; } case version_compare($currentVersion, '0.2.34', '<'): $files[] = 'templates/admin/display_reports.tpl'; PHPWS_Boost::updateFiles($files, 'hms'); $content[] = 'Added Special Needs report.'; $content[] = 'Reports now better suited for printing.'; case version_compare($currentVersion, '0.2.35', '<'): $files[] = 'templates/admin/statistics.tpl'; PHPWS_Boost::updateFiles($files, 'hms'); $db = new PHPWS_Db(); $result = $db->importFile(PHPWS_SOURCE_DIR . 'mod/hms/boost/updates/0_2_35.sql'); if (PEAR::isError($result)) { return $result; } $content[] = 'Updated Statistics Template'; $content[] = 'Updated Term Information'; case version_compare($currentVersion, '0.2.36', '<'): $db = new PHPWS_Db(); $result = $db->importFile(PHPWS_SOURCE_DIR . 'mod/hms/boost/updates/0_2_36.sql'); if (PEAR::isError($result)) { return $result; } case version_compare($currentVersion, '0.2.40', '<'): PHPWS_Boost::registerMyModule('hms', 'users', $content); // ust need to update the permissions // ust need to update the permissions case version_compare($currentVersion, '0.2.41', '<'): $files[] = 'templates/admin/activity_log_pager.tpl'; PHPWS_Boost::updateFiles($files, 'hms'); case version_compare($currentVersion, '0.2.42', '<'): $files[] = 'templates/admin/maintenance.tpl'; PHPWS_Boost::updatefiles($files, 'hms'); $db = new PHPWS_Db(); $result = $db->importFile(PHPWS_SOURCE_DIR . 'mod/hms/boost/updates/0_2_42.sql'); if (PEAR::isError($result)) { return $result; } case version_compare($currentVersion, '0.2.45', '<'): PHPWS_Core::initModClass('users', 'Permission.php'); Users_Permission::registerPermissions('hms', $content); case version_compare($currentVersion, '0.2.46', '<'): PHPWS_Core::initModClass('users', 'Permission.php'); Users_Permission::registerPermissions('hms', $content); case version_compare($currentVersion, '0.2.49', '<'): $db = new PHPWS_DB(); $result = $db->importFile(PHPWS_SOURCE_DIR . 'mod/hms/boost/updates/0_2_49.sql'); if (PEAR::isError($result)) { return $result; } case version_compare($currentVersion, '0.2.50', '<'): $db = new PHPWS_DB(); $result = $db->importFile(PHPWS_SOURCE_DIR . 'mod/hms/boost/updates/0_2_50.sql'); if (PEAR::isError($result)) { return $result; } case version_compare($currentVersion, '0.2.51', '<'): $db = new PHPWS_DB(); $result = $db->importFile(PHPWS_SOURCE_DIR . 'mod/hms/boost/updates/0_2_51.sql'); if (PEAR::isError($result)) { return $result; } case version_compare($currentVersion, '0.2.52', '<'): $db = new PHPWS_DB(); $result = $db->importFile(PHPWS_SOURCE_DIR . 'mod/hms/boost/updates/0_2_52.sql'); if (PEAR::isError($result)) { return $result; } case version_compare($currentVersion, '0.3.0', '<'): $db = new PHPWS_DB(); $result = $db->importFile(PHPWS_SOURCE_DIR . 'mod/hms/boost/updates/0_3_0.sql'); if (PEAR::isError($result)) { return $result; } case version_compare($currentVersion, '0.3.1', '<'): $db = new PHPWS_DB(); $result = $db->importFile(PHPWS_SOURCE_DIR . 'mod/hms/boost/updates/0_3_1.sql'); if (PEAR::isError($result)) { return $result; } case version_compare($currentVersion, '0.3.2', '<'): $db = new PHPWS_DB(); $result = $db->importFile(PHPWS_SOURCE_DIR . 'mod/hms/boost/updates/0_3_2.sql'); if (PEAR::isError($result)) { return $result; } case version_compare($currentVersion, '0.3.3', '<'): $db = new PHPWS_DB(); $result = $db->importFile(PHPWS_SOURCE_DIR . 'mod/hms/boost/updates/0_3_3.sql'); if (PEAR::isError($result)) { return $result; } case version_compare($currentVersion, '0.3.5', '<'): PHPWS_Core::initModClass('users', 'Permission.php'); Users_Permission::registerPermissions('hms', $content); case version_compare($currentVersion, '0.3.7', '<'): $db = new PHPWS_DB(); $result = $db->importFile(PHPWS_SOURCE_DIR . 'mod/hms/boost/updates/0_3_7.sql'); if (PEAR::isError($result)) { return $result; } case version_compare($currentVersion, '0.3.8', '<'): $db = new PHPWS_DB(); $result = $db->importFile(PHPWS_SOURCE_DIR . 'mod/hms/boost/updates/0_3_8.sql'); if (PEAR::isError($result)) { return $result; } case version_compare($currentVersion, '0.3.9', '<'): $db = new PHPWS_DB(); $result = $db->importFile(PHPWS_SOURCE_DIR . 'mod/hms/boost/updates/0_3_9.sql'); if (PEAR::isError($result)) { return $result; } case version_compare($currentVersion, '0.3.10', '<'): PHPWS_Core::initModClass('users', 'Permission.php'); Users_Permission::registerPermissions('hms', $content); $db = new PHPWS_DB(); $result = $db->importFile(PHPWS_SOURCE_DIR . 'mod/hms/boost/updates/0_3_10.sql'); if (PEAR::isError($result)) { return $result; } case version_compare($currentVersion, '0.3.11', '<'): PHPWS_Core::initModClass('users', 'Permission.php'); Users_Permission::registerPermissions('hms', $content); case version_compare($currentVersion, '0.3.13', '<'): PHPWS_Core::initModClass('users', 'Permission.php'); Users_Permission::registerPermissions('hms', $content); $db = new PHPWS_DB(); $result = $db->importFile(PHPWS_SOURCE_DIR . 'mod/hms/boost/updates/0_3_13.sql'); if (PEAR::isError($result)) { return $result; } case version_compare($currentVersion, '0.3.16', '<'): $db = new PHPWS_DB(); $result = $db->importFile(PHPWS_SOURCE_DIR . 'mod/hms/boost/updates/0_3_16.sql'); if (PEAR::isError($result)) { return $result; } case version_compare($currentVersion, '0.3.17', '<'): $db = new PHPWS_DB(); $result = $db->importFile(PHPWS_SOURCE_DIR . 'mod/hms/boost/updates/0_3_17.sql'); if (PEAR::isError($result)) { return $result; } case version_compare($currentVersion, '0.3.18', '<'): $db = new PHPWS_DB(); $result = $db->importFile(PHPWS_SOURCE_DIR . 'mod/hms/boost/updates/0_3_18.sql'); if (PEAR::isError($result)) { return $result; } case version_compare($currentVersion, '0.3.19', '<'): PHPWS_Core::initModClass('users', 'Permission.php'); Users_Permission::registerPermissions('hms', $content); $db = new PHPWS_DB(); $result = $db->importFile(PHPWS_SOURCE_DIR . 'mod/hms/boost/updates/0_3_19.sql'); if (PEAR::isError($result)) { return $result; } case version_compare($currentVersion, '0.3.20', '<'): $db = new PHPWS_DB(); $result = $db->importFile(PHPWS_SOURCE_DIR . 'mod/hms/boost/updates/0_3_20.sql'); if (PEAR::isError($result)) { return $result; } case version_compare($currentVersion, '0.3.21', '<'): $db = new PHPWS_DB(); $result = $db->importFile(PHPWS_SOURCE_DIR . 'mod/hms/boost/updates/0_3_21.sql'); if (PEAR::isError($result)) { return $result; } case version_compare($currentVersion, '0.3.31', '<'): $db = new PHPWS_DB(); $result = $db->importFile(PHPWS_SOURCE_DIR . 'mod/hms/boost/updates/0_3_31.sql'); if (PEAR::isError($result)) { return $result; } case version_compare($currentVersion, '0.4.0', '<'): $db = new PHPWS_DB(); $result = $db->importFile(PHPWS_SOURCE_DIR . 'mod/hms/boost/updates/0_4_0.sql'); if (PEAR::isError($result)) { return $result; } case version_compare($currentVersion, '0.4.1', '<'): $db = new PHPWS_DB(); $result = $db->importFile(PHPWS_SOURCE_DIR . 'mod/hms/boost/updates/0_4_1.sql'); if (PEAR::isError($result)) { return $result; } case version_compare($currentVersion, '0.4.2', '<'): PHPWS_Core::initModClass('users', 'Permission.php'); Users_Permission::registerPermissions('hms', $content); $db = new PHPWS_DB(); $result = $db->importFile(PHPWS_SOURCE_DIR . 'mod/hms/boost/updates/0_4_2.sql'); if (PEAR::isError($result)) { return $result; } case version_compare($currentVersion, '0.4.3', '<'): $db = new PHPWS_DB(); $result = $db->importFile(PHPWS_SOURCE_DIR . 'mod/hms/boost/updates/0_4_3.sql'); if (PEAR::isError($result)) { return $result; } case version_compare($currentVersion, '0.4.4', '<'): $db = new PHPWS_DB(); $result = $db->importFile(PHPWS_SOURCE_DIR . 'mod/hms/boost/updates/0_4_4.sql'); if (PEAR::isError($result)) { return $result; } case version_compare($currentVersion, '0.4.5', '<'): $db = new PHPWS_DB(); $result = $db->importFile(PHPWS_SOURCE_DIR . 'mod/hms/boost/updates/0_4_5.sql'); if (PEAR::isError($result)) { return $result; } case version_compare($currentVersion, '0.4.6', '<'): $db = new PHPWS_DB(); $result = $db->importFile(PHPWS_SOURCE_DIR . 'mod/hms/boost/updates/0_4_6.sql'); if (PEAR::isError($result)) { return $result; } case version_compare($currentVersion, '0.4.7', '<'): $db = new PHPWS_DB(); $result = $db->importFile(PHPWS_SOURCE_DIR . 'mod/hms/boost/updates/0_4_7.sql'); if (PEAR::isError($result)) { return $result; } case version_compare($currentVersion, '0.4.9', '<'): $db = new PHPWS_DB(); $result = $db->importFile(PHPWS_SOURCE_DIR . 'mod/hms/boost/updates/0_4_9.sql'); if (PEAR::isError($result)) { return $result; } case version_compare($currentVersion, '0.4.12', '<'): $db = new PHPWS_DB(); $result = $db->importFile(PHPWS_SOURCE_DIR . 'mod/hms/boost/updates/0_4_12.sql'); if (PEAR::isError($result)) { return $result; } case version_compare($currentVersion, '0.4.13', '<'): $db = new PHPWS_DB(); $result = $db->importFile(PHPWS_SOURCE_DIR . 'mod/hms/boost/updates/0_4_13.sql'); if (PEAR::isError($result)) { return $result; } case version_compare($currentVersion, '0.4.14', '<'): $db = new PHPWS_DB(); $result = $db->importFile(PHPWS_SOURCE_DIR . 'mod/hms/boost/updates/0_4_14.sql'); if (PEAR::isError($result)) { return $result; } case version_compare($currentVersion, '0.4.15', '<'): PHPWS_Core::initModClass('users', 'Permission.php'); Users_Permission::registerPermissions('hms', $content); case version_compare($currentVersion, '0.4.18', '<'): PHPWS_Core::initModClass('users', 'Permission.php'); Users_Permission::registerPermissions('hms', $content); case version_compare($currentVersion, '0.4.19', '<'): $db = new PHPWS_DB(); $result = $db->importFile(PHPWS_SOURCE_DIR . 'mod/hms/boost/updates/0_4_19.sql'); if (PEAR::isError($result)) { return $result; } PHPWS_Core::initModClass('users', 'Permission.php'); Users_Permission::registerPermissions('hms', $content); case version_compare($currentVersion, '0.4.22', '<'): $files[] = 'templates/admin/floor_assignment.tpl'; PHPWS_Boost::updatefiles($files, 'hms'); PHPWS_Core::initModClass('users', 'Permission.php'); Users_Permission::registerPermissions('hms', $content); case version_compare($currentVersion, '0.4.23', '<'): $db = new PHPWS_DB(); $result = $db->importFile(PHPWS_SOURCE_DIR . 'mod/hms/boost/updates/0_4_23.sql'); if (PEAR::isError($result)) { return $result; } case version_compare($currentVersion, '0.4.24', '<'): $db = new PHPWS_DB(); $result = $db->importFile(PHPWS_SOURCE_DIR . 'mod/hms/boost/updates/0_4_24.sql'); if (PEAR::isError($result)) { return $result; } case version_compare($currentVersion, '0.4.26', '<'): $db = new PHPWS_DB(); $result = $db->importFile(PHPWS_SOURCE_DIR . 'mod/hms/boost/updates/0_4_26.sql'); if (PEAR::isError($result)) { return $result; } case version_compare($currentVersion, '0.4.28', '<'): $db = new PHPWS_DB(); $result = $db->importFile(PHPWS_SOURCE_DIR . 'mod/hms/boost/updates/0_4_28.sql'); if (PEAR::isError($result)) { return $result; } case version_compare($currentVersion, '0.4.30', '<'): PHPWS_Core::initModClass('users', 'Permission.php'); Users_Permission::registerPermissions('hms', $content); case version_compare($currentVersion, '0.4.32', '<'): $db = new PHPWS_DB(); $result = $db->importFile(PHPWS_SOURCE_DIR . 'mod/hms/boost/updates/0_4_32.sql'); if (PEAR::isError($result)) { return $result; } case version_compare($currentVersion, '0.4.33', '<'): PHPWS_Core::initModClass('users', 'Permission.php'); Users_Permission::registerPermissions('hms', $content); $db = new PHPWS_DB(); $result = $db->importFile(PHPWS_SOURCE_DIR . 'mod/hms/boost/updates/0_4_33.sql'); if (PEAR::isError($result)) { return $result; } case version_compare($currentVersion, '0.4.34', '<'): $db = new PHPWS_DB(); $result = $db->importFile(PHPWS_SOURCE_DIR . 'mod/hms/boost/updates/0_4_34.sql'); if (PEAR::isError($result)) { return $result; } case version_compare($currentVersion, '0.4.35', '<'): $db = new PHPWS_DB(); $result = $db->importFile(PHPWS_SOURCE_DIR . 'mod/hms/boost/updates/0_4_35.sql'); if (PEAR::isError($result)) { return $result; } case version_compare($currentVersion, '0.4.37', '<'): $db = new PHPWS_DB(); $result = $db->importFile(PHPWS_SOURCE_DIR . 'mod/hms/boost/updates/0_4_37.sql'); if (PEAR::isError($result)) { return $result; } case version_compare($currentVersion, '0.4.38', '<'): $db = new PHPWS_DB(); $result = $db->importFile(PHPWS_SOURCE_DIR . 'mod/hms/boost/updates/0_4_38.sql'); if (PEAR::isError($result)) { return $result; } case version_compare($currentVersion, '0.4.39', '<'): $db = new PHPWS_DB(); $result = $db->importFile(PHPWS_SOURCE_DIR . 'mod/hms/boost/updates/0_4_39.sql'); if (PEAR::isError($result)) { return $result; } case version_compare($currentVersion, '0.4.42', '<'): $db = new PHPWS_DB(); $result = $db->importFile(PHPWS_SOURCE_DIR . 'mod/hms/boost/updates/0_4_42.sql'); if (PEAR::isError($result)) { return $result; } case version_compare($currentVersion, '0.4.43', '<'): PHPWS_Core::initModClass('users', 'Permission.php'); Users_Permission::registerPermissions('hms', $content); $db = new PHPWS_DB(); $result = $db->importFile(PHPWS_SOURCE_DIR . 'mod/hms/boost/updates/0_4_43.sql'); if (PEAR::isError($result)) { return $result; } case version_compare($currentVersion, '0.4.44', '<'): $db = new PHPWS_DB(); $result = $db->importFile(PHPWS_SOURCE_DIR . 'mod/hms/boost/updates/0_4_44.sql'); if (PEAR::isError($result)) { return $result; } case version_compare($currentVersion, '0.4.45', '<'): $db = new PHPWS_DB(); $result = $db->importFile(PHPWS_SOURCE_DIR . 'mod/hms/boost/updates/0_4_45.sql'); if (PEAR::isError($result)) { return $result; } case version_compare($currentVersion, '0.4.47', '<'): $db = new PHPWS_DB(); $result = $db->importFile(PHPWS_SOURCE_DIR . 'mod/hms/boost/updates/0_4_47.sql'); if (PEAR::isError($result)) { return $result; } case version_compare($currentVersion, '0.4.48', '<'): $db = new PHPWS_DB(); $result = $db->importFile(PHPWS_SOURCE_DIR . 'mod/hms/boost/updates/0_4_48.sql'); if (PEAR::isError($result)) { return $result; } case version_compare($currentVersion, '0.4.49', '<'): $db = new PHPWS_DB(); $result = $db->importFile(PHPWS_SOURCE_DIR . 'mod/hms/boost/updates/0_4_49.sql'); if (PEAR::isError($result)) { return $result; } case version_compare($currentVersion, '0.4.50', '<'): $db = new PHPWS_DB(); $result = $db->importFile(PHPWS_SOURCE_DIR . 'mod/hms/boost/updates/0_4_50.sql'); if (PEAR::isError($result)) { return $result; } case version_compare($currentVersion, '0.4.51', '<'): $db = new PHPWS_DB(); $result = $db->importFile(PHPWS_SOURCE_DIR . 'mod/hms/boost/updates/0_4_51.sql'); if (PEAR::isError($result)) { return $result; } case version_compare($currentVersion, '0.4.52', '<'): $db = new PHPWS_DB(); $result = $db->importFile(PHPWS_SOURCE_DIR . 'mod/hms/boost/updates/0_4_52.sql'); if (PEAR::isError($result)) { return $result; } Users_Permission::registerPermissions('hms', $content); case version_compare($currentVersion, '0.4.53', '<'): $db = new PHPWS_DB(); $result = $db->importFile(PHPWS_SOURCE_DIR . 'mod/hms/boost/updates/0_4_53.sql'); if (PEAR::isError($result)) { return $result; } case version_compare($currentVersion, '0.4.55', '<'): $db = new PHPWS_DB(); $result = $db->importFile(PHPWS_SOURCE_DIR . 'mod/hms/boost/updates/0_4_55.sql'); if (PEAR::isError($result)) { return $result; } case version_compare($currentVersion, '0.4.61', '<'): $db = new PHPWS_DB(); $result = $db->importFile(PHPWS_SOURCE_DIR . 'mod/hms/boost/updates/0_4_61.sql'); if (PEAR::isError($result)) { return $result; } PHPWS_Core::initModClass('users', 'Permission.php'); Users_Permission::registerPermissions('hms', $content); case version_compare($currentVersion, '0.4.63', '<'): $db = new PHPWS_DB(); $result = $db->importFile(PHPWS_SOURCE_DIR . 'mod/hms/boost/updates/00-04-63.sql'); if (PEAR::isError($result)) { return $result; } case version_compare($currentVersion, '0.4.66', '<'): $db = new PHPWS_DB(); $result = $db->importFile(PHPWS_SOURCE_DIR . 'mod/hms/boost/updates/00-04-66.sql'); if (PEAR::isError($result)) { return $result; } case version_compare($currentVersion, '0.4.67', '<'): $db = new PHPWS_DB(); $result = $db->importFile(PHPWS_SOURCE_DIR . 'mod/hms/boost/updates/00-04-67.sql'); if (PEAR::isError($result)) { return $result; } case version_compare($currentVersion, '0.4.68', '<'): $db = new PHPWS_DB(); $result = $db->importFile(PHPWS_SOURCE_DIR . 'mod/hms/boost/updates/00-04-68.sql'); if (PEAR::isError($result)) { return $result; } PHPWS_Core::initModClass('users', 'Permission.php'); Users_Permission::registerPermissions('hms', $content); case version_compare($currentVersion, '0.4.69', '<'): $db = new PHPWS_DB(); $result = $db->importFile(PHPWS_SOURCE_DIR . 'mod/hms/boost/updates/00-04-69.sql'); if (PEAR::isError($result)) { return $result; } case version_compare($currentVersion, '0.4.70', '<'): $db = new PHPWS_DB(); $result = $db->importFile(PHPWS_SOURCE_DIR . 'mod/hms/boost/updates/00-04-70.sql'); if (PEAR::isError($result)) { return $result; } case version_compare($currentVersion, '0.4.71', '<'): PHPWS_Core::initModClass('users', 'Permission.php'); Users_Permission::registerPermissions('hms', $content); case version_compare($currentVersion, '0.4.72', '<'): $db = new PHPWS_DB(); $result = $db->importFile(PHPWS_SOURCE_DIR . 'mod/hms/boost/updates/00-04-72.sql'); if (PEAR::isError($result)) { return $result; } case version_compare($currentVersion, '0.4.73', '<'): $db = new PHPWS_DB(); $result = $db->importFile(PHPWS_SOURCE_DIR . 'mod/hms/boost/updates/00-04-73.sql'); if (PEAR::isError($result)) { return $result; } case version_compare($currentVersion, '0.4.74', '<'): $db = new PHPWS_DB(); $result = $db->importFile(PHPWS_SOURCE_DIR . 'mod/hms/boost/updates/00-04-74.sql'); if (PEAR::isError($result)) { return $result; } case version_compare($currentVersion, '0.4.75', '<'): $db = new PHPWS_DB(); $result = $db->importFile(PHPWS_SOURCE_DIR . 'mod/hms/boost/updates/00-04-75.sql'); if (PEAR::isError($result)) { return $result; } case version_compare($currentVersion, '0.4.77', '<'): PHPWS_Core::initModClass('users', 'Permission.php'); Users_Permission::registerPermissions('hms', $content); case version_compare($currentVersion, '0.4.78', '<'): $db = new PHPWS_DB(); $result = $db->importFile(PHPWS_SOURCE_DIR . 'mod/hms/boost/updates/00-04-78.sql'); if (PEAR::isError($result)) { return $result; } case version_compare($currentVersion, '0.4.79', '<'): $db = new PHPWS_DB(); $result = $db->importFile(PHPWS_SOURCE_DIR . 'mod/hms/boost/updates/00-04-79.sql'); if (PEAR::isError($result)) { return $result; } case version_compare($currentVersion, '0.4.80', '<'): $db = new PHPWS_DB(); $result = $db->importFile(PHPWS_SOURCE_DIR . 'mod/hms/boost/updates/00-04-80.sql'); if (PEAR::isError($result)) { return $result; } case version_compare($currentVersion, '0.4.81', '<'): $db = new PHPWS_DB(); $result = $db->importFile(PHPWS_SOURCE_DIR . 'mod/hms/boost/updates/00-04-81.sql'); if (PEAR::isError($result)) { return $result; } case version_compare($currentVersion, '0.4.82', '<'): PHPWS_Core::initModClass('users', 'Permission.php'); Users_Permission::registerPermissions('hms', $content); case version_compare($currentVersion, '0.4.83', '<'): $db = new PHPWS_DB(); $result = $db->importFile(PHPWS_SOURCE_DIR . 'mod/hms/boost/updates/00-04-83.sql'); if (PEAR::isError($result)) { return $result; } case version_compare($currentVersion, '0.4.84', '<'): PHPWS_Core::initModClass('users', 'Permission.php'); Users_Permission::registerPermissions('hms', $content); case version_compare($currentVersion, '0.4.85', '<'): $db = new PHPWS_DB(); $result = $db->importFile(PHPWS_SOURCE_DIR . 'mod/hms/boost/updates/00-04-85.sql'); if (PEAR::isError($result)) { return $result; } case version_compare($currentVersion, '0.4.86', '<'): $db = new PHPWS_DB(); $result = $db->importFile(PHPWS_SOURCE_DIR . 'mod/hms/boost/updates/00-04-86.sql'); if (PEAR::isError($result)) { return $result; } case version_compare($currentVersion, '0.4.87', '<'): PHPWS_Core::initModClass('users', 'Permission.php'); Users_Permission::registerPermissions('hms', $content); case version_compare($currentVersion, '0.4.88', '<'): $db = new PHPWS_DB(); $result = $db->importFile(PHPWS_SOURCE_DIR . 'mod/hms/boost/updates/00-04-88.sql'); if (PEAR::isError($result)) { return $result; } case version_compare($currentVersion, '0.4.89', '<'): $db = new PHPWS_DB(); $result = $db->importFile(PHPWS_SOURCE_DIR . 'mod/hms/boost/updates/00-04-89.sql'); if (PEAR::isError($result)) { return $result; } case version_compare($currentVersion, '0.4.90', '<'): $db = new PHPWS_DB(); $result = $db->importFile(PHPWS_SOURCE_DIR . 'mod/hms/boost/updates/00-04-90.sql'); if (PEAR::isError($result)) { return $result; } case version_compare($currentVersion, '0.4.91', '<'): $db = new PHPWS_DB(); $result = $db->importFile(PHPWS_SOURCE_DIR . 'mod/hms/boost/updates/00-04-91.sql'); if (PEAR::isError($result)) { return $result; } case version_compare($currentVersion, '0.4.92', '<'): PHPWS_Core::initModClass('users', 'Permission.php'); Users_Permission::registerPermissions('hms', $content); $db = new PHPWS_DB(); $result = $db->importFile(PHPWS_SOURCE_DIR . 'mod/hms/boost/updates/00-04-92.sql'); if (PEAR::isError($result)) { return $result; } case version_compare($currentVersion, '0.5.0', '<'): $db = new PHPWS_DB(); $result = $db->importFile(PHPWS_SOURCE_DIR . 'mod/hms/boost/updates/00-05-00.sql'); if (PEAR::isError($result)) { return $result; } case version_compare($currentVersion, '0.5.1', '<'): $db = new PHPWS_DB(); $result = $db->importFile(PHPWS_SOURCE_DIR . 'mod/hms/boost/updates/00-05-01.sql'); if (PEAR::isError($result)) { return $result; } case version_compare($currentVersion, '0.5.2', '<'): $db = new PHPWS_DB(); $result = $db->importFile(PHPWS_SOURCE_DIR . 'mod/hms/boost/updates/00-05-02.sql'); if (PEAR::isError($result)) { return $result; } case version_compare($currentVersion, '0.5.3', '<'): PHPWS_Core::initCoreClass('Module.php'); $module = new \PHPWS_Module('pulse', false); $pulse_version = $module->getVersion(); if (version_compare($pulse_version, '2.0.0', '<')) { $content[] = '<p style="color:red;font-weight:bold">Pulse needs to be upgraded.</p>'; } $db = new PHPWS_DB(); $result = $db->importFile(PHPWS_SOURCE_DIR . 'mod/hms/boost/updates/00-05-03.sql'); if (PEAR::isError($result)) { return $result; } case version_compare($currentVersion, '0.5.4', '<'): $content[] = '<pre>Adding hms_hall_structure view.</pre>'; $db = new PHPWS_DB(); $result = $db->importFile(PHPWS_SOURCE_DIR . 'mod/hms/boost/updates/00-05-04.sql'); if (PEAR::isError($result)) { return $result; } case version_compare($currentVersion, '0.5.5', '<'): $db = new PHPWS_DB(); $result = $db->importFile(PHPWS_SOURCE_DIR . 'mod/hms/boost/updates/00-05-05.sql'); if (PEAR::isError($result)) { return $result; } case version_compare($currentVersion, '0.5.6', '<'): $db = new PHPWS_DB(); $result = $db->importFile(PHPWS_SOURCE_DIR . 'mod/hms/boost/updates/00-05-06.sql'); if (PEAR::isError($result)) { return $result; } } return TRUE; }
private function lengthenLinks() { $db = new PHPWS_DB('menu_links'); $db->addColumn('id'); $db->addColumn('url'); $db->addColumn('key_id'); $db->addWhere('url', 'pagesmith/[0-9]+$', 'regexp'); $result = $db->select(); if (empty($result)) { return true; } elseif (PHPWS_Error::logIfError($result)) { return false; } $db->reset(); $db2 = new PHPWS_DB('phpws_key'); foreach ($result as $link) { $link['url'] = preg_replace('@pagesmith/(\\d+)$@', 'index.php?module=pagesmith&uop=view_page&id=\\1', $link['url']); $db->addValue($link); $db->addWhere('id', $link['id']); if (!PHPWS_Error::logIfError($db->update()) && $link['key_id']) { $db2->addValue('url', $link['url']); $db2->addWhere('id', $link['key_id']); PHPWS_Error::logIfError($db2->update()); $db2->reset(); } $db->reset(); } }
function doMove() { if (!Current_User::authorized('wiki', 'edit_page') && !(PHPWS_Settings::get('wiki', 'allow_page_edit') && Current_User::isLogged()) || !$this->allow_edit) { Current_User::disallow(dgettext('wiki', 'User attempted to execute a wiki page move.')); return; } if (strlen($_POST['newpage']) == 0) { WikiManager::sendMessage(dgettext('wiki', 'Please supply a new page title'), array('page_op' => 'move', 'page' => $this->getTitle(FALSE))); } $db = new PHPWS_DB('wiki_pages'); $db->addWhere('title', $_POST['newpage']); $result = $db->select(); if ($result != NULL) { WikiManager::sendMessage(dgettext('wiki', 'Page with that name already exists!'), array('page_op' => 'move', 'page' => $this->getTitle(FALSE))); } $this->setTitle($_POST['newpage']); $db->reset(); $db->saveObject($this); $db2 = new PHPWS_DB('wiki_pages_version'); $db2->addWhere('title', $_POST['page']); $db2->addValue('title', $this->getTitle(FALSE)); $db2->update(); $db3 = new PHPWS_DB('phpws_key'); $db3->addWhere('item_id', $this->getId()); $db3->addWhere('module', 'wiki'); $db3->addValue('title', $this->getTitle()); $db3->addValue('url', (MOD_REWRITE_ENABLED ? 'wiki/' : 'index.php?module=wiki&page=') . $this->getTitle(FALSE)); $db3->update(); // Create redirect page $redirect = new WikiPage($_POST['page']); $redirect->setPagetext(sprintf(dgettext('wiki', 'This page has moved to %s. Please modify links to point to the new location.'), $this->getTitle(FALSE))); $redirect->setOwnerId(Current_User::getId()); $redirect->setEditorId(Current_User::getId()); $redirect->setCreated(mktime()); $redirect->setUpdated(mktime()); $redirect->setComment(sprintf(dgettext('wiki', 'Moved page to %s.'), $this->getTitle(FALSE))); $redirect->save(); PHPWS_Core::initModClass('version', 'Version.php'); $version = new Version('wiki_pages'); $version->setSource($redirect); $version->setApproved(1); $version->save(); WikiManager::sendMessage(dgettext('wiki', 'Wiki Page Moved!'), array('page' => $this->getTitle(FALSE)), FALSE); }
public function reorderLinks() { if (!$this->id) { return false; } $db = new PHPWS_DB('menu_links'); $db->addWhere('menu_id', $this->id); $db->addColumn('id'); $db->addColumn('parent'); $db->addColumn('link_order'); $db->addOrder('link_order'); $db->setIndexBy('parent'); $result = $db->select(); if (empty($result)) { return; } foreach ($result as $parent_id => $links) { if (empty($links)) { continue; } $count = 1; if (isset($links[0])) { foreach ($links as $link) { $db->reset(); $db->addWhere('id', $link['id']); $db->addValue('link_order', $count); PHPWS_Error::logIfError($db->update()); $count++; } } else { $db->reset(); $db->addWhere('id', $links['id']); $db->addValue('link_order', $count); PHPWS_Error::logIfError($db->update()); } } return true; }
/** * @author Matthew McNaney <mcnaney at gmail dot com> * @version $Id$ */ function users_update(&$content, $currentVersion) { $home_dir = PHPWS_Boost::getHomeDir(); switch ($currentVersion) { case version_compare($currentVersion, '2.2.0', '<'): $content[] = 'This package does not update versions under 2.2.0'; return false; case version_compare($currentVersion, '2.2.1', '<'): $content[] = '+ Fixed a bug causing conflicts between user and group permissions.'; case version_compare($currentVersion, '2.2.2', '<'): $content[] = '+ Set username to the same character size in both users table and user_authorization.'; $content[] = '+ Fixed typo causing branch installation failure on Postgresql.'; case version_compare($currentVersion, '2.3.0', '<'): $content[] = '<pre> 2.3.0 changes ------------------------ + Added translate function calls in classes and my_page.php + my_page hides translation option if language defines disable selection + Added a unrestricted only parameter to Current_User\'s allow and authorize functions + Dropped references from some constructors + Added error check to setPermissions function: won\'t accept empty group id + Changed id default to zero. + Removed unneeded function parameter on getGroups </pre> '; case version_compare($currentVersion, '2.3.1', '<'): $content[] = '<pre>'; $files = array('templates/my_page/user_setting.tpl'); userUpdateFiles($files, $content); $content[] = ' 2.3.1 changes ------------------------ + Added ability for user to set editor preferences </pre> '; case version_compare($currentVersion, '2.3.2', '<'): $content[] = '<pre>2.3.2 changes'; $files = array('img/users.png', 'templates/user_main.tpl'); userUpdateFiles($files, $content); $content[] = '+ Added error check to login. + Changed user control panel icon. + Fixed template typo that broke IE login. + Removed fake French translation (delete mod/users/locale/fr_FR/ directory + Permissions are now ordered alphabetically. + isUser will now always return false if passed a zero id. + Added new function requireLogin that forwards a user to the login screen </pre>'; case version_compare($currentVersion, '2.4.0', '<'): if (!PHPWS_DB::isTable('users_pw_reset')) { $new_table = 'CREATE TABLE users_pw_reset ( user_id INT NOT NULL default 0, authhash CHAR( 32 ) NOT NULL default 0, timeout INT NOT NULL default 0, );'; if (!PHPWS_DB::import($new_table)) { $content[] = 'Unable to create users_pw_reset table.'; return false; } else { $content[] = 'Created new table: users_pw_reset'; } } $files = array('templates/forms/reset_password.tpl', 'templates/forms/forgot.tpl', 'conf/config.php', 'templates/usermenus/top.tpl', 'templates/forms/settings.tpl', 'templates/my_page/user_setting.tpl'); $content[] = '<pre>'; userUpdatefiles($files, $content); if (!PHPWS_Boost::inBranch()) { $content[] = file_get_contents(PHPWS_SOURCE_DIR . 'mod/users/boost/changes/2_4_0.txt'); } $content[] = '</pre>'; case version_compare($currentVersion, '2.4.1', '<'): $content[] = '<pre>'; $files = array('conf/languages.php'); userUpdateFiles($files, $content); $content[] = ' 2.4.1 changes ------------------------ + Default item id on permission check functions is now zero instead of null. This will make checking permissions a little easier on new items. + Bug #1690657 - Changed group select js property to onclick instead of onchange. Thanks singletrack. + Changed the language abbreviation for Danish </pre> '; case version_compare($currentVersion, '2.4.2', '<'): $content[] = '<pre>'; $files = array('templates/usermenus/Default.tpl'); userUpdateFiles($files, $content); if (!PHPWS_Boost::inBranch()) { $content[] = file_get_contents(PHPWS_SOURCE_DIR . 'mod/users/boost/changes/2_4_2.txt'); } $content[] = '</pre>'; case version_compare($currentVersion, '2.4.3', '<'): $content[] = '<pre>'; if (!PHPWS_Boost::inBranch()) { $content[] = file_get_contents(PHPWS_SOURCE_DIR . 'mod/users/boost/changes/2_4_3.txt'); } $content[] = '</pre>'; case version_compare($currentVersion, '2.4.4', '<'): $content[] = '<pre>'; $source_dir = PHPWS_SOURCE_DIR . 'mod/users/javascript/'; $dest_dir = $home_dir . 'javascript/modules/users/'; if (PHPWS_File::copy_directory($source_dir, $dest_dir, true)) { $content[] = "--- Successfully copied {$source_dir} to {$dest_dir}"; } else { $content[] = "--- Could not copy {$source_dir} to {$dest_dir}"; } $files = array('conf/error.php', 'templates/forms/permissions.tpl', 'templates/forms/permission_pop.tpl'); userUpdateFiles($files, $content); if (!PHPWS_Boost::inBranch()) { $content[] = file_get_contents(PHPWS_SOURCE_DIR . 'mod/users/boost/changes/2_4_4.txt'); } $content[] = '</pre>'; case version_compare($currentVersion, '2.4.5', '<'): $content[] = '<pre>'; $files = array('conf/error.php', 'conf/languages.php', 'templates/forms/settings.tpl', 'templates/manager/groups.tpl'); userUpdateFiles($files, $content); if (!PHPWS_Boost::inBranch()) { $content[] = file_get_contents(PHPWS_SOURCE_DIR . 'mod/users/boost/changes/2_4_5.txt'); } $content[] = '</pre>'; case version_compare($currentVersion, '2.4.6', '<'): $content[] = '<pre>'; $files = array('templates/forms/forgot.tpl'); userUpdateFiles($files, $content); if (!PHPWS_Boost::inBranch()) { $content[] = ' 2.4.6 changes ------------------- + Added error check to permission menu. + Error for missing user groups now reports user id. + Forgot password will work if CAPTCHA is disabled. + Using new savePermissions function instead of save. + Current_User was calling giveItemPermissions incorrectly.'; } $content[] = '</pre>'; case version_compare($currentVersion, '2.4.7', '<'): $content[] = '<pre> 2.4.7 changes ------------------- + Removed global authorization from change password check since it is not written yet. </pre>'; case version_compare($currentVersion, '2.4.9', '<'): $content[] = '<pre>'; if (PHPWS_Core::isBranch() || PHPWS_Boost::inBranch()) { $user_db = new PHPWS_DB('users'); $user_db->addWhere('deity', 1); $user_db->addColumn('id'); $user_db->addColumn('username'); $user_db->setIndexBy('id'); $user_ids = $user_db->select('col'); if (!empty($user_ids) && !PHPWS_Error::logIfError($user_ids)) { $group_db = new PHPWS_DB('users_groups'); foreach ($user_ids as $id => $username) { $group_db->addWhere('user_id', $id); $result = $group_db->select('row'); if (!$result) { $group_db->reset(); $group_db->addValue('active', 1); $group_db->addValue('name', $username); $group_db->addValue('user_id', $id); if (!PHPWS_Error::logIfError($group_db->insert())) { $content[] = '--- Created missing group for user: '******'2.4.9 changes ----------------- + Raised sql character limit in default username, display_name, and group name installs. + Fixed bug with forbidden usernames + Added a function to group to remove its permissions upon deletion. + Bookmark won\'t return a user to a authkey page if their session dies. + Fixed bug #1850815 : unknown function itemIsAllowed in Permission.php + My Pages are unregistered on module removal. + My Page tab stays fixed. </pre>'; case version_compare($currentVersion, '2.5.0', '<'): $content[] = '<pre>'; $files = array('templates/forms/memberlist.tpl', 'templates/forms/userForm.tpl', 'javascript/generate/head.js', 'templates/manager/groups.tpl', 'templates/manager/users.tpl'); userUpdateFiles($files, $content); $content[] = '2.5.0 changes ------------------- + Members\' names alphabetized + New user email notification added. + Fixed member listing dropping names past 10. + Added random password generator on user edit form. + Removed reference from Action.php causing php notice. + Changed redundant static method call in Permission. + Added dash to allowed display name characters. + Added \\pL to display name characters. + Users will now query modules should a user get deleted. + Added an error check to Permissions. + Users will now look for remove_user.php in all modules\' inc/ directory in order to run the remove_user function. + Using pager\'s addSortHeaders in user and group listing + Added display name to pager search. </pre>'; case version_compare($currentVersion, '2.6.0', '<'): $content[] = '<pre>'; Users_Permission::registerPermissions('users', $content); $db = new PHPWS_DB('users_auth_scripts'); $db->addWhere('filename', 'local.php'); $db->addColumn('id'); $auth_id = $db->select('one'); PHPWS_Settings::set('users', 'local_script', $auth_id); PHPWS_Settings::save('users'); $files = array('conf/languages.php', 'templates/my_page/user_setting.tpl', 'templates/usermenus/css.tpl', 'img/permission.png', 'templates/forms/userForm.tpl'); userUpdateFiles($files, $content); if (!PHPWS_Boost::inBranch()) { $content[] = file_get_contents(PHPWS_SOURCE_DIR . 'mod/users/boost/changes/2_6_0.txt'); } $content[] = '</pre>'; case version_compare($currentVersion, '2.6.1', '<'): $content[] = '<pre>2.6.1 changes ------------------ + requireLogin now reroutes dependant on the user authorization + If the user\'s group is missing when they are updated, a new one is properly created. Prior to the fix, a new group was created without an assigned user id. + Added error message to my page if update goes bad. </pre>'; case version_compare($currentVersion, '2.6.2', '<'): $content[] = '<pre>'; $files = array('templates/forms/settings.tpl'); userUpdateFiles($files, $content); $content[] = '2.6.2 changes ------------------ + Moved error file to inc/ + Blank passwords forbidden. + Error check added to cosign authorization. + php fiveasized the classes. + Added some needed error logging to user creation problems + Added ability for default user groups to be set for admin created and newly joined users. + Fixed testing on addMembers. Previous code was nonsensical. + _user_group id gets set upon a user object save. </pre>'; case version_compare($currentVersion, '2.6.3', '<'): $content[] = '<pre>'; $files = array('img/deity.gif', 'img/delete.png', 'img/edit.png', 'img/man.gif', 'img/key.png', 'img/members.png', 'templates/forms/authorization.tpl', 'templates/forms/settings.tpl', 'templates/manager/users.tpl'); userUpdateFiles($files, $content); $db = new PHPWS_DB('users_auth_scripts'); PHPWS_Error::logIfError($db->addTableColumn('default_group', 'int not null default 0')); $content[] = '2.6.3 changes ------------------ + Added icons for admin options under manage users and groups + Disabled active link in groups listing + Authorization scripts now have default group assignments. New members will assigned to a group based on their authorization method. + Removed default group by user or admin from settings. + Added ability to view users by whether or not they are in a particular group. + Added pager caching to group listing + Display name may now not be the same as another user\'s username + Extended user name error to include display name + Added empty password check to ldap script </pre>'; case version_compare($currentVersion, '2.6.4', '<'): $db = new PHPWS_DB('users_auth_scripts'); PHPWS_Error::logIfError($db->addTableColumn('default_group', 'int not null default 0')); $content[] = '<pre>2.6.4 changes ------------------------- + Added missing column to install.sql</pre>'; case version_compare($currentVersion, '2.6.5', '<'): $content[] = '<pre>'; userUpdateFiles(array('conf/languages.php'), $content); $content[] = '2.6.5 changes ------------------------- + Added missing column to install.sql</pre>'; case version_compare($currentVersion, '2.6.6', '<'): $content[] = '<pre>'; userUpdateFiles(array('templates/forms/userForm.tpl'), $content); $content[] = '2.6.6 changes ----------------------- + Graceful recovery from broken authentication scripts. + Authorization script made deity only + Fixed default groups on external authentication + Deleted auth scripts will update users under it to use local instead. + The user constructor was trying to load the authorization script on failed users. Thanks Verdon.</pre>'; case version_compare($currentVersion, '2.7.0', '<'): $content[] = '<pre>2.7.0 changes ------------------------- + Usernames and passwords can not be changed on non local users + Added switch to settings to prevent admins from making new users + Site admin can be set by non-deities again + Fixed bug with users able to change password on alternate auth. + Fixed some bugs with user creation and editing with alternate authentication. + Hiding permissions and members in create group form + Icon class implemented. + Strict PHP 5 changes made. </pre>'; case version_compare($currentVersion, '2.7.1', '<'): $content[] = '<pre>2.7.1 changes ------------------------- + Improved cosign script + Fixed errors getting dropped without logging. </pre>'; case version_compare($currentVersion, '2.7.2', '<'): $content[] = '<pre>2.7.2 changes ------------------------- + Fixed multiple group member bug. + Cleaned up cosign authentication. + Current_User requireLogin to use login_link instead of login_url + New User form now properly respects the "settings" permission for showing user authentication script option. + User constuction allow username parameter. + Trim whitespace from user email addresses. Don\'t modify the member variable unless all the sanity checks passed. </pre>'; case version_compare($currentVersion, '2.7.3', '<'): PHPWS_Core::initModClass('users', 'Action.php'); User_Action::checkPermissionTables(); $content[] = '<pre>2.7.3 changes ------------------------ + Update permissions </pre>'; case version_compare($currentVersion, '2.7.4', '<'): $content[] = '<pre>2.7.4 changes ------------------------ + Fixed 500 error on My Page </pre>'; case version_compare($currentVersion, '2.7.5', '<'): $content[] = '<pre>2.7.5 changes ------------------------ + Loosened group name restrictions + User edit page shows group membership </pre>'; case version_compare($currentVersion, '2.7.6', '<'): $content[] = '<pre>2.7.6 changes ------------------------ + Updated icons to Font Awesome + Email addresses may now be used as user names. + Static method call fixed. + Added exception error for missing authorization file. + My Page no longer is using tabs as other modules use of My Page have been removed. + css.tpl template rewritten. Login now works closer with authentication script. - drop down no longer contains Home or Control Panel. Account link added - takes user to their account page to change their password. </pre>'; case version_compare($currentVersion, '2.8.0', '<'): $content[] = <<<EOF <pre>2.8.0 changes ----------------- + Added suggested bootstrap classes from TRF + Removed call to nonexistent method. + Moved icons to left and set admin-icons class to column. + Added FA icon here for mini admin + Changed to ensure users_auth_scripts table was created properly + Session timeouts are now tracked. Warning to user given before failure. </pre> EOF; case version_compare($currentVersion, '2.8.1', '<'): \PHPWS_Settings::set('users', 'session_warning', 0); \PHPWS_Settings::save('users'); $content[] = <<<EOF <pre>2.8.1 changes ----------------- + Changing default on user session to false. If you want it enabled, do so in settings. </pre> EOF; case version_compare($currentVersion, '2.8.2', '<'): $content[] = <<<EOF <pre>2.8.2 changes ----------------- + Bug Fix: Unstyled permission pop up. </pre> EOF; } // End of switch statement return TRUE; }
public function removeKeys($mod) { $db = new PHPWS_DB('phpws_key_edit'); $db->addWhere('key_id', 'phpws_key.id'); $db->addWhere('phpws_key.module', $mod->title); $db->delete(); $db = new PHPWS_DB('phpws_key_view'); $db->addWhere('key_id', 'phpws_key.id'); $db->addWhere('phpws_key.module', $mod->title); $db->delete(); $db->reset(); $db->setTable('phpws_key'); $db->addWhere('module', $mod->title); return $db->delete(); }
private function postUpload() { $error = false; if (empty($_FILES['upload_file']['tmp_name'])) { $error = true; $content[] = dgettext('calendar', 'Missing filename.'); } elseif ($_FILES['upload_file']['type'] != 'text/calendar') { $error = true; $content[] = dgettext('calendar', 'Improper file format.'); } if (!$error) { $result = file($_FILES['upload_file']['tmp_name']); if (!is_array($result)) { $error = true; $content[] = dgettext('calendar', 'Unable to parse file for events.'); } elseif (trim($result[0]) != 'BEGIN:VCALENDAR') { $error = true; $content[] = dgettext('calendar', 'File does not appear to be in iCal/vCal format.'); } } if ($error) { $content[] = $this->calendar->schedule->uploadEventsLink(false, dgettext('calendar', 'Return to upload form...')); $this->title = dgettext('calendar', 'Error'); $this->content = implode('<br />', $content); return; } PHPWS_Core::initModClass('calendar', 'Event.php'); $table = $this->calendar->schedule->getEventTable(); $db = new PHPWS_DB($table); $success = 0; $duplicates = 0; foreach ($result as $cal) { $cal = trim($cal); $colon = strpos($cal, ':'); if (!$colon) { continue; } $command = substr($cal, 0, $colon); if ($semicolon = strpos($cal, ';')) { $command = substr($cal, 0, $semicolon); } $value = substr($cal, $colon + 1, strlen($cal)); if (empty($value)) { continue; } switch ($command) { case 'BEGIN': if ($value == 'VEVENT' && !isset($event)) { $event = new Calendar_Event(0, $this->calendar->schedule); $event->start_time = 0; $event->end_time = 0; } break; case 'DTSTART': if (isset($event)) { $event->start_time = strtotime($value); } break; case 'DTSTART;VALUE=DATE': if (isset($event)) { $event->start_time = strtotime($value); } break; case 'DTEND': if (isset($event)) { $event->end_time = strtotime($value); } break; case 'DTEND;VALUE=DATE': if (isset($event)) { $event->end_time = strtotime($value); } break; case 'SUMMARY': if (isset($event)) { $value = str_replace('\\,', ',', $value); $event->setSummary($value, true); } break; case 'LOCATION': if (isset($event)) { $event->setLocation($value); } break; case 'DESCRIPTION': if (isset($event)) { $value = str_replace('\\,', ',', $value); $value = str_replace('\\n', "\n", $value); $event->setDescription($value, null, true); } break; case 'END': if ($value == 'VEVENT' && isset($event)) { if (empty($event->end_time)) { //start time should be midnight so add 23h 23min 59 sec $event->end_time = $event->start_time + 86399; $event->all_day = 1; } $db->reset(); $db->addWhere('start_time', $event->start_time); $db->addWhere('end_time', $event->end_time); $db->addWhere('summary', $event->summary); $db->addColumn('id'); $result = $db->select('one'); if (!empty($result)) { if (PHPWS_Error::logIfError($result)) { $parse_errors[] = dgettext('calendar', 'Error accessing event table.'); } else { $duplicates++; } } else { $save = $event->save(); if (PHPWS_Error::logIfError($save) || !$save) { $parse_errors[] = dgettext('calendar', 'Error saving new event.'); } else { $success++; } } unset($event); } break; } } $this->title = dgettext('calendar', 'Import complete!'); if (isset($parse_errors)) { $content[] = dgettext('calendar', 'The following errors occurred when trying to import your events:'); $content[] = '<ul><li>' . implode('</li><li>', $parse_errors) . '</li></ul>'; } $content[] = sprintf(dgettext('calendar', '%s event(s) were successfully imported.'), $success); $content[] = sprintf(dgettext('calendar', '%s duplicate event(s) were ignored.'), $duplicates); $content[] = javascript('close_window'); $this->content = implode('<br />', $content); }
public function kill() { $db = new PHPWS_DB('controlpanel_link'); $db->addWhere('id', $this->id); $result = $db->delete(); if (PHPWS_Error::isError($result)) { return $result; } $db->reset(); $db->addWhere('tab', $this->tab); $db->addOrder('link_order'); $result = $db->getObjects('PHPWS_Panel_Link'); if (PHPWS_Error::isError($result)) { return $result; } if (empty($result)) { return true; } $count = 1; foreach ($result as $link) { $link->setLinkOrder($count); $link->save(); $count++; } }
public function delete() { $all_is_well = true; $db = new PHPWS_DB('phpws_key'); $db->addWhere('id', $this->id); $result = $db->delete(); $this->unregister(); if (PHPWS_Error::isError($result)) { PHPWS_Error::log($result); $all_is_well = false; } $db->reset(); $db->setTable('phpws_key_edit'); $db->addWhere('key_id', $this->id); $result = $db->delete(); if (PHPWS_Error::isError($result)) { PHPWS_Error::log($result); $all_is_well = false; } $db->reset(); $db->setTable('phpws_key_view'); $db->addWhere('key_id', $this->id); $result = $db->delete(); if (PHPWS_Error::isError($result)) { PHPWS_Error::log($result); $all_is_well = false; } return $all_is_well; }
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; } return true; }
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 saveReasons() { // Save reason assignments $db = new PHPWS_DB('checkin_rtos'); $db->addWhere('staff_id', $this->id); $db->delete(); if ($this->filter_type & REASON_BITMASK) { foreach ($this->_reasons as $rid) { $db->reset(); $db->addValue('staff_id', $this->id); $db->addValue('reason_id', $rid); PHPWS_Error::logIfError($db->insert()); } } }
public function delete() { $db = new PHPWS_DB('signup_slots'); $db->addWhere('id', $this->id); if (PHPWS_Error::logIfError($db->delete())) { return false; } $db->reset(); $db->addWhere('s_order', $this->s_order, '>'); $db->reduceColumn('s_order', 1); return true; }
public function save($no_dupes = true, $write = true, $thumbnail = true) { if (empty($this->file_directory)) { if ($this->folder_id) { $folder = new Folder($_POST['folder_id']); if ($folder->id) { $this->setDirectory($folder->getFullDirectory()); } else { return PHPWS_Error::get(FC_MISSING_FOLDER, 'filecabinet', 'PHPWS_Image::save'); } } else { return PHPWS_Error::get(FC_DIRECTORY_NOT_SET, 'filecabinet', 'PHPWS_Image::save'); } } if (!$this->folder_id) { return PHPWS_Error::get(FC_MISSING_FOLDER, 'filecabinet', 'PHPWS_Image::save'); } if (!is_writable($this->file_directory)) { return PHPWS_Error::get(FC_BAD_DIRECTORY, 'filecabinet', 'PHPWS_Image::save', $this->file_directory); } if (empty($this->alt)) { if (empty($this->title)) { $this->loadTitleFromFilename(); } $this->alt = $this->title; } if ($write) { $result = $this->write(); if (PHPWS_Error::isError($result)) { return $result; } } if ($thumbnail) { $this->makeThumbnail(); } $db = new PHPWS_DB('images'); if ((bool) $no_dupes && empty($this->id)) { $db->addWhere('file_name', $this->file_name); $db->addWhere('folder_id', $this->folder_id); $db->addColumn('id'); $result = $db->select('one'); if (PHPWS_Error::isError($result)) { return $result; } elseif (isset($result) && is_numeric($result)) { $this->id = $result; return TRUE; } $db->reset(); } return $db->saveObject($this); }
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()); } } }
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(); }
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; } } }
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(); } }
public function save() { $db = new PHPWS_DB('layout_box'); $db->addWhere('module', $this->module); $db->addWhere('content_var', $this->content_var); $db->addWhere('theme', $this->theme); $result = $db->select('one'); if (PHPWS_Error::isError($result)) { return $result; } elseif ($result && $result != $this->id) { return FALSE; } $db->reset(); if (empty($this->box_order)) { $this->box_order = $this->nextBox(); } return $db->saveObject($this); }
public function save($item_id, $table, $total_backups = 5) { if (!PHPWS_DB::isTable($table)) { return FALSE; } $backupTable = Backup::getBackupTable($table); if (PHPWS_Error::isError($backupTable)) { return $backupTable; } $db = new PHPWS_DB($table); $db->addWhere('id', $item_id); $source_row = $db->select('row'); $db2 = new PHPWS_DB($backupTable); $db2->addWhere('backup_id', $source_row['id']); $db2->addOrder('backup_order'); $past_rows = $db2->select(); $past_row_count = count($past_rows); if (empty($past_rows) || $past_row_count < $total_backups) { $db2->reset(); $source_row['backup_id'] = $source_row['id']; unset($source_row['id']); $source_row['backup_order'] = $past_row_count + 1; $db2->addValue($source_row); $result = $db2->insert(); } else { $db2->delete(); $db2->reset(); unset($past_rows[0]); $source_row['backup_id'] = $source_row['id']; unset($source_row['id']); $past_rows[] = $source_row; foreach ($past_rows as $key => $row) { $row['backup_order'] = $key; $db2->addValue($row); $db2->insert(); $db2->resetValues(); } } }