Esempio n. 1
0
 public static function registerPermissions($module, &$content)
 {
     $tableName = Users_Permission::getPermissionTableName($module);
     if (!PHPWS_DB::isTable($tableName)) {
         return Users_Permission::createPermissions($module);
     }
     $file = sprintf('%smod/%s/boost/permission.php', PHPWS_SOURCE_DIR, $module);
     if (!is_file($file)) {
         return NULL;
     }
     include_once $file;
     if (!isset($permissions) || !is_array($permissions)) {
         return TRUE;
     }
     $db = new PHPWS_DB($tableName);
     $columns = $db->getTableColumns();
     $columnSetting = 'smallint NOT NULL default \'0\'';
     foreach ($permissions as $perm_name => $perm_proper) {
         if (in_array($perm_name, $columns)) {
             continue;
         }
         $result = $db->addTableColumn($perm_name, $columnSetting);
         if (PHPWS_Error::isError($result)) {
             $content[] = sprintf(dgettext('users', 'Could not create "%s" permission column.'), $perm_name);
             PHPWS_Error::log($result);
         } else {
             $content[] = sprintf(dgettext('users', '"%s" permission column created.'), $perm_name);
         }
     }
     return TRUE;
 }
Esempio n. 2
0
/**
 * @version $Id$
 * @author Matthew McNaney <mcnaney at gmail dot com>
 */
function checkin_update(&$content, $current_version)
{
    switch (1) {
        case version_compare($current_version, '1.0.1', '<'):
            $content[] = '<pre>';
            $db = new PHPWS_DB('checkin_staff');
            if (PHPWS_Error::logIfError($db->addTableColumn('view_order', 'smallint not null default 0'))) {
                $content[] = 'Unable to create checkin_staff.view_order column.</pre>';
                return false;
            } else {
                $content[] = 'Created checkin_staff.view_order column.';
            }
            $db->addColumn('id');
            $staff_list = $db->select('col');
            if (!empty($staff_list)) {
                $count = 1;
                foreach ($staff_list as $staff_id) {
                    $db->reset();
                    $db->addWhere('id', $staff_id);
                    $db->addValue('view_order', $count);
                    PHPWS_Error::logIfError($db->update());
                    $count++;
                }
            }
            checkinUpdateFiles(array('templates/visitors.tpl', 'templates/waiting.tpl', 'templates/queue.tpl', 'templates/settings.tpl'), $content);
            $content[] = '1.0.1 changes
------------------
+ Fixed bug with pulling current staff member
+ Added refresh link to waiting and assignment page
+ Fixed report
</pre>';
        case version_compare($current_version, '1.0.2', '<'):
            $content[] = '<pre>';
            checkinUpdateFiles(array('templates/visitors.tpl', 'templates/waiting.tpl', 'templates/style.css'), $content);
            $content[] = '1.0.2 changes
--------------------
+ Fixed translation typo.
+ Added "Send back" condition</pre>';
        case version_compare($current_version, '1.0.3', '<'):
            $content[] = '<pre>';
            checkinUpdateFiles(array('templates/report.tpl'), $content);
            $content[] = '1.0.3 changes
--------------------
+ Removed error message from report if no reasons created
+ Added the time of arrival to the report
+ Changed report date entry interface
+ Upper cased names.
</pre>';
        case version_compare($current_version, '1.0.4', '<'):
            $content[] = '<pre>1.0.4 changes
---------------------
+ Fixed waiting time setting</pre>';
        case version_compare($current_version, '1.1.0', '<'):
            $content[] = '<pre>1.1.0 changes
---------------------
+ Added code to prevent refreshed duplicates
+ Fixed possible error in admin view
+ Added monthly and student reports
+ Added report for number of times a visitor has visited within 30 days.
+ PHP 5 Strict changes</pre>';
        case version_compare($current_version, '1.1.1', '<'):
            $content[] = '<pre>1.1.1 changes
---------------------
+ Reports limited to admins</pre>';
        case version_compare($current_version, '1.2', '<'):
            $db = new PHPWS_DB('checkin_staff');
            $db->addTableColumn('active', 'smallint not null default 1');
            $content[] = '<pre>1.2 changes
--------------
+ Fixed blue button on admin menu
+ Staff can now be deactivated so they appear on reports but do not receive visitors</pre>';
        case version_compare($current_version, '1.3', '<'):
            $db = new PHPWS_DB('checkin_visitor');
            $db->addTableColumn('email', 'varchar(255) NULL');
            $content[] = '<pre>1.3 changes
---------------
+ Option to collect visitor email addresses.</pre>';
        case version_compare($current_version, '1.4.0', '<'):
            $content[] = '<pre>1.4.0 changes
---------------
+ May now report by visitor name.</pre>';
        case version_compare($current_version, '1.5.0', '<'):
            $content[] = '<pre>';
            // Make changes to checkin_visitor table
            $db = new PHPWS_DB('checkin_visitor');
            if (PHPWS_Error::logIfError($db->addTableColumn('gender', 'varchar(20) default NULL'))) {
                $content[] = 'Unable to create checkin_visitor.gender column.</pre>';
                return false;
            } else {
                $content[] = 'Created checkin_visitor.gender column.';
            }
            if (PHPWS_Error::logIfError($db->addTableColumn('birthdate', 'varchar(20) default NULL'))) {
                $content[] = 'Unable to create checkin_visitor.birthdate column.</pre>';
                return false;
            } else {
                $content[] = 'Created checkin_visitor.birthdate column.';
            }
            // Make changes to checkin_staff table
            $db = new PHPWS_DB('checkin_staff');
            if (PHPWS_Error::logIfError($db->addTableColumn('birthdate_filter_end', 'varchar(20) default NULL', 'f_regexp'))) {
                $content[] = 'Unable to create checkin_staff.birthdate_filter_end column.</pre>';
                return false;
            } else {
                $content[] = 'Created checkin_staff.birthdate_filter_end column.';
            }
            if (PHPWS_Error::logIfError($db->addTableColumn('birthdate_filter_start', 'varchar(20) default NULL', 'f_regexp'))) {
                $content[] = 'Unable to create checkin_staff.birthdate_filter_start column.</pre>';
                return false;
            } else {
                $content[] = 'Created checkin_staff.birthdate_filter_start column.';
            }
            if (PHPWS_Error::logIfError($db->addTableColumn('gender_filter', 'varchar(20) default NULL', 'f_regexp'))) {
                $content[] = 'Unable to create checkin_staff.gender_filter column.</pre>';
                return false;
            } else {
                $content[] = 'Created checkin_staff.gender_filter column.';
            }
            if (PHPWS_Error::logIfError($db->query('ALTER TABLE checkin_staff CHANGE filter lname_filter varchar(255) default NULL'))) {
                $content[] = 'Unable to rename checkin_staff.filter column.</pre>';
                return false;
            } else {
                $content[] = 'Renamed checkin_staff.filter to checkin_staff.lname_filter.';
            }
            if (PHPWS_Error::logIfError($db->query('ALTER TABLE checkin_staff CHANGE f_regexp lname_regexp varchar(255) default NULL'))) {
                $content[] = 'Unable to rename checkin_staff.f_regexp column.</pre>';
                return false;
            } else {
                $content[] = 'Renamed checkin_staff.f_regexp to checkin_staff.lname_regexp.';
            }
            $content[] = '1.5.0 changes
---------------
+ Fixed the "print view" for daily reports.
+ Option to collect visitor gender.
+ Option to collect visitor birthdate.
+ Added staff filters for gender and birthdate.
+ Staff can now have more than one filter.</pre>';
        case version_compare($current_version, '1.5.1', '<'):
            $content[] = '<pre>1.5.1 changes
----------------
+ Fixed some bugs and notices</pre>';
    }
    return true;
}
Esempio n. 3
0
/**
 * @author Matthew McNaney <mcnaney at gmail dot com>
 * @version $Id$
 */
