本文整理汇总了PHP中PHPWS_DB::addTableColumn方法的典型用法代码示例。如果您正苦于以下问题:PHP PHPWS_DB::addTableColumn方法的具体用法?PHP PHPWS_DB::addTableColumn怎么用?PHP PHPWS_DB::addTableColumn使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PHPWS_DB
的用法示例。
在下文中一共展示了PHPWS_DB::addTableColumn方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: registerPermissions
public static function registerPermissions($module, &$content)
{
$tableName = Users_Permission::getPermissionTableName($module);
if (!PHPWS_DB::isTable($tableName)) {
return Users_Permission::createPermissions($module);
}
$file = sprintf('%smod/%s/boost/permission.php', PHPWS_SOURCE_DIR, $module);
if (!is_file($file)) {
return NULL;
}
include_once $file;
if (!isset($permissions) || !is_array($permissions)) {
return TRUE;
}
$db = new PHPWS_DB($tableName);
$columns = $db->getTableColumns();
$columnSetting = 'smallint NOT NULL default \'0\'';
foreach ($permissions as $perm_name => $perm_proper) {
if (in_array($perm_name, $columns)) {
continue;
}
$result = $db->addTableColumn($perm_name, $columnSetting);
if (PHPWS_Error::isError($result)) {
$content[] = sprintf(dgettext('users', 'Could not create "%s" permission column.'), $perm_name);
PHPWS_Error::log($result);
} else {
$content[] = sprintf(dgettext('users', '"%s" permission column created.'), $perm_name);
}
}
return TRUE;
}
示例2: checkin_update
/**
* @version $Id$
* @author Matthew McNaney <mcnaney at gmail dot com>
*/
function checkin_update(&$content, $current_version)
{
switch (1) {
case version_compare($current_version, '1.0.1', '<'):
$content[] = '<pre>';
$db = new PHPWS_DB('checkin_staff');
if (PHPWS_Error::logIfError($db->addTableColumn('view_order', 'smallint not null default 0'))) {
$content[] = 'Unable to create checkin_staff.view_order column.</pre>';
return false;
} else {
$content[] = 'Created checkin_staff.view_order column.';
}
$db->addColumn('id');
$staff_list = $db->select('col');
if (!empty($staff_list)) {
$count = 1;
foreach ($staff_list as $staff_id) {
$db->reset();
$db->addWhere('id', $staff_id);
$db->addValue('view_order', $count);
PHPWS_Error::logIfError($db->update());
$count++;
}
}
checkinUpdateFiles(array('templates/visitors.tpl', 'templates/waiting.tpl', 'templates/queue.tpl', 'templates/settings.tpl'), $content);
$content[] = '1.0.1 changes
------------------
+ Fixed bug with pulling current staff member
+ Added refresh link to waiting and assignment page
+ Fixed report
</pre>';
case version_compare($current_version, '1.0.2', '<'):
$content[] = '<pre>';
checkinUpdateFiles(array('templates/visitors.tpl', 'templates/waiting.tpl', 'templates/style.css'), $content);
$content[] = '1.0.2 changes
--------------------
+ Fixed translation typo.
+ Added "Send back" condition</pre>';
case version_compare($current_version, '1.0.3', '<'):
$content[] = '<pre>';
checkinUpdateFiles(array('templates/report.tpl'), $content);
$content[] = '1.0.3 changes
--------------------
+ Removed error message from report if no reasons created
+ Added the time of arrival to the report
+ Changed report date entry interface
+ Upper cased names.
</pre>';
case version_compare($current_version, '1.0.4', '<'):
$content[] = '<pre>1.0.4 changes
---------------------
+ Fixed waiting time setting</pre>';
case version_compare($current_version, '1.1.0', '<'):
$content[] = '<pre>1.1.0 changes
---------------------
+ Added code to prevent refreshed duplicates
+ Fixed possible error in admin view
+ Added monthly and student reports
+ Added report for number of times a visitor has visited within 30 days.
+ PHP 5 Strict changes</pre>';
case version_compare($current_version, '1.1.1', '<'):
$content[] = '<pre>1.1.1 changes
---------------------
+ Reports limited to admins</pre>';
case version_compare($current_version, '1.2', '<'):
$db = new PHPWS_DB('checkin_staff');
$db->addTableColumn('active', 'smallint not null default 1');
$content[] = '<pre>1.2 changes
--------------
+ Fixed blue button on admin menu
+ Staff can now be deactivated so they appear on reports but do not receive visitors</pre>';
case version_compare($current_version, '1.3', '<'):
$db = new PHPWS_DB('checkin_visitor');
$db->addTableColumn('email', 'varchar(255) NULL');
$content[] = '<pre>1.3 changes
---------------
+ Option to collect visitor email addresses.</pre>';
case version_compare($current_version, '1.4.0', '<'):
$content[] = '<pre>1.4.0 changes
---------------
+ May now report by visitor name.</pre>';
case version_compare($current_version, '1.5.0', '<'):
$content[] = '<pre>';
// Make changes to checkin_visitor table
$db = new PHPWS_DB('checkin_visitor');
if (PHPWS_Error::logIfError($db->addTableColumn('gender', 'varchar(20) default NULL'))) {
$content[] = 'Unable to create checkin_visitor.gender column.</pre>';
return false;
} else {
$content[] = 'Created checkin_visitor.gender column.';
}
if (PHPWS_Error::logIfError($db->addTableColumn('birthdate', 'varchar(20) default NULL'))) {
$content[] = 'Unable to create checkin_visitor.birthdate column.</pre>';
return false;
} else {
$content[] = 'Created checkin_visitor.birthdate column.';
//.........这里部分代码省略.........
示例3: calendar_update
/**
* @author Matthew McNaney <mcnaney at gmail dot com>
* @version $Id$
*/
function calendar_update(&$content, $version)
{
switch ($version) {
case version_compare($version, '1.2.2', '<'):
$content[] = 'This package will not update any versions prior to 1.2.2.';
return false;
case version_compare($version, '1.3.0', '<'):
$result = PHPWS_DB::importFile(PHPWS_SOURCE_DIR . 'mod/calendar/boost/sql_update_130.sql');
if (PHPWS_Error::isError($result)) {
PHPWS_Error::log($result);
$content[] = '+ Unable to import new suggestion table.';
return false;
} else {
$files = array('templates/admin/forms/edit_event.tpl', 'templates/view/day.tpl', 'templates/view/week.tpl', 'templates/view/month/grid.tpl', 'templates/view/month/list.tpl', 'templates/style.css', 'templates/user_main.tpl', 'templates/admin/approval.tpl', 'conf/config.php');
if (PHPWS_Boost::updateFiles($files, 'calendar')) {
$content[] = '+ Template files updated successfully.';
} else {
$content[] = '+ Unable to copy template files locally.';
$content[] = '<pre>' . implode("\n", $files) . '</pre>';
}
$content[] = '+ Suggestion table import successful';
$content[] = '<pre>
1.3.0 Changes
-------------
+ Added ability to for anonymous users to make event suggestions.
+ Fixed some issues with javascript disabled users unable to make events.
+ First public schedule is made the default on creation.
</pre>';
}
case version_compare($version, '1.4.0', '<'):
$content[] = "<pre>1.4.0 Changes\n-------------";
$files = array('templates/admin/settings.tpl', 'conf/config.php');
if (PHPWS_Boost::updateFiles($files, 'calendar')) {
$content[] = '+ Successfully copied these files locally:';
} else {
$content[] = '+ Could not copy these files locally:';
}
$content[] = ' ' . implode("\n ", $files);
$content[] = '+ Bug #1648965. Clicking Day or Week from grid view pulls correct day
+ Changed "Today" link to view appropiate description to prevent
confusion
+ Changed time defaults to %p to work with more installs
+ If start date is greater than end date, the event will be saved to
the save day.
+ Bug #1648963. Fixed mini month not showing days with events.
+ Made event count linkable in grid view
+ Labeled some permissions "unrestricted only"
+ Added permissions checks for editing and deleting
+ Created checkPermissions function in schedule class to simplify code
+ Removed commented legacy code from Schedule.php
+ Added missing suggestion tables to install and uninstall
+ Fixed caching logic
+ Fixed default schedule loading in Calendar class
+ Fixed inability to create more than one schedule
+ Added option to disable month view caching
+ Caching now works on public calendars only.
+ Added translate functions.
+ Updated message translation files.</pre>';
case version_compare($version, '1.4.1', '<'):
$content[] = "<pre>1.4.1 Changes\n-------------";
$files = array('templates/admin/forms/edit_event.tpl', 'javascript/check_date/head.js');
if (PHPWS_Boost::updateFiles($files, 'calendar')) {
$content[] = '+ Successfully updated the following files:';
} else {
$content[] = '+ Unable to update the following files:';
}
$content[] = ' ' . implode("\n ", $files);
$content[] = '+ Made noon the default time for new events.
+ Fixed Daylight Saving Time breaking repeats.
+ Delete event links made secure.
+ Days made linkable in month list view.
+ Added a sync dates button on the edit event form.';
case version_compare($version, '1.5.0', '<'):
$db = new PHPWS_DB('calendar_schedule');
$result = $db->addTableColumn('show_upcoming', 'SMALLINT NOT NULL DEFAULT 0');
if (PHPWS_Error::logIfError($result)) {
$content[] = '--- Could not create show_upcoming column in calendar_schedule table.';
return false;
}
$content[] = '<pre>';
$files = array('img/calendar.png', 'conf/config.php', 'templates/admin/forms/edit_schedule.tpl', 'templates/style.css', 'templates/view/upcoming.tpl');
if (PHPWS_Boost::updateFiles($files, 'calendar')) {
$content[] = '-- Successfully updated the following files:';
} else {
$content[] = '-- Unable to update the following files:';
}
$content[] = ' ' . implode("\n ", $files);
$content[] = '
1.5.0 Changes
---------------------
+ Can now choose to show upcoming events.
+ Removed schedule created message when using javascript popup
+ Moved getEvents function in the Schedule class
+ Increase calendar event form\'s popup height
+ Reformated schedule form
+ Bug # 1699659 - Calendar will not show "Add Event" link if a
//.........这里部分代码省略.........
示例4: blog_update
/**
* @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>';
//.........这里部分代码省略.........
示例5: properties_update
function properties_update(&$content, $currentVersion)
{
switch ($currentVersion) {
case version_compare($currentVersion, '1.1.0', '<'):
$db = new PHPWS_DB('properties');
$result = $db->addTableColumn('efficiency', 'smallint not null default 0');
if (PHPWS_Error::isError($result)) {
PHPWS_Error::log($result);
$content[] = 'ERROR - could not add efficiency column';
return false;
}
$content[] = '<pre>1.1.0 updates
---------------
+ Added efficiency option</pre>';
case version_compare($currentVersion, '1.1.1', '<'):
$db = new PHPWS_DB('prop_contacts');
$result = $db->addTableColumn('company_url', 'VARCHAR( 255 ) NULL');
if (PHPWS_Error::isError($result)) {
PHPWS_Error::log($result);
$content[] = 'ERROR - could not add company_url column';
return false;
}
$content[] = '<pre>1.1.1 updates
---------------
+ Added company url
+ Property listing divided into tabs.</pre>';
case version_compare($currentVersion, '1.2.0', '<'):
$db = new PHPWS_DB('properties');
$db->addWhere('pets_allowed', 1);
$db->addColumn('id');
$db->addColumn('pet_type');
$db->setIndexBy('id');
$cols = $db->select('col');
if (!empty($cols)) {
foreach ($cols as $id => $pets) {
if (empty($pets)) {
continue;
}
$db->reset();
$pets_array = null;
$pets_array = @unserialize($pets);
if (!is_array($pets_array)) {
continue;
} else {
$pets = implode(', ', $pets_array);
}
$db->addWhere('id', $id);
$db->addValue('pet_type', $pets);
$db->update();
}
}
$db->reset();
$result = $db->addTableColumn('pet_fee', 'int not null default 0');
if (PHPWS_Error::isError($result)) {
PHPWS_Error::log($result);
$content[] = 'ERROR - could not add pet_fee column';
return false;
}
$db->reset();
$result = $db->addTableColumn('airconditioning', 'smallint not null default 0');
if (PHPWS_Error::isError($result)) {
PHPWS_Error::log($result);
$content[] = 'ERROR - could not add airconditioning column';
return false;
}
$db->reset();
$result = $db->addTableColumn('heat_type', 'varchar(255) default null');
if (PHPWS_Error::isError($result)) {
PHPWS_Error::log($result);
$content[] = 'ERROR - could not add heat_type column';
return false;
}
case version_compare($currentVersion, '1.2.1', '<'):
$content[] = '<pre>1.2.1 updates
---------------
- Improved look with Bootstrapping.</pre>';
case version_compare($currentVersion, '1.2.2', '<'):
$content[] = '<pre>1.2.2 updates
---------------
+ Added gas heat and fiber internet/tv.
</pre>';
case version_compare($currentVersion, '1.3.0', '<'):
$content[] = <<<EOF
<pre>1.3.0 updates
-----------------
+ Changed login box for IE users
+ Added ability to view properties by contact.
+ Contacts list compacted. Email links to contact name.
+ Fixed bad function call on error page.
+ Added error checks in case 1) the property does not exists or not active or
2) the image files are not present.
+ Test for incactive properties preventing error.
+ Added Bootstrap styling and overhauled to work on mobile devices.
+ Last logged defaults to creation date.
+ Fixed Shared Bedroom and Bathroom settings on roommates page.
+ Fixed active/inactive buttons.
</pre>
EOF;
case version_compare($currentVersion, '1.4.0', '<'):
if (!is_file(PHPWS_SOURCE_DIR . 'lib/vendor/autoload.php')) {
//.........这里部分代码省略.........
示例6: layout_update
//.........这里部分代码省略.........
$files = array('templates/arrange.tpl', 'conf/error.php', 'templates/move_box_select.tpl');
layoutUpdateFiles($files, $content);
if (!PHPWS_Boost::inBranch()) {
$content[] = file_get_contents(PHPWS_SOURCE_DIR . 'mod/layout/boost/changes/2_4_2.txt');
}
$content[] = '</pre>';
case version_compare($currentVersion, '2.4.3', '<'):
$content[] = '<pre>2.4.3 changes
-----------------
+ nakedDisplay now allows a choice whether to use the blank template
or not when it wraps. Default is to not.
+ Fixed noCache.
</pre>';
case version_compare($currentVersion, '2.4.4', '<'):
$content[] = '<pre>';
$db = new PHPWS_DB('layout_config');
if (PHPWS_Error::logIfError($db->dropTableColumn('userAllow'))) {
$content[] = '--- An error occurred when trying to drop the userAllow column from the layout_config table.';
} else {
$content[] = '--- Dropped the userAllow column from the layout_config table.';
}
layoutUpdateFiles(array('templates/user_form.tpl'), $content);
$content[] = '2.4.4 changes
-------------------
+ Dropped unused column from config table.
+ Added collapse function. Adds id="layout-collapse" to theme template
under the {COLLAPSE} tag.
+ Changed method of checking for javascript status. Less chance for
error.
+ Fixed notice.</pre>';
case version_compare($currentVersion, '2.4.5', '<'):
$content[] = '<pre>';
$db = new PHPWS_DB('layout_config');
if (PHPWS_Error::logIfError($db->addTableColumn('deity_reload', 'smallint not null default 0'))) {
$content[] = 'Could not create layout_config.deity_reload column.';
return false;
} else {
$content[] = 'Added layout_config.deity_reload column.';
}
layoutUpdateFiles(array('templates/metatags.tpl', 'conf/config.php'), $content);
$content[] = '2.4.5 changes
--------------------
+ Added option to use a Key\'s summary or title to fill in the meta
description.
+ Added new cacheHeader function to retain javascript and css
information should a module return cached content before the above
can be established.
+ Deities can now move a box to a theme locked area.
+ Added LAYOUT_IGNORE_JS_CHECK to force javascript use.
+ PHP 5 formatted';
case version_compare($currentVersion, '2.4.6', '<'):
$content[] = '<pre>2.4.6 changes
---------------------
+ Fix to cache headers
</pre>';
case version_compare($currentVersion, '2.4.7', '<'):
$content[] = '<pre>';
layoutUpdateFiles(array('templates/themes.tpl'), $content);
$content[] = '2.4.7 changes
---------------------
+ Added option to layout theme tab to disable or order module style
sheet inclusion.
+ Can enable box move from mini admin
</pre>';
case version_compare($currentVersion, '2.4.8', '<'):
$content[] = '<pre>2.4.8 changes
示例7: properties_update
function properties_update(&$content, $currentVersion)
{
switch ($currentVersion) {
case version_compare($currentVersion, '1.1.0', '<'):
$db = new PHPWS_DB('properties');
$result = $db->addTableColumn('efficiency', 'smallint not null default 0');
if (PHPWS_Error::isError($result)) {
PHPWS_Error::log($result);
$content[] = 'ERROR - could not add efficiency column';
return false;
}
$content[] = '<pre>1.1.0 updates
---------------
+ Added efficiency option</pre>';
case version_compare($currentVersion, '1.1.1', '<'):
$db = new PHPWS_DB('prop_contacts');
$result = $db->addTableColumn('company_url', 'VARCHAR( 255 ) NULL');
if (PHPWS_Error::isError($result)) {
PHPWS_Error::log($result);
$content[] = 'ERROR - could not add company_url column';
return false;
}
$content[] = '<pre>1.1.1 updates
---------------
+ Added company url
+ Property listing divided into tabs.</pre>';
case version_compare($currentVersion, '1.2.0', '<'):
$db = new PHPWS_DB('properties');
$db->addWhere('pets_allowed', 1);
$db->addColumn('id');
$db->addColumn('pet_type');
$db->setIndexBy('id');
$cols = $db->select('col');
if (!empty($cols)) {
foreach ($cols as $id => $pets) {
if (empty($pets)) {
continue;
}
$db->reset();
$pets_array = null;
$pets_array = @unserialize($pets);
if (!is_array($pets_array)) {
continue;
} else {
$pets = implode(', ', $pets_array);
}
$db->addWhere('id', $id);
$db->addValue('pet_type', $pets);
$db->update();
}
}
$db->reset();
$result = $db->addTableColumn('pet_fee', 'int not null default 0');
if (PHPWS_Error::isError($result)) {
PHPWS_Error::log($result);
$content[] = 'ERROR - could not add pet_fee column';
return false;
}
$db->reset();
$result = $db->addTableColumn('airconditioning', 'smallint not null default 0');
if (PHPWS_Error::isError($result)) {
PHPWS_Error::log($result);
$content[] = 'ERROR - could not add airconditioning column';
return false;
}
$db->reset();
$result = $db->addTableColumn('heat_type', 'varchar(255) default null');
if (PHPWS_Error::isError($result)) {
PHPWS_Error::log($result);
$content[] = 'ERROR - could not add heat_type column';
return false;
}
case version_compare($currentVersion, '1.2.1', '<'):
$content[] = '<pre>1.2.1 updates
---------------
- Improved look with Bootstrapping.</pre>';
case version_compare($currentVersion, '1.2.2', '<'):
$content[] = '<pre>1.2.2 updates
---------------
+ Added gas heat and fiber internet/tv.
</pre>';
case version_compare($currentVersion, '1.3.0', '<'):
$content[] = <<<EOF
<pre>1.3.0 updates
-----------------
+ Changed login box for IE users
+ Added ability to view properties by contact.
+ Contacts list compacted. Email links to contact name.
+ Fixed bad function call on error page.
+ Added error checks in case 1) the property does not exists or not active or
2) the image files are not present.
+ Test for incactive properties preventing error.
+ Added Bootstrap styling and overhauled to work on mobile devices.
+ Last logged defaults to creation date.
+ Fixed Shared Bedroom and Bathroom settings on roommates page.
+ Fixed active/inactive buttons.
</pre>
EOF;
}
return true;
//.........这里部分代码省略.........
示例8: filecabinet_update
/**
* @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.
//.........这里部分代码省略.........
示例9: pagesmith_update
/**
* @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
-------------
//.........这里部分代码省略.........
示例10: signup_update
/**
* @version $Id$
* @author Matthew McNaney <mcnaney at gmail dot com>
*/
function signup_update(&$content, $currentVersion)
{
switch ($currentVersion) {
case version_compare($currentVersion, '1.0.1', '<'):
$content[] = '<pre>';
$files = array('templates/slot_setup.tpl');
signupUpdateFiles($files, $content);
$content[] = '1.0.1 changes
----------------
+ Added ability to reset slot order should it come unraveled.
+ Fixed reroute link that was hard coded to go to sheet id 1.</pre>';
case version_compare($currentVersion, '1.0.2', '<'):
$content[] = '<pre>1.0.2 changes
----------------
+ Changed email to send individually.
+ Fixed: "All slots full" message was not displaying.</pre>';
case version_compare($currentVersion, '1.1.0', '<'):
$content[] = '<pre>';
PHPWS_Boost::registerMyModule('signup', 'users', $content);
$db = new PHPWS_DB('signup_sheet');
if (PHPWS_Error::logIfError($db->addTableColumn('contact_email', 'varchar(255) default NULL'))) {
$content[] = '--- Failed creating new column on signup_sheet.</pre>';
return false;
} else {
$content[] = '--- contact_email column created successfully on signup_sheet table.';
}
if (PHPWS_Error::logIfError($db->addTableColumn('multiple', 'smallint NOT NULL default 0'))) {
$content[] = '--- Failed creating new column on signup_sheet.</pre>';
return false;
} else {
$content[] = '--- "multiple" column created successfully on signup_sheet table.';
}
$files = array('templates/peep_pop.tpl', 'templates/slot_setup.tpl', 'templates/edit_sheet.tpl', 'templates/peeps.tpl', 'templates/slot_setup.tpl', 'img/edit.png', 'img/delete.png');
signupUpdateFiles($files, $content);
$content[] = '1.1.0 changes
----------------
+ Added way to update slots
+ Added user permissions to signup
+ Removed some unneeded, commented code
+ Added alphabetic reordering
+ Fixed ordering up and downs.
+ Changed slot form to selection method. Previously showed all slots
causing long page loads on big signups.
+ Added contact email address for sheets.
+ Added url forwarding support.
+ Sheets can be set to allow multiple signups.
</pre>';
case version_compare($currentVersion, '1.1.1', '<'):
$content[] = '<pre>';
signupUpdateFiles(array('templates/sheet_list.tpl', 'templates/slot_setup.tpl'), $content);
$content[] = '1.1.1 changes
-------------------
+ Restricted users cannot create signup sheets.
+ Added search textfield to slot screen.
+ Added missing navigation links to sheet listing.</pre>';
case version_compare($currentVersion, '1.1.2', '<'):
$content[] = '<pre>';
$db = new PHPWS_DB('signup_sheet');
if (PHPWS_Error::logIfError($db->addTableColumn('contact_email', 'varchar(255) default NULL'))) {
$content[] = '--- Failed creating new column on signup_sheet.</pre>';
return false;
} else {
$content[] = '--- contact_email column created successfully on signup_sheet table.';
}
if (PHPWS_Error::logIfError($db->addTableColumn('multiple', 'smallint NOT NULL default 0'))) {
$content[] = '--- Failed creating new column on signup_sheet.</pre>';
return false;
} else {
$content[] = '--- "multiple" column created successfully on signup_sheet table.';
}
$content[] = '1.1.2 changes
-------------------
+ Install sql was missing new columns in signup_sheet table.
+ Removed the phone number parsing. Got in the way of extensions and
the like.
</pre>';
case version_compare($currentVersion, '1.2.0', '<'):
$content[] = '<pre>1.2.0 changes
----------------
+ Fixed: signup errors reseting slot pick
+ Removed redundant error message
+ previous register fix would not list empty slots.
+ Removed string length on phone number
+ Only pulling registered users for slots open.
+ PHP 5 formatted.
</pre>';
case version_compare($currentVersion, '1.2.1', '<'):
$content[] = '<pre>1.2.1 changes
----------------
+ Removed reference symbols
+ Added dngettext for "openings(s)" translation
+ Rewrote getAllSlots. The slots filled number wasn\'t joining
properly.
+ Fixed sheet view link.</pre>';
case version_compare($currentVersion, '1.2.2', '<'):
$content[] = '<pre>1.2.2 changes
//.........这里部分代码省略.........
示例11: users_update
//.........这里部分代码省略.........
$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
-----------------------
示例12: block_update
/**
* @author Matthew McNaney <mcnaney at gmail dot com>
* @version $Id$
*/
function block_update(&$content, $currentVersion)
{
switch ($currentVersion) {
case version_compare($currentVersion, '1.1.1', '<'):
$content[] = '<pre>Block versions prior to 1.1.1 are not supported for updating.
Please download version 1.1.2.</pre>';
break;
case version_compare($currentVersion, '1.1.2', '<'):
PHPWS_Boost::updateFiles(array('img/block.png'), 'block');
$content[] = '<pre>1.1.2 changes
-------------
+ Added German files
+ Use new translation format
+ Changed control panel icon
</pre>';
case version_compare($currentVersion, '1.1.3', '<'):
$content[] = '<pre>';
if (PHPWS_Boost::updateFiles(array('templates/sample.tpl'), 'block')) {
$content[] = '--- Successfully copied templates/sample.tpl';
} else {
$content[] = '--- Unable to copy templates/sample.tpl';
}
$content[] = '
1.1.3 changes
-------------
+ Changed the sample.tpl layout to conform with other "box" templates.
</pre>';
case version_compare($currentVersion, '1.2.0', '<'):
$content[] = '<pre>';
$db = new PHPWS_DB('block');
if (PHPWS_Error::logIfError($db->addTableColumn('file_id', 'int not null default 0'))) {
$content[] = 'Unable to add file_id column to block table.</pre>';
return false;
}
if (PHPWS_Error::logIfError($db->addTableColumn('hide_title', 'smallint not null default 0'))) {
$content[] = 'Unable to add file_only column to block table.</pre>';
return false;
}
if (PHPWS_Boost::updateFiles(array('conf/config.php', 'templates/edit.tpl', 'templates/sample.tpl'), 'block')) {
$content[] = '--- Successfully updated files.';
} else {
$content[] = '--- Unable to update files. Please run revert in Boost.';
}
$content[] = '1.2.0 changes
-----------------
+ Blocks can now contain File Cabinet elements.</pre>';
case version_compare($currentVersion, '1.3.0', '<'):
if (PHPWS_Boost::updateFiles(array('templates/list.tpl', 'templates/sample.tpl'), 'block')) {
$content[] = '--- Successfully copied templates/list.tpl';
} else {
$content[] = '--- Unable to copy templates/list.tpl';
}
$content[] = '<pre>1.3.0 changes
-----------------
+ PHP 5 updated
+ Wrapped block-file class around file display.
+ Changed pager view to use addSortHeaders</pre>';
case version_compare($currentVersion, '1.3.1', '<'):
if (PHPWS_Boost::updateFiles(array('templates/settings.tpl'), 'block')) {
$content[] = '--- Successfully copied templates/settings.tpl';
} else {
$content[] = '--- Unable to copy templates/settings.tpl';
}
$content[] = '<pre>1.3.1 changes
-----------------
+ RFE #2236544 - Image size limits set in settings tab instead of in
config file.
</pre>';
case version_compare($currentVersion, '1.3.2', '<'):
$content[] = '<pre>1.3.2 changes
-------------
+ Removed isPosted check on block save.
</pre>';
case version_compare($currentVersion, '1.3.3', '<'):
$content[] = '<pre>1.3.3 changes
-------------
+ PHP 5 strict changes.
+ Using Icon class.
+ Id added to each block.
</pre>';
case version_compare($currentVersion, '1.3.4', '<'):
$content[] = '<pre>1.3.4 changes
--------------
+ Removed exit call.
</pre>';
case version_compare($currentVersion, '1.3.5', '<'):
$content[] = '<pre>1.3.5 changes
--------------
+ Put in sanity checks preventing blank blocks.
+ Removed New tab, added New block button to List view.
+ Empty block titles now get a deactivated title based on the content.
</pre>';
case version_compare($currentVersion, '1.3.6', '<'):
moveBlockImages();
$content[] = '<pre>1.3.6 changes
---------------
//.........这里部分代码省略.........
示例13: analytics_update
/**
* Description
* @author Jeff Tickle <jtickle at tux dot appstate dot edu>
*/
function analytics_update(&$content, $currentVersion)
{
switch ($currentVersion) {
case version_compare($currentVersion, '1.0.1', '<'):
$db = new PHPWS_DB('analytics_tracker');
$result = $db->addTableColumn('disable_if_logged', 'int NOT NULL default 0');
if (PHPWS_Error::logIfError($result)) {
$content[] = 'Unable to add disable_if_logged column to analytics_tracker table.';
return false;
}
$files = array('templates/edit.tpl');
if (PHPWS_Boost::updateFiles($files, 'analytics')) {
$content[] = '--- Updated templates/edit.tpl';
}
case version_compare($currentVersion, '1.1.0', '<'):
// install.sql has been wrong for awhile, this should fix any discrepancies
$db = new PHPWS_DB('analytics_tracker');
if (!$db->isTableColumn('disable_if_logged')) {
$result = $db->addTableColumn('disable_if_logged', 'int NOT NULL default 0');
if (PHPWS_Error::logIfError($result)) {
$content[] = 'Unable to add disable_if_logged column to analytics_tracker table.';
return false;
}
$content[] = '--- Added disable_if_logged option to database';
}
// Load new schema
$db = new PHPWS_DB();
$result = $db->importFile(PHPWS_SOURCE_DIR . 'mod/analytics/boost/update/1.1.0.sql');
if (PHPWS_Error::logIfError($result)) {
$content[] = 'Unable to import updated schema for version 1.1.0.';
return false;
}
$content[] = '--- Updated Analytics schema to 1.1.0';
// Move Google Analytics data to its own table
$db = new PHPWS_DB('analytics_tracker');
$db->addColumn('id');
$db->addColumn('account');
$db->addWhere('type', 'GoogleAnalyticsTracker');
$result = $db->select();
if (PHPWS_Error::logIfError($result)) {
$content[] = 'Unable to select Google Analytics tracker from analytics_tracker table.';
return false;
}
foreach ($result as $row) {
$db = new PHPWS_DB('analytics_tracker_google');
$db->addValue('id', $row['id']);
// Adding UA- into the account identifier to reduce confusion
$db->addValue('account', 'UA-' . $row['account']);
$db->insert(false);
$content[] = "--- Migrated Google Analytics configuration for account UA-{$row['account']}";
}
$db = new PHPWS_DB('analytics_tracker');
$result = $db->dropTableColumn('account');
if (PHPWS_Error::logIfError($result)) {
$content[] = 'Unable to remove account column from analytics_tracker table.';
return false;
}
$content[] = '--- Completed migration to Analytics 1.1.0 schema';
case version_compare($currentVersion, '1.1.1', '<'):
$content[] = <<<EOF
<pre>Version 1.1.1
-------------------
+ Piwik fix.
+ Fixed uninstall script
</pre>
EOF;
}
return true;
}
示例14: menu_update
//.........这里部分代码省略.........
$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>