예제 #1
0
/**
 * @version $Id$
 * @author Matthew McNaney <mcnaney at gmail dot com>
 */
function filecabinet_install(&$content)
{
    $home_dir = PHPWS_Boost::getHomeDir();
    $mm_dir = $home_dir . 'files/multimedia/';
    if (!is_dir($mm_dir)) {
        if (!@mkdir($mm_dir)) {
            $content[] = dgettext('filecabinet', 'Failed to create files/multimedia directory.');
            return false;
        } else {
            $content[] = dgettext('filecabinet', 'files/multimedia directory created successfully.');
        }
    }
    $files_dir = $home_dir . 'files/filecabinet/';
    if (!is_dir($files_dir)) {
        if (!@mkdir($files_dir)) {
            $content[] = dgettext('filecabinet', 'Failed to create files/filecabinet/ directory.');
            return false;
        } else {
            $content[] = dgettext('filecabinet', 'files/filecabinet/ directory created successfully.');
        }
    }
    $classify_dir = $home_dir . 'files/filecabinet/incoming/';
    if (!is_dir($classify_dir)) {
        if (!@mkdir($classify_dir)) {
            $content[] = dgettext('filecabinet', 'Failed to create files/filecabinet/incoming directory.');
            return false;
        } else {
            $content[] = dgettext('filecabinet', 'files/filecabinet/incoming directory created successfully.');
        }
    }
    return true;
}
예제 #2
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;
}
예제 #3
0
 /**
  * Copy of the setup function of the same name
  * This one also checks the write and read capabilities of
  * the log files.
  */
 public static function checkDirectories(&$content, $home_dir = null, $check_branch = true)
 {
     $errorDir = true;
     if (empty($home_dir)) {
         $home_dir = PHPWS_Boost::getHomeDir();
     }
     $directory[] = $home_dir . 'images/';
     $directory[] = $home_dir . 'files/';
     $directory[] = LOG_DIRECTORY;
     foreach ($directory as $id => $check) {
         if (!is_dir($check)) {
             $dirExist[] = $check;
         } elseif (!is_writable($check)) {
             $writableDir[] = $check;
         }
     }
     if (isset($dirExist)) {
         $content[] = dgettext('boost', 'The following directories need to be created:');
         $content[] = implode("\n", $dirExist);
         $errorDir = false;
     }
     if (isset($writableDir)) {
         $content[] = dgettext('boost', 'The following directories are not writable:');
         $content[] = implode(chr(10), $writableDir);
         $errorDir = false;
     }
     $files = array('boost.log', 'error.log');
     foreach ($files as $log_name) {
         if (is_file('logs/' . $log_name) && (!is_readable('logs/' . $log_name) || !is_writable('logs/' . $log_name))) {
             $content[] = sprintf(dgettext('boost', 'Your logs/%s file must be readable and writable.'), $log_name);
             $errorDir = false;
         }
     }
     if (!isset($GLOBALS['Boost_Ready'])) {
         $GLOBALS['Boost_Ready'] = $errorDir;
     }
     if (!$errorDir) {
         $GLOBALS['Boost_Current_Directory'] = false;
     }
     if ($check_branch && !PHPWS_Core::isBranch() && PHPWS_Core::moduleExists('branch')) {
         $db = new PHPWS_DB('branch_sites');
         $db->addColumn('branch_name');
         $db->addColumn('directory');
         $result = $db->select();
         if (!empty($result)) {
             if (PHPWS_Error::logIfError($result)) {
                 $content[] = dgettext('boost', 'An error occurred when tryingt to access your branch site listing.');
                 $content[] = dgettext('boost', 'Branches could not be checked.');
                 return $errorDir;
             }
             foreach ($result as $branch) {
                 $contentTmp = array();
                 if (!PHPWS_Boost::checkDirectories($contentTmp, $branch['directory'], false)) {
                     $content[] = sprintf(dgettext('boost', 'Checking branch "%s"'), $branch['branch_name']);
                     foreach ($contentTmp as $tmp) {
                         $content[] = $tmp;
                     }
                     $content[] = '';
                     $errorDir = false;
                 }
             }
         }
     }
     return $errorDir;
 }
예제 #4
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;
    }
}
예제 #5
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;
}
예제 #6
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;
}
예제 #7
0
/**
 * whatsnew - phpwebsite module
 *
 * See docs/AUTHORS and docs/COPYRIGHT for relevant info.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 *
 * @version $Id$
 * @author Verdon Vaillancourt <verdonv at gmail dot com>
 */
function whatsnew_update(&$content, $currentVersion)
{
    $home_dir = PHPWS_Boost::getHomeDir();
    switch ($currentVersion) {
        case version_compare($currentVersion, '0.1.0', '<'):
            $content[] = '<pre>';
            $files = array('templates/block.tpl');
            whatsnewUpdateFiles($files, $content);
            $content[] = '0.1.0 changes
----------------
+ Added caching to the whatsnew list

</pre>';
        case version_compare($currentVersion, '0.2.0', '<'):
            $content[] = '<pre>';
            $files = array('templates/edit_settings.tpl');
            whatsnewUpdateFiles($files, $content);
            $content[] = '0.2.0 changes
----------------
+ Added sidebox title to settings
+ Implimented text parsing to title and text settings
+ Added English language file

</pre>';
        case version_compare($currentVersion, '0.3.0', '<'):
            $content[] = '<pre>';
            $files = array('templates/edit_settings.tpl');
            whatsnewUpdateFiles($files, $content);
            $content[] = '0.3.0 changes
----------------
+ Added cache_reset to post_settings function (thanks Greg)
+ Added link and function to manually flush cache at will

</pre>';
        case version_compare($currentVersion, '1.0.0', '<'):
            $content[] = '<pre>';
            $files = array('templates/edit_settings.tpl', 'templates/block.tpl');
            whatsnewUpdateFiles($files, $content);
            $content[] = '1.0.0 changes
----------------
+ Added option to display item summaries (thanks obones)
+ Added option to display item update dates (thanks obones)
+ Bumped version to 1.0.0 as mod is being added to core distro
  and it feels at that stage.
+ Moved Read Me information to the README file in docs/

</pre>';
        case version_compare($currentVersion, '1.0.2', '<'):
            $content[] = '<pre>';
            $files = array('templates/edit_settings.tpl', 'templates/block.tpl');
            whatsnewUpdateFiles($files, $content);
            $content[] = '1.0.2 changes
----------------
+ Added option to display item source modules (thanks obones)

</pre>';
        case version_compare($currentVersion, '1.0.3', '<'):
            $content[] = '<pre>';
            $content[] = '1.0.3 changes
----------------
+ Updated for phpws Core 2.0.0
+ PHP strict fixes
+ Some code tidy up

</pre>';
    }
    // end switch
    return true;
}
예제 #8
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;
}