function calendar_update(&$content, $version)
{
    switch ($version) {
        case version_compare($version, '1.2.2', '<'):
            $content[] = 'This package will not update any versions prior to 1.2.2.';
            return false;
        case version_compare($version, '1.3.0', '<'):
            $result = PHPWS_DB::importFile(PHPWS_SOURCE_DIR . 'mod/calendar/boost/sql_update_130.sql');
            if (PHPWS_Error::isError($result)) {
                PHPWS_Error::log($result);
                $content[] = '+ Unable to import new suggestion table.';
                return false;
            } else {
                $files = array('templates/admin/forms/edit_event.tpl', 'templates/view/day.tpl', 'templates/view/week.tpl', 'templates/view/month/grid.tpl', 'templates/view/month/list.tpl', 'templates/style.css', 'templates/user_main.tpl', 'templates/admin/approval.tpl', 'conf/config.php');
                if (PHPWS_Boost::updateFiles($files, 'calendar')) {
                    $content[] = '+ Template files updated successfully.';
                } else {
                    $content[] = '+ Unable to copy template files locally.';
                    $content[] = '<pre>' . implode("\n", $files) . '</pre>';
                }
                $content[] = '+ Suggestion table import successful';
                $content[] = '<pre>
1.3.0 Changes
-------------
+ Added ability to for anonymous users to make event suggestions.
+ Fixed some issues with javascript disabled users unable to make events.
+ First public schedule is made the default on creation.
</pre>';
            }
        case version_compare($version, '1.4.0', '<'):
            $content[] = "<pre>1.4.0 Changes\n-------------";
            $files = array('templates/admin/settings.tpl', 'conf/config.php');
            if (PHPWS_Boost::updateFiles($files, 'calendar')) {
                $content[] = '+ Successfully copied these files locally:';
            } else {
                $content[] = '+ Could not copy these files locally:';
            }
            $content[] = '    ' . implode("\n    ", $files);
            $content[] = '+ Bug #1648965. Clicking Day or Week from grid view pulls correct day
+ Changed "Today" link to view appropiate description to prevent
  confusion
+ Changed time defaults to %p to work with more installs
+ If start date is greater than end date, the event will be saved to
  the save day.
+ Bug #1648963. Fixed mini month not showing days with events.
+ Made event count linkable in grid view
+ Labeled some permissions "unrestricted only"
+ Added permissions checks for editing and deleting
+ Created checkPermissions function in schedule class to simplify code
+ Removed commented legacy code from Schedule.php
+ Added missing suggestion tables to install and uninstall
+ Fixed caching logic
+ Fixed default schedule loading in Calendar class
+ Fixed inability to create more than one schedule
+ Added option to disable month view caching
+ Caching now works on public calendars only.
+ Added translate functions.
+ Updated message translation files.</pre>';
        case version_compare($version, '1.4.1', '<'):
            $content[] = "<pre>1.4.1 Changes\n-------------";
            $files = array('templates/admin/forms/edit_event.tpl', 'javascript/check_date/head.js');
            if (PHPWS_Boost::updateFiles($files, 'calendar')) {
                $content[] = '+ Successfully updated the following files:';
            } else {
                $content[] = '+ Unable to update the following files:';
            }
            $content[] = '    ' . implode("\n    ", $files);
            $content[] = '+ Made noon the default time for new events.
+ Fixed Daylight Saving Time breaking repeats.
+ Delete event links made secure.
+ Days made linkable in month list view.
+ Added a sync dates button on the edit event form.';
        case version_compare($version, '1.5.0', '<'):
            $db = new PHPWS_DB('calendar_schedule');
            $result = $db->addTableColumn('show_upcoming', 'SMALLINT NOT NULL DEFAULT 0');
            if (PHPWS_Error::logIfError($result)) {
                $content[] = '--- Could not create show_upcoming column in calendar_schedule table.';
                return false;
            }
            $content[] = '<pre>';
            $files = array('img/calendar.png', 'conf/config.php', 'templates/admin/forms/edit_schedule.tpl', 'templates/style.css', 'templates/view/upcoming.tpl');
            if (PHPWS_Boost::updateFiles($files, 'calendar')) {
                $content[] = '-- Successfully updated the following files:';
            } else {
                $content[] = '-- Unable to update the following files:';
            }
            $content[] = '    ' . implode("\n    ", $files);
            $content[] = '
1.5.0 Changes
---------------------
+ Can now choose to show upcoming events.
+ Removed schedule created message when using javascript popup
+ Moved getEvents function in the Schedule class
+ Increase calendar event form\'s popup height
+ Reformated schedule form
+ Bug # 1699659 - Calendar will not show "Add Event" link if a
  schedule has not been created. Instead, the "Create schedule" link
  will appear.
+ Updated language format
</pre>';
        case version_compare($version, '1.5.1', '<'):
            $db = new PHPWS_DB('calendar_schedule');
            if (!$db->isTableColumn('show_upcoming')) {
                $result = $db->addTableColumn('show_upcoming', 'SMALLINT NOT NULL DEFAULT 0');
                if (PHPWS_Error::logIfError($result)) {
                    $content[] = '--- Could not create show_upcoming column in calendar_schedule table.</pre>';
                    return false;
                }
            }
            $content[] = '<pre>';
            $files = array('conf/config.php', 'templates/view/month/list.tpl', 'templates/view/day.tpl', 'templates/view/week.tpl');
            if (PHPWS_Boost::updateFiles($files, 'calendar')) {
                $content[] = '-- Successfully updated the following files:';
            } else {
                $content[] = '-- Unable to update the following files:';
            }
            $content[] = '    ' . implode("\n    ", $files);
            $content[] = '
1.5.1 Changes
---------------------
+ 1.5.0 installations sql import was missing the show_upcoming column.
+ Added define to prevent day month year printing on same day events.
+ "Add event" links added to some views.
+ Changed the default hour format to "I" (eye) from l (ell) in
  config.php. Some php configurations do not recognize it.
</pre>';
        case version_compare($version, '1.5.2', '<'):
            $content[] = '<pre>';
            calendarUpdateFiles(array('templates/style.css'), $content);
            $content[] = '1.5.2 changes
-----------
+ Removed calendar colors that matched default theme.
+ Added Spanish translation.</pre>';
        case version_compare($version, '1.5.3', '<'):
            $content[] = '<pre>';
            calendarUpdateFiles(array('templates/style.css'), $content);
            $content[] = '1.5.3 change
-----------
+ Fixed issues with js_calendar.</pre>';
        case version_compare($version, '1.6.0', '<'):
            $content[] = '<pre>';
            $files = array('templates/style.css', 'templates/admin/forms/blog.tpl', 'templates/admin/settings.tpl', 'templates/view/day.tpl', 'templates/view/event.tpl', 'templates/view/month/grid.tpl', 'templates/view/month/list.tpl');
            calendarUpdateFiles($files, $content);
            $content[] = '1.6.0 changes
-------------------
+ Month grid view can be set to show events
+ Calendar events can be posted in the blog
+ Paragraph tag around day message
+ Fixed comment in event tpl preventing bar from disappearing in user
  mode
+ Removed extra message tag from month list view.
+ Applied patch #1813081 from aDarkling</pre>';
        case version_compare($version, '1.6.1', '<'):
            $content[] = '<pre>
1.6.1 changes
-------------
+ Fixed call to absent function in Event.php</pre>';
        case version_compare($version, '1.6.2', '<'):
            $content[] = '<pre>';
            calendarUpdateFiles(array('conf/config.php', 'javascript/check_date/head.js'), $content);
            $content[] = '1.6.2 changes
-------------
+ Added a upcoming date format
+ Fixed: Day view doesn\'t allow you to add an event until you create a schedule.
+ Deleting the default public calendar resets the selection.
+ Fixed: Bug #1879356 - Events spanning multiple days do not autocorrect time.
</pre>';
        case version_compare($version, '1.6.3', '<'):
            $content[] = '<pre>1.6.3 changes
-------------
+ Added missing repeatYearly function.</pre>';
        case version_compare($version, '1.6.4', '<'):
            $content[] = '<pre>';
            calendarUpdateFiles(array('templates/admin/schedules.tpl'), $content);
            $content[] = '1.6.4 changes
-------------
+ Added missing pager navigation tags to schedule listing.</pre>';
        case version_compare($version, '1.7.0', '<'):
            $db = new PHPWS_DB('calendar_schedule');
            $db->addColumn('id');
            $schedules = $db->select('col');
            if (!empty($schedules)) {
                foreach ($schedules as $id) {
                    $event_db = new PHPWS_DB('calendar_event_' . $id);
                    $event_db->addColumn('key_id');
                    $keys = $event_db->select('col');
                    if (!empty($keys)) {
                        $key_db = new PHPWS_DB('phpws_key');
                        $key_db->addWhere('id', $keys);
                        $key_db->addValue('item_name', 'event' . $id);
                        PHPWS_Error::logIfError($key_db->update());
                    }
                }
            }
            $content[] = '<pre>';
            $files = array('img/', 'templates/admin/schedules.tpl', 'templates/view/month/grid.tpl', 'templates/view/month/list.tpl', 'templates/view/day.tpl', 'templates/view/event.tpl', 'templates/view/week.tpl', 'templates/ical.tpl', 'templates/style.css', 'templates/upload.tpl', 'templates/admin/settings.tpl');
            calendarUpdateFiles($files, $content);
            $content[] = '1.7.0 changes
-------------
+ Added ability to hide the mini grid calendar.
+ Increased edit event popup default size.
+ Moved some frequent functions closer to top of switch
+ Added ability to upload and download events using iCal format
+ Fixed: Calendar was saving all events from all schedules using the same item name.
+ Deleting a schedule will remove event keys as well.
+ Deleting an event clears the cache to prevent ghosts in grid view.
+ If a non existing event is accessed, calendar forwards to day view instead of 404.
+ Added check that removes the default public calendar if it is
  changed to private.
+ Fixed events showing on multiple schedules.
+ php 5 formatted.
</pre>';
        case version_compare($version, '1.7.1', '<'):
            $content[] = '<pre>';
            $files = array('templates/admin/settings.tpl');
            calendarUpdateFiles($files, $content);
            $content[] = '1.7.1 changes
------------------
+ Added option to enable rel="nofollow" on date links</pre>';
        case version_compare($version, '1.7.2', '<'):
            $content[] = '<pre>1.7.2 changes
------------------
+ Fixed event ical download</pre>';
        case version_compare($version, '1.7.3', '<'):
            $content[] = '<pre>1.7.3 changes
------------------
+ Fixed empty events check in Upcoming Events
+ PHP 5 strict fixes.</pre>';
        case version_compare($version, '1.7.4', '<'):
            $content[] = '<pre>1.7.4 changes
------------------
+ RSS added.</pre>';
        case version_compare($version, '1.7.5', '<'):
            $content[] = '<pre>1.7.5 changes
------------------
+ Added an explicit require for Time.php in Calendar, in an attempt to move off of the older autoload</pre>';
        case version_compare($version, '1.7.6', '<'):
            $content[] = '<pre>1.7.6 changes
------------------
+ Bootstrap styling added
+ Updated Font Awesome icons
+ Fixed schedule select with last Form updates
+ Fixed users not seeing public calendars
</pre>';
        case version_compare($version, '1.8.0', '<'):
            $content[] = <<<EOF
<pre>1.8.0
-------------
+ Added END_TIME_HOUR, END_TIME_MONTH, and END_TIME_YEAR
  template tags to the event view.
+ Added Bootstrap icons and navigation buttons.
+ Administrative forms switched over to modal windows.
+ Using new datetimepicker javascript.</pre>
EOF;
        case version_compare($version, '1.8.1', '<'):
            $content[] = <<<EOF
<pre>1.8.1
-------------
+ Rolled back array call specific to PHP 5.4.
+ Increased specificity of .date-label CSS class.
</pre>
EOF;
    }
    // end of switch
    return true;
}
Esempio n. 4
0
/**
 * @author Matthew McNaney <mcnaney at gmail dot com>
 * @version $Id$
 */
