From: Eloi G. <ada...@us...> - 2004-08-21 17:02:49
|
Update of /cvsroot/phpwebsite-comm/modules/article/boost In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29156/boost Modified Files: install.sql uninstall.php update.php Log Message: 2.5 Release Files Index: install.sql =================================================================== RCS file: /cvsroot/phpwebsite-comm/modules/article/boost/install.sql,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** install.sql 19 Feb 2004 21:46:37 -0000 1.7 --- install.sql 21 Aug 2004 17:02:05 -0000 1.8 *************** *** 8,11 **** --- 8,12 ---- created_id int NOT NULL DEFAULT '0', updated_username varchar(20) NOT NULL, + updated_id int NOT NULL DEFAULT '0', created_date datetime NOT NULL, updated_date datetime NOT NULL, *************** *** 33,38 **** ); ! INSERT INTO mod_article VALUES ('Article Manager Demo Article', 'a:1:{i:0;i:1;}', 1, 50, 'eloi', 'eloi', '2002-12-05 13:51:40', '2002-12-05 15:29:24', '', 0, 0, 16, '2007-12-05 00:00:00', '2002-12-05 00:00:00', 54, 1, 'Blank', 0, 0, 1, 0, 1); ! INSERT INTO mod_article VALUES ('Introduction to Article Manager', 'a:11:{i:0;i:2;i:1;i:3;i:2;i:4;i:3;i:6;i:4;i:7;i:5;i:5;i:6;i:8;i:7;i:9;i:8;i:10;i:9;i:11;i:10;i:12;}', 0, 50, 'eloi', 'eloi', '2002-12-05 15:14:06', '2003-03-25 23:19:36', 'The ArticleManager module lets you create dynamic web articles that display your site\'s content the way -you- want it to be displayed!', 0, 0, 57, '2007-12-05 00:00:00', '2002-12-05 00:00:00', 1661, 5, 'Blank', 0, 0, 1, 3, 1); --- 34,39 ---- ); ! INSERT INTO mod_article VALUES ('Article Manager Demo Article', 'a:1:{i:0;i:1;}', 1, 50, 'eloi', 1, 'eloi', '2002-12-05 13:51:40', '2002-12-05 15:29:24', '', 0, 0, 16, '2007-12-05 00:00:00', '2002-12-05 00:00:00', 54, 1, 'Blank', 0, 0, 1, 0, 1); ! INSERT INTO mod_article VALUES ('Introduction to Article Manager', 'a:11:{i:0;i:2;i:1;i:3;i:2;i:4;i:3;i:6;i:4;i:7;i:5;i:5;i:6;i:8;i:7;i:9;i:8;i:10;i:9;i:11;i:10;i:12;}', 0, 50, 'eloi', 1, 'eloi', '2002-12-05 15:14:06', '2003-03-25 23:19:36', 'The ArticleManager module lets you create dynamic web articles that display your site\'s content the way -you- want it to be displayed!', 0, 0, 57, '2007-12-05 00:00:00', '2002-12-05 00:00:00', 1661, 5, 'Blank', 0, 0, 1, 3, 1); *************** *** 57,61 **** INSERT INTO mod_article_sections VALUES ('Article Manager Demo Section', 'Welcome to Article Manager!\r\n\r\nThis article was automatically generated when you installed Article Manager.\r\n\r\nIf you want to see an overview of the features of this module, check out "<a href="index.php?module=article&view=2">Introduction to Article Manager</a>".\r\n\r\nTo get started using Article Manager, proceed to the <a href="index.php?module=article&disp=main_menu">administrative menu</a> or go the the <a href="index.php?module=article&disp=news">"News"</a> page that lists all articles on your site.\r\n\r\nAnd most importantly, have fun with it!\r\n<strong><font color="#FF0000">eloi</font></strong>', '', '', 0, 0, '', '', '', 'Centered_Image', 0, 1); ! INSERT INTO mod_article_sections VALUES ('Features', '<b>NOTE:</b> <i>This introduction is for demo purposes only and is current as of the first release of Article Manager. For the most up-to-date version, look under the docs directory.</i>\r\n\r\nCustom articles - each section can look completely different\r\nDefine your own article and section templates\r\nAdmins can allow/deny ability to display external pages in an embedded frame\r\nUsers can add comments to your article\r\nUsers can view a list of the articles that they have created\r\nArticles keep track of how many times they\'ve been viewed\r\nArticles can be set to start showing at a future date\r\nArticles can expire on specified dates\r\nArticles can be viewed in summary format with a link to the full article\r\nMULTI-ARTICLE STORIES with automatic navigation controls!\r\nOptimization: Images are stored in multiple directories for faster access\r\nA library of approved images can be easily maintained\r\nImages can be clickable links with alternate text and photo captions\r\nExpired articles can be accessed from a list and re-activated\r\nModule settings are easily changeable\r\nUser-submitted articles can require approval before activation\r\n"Also on this site.." Block\r\n"Previous n Articles" Block\r\n"Most Popular Articles" Block\r\nArticles can be set to not show up in the homepage summary listings\r\nArticles can be assigned to topic categories\r\nArticles can be viewed only by certain groups\r\nAll of your old Announcements & PageMaster Module content can be imported\r\nAutomatic rerouting of old mod.php, Announcements & PageMaster links\r\nDisplay a printable version\r\nNothing is saved to disk until you hit "Save Page"\r\n"Edit Locking" - Only 1 user can edit a page at a time\r\nA "News" page that displays all articles', '', '', 0, 0, '', '', '', 'Centered_Image', 0, 5); INSERT INTO mod_article_sections VALUES ('The Main Menu', 'The main menu is the nerve center of the entire module. It allows you to do four basic tasks -- list articles, create a new article, change Article Manager configuration settings and manage the Image Library.', '', '', 0, 0, '', '', '', 'Centered_Image', 1, 3); INSERT INTO mod_article_sections VALUES ('List Articles:', 'Here you can choose to view all approved articles on the site or just your articles ordered by Title or by the date of creation, publication, expiration, or the last update. This list can be viewed in ascending or descending order.\r\n\r\nEach article in the listing is accompanied by buttons allowing you to set it as the homepage, edit it, delete it, or immediately publish or expire it. Of course buttons or options can only be seen if you are authorized to use them.', '', '', 0, 0, '', '', '', 'Centered_Image', 0, 2); --- 58,62 ---- INSERT INTO mod_article_sections VALUES ('Article Manager Demo Section', 'Welcome to Article Manager!\r\n\r\nThis article was automatically generated when you installed Article Manager.\r\n\r\nIf you want to see an overview of the features of this module, check out "<a href="index.php?module=article&view=2">Introduction to Article Manager</a>".\r\n\r\nTo get started using Article Manager, proceed to the <a href="index.php?module=article&disp=main_menu">administrative menu</a> or go the the <a href="index.php?module=article&disp=news">"News"</a> page that lists all articles on your site.\r\n\r\nAnd most importantly, have fun with it!\r\n<strong><font color="#FF0000">eloi</font></strong>', '', '', 0, 0, '', '', '', 'Centered_Image', 0, 1); ! INSERT INTO mod_article_sections VALUES ('Features', '<b>NOTE:</b> <i>This introduction is for demo purposes only and is current as of the first release of Article Manager. For the most up-to-date version, look under the docs directory.</i>\r\n\r\nCustom articles - each section can look completely different\r\nDefine your own article and section templates\r\nAdmins can allow/deny ability to display external pages in an embedded frame\r\nUsers can add comments to your article\r\nUsers can view a list of the articles that they have created\r\nArticles keep track of how many times they\'ve been viewed\r\nArticles can be set to start showing at a future date\r\nArticles can expire on specified dates\r\nArticles can be viewed in summary format with a link to the full article\r\nMULTI-ARTICLE STORIES with automatic navigation controls!\r\nOptimization: Images are stored in multiple directories for faster access\r\nA library of approved images can be easily maintained\r\nImages can be clickable links with alternate text and photo captions\r\nExpired articles can be accessed from a list and re-activated\r\nModule settings are easily changeable\r\nUser-submitted articles can require approval before activation\r\n"Also on this site.." Block\r\n"Previous n Articles" Block\r\n"Most Popular Articles" Block\r\nArticles can be set to not show up in the homepage summary listings\r\nArticles can be assigned to topic categories\r\nAll of your old Announcements & PageMaster Module content can be imported\r\nAutomatic rerouting of old mod.php, Announcements & PageMaster links\r\nDisplay a printable version\r\nNothing is saved to disk until you hit "Save Page"\r\n"Edit Locking" - Only 1 user can edit a page at a time\r\nA "News" page that displays all articles\r\nAn "Archives" page that lists all articles created or updated on a certain day, month or year. Perfect for blogs!\r\nArticles can generate customized webpage metatags\r\nYou can edit "keywords" and "robots" metatags.\r\n"Email A Friend"\r\nNEW FEATURE! Article revision tracking & management.', '', '', 0, 0, '', '', '', 'Centered_Image', 0, 5); INSERT INTO mod_article_sections VALUES ('The Main Menu', 'The main menu is the nerve center of the entire module. It allows you to do four basic tasks -- list articles, create a new article, change Article Manager configuration settings and manage the Image Library.', '', '', 0, 0, '', '', '', 'Centered_Image', 1, 3); INSERT INTO mod_article_sections VALUES ('List Articles:', 'Here you can choose to view all approved articles on the site or just your articles ordered by Title or by the date of creation, publication, expiration, or the last update. This list can be viewed in ascending or descending order.\r\n\r\nEach article in the listing is accompanied by buttons allowing you to set it as the homepage, edit it, delete it, or immediately publish or expire it. Of course buttons or options can only be seen if you are authorized to use them.', '', '', 0, 0, '', '', '', 'Centered_Image', 0, 2); *************** *** 71,116 **** CREATE TABLE mod_article_config ( ! default_article_template varchar(255) NOT NULL DEFAULT "Blank", ! default_section_template varchar(255) NOT NULL DEFAULT "Centered_Image", ! popular_articles smallint NOT NULL DEFAULT '5', ! summaries_on_homepage smallint NOT NULL DEFAULT '5', ! prev_n_articles smallint NOT NULL DEFAULT '5', ! listings_per_page smallint NOT NULL DEFAULT '20', ! need_approval smallint NOT NULL DEFAULT '1', ! default_allow_comments smallint NOT NULL DEFAULT '1', ! default_allow_anon smallint NOT NULL DEFAULT '0', ! can_expire smallint NOT NULL DEFAULT '0', ! expiration_years smallint NOT NULL DEFAULT '3', ! expiration_months smallint NOT NULL DEFAULT '0', ! expiration_days smallint NOT NULL DEFAULT '0', ! default_year_count smallint NOT NULL DEFAULT '10', ! max_image_size int NOT NULL DEFAULT '26700', ! max_image_height int NOT NULL DEFAULT '400', ! max_image_width int NOT NULL DEFAULT '400', ! users_can_submit smallint NOT NULL DEFAULT '0', ! users_select_article_tpl smallint NOT NULL DEFAULT '0', ! users_select_section_tpl smallint NOT NULL DEFAULT '0', ! users_allow_comments smallint NOT NULL DEFAULT '0', ! users_change_dates smallint NOT NULL DEFAULT '0', ! user_images_in_article smallint NOT NULL DEFAULT '0', ! user_upload_images smallint NOT NULL DEFAULT '0', ! restricted_viewing smallint NOT NULL DEFAULT '0', ! lock_expiration_time int NOT NULL DEFAULT '3600', ! make_metatags smallint NOT NULL DEFAULT '0', ! brand_printable smallint NOT NULL DEFAULT '0', ! print_header text NOT NULL, ! use_comments smallint NOT NULL DEFAULT '1' ); ! INSERT INTO mod_article_config VALUES ('Blank', 'Centered_Image', 5, 5, 5, 20, 1, 1, 0, 0, 3, 0, 0, 10, 26, 400, 400, 0, 0, 0, 0, 0, 0, 0, 0, 3600, 0, 0, '\r\n\r\n'); CREATE TABLE mod_article_oldversions ( ! id int PRIMARY KEY, ! article_id int NOT NULL, ! archived_date datetime NOT NULL, ! changes text NOT NULL, ! ! key (article_id), ! key (archived_date) ); --- 72,124 ---- CREATE TABLE mod_article_config ( ! default_article_template varchar(255) NOT NULL DEFAULT "Blank", ! default_section_template varchar(255) NOT NULL DEFAULT "Centered_Image", ! popular_articles smallint NOT NULL DEFAULT '5', ! summaries_on_homepage smallint NOT NULL DEFAULT '5', ! prev_n_articles smallint NOT NULL DEFAULT '5', ! listings_per_page smallint NOT NULL DEFAULT '20', ! need_approval smallint NOT NULL DEFAULT '1', ! default_allow_comments smallint NOT NULL DEFAULT '1', ! default_allow_anon smallint NOT NULL DEFAULT '0', ! can_expire smallint NOT NULL DEFAULT '0', ! expiration_years smallint NOT NULL DEFAULT '3', ! expiration_months smallint NOT NULL DEFAULT '0', ! expiration_days smallint NOT NULL DEFAULT '0', ! default_year_count smallint NOT NULL DEFAULT '10', ! max_image_size int NOT NULL DEFAULT '26700', ! max_image_height int NOT NULL DEFAULT '400', ! max_image_width int NOT NULL DEFAULT '400', ! users_can_submit smallint NOT NULL DEFAULT '0', ! users_select_article_tpl smallint NOT NULL DEFAULT '0', ! users_select_section_tpl smallint NOT NULL DEFAULT '0', ! users_allow_comments smallint NOT NULL DEFAULT '0', ! users_change_dates smallint NOT NULL DEFAULT '0', ! user_images_in_article smallint NOT NULL DEFAULT '0', ! user_upload_images smallint NOT NULL DEFAULT '0', ! restricted_viewing smallint NOT NULL DEFAULT '0', ! lock_expiration_time int NOT NULL DEFAULT '3600', ! make_metatags smallint NOT NULL DEFAULT '0', ! brand_printable smallint NOT NULL DEFAULT '0', ! print_header text NOT NULL, ! use_comments smallint NOT NULL DEFAULT '1', ! archive_days smallint NOT NULL DEFAULT '7' ); ! INSERT INTO mod_article_config VALUES ('Blank', 'Centered_Image', 5, 5, 5, 20, 1, 1, 0, 0, 3, 0, 0, 10, 26, 400, 400, 0, 0, 0, 0, 0, 0, 0, 0, 3600, 0, 0, '\r\n\r\n', 1, 7); CREATE TABLE mod_article_oldversions ( ! id int PRIMARY KEY, ! article_id int NOT NULL, ! version int NOT NULL, ! archived_date datetime NOT NULL, ! updated_userid int NOT NULL DEFAULT '0', ! numadded smallint NOT NULL DEFAULT '0', ! numdeleted smallint NOT NULL DEFAULT '0', ! numchanged smallint NOT NULL DEFAULT '0', ! article text NOT NULL, ! ! key (article_id), ! key (version) ); + 1 lines were added, 1 lines were deleted, 2 lines were changed Index: uninstall.php =================================================================== RCS file: /cvsroot/phpwebsite-comm/modules/article/boost/uninstall.php,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** uninstall.php 18 Jun 2004 23:30:29 -0000 1.3 --- uninstall.php 21 Aug 2004 17:02:06 -0000 1.4 *************** *** 27,34 **** $_SESSION["OBJ_approval"]->remove("article"); - /* Unregister from Search */ - if(isset($_SESSION["OBJ_search"])) - $GLOBALS['core']->sqlDelete("mod_search_register", "module", "article"); - /* Unregister from Comments */ if(isset($_SESSION['PHPWS_CommentManager']) && $GLOBALS['core']->sqlTableExists('mod_comments_data',1)) --- 27,30 ---- Index: update.php =================================================================== RCS file: /cvsroot/phpwebsite-comm/modules/article/boost/update.php,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** update.php 2 Jul 2004 22:36:13 -0000 1.7 --- update.php 21 Aug 2004 17:02:06 -0000 1.8 *************** *** 189,218 **** $content .= 'Update Failed!<br />Try to run this sql command on your database manually: '.$sql.'<br />'; - $content .= 'Placing user ids of article authors...'; - /* Make a list of names and message ids of all article creators */ - $msg_list = $name_list = array(); - $result = $GLOBALS['core']->query('SELECT id,created_username from mod_article WHERE NOT created_username=""', true); - while ($result && $row = $result->fetchrow(DB_FETCHMODE_ASSOC)) { - if (!$row['created_username']) continue; - $msg_list[$row['created_username']][] = $row['id']; - $name_list[$row['created_username']] = $row['created_username']; - } - unset($result); - /* Make a list of all user ids for the users in the last list */ - $result = $GLOBALS['core']->query('SELECT username,user_id from mod_users WHERE username IN ("' - . implode('","', $name_list) .'")', true); - while ($result && $row = $result->fetchrow(DB_FETCHMODE_ASSOC)) - $name_tbl[$row['username']] = $row['user_id']; - unset($result); - /* Update user id information for all articles submitted by each user */ - if (count($msg_list) && count($name_list)) { - foreach ($msg_list AS $key=>$value) { - if (!isset($name_tbl[$key])) $name_tbl[$key] = 0; - $GLOBALS['core']->query('UPDATE mod_article SET created_id=' - . $name_tbl[$key].' WHERE id IN ('.implode(',', $value).')', true); - $content .= $name_tbl[$key].','; - } - } - $content .= 'Done!<br />'; $content .= 'Adding column "use_comments" to table mod_article_config...'; $sql = 'ALTER TABLE mod_article_config ADD (use_comments smallint NOT NULL DEFAULT 1)'; --- 189,192 ---- *************** *** 239,242 **** --- 213,306 ---- } } + if($currentVersion < '2.5') + { + $prefix = $GLOBALS['core']->getTablePrefix(); + $content .= 'Updating Article Manager to version 2.5<br />' + . 'Finalizing Version Control System.<br />' + . ' Adding archive columns...'; + if($GLOBALS['core']->sqlTableExists('mod_article_oldversions',1)) + $GLOBALS['core']->sqlDropTable('mod_article_oldversions'); + $columns = array(); + $columns['id'] = 'int PRIMARY KEY'; + $columns['article_id'] = 'int NOT NULL'; + $columns['version'] = 'int NOT NULL'; + $columns['archived_date'] = 'datetime NOT NULL'; + $columns['updated_userid'] = 'int NOT NULL DEFAULT "0"'; + $columns['numadded'] = 'smallint NOT NULL DEFAULT "0"'; + $columns['numdeleted'] = 'smallint NOT NULL DEFAULT "0"'; + $columns['numchanged'] = 'smallint NOT NULL DEFAULT "0"'; + $columns['article'] = 'text NOT NULL'; + $GLOBALS['core']->sqlCreateTable('mod_article_oldversions', $columns); + $content .= 'Done<br />'; + $content .= 'Creating new indexes...'; + $GLOBALS['core']->sqlCreateIndex('mod_article_oldversions', array('article_id')); + $GLOBALS['core']->sqlCreateIndex('mod_article_oldversions', array('version')); + $content .= 'Done<br />'; + $content .= 'Adding new configuration settings...'; + if(!$GLOBALS['core']->sqlColumnExists('mod_article_config', 'archive_days')) + $GLOBALS['core']->sqlAddColumn('mod_article_config', array('archive_days'=>'smallint NOT NULL DEFAULT "7"')); + $content .= 'Done<br />'; + + $content .= 'Placing user ids of article authors...'; + /* Make a list of names and userids of all article creators */ + $sql = 'SELECT a.created_username, u.user_id FROM '.$prefix.'mod_article AS a LEFT JOIN '.$prefix.'mod_users AS u ON ( u.username = a.created_username ) WHERE NOT (a.created_username = "") GROUP BY a.created_username'; + $result = $GLOBALS['core']->query($sql); + while ($result && $row = $result->fetchrow(DB_FETCHMODE_ASSOC)) { + if(!$row['user_id']) + $row['user_id'] = '0'; + $GLOBALS['core']->query('UPDATE mod_article SET created_id='.$row['user_id'].' WHERE created_username ="'.$row['created_username'].'"', true); + } + $content .= 'Done!<br />'; + + $content .= 'Adding column "updated_id" to table mod_article...'; + $sql = 'ALTER TABLE mod_article ADD updated_id int NOT NULL DEFAULT 0 AFTER updated_username'; + if ($GLOBALS['core']->query($sql, true)) + $content .= 'Column added successfully!<br />'; + else + $content .= 'Update Failed!<br />Try to run this sql command on your database manually: '.$sql.'<br />'; + + $content .= 'Placing user ids of article editors...'; + /* Make a list of names and userids of all article editors */ + $sql = 'SELECT a.updated_username, u.user_id FROM '.$prefix.'mod_article AS a LEFT JOIN '.$prefix.'mod_users AS u ON ( u.username = a.updated_username ) WHERE NOT (a.updated_username = "") GROUP BY a.updated_username'; + $result = $GLOBALS['core']->query($sql); + while ($result && $row = $result->fetchrow(DB_FETCHMODE_ASSOC)) { + if(!$row['user_id']) + $row['user_id'] = '0'; + $GLOBALS['core']->query('UPDATE mod_article SET updated_id='.$row['user_id'].' WHERE updated_username ="'.$row['updated_username'].'"', true); + } + $content .= 'Done!<br />'; + + /* Update page & section template spellings */ + $content .= 'Updating section template names.<br />'; + $GLOBALS['core']->query('UPDATE mod_article_sections SET template="Page_Insertion_to_Fit_Block.tpl" WHERE template="Page_Insertion_(Fit_Block).tpl"', true); + $GLOBALS['core']->query('UPDATE mod_article_sections SET template="Page_Insertion_to_Fit_Page.tpl" WHERE template="Page_Insertion_(Fit_Page).tpl"', true); + $GLOBALS['core']->query('UPDATE mod_article_sections SET template="Page_Insertion_for_Max_Page.tpl" WHERE template="Page_Insertion_(Max_Page).tpl"', true); + $GLOBALS['core']->query('UPDATE mod_article_sections SET template="Page_Insertion_with_Title_is_Size.tpl" WHERE template="Page_Insertion_(Title_is_Size).tpl"', true); + + /* Delete the old template files */ + if ( ! function_exists('delfile') ) + { + function delfile ($dir, $file) + { + if (file_exists(PHPWS_SOURCE_DIR . $dir . $file)) + { + if (unlink(PHPWS_SOURCE_DIR . $dir . $file)) + return $file.' Deleted.<br />'; + else + return 'ERROR: '.$file.' could not be deleted. Please delete it manually.<br />'; + } + } + $content .= 'Deleting old template files (the ones with parentheses in the names)<br />'; + $content .= delfile('mod/article/templates/section/','Page_Insertion_(Fit_Block).tpl'); + $content .= delfile('mod/article/templates/section/','Page_Insertion_(Fit_Page).tpl'); + $content .= delfile('mod/article/templates/section/','Page_Insertion_(Max_Page).tpl'); + $content .= delfile('mod/article/templates/section/','Page_Insertion_(Title_is_Size).tpl'); + } + + $content .= 'Re-registering with the Search Module....Done.<br />'; + require_once(PHPWS_SOURCE_DIR.'mod/search/class/Search.php'); + PHPWS_Search::register('article'); + $content .= 'Update Complete!'; + } $_SESSION['OBJ_help']->uninstall_help('article'); |