function blog_update(&$content, $currentVersion)
{
    $home_directory = PHPWS_Boost::getHomeDir();
    switch ($currentVersion) {
        case version_compare($currentVersion, '1.2.2', '<'):
            $content[] = 'This package will not update versions prior to 1.2.2.';
            return false;
        case version_compare($currentVersion, '1.2.3', '<'):
            $content[] = '<pre>
1.2.3 Changes
-------------
+ Make call to resetKeywords in search to prevent old search word retention.
</pre>';
        case version_compare($currentVersion, '1.4.1', '<'):
            $content[] = '<pre>';
            $db = new PHPWS_DB('blog_entries');
            $result = $db->addTableColumn('image_id', 'int NOT NULL default 0');
            if (PHPWS_Error::isError($result)) {
                PHPWS_Error::log($result);
                $content[] = 'Unable to add image_id colume to blog_entries table.</pre>';
                return false;
            }
            $files = array('templates/edit.tpl', 'templates/settings.tpl', 'templates/view.tpl', 'templates/submit.tpl', 'templates/user_main.tpl', 'templates/list_view.tpl');
            blogUpdateFiles($files, $content);
            $content[] = '
1.4.1 Changes
-------------
+ Added missing category tags to entry listing.
+ Added ability for anonymous and users without blog permission to
  submit entries for later approval.
+ Added setting to allow anonymous submission.
+ Added ability to place images on Blog entries without editor.
+ Added pagination to Blog view.
+ Added link to reset the view cache.
+ Added ability to add images to entry without editor.
+ Added missing translate calls.
+ Changed edit form layout.
</pre>';
        case version_compare($currentVersion, '1.4.2', '<'):
            $content[] = '<pre>';
            $files = array('templates/list.tpl');
            blogUpdateFiles($files, $content);
            $content[] = '1.4.2 Changes
-------------
+ Fixed bug causing error message when Blog listing moved off front page.
+ Changes "Entry" column to "Summary" on admin list. Was not updated since summary was added.
</pre>';
        case version_compare($currentVersion, '1.4.3', '<'):
            $content[] = '<pre>1.4.3 Changes
-------------';
            $db = new PHPWS_DB('blog_entries');
            $result = $db->addTableColumn('expire_date', 'int not null default 0', 'publish_date');
            if (PHPWS_Error::isError($result)) {
                PHPWS_Error::log($result);
                $content[] = 'Unable to create table column "expire_date" on blog_entries table.</pre>';
                return false;
            } else {
                $content[] = '+ Created "expire_date" column on blog_entries table.';
            }
            $result = $db->addTableColumn('sticky', 'smallint not null default 0');
            if (PHPWS_Error::isError($result)) {
                PHPWS_Error::log($result);
                $content[] = 'Unable to create table column "sticky" on blog_entries table.</pre>';
                return false;
            } else {
                $content[] = '+ Created "sticky" column on blog_entries table.';
            }
            $files = array('img/blog.png', 'templates/edit.tpl', 'templates/list.tpl');
            blogUpdateFiles($files, $content);
            $content[] = '+ Priviledged blog entries now forward to login page.
+ Added sticky option.
+ Added expiration options.
+ Removed fake French translation.
+ Changed Control Panel icon.
</pre>';
        case version_compare($currentVersion, '1.5.0', '<'):
            $content[] = '<pre>';
            $files = array('templates/settings.tpl', 'templates/edit.tpl', 'conf/config.php', 'templates/list_view.tpl');
            blogUpdateFiles($files);
            $content[] = '
1.5.0 Changes
-------------
+ Increased default blog entry title size to 100.
+ Added setting to control whether to allow anonymous comments by
  default on new blog entries
+ Added Captcha option to submissions.
+ Fixed cache reset
+ Added define to determine the highest amount of blog pages to cache
+ Added extra checks for anonymous submission
+ Changed coding of image manager call.
+ Changed to new language functionality.
+ Fixed: logErrors called on blog object instead of image object
  on empty image id.
+ Fixed pagination on list view.
+ Now uses new File Cabinet module.
</pre>';
        case version_compare($currentVersion, '1.5.1', '<'):
            $content[] = '<pre>
1.5.1 Changes
-------------
+ Comments link points to comments anchor.</pre>';
        case version_compare($currentVersion, '1.5.2', '<'):
            $content[] = '<pre>
1.5.2 Changes
-------------
+ Fixed previous blog listing.</pre>';
        case version_compare($currentVersion, '1.6.0', '<'):
            $content[] = '<pre>';
            $columns = array();
            $columns['update_date'] = 'int not null default 0';
            $columns['updater'] = 'varchar(50) NOT NULL';
            $columns['updater_id'] = 'int not null default 0';
            $db = new PHPWS_DB('blog_entries');
            foreach ($columns as $column_name => $col_info) {
                $result = $db->addTableColumn($column_name, $col_info, 'create_date');
                if (PHPWS_Error::logIfError($result)) {
                    $content[] = "--- Unable to create table column '{$column_name}' on blog_entries table.</pre>";
                    return false;
                } else {
                    $content[] = "--- Created '{$column_name}' column on blog_entries table.";
                }
            }
            $image_dir = $home_directory . 'images/blog/';
            if (!is_dir($image_dir)) {
                if (mkdir($image_dir)) {
                    $content[] = '--- Created Blog image directory for xmlrpc.';
                } else {
                    $content[] = '--- Unable to created Blog image directory for xmlrpc.';
                }
            } elseif (!is_writable($image_dir)) {
                $content[] = '--- images/blog directory is not writable. XMLRPC upload will not function.';
            }
            $files = array('templates/settings.tpl', 'templates/view.tpl');
            blogUpdateFiles($files, $content);
            if (!PHPWS_Boost::inBranch()) {
                $content[] = file_get_contents(PHPWS_SOURCE_DIR . 'mod/blog/boost/changes/1_6_0.txt');
            }
            $content[] = '</pre>';
        case version_compare($currentVersion, '1.6.1', '<'):
            $content[] = '<pre>';
            blogUpdateFiles(array('templates/settings.tpl'), $content);
            if (!PHPWS_Boost::inBranch()) {
                $content[] = file_get_contents(PHPWS_SOURCE_DIR . 'mod/blog/boost/changes/1_6_1.txt');
            }
            $content[] = '</pre>';
        case version_compare($currentVersion, '1.6.2', '<'):
            $content[] = '<pre>';
            blogUpdateFiles(array('templates/view.tpl', 'templates/settings.tpl', 'templates/style.css'), $content);
            if (!PHPWS_Boost::inBranch()) {
                $content[] = file_get_contents(PHPWS_SOURCE_DIR . 'mod/blog/boost/changes/1_6_2.txt');
            }
            $content[] = '</pre>';
        case version_compare($currentVersion, '1.6.3', '<'):
            $content[] = '<pre>
1.6.3 changes
----------------
+ Small fix to allow linkable images on cached pages.
</pre>';
        case version_compare($currentVersion, '1.7.0', '<'):
            $content[] = '<pre>';
            $db = new PHPWS_DB('blog_entries');
            if (PHPWS_Error::logIfError($db->addTableColumn('image_link', "varchar(255) NOT NULL default 'default'"))) {
                $content[] = '--- Unable to create image_link column on blog_entries table.</pre>';
                return false;
            } else {
                $content[] = '--- Created image_link column on blog_entries table';
            }
            PHPWS_Core::initModClass('filecabinet', 'Cabinet.php');
            if (Cabinet::convertImagesToFileAssoc('blog_entries', 'image_id')) {
                $content[] = '--- Converted images to new File Cabinet format.';
            } else {
                $content[] = '--- Could not convert images to new File Cabinet format.</pre>';
                return false;
            }
            blogUpdateFiles(array('templates/edit.tpl'), $content);
            if (!PHPWS_Boost::inBranch()) {
                $content[] = file_get_contents(PHPWS_SOURCE_DIR . 'mod/blog/boost/changes/1_7_0.txt');
            }
            $content[] = '</pre>';
        case version_compare($currentVersion, '1.7.1', '<'):
            if (!PHPWS_Boost::inBranch()) {
                $content[] = '<pre>' . file_get_contents(PHPWS_SOURCE_DIR . 'mod/blog/boost/changes/1_7_1.txt') . '</pre>';
            }
        case version_compare($currentVersion, '1.7.2', '<'):
            $db = new PHPWS_DB('blog_entries');
            if (PHPWS_Error::logIfError($db->addTableColumn('thumbnail', 'smallint not null default 0'))) {
                $content[] = 'Unable to create thumbnail column on blog_entries table.';
            }
            $content[] = '<pre>';
            blogUpdatefiles(array('templates/edit.tpl', 'templates/style.css', 'templates/view.tpl', 'templates/list.tpl', 'templates/settings.tpl'), $content);
            $content[] = '1.7.2 changes
-------------
+ Can use media or image thumbnails on blog listing page.
+ Blog uses new key datetime terminators.
+ File Cabinet style sheet called regardless of cache.
+ Indicators added for published status.
+ Fixed notice warning.
+ Re-added ability to limit folder view by module.
+ Blog uses new dbpager sorting headers.
+ Lets you use new comments approval.
+ Fixed bug with setting allow anonymous submissions.
+ Fixed forward message when entry creation encounters an error
+ js_calendar added to edit form.
</pre>';
        case version_compare($currentVersion, '1.8.0', '<'):
            $content[] = '<pre>';
            $files = array('templates/list.tpl', 'templates/purge_confirm.tpl', 'conf/config.php', 'img/');
            blogUpdateFiles($files, $content);
            if (!PHPWS_Boost::inBranch()) {
                $content[] = file_get_contents(PHPWS_SOURCE_DIR . 'mod/blog/boost/changes/1_8_0.txt');
            }
            $content[] = '</pre>';
        case version_compare($currentVersion, '1.8.1', '<'):
            $content[] = '<pre>';
            $files = array('templates/settings.tpl');
            blogUpdateFiles($files, $content);
            if (!PHPWS_Boost::inBranch()) {
                $content[] = '1.8.1 changes
---------------------
+ Added ability to limit blog view to logged users only.
+ Added ability to lock view of all blog entries down to specific groups.
+ Blog uses break post.
+ /blog works again.';
            }
            $content[] = '</pre>';
        case version_compare($currentVersion, '1.8.2', '<'):
            $content[] = '<pre>';
            $files = array('templates/view_full.tpl', 'templates/view_list.tpl');
            blogUpdateFiles($files, $content);
            $content[] = '1.8.2 changes
---------------------
+ Blog templates now have have single view and multiple view
  templates.';
            $content[] = '</pre>';
        case version_compare($currentVersion, '1.8.3', '<'):
            $content[] = '<pre>1.8.3 changes
---------------------
+ Hub/Branch changes.
+ Updated code to conform to php 5 strict standards.</pre>';
        case version_compare($currentVersion, '1.8.4', '<'):
            $content[] = '<pre>1.8.4 changes
---------------------
+ Removed caching to correct previous blog entries problems
</pre>';
        case version_compare($currentVersion, '1.9.0', '<'):
            $content[] = '<pre>1.9.0 changes
---------------------
+ Blog entry takes place in just one text field now.</pre>';
        case version_compare($currentVersion, '1.10.0', '<'):
            $content[] = '<pre>1.10.0 changes
---------------------
+ Rewrote image url hiding script
</pre>';
        case version_compare($currentVersion, '1.10.1', '<'):
            $content[] = '<pre>1.10.1 changes
---------------------
+ Blog guesses an entry point for an hr tag.
</pre>';
        case version_compare($currentVersion, '1.10.2', '<'):
            $content[] = '<pre>1.10.2 changes
---------------------
+ Updated icons to Font Awesome
+ Removed Categories from Blog
+ Create Blog link in miniadmin now works as intended.
+ Static methods set to avoid error notices.
</pre>';
        case version_compare($currentVersion, '1.10.3', '<'):
            $content[] = '<pre>1.10.3 changes
---------------------
+ Horizontal rules are acknowledged on save.
</pre>';
        case version_compare($currentVersion, '1.10.4', '<'):
            $content[] = '<pre>1.10.4 changes
---------------------
+ Removed Version code
</pre>';
        case version_compare($currentVersion, '1.10.5', '<'):
            $content[] = <<<EOF
<pre>1.10.5
------------
+ Added new datetimepicker for date fields.
</pre>
EOF;
    }
    // end of switch
    return true;
}
Esempio n. 5
0
function properties_update(&$content, $currentVersion)
{
    switch ($currentVersion) {
        case version_compare($currentVersion, '1.1.0', '<'):
            $db = new PHPWS_DB('properties');
            $result = $db->addTableColumn('efficiency', 'smallint not null default 0');
            if (PHPWS_Error::isError($result)) {
                PHPWS_Error::log($result);
                $content[] = 'ERROR - could not add efficiency column';
                return false;
            }
            $content[] = '<pre>1.1.0 updates
---------------
+ Added efficiency option</pre>';
        case version_compare($currentVersion, '1.1.1', '<'):
            $db = new PHPWS_DB('prop_contacts');
            $result = $db->addTableColumn('company_url', 'VARCHAR( 255 ) NULL');
            if (PHPWS_Error::isError($result)) {
                PHPWS_Error::log($result);
                $content[] = 'ERROR - could not add company_url column';
                return false;
            }
            $content[] = '<pre>1.1.1 updates
---------------
+ Added company url
+ Property listing divided into tabs.</pre>';
        case version_compare($currentVersion, '1.2.0', '<'):
            $db = new PHPWS_DB('properties');
            $db->addWhere('pets_allowed', 1);
            $db->addColumn('id');
            $db->addColumn('pet_type');
            $db->setIndexBy('id');
            $cols = $db->select('col');
            if (!empty($cols)) {
                foreach ($cols as $id => $pets) {
                    if (empty($pets)) {
                        continue;
                    }
                    $db->reset();
                    $pets_array = null;
                    $pets_array = @unserialize($pets);
                    if (!is_array($pets_array)) {
                        continue;
                    } else {
                        $pets = implode(', ', $pets_array);
                    }
                    $db->addWhere('id', $id);
                    $db->addValue('pet_type', $pets);
                    $db->update();
                }
            }
            $db->reset();
            $result = $db->addTableColumn('pet_fee', 'int not null default 0');
            if (PHPWS_Error::isError($result)) {
                PHPWS_Error::log($result);
                $content[] = 'ERROR - could not add pet_fee column';
                return false;
            }
            $db->reset();
            $result = $db->addTableColumn('airconditioning', 'smallint not null default 0');
            if (PHPWS_Error::isError($result)) {
                PHPWS_Error::log($result);
                $content[] = 'ERROR - could not add airconditioning column';
                return false;
            }
            $db->reset();
            $result = $db->addTableColumn('heat_type', 'varchar(255) default null');
            if (PHPWS_Error::isError($result)) {
                PHPWS_Error::log($result);
                $content[] = 'ERROR - could not add heat_type column';
                return false;
            }
        case version_compare($currentVersion, '1.2.1', '<'):
            $content[] = '<pre>1.2.1 updates
---------------
- Improved look with Bootstrapping.</pre>';
        case version_compare($currentVersion, '1.2.2', '<'):
            $content[] = '<pre>1.2.2 updates
---------------
+ Added gas heat and fiber internet/tv.
</pre>';
        case version_compare($currentVersion, '1.3.0', '<'):
            $content[] = <<<EOF
<pre>1.3.0 updates
-----------------
+ Changed login box for IE users
+ Added ability to view properties by contact.
+ Contacts list compacted. Email links to contact name.
+ Fixed bad function call on error page.
+ Added error checks in case 1) the property does not exists or not active or
  2) the image files are not present.
+ Test for incactive properties preventing error.
+ Added Bootstrap styling and overhauled to work on mobile devices.
+ Last logged defaults to creation date.
+ Fixed Shared Bedroom and Bathroom settings on roommates page.
+ Fixed active/inactive buttons.
</pre>
EOF;
        case version_compare($currentVersion, '1.4.0', '<'):
            if (!is_file(PHPWS_SOURCE_DIR . 'lib/vendor/autoload.php')) {
                $content[] = 'Composer is not installed. Be sure to run `composer install` in your installation\'s lib directory.';
                return false;
            }
            $db = \Database::getDB();
            $t1 = $db->addTable('prop_contacts');
            $dt = $t1->addDataType('private', 'smallint');
            $dt->setDefault(0);
            $dt->add();
            $dt2 = $t1->addDataType('approved', 'smallint');
            $dt2->setDefault(1);
            $dt2->add();
            $t1->addFieldConditional('company_name', 'private%', 'like');
            $t1->addValue('private', 1);
            $db->update();
            $old = $t1->getDataType('company_name');
            $new = clone $old;
            $new->setIsNull(true);
            $t1->alter($old, $new);
            $content[] = <<<EOF
<pre>1.4.0 updates
-----------------
+ Added Private Renter designation.
+ Added new manager signup.
</pre>
EOF;
        case version_compare($currentVersion, '1.4.1', '<'):
            $content[] = <<<EOF
<pre>1.4.1 updates
-----------------
+ New user signup requires all email settings to be set.
+ Invalid and duplicate email addresses are now checked on signup.
</pre>
EOF;
        case version_compare($currentVersion, '1.4.2', '<'):
            $content[] = <<<EOF
<pre>1.4.2 updates
-----------------
+ Fixed: New managers could log in before approved.
</pre>
EOF;
    }
    return true;
}
Esempio n. 6
0
/**
 * @author Matthew McNaney <mcnaney at gmail dot com>
 * @version $Id$
 */
function layout_update(&$content, $currentVersion)
{
    switch ($currentVersion) {
        case version_compare($currentVersion, '2.2.0', '<'):
            $content[] = 'This package will not update versions under 2.2.0.';
            return false;
        case version_compare($currentVersion, '2.2.1', '<'):
            $content[] = '+ Fixed improper sql call in update_220.sql file.';
        case version_compare($currentVersion, '2.3.0', '<'):
            $content[] = '<pre>';
            if (PHPWS_Boost::updateFiles(array('conf/config.php', 'conf/error.php'), 'layout')) {
                $content[] = 'Updated conf/config.php and conf/error.php file.';
            } else {
                $content[] = 'Unable to update conf/config.php and conf/error.php file.';
            }
            $content[] = '
2.3.0 changes
-------------
+ Removed references from object constructors.
+ Added the plug function to allow users to inject content directly
  into a theme.
+ Added translate functions.
+ Layout now looks for and includes a theme\'s theme.php file.
+ Fixed unauthorized access.
+ Added XML mode to config.php file. Puts Layout in XHTML+XML content mode.
+ Added missing media parameters to XML mode.
</pre>';
        case version_compare($currentVersion, '2.4.0', '<'):
            $files = array('img/layout.png', 'templates/no_cookie.tpl');
            $content[] = '<pre>';
            if (PHPWS_Boost::updateFiles($files, 'layout')) {
                $content[] = '--- Successfully updated the following files:';
            } else {
                $content[] = '--- Was unable to copy the following files:';
            }
            $content[] = '     ' . implode("\n     ", $files);
            $content[] = '
2.4.0 changes
-------------
+ Layout now checks and forces a user to enable cookies on their
  browser.
+ Rewrote Javascript detection. Was buggy before as session
  destruction could disrupt it.
+ Added German translations
+ Updated language functions
+ Fixed: bug in Layout confused a user\'s style sheet settings after
  the theme was changed.
+ Rewrote theme change code.
+ Added ability to force theme on layout settings construction.
+ Changed Control Panel icon
</pre>';
        case version_compare($currentVersion, '2.4.1', '<'):
            $files = array('conf/config.php');
            $content[] = '<pre>';
            if (PHPWS_Boost::updateFiles($files, 'layout')) {
                $content[] = '--- Successfully updated the following files:';
            } else {
                $content[] = '--- Was unable to copy the following files:';
            }
            $content[] = '     ' . implode("\n     ", $files);
            $content[] = '
2.4.1 changes
-------------
+ Bug #1741111 - Fixed moving a top box up and a bottom box down.
+ The cookie check is not determined by a define in the config file.
+ The cookie check was interfering with the rss feed. Cut off the page
  too quickly. Moved cookie check to the close.php file.
</pre>';
        case version_compare($currentVersion, '2.4.2', '<'):
            $content[] = '<pre>';
            $files = array('templates/arrange.tpl', 'conf/error.php', 'templates/move_box_select.tpl');
            layoutUpdateFiles($files, $content);
            if (!PHPWS_Boost::inBranch()) {
                $content[] = file_get_contents(PHPWS_SOURCE_DIR . 'mod/layout/boost/changes/2_4_2.txt');
            }
            $content[] = '</pre>';
        case version_compare($currentVersion, '2.4.3', '<'):
            $content[] = '<pre>2.4.3 changes
-----------------
+ nakedDisplay now allows a choice whether to use the blank template
  or not when it wraps. Default is to not.
+ Fixed noCache.
</pre>';
        case version_compare($currentVersion, '2.4.4', '<'):
            $content[] = '<pre>';
            $db = new PHPWS_DB('layout_config');
            if (PHPWS_Error::logIfError($db->dropTableColumn('userAllow'))) {
                $content[] = '--- An error occurred when trying to drop the userAllow column from the layout_config table.';
            } else {
                $content[] = '--- Dropped the userAllow column from the layout_config table.';
            }
            layoutUpdateFiles(array('templates/user_form.tpl'), $content);
            $content[] = '2.4.4 changes
-------------------
+ Dropped unused column from config table.
+ Added collapse function. Adds id="layout-collapse" to theme template
  under the {COLLAPSE} tag.
+ Changed method of checking for javascript status. Less chance for
  error.
+ Fixed notice.</pre>';
        case version_compare($currentVersion, '2.4.5', '<'):
            $content[] = '<pre>';
            $db = new PHPWS_DB('layout_config');
            if (PHPWS_Error::logIfError($db->addTableColumn('deity_reload', 'smallint not null default 0'))) {
                $content[] = 'Could not create layout_config.deity_reload column.';
                return false;
            } else {
                $content[] = 'Added layout_config.deity_reload column.';
            }
            layoutUpdateFiles(array('templates/metatags.tpl', 'conf/config.php'), $content);
            $content[] = '2.4.5 changes
--------------------
+ Added option to use a Key\'s summary or title to fill in the meta
  description.
+ Added new cacheHeader function to retain javascript and css
  information should a module return cached content before the above
  can be established.
+ Deities can now move a box to a theme locked area.
+ Added LAYOUT_IGNORE_JS_CHECK to force javascript use.
+ PHP 5 formatted';
        case version_compare($currentVersion, '2.4.6', '<'):
            $content[] = '<pre>2.4.6 changes
---------------------
+ Fix to cache headers
</pre>';
        case version_compare($currentVersion, '2.4.7', '<'):
            $content[] = '<pre>';
            layoutUpdateFiles(array('templates/themes.tpl'), $content);
            $content[] = '2.4.7 changes
---------------------
+ Added option to layout theme tab to disable or order module style
  sheet inclusion.
+ Can enable box move from mini admin
</pre>';
        case version_compare($currentVersion, '2.4.8', '<'):
            $content[] = '<pre>2.4.8 changes
---------------------
+ Bug#2424256 - Removed browser check to use @import on style sheets.
</pre>';
        case version_compare($currentVersion, '2.5.0', '<'):
            $content[] = '<pre>2.5.0 changes
---------------------
+ Icon class used.
+ Change of template directories to conform with core hub/branch change.
+ PHP 5 strict fixes.
+ New javascript detection method.
+ Default theme is now simple.
+ Allow admin to use hub or local themes.
</pre>';
        case version_compare($currentVersion, '2.5.1', '<'):
            $content[] = '<pre>2.5.1 changes
---------------------
+ Eloi George javascript patch applied
</pre>';
        case version_compare($currentVersion, '2.5.2', '<'):
            $content[] = '<pre>2.5.2 changes
---------------------
+ Eloi George templating patch added.
+ Fixed silent javascript failure.
</pre>';
        case version_compare($currentVersion, '2.5.3', '<'):
            $content[] = '<pre>2.5.3 changes
---------------------
+ Added HTTP tag for theming. Assists with http vs https
+ HOME_URL also added for theming.
</pre>';
        case version_compare($currentVersion, '2.5.4', '<'):
            $content[] = '<pre>2.5.4 changes
---------------------
+ Static notice corrected.
+ Page title can be changed from miniadmin
</pre>';
        case version_compare($currentVersion, '2.5.5', '<'):
            require_once PHPWS_SOURCE_DIR . 'mod/users/class/My_Page.php';
            My_Page::unregisterMyPage('layout');
            $content[] = '<pre>2.5.5 changes
---------------------
+ Unregister My Page
</pre>';
        case version_compare($currentVersion, '2.6.0', '<'):
            $content[] = <<<EOF
<pre>2.6.0 changes
--------------------
+ Removed Layout\\'s caching code.
+ Fixed layout's problem with locked content variables.
+ Fixed: Content without a content_var was overwriting previously unlabeled content.
+ Added Layout method includeJavascript. Shortcut for script inclusion over addJSHeader.
+ Added Font Awesome icons.
+ Reworded box move command in miniadmin.
+ Removed deprecated ckeditor function.
</pre>
EOF;
        case version_compare($currentVersion, '2.6.1', '<'):
            $content[] = <<<EOF
<pre>2.6.1 changes
--------------------
+ Added THEME_HTTP to the Layout wrap function.
</pre>
EOF;
        case version_compare($currentVersion, '2.7.0', '<'):
            if (PHPWS_Core::moduleExists('block')) {
                $db = Database::newDB();
                $t = $db->addTable('layout_config');
                $t->addField('header');
                $t->addField('footer');
                $config_result = $db->selectOneRow();
                if (!empty($config_result['header'])) {
                    $header_block = new Block_Item();
                    $header_block->title = 'Layout header';
                    $header_block->content = $_SESSION['Layout_Settings']->header;
                    $header_block->hide_title = true;
                    $header_block->save();
                }
                if (!empty($config_result['footer'])) {
                    $footer_block = new Block_Item();
                    $footer_block->title = 'Layout footer';
                    $footer_block->content = $_SESSION['Layout_Settings']->footer;
                    $footer_block->hide_title = true;
                    $footer_block->save();
                }
            }
            $content[] = <<<EOF
<pre>2.7.0 changes
--------------------
+ Removed header and footer. Moved data to Blocks.
+ Fixed some admin forms
</pre>
EOF;
    }
    return true;
}
Esempio n. 7
0
function properties_update(&$content, $currentVersion)
{
    switch ($currentVersion) {
        case version_compare($currentVersion, '1.1.0', '<'):
            $db = new PHPWS_DB('properties');
            $result = $db->addTableColumn('efficiency', 'smallint not null default 0');
            if (PHPWS_Error::isError($result)) {
                PHPWS_Error::log($result);
                $content[] = 'ERROR - could not add efficiency column';
                return false;
            }
            $content[] = '<pre>1.1.0 updates
---------------
+ Added efficiency option</pre>';
        case version_compare($currentVersion, '1.1.1', '<'):
            $db = new PHPWS_DB('prop_contacts');
            $result = $db->addTableColumn('company_url', 'VARCHAR( 255 ) NULL');
            if (PHPWS_Error::isError($result)) {
                PHPWS_Error::log($result);
                $content[] = 'ERROR - could not add company_url column';
                return false;
            }
            $content[] = '<pre>1.1.1 updates
---------------
+ Added company url
+ Property listing divided into tabs.</pre>';
        case version_compare($currentVersion, '1.2.0', '<'):
            $db = new PHPWS_DB('properties');
            $db->addWhere('pets_allowed', 1);
            $db->addColumn('id');
            $db->addColumn('pet_type');
            $db->setIndexBy('id');
            $cols = $db->select('col');
            if (!empty($cols)) {
                foreach ($cols as $id => $pets) {
                    if (empty($pets)) {
                        continue;
                    }
                    $db->reset();
                    $pets_array = null;
                    $pets_array = @unserialize($pets);
                    if (!is_array($pets_array)) {
                        continue;
                    } else {
                        $pets = implode(', ', $pets_array);
                    }
                    $db->addWhere('id', $id);
                    $db->addValue('pet_type', $pets);
                    $db->update();
                }
            }
            $db->reset();
            $result = $db->addTableColumn('pet_fee', 'int not null default 0');
            if (PHPWS_Error::isError($result)) {
                PHPWS_Error::log($result);
                $content[] = 'ERROR - could not add pet_fee column';
                return false;
            }
            $db->reset();
            $result = $db->addTableColumn('airconditioning', 'smallint not null default 0');
            if (PHPWS_Error::isError($result)) {
                PHPWS_Error::log($result);
                $content[] = 'ERROR - could not add airconditioning column';
                return false;
            }
            $db->reset();
            $result = $db->addTableColumn('heat_type', 'varchar(255) default null');
            if (PHPWS_Error::isError($result)) {
                PHPWS_Error::log($result);
                $content[] = 'ERROR - could not add heat_type column';
                return false;
            }
        case version_compare($currentVersion, '1.2.1', '<'):
            $content[] = '<pre>1.2.1 updates
---------------
- Improved look with Bootstrapping.</pre>';
        case version_compare($currentVersion, '1.2.2', '<'):
            $content[] = '<pre>1.2.2 updates
---------------
+ Added gas heat and fiber internet/tv.
</pre>';
        case version_compare($currentVersion, '1.3.0', '<'):
            $content[] = <<<EOF
<pre>1.3.0 updates
-----------------
+ Changed login box for IE users
+ Added ability to view properties by contact.
+ Contacts list compacted. Email links to contact name.
+ Fixed bad function call on error page.
+ Added error checks in case 1) the property does not exists or not active or
  2) the image files are not present.
+ Test for incactive properties preventing error.
+ Added Bootstrap styling and overhauled to work on mobile devices.
+ Last logged defaults to creation date.
+ Fixed Shared Bedroom and Bathroom settings on roommates page.
+ Fixed active/inactive buttons.
</pre>
EOF;
    }
    return true;
}
Esempio n. 8
0
/**
 * @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;
    }
}
Esempio n. 9
0
/**
 * @version $Id$
 * @author Matthew McNaney <mcnaney at gmail dot com>
 */
function pagesmith_update(&$content, $currentVersion)
{
    $home_dir = PHPWS_Boost::getHomeDir();
    switch ($currentVersion) {
        case version_compare($currentVersion, '1.0.1', '<'):
            $content[] = '<pre>';
            $db = new PHPWS_DB('ps_page');
            $result = $db->addTableColumn('front_page', 'smallint NOT NULL default 0');
            if (PHPWS_Error::logIfError($result)) {
                $content[] = "--- Unable to create table column 'front_page' on ps_page table.</pre>";
                return false;
            } else {
                $content[] = "--- Created 'front_page' column on ps_page table.";
            }
            $files = array('templates/page_list.tpl', 'javascript/update/head.js', 'conf/error.php', 'templates/page_templates/simple/page.tpl', 'templates/page_templates/twocolumns/page.tpl');
            pagesmithUpdateFiles($files, $content);
            if (!PHPWS_Boost::inBranch()) {
                $content[] = file_get_contents(PHPWS_SOURCE_DIR . 'mod/pagesmith/boost/changes/1_0_1.txt');
            }
            $content[] = '</pre>';
        case version_compare($currentVersion, '1.0.2', '<'):
            $content[] = '<pre>';
            $dest_dir = $home_dir . 'javascript/modules/pagesmith/passinfo/';
            if (!is_dir($dest_dir)) {
                if (is_writable($home_dir . 'javascript/modules/pagesmith/') && @mkdir($dest_dir)) {
                    $content[] = '--- SUCCEEDED creating "javascript/modules/passinfo/" directory.';
                } else {
                    $content[] = 'PageSmith 1.0.2 requires the javascript/modules/pagesmith/ directory be writable.</pre>';
                    return false;
                }
            } elseif (!is_writable($dest_dir)) {
                $content[] = 'PageSmith 1.0.2 requires the javascript/modules/pagesmith/passinfo/ directory be writable.</pre>';
                return false;
            }
            $source_dir = PHPWS_SOURCE_DIR . 'mod/pagesmith/javascript/passinfo/';
            if (!PHPWS_File::copy_directory($source_dir, $dest_dir)) {
                $content[] = "--- FAILED copying to {$dest_dir}.</pre>";
                return false;
            } else {
                $content[] = "--- SUCCEEDED copying to {$dest_dir} directory.";
            }
            if (!PHPWS_Boost::inBranch()) {
                $content[] = file_get_contents(PHPWS_SOURCE_DIR . 'mod/pagesmith/boost/changes/1_0_2.txt');
            }
            $content[] = '</pre>';
        case version_compare($currentVersion, '1.0.3', '<'):
            $content[] = '<pre>';
            $source_dir = PHPWS_SOURCE_DIR . 'mod/pagesmith/templates/page_templates/text_only/';
            $dest_dir = $home_dir . 'templates/pagesmith/page_templates/text_only/';
            if (PHPWS_File::copy_directory($source_dir, $dest_dir)) {
                $content[] = "--- Successfully copied {$source_dir}\n    to {$dest_dir}\n";
            } else {
                $content[] = "--- Failed to copy {$source_dir} to {$dest_dir}</pre>";
                return false;
            }
            $files = array('conf/config.php');
            pagesmithUpdateFiles($files, $content);
            if (!PHPWS_Boost::inBranch()) {
                $content[] = file_get_contents(PHPWS_SOURCE_DIR . 'mod/pagesmith/boost/changes/1_0_3.txt');
            }
            $content[] = '</pre>';
        case version_compare($currentVersion, '1.0.4', '<'):
            $content[] = '<pre>';
            $db = new PHPWS_DB('phpws_key');
            $db->addWhere('module', 'pagesmith');
            $db->addValue('edit_permission', 'edit_page');
            if (PHPWS_Error::logIfError($db->update())) {
                $content[] = 'Unable to update phpws_key table.</pre>';
                return false;
            } else {
                $content[] = 'Updated phpws_key table.';
            }
            $content[] = '1.0.4 changes
------------------
+ Fixed pagesmith edit permission.
+ PageSmith home pages were missing edit link.</pre>';
        case version_compare($currentVersion, '1.0.5', '<'):
            $content[] = '<pre>';
            pagesmithUpdateFiles(array('templates/page_templates/text_only/page.tpl'), $content);
            $content[] = '1.0.5 changes
----------------
+ Changed wording on move to front functionality
+ Added move to front to miniadmin
+ Fixed text_only template. Missing closing div tag.
</pre>';
        case version_compare($currentVersion, '1.0.6', '<'):
            $content[] = '<pre>
1.0.6 changes
-------------
+ Small fix to allow linkable images on cached pages.
</pre>';
        case version_compare($currentVersion, '1.0.7', '<'):
            $content[] = '<pre>';
            pagesmithUpdateFiles(array('templates/settings.tpl'), $content);
            $content[] = '1.0.7 changes
-------------
+ PageSmith can be set to automatically create a link when a new page
  is created.
+ Changing a page title now updates the menu link.
</pre>';
        case version_compare($currentVersion, '1.1.0', '<'):
            PHPWS_Core::initModClass('filecabinet', 'Cabinet.php');
            $content[] = '<pre>';
            Cabinet::convertImagesToFileAssoc('ps_block', 'type_id');
            $content[] = '--- Images converted for File Cabinet 2.0.0.';
            pagesmithUpdateFiles(array('javascript/passinfo/head.js', 'templates/page_templates/threesec/page.css', 'templates/page_templates/threesec/page.tpl', 'templates/page_templates/threesec/structure.xml', 'templates/page_templates/threesec/threesec.png'), $content);
            $content[] = '1.1.0 changes (unreleased)
-------------
+ PageSmith conforms to new File Cabinet update.
+ Added url parser to passinfo script to allow images to work with fck better.
</pre>';
        case version_compare($currentVersion, '1.2.1', '<'):
            $content[] = '<pre>';
            $source_tpl = PHPWS_SOURCE_DIR . 'mod/pagesmith/templates/page_templates/';
            $local_tpl = $home_dir . 'templates/pagesmith/page_templates/';
            $backup = $home_dir . 'templates/pagesmith/_page_templates/';
            $source_img = PHPWS_SOURCE_DIR . 'mod/pagesmith/img/folder_icons/';
            $local_img = $home_dir . 'images/mod/pagesmith/folder_icons/';
            if (is_dir($backup) || @PHPWS_File::copy_directory($local_tpl, $backup)) {
                $content[] = '--- Local page templates backed up to: ' . $backup;
            } else {
                $content[] = sprintf('--- Could not backup directory "%s" to "%s"</pre>', $local_tpl, $backup);
                return false;
            }
            if (PHPWS_File::copy_directory($source_tpl, $local_tpl)) {
                $content[] = '--- Local page templates updated.';
            } else {
                $content[] = sprintf('--- Could not copy directory "%s" to "%s"</pre>', $source_tpl, $local_tpl);
                return false;
            }
            if (PHPWS_File::copy_directory($source_img, $local_img)) {
                $content[] = '--- New page template icons copied locally.';
            } else {
                $content[] = sprintf('--- Could not copy directory "%s" to "%s"</pre>', $source_img, $local_img);
                return false;
            }
            if (!pagesmithSearchIndex()) {
                $content[] = '--- Unable to index pages in search. Check your error log.</pre>';
                return false;
            } else {
                $content[] = '--- Pages added to search';
            }
            $files = array('templates/pick_folder.tpl', 'templates/pick_template.tpl', 'templates/style.css', 'conf/folder_icons.php');
            pagesmithUpdateFiles($files, $content);
            $content[] = '1.2.1 changes
----------------
+ PageSmith now allows the sorting of templates
+ Page titles now added to search.
+ Wrong page ids don\'t 404. Send to message page.
+ Search indexing added to update and version raised.
+ Added search to pagesmith.
+ Changed to new url rewriting method.</pre>';
        case version_compare($currentVersion, '1.2.2', '<'):
            $content[] = '<pre>';
            $files = array('templates/page_list.tpl');
            pagesmithUpdateFiles($files, $content);
            $content[] = '
1.2.2 changes
---------------
+ Updated pagers to addSortHeaders.
+ Fixed direct access to page allowing view.
+ Front page does not alter page title.
+ Fixed some notices and a caching bug.
+ Changed wording on edit text windows.</pre>';
        case version_compare($currentVersion, '1.3.0', '<'):
            $db = new PHPWS_DB('ps_block');
            $db->dropTableColumn('btype');
            $db = new PHPWS_DB('ps_page');
            if (PHPWS_Error::logIfError($db->addTableColumn('parent_page', 'int NOT NULL default 0'))) {
                $content[] = 'Could not create ps_page.parent_page column.';
                return false;
            }
            if (PHPWS_Error::logIfError($db->addTableColumn('page_order', 'smallint NOT NULL default 0'))) {
                $content[] = 'Could not create ps_page.page_order column.';
                return false;
            }
            $db = new PHPWS_DB('ps_text');
            if (PHPWS_DB::getDBType() == 'mysql' || PHPWS_DB::getDBType() == 'mysqli') {
                if (PHPWS_Error::logIfError($db->alterColumnType('content', 'longtext NOT NULL'))) {
                    $content[] = 'Could not alter ps_text.content column.';
                }
            }
            $content[] = '<pre>';
            $files = array('javascript/passinfo/head.js', 'templates/page_form.tpl', 'javascript/delete_orphan/', 'javascript/confirm_delete/', 'javascript/update/head.js', 'templates/page_templates/threesec-tbl/', 'templates/orphans.tpl', 'templates/page_form.tpl', 'templates/page_frame.tpl', 'templates/page_list.tpl', 'templates/style.css', 'templates/sublist.tpl', 'templates/upload_template.tpl', 'img/add.png', 'img/delete.png', 'img/back.png', 'img/front.png');
            pagesmithUpdateFiles($files, $content);
            if (!PHPWS_Boost::inBranch()) {
                $content[] = file_get_contents(PHPWS_SOURCE_DIR . 'mod/pagesmith/boost/changes/1_3_0.txt');
            }
            $content[] = '</pre>';
        case version_compare($currentVersion, '1.3.1', '<'):
            $content[] = '<pre>';
            $files = array('templates/page_templates/threesec/page.tpl', 'templates/page_templates/threesec-tbl/page.tpl', 'templates/settings.tpl');
            pagesmithUpdateFiles($files, $content);
            $content[] = '1.3.1 changes
---------------
+ Page cache refreshed on page save.
+ Updated threesec templates to conform with norm box-title,
  box-content layout
+ Added ability to lengthen or shorten pagesmith links.
+ Added fix so edit mode does not parse smarttags.</pre>';
        case version_compare($currentVersion, '1.3.2', '<'):
            $content[] = '<pre>';
            Users_Permission::registerPermissions('pagesmith', $content);
            pagesmithUpdateFiles(array('templates/page_templates/'), $content);
            $content[] = '1.3.2 changes
----------------
+ Update was missing a permission update
+ Wrong permission getting called on settings
+ All page templates now have a class called pagesmith-page
+ Removed padding from page templates</pre>';
        case version_compare($currentVersion, '1.3.3', '<'):
            $db = new PHPWS_DB('ps_text');
            if (PHPWS_Error::logIfError($db->alterColumnType('content', 'longtext'))) {
                $content[] = 'Could not alter ps_text.content column.';
                return false;
            } else {
                $content[] = 'Updated ps_text.content column';
            }
            $content[] = '<pre>';
            pagesmithUpdateFiles(array('javascript/disable_links/', 'javascript/update/head.js'), $content);
            $content[] = 'Version 1.3.3
--------------------------------------------------------------------
+ Made ps_text.content null instead of not null
+ Made a change in page editing. Text spaces receive text without
  formatting. Prior to this change the parseOutput was run before
  sending the data to the editor. This stripped data that may need
  editing.
  Now the text is sent to the editor without processing. After post
  the text IS processed. This fixed the filters. Anchors will be
  busted AFTER the edit post but I don\'t think they really need to
  work in edit mode.
+ Added javascript to prevent accidental link clicks in edit mode.
+ change_link was an id, changed to a class since there were several
  on a page.</pre>';
        case version_compare($currentVersion, '1.3.4', '<'):
            $content[] = '<pre>1.3.4 changes
-------------
+ Fixed link shortening
+ Restored missing placeholder width and height
+ Fixed lost text bug.
</pre>';
        case version_compare($currentVersion, '1.4.0', '<'):
            $content[] = '<pre>1.4.0 changes
-------------
+ Icon class implemented.
+ Fixed on disableLinks script.
+ Added black page check on saving. Prohibits empty content from being saved to the database.
+ Added option to turn off "Back to top" links.
+ Added default installation page.
+ PHP 5 strict fixes.</pre>';
        case version_compare($currentVersion, '1.4.1', '<'):
            $content[] = '<pre>1.4.1 changes
-------------
Fixed bug causing blank editors on edit.</pre>';
        case version_compare($currentVersion, '1.4.2', '<'):
            $content[] = '<pre>1.4.2 changes
-------------
+ Added conditionals to try and prevent blank page posting.
+ Updated javascript to jquery code.
+ Added some new templates.
.</pre>';
        case version_compare($currentVersion, '1.5.0', '<'):
            $content[] = '<pre>1.5.0 changes
---------------
+ New method of editing text. Click on text instead of edit image.
+ Javascript window replaced with Jquery dialog.
</pre>';
        case version_compare($currentVersion, '1.5.1', '<'):
            $content[] = '<pre>1.5.1 changes
---------------
+ Mouseover edit behavior changed.
+ Publish on date added.
</pre>';
        case version_compare($currentVersion, '1.5.2', '<'):
            $content[] = '<pre>1.5.2 changes
---------------
- Fixed error message
- Empty orphans are removed automatically.
- Dialog editor made modal.
</pre>';
        case version_compare($currentVersion, '1.5.3', '<'):
            $content[] = '<pre>1.5.3 changes
---------------
+ Edit hinting changed to Boostrap standard
+ Removed upload template tab and code
+ Font Awesome used in icons
+ Tweaked page listing.
+ Removed default background color from page template.
+ Fixed bug with pages saving untitled.
</pre>';
        case version_compare($currentVersion, '1.5.4', '<'):
            $content[] = '<pre>1.5.4 changes
---------------
+ Added titles to admin icons
+ Removed @ to prevent PHP warning message
+ Style changes to pager listing
+ Pop up width is relative to browser
</pre>';
        case version_compare($currentVersion, '1.6.0', '<'):
            $db = \Database::newDB();
            $table = $db->addTable('ps_page');
            $table->addFieldConditional('template', 'art');
            $table->addValue('template', 'banner');
            $db->update();
            $db->clearConditional();
            $table->reset();
            $c1 = $table->getFieldConditional('template', 'vtour');
            $c2 = $table->getFieldConditional('template', 'VTOUR');
            $db->addConditional($db->createConditional($c1, $c2, 'OR'));
            $table->addValue('template', 'threesec');
            $db->update();
            $content[] = '<pre>1.6.0 changes
---------------
+ Rewrote page templates to be Bootstrap compatible.
+ Removed art and vtour template.
</pre>';
        case version_compare($currentVersion, '1.6.1', '<'):
            $content[] = '<pre>1.6.1 changes
---------------
+ changed content editor pop up to use bootstrap modal instead of jquery dialog
+ Bootstrap styling to some UI elements
+ Back to top link pulled right with new icon
</pre>';
        case version_compare($currentVersion, '1.7.0', '<'):
            $content[] = <<<EOF
<pre>1.7.0 changes
------------------
+ Removed hardcoded h2 styles on some templates
+ Back to top default setting added
+ Clicking off edit window saves content
</pre>
EOF;
        case version_compare($currentVersion, '1.8.0', '<'):
            $db = \Database::newDB();
            $lb = $db->addTable('layout_box');
            $lb->addFieldConditional('module', 'pagesmith');
            $db->delete();
            $content[] = <<<EOF
<pre>1.8.0 changes
------------------
+ Removed all PageSmith pages from layout_box table. Was kept only for multiple front pages which no one used.
</pre>
EOF;
        case version_compare($currentVersion, '1.9.0', '<'):
            $db = \Database::newDB();
            $pp = $db->addTable('ps_page');
            $st = $pp->addDataType('show_title', 'smallint');
            $st->add();
            $content[] = <<<EOF
<pre>1.9.0 changes
------------------
+ Added: Ability to hide title
+ Changed: Pagesmith editing works within Bootstrap modals.
+ Changed: Adapted to work with CKEditor 4.
+ Changed: Front page is now Highlander style.
</pre>
EOF;
        case version_compare($currentVersion, '1.9.1', '<'):
            $db = \Database::newDB();
            $pp = $db->addTable('ps_page');
            if (!$pp->columnExists('hide_title') && $pp->columnExists('show_title')) {
                $dt = $pp->getDatatype('show_title');
                $dt->change('hide_title');
            }
            $content[] = <<<EOF
<pre>1.9.1 changes
------------------
+ Fixed: Code uses hide_title. Column name was show_title.
</pre>
EOF;
        case version_compare($currentVersion, '1.9.2', '<'):
            $content[] = <<<EOF
<pre>1.9.2 changes
------------------
+ Fixed: hide_title was not properly formated in install.sql
+ Fixed: Reduced edit popup window height.
+ Feature: Added save button to CKEditor that works in maximize.
+ Feature: Added page update check to page submission.
+ Change: Save button is styled and larger.
+ Change: New page defaults to Text Only template.
</pre>
EOF;
        case version_compare($currentVersion, '1.10.0', '<'):
            $db = \Database::newDB();
            $t1 = $db->addTable('ps_page');
            $dt = $t1->addDatatype('deleted', 'smallint');
            $dt->setDefault(0);
            $dt->add();
            $content[] = <<<EOF
<pre>
1.10.0 Changes
---------------
+ Deleted pages are kept in database
</pre>
EOF;
    }
    // end switch
    return true;
}
Esempio n. 10
0
/**
 * @version $Id$
 * @author Matthew McNaney <mcnaney at gmail dot com>
 */
function signup_update(&$content, $currentVersion)
{
    switch ($currentVersion) {
        case version_compare($currentVersion, '1.0.1', '<'):
            $content[] = '<pre>';
            $files = array('templates/slot_setup.tpl');
            signupUpdateFiles($files, $content);
            $content[] = '1.0.1 changes
----------------
+ Added ability to reset slot order should it come unraveled.
+ Fixed reroute link that was hard coded to go to sheet id 1.</pre>';
        case version_compare($currentVersion, '1.0.2', '<'):
            $content[] = '<pre>1.0.2 changes
----------------
+ Changed email to send individually.
+ Fixed: "All slots full" message was not displaying.</pre>';
        case version_compare($currentVersion, '1.1.0', '<'):
            $content[] = '<pre>';
            PHPWS_Boost::registerMyModule('signup', 'users', $content);
            $db = new PHPWS_DB('signup_sheet');
            if (PHPWS_Error::logIfError($db->addTableColumn('contact_email', 'varchar(255) default NULL'))) {
                $content[] = '--- Failed creating new column on signup_sheet.</pre>';
                return false;
            } else {
                $content[] = '--- contact_email column created successfully on signup_sheet table.';
            }
            if (PHPWS_Error::logIfError($db->addTableColumn('multiple', 'smallint NOT NULL default 0'))) {
                $content[] = '--- Failed creating new column on signup_sheet.</pre>';
                return false;
            } else {
                $content[] = '--- "multiple" column created successfully on signup_sheet table.';
            }
            $files = array('templates/peep_pop.tpl', 'templates/slot_setup.tpl', 'templates/edit_sheet.tpl', 'templates/peeps.tpl', 'templates/slot_setup.tpl', 'img/edit.png', 'img/delete.png');
            signupUpdateFiles($files, $content);
            $content[] = '1.1.0 changes
----------------
+ Added way to update slots
+ Added user permissions to signup
+ Removed some unneeded, commented code
+ Added alphabetic reordering
+ Fixed ordering up and downs.
+ Changed slot form to selection method. Previously showed all slots
  causing long page loads on big signups.
+ Added contact email address for sheets.
+ Added url forwarding support.
+ Sheets can be set to allow multiple signups.
</pre>';
        case version_compare($currentVersion, '1.1.1', '<'):
            $content[] = '<pre>';
            signupUpdateFiles(array('templates/sheet_list.tpl', 'templates/slot_setup.tpl'), $content);
            $content[] = '1.1.1 changes
-------------------
+ Restricted users cannot create signup sheets.
+ Added search textfield to slot screen.
+ Added missing navigation links to sheet listing.</pre>';
        case version_compare($currentVersion, '1.1.2', '<'):
            $content[] = '<pre>';
            $db = new PHPWS_DB('signup_sheet');
            if (PHPWS_Error::logIfError($db->addTableColumn('contact_email', 'varchar(255) default NULL'))) {
                $content[] = '--- Failed creating new column on signup_sheet.</pre>';
                return false;
            } else {
                $content[] = '--- contact_email column created successfully on signup_sheet table.';
            }
            if (PHPWS_Error::logIfError($db->addTableColumn('multiple', 'smallint NOT NULL default 0'))) {
                $content[] = '--- Failed creating new column on signup_sheet.</pre>';
                return false;
            } else {
                $content[] = '--- "multiple" column created successfully on signup_sheet table.';
            }
            $content[] = '1.1.2 changes
-------------------
+ Install sql was missing new columns in signup_sheet table.
+ Removed the phone number parsing. Got in the way of extensions and
  the like.
</pre>';
        case version_compare($currentVersion, '1.2.0', '<'):
            $content[] = '<pre>1.2.0 changes
----------------
+ Fixed: signup errors reseting slot pick
+ Removed redundant error message
+ previous register fix would not list empty slots.
+ Removed string length on phone number
+ Only pulling registered users for slots open.
+ PHP 5 formatted.
</pre>';
        case version_compare($currentVersion, '1.2.1', '<'):
            $content[] = '<pre>1.2.1 changes
----------------
+ Removed reference symbols
+ Added dngettext for "openings(s)" translation
+ Rewrote getAllSlots. The slots filled number wasn\'t joining
  properly.
+ Fixed sheet view link.</pre>';
        case version_compare($currentVersion, '1.2.2', '<'):
            $content[] = '<pre>1.2.2 changes
----------------
+ Fixed url sent to key.</pre>';
        case version_compare($currentVersion, '1.3.0', '<'):
            $content[] = '<pre>';
            $db = new PHPWS_DB('signup_peeps');
            $db->addTableColumn('extra1', 'varchar(255) null');
            $db->addTableColumn('extra2', 'varchar(255) null');
            $db->addTableColumn('extra3', 'varchar(255) null');
            $db->query('update signup_peeps set extra1 = organization');
            $db = new PHPWS_DB('signup_sheet');
            $db->addTableColumn('extra1', 'varchar(255) null');
            $db->addTableColumn('extra2', 'varchar(255) null');
            $db->addTableColumn('extra3', 'varchar(255) null');
            $db->addValue('extra1', 'Organization');
            $db->update();
            $files = array('templates/applicants.tpl', 'templates/edit_peep.tpl', 'templates/peeps.tpl', 'templates/signup_form.tpl');
            signupUpdateFiles($files, $content);
            $content[] = '1.3.0 changes
--------------
+ Added extra 1 thru 3 to sheet and peeps for extra questions.
</pre>';
        case version_compare($currentVersion, '1.3.1', '<'):
            $content[] = '<pre>1.3.1 changes
-------------------
+ Fixed incorrect counting of people in slots.</pre>';
        case version_compare($currentVersion, '1.3.2', '<'):
            $content[] = '<pre>1.3.2 changes
-------------------
+ PHP 5 strict fixes.
+ Icon class added</pre>';
        case version_compare($currentVersion, '1.3.3', '<'):
            $content[] = '<pre>1.3.3 changes
-------------------
+ New additions by Chris Coley
 - Added move to bottom and top for slot ordering.
 - Phone number error checked.
 - Refined slot search, only slots with searched member.
 - Start and end times order options on sheet listing.
 - Added clearer instructions to sheet setup.
 - Emails sent according to last search.
 - UI additions to ease administration.
</pre>';
        case version_compare($currentVersion, '1.3.4', '<'):
            $content[] = '<pre>1.3.4 changes
-----------------
+ Fixed bad form on moving slot member</pre>';
        case version_compare($currentVersion, '1.3.5', '<'):
            $db = \Database::newDB();
            $sp = $db->addTable('signup_peeps');
            if (!$sp->columnExists('extra1')) {
                $dt1 = \Database\Datatype::factory($sp, 'extra1', 'varchar');
                $dt1->add();
                $dt2 = \Database\Datatype::factory($sp, 'extra2', 'varchar');
                $dt2->add();
                $dt3 = \Database\Datatype::factory($sp, 'extra3', 'varchar');
                $dt3->add();
            }
            $content[] = '<pre>1.3.5 changes
----------------
+ Installation did not include the extra columns.
</pre>';
        case version_compare($currentVersion, '1.3.6', '<'):
            $db = \Database::newDB();
            $dbtype = $db->getDatabaseType();
            if ($dbtype == 'mysql') {
                $db->query('ALTER TABLE `signup_peeps` MODIFY extra1 VARCHAR(255) DEFAULT NULL');
                $db->query('ALTER TABLE `signup_peeps` MODIFY extra2 VARCHAR(255) DEFAULT NULL');
                $db->query('ALTER TABLE `signup_peeps` MODIFY extra3 VARCHAR(255) DEFAULT NULL');
            } else {
                $db->query('ALTER TABLE signup_peeps ALTER COLUMN extra1 DROP NOT NULL');
                $db->query('ALTER TABLE signup_peeps ALTER COLUMN extra2 DROP NOT NULL');
                $db->query('ALTER TABLE signup_peeps ALTER COLUMN extra3 DROP NOT NULL');
            }
            $content[] = '<pre>1.3.6 changes
----------------
+ Extra peer columns need to be null
</pre>';
    }
    return true;
}
Esempio n. 11
0
/**
 * @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;
}
Esempio n. 12
0
/**
 * @author Matthew McNaney <mcnaney at gmail dot com>
 * @version $Id$
 */
function block_update(&$content, $currentVersion)
{
    switch ($currentVersion) {
        case version_compare($currentVersion, '1.1.1', '<'):
            $content[] = '<pre>Block versions prior to 1.1.1 are not supported for updating.
Please download version 1.1.2.</pre>';
            break;
        case version_compare($currentVersion, '1.1.2', '<'):
            PHPWS_Boost::updateFiles(array('img/block.png'), 'block');
            $content[] = '<pre>1.1.2 changes
-------------
+ Added German files
+ Use new translation format
+ Changed control panel icon
</pre>';
        case version_compare($currentVersion, '1.1.3', '<'):
            $content[] = '<pre>';
            if (PHPWS_Boost::updateFiles(array('templates/sample.tpl'), 'block')) {
                $content[] = '--- Successfully copied templates/sample.tpl';
            } else {
                $content[] = '--- Unable to copy templates/sample.tpl';
            }
            $content[] = '
1.1.3 changes
-------------
+ Changed the sample.tpl layout to conform with other "box" templates.
</pre>';
        case version_compare($currentVersion, '1.2.0', '<'):
            $content[] = '<pre>';
            $db = new PHPWS_DB('block');
            if (PHPWS_Error::logIfError($db->addTableColumn('file_id', 'int not null default 0'))) {
                $content[] = 'Unable to add file_id column to block table.</pre>';
                return false;
            }
            if (PHPWS_Error::logIfError($db->addTableColumn('hide_title', 'smallint not null default 0'))) {
                $content[] = 'Unable to add file_only column to block table.</pre>';
                return false;
            }
            if (PHPWS_Boost::updateFiles(array('conf/config.php', 'templates/edit.tpl', 'templates/sample.tpl'), 'block')) {
                $content[] = '--- Successfully updated files.';
            } else {
                $content[] = '--- Unable to update files. Please run revert in Boost.';
            }
            $content[] = '1.2.0 changes
-----------------
+ Blocks can now contain File Cabinet elements.</pre>';
        case version_compare($currentVersion, '1.3.0', '<'):
            if (PHPWS_Boost::updateFiles(array('templates/list.tpl', 'templates/sample.tpl'), 'block')) {
                $content[] = '--- Successfully copied templates/list.tpl';
            } else {
                $content[] = '--- Unable to copy templates/list.tpl';
            }
            $content[] = '<pre>1.3.0 changes
-----------------
+ PHP 5 updated
+ Wrapped block-file class around file display.
+ Changed pager view to use addSortHeaders</pre>';
        case version_compare($currentVersion, '1.3.1', '<'):
            if (PHPWS_Boost::updateFiles(array('templates/settings.tpl'), 'block')) {
                $content[] = '--- Successfully copied templates/settings.tpl';
            } else {
                $content[] = '--- Unable to copy templates/settings.tpl';
            }
            $content[] = '<pre>1.3.1 changes
-----------------
+ RFE #2236544 - Image size limits set in settings tab instead of in
  config file.
</pre>';
        case version_compare($currentVersion, '1.3.2', '<'):
            $content[] = '<pre>1.3.2 changes
-------------
+ Removed isPosted check on block save.
</pre>';
        case version_compare($currentVersion, '1.3.3', '<'):
            $content[] = '<pre>1.3.3 changes
-------------
+ PHP 5 strict changes.
+ Using Icon class.
+ Id added to each block.
</pre>';
        case version_compare($currentVersion, '1.3.4', '<'):
            $content[] = '<pre>1.3.4 changes
--------------
+ Removed exit call.
</pre>';
        case version_compare($currentVersion, '1.3.5', '<'):
            $content[] = '<pre>1.3.5 changes
--------------
+ Put in sanity checks preventing blank blocks.
+ Removed New tab, added New block button to List view.
+ Empty block titles now get a deactivated title based on the content.
</pre>';
        case version_compare($currentVersion, '1.3.6', '<'):
            moveBlockImages();
            $content[] = '<pre>1.3.6 changes
---------------
+ Moved File Cabinet material to block content.
+ Removed copy and pin single functionality.
+ Added ability to post block to page through the miniadmin link.
</pre>';
        case version_compare($currentVersion, '1.3.7', '<'):
            if ($currentVersion == '1.3.6' && PHPWS_Boost::inBranch()) {
                moveBlockImages();
            }
            $db = Database::newDB();
            $btable = $db->addTable('block');
            $dt = $btable->addDataType('hide_narrow', 'smallint');
            $dt->add();
            $content[] = '<pre>1.3.7
---------------
+ Moved File Cabinet material to block content (did not work on branches from 1.3.6).
+ Added option to hide a block when width is minimized.
</pre>';
        case version_compare($currentVersion, '1.3.8', '<'):
            $content[] = '<pre>1.3.8 changes
---------------
+ Updated icons to Font Awesome
+ Fixed bug with Branch update.
</pre>';
        case version_compare($currentVersion, '1.3.9', '<'):
            $content[] = '<pre>1.3.9 changes
---------------
+ Removed viewPinnedBlocks code
</pre>';
        case version_compare($currentVersion, '1.3.10', '<'):
            $content[] = '<pre>1.3.10 changes
---------------
+ Added font-awesome icons.
+ Updated to work with ckeditor 4.
</pre>';
        case version_compare($currentVersion, '1.3.11', '<'):
            $content[] = '<pre>1.3.10 changes
---------------
+ Added error check in admin for blank titles.
</pre>';
    }
    return TRUE;
}
Esempio n. 13
0
/**
 * Description
 * @author Jeff Tickle <jtickle at tux dot appstate dot edu>
 */
function analytics_update(&$content, $currentVersion)
{
    switch ($currentVersion) {
        case version_compare($currentVersion, '1.0.1', '<'):
            $db = new PHPWS_DB('analytics_tracker');
            $result = $db->addTableColumn('disable_if_logged', 'int NOT NULL default 0');
            if (PHPWS_Error::logIfError($result)) {
                $content[] = 'Unable to add disable_if_logged column to analytics_tracker table.';
                return false;
            }
            $files = array('templates/edit.tpl');
            if (PHPWS_Boost::updateFiles($files, 'analytics')) {
                $content[] = '--- Updated templates/edit.tpl';
            }
        case version_compare($currentVersion, '1.1.0', '<'):
            // install.sql has been wrong for awhile, this should fix any discrepancies
            $db = new PHPWS_DB('analytics_tracker');
            if (!$db->isTableColumn('disable_if_logged')) {
                $result = $db->addTableColumn('disable_if_logged', 'int NOT NULL default 0');
                if (PHPWS_Error::logIfError($result)) {
                    $content[] = 'Unable to add disable_if_logged column to analytics_tracker table.';
                    return false;
                }
                $content[] = '--- Added disable_if_logged option to database';
            }
            // Load new schema
            $db = new PHPWS_DB();
            $result = $db->importFile(PHPWS_SOURCE_DIR . 'mod/analytics/boost/update/1.1.0.sql');
            if (PHPWS_Error::logIfError($result)) {
                $content[] = 'Unable to import updated schema for version 1.1.0.';
                return false;
            }
            $content[] = '--- Updated Analytics schema to 1.1.0';
            // Move Google Analytics data to its own table
            $db = new PHPWS_DB('analytics_tracker');
            $db->addColumn('id');
            $db->addColumn('account');
            $db->addWhere('type', 'GoogleAnalyticsTracker');
            $result = $db->select();
            if (PHPWS_Error::logIfError($result)) {
                $content[] = 'Unable to select Google Analytics tracker from analytics_tracker table.';
                return false;
            }
            foreach ($result as $row) {
                $db = new PHPWS_DB('analytics_tracker_google');
                $db->addValue('id', $row['id']);
                // Adding UA- into the account identifier to reduce confusion
                $db->addValue('account', 'UA-' . $row['account']);
                $db->insert(false);
                $content[] = "--- Migrated Google Analytics configuration for account UA-{$row['account']}";
            }
            $db = new PHPWS_DB('analytics_tracker');
            $result = $db->dropTableColumn('account');
            if (PHPWS_Error::logIfError($result)) {
                $content[] = 'Unable to remove account column from analytics_tracker table.';
                return false;
            }
            $content[] = '--- Completed migration to Analytics 1.1.0 schema';
        case version_compare($currentVersion, '1.1.1', '<'):
            $content[] = <<<EOF
<pre>Version 1.1.1
-------------------
+ Piwik fix.
+ Fixed uninstall script
</pre>
EOF;
    }
    return true;
}
Esempio n. 14
0
/**
 * update file for menu
 *
 * @author Matthew McNaney <mcnaney at gmail dot com>
 * @version $Id$
 */
function menu_update(&$content, $currentVersion)
{
    $home_directory = PHPWS_Boost::getHomeDir();
    switch ($currentVersion) {
        case version_compare($currentVersion, '1.2.0', '<'):
            $content[] = '<pre>Menu versions prior to 1.2.0 are not supported for update.
Please download 1.2.1.</pre>';
            break;
        case version_compare($currentVersion, '1.2.1', '<'):
            $content[] = '<pre>1.2.1 changes
-----------------
+ Fixed bug with making home link.
</pre>';
        case version_compare($currentVersion, '1.3.0', '<'):
            $files = array('conf/config.php', 'templates/admin/settings.tpl', 'templates/links/link.tpl', 'templates/popup_admin.tpl');
            $content[] = '<pre>';
            if (PHPWS_Boost::updateFiles($files, 'menu')) {
                $content[] = '--- Successfully updated the following files:';
            } else {
                $content[] = '--- Was unable to copy the following files:';
            }
            $content[] = '     ' . implode("\n     ", $files);
            $content[] = '
1.3.0 changes
-----------------
+ Admin icon for links is now clickable. Pulls up window of options.
+ Added ability to disable floating admin links.
</pre>';
        case version_compare($currentVersion, '1.3.1', '<'):
            $files = array('templates/site_map.tpl');
            $content[] = '<pre>';
            if (PHPWS_Boost::updateFiles($files, 'menu')) {
                $content[] = '--- Successfully updated the following files:';
            } else {
                $content[] = '--- Was unable to copy the following files:';
            }
            $content[] = '     ' . implode("\n     ", $files);
            $content[] = '
1.3.1 changes
-----------------
+ Bug # 1609737. Fixed site_map.tpl file. Thanks Andy.
</pre>';
        case version_compare($currentVersion, '1.4.0', '<'):
            $content[] = '<pre>';
            $basic_dir = $home_directory . 'templates/menu/menu_layout/basic/';
            $horz_dir = $home_directory . 'templates/menu/menu_layout/horizontal/';
            if (!is_dir($basic_dir)) {
                if (PHPWS_File::copy_directory(PHPWS_SOURCE_DIR . 'mod/menu/templates/menu_layout/basic/', $basic_dir)) {
                    $content[] = "--- Successfully copied directory: {$basic_dir}";
                } else {
                    $content[] = "--- Failed to copy directory: {$basic_dir}</pre>";
                    return false;
                }
            }
            if (!is_dir($horz_dir)) {
                if (PHPWS_File::copy_directory(PHPWS_SOURCE_DIR . 'mod/menu/templates/menu_layout/horizontal/', $horz_dir)) {
                    $content[] = "--- Successfully copied directory: {$horz_dir}";
                } else {
                    $content[] = "--- Failed to copy directory: {$horz_dir}</pre>";
                    return false;
                }
            }
            menuUpdateFiles(array('conf/error.php'), $content);
            if (!PHPWS_Boost::inBranch()) {
                $content[] = file_get_contents(PHPWS_SOURCE_DIR . 'mod/menu/boost/changes/1_4_0.txt');
            }
            $content[] = '</pre>';
        case version_compare($currentVersion, '1.4.1', '<'):
            $content[] = '<pre>';
            $files = array('templates/admin/settings.tpl', 'templates/admin/menu_list.tpl');
            menuUpdateFiles($files, $content);
            if (!PHPWS_Boost::inBranch()) {
                $content[] = file_get_contents(PHPWS_SOURCE_DIR . 'mod/menu/boost/changes/1_4_1.txt');
            }
            $content[] = '</pre>';
        case version_compare($currentVersion, '1.4.2', '<'):
            $content[] = '<pre>';
            $db = new PHPWS_DB('menus');
            $db->addWhere('template', 'basic.tpl');
            $db->addValue('template', 'basic');
            if (PHPWS_Error::logIfError($db->update())) {
                $content[] = '--- Failed to update menus table.';
            } else {
                $content[] = '--- Updated menu table with correct template directory.';
            }
            $files = array('templates/admin/settings.tpl');
            menuUpdateFiles($files, $content);
            if (!PHPWS_Boost::inBranch()) {
                $content[] = file_get_contents(PHPWS_SOURCE_DIR . 'mod/menu/boost/changes/1_4_2.txt');
            }
            $content[] = '</pre>';
        case version_compare($currentVersion, '1.4.3', '<'):
            $content[] = '<pre>';
            $files = array('templates/admin/settings.tpl');
            menuUpdateFiles($files, $content);
            if (!PHPWS_Boost::inBranch()) {
                $content[] = file_get_contents(PHPWS_SOURCE_DIR . 'mod/menu/boost/changes/1_4_3.txt');
            }
            $content[] = '</pre>';
        case version_compare($currentVersion, '1.4.4', '<'):
            $content[] = '<pre>
1.4.4 Changes
--------------
+ Added three new menu functions:
  o quickLink - inserts a new link on any menu pinned on all pages;
                passed a title and url.
  o quickKeyLink - same as above but passed key_id
  o updateKeyLink - causes a link to reset its url, title, and active
                    status based on the condition of the current key
                    it is based on.</pre>';
        case version_compare($currentVersion, '1.4.5', '<'):
            $content[] = '<pre>
1.4.5 Changes
--------------
+ Fixed some submenus not appearing when sibling chosen.</pre>';
        case version_compare($currentVersion, '1.4.6', '<'):
            $content[] = '<pre>';
            menuUpdateFiles(array('templates/admin/menu_list.tpl'), $content);
            $content[] = '1.4.6 Changes
--------------
+ Update to addSortHeaders.
+ Adding missing paging navigation.</pre>';
        case version_compare($currentVersion, '1.5.0', '<'):
            $db = new PHPWS_DB('menu_links');
            PHPWS_Error::logIfError($db->alterColumnType('title', 'varchar(255) not null'));
            $files = array('templates/style.css', 'templates/menu_layout/basic/menu.tpl', 'templates/menu_layout/basic/link.tpl', 'templates/menu_layout/horizontal/menu.tpl', 'templates/admin/settings.tpl', 'img/icon_indent.png', 'img/icon_outdent.gif', 'javascript/admin_link/', 'conf/config.php');
            $content[] = '<pre>';
            menuUpdateFiles($files, $content);
            $content[] = '1.5.0 Changes
--------------
+ RFE #2060159: Pin page link appears in miniadmin if admin mode is
  set to appear there.
+ Fixed bug #2079194. Deleting menu now removes links as well. Thanks
  Tommy.
+ Added option to expand menus when admin mode is enabled
+ Reworded menu admin link.
+ Added more ajax controls (add, delete, move) to the admin menu.
+ getTitle returns link without decoding it. Needed to prevent
  breakage with quotation marks.
+ Increased some popup window sizes
+ Fixed current link problem with unkeyed items.
+ Increased link title length in database.
</pre>';
        case version_compare($currentVersion, '1.5.1', '<'):
            $content[] = '<pre>1.5.1 changes
-------------------
+ Fixed menu preventing unpinning.
+ Default is now false for menu expansion in admin mode.</pre>';
        case version_compare($currentVersion, '1.5.2', '<'):
            $content[] = '<pre>';
            $files = array('templates/site_map.tpl', 'templates/menu_layout/basic/menu.tpl', 'templates/menu_layout/horizontal/menu.tpl');
            menuUpdateFiles($files, $content);
            $content[] = '1.5.2 changes
---------------
+ Added Verdon\'s edit full menu sitemap
+ Removed duplicate pin page link in miniadmin
+ Wrapped default menu template in box-content div per patch by Obones
+ Local links created on key pages were not made current.
+ Commented out pin page link in template</pre>';
        case version_compare($currentVersion, '1.6.0', '<'):
            $db = new PHPWS_DB('menus');
            if (PHPWS_Error::logIfError($db->addTableColumn('key_id', 'int not null default 0'))) {
                return false;
            }
            PHPWS_Core::initModClass('menu', 'Menu_Item.php');
            $menus = $db->getObjects('Menu_Item');
            if (!empty($menus) && !PHPWS_Error::logIfError($menus)) {
                foreach ($menus as $m) {
                    $m->save();
                }
            }
            $content[] = '<pre>';
            $files = array('img/icon_outdent.gif', 'conf/config.php', 'javascript/admin_link/default.php', 'javascript/admin_link/menu.js', 'templates/admin/settings.tpl');
            menuUpdateFiles($files, $content);
            $content[] = '1.6.0 changes
---------------
+ Fixed bugs with popup menu.
+ Added "outdent" ability
+ Added ability to set view permissions on menus.
+ Added option to have add links always on.
</pre>';
        case version_compare($currentVersion, '1.6.1', '<'):
            $content[] = '<pre>';
            $files = array('templates/menu_layout/basic/link.tpl', 'templates/menu_layout/horizontal/link.tpl', 'templates/style.css', 'conf/config.php', 'img/icon_outdent.gif');
            menuUpdateFiles($files, $content);
            $content[] = '1.6.1 changes
---------------
+ Fixed up arrows and indent icons not appearing.
</pre>';
        case version_compare($currentVersion, '1.6.2', '<'):
            $content[] = '<pre>1.6.2 changes
---------------
+ Added file include for missing class.
+ Added missing indent tags to popup_admin.tpl</pre>
';
        case version_compare($currentVersion, '1.6.3', '<'):
            $content[] = '<pre>1.6.3 changes
---------------
+ View permission fix.
+ Icon class used.
+ PHP 5 strict fixes</pre>
';
        case version_compare($currentVersion, '1.6.4', '<'):
            $content[] = '<pre>1.6.4 changes
---------------
+ Bug fix with database initialization
+ Added code from Eloi George reducing DB queries</pre>
';
        case version_compare($currentVersion, '1.6.5', '<'):
            $content[] = '<pre>1.6.5 changes
----------------
+ Patch from Eloi that reduces database calls on menu creation.
+ Fixed notice bugs from link movement
</pre>';
        case version_compare($currentVersion, '1.6.6', '<'):
            $content[] = '<pre>1.6.6 changes
----------------
+ Fixed bug with javascript in menu admin.
+ Changed getUrl to return just the href and not a complete tag.
</pre>';
        case version_compare($currentVersion, '1.6.7', '<'):
            $content[] = '<pre>1.6.7 changes
----------------
+ Fixed bug with add link not appearing on home page
+ Re-ordered administrative options in "mouse hover" menu for menu link
+ Added additional conditional to prevent menu expansion on a blank url
</pre>';
        case version_compare($currentVersion, '1.6.8', '<'):
            $content[] = '<pre>1.6.8 changes
----------------
+ menu-link-href class added to the "a" menu tag.
+ Font Awesome links used in admin functionality.
+ Old graphic files removed.
+ Changed some working to make admin options more clear.
</pre>';
        case version_compare($currentVersion, '2.0.0', '<'):
            $db = \Database::newDB();
            $tbl = $db->addTable('menus');
            $tbl->addDataType('queue', 'smallint')->add();
            $tbl->addField('id');
            $count = 0;
            while ($id = $db->selectColumn()) {
                $count++;
                $tbl->addValue('queue', $count);
                $tbl->addFieldConditional('id', $id);
                $db->update();
                $tbl->resetValues();
                $db->clearConditional();
            }
            $content[] = '<pre>2.0.0 changes
----------------
+ Rewrote large parts of administration
+ Category view for menus
</pre>';
        case version_compare($currentVersion, '2.0.1', '<'):
            $db = \Database::newDB();
            $tbl = $db->addTable('menus');
            $tbl->addDataType('assoc_key', 'int')->add();
            $content[] = '<pre>2.0.1 changes
----------------
+ Can associate page to a menu
</pre>';
        case version_compare($currentVersion, '2.0.2', '<'):
            $db = \Database::newDB();
            $tbl = $db->addTable('menus');
            $dt = $tbl->addDataType('assoc_url', 'varchar');
            $dt->setIsNull(true);
            $dt->add();
            $content[] = '<pre>2.0.2 changes
----------------
+ Can associate url to a menu
</pre>';
        case version_compare($currentVersion, '2.0.3', '<'):
            $new_directory = $home_directory . 'images/menu/';
            if (!is_dir($new_directory)) {
                $status = mkdir($new_directory);
                if (!$status) {
                    $content[] = "Could not create directory {$new_directory}.";
                    return false;
                }
            }
            $db = \Database::newDB();
            $tbl = $db->addTable('menus');
            $dt = $tbl->addDataType('assoc_image', 'varchar');
            $dt->setIsNull(true);
            $dt->add();
            $content[] = "<pre>2.0.3 changes\n----------------\n+ Created {$new_directory}\n+ Can associate image to a menu\n</pre>";
        case version_compare($currentVersion, '2.0.4', '<'):
            $content[] = "<pre>2.0.4 changes\n----------------\n+ Fixed home icon set as active when menu associated page is chosen.\n</pre>";
        case version_compare($currentVersion, '2.0.5', '<'):
            $content[] = "<pre>2.0.5 changes\n----------------\n+ Reset menu button now sorts all links as well\n+ Menu images not loaded if tablet width or below\n</pre>";
        case version_compare($currentVersion, '2.1.0', '<'):
            $content[] = <<<EOF
<pre>2.1.0 changes
-----------------
+ Created settings icon for display type and character limit.
+ If PageSmith creates a menu link, an access shortcut will be used if it exists.
+ Removed old icons.
+ Menu assoc_url will pull shortcut if it exists for page.
+ Added button to shortcut all links.
+ Menu can copy carousel images.
+ Added ability for menu links to have external and pdf icons.
+ Fixed: local links changes into bad http urls.
+ Fixed: Menu images will work on classic menus.
+ Fixed: Theme template style sheets not working.
+ Fixed: isDummy check was not set for home page.
+ Added Bootstrap icons
+ Fixed: Menu link no getting saved if PageSmith pages are not available.
+ Fixed: Home link highlighted with other links.
+ Fixed: Drop down options not working in MiniAdmin
</pre>           
EOF;
    }
    return true;
}