From c57a922892b6c525ca706f652c71bdba8850f272 Mon Sep 17 00:00:00 2001 From: JT Smith Date: Mon, 13 Aug 2001 23:18:00 +0000 Subject: [PATCH] WebGUI 0.9.0 release --- docs/create.sql | 1239 ++++++++++++++++++++++++ docs/legal.txt | 22 + docs/licence.txt | 90 ++ etc/WebGUI.conf | 3 + extras/WebGUI.js | 82 ++ extras/calendar.html | 320 ++++++ extras/colorPicker.gif | Bin 0 -> 15962 bytes extras/colorPicker.html | 364 +++++++ extras/cut.gif | Bin 0 -> 904 bytes extras/delete.gif | Bin 0 -> 863 bytes extras/downArrow.gif | Bin 0 -> 869 bytes extras/edit.gif | Bin 0 -> 913 bytes extras/help.gif | Bin 0 -> 934 bytes extras/leftArrow.gif | Bin 0 -> 864 bytes extras/rightArrow.gif | Bin 0 -> 862 bytes extras/upArrow.gif | Bin 0 -> 867 bytes extras/viewer.html | 34 + lib/WebGUI.pm | 165 ++++ lib/WebGUI/Config.pm | 650 +++++++++++++ lib/WebGUI/ErrorHandler.pm | 35 + lib/WebGUI/Form.pm | 157 +++ lib/WebGUI/Macro.pm | 173 ++++ lib/WebGUI/Mail.pm | 40 + lib/WebGUI/Operation.pm | 24 + lib/WebGUI/Operation/Account.pm | 268 +++++ lib/WebGUI/Operation/Admin.pm | 45 + lib/WebGUI/Operation/Group.pm | 156 +++ lib/WebGUI/Operation/Help.pm | 71 ++ lib/WebGUI/Operation/Page.pm | 190 ++++ lib/WebGUI/Operation/Settings.pm | 68 ++ lib/WebGUI/Operation/Style.pm | 153 +++ lib/WebGUI/Operation/User.pm | 179 ++++ lib/WebGUI/Privilege.pm | 75 ++ lib/WebGUI/SQL.pm | 105 ++ lib/WebGUI/Session.pm | 172 ++++ lib/WebGUI/Style.pm | 39 + lib/WebGUI/Utility.pm | 83 ++ lib/WebGUI/Widget.pm | 129 +++ lib/WebGUI/Widget/Article.pm | 174 ++++ lib/WebGUI/Widget/EventsCalendar.pm | 217 +++++ lib/WebGUI/Widget/ExtraColumn.pm | 107 ++ lib/WebGUI/Widget/FAQ.pm | 258 +++++ lib/WebGUI/Widget/LinkList.pm | 253 +++++ lib/WebGUI/Widget/MessageBoard.pm | 359 +++++++ lib/WebGUI/Widget/Poll.pm | 182 ++++ lib/WebGUI/Widget/SQLReport.pm | 146 +++ lib/WebGUI/Widget/SearchMnoGo.pm | 143 +++ lib/WebGUI/Widget/SiteMap.pm | 142 +++ lib/WebGUI/Widget/SyndicatedContent.pm | 112 +++ lib/runHourly.pl | 109 +++ www/index.pl | 18 + 51 files changed, 7351 insertions(+) create mode 100644 docs/create.sql create mode 100644 docs/legal.txt create mode 100644 docs/licence.txt create mode 100644 etc/WebGUI.conf create mode 100644 extras/WebGUI.js create mode 100644 extras/calendar.html create mode 100644 extras/colorPicker.gif create mode 100644 extras/colorPicker.html create mode 100644 extras/cut.gif create mode 100644 extras/delete.gif create mode 100644 extras/downArrow.gif create mode 100644 extras/edit.gif create mode 100644 extras/help.gif create mode 100644 extras/leftArrow.gif create mode 100644 extras/rightArrow.gif create mode 100644 extras/upArrow.gif create mode 100644 extras/viewer.html create mode 100644 lib/WebGUI.pm create mode 100644 lib/WebGUI/Config.pm create mode 100644 lib/WebGUI/ErrorHandler.pm create mode 100644 lib/WebGUI/Form.pm create mode 100644 lib/WebGUI/Macro.pm create mode 100644 lib/WebGUI/Mail.pm create mode 100644 lib/WebGUI/Operation.pm create mode 100644 lib/WebGUI/Operation/Account.pm create mode 100644 lib/WebGUI/Operation/Admin.pm create mode 100644 lib/WebGUI/Operation/Group.pm create mode 100644 lib/WebGUI/Operation/Help.pm create mode 100644 lib/WebGUI/Operation/Page.pm create mode 100644 lib/WebGUI/Operation/Settings.pm create mode 100644 lib/WebGUI/Operation/Style.pm create mode 100644 lib/WebGUI/Operation/User.pm create mode 100644 lib/WebGUI/Privilege.pm create mode 100644 lib/WebGUI/SQL.pm create mode 100644 lib/WebGUI/Session.pm create mode 100644 lib/WebGUI/Style.pm create mode 100644 lib/WebGUI/Utility.pm create mode 100644 lib/WebGUI/Widget.pm create mode 100644 lib/WebGUI/Widget/Article.pm create mode 100644 lib/WebGUI/Widget/EventsCalendar.pm create mode 100644 lib/WebGUI/Widget/ExtraColumn.pm create mode 100644 lib/WebGUI/Widget/FAQ.pm create mode 100644 lib/WebGUI/Widget/LinkList.pm create mode 100644 lib/WebGUI/Widget/MessageBoard.pm create mode 100644 lib/WebGUI/Widget/Poll.pm create mode 100644 lib/WebGUI/Widget/SQLReport.pm create mode 100644 lib/WebGUI/Widget/SearchMnoGo.pm create mode 100644 lib/WebGUI/Widget/SiteMap.pm create mode 100644 lib/WebGUI/Widget/SyndicatedContent.pm create mode 100644 lib/runHourly.pl create mode 100755 www/index.pl diff --git a/docs/create.sql b/docs/create.sql new file mode 100644 index 000000000..a782fa3c7 --- /dev/null +++ b/docs/create.sql @@ -0,0 +1,1239 @@ +# MySQL dump 8.13 +# +# Host: localhost Database: WebGUI +#-------------------------------------------------------- +# Server version 3.23.36 + +# +# Table structure for table 'Article' +# + +CREATE TABLE Article ( + widgetId int(11) default NULL, + startDate datetime default NULL, + endDate datetime default NULL, + body text, + image varchar(255) default NULL, + linkTitle varchar(255) default NULL, + linkURL text, + attachment varchar(255) default NULL +) TYPE=MyISAM; + +# +# Dumping data for table 'Article' +# + + +# +# Table structure for table 'ExtraColumn' +# + +CREATE TABLE ExtraColumn ( + widgetId int(11) NOT NULL default '0', + spacer int(11) default NULL, + width int(11) default NULL, + class varchar(50) default NULL, + PRIMARY KEY (widgetId) +) TYPE=MyISAM; + +# +# Dumping data for table 'ExtraColumn' +# + + +# +# Table structure for table 'MessageBoard' +# + +CREATE TABLE MessageBoard ( + widgetId int(11) default NULL, + groupToPost int(11) default NULL, + messagesPerPage int(11) NOT NULL default '50', + editTimeout int(11) default NULL +) TYPE=MyISAM; + +# +# Dumping data for table 'MessageBoard' +# + + +# +# Table structure for table 'Poll' +# + +CREATE TABLE Poll ( + widgetId int(11) NOT NULL default '0', + active int(11) NOT NULL default '1', + voteGroup int(11) default NULL, + question varchar(255) default NULL, + a1 varchar(255) default NULL, + a2 varchar(255) default NULL, + a3 varchar(255) default NULL, + a4 varchar(255) default NULL, + a5 varchar(255) default NULL, + a6 varchar(255) default NULL, + a7 varchar(255) default NULL, + a8 varchar(255) default NULL, + a9 varchar(255) default NULL, + a10 varchar(255) default NULL, + a11 varchar(255) default NULL, + a12 varchar(255) default NULL, + a13 varchar(255) default NULL, + a14 varchar(255) default NULL, + a15 varchar(255) default NULL, + a16 varchar(255) default NULL, + a17 varchar(255) default NULL, + a18 varchar(255) default NULL, + a19 varchar(255) default NULL, + a20 varchar(255) default NULL, + PRIMARY KEY (widgetId) +) TYPE=MyISAM; + +# +# Dumping data for table 'Poll' +# + + +# +# Table structure for table 'SQLReport' +# + +CREATE TABLE SQLReport ( + widgetId int(11) NOT NULL default '0', + template text, + dbQuery text, + DSN varchar(255) default NULL, + username varchar(255) default NULL, + identifier varchar(255) default NULL, + PRIMARY KEY (widgetId) +) TYPE=MyISAM; + +# +# Dumping data for table 'SQLReport' +# + + +# +# Table structure for table 'SearchMnoGo' +# + +CREATE TABLE SearchMnoGo ( + widgetId int(11) NOT NULL default '0', + DSN varchar(255) default NULL, + username varchar(255) default NULL, + identifier varchar(255) default NULL, + PRIMARY KEY (widgetId) +) TYPE=MyISAM; + +# +# Dumping data for table 'SearchMnoGo' +# + + +# +# Table structure for table 'SiteMap' +# + +CREATE TABLE SiteMap ( + widgetId int(11) NOT NULL default '0', + startAtThisLevel int(11) default NULL, + showOnlyThisLevel int(11) default NULL, + PRIMARY KEY (widgetId) +) TYPE=MyISAM; + +# +# Dumping data for table 'SiteMap' +# + + +# +# Table structure for table 'SyndicatedContent' +# + +CREATE TABLE SyndicatedContent ( + widgetId int(11) NOT NULL default '0', + rssUrl text, + content text, + lastFetched datetime NOT NULL default '0000-00-00 00:00:00', + PRIMARY KEY (widgetId) +) TYPE=MyISAM; + +# +# Dumping data for table 'SyndicatedContent' +# + + +# +# Table structure for table 'UserContribution' +# + +CREATE TABLE UserContribution ( + widgetId int(11) NOT NULL default '0', + groupToContribute int(11) default NULL, + contributionsPerPage int(11) default NULL, + PRIMARY KEY (widgetId) +) TYPE=MyISAM; + +# +# Dumping data for table 'UserContribution' +# + + +# +# Table structure for table 'dict' +# + +CREATE TABLE dict ( + url_id int(11) NOT NULL default '0', + word varchar(32) NOT NULL default '', + intag int(11) NOT NULL default '0', + KEY url_id (url_id), + KEY word_url (word) +) TYPE=MyISAM; + +# +# Dumping data for table 'dict' +# + + +# +# Table structure for table 'event' +# + +CREATE TABLE event ( + eventId int(11) NOT NULL default '1', + widgetId int(11) default NULL, + name varchar(255) default NULL, + description text, + startDate datetime default NULL, + endDate datetime default NULL, + PRIMARY KEY (eventId) +) TYPE=MyISAM; + +# +# Dumping data for table 'event' +# + + +# +# Table structure for table 'faqQuestion' +# + +CREATE TABLE faqQuestion ( + widgetId int(11) default NULL, + questionId int(11) NOT NULL default '0', + question text, + answer text, + sequenceNumber int(11) NOT NULL default '0', + PRIMARY KEY (questionId) +) TYPE=MyISAM; + +# +# Dumping data for table 'faqQuestion' +# + + +# +# Table structure for table 'groupings' +# + +CREATE TABLE groupings ( + groupId int(11) NOT NULL default '0', + userId int(11) NOT NULL default '0', + PRIMARY KEY (groupId,userId) +) TYPE=MyISAM; + +# +# Dumping data for table 'groupings' +# + +INSERT INTO groupings VALUES (1,1); +INSERT INTO groupings VALUES (2,3); +INSERT INTO groupings VALUES (3,3); +INSERT INTO groupings VALUES (4,3); + +# +# Table structure for table 'groups' +# + +CREATE TABLE groups ( + groupId int(11) NOT NULL default '0', + groupName varchar(30) default NULL, + description varchar(255) default NULL, + PRIMARY KEY (groupId) +) TYPE=MyISAM; + +# +# Dumping data for table 'groups' +# + +INSERT INTO groups VALUES (1,'Visitors','This is the public group that has no privileges.'); +INSERT INTO groups VALUES (2,'Registered Users','All registered users belong to this group automatically.'); +INSERT INTO groups VALUES (3,'Admins','Anyone who belongs to this group has privileges to everything.'); +INSERT INTO groups VALUES (4,'Content Managers','Users that have privileges to edit content on this site. The user still needs to be added to a group that has editing privileges on specific pages.'); +INSERT INTO groups VALUES (5,'Reserved',''); +INSERT INTO groups VALUES (6,'Reserved',''); +INSERT INTO groups VALUES (7,'Reserved',''); +INSERT INTO groups VALUES (8,'Reserved',''); +INSERT INTO groups VALUES (9,'Reserved',''); +INSERT INTO groups VALUES (10,'Reserved',''); +INSERT INTO groups VALUES (11,'Reserved',''); +INSERT INTO groups VALUES (12,'Reserved',''); +INSERT INTO groups VALUES (13,'Reserved',''); +INSERT INTO groups VALUES (14,'Reserved',''); +INSERT INTO groups VALUES (15,'Reserved',''); +INSERT INTO groups VALUES (16,'Reserved',''); +INSERT INTO groups VALUES (17,'Reserved',''); +INSERT INTO groups VALUES (18,'Reserved',''); +INSERT INTO groups VALUES (19,'Reserved',''); +INSERT INTO groups VALUES (20,'Reserved',''); +INSERT INTO groups VALUES (21,'Reserved',''); +INSERT INTO groups VALUES (22,'Reserved',''); +INSERT INTO groups VALUES (23,'Reserved',''); +INSERT INTO groups VALUES (24,'Reserved',''); +INSERT INTO groups VALUES (25,'Reserved',''); + +# +# Table structure for table 'help' +# + +CREATE TABLE help ( + helpId int(11) NOT NULL default '0', + language varchar(30) NOT NULL default 'US English', + action varchar(30) default NULL, + object varchar(30) default NULL, + body text, + seeAlso varchar(50) NOT NULL default '0', + KEY helpId (helpId,language) +) TYPE=MyISAM; + +# +# Dumping data for table 'help' +# + +INSERT INTO help VALUES (1,'US English','Add','Page','Think of pages as containers for content. For instance, if you want to write a letter to the editor of your favorite magazine you\'d get out a notepad (or open a word processor) and start filling it with your thoughts. The same is true with WebGUI. Create a page, then add your content to the page.\r\n\r\nTitle\r\nThe title of the page is what your users will use to navigate through the site. Titles should be descriptive, but not very long.\r\n\r\nMeta Tags\r\nMeta tags are used by some search engines to associate key words to a particular page. There is a great site called Meta Tag Builder that will help you build meta tags if you\'ve never done it before.\r\n\r\nAdvanced Users: If you have other things (like JavaScript) you usually put in the <head> area of your pages, you may put them here as well.','0'); +INSERT INTO help VALUES (2,'US English','Edit','Page','Title\r\nSee Add Page for details.\r\n\r\nMeta Tags\r\nSee Add Page for details.\r\n\r\nStyle\r\nBy default, when you create a page, it inherits a few traits from its parent. One of those traits is style. Choose from the list of styles if you would like to change the appearance of this page. See Add Style for more details.\r\n\r\nIf you check the box next to the style pull-down menu, all of the pages below this page will take on the style you\'ve chosen for this page.\r\n\r\nPage URL\r\nWhen you create a page a url for the page is generated based on the page title. If you are unhappy with the url that was chosen, you can change it here.\r\n\r\nOwner\r\nThe owner of a page is usually the person who created the page. If you\'d like to give ownership of a page to a different content manager, then change the name here. Be careful though, once you change ownership of the page, you won\'t be able to get it back unless you are an administrator.\r\n\r\nOwner can view?\r\nCan the owner view the page or not?\r\n\r\nOwner can edit?\r\nCan the owner edit the page or not? Be careful, if you decide that the owner cannot edit the page and you do not belong to the page group, then you\'ll lose the ability to edit this page.\r\n\r\nGroup\r\nA group is assigned to every page for additional privilege control. Pick a group from the pull-down menu.\r\n\r\nGroup can view?\r\nCan members of this group view this page?\r\n\r\nGroup can edit?\r\nCan members of this group edit this page?\r\n\r\nAnybody can view?\r\nCan any visitor or member regardless of the group and owner view this page?\r\n\r\nAnybody can edit?\r\nCan any visitor or member regardless of the group and owner edit this page?\r\n\r\n','9'); +INSERT INTO help VALUES (3,'US English','Delete','Page','Deleting a page can create a big mess if you are uncertain about what you are doing. When you delete a page you are also deleting the content it contains, all sub-pages connected to this page, and all the content they contain. Be certain that you have already moved all other content before you delete a page.\r\n\r\nAs with any delete operation, you are prompted to be sure you wish to proceed with the delete. If you answer yes, the delete will proceed and there is no recovery possible. If you answer no you\'ll be returned to the prior screen.','0'); +INSERT INTO help VALUES (4,'US English','Delete','Style','When you delete a style all pages using that style will be reverted to the fail safe style. To ensure uninterrupted viewing, you should be sure that no pages are using a style before you delete it.\r\n\r\nAs with any delete operation, you are prompted to be sure you wish to proceed with the delete. If you answer yes, the delete will proceed and there is no recovery possible. If you answer no you\'ll be returned to the prior screen.','0'); +INSERT INTO help VALUES (5,'US English','Add','User','See Manage Users for additional details.\r\n\r\nUsername\r\nUsername is a unique identifier for a user. Sometimes called a handle, it is also how the user will be known on the site. (Note: Administrators have unlimited power in the WebGUI system. This also means they are capable of breaking the system. If you rename or create a user, be careful not to use a username already in existance.)\r\n\r\nPassword\r\nA password is used to ensure that the user is who s/he says s/he is.\r\n\r\nEmail Address\r\nThe user\'s email address. This must only be specified if the user will partake in functions that require email.\r\n\r\nICQ UIN\r\nThe ICQ UIN is the \"User ID Number\" on the ICQ network. ICQ is a very popular instant messaging platform.\r\n\r\nGroups\r\nGroups displays which groups the user is in. Groups that are highlighted are groups that the user is assigned to. Those that are not highlighted are other groups that can be assigned. Note that you must hold down CTRL to select multiple groups.','0'); +INSERT INTO help VALUES (6,'US English','Edit','User','Username\r\nSee Add User for details.\r\n\r\nPassword\r\nSee Add User for details.\r\n\r\nEmail Address\r\nSee Add User for details.\r\n\r\nICQ UIN\r\nSee Add User for details.\r\n\r\nGroups\r\nSee Add User for details.\r\n\r\n','0'); +INSERT INTO help VALUES (7,'US English','Delete','User','There is really no reason to ever delete a user. If you are concerned with locking out a user, then simply change their password. If you truely wish to delete a user, then please know that there are consequences. If you delete a user any content that they added to the site via widgets like message boards and user contributions will remain on the site. However, if another user tries to visit the deleted user\'s profile they will get an error message. Also if the user ever is welcomed back to the site, there is no way to give him/her access to his/her old content items except by manually re-adding the user to the users table manually.\r\n\r\nAs with any delete operation, you are prompted to be sure you wish to proceed with the delete. If you answer yes, the delete will proceed and there is no recovery possible. If you answer no you\'ll be returned to the prior screen.','0'); +INSERT INTO help VALUES (8,'US English','Manage','User','Users are the accounts in the system given rights to do things. There are two default users built into the system: Admin and Visitor.\r\n\r\nAdmin\r\nAdmin is exactly what you\'d expect. It is a user with unlimited rights in the WebGUI environment. If it can be done, this user has the rights to do it.\r\n\r\nVisitor\r\nVisitor is exactly the opposite of Admin. Visitor has no rights what-so-ever. By default any user who is not logged in is seen as the user Visitor.','0'); +INSERT INTO help VALUES (9,'US English','Manage','Style','Styles are used to manage the look and feel of your WebGUI pages. With WebGUI, you can have an unlimited number of styles, so your site can take on as many looks as you like. You could have some pages that look like your company\'s brochure, and some pages that look like Yahoo!. You could even have some pages that look like pages in a book. Using style management, you have ultimate control over all your designs.\r\n\r\nThere are three styles built in to WebGUI: Fail Safe, Plain Black Software, and Yahoo!. These styles are not meant to be edited, but rather to give you samples of what\'s possible.\r\n\r\nFail Safe\r\nWhen you delete a style that is still in use on some pages, the Fail Safe style will be applied to those pages. This style has a white background and simple navigation.\r\n\r\nPlain Black Software\r\nThis is the simple design used on the Plain Black Software site.\r\n\r\nYahoo!\r\nThis is the design of the Yahoo! site. (Yahoo! has not given us permission to use their design. It is simply an example.)','0'); +INSERT INTO help VALUES (10,'US English','Manage','Group','Groups are used to subdivided privileges and responsibilities within the WebGUI system. For instance, you may be building a site for a classroom situation. In that case you might set up a different group for each class that you teach. You would then apply those groups to the pages that are designed for each class.\r\n\r\nThere are four groups built into WebGUI. They are Admins, Content Managers, Visitors, and Registered Users.\r\n\r\nAdmins\r\nAdmins are users who have unlimited privileges within WebGUI. A user should only be added to the admin group if they oversee the system. Usually only one to three people will be added to this group.\r\n\r\nContent Managers\r\nContent managers are users who have privileges to add, edit, and delete content from various areas on the site. The content managers group should not be used to control individual content areas within the site, but instead just whether users can edit content at all. You should set up additional groups to separate content areas on the site.\r\n\r\nRegistered Users\r\nWhen users are added to the system they are put into the registered users group. A user should only be removed from this group if their account is deleted or if you wish to punish a troublemaker.\r\n\r\nVisitors\r\nVisitors are users who are not logged in using an account on the system. Also, if you wish to punish a registered user you could remove him/her from the Registered Users group and insert him/her into the Visitors group.','0'); +INSERT INTO help VALUES (11,'US English','Edit','Style','Style Name\r\nSee Add Style for details.\r\n\r\nHeader\r\nSee Add Style for details.\r\n\r\nFooter\r\nSee Add Style for details.\r\n\r\nStyle Sheet\r\nSee Add Style for details.\r\n\r\n','18,19'); +INSERT INTO help VALUES (12,'US English','Edit','Settings','Settings are items that allow you to adjust WebGUI to your particular needs.\r\n\r\nPath to WebGUI Extras\r\nThe web-path to the directory containing WebGUI images and javascript files.\r\n\r\nSession Timeout\r\nThe time (in seconds) that a user session remains active (before needing to log in again). This timeout is reset each time a visitor hits a page. Therefore if you set the timeout for 8 hours, a user would have to log in again if s/he hadn\'t visited the site for 8 hours.\r\n\r\n1800 = half hour\r\n3600 = 1 hour\r\n28000 = 8 hours\r\n86400 = 1 day\r\n604800 = 1 week\r\n1209600 = 2 weeks\r\n\r\nMaximum Attachment Size\r\nThe maximum size of files allowed to be uploaded to this site. This applies to all widgets that allow uploaded files and images (like Article and User Contributions). This size is measured in kilobytes.\r\n\r\nWeb Attachment Path\r\nThe web-path of the directory where attachments are to be stored.\r\n\r\nServer Attachment Path\r\nThe local path of the directory where attachments are to be stored. (Perhaps /var/www/public/uploads) Be sure that the web server has the rights to write to that directory.\r\n\r\nSMTP Server\r\nThis is the address of your local mail server. It is needed for all features that use the Internet email system (such as password recovery).\r\n\r\nCompany Name\r\nThe name of your company. It will appear on all emails and anywhere you use the Company Name macro.\r\n\r\nCompany Email Address\r\nA general email address at your company. This is the address that all automated messages will come from. It can also be used via the WebGUI macro system.\r\n\r\nCompany URL\r\nThe primary URL of your company. This will appear on all automated emails sent from the WebGUI system. It is also available via the WebGUI macro system.\r\n\r\n\r\n','19'); +INSERT INTO help VALUES (13,'US English','Edit','Group','Group Name\r\nSee Add Group for details.\r\n\r\nDescription\r\nSee Add Group for details.\r\n','0'); +INSERT INTO help VALUES (14,'US English','Delete','Content','As the function suggests you\'ll be deleting some content from a page. If you are unsure whether you wish to delete this content you may be better served to cut the content to the clipboard until you are certain you wish to delete it.\r\n\r\nAs with any delete operation, you are prompted to be sure you wish to proceed with the delete. If you answer yes, the delete will proceed and there is no recovery possible. If you answer no you\'ll be returned to the prior screen.','0'); +INSERT INTO help VALUES (15,'US English','Delete','Group','As the function suggests you\'ll be deleting a group and removing all users from the group. Be careful not to orphan users from pages they should have access to by deleting a group that is in use.\r\n\r\nAs with any delete operation, you are prompted to be sure you wish to proceed with the delete. If you answer yes, the delete will proceed and there is no recovery possible. If you answer no you\'ll be returned to the prior screen.','0'); +INSERT INTO help VALUES (16,'US English','Add','Style','Styles are WebGUI macro enabled. See Using Macros for more information.\r\n\r\nStyle Name\r\nA unique name to describe what this style looks like at a glance. The name has no effect on the actual look of the style.\r\n\r\nHeader\r\nThe header is the start of the look of your site. It is helpful to look at your design and cut it into three pieces. The top and left of your design is the header. The center part is the content, and the right and bottom is the footer. Cut the HTML from your header and paste it in the space provided.\r\n\r\nIf you are in need of assistance for creating a look for your site, or if you need help cutting apart your design, Plain Black Software provides support services for a small fee.\r\n\r\nMany people will add WebGUI macros to their header for automated navigation, and other features.\r\n\r\nFooter\r\nThe footer is the end of the look for your site. It is the right and bottom portion of your design. You may also place WebGUI macros in your footer.\r\n\r\nStyle Sheet\r\nPlace your style sheet entries here. Style sheets are used to control colors, sizes, and other properties of the elements on your site. See Using Style Sheets for more information.\r\n\r\nAdvanced Users: for greater performance create your stylesheet on the file system (call it something like webgui.css) and add an entry like this to this area: \r\n<link href=\"/webgui.css\" rel=\"stylesheet\" rev=\"stylesheet\" type=\"text/css\">','18,19'); +INSERT INTO help VALUES (17,'US English','Add','Group','See Manage Group for a description of grouping functions and the default groups.\r\n\r\nGroup Name\r\nA name for the group. It is best if the name is descriptive so you know what it is at a glance.\r\n\r\nDescription\r\nA longer description of the group so that other admins and content managers (or you if you forget) will know what the purpose of this group is.','0'); +INSERT INTO help VALUES (18,'US English','Using','Style Sheets','Cascading Style Sheets (CSS) are a great way to manage the look and feel of any web site. They are used extensively in WebGUI.\r\n\r\nIf you are unfamiliar with how to use CSS, Plain Black Software provides training classes on XHTML and CSS. Alternatively, Bradsoft makes an excellent CSS editor called Top Style.\r\n\r\nThe following is a list of classes used to control the look of WebGUI:\r\n\r\nA\r\nThe links throughout the style.\r\n\r\nBODY\r\nThe default setup of all pages within a style.\r\n\r\nH1\r\nThe headers on every page.\r\n\r\n.accountOptions\r\nThe links that appear under the login and account update forms.\r\n\r\n.adminBar \r\nThe bar that appears at the top of the page when you\'re in admin mode.\r\n\r\n.boardData \r\nThe message listings on the message boards.\r\n\r\n.boardHeader \r\nThe header on the message boards.\r\n\r\n.boardMenu \r\nThe menu on the message boards.\r\n\r\n.boardMessage \r\nThe full message text.\r\n\r\n.boardTitle \r\nThe headings of each column on the message list.\r\n\r\n.content\r\nThe main content area on all pages of the style.\r\n\r\n.crumbTrail \r\nThe crumb trail (if you\'re using that macro).\r\n\r\n.faqQuestion\r\nAn F.A.Q. question. To distinguish it from an answer.\r\n\r\n.formDescription \r\nThe tags on all forms next to the form elements. \r\n\r\n.formSubtext \r\nThe tags below some form elements.\r\n\r\n.highlight \r\nDenotes a highlighted item, such as which message you are viewing within a list.\r\n\r\n.horizontalMenu \r\nThe horizontal menu (if you use a horizontal menu macro).\r\n\r\n.loginBox\r\nThe login box macro.\r\n\r\n.pagination \r\nThe Previous and Next links on pages with pagination.\r\n\r\n.pollAnswer \r\nAn answer on a poll.\r\n\r\n.pollColor \r\nThe color of the percentage bar on a poll.\r\n\r\n.pollQuestion \r\nThe question on a poll.\r\n\r\n.verticalMenu \r\nThe vertical menu (if you use a verticall menu macro).\r\n\r\n','11,16'); +INSERT INTO help VALUES (19,'US English','Using','Macros','WebGUI macros are used to create dynamic content within otherwise static content. For instance, you may wish to show which user is logged in on every page, or you may wish to have a dynamically built menu or crumb trail. \r\n\r\nMacros always begin with a carrot (^) and follow with one other character. The following is a description of all the macros in the WebGUI system.\r\n\r\n^^ - Carrot\r\nSince the carrot symbol is used to start all macros, this macro is in place just in case you really wanted to use a carrot somewhere.\r\n\r\n^/ - System URL\r\nThe URL to the gateway script (including the domain for this site). This is often used within pages so that if your development server is on a domain different than your production server that your URLs will still worked when moved.\r\n\r\n^@ - Username\r\nThe username of the currently logged in user.\r\n\r\n^# - User ID\r\nThe user id of the currently logged in user.\r\n\r\n^* - Random Number\r\nA randomly generated number. This is often used on images (such as banner ads) that you want to ensure do not cache.\r\n\r\n^a - My Account Link\r\nA link to your account information.\r\n\r\n^C - Crumb Trail\r\nA dynamically generated crumb trail to the current page.\r\n\r\n^D - Date\r\nThe current date and time.\r\n\r\n^H - Home Link\r\nA link to the home page of this site.\r\n\r\n^L - Login\r\nA small login form.\r\n\r\n^M - Current Menu (Vertical)\r\nA vertical menu containing the sub-pages at the current level.\r\n\r\n^m - Current Menu (Horizontal)\r\nA horizontal menu containing the sub-pages at the current level.\r\n\r\n^T - Top Level Menu (Vertical)\r\nA vertical menu containing the main pages of the site (aka the sub-pages from the home page).\r\n\r\n^t - Top Level Menu (Horizontal)\r\nA vertical menu containing the main pages of the site (aka the sub-pages from the home page).\r\n\r\n','11,16,12'); + +# +# Table structure for table 'incrementer' +# + +CREATE TABLE incrementer ( + incrementerId varchar(50) NOT NULL default '', + nextValue int(11) NOT NULL default '1', + PRIMARY KEY (incrementerId) +) TYPE=MyISAM; + +# +# Dumping data for table 'incrementer' +# + +INSERT INTO incrementer VALUES ('groupId',26); +INSERT INTO incrementer VALUES ('helpId',20); +INSERT INTO incrementer VALUES ('messageId',1); +INSERT INTO incrementer VALUES ('pageId',26); +INSERT INTO incrementer VALUES ('styleId',26); +INSERT INTO incrementer VALUES ('userId',26); +INSERT INTO incrementer VALUES ('widgetId',1); +INSERT INTO incrementer VALUES ('eventId',1); +INSERT INTO incrementer VALUES ('linkId',1); +INSERT INTO incrementer VALUES ('questionId',1); + +# +# Table structure for table 'link' +# + +CREATE TABLE link ( + widgetId int(11) default NULL, + linkId int(11) NOT NULL default '0', + name varchar(30) default NULL, + url text, + description text, + sequenceNumber int(11) NOT NULL default '0', + PRIMARY KEY (linkId) +) TYPE=MyISAM; + +# +# Dumping data for table 'link' +# + + +# +# Table structure for table 'message' +# + +CREATE TABLE message ( + messageId int(11) NOT NULL default '0', + rid int(11) default NULL, + widgetId int(11) default NULL, + pid int(11) default NULL, + userId int(11) default NULL, + username varchar(30) default NULL, + subject varchar(255) default NULL, + message text, + dateOfPost datetime default NULL, + PRIMARY KEY (messageId) +) TYPE=MyISAM; + +# +# Dumping data for table 'message' +# + + +# +# Table structure for table 'page' +# + +CREATE TABLE page ( + pageId int(11) NOT NULL default '0', + parentId int(11) NOT NULL default '0', + title varchar(255) NOT NULL default '', + styleId int(11) NOT NULL default '0', + ownerId int(11) NOT NULL default '0', + ownerView int(11) NOT NULL default '1', + ownerEdit int(11) NOT NULL default '1', + groupId int(11) default NULL, + groupView int(11) NOT NULL default '1', + groupEdit int(11) NOT NULL default '0', + worldView int(11) NOT NULL default '1', + worldEdit int(11) NOT NULL default '0', + sequenceNumber int(11) NOT NULL default '1', + metaTags text, + urlizedTitle varchar(255) default NULL, + PRIMARY KEY (pageId) +) TYPE=MyISAM; + +# +# Dumping data for table 'page' +# + +INSERT INTO page VALUES (1,0,'Home',3,3,1,1,1,1,0,1,0,1,'','home'); +INSERT INTO page VALUES (5,3,'Reserved',1,1,1,1,NULL,1,0,1,0,1,NULL,'page_2.1'); +INSERT INTO page VALUES (6,0,'Reserved',0,0,1,1,NULL,1,0,1,0,1,NULL,NULL); +INSERT INTO page VALUES (7,0,'Reserved',0,0,1,1,NULL,1,0,1,0,1,NULL,NULL); +INSERT INTO page VALUES (8,0,'Reserved',0,0,1,1,NULL,1,0,1,0,1,NULL,NULL); +INSERT INTO page VALUES (9,0,'Reserved',0,0,1,1,NULL,1,0,1,0,1,NULL,NULL); +INSERT INTO page VALUES (10,0,'Reserved',0,0,1,1,NULL,1,0,1,0,1,NULL,NULL); +INSERT INTO page VALUES (11,0,'Reserved',0,0,1,1,NULL,1,0,1,0,1,NULL,NULL); +INSERT INTO page VALUES (12,0,'Reserved',0,0,1,1,NULL,1,0,1,0,1,NULL,NULL); +INSERT INTO page VALUES (13,0,'Reserved',0,0,1,1,NULL,1,0,1,0,1,NULL,NULL); +INSERT INTO page VALUES (14,0,'Reserved',0,0,1,1,NULL,1,0,1,0,1,NULL,NULL); +INSERT INTO page VALUES (15,0,'Reserved',0,0,1,1,NULL,1,0,1,0,1,NULL,NULL); +INSERT INTO page VALUES (16,0,'Reserved',0,0,1,1,NULL,1,0,1,0,1,NULL,NULL); +INSERT INTO page VALUES (17,0,'Reserved',0,0,1,1,NULL,1,0,1,0,1,NULL,NULL); +INSERT INTO page VALUES (18,0,'Reserved',0,0,1,1,NULL,1,0,1,0,1,NULL,NULL); +INSERT INTO page VALUES (19,0,'Reserved',0,0,1,1,NULL,1,0,1,0,1,NULL,NULL); +INSERT INTO page VALUES (20,0,'Reserved',0,0,1,1,NULL,1,0,1,0,1,NULL,NULL); +INSERT INTO page VALUES (21,0,'Reserved',0,0,1,1,NULL,1,0,1,0,1,NULL,NULL); +INSERT INTO page VALUES (22,0,'Reserved',0,0,1,1,NULL,1,0,1,0,1,NULL,NULL); +INSERT INTO page VALUES (23,0,'Reserved',0,0,1,1,NULL,1,0,1,0,1,NULL,NULL); +INSERT INTO page VALUES (24,0,'Reserved',0,0,1,1,NULL,1,0,1,0,1,NULL,NULL); +INSERT INTO page VALUES (25,0,'Reserved',0,0,1,1,NULL,1,0,1,0,1,NULL,NULL); +INSERT INTO page VALUES (4,0,'Reserved',1,0,1,1,0,1,0,1,0,1,NULL,NULL); +INSERT INTO page VALUES (3,0,'Trash',2,45,1,1,3,1,1,0,0,1,'','trash'); +INSERT INTO page VALUES (2,0,'Clipboard',2,45,1,1,4,1,1,0,0,1,'','clipboard'); + +# +# Table structure for table 'pollAnswer' +# + +CREATE TABLE pollAnswer ( + widgetId int(11) NOT NULL default '0', + answer char(3) default NULL, + userId int(11) default NULL +) TYPE=MyISAM; + +# +# Dumping data for table 'pollAnswer' +# + + +# +# Table structure for table 'robots' +# + +CREATE TABLE robots ( + hostinfo varchar(127) NOT NULL default '', + path varchar(127) NOT NULL default '' +) TYPE=MyISAM; + +# +# Dumping data for table 'robots' +# + + +# +# Table structure for table 'session' +# + +CREATE TABLE session ( + sessionId varchar(60) NOT NULL default '', + expires datetime default NULL, + lastPageView datetime default NULL, + adminOn int(11) NOT NULL default '0', + PRIMARY KEY (sessionId) +) TYPE=MyISAM; + +# +# Dumping data for table 'session' +# + + +# +# Table structure for table 'settings' +# + +CREATE TABLE settings ( + name varchar(255) NOT NULL default '', + value text, + PRIMARY KEY (name) +) TYPE=MyISAM; + +# +# Dumping data for table 'settings' +# + +INSERT INTO settings VALUES ('attachmentDirectoryWeb','/uploads'); +INSERT INTO settings VALUES ('maxAttachmentSize','300'); +INSERT INTO settings VALUES ('lib','/extras'); +INSERT INTO settings VALUES ('sessionTimeout','28000'); +INSERT INTO settings VALUES ('attachmentDirectoryLocal','/path/to/mysite/uploads'); +INSERT INTO settings VALUES ('smtpServer','smtp.mycompany.com'); +INSERT INTO settings VALUES ('companyEmail','info@mycompany.com'); +INSERT INTO settings VALUES ('companyName','My Company'); +INSERT INTO settings VALUES ('companyURL','http://www.mycompany.com'); + +# +# Table structure for table 'stopword' +# + +CREATE TABLE stopword ( + word char(32) NOT NULL default '', + lang char(2) NOT NULL default '', + PRIMARY KEY (word,lang) +) TYPE=MyISAM; + +# +# Dumping data for table 'stopword' +# + +INSERT INTO stopword VALUES ('a','en'); +INSERT INTO stopword VALUES ('about','en'); +INSERT INTO stopword VALUES ('above','en'); +INSERT INTO stopword VALUES ('abst','en'); +INSERT INTO stopword VALUES ('accordance','en'); +INSERT INTO stopword VALUES ('according','en'); +INSERT INTO stopword VALUES ('accordingly','en'); +INSERT INTO stopword VALUES ('across','en'); +INSERT INTO stopword VALUES ('act','en'); +INSERT INTO stopword VALUES ('actually','en'); +INSERT INTO stopword VALUES ('added','en'); +INSERT INTO stopword VALUES ('adj','en'); +INSERT INTO stopword VALUES ('adopted','en'); +INSERT INTO stopword VALUES ('affected','en'); +INSERT INTO stopword VALUES ('affecting','en'); +INSERT INTO stopword VALUES ('affects','en'); +INSERT INTO stopword VALUES ('after','en'); +INSERT INTO stopword VALUES ('afterwards','en'); +INSERT INTO stopword VALUES ('again','en'); +INSERT INTO stopword VALUES ('against','en'); +INSERT INTO stopword VALUES ('ah','en'); +INSERT INTO stopword VALUES ('all','en'); +INSERT INTO stopword VALUES ('almost','en'); +INSERT INTO stopword VALUES ('alone','en'); +INSERT INTO stopword VALUES ('along','en'); +INSERT INTO stopword VALUES ('already','en'); +INSERT INTO stopword VALUES ('also','en'); +INSERT INTO stopword VALUES ('although','en'); +INSERT INTO stopword VALUES ('always','en'); +INSERT INTO stopword VALUES ('am','en'); +INSERT INTO stopword VALUES ('among','en'); +INSERT INTO stopword VALUES ('amongst','en'); +INSERT INTO stopword VALUES ('an','en'); +INSERT INTO stopword VALUES ('and','en'); +INSERT INTO stopword VALUES ('announce','en'); +INSERT INTO stopword VALUES ('another','en'); +INSERT INTO stopword VALUES ('any','en'); +INSERT INTO stopword VALUES ('anyhow','en'); +INSERT INTO stopword VALUES ('anymore','en'); +INSERT INTO stopword VALUES ('anyone','en'); +INSERT INTO stopword VALUES ('anything','en'); +INSERT INTO stopword VALUES ('anywhere','en'); +INSERT INTO stopword VALUES ('apparently','en'); +INSERT INTO stopword VALUES ('approximately','en'); +INSERT INTO stopword VALUES ('are','en'); +INSERT INTO stopword VALUES ('aren','en'); +INSERT INTO stopword VALUES ('arent','en'); +INSERT INTO stopword VALUES ('arise','en'); +INSERT INTO stopword VALUES ('around','en'); +INSERT INTO stopword VALUES ('as','en'); +INSERT INTO stopword VALUES ('aside','en'); +INSERT INTO stopword VALUES ('at','en'); +INSERT INTO stopword VALUES ('auth','en'); +INSERT INTO stopword VALUES ('available','en'); +INSERT INTO stopword VALUES ('away','en'); +INSERT INTO stopword VALUES ('b','en'); +INSERT INTO stopword VALUES ('back','en'); +INSERT INTO stopword VALUES ('be','en'); +INSERT INTO stopword VALUES ('became','en'); +INSERT INTO stopword VALUES ('because','en'); +INSERT INTO stopword VALUES ('become','en'); +INSERT INTO stopword VALUES ('becomes','en'); +INSERT INTO stopword VALUES ('becoming','en'); +INSERT INTO stopword VALUES ('been','en'); +INSERT INTO stopword VALUES ('before','en'); +INSERT INTO stopword VALUES ('beforehand','en'); +INSERT INTO stopword VALUES ('begin','en'); +INSERT INTO stopword VALUES ('beginning','en'); +INSERT INTO stopword VALUES ('beginnings','en'); +INSERT INTO stopword VALUES ('begins','en'); +INSERT INTO stopword VALUES ('behind','en'); +INSERT INTO stopword VALUES ('being','en'); +INSERT INTO stopword VALUES ('below','en'); +INSERT INTO stopword VALUES ('beside','en'); +INSERT INTO stopword VALUES ('besides','en'); +INSERT INTO stopword VALUES ('between','en'); +INSERT INTO stopword VALUES ('beyond','en'); +INSERT INTO stopword VALUES ('billion','en'); +INSERT INTO stopword VALUES ('biol','en'); +INSERT INTO stopword VALUES ('both','en'); +INSERT INTO stopword VALUES ('briefly','en'); +INSERT INTO stopword VALUES ('but','en'); +INSERT INTO stopword VALUES ('by','en'); +INSERT INTO stopword VALUES ('c','en'); +INSERT INTO stopword VALUES ('ca','en'); +INSERT INTO stopword VALUES ('came','en'); +INSERT INTO stopword VALUES ('can','en'); +INSERT INTO stopword VALUES ('cannot','en'); +INSERT INTO stopword VALUES ('cant','en'); +INSERT INTO stopword VALUES ('certain','en'); +INSERT INTO stopword VALUES ('certainly','en'); +INSERT INTO stopword VALUES ('co','en'); +INSERT INTO stopword VALUES ('co.','en'); +INSERT INTO stopword VALUES ('come','en'); +INSERT INTO stopword VALUES ('contains','en'); +INSERT INTO stopword VALUES ('could','en'); +INSERT INTO stopword VALUES ('couldnt','en'); +INSERT INTO stopword VALUES ('d','en'); +INSERT INTO stopword VALUES ('date','en'); +INSERT INTO stopword VALUES ('did','en'); +INSERT INTO stopword VALUES ('didnt','en'); +INSERT INTO stopword VALUES ('different','en'); +INSERT INTO stopword VALUES ('do','en'); +INSERT INTO stopword VALUES ('does','en'); +INSERT INTO stopword VALUES ('doesnt','en'); +INSERT INTO stopword VALUES ('doing','en'); +INSERT INTO stopword VALUES ('done','en'); +INSERT INTO stopword VALUES ('dont','en'); +INSERT INTO stopword VALUES ('down','en'); +INSERT INTO stopword VALUES ('due','en'); +INSERT INTO stopword VALUES ('during','en'); +INSERT INTO stopword VALUES ('e','en'); +INSERT INTO stopword VALUES ('each','en'); +INSERT INTO stopword VALUES ('ed','en'); +INSERT INTO stopword VALUES ('effect','en'); +INSERT INTO stopword VALUES ('eg','en'); +INSERT INTO stopword VALUES ('eight','en'); +INSERT INTO stopword VALUES ('eighty','en'); +INSERT INTO stopword VALUES ('either','en'); +INSERT INTO stopword VALUES ('else','en'); +INSERT INTO stopword VALUES ('elsewhere','en'); +INSERT INTO stopword VALUES ('end','en'); +INSERT INTO stopword VALUES ('ending','en'); +INSERT INTO stopword VALUES ('enough','en'); +INSERT INTO stopword VALUES ('especially','en'); +INSERT INTO stopword VALUES ('et-al','en'); +INSERT INTO stopword VALUES ('etc','en'); +INSERT INTO stopword VALUES ('even','en'); +INSERT INTO stopword VALUES ('ever','en'); +INSERT INTO stopword VALUES ('every','en'); +INSERT INTO stopword VALUES ('everyone','en'); +INSERT INTO stopword VALUES ('everything','en'); +INSERT INTO stopword VALUES ('everywhere','en'); +INSERT INTO stopword VALUES ('except','en'); +INSERT INTO stopword VALUES ('f','en'); +INSERT INTO stopword VALUES ('far','en'); +INSERT INTO stopword VALUES ('few','en'); +INSERT INTO stopword VALUES ('ff','en'); +INSERT INTO stopword VALUES ('first','en'); +INSERT INTO stopword VALUES ('five','en'); +INSERT INTO stopword VALUES ('fix','en'); +INSERT INTO stopword VALUES ('followed','en'); +INSERT INTO stopword VALUES ('following','en'); +INSERT INTO stopword VALUES ('for','en'); +INSERT INTO stopword VALUES ('former','en'); +INSERT INTO stopword VALUES ('formerly','en'); +INSERT INTO stopword VALUES ('found','en'); +INSERT INTO stopword VALUES ('from','en'); +INSERT INTO stopword VALUES ('further','en'); +INSERT INTO stopword VALUES ('g','en'); +INSERT INTO stopword VALUES ('gave','en'); +INSERT INTO stopword VALUES ('get','en'); +INSERT INTO stopword VALUES ('gets','en'); +INSERT INTO stopword VALUES ('give','en'); +INSERT INTO stopword VALUES ('given','en'); +INSERT INTO stopword VALUES ('giving','en'); +INSERT INTO stopword VALUES ('go','en'); +INSERT INTO stopword VALUES ('goes','en'); +INSERT INTO stopword VALUES ('gone','en'); +INSERT INTO stopword VALUES ('got','en'); +INSERT INTO stopword VALUES ('h','en'); +INSERT INTO stopword VALUES ('had','en'); +INSERT INTO stopword VALUES ('hardly','en'); +INSERT INTO stopword VALUES ('has','en'); +INSERT INTO stopword VALUES ('hasnt','en'); +INSERT INTO stopword VALUES ('have','en'); +INSERT INTO stopword VALUES ('havent','en'); +INSERT INTO stopword VALUES ('having','en'); +INSERT INTO stopword VALUES ('he','en'); +INSERT INTO stopword VALUES ('hed','en'); +INSERT INTO stopword VALUES ('hence','en'); +INSERT INTO stopword VALUES ('her','en'); +INSERT INTO stopword VALUES ('here','en'); +INSERT INTO stopword VALUES ('hereafter','en'); +INSERT INTO stopword VALUES ('hereby','en'); +INSERT INTO stopword VALUES ('herein','en'); +INSERT INTO stopword VALUES ('heres','en'); +INSERT INTO stopword VALUES ('hereupon','en'); +INSERT INTO stopword VALUES ('hers','en'); +INSERT INTO stopword VALUES ('herself','en'); +INSERT INTO stopword VALUES ('hes','en'); +INSERT INTO stopword VALUES ('hid','en'); +INSERT INTO stopword VALUES ('him','en'); +INSERT INTO stopword VALUES ('himself','en'); +INSERT INTO stopword VALUES ('his','en'); +INSERT INTO stopword VALUES ('home','en'); +INSERT INTO stopword VALUES ('how','en'); +INSERT INTO stopword VALUES ('however','en'); +INSERT INTO stopword VALUES ('hundred','en'); +INSERT INTO stopword VALUES ('i','en'); +INSERT INTO stopword VALUES ('id','en'); +INSERT INTO stopword VALUES ('ie','en'); +INSERT INTO stopword VALUES ('if','en'); +INSERT INTO stopword VALUES ('ill','en'); +INSERT INTO stopword VALUES ('im','en'); +INSERT INTO stopword VALUES ('immediately','en'); +INSERT INTO stopword VALUES ('importance','en'); +INSERT INTO stopword VALUES ('important','en'); +INSERT INTO stopword VALUES ('in','en'); +INSERT INTO stopword VALUES ('inc','en'); +INSERT INTO stopword VALUES ('inc.','en'); +INSERT INTO stopword VALUES ('indeed','en'); +INSERT INTO stopword VALUES ('index','en'); +INSERT INTO stopword VALUES ('information','en'); +INSERT INTO stopword VALUES ('instead','en'); +INSERT INTO stopword VALUES ('into','en'); +INSERT INTO stopword VALUES ('invention','en'); +INSERT INTO stopword VALUES ('is','en'); +INSERT INTO stopword VALUES ('isnt','en'); +INSERT INTO stopword VALUES ('it','en'); +INSERT INTO stopword VALUES ('its','en'); +INSERT INTO stopword VALUES ('itself','en'); +INSERT INTO stopword VALUES ('ive','en'); +INSERT INTO stopword VALUES ('j','en'); +INSERT INTO stopword VALUES ('just','en'); +INSERT INTO stopword VALUES ('k','en'); +INSERT INTO stopword VALUES ('keep','en'); +INSERT INTO stopword VALUES ('kept','en'); +INSERT INTO stopword VALUES ('keys','en'); +INSERT INTO stopword VALUES ('kg','en'); +INSERT INTO stopword VALUES ('km','en'); +INSERT INTO stopword VALUES ('l','en'); +INSERT INTO stopword VALUES ('largely','en'); +INSERT INTO stopword VALUES ('last','en'); +INSERT INTO stopword VALUES ('later','en'); +INSERT INTO stopword VALUES ('latter','en'); +INSERT INTO stopword VALUES ('latterly','en'); +INSERT INTO stopword VALUES ('least','en'); +INSERT INTO stopword VALUES ('let','en'); +INSERT INTO stopword VALUES ('lets','en'); +INSERT INTO stopword VALUES ('like','en'); +INSERT INTO stopword VALUES ('likely','en'); +INSERT INTO stopword VALUES ('line','en'); +INSERT INTO stopword VALUES ('ll','en'); +INSERT INTO stopword VALUES ('ltd','en'); +INSERT INTO stopword VALUES ('m','en'); +INSERT INTO stopword VALUES ('made','en'); +INSERT INTO stopword VALUES ('mainly','en'); +INSERT INTO stopword VALUES ('make','en'); +INSERT INTO stopword VALUES ('makes','en'); +INSERT INTO stopword VALUES ('many','en'); +INSERT INTO stopword VALUES ('may','en'); +INSERT INTO stopword VALUES ('maybe','en'); +INSERT INTO stopword VALUES ('me','en'); +INSERT INTO stopword VALUES ('means','en'); +INSERT INTO stopword VALUES ('meantime','en'); +INSERT INTO stopword VALUES ('meanwhile','en'); +INSERT INTO stopword VALUES ('mg','en'); +INSERT INTO stopword VALUES ('might','en'); +INSERT INTO stopword VALUES ('million','en'); +INSERT INTO stopword VALUES ('miss','en'); +INSERT INTO stopword VALUES ('ml','en'); +INSERT INTO stopword VALUES ('more','en'); +INSERT INTO stopword VALUES ('moreover','en'); +INSERT INTO stopword VALUES ('most','en'); +INSERT INTO stopword VALUES ('mostly','en'); +INSERT INTO stopword VALUES ('mr','en'); +INSERT INTO stopword VALUES ('mrs','en'); +INSERT INTO stopword VALUES ('much','en'); +INSERT INTO stopword VALUES ('mug','en'); +INSERT INTO stopword VALUES ('must','en'); +INSERT INTO stopword VALUES ('my','en'); +INSERT INTO stopword VALUES ('myself','en'); +INSERT INTO stopword VALUES ('n','en'); +INSERT INTO stopword VALUES ('na','en'); +INSERT INTO stopword VALUES ('namely','en'); +INSERT INTO stopword VALUES ('nay','en'); +INSERT INTO stopword VALUES ('near','en'); +INSERT INTO stopword VALUES ('nearly','en'); +INSERT INTO stopword VALUES ('necessarily','en'); +INSERT INTO stopword VALUES ('neither','en'); +INSERT INTO stopword VALUES ('never','en'); +INSERT INTO stopword VALUES ('nevertheless','en'); +INSERT INTO stopword VALUES ('new','en'); +INSERT INTO stopword VALUES ('next','en'); +INSERT INTO stopword VALUES ('nine','en'); +INSERT INTO stopword VALUES ('ninety','en'); +INSERT INTO stopword VALUES ('no','en'); +INSERT INTO stopword VALUES ('nobody','en'); +INSERT INTO stopword VALUES ('none','en'); +INSERT INTO stopword VALUES ('nonetheless','en'); +INSERT INTO stopword VALUES ('noone','en'); +INSERT INTO stopword VALUES ('nor','en'); +INSERT INTO stopword VALUES ('normally','en'); +INSERT INTO stopword VALUES ('nos','en'); +INSERT INTO stopword VALUES ('not','en'); +INSERT INTO stopword VALUES ('noted','en'); +INSERT INTO stopword VALUES ('nothing','en'); +INSERT INTO stopword VALUES ('now','en'); +INSERT INTO stopword VALUES ('nowhere','en'); +INSERT INTO stopword VALUES ('o','en'); +INSERT INTO stopword VALUES ('obtain','en'); +INSERT INTO stopword VALUES ('obtained','en'); +INSERT INTO stopword VALUES ('of','en'); +INSERT INTO stopword VALUES ('off','en'); +INSERT INTO stopword VALUES ('often','en'); +INSERT INTO stopword VALUES ('oh','en'); +INSERT INTO stopword VALUES ('omitted','en'); +INSERT INTO stopword VALUES ('on','en'); +INSERT INTO stopword VALUES ('once','en'); +INSERT INTO stopword VALUES ('one','en'); +INSERT INTO stopword VALUES ('ones','en'); +INSERT INTO stopword VALUES ('only','en'); +INSERT INTO stopword VALUES ('onto','en'); +INSERT INTO stopword VALUES ('or','en'); +INSERT INTO stopword VALUES ('ord','en'); +INSERT INTO stopword VALUES ('other','en'); +INSERT INTO stopword VALUES ('others','en'); +INSERT INTO stopword VALUES ('otherwise','en'); +INSERT INTO stopword VALUES ('ought','en'); +INSERT INTO stopword VALUES ('our','en'); +INSERT INTO stopword VALUES ('ours','en'); +INSERT INTO stopword VALUES ('ourselves','en'); +INSERT INTO stopword VALUES ('out','en'); +INSERT INTO stopword VALUES ('over','en'); +INSERT INTO stopword VALUES ('overall','en'); +INSERT INTO stopword VALUES ('owing','en'); +INSERT INTO stopword VALUES ('own','en'); +INSERT INTO stopword VALUES ('p','en'); +INSERT INTO stopword VALUES ('page','en'); +INSERT INTO stopword VALUES ('pages','en'); +INSERT INTO stopword VALUES ('part','en'); +INSERT INTO stopword VALUES ('particularly','en'); +INSERT INTO stopword VALUES ('past','en'); +INSERT INTO stopword VALUES ('per','en'); +INSERT INTO stopword VALUES ('perhaps','en'); +INSERT INTO stopword VALUES ('please','en'); +INSERT INTO stopword VALUES ('poorly','en'); +INSERT INTO stopword VALUES ('possible','en'); +INSERT INTO stopword VALUES ('possibly','en'); +INSERT INTO stopword VALUES ('potentially','en'); +INSERT INTO stopword VALUES ('pp','en'); +INSERT INTO stopword VALUES ('predominantly','en'); +INSERT INTO stopword VALUES ('present','en'); +INSERT INTO stopword VALUES ('previously','en'); +INSERT INTO stopword VALUES ('primarily','en'); +INSERT INTO stopword VALUES ('probably','en'); +INSERT INTO stopword VALUES ('promptly','en'); +INSERT INTO stopword VALUES ('proud','en'); +INSERT INTO stopword VALUES ('put','en'); +INSERT INTO stopword VALUES ('q','en'); +INSERT INTO stopword VALUES ('quickly','en'); +INSERT INTO stopword VALUES ('quite','en'); +INSERT INTO stopword VALUES ('r','en'); +INSERT INTO stopword VALUES ('ran','en'); +INSERT INTO stopword VALUES ('rather','en'); +INSERT INTO stopword VALUES ('re','en'); +INSERT INTO stopword VALUES ('readily','en'); +INSERT INTO stopword VALUES ('really','en'); +INSERT INTO stopword VALUES ('recent','en'); +INSERT INTO stopword VALUES ('recently','en'); +INSERT INTO stopword VALUES ('ref','en'); +INSERT INTO stopword VALUES ('refs','en'); +INSERT INTO stopword VALUES ('regardless','en'); +INSERT INTO stopword VALUES ('related','en'); +INSERT INTO stopword VALUES ('relatively','en'); +INSERT INTO stopword VALUES ('research','en'); +INSERT INTO stopword VALUES ('respectively','en'); +INSERT INTO stopword VALUES ('resulted','en'); +INSERT INTO stopword VALUES ('resulting','en'); +INSERT INTO stopword VALUES ('results','en'); +INSERT INTO stopword VALUES ('run','en'); +INSERT INTO stopword VALUES ('s','en'); +INSERT INTO stopword VALUES ('said','en'); +INSERT INTO stopword VALUES ('same','en'); +INSERT INTO stopword VALUES ('say','en'); +INSERT INTO stopword VALUES ('sec','en'); +INSERT INTO stopword VALUES ('section','en'); +INSERT INTO stopword VALUES ('seem','en'); +INSERT INTO stopword VALUES ('seemed','en'); +INSERT INTO stopword VALUES ('seeming','en'); +INSERT INTO stopword VALUES ('seems','en'); +INSERT INTO stopword VALUES ('seen','en'); +INSERT INTO stopword VALUES ('seven','en'); +INSERT INTO stopword VALUES ('several','en'); +INSERT INTO stopword VALUES ('shall','en'); +INSERT INTO stopword VALUES ('she','en'); +INSERT INTO stopword VALUES ('shed','en'); +INSERT INTO stopword VALUES ('shell','en'); +INSERT INTO stopword VALUES ('shes','en'); +INSERT INTO stopword VALUES ('should','en'); +INSERT INTO stopword VALUES ('shouldnt','en'); +INSERT INTO stopword VALUES ('show','en'); +INSERT INTO stopword VALUES ('showed','en'); +INSERT INTO stopword VALUES ('shown','en'); +INSERT INTO stopword VALUES ('showns','en'); +INSERT INTO stopword VALUES ('shows','en'); +INSERT INTO stopword VALUES ('significant','en'); +INSERT INTO stopword VALUES ('significantly','en'); +INSERT INTO stopword VALUES ('similar','en'); +INSERT INTO stopword VALUES ('similarly','en'); +INSERT INTO stopword VALUES ('since','en'); +INSERT INTO stopword VALUES ('six','en'); +INSERT INTO stopword VALUES ('slightly','en'); +INSERT INTO stopword VALUES ('so','en'); +INSERT INTO stopword VALUES ('some','en'); +INSERT INTO stopword VALUES ('somehow','en'); +INSERT INTO stopword VALUES ('someone','en'); +INSERT INTO stopword VALUES ('somethan','en'); +INSERT INTO stopword VALUES ('something','en'); +INSERT INTO stopword VALUES ('sometime','en'); +INSERT INTO stopword VALUES ('sometimes','en'); +INSERT INTO stopword VALUES ('somewhat','en'); +INSERT INTO stopword VALUES ('somewhere','en'); +INSERT INTO stopword VALUES ('soon','en'); +INSERT INTO stopword VALUES ('specifically','en'); +INSERT INTO stopword VALUES ('state','en'); +INSERT INTO stopword VALUES ('states','en'); +INSERT INTO stopword VALUES ('still','en'); +INSERT INTO stopword VALUES ('stop','en'); +INSERT INTO stopword VALUES ('strongly','en'); +INSERT INTO stopword VALUES ('substantially','en'); +INSERT INTO stopword VALUES ('successfully','en'); +INSERT INTO stopword VALUES ('such','en'); +INSERT INTO stopword VALUES ('sufficiently','en'); +INSERT INTO stopword VALUES ('suggest','en'); +INSERT INTO stopword VALUES ('t','en'); +INSERT INTO stopword VALUES ('taking','en'); +INSERT INTO stopword VALUES ('than','en'); +INSERT INTO stopword VALUES ('that','en'); +INSERT INTO stopword VALUES ('thatll','en'); +INSERT INTO stopword VALUES ('thats','en'); +INSERT INTO stopword VALUES ('thatve','en'); +INSERT INTO stopword VALUES ('the','en'); +INSERT INTO stopword VALUES ('their','en'); +INSERT INTO stopword VALUES ('theirs','en'); +INSERT INTO stopword VALUES ('them','en'); +INSERT INTO stopword VALUES ('themselves','en'); +INSERT INTO stopword VALUES ('then','en'); +INSERT INTO stopword VALUES ('thence','en'); +INSERT INTO stopword VALUES ('there','en'); +INSERT INTO stopword VALUES ('thereafter','en'); +INSERT INTO stopword VALUES ('thereby','en'); +INSERT INTO stopword VALUES ('thered','en'); +INSERT INTO stopword VALUES ('therefore','en'); +INSERT INTO stopword VALUES ('therein','en'); +INSERT INTO stopword VALUES ('therell','en'); +INSERT INTO stopword VALUES ('thereof','en'); +INSERT INTO stopword VALUES ('therere','en'); +INSERT INTO stopword VALUES ('theres','en'); +INSERT INTO stopword VALUES ('thereto','en'); +INSERT INTO stopword VALUES ('thereupon','en'); +INSERT INTO stopword VALUES ('thereve','en'); +INSERT INTO stopword VALUES ('these','en'); +INSERT INTO stopword VALUES ('they','en'); +INSERT INTO stopword VALUES ('theyd','en'); +INSERT INTO stopword VALUES ('theyll','en'); +INSERT INTO stopword VALUES ('theyre','en'); +INSERT INTO stopword VALUES ('theyve','en'); +INSERT INTO stopword VALUES ('this','en'); +INSERT INTO stopword VALUES ('those','en'); +INSERT INTO stopword VALUES ('thou','en'); +INSERT INTO stopword VALUES ('though','en'); +INSERT INTO stopword VALUES ('thoughh','en'); +INSERT INTO stopword VALUES ('thousand','en'); +INSERT INTO stopword VALUES ('throug','en'); +INSERT INTO stopword VALUES ('through','en'); +INSERT INTO stopword VALUES ('throughout','en'); +INSERT INTO stopword VALUES ('thru','en'); +INSERT INTO stopword VALUES ('thus','en'); +INSERT INTO stopword VALUES ('til','en'); +INSERT INTO stopword VALUES ('tip','en'); +INSERT INTO stopword VALUES ('to','en'); +INSERT INTO stopword VALUES ('together','en'); +INSERT INTO stopword VALUES ('too','en'); +INSERT INTO stopword VALUES ('toward','en'); +INSERT INTO stopword VALUES ('towards','en'); +INSERT INTO stopword VALUES ('trillion','en'); +INSERT INTO stopword VALUES ('try','en'); +INSERT INTO stopword VALUES ('two','en'); +INSERT INTO stopword VALUES ('u','en'); +INSERT INTO stopword VALUES ('under','en'); +INSERT INTO stopword VALUES ('unless','en'); +INSERT INTO stopword VALUES ('unlike','en'); +INSERT INTO stopword VALUES ('unlikely','en'); +INSERT INTO stopword VALUES ('until','en'); +INSERT INTO stopword VALUES ('unto','en'); +INSERT INTO stopword VALUES ('up','en'); +INSERT INTO stopword VALUES ('upon','en'); +INSERT INTO stopword VALUES ('ups','en'); +INSERT INTO stopword VALUES ('us','en'); +INSERT INTO stopword VALUES ('use','en'); +INSERT INTO stopword VALUES ('used','en'); +INSERT INTO stopword VALUES ('usefully','en'); +INSERT INTO stopword VALUES ('usefulness','en'); +INSERT INTO stopword VALUES ('using','en'); +INSERT INTO stopword VALUES ('usually','en'); +INSERT INTO stopword VALUES ('v','en'); +INSERT INTO stopword VALUES ('various','en'); +INSERT INTO stopword VALUES ('ve','en'); +INSERT INTO stopword VALUES ('very','en'); +INSERT INTO stopword VALUES ('via','en'); +INSERT INTO stopword VALUES ('vol','en'); +INSERT INTO stopword VALUES ('vols','en'); +INSERT INTO stopword VALUES ('vs','en'); +INSERT INTO stopword VALUES ('w','en'); +INSERT INTO stopword VALUES ('was','en'); +INSERT INTO stopword VALUES ('wasnt','en'); +INSERT INTO stopword VALUES ('way','en'); +INSERT INTO stopword VALUES ('we','en'); +INSERT INTO stopword VALUES ('web','en'); +INSERT INTO stopword VALUES ('wed','en'); +INSERT INTO stopword VALUES ('well','en'); +INSERT INTO stopword VALUES ('were','en'); +INSERT INTO stopword VALUES ('werent','en'); +INSERT INTO stopword VALUES ('weve','en'); +INSERT INTO stopword VALUES ('what','en'); +INSERT INTO stopword VALUES ('whatever','en'); +INSERT INTO stopword VALUES ('whatll','en'); +INSERT INTO stopword VALUES ('whats','en'); +INSERT INTO stopword VALUES ('whatve','en'); +INSERT INTO stopword VALUES ('when','en'); +INSERT INTO stopword VALUES ('whence','en'); +INSERT INTO stopword VALUES ('whenever','en'); +INSERT INTO stopword VALUES ('where','en'); +INSERT INTO stopword VALUES ('whereafter','en'); +INSERT INTO stopword VALUES ('whereas','en'); +INSERT INTO stopword VALUES ('whereby','en'); +INSERT INTO stopword VALUES ('wherein','en'); +INSERT INTO stopword VALUES ('wheres','en'); +INSERT INTO stopword VALUES ('whereupon','en'); +INSERT INTO stopword VALUES ('wherever','en'); +INSERT INTO stopword VALUES ('whether','en'); +INSERT INTO stopword VALUES ('which','en'); +INSERT INTO stopword VALUES ('while','en'); +INSERT INTO stopword VALUES ('whim','en'); +INSERT INTO stopword VALUES ('whither','en'); +INSERT INTO stopword VALUES ('who','en'); +INSERT INTO stopword VALUES ('whod','en'); +INSERT INTO stopword VALUES ('whoever','en'); +INSERT INTO stopword VALUES ('whole','en'); +INSERT INTO stopword VALUES ('wholl','en'); +INSERT INTO stopword VALUES ('whom','en'); +INSERT INTO stopword VALUES ('whomever','en'); +INSERT INTO stopword VALUES ('whos','en'); +INSERT INTO stopword VALUES ('whose','en'); +INSERT INTO stopword VALUES ('why','en'); +INSERT INTO stopword VALUES ('widely','en'); +INSERT INTO stopword VALUES ('will','en'); +INSERT INTO stopword VALUES ('with','en'); +INSERT INTO stopword VALUES ('within','en'); +INSERT INTO stopword VALUES ('without','en'); +INSERT INTO stopword VALUES ('wont','en'); +INSERT INTO stopword VALUES ('words','en'); +INSERT INTO stopword VALUES ('world','en'); +INSERT INTO stopword VALUES ('would','en'); +INSERT INTO stopword VALUES ('wouldnt','en'); +INSERT INTO stopword VALUES ('www','en'); +INSERT INTO stopword VALUES ('x','en'); +INSERT INTO stopword VALUES ('y','en'); +INSERT INTO stopword VALUES ('yes','en'); +INSERT INTO stopword VALUES ('yet','en'); +INSERT INTO stopword VALUES ('you','en'); +INSERT INTO stopword VALUES ('youd','en'); +INSERT INTO stopword VALUES ('youll','en'); +INSERT INTO stopword VALUES ('your','en'); +INSERT INTO stopword VALUES ('youre','en'); +INSERT INTO stopword VALUES ('yours','en'); +INSERT INTO stopword VALUES ('yourself','en'); +INSERT INTO stopword VALUES ('yourselves','en'); +INSERT INTO stopword VALUES ('youve','en'); +INSERT INTO stopword VALUES ('z','en'); + +# +# Table structure for table 'style' +# + +CREATE TABLE style ( + styleId int(11) NOT NULL default '0', + name varchar(30) default NULL, + header text, + footer text, + styleSheet text, + PRIMARY KEY (styleId) +) TYPE=MyISAM; + +# +# Dumping data for table 'style' +# + +INSERT INTO style VALUES (1,'Reserved','\r\n
^C^D
\r\n
\r\nhorizontal top level menu: ^t\r\n
\r\nhorizontal current level menu: ^m\r\n
\r\n
\r\nvertical top level menu: ^T
\r\n
\r\nvertical current level menu: ^M
\r\n\r\n\r\n
\r\n\r\n','\r\n^@
\r\n^#
\r\n^*
\r\n^?
\r\n
\r\n\r\n\r\n',''); +INSERT INTO style VALUES (2,'Fail Safe','\r\n^H / ^t / ^m / ^a\r\n
','
\r\n^H / ^t / ^m / ^a\r\n',''); +INSERT INTO style VALUES (3,'Plain Black Software','\r\n
^C^D
\r\n
\r\nuser: ^@\r\n
\r\n^T\r\n
\r\n^M\r\n
\r\n\r\n','

\r\n^H / ^a\r\n',''); +INSERT INTO style VALUES (4,'Reserved','','',NULL); +INSERT INTO style VALUES (5,'Reserved','','',NULL); +INSERT INTO style VALUES (6,'Reserved','','',NULL); +INSERT INTO style VALUES (7,'Reserved','','',NULL); +INSERT INTO style VALUES (8,'Reserved','','',NULL); +INSERT INTO style VALUES (9,'Reserved','','',NULL); +INSERT INTO style VALUES (10,'Reserved','','',NULL); +INSERT INTO style VALUES (11,'Reserved','','',NULL); +INSERT INTO style VALUES (12,'Reserved','','',NULL); +INSERT INTO style VALUES (13,'Reserved','','',NULL); +INSERT INTO style VALUES (14,'Reserved','','',NULL); +INSERT INTO style VALUES (15,'Reserved','','',NULL); +INSERT INTO style VALUES (16,'Reserved','','',NULL); +INSERT INTO style VALUES (17,'Reserved','','',NULL); +INSERT INTO style VALUES (18,'Reserved','','',NULL); +INSERT INTO style VALUES (19,'Reserved','','',NULL); +INSERT INTO style VALUES (20,'Reserved','','',NULL); +INSERT INTO style VALUES (21,'Reserved','','',NULL); +INSERT INTO style VALUES (22,'Reserved','','',NULL); +INSERT INTO style VALUES (23,'Reserved','','',NULL); +INSERT INTO style VALUES (24,'Reserved','','',NULL); +INSERT INTO style VALUES (25,'Yahoo!','Yahoo!\r\n\r\n
Yahoo
\r\nnew! Y! Domains
reserve .biz & .info domains
\"\"Yahoo! Mail
you@yahoo.com
\r\n advanced search
\r\n
\r\n
\r\n','
\r\n
How to Suggest a Site -\r\nCompany Info -\r\nCopyright Policy -\r\nTerms of Service -\r\nContributors -\r\nJobs -\r\nAdvertising

Copyright © 2001 Yahoo! Inc. All rights reserved.
Privacy Policy

\r\n',''); + +# +# Table structure for table 'url' +# + +CREATE TABLE url ( + rec_id int(11) NOT NULL auto_increment, + status int(11) NOT NULL default '0', + url varchar(128) NOT NULL default '', + content_type varchar(48) NOT NULL default '', + title varchar(128) NOT NULL default '', + txt varchar(255) NOT NULL default '', + docsize int(11) NOT NULL default '0', + last_index_time int(11) NOT NULL default '0', + next_index_time int(11) NOT NULL default '0', + last_mod_time int(11) NOT NULL default '0', + referrer int(11) NOT NULL default '0', + tag varchar(11) NOT NULL default '0', + hops int(11) NOT NULL default '0', + category varchar(11) NOT NULL default '', + keywords varchar(255) NOT NULL default '', + description varchar(100) NOT NULL default '', + crc32 int(11) NOT NULL default '0', + lang char(2) NOT NULL default '', + PRIMARY KEY (rec_id), + UNIQUE KEY url (url), + KEY key_crc (crc32) +) TYPE=MyISAM; + +# +# Dumping data for table 'url' +# + + +# +# Table structure for table 'user' +# + +CREATE TABLE user ( + userId int(11) NOT NULL default '0', + username varchar(35) default NULL, + identifier varchar(35) default NULL, + email varchar(255) default NULL, + icq varchar(30) default NULL, + PRIMARY KEY (userId) +) TYPE=MyISAM; + +# +# Dumping data for table 'user' +# + +INSERT INTO user VALUES (1,'Visitor','No Login','',''); +INSERT INTO user VALUES (2,'Reserved','No Login',NULL,NULL); +INSERT INTO user VALUES (3,'Admin','RvlMjeFPs2aAhQdo/xt/Kg','',''); +INSERT INTO user VALUES (4,'Reserved','No Login',NULL,NULL); +INSERT INTO user VALUES (5,'Reserved','No Login',NULL,NULL); +INSERT INTO user VALUES (6,'Reserved','No Login',NULL,NULL); +INSERT INTO user VALUES (7,'Reserved','No Login',NULL,NULL); +INSERT INTO user VALUES (8,'Reserved','No Login',NULL,NULL); +INSERT INTO user VALUES (9,'Reserved','No Login',NULL,NULL); +INSERT INTO user VALUES (10,'Reserved','No Login',NULL,NULL); +INSERT INTO user VALUES (11,'Reserved','No Login',NULL,NULL); +INSERT INTO user VALUES (12,'Reserved','No Login',NULL,NULL); +INSERT INTO user VALUES (13,'Reserved','No Login',NULL,NULL); +INSERT INTO user VALUES (14,'Reserved','No Login',NULL,NULL); +INSERT INTO user VALUES (15,'Reserved','No Login',NULL,NULL); +INSERT INTO user VALUES (16,'Reserved','No Login',NULL,NULL); +INSERT INTO user VALUES (17,'Reserved','No Login',NULL,NULL); +INSERT INTO user VALUES (18,'Reserved','No Login',NULL,NULL); +INSERT INTO user VALUES (19,'Reserved','No Login',NULL,NULL); +INSERT INTO user VALUES (20,'Reserved','No Login',NULL,NULL); +INSERT INTO user VALUES (21,'Reserved','No Login',NULL,NULL); +INSERT INTO user VALUES (22,'Reserved','No Login',NULL,NULL); +INSERT INTO user VALUES (23,'Reserved','No Login',NULL,NULL); +INSERT INTO user VALUES (24,'Reserved','No Login',NULL,NULL); +INSERT INTO user VALUES (25,'Reserved','No Login',NULL,NULL); + +# +# Table structure for table 'widget' +# + +CREATE TABLE widget ( + widgetId int(11) NOT NULL default '0', + pageId int(11) default NULL, + widgetType varchar(35) default NULL, + sequenceNumber int(11) NOT NULL default '1', + title varchar(255) default NULL, + displayTitle int(11) NOT NULL default '1', + description text, + processMacros int(11) NOT NULL default '0', + PRIMARY KEY (widgetId) +) TYPE=MyISAM; + +# +# Dumping data for table 'widget' +# + + diff --git a/docs/legal.txt b/docs/legal.txt new file mode 100644 index 000000000..312bcecf3 --- /dev/null +++ b/docs/legal.txt @@ -0,0 +1,22 @@ +WebGUI is Copyright 2001 Plain Black Software. All rights reserved. + +WebGUI is a trademark of Plain Black Software. + +WebGUI may be distributed under the GNU General Public license. A copy of that license is distributed with this code in a file called "license.txt". If you are unable to retrieve that license for any reason, you may find a copy of it here: http://www.opensource.org/licenses/gpl-license.html + +For more information about Plain Black Software or WebGUI, please visit http://www.plainblack.com or email info@plainblack.com. + +It is illegal to remove or tamper with the notices at the top of each file, or this file, or the license file. The notice at the top of each file looks like the following: + +#------------------------------------------------------------------- +# WebGUI is Copyright 2001 Plain Black Software. +#------------------------------------------------------------------- +# Please read the legal notices (docs/legal.txt) and the license +# (docs/license.txt) that came with this distribution before using +# this software. +#------------------------------------------------------------------- +# http://www.plainblack.com info@plainblack.com +#------------------------------------------------------------------- + + + diff --git a/docs/licence.txt b/docs/licence.txt new file mode 100644 index 000000000..0d172a20d --- /dev/null +++ b/docs/licence.txt @@ -0,0 +1,90 @@ +The General Public License (GPL) +Version 2, June 1991 +Copyright (C) 1989, 1991 Free Software Foundation, Inc. 675 Mass Ave, Cambridge, MA 02139, USA. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. + +Preamble + +The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.) You can apply it to your programs, too. + +When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. + +To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. + +For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. + +We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. + +Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. + +Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. + +The precise terms and conditions for copying, distribution and modification follow. + +GNU GENERAL PUBLIC LICENSE +TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + +0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. + +1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. + +You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. + +2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: + +a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. + +b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. + +c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. + +3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: + +a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, + +b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, + +c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. + +If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. + +4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. + +5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. + +6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. + +7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. + +It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. + +This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. + +8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. + +9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. + +Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. + +10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. + +NO WARRANTY + +11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + +12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + +END OF TERMS AND CONDITIONS + + diff --git a/etc/WebGUI.conf b/etc/WebGUI.conf new file mode 100644 index 000000000..4c49d0c93 --- /dev/null +++ b/etc/WebGUI.conf @@ -0,0 +1,3 @@ +dsn = DBI:mysql:WebGUI +dbuser = webgui +dbpass = password diff --git a/extras/WebGUI.js b/extras/WebGUI.js new file mode 100644 index 000000000..69ee5a7de --- /dev/null +++ b/extras/WebGUI.js @@ -0,0 +1,82 @@ +/* + +#------------------------------------------------------------------- +# WebGUI is Copyright 2001 Plain Black Software. +#------------------------------------------------------------------- +# Please read the legal notices (docs/legal.txt) and the license +# (docs/license.txt) that came with this distribution before using +# this software. +#------------------------------------------------------------------- +# http://www.plainblack.com info@plainblack.com +#------------------------------------------------------------------- + +*/ + +var color; +var formObj; + +function boldText(obj) { + obj.value = obj.value+''+prompt("Enter the text to bold:", "")+''; +} + +function centerText(obj) { + obj.value = obj.value+'
'+prompt("Enter the text to center:", "")+'
'; +} + +function colorText(obj) { + formObj = obj; + window.open("/lib/colorPicker.html","colorPicker","width=438,height=258"); +} + +function copyright(obj) { + obj.value = obj.value+'©'; +} + +function email(obj) { + var email = prompt("Enter the Email address:", ""); + obj.value = obj.value+''+email+''; +} + +function getShowMeText() { + return formObj.value; +} + +function image(obj) { + obj.value = obj.value+''; +} + +function italicText(obj) { + obj.value = obj.value+''+prompt("Enter the text to italicize:", "")+''; +} + +function list(obj) { + var item; + obj.value = obj.value+''; +} + +function registered(obj) { + obj.value = obj.value+'®'; +} + +function setColor(remoteColor) { + formObj.value = formObj.value+''+prompt("Enter the text to color:","")+''; +} + +function showMe(obj) { + formObj = obj; + window.open("/lib/viewer.html","showMeViewer","width=500,height=300,scrollbars=1"); +} + +function trademark(obj) { + obj.value = obj.value+'TM'; +} + +function url(obj) { + obj.value = obj.value+''+prompt("Enter the title of the link:", "Google")+''; +} + diff --git a/extras/calendar.html b/extras/calendar.html new file mode 100644 index 000000000..930062972 --- /dev/null +++ b/extras/calendar.html @@ -0,0 +1,320 @@ + + + + +Calendar + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + +
+
+
+ + + + + +
+
Su
Mo
Tu
We
Th
Fr
Sa
+ + +
+ + diff --git a/extras/colorPicker.gif b/extras/colorPicker.gif new file mode 100644 index 0000000000000000000000000000000000000000..a36307109fcf18a2d351e89b889bd4bc30df963b GIT binary patch literal 15962 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 + +Color Picker + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/extras/cut.gif b/extras/cut.gif new file mode 100644 index 0000000000000000000000000000000000000000..22df7b9ea04cb9609dfee266352e5e6d17f46664 GIT binary patch literal 904 zcmZ?wbhEHblwsg!_|5Yc089_{4p(oO_qa&W%Y&I>i%L@pyiE>eX%( z_-u=0@zOJMIg9&ZW_*5rs>ii=l?Z2vru%Z0%v~%mwkSMH)&TS= BEztk~ literal 0 HcmV?d00001 diff --git a/extras/delete.gif b/extras/delete.gif new file mode 100644 index 0000000000000000000000000000000000000000..7f9282ab9c41a29d259bf63a333634bbe6a42838 GIT binary patch literal 863 zcmZ?wbhEHbq|#K>d96C@l81=3zwc~5l+1q OlW}>0KO-X}gEasgbr(_q literal 0 HcmV?d00001 diff --git a/extras/edit.gif b/extras/edit.gif new file mode 100644 index 0000000000000000000000000000000000000000..1f3195f7467f075fe84ed3d5e511054911a49b8c GIT binary patch literal 913 zcmZ?wbhEHblxN^)_|5-T0PESEz~Sz=0=SRlleN^Om=NhJ#$&^RgUuX_8Zjp} zEIi!K%gV$dut3qZgIhmo$_m3|*B)VerzaXgiS8ZhvXiz%OiDW4FK#`l#PjlE?|!w+ zx;ZO_mwEI$B*(>^G+1$Nj>klyqmrL8PAu`CuI6hQn&G%0?mUeett9Q8Wq1_eyY%C1c0O|BMbpQYW literal 0 HcmV?d00001 diff --git a/extras/leftArrow.gif b/extras/leftArrow.gif new file mode 100644 index 0000000000000000000000000000000000000000..1a4d5aa85613aa00bca33bf7528b95d5f6893901 GIT binary patch literal 864 zcmZ?wbhEHbf)9`NO4!!1+$?x#P`0L&dYRxOiX5 JNC+@k0|0R_5?cTO literal 0 HcmV?d00001 diff --git a/extras/rightArrow.gif b/extras/rightArrow.gif new file mode 100644 index 0000000000000000000000000000000000000000..b141a4189a0944a6102e3fdff6cc0fd84a65e831 GIT binary patch literal 862 zcmZ?wbhEHb*MXfzQ3>Le!$k^7g6a=QYPGA?D^+%)d>B(t&fn_C}8x_xX$;cX+ MoCr>EU|_HY0IC8M0{{R3 literal 0 HcmV?d00001 diff --git a/extras/viewer.html b/extras/viewer.html new file mode 100644 index 000000000..2e6d2c7e8 --- /dev/null +++ b/extras/viewer.html @@ -0,0 +1,34 @@ + + + + +ShowMe Viewer + + + + + + +
+ +
+ + + diff --git a/lib/WebGUI.pm b/lib/WebGUI.pm new file mode 100644 index 000000000..f8dbf6101 --- /dev/null +++ b/lib/WebGUI.pm @@ -0,0 +1,165 @@ +package WebGUI; + +#------------------------------------------------------------------- +# WebGUI is Copyright 2001 Plain Black Software. +#------------------------------------------------------------------- +# Please read the legal notices (docs/legal.txt) and the license +# (docs/license.txt) that came with this distribution before using +# this software. +#------------------------------------------------------------------- +# http://www.plainblack.com info@plainblack.com +#------------------------------------------------------------------- + +use strict qw(vars subs); +use Tie::IxHash; +use WebGUI::Operation; +use WebGUI::Privilege; +use WebGUI::Session; +use WebGUI::SQL; +use WebGUI::Style; + +#------------------------------------------------------------------- +sub _displayAdminBar { + my ($widgetName, $key, %hash2, $miscSelect, $adminSelect, $clipboardSelect, $widget, @widgetArray, %hash, $output, $contentSelect); + tie %hash, "Tie::IxHash"; + tie %hash2, "Tie::IxHash"; + #--content adder + @widgetArray = @_; + $hash2{$session{page}{url}} = "Add content..."; + $hash2{$session{page}{url}.'?op=addPage'} = 'Page'; + foreach $widget (@widgetArray) { + $widgetName = "WebGUI::Widget::".$widget."::widgetName"; + $hash2{$session{page}{url}.'?func=add&widget='.$widget} = &$widgetName; + } + $contentSelect = WebGUI::Form::selectList("contentSelect",\%hash2,"","","","goContent()"); + #--clipboard paster + %hash2 = ( $session{page}{url}=> "Paste from clipboard..." ); + %hash = WebGUI::SQL->buildHash("select pageId,title from page where parentId=2 order by title",$session{dbh}); + foreach $key (keys %hash) { + $hash2{$session{page}{url}.'?op=pastePage&pageId='.$key} = $hash{$key}; + } + %hash = WebGUI::SQL->buildHash("select widgetId,title from widget where pageId=2 order by title",$session{dbh}); + foreach $key (keys %hash) { + $hash2{$session{page}{url}.'?func=paste&wid='.$key} = $hash{$key}; + } + $clipboardSelect = WebGUI::Form::selectList("clipboardSelect",\%hash2,"","","","goClipboard()"); + #--admin functions + %hash = ( $session{page}{url}=>'Manage...', + $session{env}{SCRIPT_NAME}.'/clipboard'=>'Clipboard', + $session{page}{url}.'?op=listGroups'=>'Groups', + $session{page}{url}.'?op=editSettings'=>'Settings', + $session{page}{url}.'?op=listStyles'=>'Styles', + $session{env}{SCRIPT_NAME}.'/trash'=>'Trash', + $session{page}{url}.'?op=listUsers'=>'Users' + ); + $adminSelect = WebGUI::Form::selectList("adminSelect",\%hash,"","","","goAdmin()"); + #--misc functions + %hash = ( $session{page}{url}=>'Miscellaneous functions...', + $session{page}{url}.'?op=switchOffAdmin'=>'Turn Admin Off', + $session{page}{url}.'?op=viewHelpIndex'=>'View Help Index' + ); + $miscSelect = WebGUI::Form::selectList("miscSelect",\%hash,"","","","goMisc()"); + #--output admin bar + $output = ' +
+ + + + '; + if (WebGUI::Privilege::isInGroup(3,$session{user}{userId})) { + $output .= ' '; + } + $output .= ' + +
'.$contentSelect.'
'.$clipboardSelect.'
'.$adminSelect.'
'.$miscSelect.'
+ '; + return $output; +} + +#------------------------------------------------------------------- +sub _loadWidgets { + my (@files, $file, $use, @widget, $i); + opendir (DIR,"../lib/WebGUI/Widget") or die "Can't get widget directory!\n"; + @files = readdir(DIR); + foreach $file (@files) { + unless ($file eq "." || $file eq "..") { + $file =~ s/\.pm//; + $widget[$i] = $file; + $use = "use WebGUI::Widget::".$widget[$i]; + eval($use); + $i++; + } + } + closedir(DIR); + return @widget; +} + +#------------------------------------------------------------------- +sub page { + my ($preContent, $postContent, $widgetType, $function, $functionOutput, $widget, @availableWidgets, @widgetList, $sth, $httpHeader, $header, $footer, $content, $operationOutput, $operation, $adminBar); + WebGUI::Session::open(); + $preContent = '
'; + $postContent = '
'; + @availableWidgets = _loadWidgets(); + if (exists $session{form}{op}) { + $operation = "WebGUI::Operation::www_".$session{form}{op}; + $operationOutput = &$operation(); + } + if (exists $session{form}{func}) { + if (exists $session{form}{widget}) { + $widgetType = $session{form}{widget}; + } else { + ($widgetType) = WebGUI::SQL->quickArray("select widgetType from widget where widgetId='$session{form}{wid}'",$session{dbh}); + } + $function = "WebGUI::Widget::".$widgetType."::www_".$session{form}{func}; + $functionOutput = &$function(); + } + if ($operationOutput ne "") { + $content = $operationOutput; + } elsif ($functionOutput ne "") { + $content = $functionOutput; + } else { + #if (WebGUI::Privilege::canViewPage($session{page}{pageId})) { + if (WebGUI::Privilege::canViewPage()) { + if ($session{var}{adminOn}) { + $content .= ''; + } + $sth = WebGUI::SQL->read("select widgetId, widgetType from widget where pageId=".$session{page}{pageId}." order by sequenceNumber, widgetId",$session{dbh}); + while (@widgetList = $sth->array) { + if ($session{var}{adminOn}) { + $content .= '

'; + } + $widget = "WebGUI::Widget::".$widgetList[1]."::www_view"; + $content .= &$widget($widgetList[0])."

"; + } + $sth->finish; + } else { + $content = '

Permission Denied!

You do not have sufficient privileges to access this page. '; + } + } + if ($session{var}{adminOn}) { + $adminBar = _displayAdminBar(@availableWidgets); + } + $httpHeader = WebGUI::Session::httpHeader(); + ($header, $footer) = WebGUI::Style::getStyle(); + WebGUI::Session::close(); + return $httpHeader.$adminBar.$header.$preContent.$content.$postContent.$footer; +} + + + + +1; diff --git a/lib/WebGUI/Config.pm b/lib/WebGUI/Config.pm new file mode 100644 index 000000000..789b2b2b1 --- /dev/null +++ b/lib/WebGUI/Config.pm @@ -0,0 +1,650 @@ +package WebGUI::Config; +# This package was originally Data::Config + +use strict; +use Carp; +use FileHandle; + +use vars qw($CLASS $VERSION); +$CLASS = 'WebGUI::Config'; +$VERSION = '0.8.3'; + +=head1 NAME + +Data::Config - Module that can read easy-to-use configuration files + +=head1 SYNOPSIS + +Lets say you have a file F + + name = John Doe + email = doe@somewhere.net + server = mail.somewhere.net + signature = - + John Doe + -- + Visit my homepage at http://www.somewhere.net/~doe/ + . + +You can read it using the following program: + + use Data::Source; + my $mailconf = new Data::Source 'mail.conf'; + +and you can for example print the signature: + + print $mailconf->param('signature'); + + + +=head1 DESCRIPTION + +This module has been writen in order to provide an easy way to read +simple configuration files. The format of these configuration files is +itself extremely easy to understand, so that it can be used even by +non-tech people (I hope!). + +One of the reason I wrote this module is that I wanted a very easy way +to feed data to HTML::Template-based scripts. Therefore, the API of +Data::Config is compatible with HTML::Template, and you can write +programs as simple as: + + use strict; + use Data::Config; + use HTML::template; + + my $source = new Data::Config 'file.src'; + my $tmpl = new HTML::Template type => 'filename', + source => 'file.tmpl', associate => $source; + print $tmpl->output; + +=head2 Syntax + +The syntax of the configuration files is pretty simple. To affect a +value to a parameter, just write: + + param = value of param + +The parameter C will have the value "value of param". +You can also give multi-lines values this way: + + text = - + Perl is a language optimized for scanning arbitrary text files, + extracting information from those text files, and printing + reports based on that information. It's also a good language + for many system management tasks. The language is intended to + be practical (easy to use, efficient, complete) rather than + beautiful (tiny, elegant, minimal). + + [from perl(1)] + . + +Think of this as a "Unix-inspired" syntax. Instead of giving the value, +you write '-' to mean "the value will follow" (in Unix, this means the +data will come from standard input). To end the multi-lines value, you +simply put a single dot '.' on a line (as in Unix mail, but it needn't +be on the first column). + +If you need to write several identical records, you can use lists. +The syntax is: + + list_name { + # affectations + } + +Example: a version history + + ## that's the version history of Data::Config :) + + history { + date = 2000.10.10 + vers = 0.7.0 + text = First fully functional release. + } + + history { + date = 2000.11.04 + vers = 0.7.1 + text = - + Minor change in the internal structure: options + are now grouped. + . + } + + history { + date = 2000.11.05 + vers = 0.8.0 + text = - + Code cleanup (mainly auto-generation of the + options accessors). + Added list support. + . + } + +Note that currently, there must be only one item on each line. +This means you can't write: + + line { param = value } + +but instead + + line { + param = value + } + +I think that's not a big deal. + +Also note that you can't nest lists. + +You can put some comments in your file. If a line begins with a +sharp sign '#', it will be ignored. + +=head2 Objects Options + +If the default symbols used in the configuration file syntax doesn't +fit your needs, you can change them using the following methods. + +=over 4 + +=item affectation_symbol + +Use this method to change the affectation symbol. Default is '='. + +=item multiline_begin_symbol + +Use this method to change the multiline begin symbol. Default is '-'. + +=item multiline_end_symbol + +Use this method to change the multiline end symbol. Default is '.'. + +=item comment_line_symbol + +Use this method to change the comment symbol. Default is '#'. + +=item list_begin_symbol + +Use this method to change the list begin symbol. Default is '{'. + +=item list_end_symbol + +Use this method to change the list end symbol. Default is '}'. + +=item case_sensitive + +Use this method to change the case behaviour. Defaults is 1 (case sensitive). + +=back + +=head2 Methods + +=over 8 + +=item new + +This method creates a new object. You can give an optional parameter, in +which case the C method is called with that parameter. + +=item read_source ( FILENAME ) + +=item read_source ( FILEHANDLE ) + +This method reads the content of the given file and stores the parameters +values in the object. The argument can be either a filename or a filehandle. +This is useful if you want to store your parameters in your program: + + use Data::Source; + my $conf = new Data::Source \*DATA; + + $conf->param(-debug => 1); ## set debug on + + if($conf->param('debug')) { + print "current options:\n"; + print $conf->dump_param(-prefix => ' '); + } + + # ... + + __END__ + ## default values + verbose = 1 + debug = 0 + die_on_errors = 0 + +Note that you can call the C method several times if you want +to merge the settings from differents configuration files. + +=item param + +This is the general purpose manipulating method. It can used to get or set +the value of the parameters of an object. + +1) Return a list of the parameters: + + @params = $conf->param; + +2) Return the value of a parameter: + + print $conf->param('debug'); + +3) Return the values of a number of parameters: + + @dbg = $conf->param(qw(debug verbose)); + +4) Set the value of a parameter: + + ## using CGI.pm-like syntax + $conf->param(-debug => 0); + + ## using a hashref + $conf->param({ debug => 0 }); + +5) Set the values of a number of parameters + + ## using CGI.pm-like syntax + $conf->param( + -warn_non_existant => 1, + -mangle => 0 + ); + + ## using a hashref + $conf->param( + { + warn_non_existant => 1, + mangle => 0 + } + ); + +=item all_parameters + +This method returns the list of the parameters of an object. + +=item delete ( LIST ) + +This method deletes the given parameters. + +=item delete_all + +This method deletes all the parameters. + +=item clear + +This method sets the given parameters to undef. + +=item clear_params + +This method sets all the parameters to undef. + +=item dump_param ( OPTIONS ) + +This method returns a dump of the parameters as a string. It can be used +to simply print them out, or to save them to a configuration file. + +B + +=over 4 + +=item * + +prefix - If you set this option to a string, it will be printed before printing + +each parameter. + +=item * + +suffix - If you set this option to a string, it will be printed after printing +each parameter. + +=back + +=back + +=head1 VERSION HISTORY + +=over 4 + +=item v0.8.3, Thursday, November 15, 2000 + +Added the method C. + +=item v0.8.2, Saturday, November 11, 2000 + +Added a destructor method. This was needed because of a strange behaviour +in MacPerl 5.2.0r4. + +=item v0.8.1, Thursday, November 8, 2000 + +Minor bug corrected: empty or undefined parameters are not added. + +Bug corrected: syntaxic symbol are now escaped through quotemeta(). + +=item v0.8.0, Sunday, November 5, 2000 + +Code cleanup (mainly auto-generation of the options accessors). + +Added list support. + +=item v0.7.1, Saturday, November 4, 2000 + +Minor change in the internal structure: options are now grouped. + +=item v0.7.0, Tuesday, October 10, 2000 + +First fully functional release. + +=back + +=head1 AUTHOR + +SEbastien Aperghis-Tramoni + +=head1 COPYRIGHT + +Data::Config is Copyright (C)2000 SEbastien Aperghis-Tramoni. + +This program is free software. You can redistribute it and/or modify it +under the terms of either the Perl Artistic License or the GNU General +Public License, version 2 or later. + +=cut + + +my @base = ( + options => { + comment_line_symbol => '#', + affectation_symbol => '=', + multiline_begin_symbol => '-', + multiline_end_symbol => '.', + list_begin_symbol => '{', + list_end_symbol => '}', + case_sensitive => 1 + }, + state => { }, + param => { } +); + +## set the accessors for the object options +for my $option (keys %{$base[1]}) { + eval qq| sub $option { _get_set_option(shift, '$option', shift) } |; + warn "[$CLASS] Initialisation error: $@ " if $@; +} + + +# +# new() +# --- +sub new { + my $class = shift; + my $self = bless { @base }, $class; + $self->read_source(shift) if @_; + return $self; +} + + +# +# DESTROY() +# ------- +sub DESTROY { + my $self = shift; + $self->clear_params; + $self->delete_all; +} + + +# +# _get_set_option() +# --------------- +sub _get_set_option { + my $self = shift; + my $option = shift; + my $value = shift; + + carp "[$CLASS] Uknown option '$option' " unless exists $self->{options}{$option}; + + if(defined $value) { + ($value, $self->{options}{$option}) = ($self->{options}{$option}, $value); + return $value + } else { + return $self->{options}{$option} + } +} + + +# +# read_source() +# ----------- +sub read_source { + my $self = shift; + my $fh = _file_or_handle(shift); + my $aff_sym = $self->affectation_symbol; + my $multiline = $self->multiline_begin_symbol; + my $multi_end = $self->multiline_end_symbol; + my $list = $self->list_begin_symbol; + my $list_end = $self->list_end_symbol; + local $_; + + while(defined($_ = <$fh>)) { + next if /^\s*$/; ## skip empty lines + next if /^\s*#/; ## skip comments + chomp; + + if(/^\s*(\w+)\s*\Q${list}\E$/) { + $self->{state}{current_list} = $1; + $self->{state}{current_stack} = []; + next + } + + if(/^\s*\Q${list_end}\E\s*$/) { + push @{$self->{'param'}{$self->{state}{current_list}}}, { @{$self->{state}{current_stack}} }; + $self->{state}{current_list} = 0; + $self->{state}{current_stack} = []; + next + } + + my($field,$value) = (/^\s*(\w+)\s*\Q${aff_sym}\E\s*(.*)$/); + + if($value =~ /^\s*${multiline}\s*$/) { + $value = ''; + $_ = <$fh>; + + while(not /^\s*\Q${multi_end}\E\s*$/) { + $value .= $_; + $_ = <$fh>; + } + } + + $self->param({ $field => $value }); + } +} + + +# +# _file_or_handle() +# --------------- +sub _file_or_handle { + my $file = shift; + + if(not ref $file) { + my $fh = new FileHandle $file; + croak "[$CLASS] Can't open file '$file': $! " unless defined $fh; + return $fh + } + + return $file +} + + +# +# param() +# ----- +sub param { + my $self = shift; + return $self->all_parameters unless @_; + + my $args = _parse_args(@_); + + my @retlist = (); ## return list + + ## get the value of the desired parameters + for my $arg (@{$args->{'get'}}) { + carp("[$CLASS] Parameter '$arg' does not exist ") and next + if not exists $self->{'param'}{_case_($self, $arg)}; + + push @retlist, $self->{'param'}{_case_($self, $arg)} + } + + ## set the names parameters to new values + my $current_list = $self->{'state'}{current_list}; + my @arg_list = keys %{$args->{'set'}}; + + if($current_list) { + unless(exists $self->{'param'}{$current_list}) { + $self->{'param'}{$current_list} = [] + } + + for my $arg (@arg_list) { + push @{$self->{'state'}{'current_stack'}}, _case_($self, $arg) => $args->{'set'}{$arg} + } + + } else { + for my $arg (@arg_list) { + $self->{'param'}{_case_($self, $arg)} = $args->{'set'}{$arg} + } + } + + return wantarray ? @retlist : $retlist[0] +} + + +# +# _case_() +# ------ +sub _case_ { + my $self = shift; + my $param = shift; + return ($self->case_sensitive ? $param : lc $param) +} + + +# +# _parse_args() +# ----------- +sub _parse_args { + my %args = ( get => [], set => {} ); + + while(my $arg = shift) { + if(my $ref_type = ref $arg) { + + ## setting multiples parameters using a hashref + if($ref_type eq 'HASH') { + local $_; + for (keys %$arg) { + $args{'set'}{$_} = $arg->{$_} if $_ + } + + } else { + carp "[$CLASS] Bad ref $ref_type; ignoring it "; + next + } + + } else { + ## setting a parameter to a new value + if(substr($arg, 0, 1) eq '-') { + $arg = substr($arg, 1); + my $val = shift; + carp("[$CLASS] Undefined value for parameter '$arg' ") and next + if not defined $val; + $args{'set'}{$arg} = $val if $arg + + ## getting the value of a parameter + } else { + push @{$args{'get'}}, $arg + } + } + } + + return \%args +} + + +# +# all_parameters() +# -------------- +sub all_parameters { + my $self = shift; + return keys %{$self->{'param'}} +} + + +# +# delete() +# ------ +sub delete { + my $self = shift; + + for my $param (@_) { + carp("[$CLASS] Parameter '$param' does not exist ") and next + if not exists $self->{'param'}{_case_($self, $param)}; + delete $self->{'param'}{_case_($self, $param)} + } +} + + +# +# delete_all() +# ---------- +sub delete_all { + my $self = shift; + $self->delete($self->all_parameters) +} + + +# +# clear() +# ----- +sub clear { + my $self = shift; + for my $param (@_) { + $self->param({$param => ''}) + } +} + + +# +# clear_params() +# ------------ +sub clear_params { + my $self = shift; + for my $param ($self->all_parameters) { + $self->param({$param => ''}) + } +} + + +# +# dump_param() +# ---------- +sub dump_param { + my $self = shift; + my $args = _parse_args(@_); + my $prefix = $args->{'set'}{'prefix'} || ''; + my $suffix = $args->{'set'}{'suffix'} || ''; + my $str = ''; + + for my $param (sort $self->all_parameters) { + next unless $param; + ## multi-line value ? + my $multiline = 1 if $self->param($param) =~ /\n|\r/; + + $str .= join '', $prefix, $param, ' ', $self->affectation_symbol, ' ', + ($multiline ? $self->multiline_begin_symbol . $/ : ''), + $self->param($param), + ($multiline ? $self->multiline_end_symbol . $/ : ''), + $suffix, $/; + } + + return $str +} + + +1; diff --git a/lib/WebGUI/ErrorHandler.pm b/lib/WebGUI/ErrorHandler.pm new file mode 100644 index 000000000..83e2e1ac1 --- /dev/null +++ b/lib/WebGUI/ErrorHandler.pm @@ -0,0 +1,35 @@ +package ErrorHandler; + +#------------------------------------------------------------------- +# WebGUI is Copyright 2001 Plain Black Software. +#------------------------------------------------------------------- +# Please read the legal notices (docs/legal.txt) and the license +# (docs/license.txt) that came with this distribution before using +# this software. +#------------------------------------------------------------------- +# http://www.plainblack.com info@plainblack.com +#------------------------------------------------------------------- + + +#------------------------------------------------------------------- +#sub fatalError { +# my ($key); +# print httpHeader(); +# print "

WebGUI Fatal Error

Something unexpected happened that caused this system to fault. Please send t +his message to ";#.$session{setting}{adminEmail}."

"; +# print $0." at ".localtime(time)." reported:
"; +# print $_[0]; +# print "

Caller

"; +# print "Level 1
".join("
",caller(1)); +# print "
"."Level 2
".join("
",caller(2)); +# print "
"."Level 3
".join("
",caller(3)); +# print "
"."Level 4
".join("
",caller(4)); +# print "

Form Variables

"; +# #foreach $key (keys %session(form}) { +# # print $key." = ".$session{form}{$key}."
"; +# #} +# exit; +#} + + + diff --git a/lib/WebGUI/Form.pm b/lib/WebGUI/Form.pm new file mode 100644 index 000000000..0e07f9fae --- /dev/null +++ b/lib/WebGUI/Form.pm @@ -0,0 +1,157 @@ +package WebGUI::Form; + +#------------------------------------------------------------------- +# WebGUI is Copyright 2001 Plain Black Software. +#------------------------------------------------------------------- +# Please read the legal notices (docs/legal.txt) and the license +# (docs/license.txt) that came with this distribution before using +# this software. +#------------------------------------------------------------------- +# http://www.plainblack.com info@plainblack.com +#------------------------------------------------------------------- + +use strict qw(vars subs); +use WebGUI::Session; + +#------------------------------------------------------------------- +sub _fixQuotes { + my $value = shift; + $value =~ s/\"/\"\;/g; + return $value; +} + +#------------------------------------------------------------------- +sub checkbox { + my ($output, $name, $value, $checked); + ($name, $value, $checked) = @_; + if ($checked) { + $checked = ' checked'; + } + $output = ''; + return $output; +} + +#------------------------------------------------------------------- +sub file { + my ($output, $name); + ($name) = @_; + $output = ''; + return $output; +} + +#------------------------------------------------------------------- +sub hidden { + my ($output, $name, $value); + ($name, $value) = @_; + $value = _fixQuotes($value); + $output = ''; + return $output; +} + +#------------------------------------------------------------------- +sub password { + my ($output, $name, $size, $maxLength, $value); + $name = shift; + $size = shift; + if ($size eq "") { + $size = 15; + } + $maxLength = shift; + if ($maxLength ne "") { + $maxLength = ' maxlength="'.$maxLength.'"'; + } + $value = shift; + $output = ''; + return $output; +} + +#------------------------------------------------------------------- +sub radio { + my ($output, $name, $value, $checked); + ($name, $value, $checked) = @_; + if ($checked) { + $checked = ' checked'; + } + $output = ''; + return $output; +} + +#------------------------------------------------------------------- +# eg: selectList(name, valueListHashref, selectedArrayref, size, multipleSelection, onChange) +sub selectList { + my ($output, $valueList, $key, $item, $name, $selected, $size, $multiple, $onChange); + ($name, $valueList, $selected, $size, $multiple, $onChange) = @_; + if ($size > 1) { + $size = ' size="'.$size.'"'; + } + if ($multiple > 0) { + $multiple = ' multiple="1"'; + } + if ($onChange ne "") { + $onChange = ' onChange="'.$onChange.'"'; + } + $output = ''; + } + $value = _fixQuotes($value); + $output = ''.$assistance; + return $output; +} + +#------------------------------------------------------------------- +sub textArea { + my ($output, $name, $value, $cols, $rows, $htmlEdit, $wrap); + ($name, $value, $cols, $rows, $htmlEdit, $wrap) = @_; + if ($cols eq "") { + $cols = 50; + } + if ($rows eq "") { + $rows = 5; + } + if ($htmlEdit > 0) { + $output = '
'; + } + if ($wrap eq "") { + $wrap = "virtual"; + } + $output .= ''; + return $output; +} + + + +1; diff --git a/lib/WebGUI/Macro.pm b/lib/WebGUI/Macro.pm new file mode 100644 index 000000000..348d387f0 --- /dev/null +++ b/lib/WebGUI/Macro.pm @@ -0,0 +1,173 @@ +package WebGUI::Macro; + +#------------------------------------------------------------------- +# WebGUI is Copyright 2001 Plain Black Software. +#------------------------------------------------------------------- +# Please read the legal notices (docs/legal.txt) and the license +# (docs/license.txt) that came with this distribution before using +# this software. +#------------------------------------------------------------------- +# http://www.plainblack.com info@plainblack.com +#------------------------------------------------------------------- + +use strict; +use WebGUI::Privilege; +use WebGUI::Session; +use WebGUI::SQL; + +#------------------------------------------------------------------- +sub _recurseCrumbTrail { + my ($sth, %data, $output); + %data = WebGUI::SQL->quickHash("select pageId,parentId,title,urlizedTitle from page where pageId=$_[0]",$session{dbh}); + if ($data{pageId} > 1) { + $output .= _recurseCrumbTrail($data{parentId}); + } + if ($data{title} ne "") { + $output .= ''.$data{title}.' > '; + } + return $output; +} + +#------------------------------------------------------------------- +sub process { + my ($output, $temp, @data, $sth, $first); + $output = $_[0]; + #---carrot ^--- + if ($output =~ /\^\^/) { + $output =~ s/\^\^/\^/g; + } + #---page url--- + if ($output =~ /\^\//) { + $output =~ s/\^\//\$session{env}{SCRIPT_NAME}/g; + } + #---username--- + if ($output =~ /\^\@/) { + $output =~ s/\^\@/$session{user}{username}/g; + } + #---uid--- + if ($output =~ /\^\#/) { + $output =~ s/\^\#/$session{page}{userId}/g; + } + #---random number--- + if ($output =~ /\^\*/) { + $temp = rand()*1000000000; + $output =~ s/\^\*/$temp/g; + } + #---account link--- + if ($output =~ /\^a/) { + $temp = 'My Account'; + $output =~ s/\^a/$temp/g; + } + #---company name--- + if ($output =~ /\^c/) { + $output =~ s/\^c/$session{setting}{companyName}/g; + } + #---crumb trail--- + if ($output =~ /\^C/) { + $temp = ''._recurseCrumbTrail($session{page}{parentId}).$session{page}{title}.''; + $output =~ s/\^C/$temp/g; + } + #---date--- + if ($output =~ /\^D/) { + $temp = localtime(time); + $output =~ s/\^D/$temp/g; + } + #---company email--- + if ($output =~ /\^e/) { + $output =~ s/\^e/$session{setting}{companyEmail}/g; + } + #---home link--- + if ($output =~ /\^H/) { + $temp = 'Home'; + $output =~ s/\^H/$temp/g; + } + #---login box--- + if ($output =~ /\^L/) { + $temp = '
'; + if ($session{var}{sessionId}) { + $temp .= 'Hello '.$session{user}{username}.'. Click here to log out.'; + } else { + $temp .= '
'; + $temp .= WebGUI::Form::hidden("op","login").'Username:
'; + $temp .= WebGUI::Form::text("username",12,30).'
Password:
'; + $temp .= WebGUI::Form::password("identifier",12,30).'
'; + $temp .= WebGUI::Form::submit("login"); + $temp .= '
'; + } + $temp .= '
'; + $output =~ s/\^L/$temp/g; + } + #---current menu vertical--- + if ($output =~ /\^M/) { + $temp = ''; + $sth = WebGUI::SQL->read("select title,urlizedTitle,pageId from page where parentId=$session{page}{pageId}",$session{dbh}); + while (@data = $sth->array) { + if (WebGUI::Privilege::canViewPage($data[2])) { + $temp .= ''.$data[0].'
'; + } + } + $sth->finish; + $temp .= '
'; + $output =~ s/\^M/$temp/g; + } + #---current menu horizontal --- + if ($output =~ /\^m/) { + $temp = ''; + $first = 1; + $sth = WebGUI::SQL->read("select title,urlizedTitle,pageId from page where parentId=$session{page}{pageId}",$session{dbh}); + while (@data = $sth->array) { + if (WebGUI::Privilege::canViewPage($data[2])) { + if ($first) { + $first = 0; + } else { + $temp .= " · "; + } + $temp .= ''.$data[0].''; + } + } + $sth->finish; + $temp .= ''; + $output =~ s/\^m/$temp/g; + } + #---top menu vertical--- + if ($output =~ /\^T/) { + $temp = ''; + $sth = WebGUI::SQL->read("select title,urlizedTitle,pageId from page where parentId=1",$session{dbh}); + while (@data = $sth->array) { + if (WebGUI::Privilege::canViewPage($data[2])) { + $temp .= ''.$data[0].'
'; + } + } + $sth->finish; + $temp .= '
'; + $output =~ s/\^T/$temp/g; + } + #---top menu horizontal--- + if ($output =~ /\^t/) { + $temp = ''; + $first = 1; + $sth = WebGUI::SQL->read("select title,urlizedTitle,pageId from page where parentId=1",$session{dbh}); + while (@data = $sth->array) { + if (WebGUI::Privilege::canViewPage($data[2])) { + if ($first) { + $first = 0; + } else { + $temp .= " · "; + } + $temp .= ''.$data[0].''; + } + } + $sth->finish; + $temp .= ''; + $output =~ s/\^t/$temp/g; + } + #---company URL--- + if ($output =~ /\^u/) { + $output =~ s/\^u/$session{setting}{companyURL}/g; + } + return $output; +} + + + +1; diff --git a/lib/WebGUI/Mail.pm b/lib/WebGUI/Mail.pm new file mode 100644 index 000000000..9a7199e21 --- /dev/null +++ b/lib/WebGUI/Mail.pm @@ -0,0 +1,40 @@ +package WebGUI::Mail; + +#------------------------------------------------------------------- +# WebGUI is Copyright 2001 Plain Black Software. +#------------------------------------------------------------------- +# Please read the legal notices (docs/legal.txt) and the license +# (docs/license.txt) that came with this distribution before using +# this software. +#------------------------------------------------------------------- +# http://www.plainblack.com info@plainblack.com +#------------------------------------------------------------------- + +use strict; +use WebGUI::Session; + +#------------------------------------------------------------------- +#eg: send("jt@jt.com","hi, how are you","this is my message","bob@bob.com"); +sub send { + my ($smtp); + $smtp = Net::SMTP->new($session{setting}{smtpServer}); # connect to an SMTP server + $smtp->mail($session{setting}{companyEmail}); # use the sender's address here + $smtp->to($_[0]); # recipient's address + $smtp->data(); # Start the mail + # Send the header. + $smtp->datasend("To: ".$_[0]."\n"); + $smtp->datasend("From: $session{setting}{companyName} <$session{setting}{companyEmail}>\n"); + $smtp->datasend("CC: $_[3]\n") if ($cc); + $smtp->datasend("Subject: ".$_[1]."\n"); + $smtp->datasend("\n"); + # Send the body. + $smtp->datasend($_[2]); + $smtp->datasend("\n\n $session{setting}{companyName}\n $setting{setting}{companyEmail}\n $session{setting}{companyURL}\n"); + $smtp->dataend(); # Finish sending the mail + $smtp->quit; # Close the SMTP connection +} + + + + +1; diff --git a/lib/WebGUI/Operation.pm b/lib/WebGUI/Operation.pm new file mode 100644 index 000000000..2aad2dd25 --- /dev/null +++ b/lib/WebGUI/Operation.pm @@ -0,0 +1,24 @@ +package WebGUI::Operation; + +#------------------------------------------------------------------- +# WebGUI is Copyright 2001 Plain Black Software. +#------------------------------------------------------------------- +# Please read the legal notices (docs/legal.txt) and the license +# (docs/license.txt) that came with this distribution before using +# this software. +#------------------------------------------------------------------- +# http://www.plainblack.com info@plainblack.com +#------------------------------------------------------------------- + +use strict; +use WebGUI::Operation::Account; +use WebGUI::Operation::Admin; +use WebGUI::Operation::Group; +use WebGUI::Operation::Help; +use WebGUI::Operation::Settings; +use WebGUI::Operation::Style; +use WebGUI::Operation::Page; +use WebGUI::Operation::User; + + +1; diff --git a/lib/WebGUI/Operation/Account.pm b/lib/WebGUI/Operation/Account.pm new file mode 100644 index 000000000..24527b3f4 --- /dev/null +++ b/lib/WebGUI/Operation/Account.pm @@ -0,0 +1,268 @@ +package WebGUI::Operation::Account; + +#------------------------------------------------------------------- +# WebGUI is Copyright 2001 Plain Black Software. +#------------------------------------------------------------------- +# Please read the legal notices (docs/legal.txt) and the license +# (docs/license.txt) that came with this distribution before using +# this software. +#------------------------------------------------------------------- +# http://www.plainblack.com info@plainblack.com +#------------------------------------------------------------------- + +use Digest::MD5 qw(md5_base64); +use Exporter; +use strict; +use WebGUI::Form; +use WebGUI::Privilege; +use WebGUI::Session; +use WebGUI::SQL; +use WebGUI::Utility; + +our @ISA = qw(Exporter); +our @EXPORT = qw(&www_createAccount &www_deactivateAccount &www_deactivateAccountConfirm &www_displayAccount &www_displayLogin &www_login &www_logout &www_recoverPassword &www_recoverPasswordFinish &www_saveAccount &www_updateAccount); + +#------------------------------------------------------------------- +sub _hasBadPassword { + if ($_[0] ne $_[1] || $_[0] eq "") { + return 1; + } else { + return 0; + } +} + +#------------------------------------------------------------------- +sub _hasBadUsername { + my ($otherUser); + ($otherUser) = WebGUI::SQL->quickArray("select username from user where lcase(username)=lcase('$_[0]')",$session{dbh}); + if ($otherUser ne "" || $_[0] eq "") { + return 1; + } else { + return 0; + } +} + +#------------------------------------------------------------------- +sub _login { + my ($cookieInfo); + $cookieInfo = $_[0]."|".crypt($_[1],"yJ"); + WebGUI::Session::end($cookieInfo); #clearing out old session info just in case something bad happened + if (WebGUI::Session::start($cookieInfo)) { + WebGUI::Session::setCookie("wgSession",$cookieInfo); + return ""; + } else { + return "Error: Unable to initialize session vars because your session signature does not match your account information.

"; + } +} + +#------------------------------------------------------------------- +sub www_createAccount { + my ($output); + if ($session{user}{userId} != 1) { + $output .= www_displayAccount(); + } else { + $output .= '

Create Account

'; + $output .= WebGUI::Form::hidden("op","saveAccount"); + $output .= ''; + $output .= ''; + $output .= ''; + $output .= ''; + $output .= ''; + $output .= ''; + $output .= ''; + $output .= '
Username'.WebGUI::Form::text("username",20,30).'
Password'.WebGUI::Form::password("identifier1",20,30).'
Password (confirm)'.WebGUI::Form::password("identifier2",20,30).'
Email Address'.WebGUI::Form::text("email",20,255).'
This is only necessary if you wish to use features that require Email.
ICQ UIN'.WebGUI::Form::text("icq",20,30).'
This is only necessary if you wish to use features that require ICQ.
'.WebGUI::Form::submit("create").'
'; + $output .= '
'; + $output .= ''; + } + return $output; +} + +#------------------------------------------------------------------- +sub www_deactivateAccount { + my ($output); + if ($session{user}{userId} == 1) { + $output .= www_displayLogin(); + } else { + $output .= '

Please Confirm

'; + $output .= 'Are you certain you want to deactivate your account. If you proceed your account information will be lost permanently.

'; + $output .= '

Yes, I\'m sure.'; + $output .= '    No, I made a mistake.
'; + } + return $output; +} + +#------------------------------------------------------------------- +sub www_deactivateAccountConfirm { + if ($session{user}{userId} != 1) { + WebGUI::SQL->write("delete from user where userId=$session{user}{userId}",$session{dbh}); + WebGUI::SQL->write("delete from groupings where userId=$session{user}{userId}",$session{dbh}); + WebGUI::Session::end($session{var}{sessionId}); + _login(1,"null"); + } + return www_displayLogin(); +} + +#------------------------------------------------------------------- +sub www_displayAccount { + my ($output); + if ($session{user}{userId} != 1) { + $output .= '

Update Account Information

'; + $output .= WebGUI::Form::hidden("op","updateAccount"); + $output .= ''; + $output .= ''; + $output .= ''; + $output .= ''; + $output .= ''; + $output .= ''; + $output .= ''; + $output .= '
username'.WebGUI::Form::text("username",20,30,$session{user}{username}).'
password'.WebGUI::Form::password("identifier1",20,30,"password").'
password (confirm)'.WebGUI::Form::password("identifier2",20,30,"password").'
email address'.WebGUI::Form::text("email",20,255,$session{user}{email}).'
This is only necessary if you wish to use features that require Email.
ICQ UIN'.WebGUI::Form::text("icq",20,30,$session{user}{icq}).'
This is only necessary if you wish to use features that require ICQ.
'.WebGUI::Form::submit("update").'
'; + $output .= '
'; + $output .= '
'; + } else { + $output .= 'You need to be logged in to view your account information.

'; + $output .= www_displayLogin(); + } + return $output; +} + +#------------------------------------------------------------------- +sub www_displayLogin { + my ($output); + if ($session{var}{sessionId}) { + $output .= www_displayAccount(); + } else { + $output .= '

Login

'; + $output .= WebGUI::Form::hidden("op","login"); + $output .= ''; + $output .= ''; + $output .= ''; + $output .= ''; + $output .= '
username'.WebGUI::Form::text("username",20,30).'
password'.WebGUI::Form::password("identifier",20,30).'
'.WebGUI::Form::submit("login").'
'; + $output .= '
'; + $output .= ''; + } + return $output; +} + +#------------------------------------------------------------------- +sub www_login { + my ($uid,$pass); + ($uid,$pass) = WebGUI::SQL->quickArray("select userId,identifier from user where username=".quote($session{form}{username}),$session{dbh}); + if (Digest::MD5::md5_base64($session{form}{identifier}) eq $pass && $session{form}{identifier} ne "") { + _login($uid,$pass); + return ""; + } else { + return "

Invalid Account

The account information you supplied is invalid. Either the account does not exist or the username/password combination was incorrect.".www_displayLogin(); + } +} + +#------------------------------------------------------------------- +sub www_logout { + WebGUI::Session::end($session{var}{sessionId}); + #_login(1,"null"); + return ""; +} + +#------------------------------------------------------------------- +sub www_recoverPassword { + my ($output); + if ($session{var}{sessionId}) { + $output .= www_displayAccount(); + } else { + $output .= '

Recover Password

'; + $output .= WebGUI::Form::hidden("op","recoverPasswordFinish"); + $output .= ''; + $output .= ''; + $output .= ''; + $output .= '
Email Address'.WebGUI::Form::text("email",20,255).'
'.WebGUI::Form::submit("recover").'
'; + $output .= '
'; + $output .= ''; + } + return $output; +} + +#------------------------------------------------------------------- +sub www_recoverPasswordFinish { + my ($sth, $username, $encryptedPassword, $userId, $password, $flag, $message, $output); + $sth = WebGUI::SQL->read("select username, userId from user where email=".quote($session{form}{email}),$session{dbh}); + while (($username,$userId) = $sth->array) { + foreach (0,1,2,3,4,5) { + $password .= chr(ord('A') + randint(32)); + } + $encryptedPassword = Digest::MD5::md5_base64($password); + WebGUI::SQL->write("update user set identifier='$encryptedPassword' where userId='$userId'",$session{dbh}); + $flag = 1; + $message = 'Someone (probably you) requested your account information be sent. Your password has been reset. The following information represents your new account information:\nUser: '.$username.'\nPass: '.$password.'\n'; + WebGUI::Mail::send($session{form}{email},"Account Information",$message); + } + $sth->finish(); + if ($flag) { + $output = '
  • Your account information has been sent to your email address.
'; + $output .= www_displayLogin(); + } else { + $output = '
  • That email address is not in our databases.
'; + $output .= www_recoverPassword(); + } + return $output; +} + +#------------------------------------------------------------------- +sub www_saveAccount { + my ($output, $error, $uid, $encryptedPassword); + if (_hasBadUsername($session{form}{username})) { + $error = 'Error: The account name '.$session{form}{username}.' is in use by another member of this site. Please try a different username, perhaps "'.$session{form}{username}.'too" or "'.$session{form}{username}.'01"

'; + } + if (_hasBadPassword($session{form}{identifier1},$session{form}{identifier2})) { + $error .= 'Error: Your passwords did not match. Please try again.

'; + } + if ($error eq "") { + $encryptedPassword = Digest::MD5::md5_base64($session{form}{identifier1}); + $uid = getNextId("userId"); + WebGUI::SQL->write("insert into user set userId=".getNextId("userId").", username=".quote($session{form}{username}).", identifier=".quote($encryptedPassword).", email=".quote($session{form}{email}).", icq=".quote($session{form}{icq}),$session{dbh}); + WebGUI::SQL->write("insert into groupings set groupId=2,userId=$uid",$session{dbh}); + _login($uid,$encryptedPassword); + $output .= 'Account created successfully!

'; + $output .= www_displayAccount(); + } else { + $output = $error; + $output = www_createAccount(); + } + return $output; +} + +#------------------------------------------------------------------- +sub www_updateAccount { + my ($output, $error, $encryptedPassword, $passwordStatement); + if ($session{var}{sessionId}) { + if (_hasBadUsername($session{form}{username})) { + $error = 'Error: The account name '.$session{form}{username}.' is in use by another member of this site. Please try a different username, perhaps "'.$session{form}{username}.'too" or "'.$session{form}{username}.'01"

'; + } + if ($session{form}{identifier1} ne "password" && _hasBadPassword($session{form}{identifier1},$session{form}{identifier2})) { + $error .= 'Error: Your passwords did not match. Please try again.

'; + } else { + $encryptedPassword = Digest::MD5::md5_base64($session{form}{identifier1}); + $passwordStatement = ', identifier='.quote($encryptedPassword); + } + if ($error eq "") { + $encryptedPassword = Digest::MD5::md5_base64($session{form}{identifier1}); + WebGUI::SQL->write("update user set username=".quote($session{form}{username}).$passwordStatement.", email=".quote($session{form}{email}).", icq=".quote($session{form}{icq})." where userId=".$session{user}{userId},$session{dbh}); + if ($passwordStatement ne "") { + _login($session{user}{userId},$encryptedPassword); + } + $output .= 'Account updated successfully!

'; + $output .= www_displayAccount(); + } else { + $output = $error; + $output = www_createAccount(); + } + } else { + $output .= www_displayLogin(); + } + return $output; +} + +1; diff --git a/lib/WebGUI/Operation/Admin.pm b/lib/WebGUI/Operation/Admin.pm new file mode 100644 index 000000000..3219b4b06 --- /dev/null +++ b/lib/WebGUI/Operation/Admin.pm @@ -0,0 +1,45 @@ +package WebGUI::Operation::Admin; + +#------------------------------------------------------------------- +# WebGUI is Copyright 2001 Plain Black Software. +#------------------------------------------------------------------- +# Please read the legal notices (docs/legal.txt) and the license +# (docs/license.txt) that came with this distribution before using +# this software. +#------------------------------------------------------------------- +# http://www.plainblack.com info@plainblack.com +#------------------------------------------------------------------- + +use Exporter; +use strict; +use WebGUI::Privilege; +use WebGUI::Session; +use WebGUI::SQL; + +our @ISA = qw(Exporter); +our @EXPORT = qw(&www_switchOffAdmin &www_switchOnAdmin); + +#------------------------------------------------------------------- +sub www_switchOffAdmin { + if ($session{var}{sessionId}) { + WebGUI::SQL->write("update session set adminOn=0 where sessionId='$session{var}{sessionId}'",$session{dbh}); + WebGUI::Session::refreshSessionVars($session{var}{sessionId}); + return ""; + } else { + return WebGUI::Privilege::insufficient(); + } +} + +#------------------------------------------------------------------- +sub www_switchOnAdmin { + if ($session{var}{sessionId}) { + WebGUI::SQL->write("update session set adminOn=1 where sessionId='$session{var}{sessionId}'",$session{dbh}); + WebGUI::Session::refreshSessionVars($session{var}{sessionId}); + return ""; + } else { + return WebGUI::Privilege::insufficient(); + } +} + + +1; diff --git a/lib/WebGUI/Operation/Group.pm b/lib/WebGUI/Operation/Group.pm new file mode 100644 index 000000000..bff6719dd --- /dev/null +++ b/lib/WebGUI/Operation/Group.pm @@ -0,0 +1,156 @@ +package WebGUI::Operation::Group; + +#------------------------------------------------------------------- +# WebGUI is Copyright 2001 Plain Black Software. +#------------------------------------------------------------------- +# Please read the legal notices (docs/legal.txt) and the license +# (docs/license.txt) that came with this distribution before using +# this software. +#------------------------------------------------------------------- +# http://www.plainblack.com info@plainblack.com +#------------------------------------------------------------------- + +use Exporter; +use strict; +use WebGUI::Form; +use WebGUI::Privilege; +use WebGUI::Session; +use WebGUI::SQL; +use WebGUI::Utility; + +our @ISA = qw(Exporter); +our @EXPORT = qw(&www_addGroup &www_addGroupSave &www_deleteGroup &www_deleteGroupConfirm &www_editGroup &www_editGroupSave &www_listGroups); + +#------------------------------------------------------------------- +sub www_addGroup { + my ($output); + if (WebGUI::Privilege::isInGroup(3)) { + $output .= '

Add Group

'; + $output .= WebGUI::Form::hidden("op","addGroupSave"); + $output .= ''; + $output .= ''; + $output .= ''; + $output .= ''; + $output .= '
Group Name'.WebGUI::Form::text("groupName",20,30).'
Description'.WebGUI::Form::textArea("description",'').'
'.WebGUI::Form::submit("save").'
'; + $output .= '
'; + } else { + $output = WebGUI::Privilege::insufficient(); + } + return $output; +} + +#------------------------------------------------------------------- +sub www_addGroupSave { + my ($output); + if ($session{var}{sessionId}) { + WebGUI::SQL->write("insert into groups set groupId=".getNextId("groupId").", groupName=".quote($session{form}{groupName}).", description=".quote($session{form}{description}),$session{dbh}); + $output = www_listGroups(); + } else { + $output = WebGUI::Privilege::insufficient(); + } + return $output; +} + +#------------------------------------------------------------------- +sub www_deleteGroup { + my ($output); + if (WebGUI::Privilege::isInGroup(3) && $session{form}{gid} > 25) { + $output .= '

Please Confirm

'; + $output .= 'Are you certain you wish to delete this group? Beware that deleting a group is permanent and will remove all privileges associated with this group.

'; + $output .= '

Yes, I\'m sure.'; + $output .= '    No, I made a mistake.
'; + return $output; + } else { + return WebGUI::Privilege::insufficient(); + } +} + +#------------------------------------------------------------------- +sub www_deleteGroupConfirm { + if (WebGUI::Privilege::isInGroup(3) && $session{form}{gid} > 25) { + WebGUI::SQL->write("delete from groups where groupId=$session{form}{gid}",$session{dbh}); + WebGUI::SQL->write("delete from groupings where groupId=$session{form}{gid}",$session{dbh}); + return www_listGroups(); + } else { + return WebGUI::Privilege::insufficient(); + } +} + +#------------------------------------------------------------------- +sub www_editGroup { + my ($output, $sth, %group, $user); + if (WebGUI::Privilege::isInGroup(3)) { + %group = WebGUI::SQL->quickHash("select * from groups where groupId=$session{form}{gid}",$session{dbh}); + $output .= '

Edit Group

'; + $output .= WebGUI::Form::hidden("op","editGroupSave"); + $output .= WebGUI::Form::hidden("gid",$session{form}{gid}); + $output .= ''; + $output .= ''; + $output .= ''; + $output .= ''; + $output .= ''; + $output .= '
Group Name'.WebGUI::Form::text("groupName",20,30,$group{groupName}).'
Description'.WebGUI::Form::textArea("description",$group{description}).'
'.WebGUI::Form::submit("save").'
Users In Group'; + $sth = WebGUI::SQL->read("select user.username from user,groupings where groupings.groupId=$session{form}{gid} and groupings.userId=user.userId order by user.username",$session{dbh}); + while (($user) = $sth->array) { + $output .= $user."
"; + } + $sth->finish; + $output .= '
'; + $output .= '
'; + } else { + $output = WebGUI::Privilege::insufficient(); + } + return $output; +} + +#------------------------------------------------------------------- +sub www_editGroupSave { + if (WebGUI::Privilege::isInGroup(3)) { + WebGUI::SQL->write("update groups set groupName=".quote($session{form}{groupName}).", description=".quote($session{form}{description})." where groupId=".$session{form}{gid},$session{dbh}); + return www_listGroups(); + } else { + return WebGUI::Privilege::insufficient(); + } +} + +#------------------------------------------------------------------- +sub www_listGroups { + my ($output, $sth, @data, $totalItems, $currentPage, $itemsPerPage); + if (WebGUI::Privilege::isInGroup(3)) { + $itemsPerPage = 50; + if ($session{form}{pageNumber} < 1) { + $currentPage = 1; + } else { + $currentPage = $session{form}{pageNumber}; + } + ($totalItems) = WebGUI::SQL->quickArray("select count(*) from groups where groupName<>'Reserved'",$session{dbh}); + $output = '

Groups

'; + $output .= ''; + $output .= ''; + $sth = WebGUI::SQL->read("select groupId,groupName,description from groups where groupName<>'Reserved' order by groupName limit ".(($currentPage*$itemsPerPage)-$itemsPerPage).",".$itemsPerPage,$session{dbh}); + while (@data = $sth->array) { + $output .= ''; + $output .= ''; + $output .= ''; + } + $output .= '
'.$data[1].''.$data[2].'
'; + return $output; + } else { + return WebGUI::Privilege::insufficient(); + } +} + + +1; diff --git a/lib/WebGUI/Operation/Help.pm b/lib/WebGUI/Operation/Help.pm new file mode 100644 index 000000000..52c6b89ba --- /dev/null +++ b/lib/WebGUI/Operation/Help.pm @@ -0,0 +1,71 @@ +package WebGUI::Operation::Help; + +#------------------------------------------------------------------- +# WebGUI is Copyright 2001 Plain Black Software. +#------------------------------------------------------------------- +# Please read the legal notices (docs/legal.txt) and the license +# (docs/license.txt) that came with this distribution before using +# this software. +#------------------------------------------------------------------- +# http://www.plainblack.com info@plainblack.com +#------------------------------------------------------------------- + +use Exporter; +use strict; +use WebGUI::Session; +use WebGUI::SQL; +use WebGUI::Utility; + +our @ISA = qw(Exporter); +our @EXPORT = qw(&www_viewHelp &www_viewHelpIndex); + +#------------------------------------------------------------------- +sub www_viewHelp { + my ($output, %help, @data, $sth); + %help = WebGUI::SQL->quickHash("select * from help where helpId=$session{form}{hid}",$session{dbh}); + $output = '

Help: '.$help{action}.' '.$help{object}.'

'; + $help{body} =~ s/\n/\/g; + $output .= $help{body}; + $output .= '

See Also:'; + $sth = WebGUI::SQL->read("select helpId, action, object from help where object='$help{object}' and action<>'$help{action}' order by action",$session{dbh}); + while (@data = $sth->array) { + $output .= ' '.$data[1].' '.$data[2].''; + } + $sth->finish; + $sth = WebGUI::SQL->read("select helpId, action, object from help where helpId in ($help{seeAlso}) order by action",$session{dbh}); + while (@data = $sth->array) { + $output .= ' '.$data[1].' '.$data[2].''; + } + $sth->finish; + return $output; +} + +#------------------------------------------------------------------- +sub www_viewHelpIndex { + my ($sth, @data, $output, $previous); + $output = '

Help Index

'; + $output .= '
Sorted By Action

'; + $sth = WebGUI::SQL->read("select helpId, action, object from help order by action,object",$session{dbh}); + while (@data = $sth->array) { + if ($data[1] ne $previous) { + $output .= '

'.$data[1].'
'; + $previous = $data[1]; + } + $output .= '

  • '.$data[2].'
    '; + } + $sth->finish; + $output .= '
  • Sorted By Object

    '; + $sth = WebGUI::SQL->read("select helpId, object, action from help order by object,action",$session{dbh}); + while (@data = $sth->array) { + if ($data[1] ne $previous) { + $output .= '

    '.$data[1].'
    '; + $previous = $data[1]; + } + $output .= '

  • '.$data[2].'
    '; + } + $sth->finish; + $output .= '
  • '; + return $output; +} + +1; diff --git a/lib/WebGUI/Operation/Page.pm b/lib/WebGUI/Operation/Page.pm new file mode 100644 index 000000000..0d3a74577 --- /dev/null +++ b/lib/WebGUI/Operation/Page.pm @@ -0,0 +1,190 @@ +package WebGUI::Operation::Page; + +#------------------------------------------------------------------- +# WebGUI is Copyright 2001 Plain Black Software. +#------------------------------------------------------------------- +# Please read the legal notices (docs/legal.txt) and the license +# (docs/license.txt) that came with this distribution before using +# this software. +#------------------------------------------------------------------- +# http://www.plainblack.com info@plainblack.com +#------------------------------------------------------------------- + +use Exporter; +use strict; +use WebGUI::Form; +use WebGUI::Privilege; +use WebGUI::Session; +use WebGUI::SQL; +use WebGUI::Utility; + +our @ISA = qw(Exporter); +our @EXPORT = qw(&www_addPage &www_addPageSave &www_cutPage &www_deletePage &www_deletePageConfirm &www_editPage &www_editPageSave &www_pastePage); + +#------------------------------------------------------------------- +sub _recursivelyChangePrivileges { + my ($sth, $pageId); + $sth = WebGUI::SQL->read("select pageId from page where parentId=$_[0]",$session{dbh}); + while (($pageId) = $sth->array) { + WebGUI::SQL->write("update page set ownerId=$session{form}{ownerId}, ownerView=$session{form}{ownerView}, ownerEdit=$session{form}{ownerEdit}, groupId='$session{form}{groupId}', groupView=$session{form}{groupView}, groupEdit=$session{form}{groupEdit}, worldView=$session{form}{worldView}, worldEdit=$session{form}{worldEdit} where pageId=$pageId",$session{dbh}); + _recursivelyChangePrivileges($pageId); + } + $sth->finish; +} + +#------------------------------------------------------------------- +sub _recursivelyChangeStyle { + my ($sth, $pageId); + $sth = WebGUI::SQL->read("select pageId from page where parentId=$_[0]",$session{dbh}); + while (($pageId) = $sth->array) { + WebGUI::SQL->write("update page set styleId=$session{form}{styleId} where pageId=$pageId",$session{dbh}); + _recursivelyChangeStyle($pageId); + } + $sth->finish; +} + +#------------------------------------------------------------------- +sub www_addPage { + my ($output); + if (WebGUI::Privilege::canEditPage()) { + $output = '

    Add Page

    '; + $output .= WebGUI::Form::hidden("op","addPageSave"); + $output .= ''; + $output .= ''; + $output .= ''; + $output .= ''; + $output .= '
    Title'.WebGUI::Form::text("title",20,30,$session{form}{title}).'
    Meta Tags'.WebGUI::Form::textArea("metaTags",$session{form}{metaTags}).'
    '.WebGUI::Form::submit("create").'
    '; + return $output; + } else { + return WebGUI::Privilege::insufficient(); + } +} + +#------------------------------------------------------------------- +sub www_addPageSave { + my (%parent, $urlizedTitle, $test); + if (WebGUI::Privilege::canEditPage()) { + %parent = WebGUI::SQL->quickHash("select * from page where pageId=$session{page}{pageId}",$session{dbh}); + $urlizedTitle = urlizeTitle($session{form}{title}); + while (($test) = WebGUI::SQL->quickArray("select urlizedTitle from page where urlizedTitle='$urlizedTitle'",$session{dbh})) { + $urlizedTitle .= 2; + } + WebGUI::SQL->write("insert into page set pageId=".getNextId("pageId").", parentId=$session{page}{pageId}, title=".quote($session{form}{title}).", styleId=$parent{styleId}, ownerId=$session{user}{userId}, ownerView=$parent{ownerView}, ownerEdit=$parent{ownerEdit}, groupId='$parent{groupId}', groupView=$parent{groupView}, groupEdit=$parent{groupEdit}, worldView=$parent{worldView}, worldEdit=$parent{worldEdit}, metaTags=".quote($session{form}{metaTags}).", urlizedTitle='$urlizedTitle'",$session{dbh}); + return ""; + } else { + return WebGUI::Privilege::insufficient(); + } +} + +#------------------------------------------------------------------- +sub www_cutPage { + if (WebGUI::Privilege::canEditPage() && $session{page}{pageId}!=1) { + WebGUI::SQL->write("update page set parentId=2 where pageId=".$session{page}{pageId},$session{dbh}); + WebGUI::Session::refreshPageInfo($session{page}{parentId}); + return ""; + } else { + return WebGUI::Privilege::insufficient(); + } +} + +#------------------------------------------------------------------- +sub www_deletePage { + my ($output); + if (WebGUI::Privilege::canEditPage() && $session{page}{pageId}!=1) { + $output .= '

    Please Confirm

    '; + $output .= 'Are you certain that you wish to delete this page, its content, and all items under it?

    '; + $output .= '

    Yes, I\'m sure.'; + $output .= '    No, I made a mistake.
    '; + return $output; + } else { + return WebGUI::Privilege::insufficient(); + } +} + +#------------------------------------------------------------------- +sub www_deletePageConfirm { + if (WebGUI::Privilege::canEditPage() && $session{page}{pageId}!=1) { + WebGUI::SQL->write("update page set parentId=3 where pageId=".$session{page}{pageId},$session{dbh}); + WebGUI::Session::refreshPageInfo($session{page}{parentId}); + return ""; + } else { + return WebGUI::Privilege::insufficient(); + } +} + +#------------------------------------------------------------------- +sub www_editPage { + my ($output, %yesNo, %hash, @array); + tie %hash, "Tie::IxHash"; + if (WebGUI::Privilege::canEditPage()) { + %yesNo = ("0"=>"No", "1"=>"Yes"); + $output = '

    Edit Page

    '; + $output .= WebGUI::Form::hidden("op","editPageSave"); + $output .= ''; + $output .= ''; + $output .= ''; + %hash = WebGUI::SQL->buildHash("select styleId,name from style where name<>'Reserved' order by name",$session{dbh}); + $array[0] = $session{page}{styleId}; + $output .= ''; + $output .= ''; + %hash = WebGUI::SQL->buildHash("select user.userId,user.username from user,groupings where groupings.groupId=4 and groupings.userId=user.userId order by user.username",$session{dbh}); + $array[0] = $session{page}{ownerId}; + $output .= ''; + $array[0] = $session{page}{ownerView}; + $output .= ''; + $array[0] = $session{page}{ownerEdit}; + $output .= ''; + %hash = WebGUI::SQL->buildHash("select groupId,groupName from groups where groupName<>'Reserved' order by groupName",$session{dbh}); + $array[0] = $session{page}{groupId}; + $output .= ''; + $array[0] = $session{page}{groupView}; + $output .= ''; + $array[0] = $session{page}{groupEdit}; + $output .= ''; + $array[0] = $session{page}{worldView}; + $output .= ''; + $array[0] = $session{page}{worldEdit}; + $output .= ''; + $output .= ''; + $output .= '
    Title'.WebGUI::Form::text("title",20,30,$session{page}{title}).'
    Meta Tags'.WebGUI::Form::textArea("metaTags",$session{page}{metaTags}).'
    Style'.WebGUI::Form::selectList("styleId",\%hash,\@array).' '.WebGUI::Form::checkbox("recurseStyle","yes").' Check to give this style to all sub-pages.
    Page URL'.WebGUI::Form::text("urlizedTitle",20,30,$session{page}{urlizedTitle}).'
    Owner'.WebGUI::Form::selectList("ownerId",\%hash,\@array).' '.WebGUI::Form::checkbox("recursePrivs","yes").' Check to give these privileges to all sub-pages.
    Owner can view?'.WebGUI::Form::selectList("ownerView",\%yesNo,\@array).'
    Owner can edit?'.WebGUI::Form::selectList("ownerEdit",\%yesNo,\@array).'
    Group'.WebGUI::Form::selectList("groupId",\%hash,\@array).'
    Group can view?'.WebGUI::Form::selectList("groupView",\%yesNo,\@array).'
    Group can edit?'.WebGUI::Form::selectList("groupEdit",\%yesNo,\@array).'
    Anybody can view?'.WebGUI::Form::selectList("worldView",\%yesNo,\@array).'
    Anybody can Edit?'.WebGUI::Form::selectList("worldEdit",\%yesNo,\@array).'
    '.WebGUI::Form::submit("save").'
    '; + return $output; + } else { + return WebGUI::Privilege::insufficient(); + } +} + +#------------------------------------------------------------------- +sub www_editPageSave { + my (%parent, $urlizedTitle, $test); + if (WebGUI::Privilege::canEditPage()) { + $urlizedTitle = urlizeTitle($session{form}{urlizedTitle}); + while (($test) = WebGUI::SQL->quickArray("select urlizedTitle from page where urlizedTitle='$urlizedTitle' and pageId<>$session{page}{pageId}",$session{dbh})) { + $urlizedTitle .= 2; + } + WebGUI::SQL->write("update page set title=".quote($session{form}{title}).", styleId=$session{form}{styleId}, ownerId=$session{form}{ownerId}, ownerView=$session{form}{ownerView}, ownerEdit=$session{form}{ownerEdit}, groupId='$session{form}{groupId}', groupView=$session{form}{groupView}, groupEdit=$session{form}{groupEdit}, worldView=$session{form}{worldView}, worldEdit=$session{form}{worldEdit}, metaTags=".quote($session{form}{metaTags}).", urlizedTitle='$urlizedTitle' where pageId=$session{page}{pageId}",$session{dbh}); + if ($session{form}{recurseStyle} eq "yes") { + _recursivelyChangeStyle($session{page}{pageId}); + } + if ($session{form}{recursePrivs} eq "yes") { + _recursivelyChangePrivileges($session{page}{pageId}); + } + WebGUI::Session::refreshPageInfo($session{page}{pageId}); + return ""; + } else { + return WebGUI::Privilege::insufficient(); + } +} + +#------------------------------------------------------------------- +sub www_pastePage { + my ($output); + if (WebGUI::Privilege::canEditPage()) { + WebGUI::SQL->write("update page set parentId=$session{page}{pageId} where pageId=$session{form}{pageId}",$session{dbh}); + return ""; + } else { + return WebGUI::Privilege::insufficient(); + } +} + + +1; diff --git a/lib/WebGUI/Operation/Settings.pm b/lib/WebGUI/Operation/Settings.pm new file mode 100644 index 000000000..e6ce895c2 --- /dev/null +++ b/lib/WebGUI/Operation/Settings.pm @@ -0,0 +1,68 @@ +package WebGUI::Operation::Settings; + +#------------------------------------------------------------------- +# WebGUI is Copyright 2001 Plain Black Software. +#------------------------------------------------------------------- +# Please read the legal notices (docs/legal.txt) and the license +# (docs/license.txt) that came with this distribution before using +# this software. +#------------------------------------------------------------------- +# http://www.plainblack.com info@plainblack.com +#------------------------------------------------------------------- + +use Exporter; +use strict; +use WebGUI::Form; +use WebGUI::Privilege; +use WebGUI::Session; +use WebGUI::SQL; +use WebGUI::Utility; + +our @ISA = qw(Exporter); +our @EXPORT = qw(&www_editSettings &www_editSettingsSave); + +#------------------------------------------------------------------- +sub www_editSettings { + my ($output); + if (WebGUI::Privilege::isInGroup(3)) { + $output .= '

    Edit Settings

    '; + $output .= WebGUI::Form::hidden("op","editSettingsSave"); + $output .= ''; + $output .= ''; + $output .= ''; + $output .= ''; + $output .= ''; + $output .= ''; + $output .= ''; + $output .= ''; + $output .= ''; + $output .= ''; + $output .= ''; + $output .= '
    Path to WebGUI Extras'.WebGUI::Form::text("lib",20,255,$session{setting}{lib}).'
    Session Timeout'.WebGUI::Form::text("sessionTimeout",20,11,$session{setting}{sessionTimeout}).'
    Maximum Attachment Size'.WebGUI::Form::text("maxAttachmentSize",20,11,$session{setting}{maxAttachmentSize}).'
    Web Attachment Path'.WebGUI::Form::text("attachmentDirectoryWeb",20,255,$session{setting}{attachmentDirectoryWeb}).'
    Server Attachment Path'.WebGUI::Form::text("attachmentDirectoryLocal",20,255,$session{setting}{attachmentDirectoryLocal}).'
    SMTP Server'.WebGUI::Form::text("smtpServer",20,255,$session{setting}{smtpServer}).'
    Company Name'.WebGUI::Form::text("companyName",20,255,$session{setting}{companyName}).'
    Company Email Address'.WebGUI::Form::text("companyEmail",20,255,$session{setting}{companyEmail}).'
    Company URL'.WebGUI::Form::text("companyURL",20,255,$session{setting}{companyURL}).'
    '.WebGUI::Form::submit("save").'
    '; + $output .= '
    '; + $output .= '
    Build Version: '.$session{wg}{version}.'
    Release Date: '.$session{wg}{date}; + } else { + $output = WebGUI::Privilege::insufficient(); + } + return $output; +} + +#------------------------------------------------------------------- +sub www_editSettingsSave { + if (WebGUI::Privilege::isInGroup(3)) { + WebGUI::SQL->write("update settings set value=".quote($session{form}{lib})." where name='lib'",$session{dbh}); + WebGUI::SQL->write("update settings set value=".quote($session{form}{sessionTimeout})." where name='sessionTimeout'",$session{dbh}); + WebGUI::SQL->write("update settings set value=".quote($session{form}{maxAttachmentSize})." where name='maxAttachmentSize'",$session{dbh}); + WebGUI::SQL->write("update settings set value=".quote($session{form}{attachmentDirectoryWeb})." where name='attachmentDirectoryWeb'",$session{dbh}); + WebGUI::SQL->write("update settings set value=".quote($session{form}{attachmentDirectoryLocal})." where name='attachmentDirectoryLocal'",$session{dbh}); + WebGUI::SQL->write("update settings set value=".quote($session{form}{smtpServer})." where name='smtpServer'",$session{dbh}); + WebGUI::SQL->write("update settings set value=".quote($session{form}{companyName})." where name='companyName'",$session{dbh}); + WebGUI::SQL->write("update settings set value=".quote($session{form}{companyEmail})." where name='companyEmail'",$session{dbh}); + WebGUI::SQL->write("update settings set value=".quote($session{form}{companyURL})." where name='companyURL'",$session{dbh}); + return ""; + } else { + return WebGUI::Privilege::insufficient(); + } +} + +1; diff --git a/lib/WebGUI/Operation/Style.pm b/lib/WebGUI/Operation/Style.pm new file mode 100644 index 000000000..7ab7b8890 --- /dev/null +++ b/lib/WebGUI/Operation/Style.pm @@ -0,0 +1,153 @@ +package WebGUI::Operation::Style; + +#------------------------------------------------------------------- +# WebGUI is Copyright 2001 Plain Black Software. +#------------------------------------------------------------------- +# Please read the legal notices (docs/legal.txt) and the license +# (docs/license.txt) that came with this distribution before using +# this software. +#------------------------------------------------------------------- +# http://www.plainblack.com info@plainblack.com +#------------------------------------------------------------------- + +use Exporter; +use strict; +use WebGUI::Form; +use WebGUI::Privilege; +use WebGUI::Session; +use WebGUI::SQL; +use WebGUI::Utility; + +our @ISA = qw(Exporter); +our @EXPORT = qw(&www_addStyle &www_addStyleSave &www_deleteStyle &www_deleteStyleConfirm &www_editStyle &www_editStyleSave &www_listStyles); + +#------------------------------------------------------------------- +sub www_addStyle { + my ($output); + if (WebGUI::Privilege::isInGroup(3)) { + $output .= '

    Add Style

    '; + $output .= WebGUI::Form::hidden("op","addStyleSave"); + $output .= ''; + $output .= ''; + $output .= ''; + $output .= ''; + $output .= ''; + $output .= ''; + $output .= '
    Style Name'.WebGUI::Form::text("name",20,30).'
    Header'.WebGUI::Form::textArea("header",'',50,10,1).'
    Footer'.WebGUI::Form::textArea("footer",'',50,10,1).'
    Style Sheet'.WebGUI::Form::textArea("styleSheet",'',50,10).'
    '.WebGUI::Form::submit("save").'
    '; + $output .= '
    '; + } else { + $output = WebGUI::Privilege::insufficient(); + } + return $output; +} + +#------------------------------------------------------------------- +sub www_addStyleSave { + my ($output); + if (WebGUI::Privilege::isInGroup(3)) { + WebGUI::SQL->write("insert into style set styleId=".getNextId("styleId")." name=".quote($session{form}{name}).", header=".quote($session{form}{header}).", footer=".quote($session{form}{footer}).", styleSheet=".quote($session{form}{styleSheet}),$session{dbh}); + $output = www_listStyles(); + } else { + $output = WebGUI::Privilege::insufficient(); + } + return $output; +} + +#------------------------------------------------------------------- +sub www_deleteStyle { + my ($output); + if (WebGUI::Privilege::isInGroup(3) && $session{form}{sid} > 25) { + $output .= '

    Please Confirm

    '; + $output .= 'Are you certain you wish to delete this style and migrate all pages using this style to the "Fail Safe" style?

    '; + $output .= '

    Yes, I\'m sure.'; + $output .= '    No, I made a mistake.
    '; + return $output; + } else { + return WebGUI::Privilege::insufficient(); + } +} + +#------------------------------------------------------------------- +sub www_deleteStyleConfirm { + if (WebGUI::Privilege::isInGroup(3) && $session{form}{sid} > 25) { + WebGUI::SQL->write("delete from style where styleId=".$session{form}{sid},$session{dbh}); + WebGUI::SQL->write("update page set styleId=2 where styleId=".$session{form}{sid},$session{dbh}); + return www_listStyles(); + } else { + return WebGUI::Privilege::insufficient(); + } +} + +#------------------------------------------------------------------- +sub www_editStyle { + my ($output, %style); + if (WebGUI::Privilege::isInGroup(3)) { + %style = WebGUI::SQL->quickHash("select * from style where styleId=$session{form}{sid}",$session{dbh}); + $output .= '

    Edit Style

    '; + $output .= WebGUI::Form::hidden("op","editStyleSave"); + $output .= WebGUI::Form::hidden("sid",$session{form}{sid}); + $output .= ''; + $output .= ''; + $output .= ''; + $output .= ''; + $output .= ''; + $output .= ''; + $output .= '
    Style Name'.WebGUI::Form::text("name",20,30,$style{name}).'
    Header'.WebGUI::Form::textArea("header",$style{header},50,10,1).'
    Footer'.WebGUI::Form::textArea("footer",$style{footer},50,10,1).'
    Style Sheet'.WebGUI::Form::textArea("styleSheet",$style{styleSheet},50,10).'
    '.WebGUI::Form::submit("save").'
    '; + $output .= '
    '; + } else { + $output = WebGUI::Privilege::insufficient(); + } + return $output; +} + +#------------------------------------------------------------------- +sub www_editStyleSave { + if (WebGUI::Privilege::isInGroup(3)) { + WebGUI::SQL->write("update style set name=".quote($session{form}{name}).", header=".quote($session{form}{header}).", footer=".quote($session{form}{footer}).", styleSheet=".quote($session{form}{styleSheet})." where styleId=".$session{form}{sid},$session{dbh}); + return www_listStyles(); + } else { + return WebGUI::Privilege::insufficient(); + } +} + +#------------------------------------------------------------------- +sub www_listStyles { + my ($output, $sth, @data, $totalItems, $currentPage, $itemsPerPage); + if (WebGUI::Privilege::isInGroup(3)) { + $itemsPerPage = 50; + if ($session{form}{pageNumber} < 1) { + $currentPage = 1; + } else { + $currentPage = $session{form}{pageNumber}; + } + ($totalItems) = WebGUI::SQL->quickArray("select count(*) from style where name<>'Reserved'",$session{dbh}); + $output = '

    Styles

    '; + $output .= ''; + $output .= ''; + $sth = WebGUI::SQL->read("select styleId,name from style where name<>'Reserved' order by name limit ".(($currentPage*$itemsPerPage)-$itemsPerPage).",".$itemsPerPage,$session{dbh}); + while (@data = $sth->array) { + $output .= ''; + $output .= ''; + } + $output .= '
    '.$data[1].'
    '; + return $output; + } else { + return WebGUI::Privilege::insufficient(); + } +} + + + +1; diff --git a/lib/WebGUI/Operation/User.pm b/lib/WebGUI/Operation/User.pm new file mode 100644 index 000000000..847f9b13a --- /dev/null +++ b/lib/WebGUI/Operation/User.pm @@ -0,0 +1,179 @@ +package WebGUI::Operation::User; + +#------------------------------------------------------------------- +# WebGUI is Copyright 2001 Plain Black Software. +#------------------------------------------------------------------- +# Please read the legal notices (docs/legal.txt) and the license +# (docs/license.txt) that came with this distribution before using +# this software. +#------------------------------------------------------------------- +# http://www.plainblack.com info@plainblack.com +#------------------------------------------------------------------- + +use Digest::MD5 qw(md5_base64); +use Exporter; +use strict; +use WebGUI::Form; +use WebGUI::Operation::Help; +use WebGUI::Operation::Page; +use WebGUI::Privilege; +use WebGUI::Session; +use WebGUI::SQL; +use WebGUI::Utility; + +our @ISA = qw(Exporter); +our @EXPORT = qw(&www_addUser &www_addUserSave &www_deleteUser &www_deleteUserConfirm &www_editUser &www_editUserSave &www_listUsers); + +#------------------------------------------------------------------- +sub www_addUser { + my ($output, %hash); + if (WebGUI::Privilege::isInGroup(3)) { + $output .= '

    Add User

    '; + $output .= WebGUI::Form::hidden("op","addUserSave"); + $output .= ''; + $output .= ''; + $output .= ''; + $output .= ''; + $output .= ''; + %hash = WebGUI::SQL->buildHash("select groupId,groupName from groups where groupName<>'Reserved' order by groupName",$session{dbh}); + $output .= ''; + $output .= ''; + $output .= '
    Username'.WebGUI::Form::text("username",20,30).'
    Password'.WebGUI::Form::password("identifier",20,30).'
    Email address'.WebGUI::Form::text("email",20,255).'
    ICQ UIN'.WebGUI::Form::text("icq",20,30).'
    Groups'.WebGUI::Form::selectList("groups",\%hash,'',5,1).'
    '.WebGUI::Form::submit("save").'
    '; + $output .= '
    '; + } else { + $output = WebGUI::Privilege::insufficient(); + } + return $output; +} + +#------------------------------------------------------------------- +sub www_addUserSave { + my ($output, @groups, $uid, $gid, $encryptedPassword, $passwordStatement); + if (WebGUI::Privilege::isInGroup(3)) { + $encryptedPassword = Digest::MD5::md5_base64($session{form}{identifier1}); + $passwordStatement = ', identifier='.quote($encryptedPassword); + $uid = getNextId("userId"); + WebGUI::SQL->write("insert into user set userId=$uid, username=".quote($session{form}{username}).$passwordStatement.", email=".quote($session{form}{email}).", icq=".quote($session{form}{icq}),$session{dbh}); + @groups = $session{cgi}->param('groups'); + foreach $gid (@groups) { + WebGUI::SQL->write("insert into groupings set groupId=$gid, userId=$uid",$session{dbh}); + } + $output = www_listUsers(); + } else { + $output = WebGUI::Privilege::insufficient(); + } + return $output; +} + +#------------------------------------------------------------------- +sub www_deleteUser { + my ($output); + if (WebGUI::Privilege::isInGroup(3) && $session{form}{uid} > 25) { + $output .= '

    Please Confirm

    '; + $output .= 'Are you certain you want to delete this user? Be warned that all this user\'s information will be lost permanently if you choose to proceed.

    '; + $output .= '

    Yes, I\'m sure.'; + $output .= '    No, I made a mistake.
    '; + return $output; + } else { + return WebGUI::Privilege::insufficient(); + } +} + +#------------------------------------------------------------------- +sub www_deleteUserConfirm { + if (WebGUI::Privilege::isInGroup(3) && $session{form}{uid} > 25) { + WebGUI::SQL->write("delete from user where userId=$session{form}{uid}",$session{dbh}); + WebGUI::SQL->write("delete from groupings where userId=$session{form}{uid}",$session{dbh}); + return www_listUsers(); + } else { + return WebGUI::Privilege::insufficient(); + } +} + +#------------------------------------------------------------------- +sub www_editUser { + my ($output, %user, %hash, @array); + if (WebGUI::Privilege::isInGroup(3)) { + %user = WebGUI::SQL->quickHash("select * from user where userId=$session{form}{uid}",$session{dbh}); + $output .= '

    Edit User

    '; + $output .= WebGUI::Form::hidden("op","editUserSave"); + $output .= WebGUI::Form::hidden("uid",$session{form}{uid}); + $output .= ''; + $output .= ''; + $output .= ''; + $output .= ''; + $output .= ''; + %hash = WebGUI::SQL->buildHash("select groupId,groupName from groups where groupName<>'Reserved' order by groupName",$session{dbh}); + @array = WebGUI::SQL->buildArray("select groupId from groupings where userId=$session{form}{uid}",$session{dbh}); + $output .= ''; + $output .= ''; + $output .= '
    username'.WebGUI::Form::text("username",20,30,$user{username}).'
    password'.WebGUI::Form::password("identifier",20,30,"password").'
    email address'.WebGUI::Form::text("email",20,255,$user{email}).'
    ICQ UIN'.WebGUI::Form::text("icq",20,30,$user{icq}).'
    Groups'.WebGUI::Form::selectList("groups",\%hash,\@array,5,1).'
    '.WebGUI::Form::submit("save").'
    '; + $output .= '
    '; + } else { + $output = WebGUI::Privilege::insufficient(); + } + return $output; +} + +#------------------------------------------------------------------- +sub www_editUserSave { + my (@groups, $error, $gid, $encryptedPassword, $passwordStatement); + if (WebGUI::Privilege::isInGroup(3)) { + if ($session{form}{identifier} ne "password") { + $encryptedPassword = Digest::MD5::md5_base64($session{form}{identifier}); + $passwordStatement = ', identifier='.quote($encryptedPassword); + } + $encryptedPassword = Digest::MD5::md5_base64($session{form}{identifier1}); + WebGUI::SQL->write("update user set username=".quote($session{form}{username}).$passwordStatement.", email=".quote($session{form}{email}).", icq=".quote($session{form}{icq})." where userId=".$session{form}{uid},$session{dbh}); + WebGUI::SQL->write("delete from groupings where userId=$session{form}{uid}",$session{dbh}); + @groups = $session{cgi}->param('groups'); + foreach $gid (@groups) { + WebGUI::SQL->write("insert into groupings set groupId=$gid, userId=$session{form}{uid}",$session{dbh}); + } + return www_listUsers(); + } else { + return WebGUI::Privilege::insufficient(); + } +} + +#------------------------------------------------------------------- +sub www_listUsers { + my ($output, $sth, @data, $totalItems, $currentPage, $itemsPerPage); + if (WebGUI::Privilege::isInGroup(3)) { + $itemsPerPage = 50; + if ($session{form}{pageNumber} < 1) { + $currentPage = 1; + } else { + $currentPage = $session{form}{pageNumber}; + } + ($totalItems) = WebGUI::SQL->quickArray("select count(*) from user where username<>'Reserved'",$session{dbh}); + $output = '

    Users

    '; + $output .= ''; + $output .= ''; + $sth = WebGUI::SQL->read("select userId,username,email from user where username<>'Reserved' order by username limit ".(($currentPage*$itemsPerPage)-$itemsPerPage).",".$itemsPerPage,$session{dbh}); + while (@data = $sth->array) { + $output .= ''; + $output .= ''; + $output .= ''; + } + $output .= '
    '.$data[1].''.$data[2].'
    '; + return $output; + } else { + return WebGUI::Privilege::insufficient(); + } +} + + +1; diff --git a/lib/WebGUI/Privilege.pm b/lib/WebGUI/Privilege.pm new file mode 100644 index 000000000..7efa4b40f --- /dev/null +++ b/lib/WebGUI/Privilege.pm @@ -0,0 +1,75 @@ +package WebGUI::Privilege; + +#------------------------------------------------------------------- +# WebGUI is Copyright 2001 Plain Black Software. +#------------------------------------------------------------------- +# Please read the legal notices (docs/legal.txt) and the license +# (docs/license.txt) that came with this distribution before using +# this software. +#------------------------------------------------------------------- +# http://www.plainblack.com info@plainblack.com +#------------------------------------------------------------------- + +use strict; +use WebGUI::Session; +use WebGUI::SQL; +use WebGUI::Utility; + +#------------------------------------------------------------------- +sub canEditPage { + if ($session{page}{worldEdit}) { + return 1; + } elsif ($session{user}{userId} eq $session{page}{ownerId} && $session{page}{ownerEdit}) { + return 1; + } elsif (isInGroup(3)) { + return 1; + } elsif (isInGroup($session{page}{groupId}) && $session{page}{groupEdit}) { + return 1; + } else { + return 0; + } +} + +#------------------------------------------------------------------- +sub canViewPage { + my (%page); + if ($_[0] eq "") { + %page = %{$session{page}}; + } else { + %page = WebGUI::SQL->quickHash("select * from page where pageId=$_[0]",$session{dbh}); + } + if ($page{worldView}) { + return 1; + } elsif ($session{user}{userId} eq $page{ownerId} && $page{ownerView}) { + return 1; + } elsif (isInGroup(3)) { + return 1; + } elsif (isInGroup($page{groupId}) && $page{groupView}) { + return 1; + } else { + return 0; + } +} + +#------------------------------------------------------------------- +sub insufficient { + return '

    Permission Denied!

    You do not have sufficient privileges to perform this operation. Please log in with an account that has sufficient privileges before attempting this operation.

    '; +} + +#------------------------------------------------------------------- +sub isInGroup { + my ($gid, $uid, $result); + ($gid, $uid) = @_; + if ($uid eq "") { + $uid = $session{user}{userId}; + } + ($result) = WebGUI::SQL->quickArray("select count(*) from groupings where groupId='$gid' && userId='$uid'",$session{dbh}); + return $result; +} + + + + + + +1; diff --git a/lib/WebGUI/SQL.pm b/lib/WebGUI/SQL.pm new file mode 100644 index 000000000..757921683 --- /dev/null +++ b/lib/WebGUI/SQL.pm @@ -0,0 +1,105 @@ +package WebGUI::SQL; + +#------------------------------------------------------------------- +# WebGUI is Copyright 2001 Plain Black Software. +#------------------------------------------------------------------- +# Please read the legal notices (docs/legal.txt) and the license +# (docs/license.txt) that came with this distribution before using +# this software. +#------------------------------------------------------------------- +# http://www.plainblack.com info@plainblack.com +#------------------------------------------------------------------- + +use CGI::Carp qw(fatalsToBrowser); +use DBI; +use strict; +use Tie::IxHash; + +# Note: This class is really not necessary, I just decided to wrapper DBI in case +# I wanted to change to some other DB connector in the future. Also, it shorthands +# a few tasks. + +#------------------------------------------------------------------- +sub array { + return $_[0]->{_sth}->fetchrow_array() or croak DBI->errstr; +} + +#------------------------------------------------------------------- +sub buildArray { + my ($sth, $data, @array, $i); + $sth = WebGUI::SQL->read($_[1],$_[2]); + $i=0; + while (($data) = $sth->array) { + $array[$i] = $data; + $i++; + } + $sth->finish; + return @array; +} + +#------------------------------------------------------------------- +sub buildHash { + my ($sth, %hash, @data); + tie %hash, "Tie::IxHash"; + $sth = WebGUI::SQL->read($_[1],$_[2]); + while (@data = $sth->array) { + $hash{$data[0]} = $data[1]; + } + $sth->finish; + return %hash; +} + +#------------------------------------------------------------------- +sub finish { + return $_[0]->{_sth}->finish; +} + +#------------------------------------------------------------------- +sub hash { + return $_[0]->{_sth}->fetchrow_hashref() or croak DBI->errstr; +} + +#------------------------------------------------------------------- +sub new { + my ($class, $sql, $dbh, $sth); + $class = shift; + $sql = shift; + $dbh = shift; + $sth = $dbh->prepare($sql) or croak "Couldn't prepare statement: ".$sql." : ". DBI->errstr; + $sth->execute or croak "Couldn't execute statement: ".$sql." : ". DBI->errstr; + bless ({_sth => $sth}, $class); +} + +#------------------------------------------------------------------- +sub quickArray { + my ($sth, @data); + $sth = WebGUI::SQL->new($_[1],$_[2]); + @data = $sth->array; + $sth->finish; + return @data; +} + +#------------------------------------------------------------------- +sub quickHash { + my ($sth, $data); + $sth = WebGUI::SQL->new($_[1],$_[2]); + $data = $sth->hash; + $sth->finish; + if (defined $data) { + return %{$data}; + } +} + +#------------------------------------------------------------------- +sub read { + return WebGUI::SQL->new($_[1],$_[2]); +} + +#------------------------------------------------------------------- +sub write { + $_[2]->do($_[1]) or croak "Couldn't prepare statement: ".$_[1]." : ". DBI->errstr; +} + + + +1; diff --git a/lib/WebGUI/Session.pm b/lib/WebGUI/Session.pm new file mode 100644 index 000000000..6033104e4 --- /dev/null +++ b/lib/WebGUI/Session.pm @@ -0,0 +1,172 @@ +package WebGUI::Session; + +#------------------------------------------------------------------- +# WebGUI is Copyright 2001 Plain Black Software. +#------------------------------------------------------------------- +# Please read the legal notices (docs/legal.txt) and the license +# (docs/license.txt) that came with this distribution before using +# this software. +#------------------------------------------------------------------- +# http://www.plainblack.com info@plainblack.com +#------------------------------------------------------------------- + +use CGI; +use DBI; +use Exporter; +use strict; +use WebGUI::Config; +use WebGUI::SQL; + +our @ISA = qw(Exporter); +our @EXPORT = qw(%session); +our %session = (); + +#------------------------------------------------------------------- +sub _getPageInfo { + my (%page, $pageId, $pageName); + ($pageId) = $_[0]; + if ($pageId eq "") { + $pageName = lc($ENV{PATH_INFO}); + $pageName =~ s/\///; + if ($pageName ne "") { + ($pageId) = WebGUI::SQL->quickArray("select pageId from page where urlizedTitle='".$pageName."'",$_[1]); + if ($pageId eq "") { + $pageId = 1; + } + } else { + $pageId = 1; + } + } + %page = WebGUI::SQL->quickHash("select * from page where pageId='".$pageId."'",$_[1]); + $page{url} = $ENV{SCRIPT_NAME}."/".$page{urlizedTitle}; + return %page; +} + +#------------------------------------------------------------------- +sub _getSessionVars { + my (%vars, $uid, $encryptedPassword); + if ($_[0] ne "") { + %vars = WebGUI::SQL->quickHash("select * from session where sessionId='$_[0]'", $_[1]); + if ($vars{sessionId} ne "") { + WebGUI::SQL->write("update session set lastPageView=now(), expires=date_add(now(),interval $_[2] second) where sessionId='$_[0]'",$_[1]); + } + } + return %vars; +} + +#------------------------------------------------------------------- +sub _getUserInfo { + my (%user, $uid, $encryptedPassword); + if ($_[0] ne "") { + ($uid, $encryptedPassword) = split(/\|/,$_[0]); + } else { + $uid = 1; + } + %user = WebGUI::SQL->quickHash("select * from user where userId='$uid'", $_[1]); + if ($user{userId} eq "") { + %user = _getUserInfo(1,$_[1]); + } + return %user; +} + +#------------------------------------------------------------------- +sub close { + $session{'dbh'}->disconnect(); + undef %session; +} + +#------------------------------------------------------------------- +sub end { + WebGUI::SQL->write("delete from session where sessionId='$_[0]'",$session{dbh}); + refreshSessionVars(); +} + +#------------------------------------------------------------------- +sub httpHeader { + return $session{cgi}->header( -cookie => $session{header}{cookie}); +} + +#------------------------------------------------------------------- +sub httpRedirect { + return $session{cgi}->redirect($_[0]); +} + +#------------------------------------------------------------------- +sub open { + my ($key, %WebGUI, %CONFIG, %VARS, %PAGE, %FORM, $query, %COOKIES, $config, %USER, %SETTINGS, $dbh); + %WebGUI = (version=>"0.9.0", date=>"2001-08-13"); + $config = new WebGUI::Config '../etc/WebGUI.conf'; + foreach ($config->param) { + $CONFIG{$_} = $config->param($_); + } + $dbh = DBI->connect($CONFIG{dsn}, $CONFIG{dbuser}, $CONFIG{dbpass}); + $query = CGI->new(); + foreach ($query->param) { + $FORM{$_} = $query->param($_); + } + foreach ($query->cookie) { + $COOKIES{$_} = $query->cookie($_); + } + %SETTINGS = WebGUI::SQL->buildHash("select name,value from settings",$dbh); + %VARS = _getSessionVars($COOKIES{wgSession},$dbh,$SETTINGS{sessionTimeout}); + %USER = _getUserInfo($VARS{sessionId},$dbh); + $CGI::POST_MAX=1024 * $SETTINGS{maxAttachmentSize}; + %PAGE = _getPageInfo("",$dbh); + %session = ( + env => \%ENV, # environment variables from the web server + # config=> \%CONFIG, # variables loaded from the config file + user => \%USER, # the user's account information + var => \%VARS, # session specific variables + form => \%FORM, # variables passed in from a form + cookie => \%COOKIES, # variables passed in via cookie + setting => \%SETTINGS, # variables set by the administrator + cgi => $query, # interface to the CGI environment + page => \%PAGE, # variables related to the current page + header => {}, # settings to be passed back through the http header + dbh => $dbh, # interface to the default WebGUI database + wg => \%WebGUI # WebGUI internal settings + ); +} + +#------------------------------------------------------------------- +sub refreshPageInfo { + my (%PAGE); + %PAGE = _getPageInfo($_[0],$session{dbh}); + $session{page} = \%PAGE; +} + +#------------------------------------------------------------------- +sub refreshSessionVars { + my (%VARS); + %VARS = _getSessionVars($_[0],$session{dbh},$session{setting}{sessionTimeout}); + $session{var} = \%VARS; + refreshUserInfo($session{var}{sessionId}); +} + +#------------------------------------------------------------------- +sub refreshUserInfo { + my (%USER); + %USER = _getUserInfo($_[0],$session{dbh}); + $session{user} = \%USER; +} + +#------------------------------------------------------------------- +sub setCookie { + $session{header}{cookie} = $session{cgi}->cookie(-name=>$_[0], -value=>$_[1], -expires=>'+10y', -path=>'/'); +} + +#------------------------------------------------------------------- +sub start { + my (%user, $uid, $encryptedPassword); + ($uid, $encryptedPassword) = split(/\|/,$_[0]); + %user = WebGUI::SQL->quickHash("select * from user where userId='$uid'", $session{dbh}); + if (crypt($user{identifier},"yJ") eq $encryptedPassword) { + WebGUI::SQL->write("insert into session set sessionId='$_[0]', expires=date_add(now(),interval $session{setting}{sessionTimeout} second)",$session{dbh}); + refreshSessionVars($_[0]); + return 1; + } else { + return 0; + } +} + +1; diff --git a/lib/WebGUI/Style.pm b/lib/WebGUI/Style.pm new file mode 100644 index 000000000..51787cb36 --- /dev/null +++ b/lib/WebGUI/Style.pm @@ -0,0 +1,39 @@ +package WebGUI::Style; + +#------------------------------------------------------------------- +# WebGUI is Copyright 2001 Plain Black Software. +#------------------------------------------------------------------- +# Please read the legal notices (docs/legal.txt) and the license +# (docs/license.txt) that came with this distribution before using +# this software. +#------------------------------------------------------------------- +# http://www.plainblack.com info@plainblack.com +#------------------------------------------------------------------- + +use strict; +use WebGUI::Macro; +use WebGUI::Session; +use WebGUI::SQL; + +#------------------------------------------------------------------- +sub getStyle { + my ($header, $footer, @style, %style); + %style = WebGUI::SQL->quickHash("select header,footer,styleSheet from style where styleId=$session{page}{styleId}",$session{dbh}); + $header = ' + + '.$session{page}{title}.''.$style{styleSheet}.$session{page}{metaTags}.' + + + + '.$style{header}; + $footer = $style{footer}; + $header = WebGUI::Macro::process($header); + $footer = WebGUI::Macro::process($footer); + return ($header, $footer); +} + + + + + +1; diff --git a/lib/WebGUI/Utility.pm b/lib/WebGUI/Utility.pm new file mode 100644 index 000000000..d1c37ee6a --- /dev/null +++ b/lib/WebGUI/Utility.pm @@ -0,0 +1,83 @@ +package WebGUI::Utility; + +#------------------------------------------------------------------- +# WebGUI is Copyright 2001 Plain Black Software. +#------------------------------------------------------------------- +# Please read the legal notices (docs/legal.txt) and the license +# (docs/license.txt) that came with this distribution before using +# this software. +#------------------------------------------------------------------- +# http://www.plainblack.com info@plainblack.com +#------------------------------------------------------------------- + +use CGI; +use Exporter; +use FileHandle; +use strict; +use WebGUI::Session; +use WebGUI::SQL; + +our @ISA = qw(Exporter); +our @EXPORT = qw(&getNextId &saveAttachment &humanToMysqlDate &round &urlizeTitle "e); + +#------------------------------------------------------------------- +sub getNextId { + my ($id); + ($id) = WebGUI::SQL->quickArray("select nextValue from incrementer where incrementerId='$_[0]'",$session{dbh}); + WebGUI::SQL->write("update incrementer set nextValue=nextValue+1 where incrementerId='$_[0]'",$session{dbh}); + return $id; +} + +#------------------------------------------------------------------- +sub humanToMysqlDate { + my ($month, $day, $year) = split(/\//,$_[0]); + return $year.'-'.$month.'-'.$day.' 00:00:00'; +} + +#------------------------------------------------------------------- +# This is here simply to make typing shorter, cuz I'm lazy. +sub quote { + return $session{dbh}->quote($_[0]); +} + +#------------------------------------------------------------------- +sub round { + return sprintf("%.0f", $_[0]); +} + +#------------------------------------------------------------------- +# eg: saveAttachment(formVarName,widgetId); +sub saveAttachment { + my ($file, $filename, $bytesread, $buffer, $urlizedFilename); + $filename = $session{cgi}->upload($_[0]); + #$filename = $session{form}{$_[0]}; + #$filename = $session{cgi}->param($_[0]); + if (defined $filename) { + $urlizedFilename = urlizeTitle($filename); + mkdir ($session{setting}{attachmentDirectoryLocal}."/".$_[1],0755); + $file = FileHandle->new(">".$session{setting}{attachmentDirectoryLocal}."/".$_[1]."/".$urlizedFilename); + if (defined $file) { + while ($bytesread=read($filename,$buffer,1024)) { + print $file $buffer; + } + close($file); + } else { + return ""; + } + return $urlizedFilename; + } else { + return ""; + } +} + +#------------------------------------------------------------------- +sub urlizeTitle { + my ($title); + $title = lc($_[0]); + $title =~ s/ /_/g; + $title =~ s/[^a-z0-9\-\.\_]//g; + return $title; +} + + +1; diff --git a/lib/WebGUI/Widget.pm b/lib/WebGUI/Widget.pm new file mode 100644 index 000000000..415ae4ff2 --- /dev/null +++ b/lib/WebGUI/Widget.pm @@ -0,0 +1,129 @@ +package WebGUI::Widget; + +#------------------------------------------------------------------- +# WebGUI is Copyright 2001 Plain Black Software. +#------------------------------------------------------------------- +# Please read the legal notices (docs/legal.txt) and the license +# (docs/license.txt) that came with this distribution before using +# this software. +#------------------------------------------------------------------- +# http://www.plainblack.com info@plainblack.com +#------------------------------------------------------------------- + +use CGI::Carp qw(fatalsToBrowser); +use DBI; +use Exporter; +use strict; +use WebGUI::Session; +use WebGUI::SQL; +use WebGUI::Utility; + +our @ISA = qw(Exporter); +our @EXPORT = qw(&update &www_moveUp &www_moveDown &www_delete &www_deleteConfirm &www_cut &create &www_paste); + +#------------------------------------------------------------------- +sub _reorderWidgets { + my ($sth, $i, $wid); + $sth = WebGUI::SQL->read("select widgetId from widget where pageId=$_[0] order by sequenceNumber",$session{dbh}); + while (($wid) = $sth->array) { + WebGUI::SQL->write("update widget set sequenceNumber='$i' where widgetId=$wid",$session{dbh}); + $i++; + } + $sth->finish; +} + +#------------------------------------------------------------------- +sub create { + my ($widgetId, $nextSeq); + $widgetId = getNextId("widgetId"); + ($nextSeq) = WebGUI::SQL->quickArray("select max(sequenceNumber)+1 from widget where pageId=$session{page}{pageId}",$session{dbh}); + WebGUI::SQL->write("insert into widget set widgetId=$widgetId, pageId=$session{page}{pageId}, widgetType='$session{form}{widget}', title=".quote($session{form}{title}).", displayTitle='$session{form}{displayTitle}', description=".quote($session{form}{description}).", sequenceNumber='$nextSeq'",$session{dbh}); + return $widgetId; +} + +#------------------------------------------------------------------- +sub update { + WebGUI::SQL->write("update widget set title=".quote($session{form}{title}).", displayTitle='$session{form}{displayTitle}', description=".quote($session{form}{description}).", processMacros='$session{form}{processMacros}' where widgetId=$session{form}{wid}",$session{dbh}); +} + +#------------------------------------------------------------------- +sub www_cut { + if (WebGUI::Privilege::canEditPage()) { + WebGUI::SQL->write("update widget set pageId=2 where widgetId=".$session{form}{wid},$session{dbh}); + _reorderWidgets($session{page}{pageId}); + return ""; + } else { + return WebGUI::Privilege::insufficient(); + } +} + +#------------------------------------------------------------------- +sub www_delete { + my ($output); + if (WebGUI::Privilege::canEditPage()) { + $output .= '

    Please Confirm

    '; + $output .= 'Are you certain that you wish to delete this content?

    '; + $output .= '

    Yes, I\'m sure.'; + $output .= '    No, I made a mistake.
    '; + return $output; + } else { + return WebGUI::Privilege::insufficient(); + } +} + +#------------------------------------------------------------------- +sub www_deleteConfirm { + if (WebGUI::Privilege::canEditPage()) { + WebGUI::SQL->write("update widget set pageId=3 where widgetId=".$session{form}{wid},$session{dbh}); + _reorderWidgets($session{page}{pageId}); + return ""; + } else { + return WebGUI::Privilege::insufficient(); + } +} + +#------------------------------------------------------------------- +sub www_moveDown { + my (@data, $thisSeq); + if (WebGUI::Privilege::canEditPage()) { + ($thisSeq) = WebGUI::SQL->quickArray("select sequenceNumber from widget where widgetId=$session{form}{wid}",$session{dbh}); + @data = WebGUI::SQL->quickArray("select widgetId, min(sequenceNumber) from widget where pageId=$session{page}{pageId} and sequenceNumber>$thisSeq group by pageId",$session{dbh}); + if ($data[0] ne "") { + WebGUI::SQL->write("update widget set sequenceNumber=sequenceNumber+1 where widgetId=$session{form}{wid}",$session{dbh}); + WebGUI::SQL->write("update widget set sequenceNumber=sequenceNumber-1 where widgetId=$data[0]",$session{dbh}); + } + return ""; + } else { + return WebGUI::Privilege::insufficient(); + } +} + +#------------------------------------------------------------------- +sub www_moveUp { + my (@data, $thisSeq); + if (WebGUI::Privilege::canEditPage()) { + ($thisSeq) = WebGUI::SQL->quickArray("select sequenceNumber from widget where widgetId=$session{form}{wid}",$session{dbh}); + @data = WebGUI::SQL->quickArray("select widgetId, max(sequenceNumber) from widget where pageId=$session{page}{pageId} and sequenceNumber<$thisSeq group by pageId",$session{dbh}); + if ($data[0] ne "") { + WebGUI::SQL->write("update widget set sequenceNumber=sequenceNumber-1 where widgetId=$session{form}{wid}",$session{dbh}); + WebGUI::SQL->write("update widget set sequenceNumber=sequenceNumber+1 where widgetId=$data[0]",$session{dbh}); + } + return ""; + } else { + return WebGUI::Privilege::insufficient(); + } +} + +#------------------------------------------------------------------- +sub www_paste { + my ($output, $nextSeq); + if (WebGUI::Privilege::canEditPage()) { + ($nextSeq) = WebGUI::SQL->quickArray("select max(sequenceNumber)+1 from widget where pageId=$session{page}{pageId}",$session{dbh}); + WebGUI::SQL->write("update widget set pageId=$session{page}{pageId}, sequenceNumber='$nextSeq' where widgetId=$session{form}{wid}",$session{dbh}); + return ""; + } else { + return WebGUI::Privilege::insufficient(); + } +} + +1; diff --git a/lib/WebGUI/Widget/Article.pm b/lib/WebGUI/Widget/Article.pm new file mode 100644 index 000000000..722cc8c9b --- /dev/null +++ b/lib/WebGUI/Widget/Article.pm @@ -0,0 +1,174 @@ +package WebGUI::Widget::Article; + +#------------------------------------------------------------------- +# WebGUI is Copyright 2001 Plain Black Software. +#------------------------------------------------------------------- +# Please read the legal notices (docs/legal.txt) and the license +# (docs/license.txt) that came with this distribution before using +# this software. +#------------------------------------------------------------------- +# http://www.plainblack.com info@plainblack.com +#------------------------------------------------------------------- + +use strict; +use WebGUI::Macro; +use WebGUI::Privilege; +use WebGUI::Session; +use WebGUI::SQL; +use WebGUI::Utility; +use WebGUI::Widget; + +#------------------------------------------------------------------- +sub widgetName { + return "Article"; +} + +#------------------------------------------------------------------- +sub www_add { + my ($output); + if (WebGUI::Privilege::canEditPage()) { + $output = '

    Add Article

    '; + $output .= WebGUI::Form::hidden("widget","Article"); + $output .= WebGUI::Form::hidden("func","addSave"); + $output .= ''; + $output .= ''; + $output .= ''; + $output .= ''; + $output .= ''; + $output .= ''; + $output .= ''; + $output .= ''; + $output .= ''; + $output .= ''; + $output .= ''; + $output .= ''; + $output .= '
    Title'.WebGUI::Form::text("title",20,30).'
    Display the title?'.WebGUI::Form::checkbox("displayTitle",1).'
    Process macros?'.WebGUI::Form::checkbox("processMacros",1,1).'
    Start Date'.WebGUI::Form::text("startDate",20,30,'01/01/2000',1).'
    End Date'.WebGUI::Form::text("endDate",20,30,'01/01/2100',1).'
    Body'.WebGUI::Form::textArea("body",'',50,10,1).'
    Image'.WebGUI::Form::file("image").'
    Link Title'.WebGUI::Form::text("linkTitle",20,30).'
    Link URL'.WebGUI::Form::text("linkURL",20,2048).'
    Attachment'.WebGUI::Form::file("attachment").'
    '.WebGUI::Form::submit("save").'
    '; + return $output; + } else { + return WebGUI::Privilege::insufficient(); + } + return $output; +} + +#------------------------------------------------------------------- +sub www_addSave { + my ($widgetId, $displayTitle, $image, $attachment); + if (WebGUI::Privilege::canEditPage()) { + $widgetId = create(); + $image = saveAttachment("image",$widgetId); + $attachment = saveAttachment("attachment",$widgetId); + WebGUI::SQL->write("insert into Article set widgetId=$widgetId, startDate='".humanToMysqlDate($session{form}{startDate})."', endDate='".humanToMysqlDate($session{form}{endDate})."', body=".quote($session{form}{body}).", image=".quote($image).", linkTitle=".quote($session{form}{linkTitle}).", linkURL=".quote($session{form}{linkURL}).", attachment=".quote($attachment),$session{dbh}); + return ""; + } else { + return WebGUI::Privilege::insufficient(); + } +} + +#------------------------------------------------------------------- +sub www_deleteAttachment { + if (WebGUI::Privilege::canEditPage()) { + WebGUI::SQL->write("update Article set attachment='' where widgetId=$session{form}{wid}",$session{dbh}); + return www_edit(); + } else { + return WebGUI::Privilege::insufficient(); + } +} + +#------------------------------------------------------------------- +sub www_deleteImage { + if (WebGUI::Privilege::canEditPage()) { + WebGUI::SQL->write("update Article set image='' where widgetId=$session{form}{wid}",$session{dbh}); + return www_edit(); + } else { + return WebGUI::Privilege::insufficient(); + } +} + +#------------------------------------------------------------------- +sub www_edit { + my ($output, %article); + if (WebGUI::Privilege::canEditPage()) { + %article = WebGUI::SQL->quickHash("select widget.title, widget.displayTitle, date_format(Article.startDate,'%m/%d/%Y') as start, date_format(Article.endDate,'%m/%d/%Y') as end, Article.body, Article.image, Article.linkTitle, Article.linkURL, Article.attachment, widget.processMacros from widget left join Article on (widget.widgetId=Article.widgetId) where widget.widgetId=$session{form}{wid}",$session{dbh}); + $output = '

    Edit Article

    '; + $output .= WebGUI::Form::hidden("wid",$session{form}{wid}); + $output .= WebGUI::Form::hidden("func","editSave"); + $output .= ''; + $output .= ''; + $output .= ''; + $output .= ''; + $output .= ''; + $output .= ''; + $output .= ''; + if ($article{image} ne "") { + $output .= ''; + } else { + $output .= ''; + } + $output .= ''; + $output .= ''; + if ($article{attachment} ne "") { + $output .= ''; + } else { + $output .= ''; + } + $output .= ''; + $output .= '
    Title'.WebGUI::Form::text("title",20,30,$article{title}).'
    Display the title?'.WebGUI::Form::checkbox("displayTitle","1",$article{displayTitle}).'
    Process macros?'.WebGUI::Form::checkbox("processMacros","1",$article{processMacros}).'
    Start Date'.WebGUI::Form::text("startDate",20,30,$article{start},1).'
    End Date'.WebGUI::Form::text("endDate",20,30,$article{end},1).'
    Body'.WebGUI::Form::textArea("body",$article{body},50,10,1).'
    ImageDelete Image
    Image'.WebGUI::Form::file("image").'
    Link Title'.WebGUI::Form::text("linkTitle",20,30,$article{linkTitle}).'
    Link URL'.WebGUI::Form::text("linkURL",20,2048,$article{linkURL}).'
    AttachmentDelete Attachment
    Attachment'.WebGUI::Form::file("attachment").'
    '.WebGUI::Form::submit("save").'
    '; + return $output; + } else { + return WebGUI::Privilege::insufficient(); + } +} + +#------------------------------------------------------------------- +sub www_editSave { + my ($widgetId, $displayTitle, $image, $attachment); + if (WebGUI::Privilege::canEditPage()) { + update(); + $image = saveAttachment("image",$session{form}{wid}); + if ($image ne "") { + $image = ', image='.quote($image); + } + $attachment = saveAttachment("attachment",$session{form}{wid}); + if ($attachment ne "") { + $attachment = ', attachment='.quote($attachment); + } + WebGUI::SQL->write("update Article set startDate='".humanToMysqlDate($session{form}{startDate})."', endDate='".humanToMysqlDate($session{form}{endDate})."', body=".quote($session{form}{body}).", linkTitle=".quote($session{form}{linkTitle}).", linkURL=".quote($session{form}{linkURL}).$attachment.$image." where widgetId=$session{form}{wid}",$session{dbh}); + return ""; + } else { + return WebGUI::Privilege::insufficient(); + } +} + +#------------------------------------------------------------------- +sub www_view { + my (%data, @test, $output, $widgetId); + $widgetId = shift; + %data = WebGUI::SQL->quickHash("select widget.title, widget.displayTitle, widget.processMacros, Article.body, Article.image, Article.linkTitle, Article.linkURL, Article.attachment from widget,Article where widget.widgetId='$widgetId' and widget.WidgetId=Article.widgetId and Article.startDatenow()",$session{dbh}); + if (defined %data) { + if ($data{displayTitle} == 1) { + $output = "

    ".$data{title}."

    "; + } + if ($data{image} ne "") { + $output .= ''; + } + $output .= $data{body}; + if ($data{linkURL} ne "" && $data{linkTitle} ne "") { + $output .= '

    '.$data{linkTitle}.''; + } + if ($data{attachment} ne "") { + $output .= '

    [attachment: '.$data{attachment}.']'; + } + } + if ($data{processMacros} == 1) { + $output = WebGUI::Macro::process($output); + } + return $output; +} + + + + + + + +1; diff --git a/lib/WebGUI/Widget/EventsCalendar.pm b/lib/WebGUI/Widget/EventsCalendar.pm new file mode 100644 index 000000000..1e814c561 --- /dev/null +++ b/lib/WebGUI/Widget/EventsCalendar.pm @@ -0,0 +1,217 @@ +package WebGUI::Widget::EventsCalendar; + +#------------------------------------------------------------------- +# WebGUI is Copyright 2001 Plain Black Software. +#------------------------------------------------------------------- +# Please read the legal notices (docs/legal.txt) and the license +# (docs/license.txt) that came with this distribution before using +# this software. +#------------------------------------------------------------------- +# http://www.plainblack.com info@plainblack.com +#------------------------------------------------------------------- + +use strict; +use WebGUI::Privilege; +use WebGUI::Session; +use WebGUI::SQL; +use WebGUI::Utility; +use WebGUI::Widget; + +#------------------------------------------------------------------- +sub widgetName { + return "Events Calendar"; +} + +#------------------------------------------------------------------- +sub www_add { + my ($output); + if (WebGUI::Privilege::canEditPage()) { + $output = '

    Add Events Calendar

    '; + $output .= WebGUI::Form::hidden("widget","EventsCalendar"); + $output .= WebGUI::Form::hidden("func","addSave"); + $output .= ''; + $output .= ''; + $output .= ''; + $output .= ''; + $output .= '
    Title'.WebGUI::Form::text("title",20,30).'
    Display the title?'.WebGUI::Form::checkbox("displayTitle","1").'
    '.WebGUI::Form::submit("save").'
    '; + return $output; + } else { + return WebGUI::Privilege::insufficient(); + } + return $output; +} + +#------------------------------------------------------------------- +sub www_addSave { + my ($widgetId); + if (WebGUI::Privilege::canEditPage()) { + $widgetId = create(); + return ""; + } else { + return WebGUI::Privilege::insufficient(); + } +} + +#------------------------------------------------------------------- +sub www_addEvent { + my ($output, $today); + if (WebGUI::Privilege::canEditPage()) { + ($today) = WebGUI::SQL->quickArray("select date_format(date_add(now(), interval 1 day),'%m/%d/%Y')",$session{dbh}); + $output = '

    Add Event

    '; + $output .= WebGUI::Form::hidden("wid",$session{form}{wid}); + $output .= WebGUI::Form::hidden("func","addEventSave"); + $output .= ''; + $output .= ''; + $output .= ''; + $output .= ''; + $output .= ''; + $output .= ''; + $output .= '
    Name'.WebGUI::Form::text("name",20,30).'
    Description'.WebGUI::Form::textArea("description",'',50,10,1).'
    Start Date'.WebGUI::Form::text("startDate",20,30,$today,1).'
    End Date'.WebGUI::Form::text("endDate",20,30,$today,1).'
    '.WebGUI::Form::submit("save").'
    '; + return $output; + } else { + return WebGUI::Privilege::insufficient(); + } + return $output; +} + +#------------------------------------------------------------------- +sub www_addEventSave { + my ($eventId); + if (WebGUI::Privilege::canEditPage()) { + $eventId = getNextId("eventId"); + WebGUI::SQL->write("insert into event set widgetId=$session{form}{wid}, eventId=$eventId, name=".quote($session{form}{name}).", description=".quote($session{form}{description}).", startDate='".humanToMysqlDate($session{form}{startDate})."', endDate='".humanToMysqlDate($session{form}{endDate})."'",$session{dbh}); + return www_edit(); + } else { + return WebGUI::Privilege::insufficient(); + } +} + +#------------------------------------------------------------------- +sub www_deleteEvent { + my ($output); + if (WebGUI::Privilege::canEditPage()) { + $output = '

    Please Confirm

    '; + $output = 'Are you certain that you want to delete this event?

    '; + return $output; + } else { + return WebGUI::Privilege::insufficient(); + } +} + +#------------------------------------------------------------------- +sub www_deleteEventConfirm { + my ($output); + if (WebGUI::Privilege::canEditPage()) { + WebGUI::SQL->write("delete from event where eventId=$session{form}{eid}",$session{dbh}); + return www_edit(); + } else { + return WebGUI::Privilege::insufficient(); + } +} + +#------------------------------------------------------------------- +sub www_edit { + my ($output, %data, @event, $sth); + if (WebGUI::Privilege::canEditPage()) { + %data = WebGUI::SQL->quickHash("select widget.title, widget.displayTitle from widget where widget.widgetId=$session{form}{wid}",$session{dbh}); + $output = '

    Edit Events Calendar

    '; + $output .= WebGUI::Form::hidden("wid",$session{form}{wid}); + $output .= WebGUI::Form::hidden("func","editSave"); + $output .= ''; + $output .= ''; + $output .= ''; + $output .= ''; + $output .= '
    Title'.WebGUI::Form::text("title",20,30,$data{title}).'
    Display the title?'.WebGUI::Form::checkbox("displayTitle","1",$data{displayTitle}).'
    '.WebGUI::Form::submit("save").'
    '; + $output .= '

    Add New Event

    '; + $output .= ''; + $sth = WebGUI::SQL->read("select eventId, name from event where widgetId='$session{form}{wid}' order by startDate",$session{dbh}); + while (@event = $sth->array) { + $output .= ''; + } + $sth->finish; + $output .= '
    '.$event[1].'
    '; + return $output; + } else { + return WebGUI::Privilege::insufficient(); + } +} + +#------------------------------------------------------------------- +sub www_editSave { + if (WebGUI::Privilege::canEditPage()) { + update(); + return ""; + } else { + return WebGUI::Privilege::insufficient(); + } +} + +#------------------------------------------------------------------- +sub www_editEvent { + my ($output, %event); + if (WebGUI::Privilege::canEditPage()) { + %event = WebGUI::SQL->quickHash("select name, description, date_format(startDate,'%m/%d/%Y') as start, date_format(endDate,'%m/%d/%Y') as end from event where eventId='$session{form}{eid}'",$session{dbh}); + $output = '

    Edit Event

    '; + $output .= WebGUI::Form::hidden("wid",$session{form}{wid}); + $output .= WebGUI::Form::hidden("eid",$session{form}{eid}); + $output .= WebGUI::Form::hidden("func","editEventSave"); + $output .= ''; + $output .= '' +; + $output .= ''; + $output .= ''; + $output .= ''; + $output .= ''; + $output .= '
    Name'.WebGUI::Form::text("name",20,30,$event{name}).'
    Description'.WebGUI::Form::textArea("description",$event{description},50,10,1).'
    Start Date'.WebGUI::Form::text("startDate",20,30,$event{start},1).'
    End Date'.WebGUI::Form::text("endDate",20,30,$event{end},1).'
    '.WebGUI::Form::submit("save").'
    '; + return $output; + } else { + return WebGUI::Privilege::insufficient(); + } + return $output; +} + +#------------------------------------------------------------------- +sub www_editEventSave { + my ($eventId); + if (WebGUI::Privilege::canEditPage()) { + WebGUI::SQL->write("update event set name=".quote($session{form}{name}).", description=".quote($session{form}{description}).", startDate='".humanToMysqlDate($session{form}{startDate})."', endDate='".humanToMysqlDate($session{form}{endDate})."' where eventId=$session{form}{eid}",$session{dbh}); + return www_edit(); + } else { + return WebGUI::Privilege::insufficient(); + } +} + +#------------------------------------------------------------------- +sub www_view { + my (%data, @event, $output, $widgetId, $sth); + $widgetId = shift; + %data = WebGUI::SQL->quickHash("select widget.title, widget.displayTitle from widget where widget.widgetId='$widgetId'",$session{dbh}); + if (defined %data) { + if ($data{displayTitle} == 1) { + $output = "

    ".$data{title}."

    "; + } + $sth = WebGUI::SQL->read("select name, description, date_format(startDate,'%M'), date_format(startDate,'%e'), date_format(startDate,'%Y'), date_format(endDate,'%e') from event where widgetId='$widgetId' and startDate>now() order by startDate",$session{dbh}); + while (@event = $sth->array) { + $output .= "$event[2] $event[3]"; + if ($event[3] ne $event[5]) { + $output .= "-$event[5]"; + } + $output .= ", $event[4]"; + $output .= "
    "; + $output .= ''; + $output .= ''; + $output .= ''; + $output .= '
    '.$event[0].' - '.$event[1].'

    '; + } + $sth->finish; + } + return $output; +} + + + + + + + +1; diff --git a/lib/WebGUI/Widget/ExtraColumn.pm b/lib/WebGUI/Widget/ExtraColumn.pm new file mode 100644 index 000000000..a9c6a9eb7 --- /dev/null +++ b/lib/WebGUI/Widget/ExtraColumn.pm @@ -0,0 +1,107 @@ +package WebGUI::Widget::ExtraColumn; + +#------------------------------------------------------------------- +# WebGUI is Copyright 2001 Plain Black Software. +#------------------------------------------------------------------- +# Please read the legal notices (docs/legal.txt) and the license +# (docs/license.txt) that came with this distribution before using +# this software. +#------------------------------------------------------------------- +# http://www.plainblack.com info@plainblack.com +#------------------------------------------------------------------- + +use strict; +use WebGUI::Privilege; +use WebGUI::Session; +use WebGUI::SQL; +use WebGUI::Utility; +use WebGUI::Widget; + +#------------------------------------------------------------------- +sub widgetName { + return "Extra Column"; +} + +#------------------------------------------------------------------- +sub www_add { + my ($output); + if (WebGUI::Privilege::canEditPage()) { + $output = '

    Add Column

    '; + $output .= WebGUI::Form::hidden("widget","ExtraColumn"); + $output .= WebGUI::Form::hidden("func","addSave"); + $output .= WebGUI::Form::hidden("title","column"); + $output .= ''; + $output .= ''; + $output .= ''; + $output .= ''; + $output .= ''; + $output .= '
    Spacer'.WebGUI::Form::text("spacer",20,3).'
    Width'.WebGUI::Form::text("width",20,3).'
    StyleSheet Class'.WebGUI::Form::text("class",20,50).'
    '.WebGUI::Form::submit("save").'
    '; + return $output; + } else { + return WebGUI::Privilege::insufficient(); + } + return $output; +} + +#------------------------------------------------------------------- +sub www_addSave { + my ($widgetId, $displayTitle, $image, $attachment); + if (WebGUI::Privilege::canEditPage()) { + $widgetId = create(); + WebGUI::SQL->write("insert into ExtraColumn set widgetId=$widgetId, spacer='$session{form}{spacer}', width='$session{form}{width}', class=".quote($session{form}{class}),$session{dbh}); + return ""; + } else { + return WebGUI::Privilege::insufficient(); + } +} + +#------------------------------------------------------------------- +sub www_edit { + my ($output, %data); + if (WebGUI::Privilege::canEditPage()) { + %data = WebGUI::SQL->quickHash("select * from ExtraColumn where widgetId=$session{form}{wid}",$session{dbh}); + $output = '

    Edit Column

    '; + $output .= WebGUI::Form::hidden("wid",$session{form}{wid}); + $output .= WebGUI::Form::hidden("func","editSave"); + $output .= WebGUI::Form::hidden("title","column"); + $output .= ''; + $output .= ''; + $output .= ''; + $output .= ''; + $output .= ''; + $output .= '
    Spacer'.WebGUI::Form::text("spacer",20,3,$data{spacer}).'
    Width'.WebGUI::Form::text("width",20,3,$data{width}).'
    StyleSheet Class'.WebGUI::Form::text("class",20,30,$data{class}).'
    '.WebGUI::Form::submit("save").'
    '; + return $output; + } else { + return WebGUI::Privilege::insufficient(); + } +} + +#------------------------------------------------------------------- +sub www_editSave { + my ($widgetId, $displayTitle); + if (WebGUI::Privilege::canEditPage()) { + WebGUI::SQL->write("update ExtraColumn set spacer='$session{form}{spacer}', width='$session{form}{width}', class=".quote($session{form}{class})." where widgetId=$session{form}{wid}",$session{dbh}); + return ""; + } else { + return WebGUI::Privilege::insufficient(); + } +} + +#------------------------------------------------------------------- +sub www_view { + my (%data, @test, $output, $widgetId); + $widgetId = shift; + %data = WebGUI::SQL->quickHash("select * from ExtraColumn where widgetId='$widgetId'",$session{dbh}); + if (defined %data) { + $output = ''; + } + return $output; +} + + + + + + + +1; diff --git a/lib/WebGUI/Widget/FAQ.pm b/lib/WebGUI/Widget/FAQ.pm new file mode 100644 index 000000000..d8d896cb5 --- /dev/null +++ b/lib/WebGUI/Widget/FAQ.pm @@ -0,0 +1,258 @@ +package WebGUI::Widget::FAQ; + +#------------------------------------------------------------------- +# WebGUI is Copyright 2001 Plain Black Software. +#------------------------------------------------------------------- +# Please read the legal notices (docs/legal.txt) and the license +# (docs/license.txt) that came with this distribution before using +# this software. +#------------------------------------------------------------------- +# http://www.plainblack.com info@plainblack.com +#------------------------------------------------------------------- + +use strict; +use WebGUI::Macro; +use WebGUI::Privilege; +use WebGUI::Session; +use WebGUI::SQL; +use WebGUI::Utility; +use WebGUI::Widget; + +#------------------------------------------------------------------- +sub _reorderQuestions { + my ($sth, $i, $qid); + $sth = WebGUI::SQL->read("select questionId from faqQuestion where widgetId=$_[0] order by sequenceNumber",$session{dbh}); + while (($qid) = $sth->array) { + WebGUI::SQL->write("update faqQuestion set sequenceNumber='$i' where questionId=$qid",$session{dbh}); + $i++; + } + $sth->finish; +} + +#------------------------------------------------------------------- +sub widgetName { + return "F.A.Q."; +} + +#------------------------------------------------------------------- +sub www_add { + my ($output); + if (WebGUI::Privilege::canEditPage()) { + $output = '

    Add F.A.Q.

    '; + $output .= WebGUI::Form::hidden("widget","FAQ"); + $output .= WebGUI::Form::hidden("func","addSave"); + $output .= ''; + $output .= ''; + $output .= ''; + $output .= ''; + $output .= ''; + $output .= ''; + $output .= '
    Title'.WebGUI::Form::text("title",20,30).'
    Display the title?'.WebGUI::Form::checkbox("displayTitle",1,1).'
    Process Macros?'.WebGUI::Form::checkbox("processMacros",1,1).'
    Description'.WebGUI::Form::textArea("description").'
    '.WebGUI::Form::submit("save").'
    '; + return $output; + } else { + return WebGUI::Privilege::insufficient(); + } + return $output; +} + +#------------------------------------------------------------------- +sub www_addSave { + my ($widgetId); + if (WebGUI::Privilege::canEditPage()) { + $widgetId = create(); + return ""; + } else { + return WebGUI::Privilege::insufficient(); + } +} + +#------------------------------------------------------------------- +sub www_addQuestion { + my ($output); + if (WebGUI::Privilege::canEditPage()) { + $output = '

    Add Question

    '; + $output .= WebGUI::Form::hidden("wid",$session{form}{wid}); + $output .= WebGUI::Form::hidden("func","addQuestionSave"); + $output .= ''; + $output .= ''; + $output .= ''; + $output .= ''; + $output .= '
    Question'.WebGUI::Form::textArea("question",'',50,3).'
    Answer'.WebGUI::Form::textArea("answer").'
    '.WebGUI::Form::submit("save").'
    '; + return $output; + } else { + return WebGUI::Privilege::insufficient(); + } + return $output; +} + +#------------------------------------------------------------------- +sub www_addQuestionSave { + my ($questionId, $nextSeq); + if (WebGUI::Privilege::canEditPage()) { + ($nextSeq) = WebGUI::SQL->quickArray("select max(sequenceNumber)+1 from faqQuestion where widgetId=$session{form}{wid}",$session{dbh}); + $questionId = getNextId("questionId"); + WebGUI::SQL->write("insert into faqQuestion set widgetId=$session{form}{wid}, questionId=$questionId, sequenceNumber='$nextSeq', question=".quote($session{form}{question}).", answer=".quote($session{form}{answer}),$session{dbh}); + return www_edit(); + } else { + return WebGUI::Privilege::insufficient(); + } +} + +#------------------------------------------------------------------- +sub www_deleteQuestion { + my ($output); + if (WebGUI::Privilege::canEditPage()) { + $output = '

    Please Confirm

    '; + $output = 'Are you certain that you want to delete this question?

    '; + return $output; + } else { + return WebGUI::Privilege::insufficient(); + } +} + +#------------------------------------------------------------------- +sub www_deleteQuestionConfirm { + my ($output); + if (WebGUI::Privilege::canEditPage()) { + WebGUI::SQL->write("delete from faqQuestions where questionId=$session{form}{qid}",$session{dbh}); + _reorderQuestions($session{form}{wid}); + return www_edit(); + } else { + return WebGUI::Privilege::insufficient(); + } +} + +#------------------------------------------------------------------- +sub www_edit { + my ($output, %data, @question, $sth); + if (WebGUI::Privilege::canEditPage()) { + %data = WebGUI::SQL->quickHash("select * from widget where widget.widgetId=$session{form}{wid}",$session{dbh}); + $output = '

    Edit Link List

    '; + $output .= WebGUI::Form::hidden("wid",$session{form}{wid}); + $output .= WebGUI::Form::hidden("func","editSave"); + $output .= ''; + $output .= ''; + $output .= ''; + $output .= ''; + $output .= ''; + $output .= ''; + $output .= '
    Title'.WebGUI::Form::text("title",20,30,$data{title}).'
    Display the title?'.WebGUI::Form::checkbox("displayTitle","1",$data{displayTitle}).'
    Process macros?'.WebGUI::Form::checkbox("processMacros","1",$data{processMacros}).'
    Description'.WebGUI::Form::textArea("description",$data{description}).'
    '.WebGUI::Form::submit("save").'
    '; + $output .= '

    Add New Question

    '; + $output .= ''; + $sth = WebGUI::SQL->read("select questionId,question from faqQuestion where widgetId='$session{form}{wid}' order by sequenceNumber",$session{dbh}); + while (@question = $sth->array) { + $output .= ''; + } + $sth->finish; + $output .= '
    '.$question[1].'
    '; + return $output; + } else { + return WebGUI::Privilege::insufficient(); + } +} + +#------------------------------------------------------------------- +sub www_editSave { + if (WebGUI::Privilege::canEditPage()) { + update(); + return ""; + } else { + return WebGUI::Privilege::insufficient(); + } +} + +#------------------------------------------------------------------- +sub www_editQuestion { + my ($output, %question); + if (WebGUI::Privilege::canEditPage()) { + %question = WebGUI::SQL->quickHash("select * from faqQuestion where questionId='$session{form}{qid}'",$session{dbh}); + $output = '

    Edit Question

    '; + $output .= WebGUI::Form::hidden("wid",$session{form}{wid}); + $output .= WebGUI::Form::hidden("qid",$session{form}{qid}); + $output .= WebGUI::Form::hidden("func","editQuestionSave"); + $output .= ''; + $output .= ''; + $output .= ''; + $output .= ''; + $output .= '
    Question'.WebGUI::Form::textArea("question",$question{question},50,3).'
    Answer'.WebGUI::Form::textArea("answer",$question{answer}).'
    '.WebGUI::Form::submit("save").'
    '; + return $output; + } else { + return WebGUI::Privilege::insufficient(); + } + return $output; +} + +#------------------------------------------------------------------- +sub www_editQuestionSave { + if (WebGUI::Privilege::canEditPage()) { + WebGUI::SQL->write("update faqQuestion set question=".quote($session{form}{question}).", answer=".quote($session{form}{answer})." where questionId=$session{form}{qid}",$session{dbh}); + return ""; + } else { + return WebGUI::Privilege::insufficient(); + } +} + +#------------------------------------------------------------------- +sub www_moveQuestionDown { + my (@data, $thisSeq); + if (WebGUI::Privilege::canEditPage()) { + ($thisSeq) = WebGUI::SQL->quickArray("select sequenceNumber from faqQuestion where questionId=$session{form}{qid}",$session{dbh}); + @data = WebGUI::SQL->quickArray("select questionId, min(sequenceNumber) from faqQuestion where widgetId=$session{form}{wid} and sequenceNumber>$thisSeq group by widgetId",$session{dbh}); + if ($data[0] ne "") { + WebGUI::SQL->write("update faqQuestion set sequenceNumber=sequenceNumber+1 where questionId=$session{form}{qid}",$session{dbh}); + WebGUI::SQL->write("update faqQuestion set sequenceNumber=sequenceNumber-1 where questionId=$data[0]",$session{dbh}); + } + return www_edit(); + } else { + return WebGUI::Privilege::insufficient(); + } +} + +#------------------------------------------------------------------- +sub www_moveQuestionUp { + my (@data, $thisSeq); + if (WebGUI::Privilege::canEditPage()) { + ($thisSeq) = WebGUI::SQL->quickArray("select sequenceNumber from faqQuestion where questionId=$session{form}{qid}",$session{dbh}); + @data = WebGUI::SQL->quickArray("select questionId, max(sequenceNumber) from faqQuestion where widgetId=$session{form}{wid} and sequenceNumber<$thisSeq group by widgetId",$session{dbh}); + if ($data[0] ne "") { + WebGUI::SQL->write("update faqQuestion set sequenceNumber=sequenceNumber-1 where questionId=$session{form}{qid}",$session{dbh}); + WebGUI::SQL->write("update faqQuestion set sequenceNumber=sequenceNumber+1 where questionId=$data[0]",$session{dbh}); + } + return www_edit(); + } else { + return WebGUI::Privilege::insufficient(); + } +} + +#------------------------------------------------------------------- +sub www_view { + my (%data, @question, $output, $widgetId, $sth, $qNa); + $widgetId = shift; + %data = WebGUI::SQL->quickHash("select * from widget where widget.widgetId='$widgetId'",$session{dbh}); + if (defined %data) { + if ($data{displayTitle} == 1) { + $output = "

    ".$data{title}."

    "; + } + if ($data{description} ne "") { + $output .= $data{description}; + } + $output .= '
      '; + $sth = WebGUI::SQL->read("select questionId,question,answer from faqQuestion where widgetId='$widgetId' order by sequenceNumber",$session{dbh}); + while (@question = $sth->array) { + $output .= '
    • '.$question[1].''; + $qNa .= ''.$question[1].'
      '.$question[2].'

      '; + } + $sth->finish; + $output .= '

    '.$qNa; + } + if ($data{processMacros} == 1) { + $output = WebGUI::Macro::process($output); + } + return $output; +} + + + + + +1; diff --git a/lib/WebGUI/Widget/LinkList.pm b/lib/WebGUI/Widget/LinkList.pm new file mode 100644 index 000000000..da27f9d5c --- /dev/null +++ b/lib/WebGUI/Widget/LinkList.pm @@ -0,0 +1,253 @@ +package WebGUI::Widget::LinkList; + +#------------------------------------------------------------------- +# WebGUI is Copyright 2001 Plain Black Software. +#------------------------------------------------------------------- +# Please read the legal notices (docs/legal.txt) and the license +# (docs/license.txt) that came with this distribution before using +# this software. +#------------------------------------------------------------------- +# http://www.plainblack.com info@plainblack.com +#------------------------------------------------------------------- + +use strict; +use WebGUI::Privilege; +use WebGUI::Session; +use WebGUI::SQL; +use WebGUI::Utility; +use WebGUI::Widget; + +#------------------------------------------------------------------- +sub _reorderLinks { + my ($sth, $i, $lid); + $sth = WebGUI::SQL->read("select linkId from link where widgetId=$_[0] order by sequenceNumber",$session{dbh}); + while (($lid) = $sth->array) { + WebGUI::SQL->write("update link set sequenceNumber='$i' where linkId=$lid",$session{dbh}); + $i++; + } + $sth->finish; +} + +#------------------------------------------------------------------- +sub widgetName { + return "Link List"; +} + +#------------------------------------------------------------------- +sub www_add { + my ($output); + if (WebGUI::Privilege::canEditPage()) { + $output = '

    Add Link List

    '; + $output .= WebGUI::Form::hidden("widget","LinkList"); + $output .= WebGUI::Form::hidden("func","addSave"); + $output .= ''; + $output .= ''; + $output .= ''; + $output .= ''; + $output .= '
    Title'.WebGUI::Form::text("title",20,30).'
    Display the title?'.WebGUI::Form::checkbox("displayTitle","1").'
    '.WebGUI::Form::submit("save").'
    '; + return $output; + } else { + return WebGUI::Privilege::insufficient(); + } + return $output; +} + +#------------------------------------------------------------------- +sub www_addSave { + my ($widgetId); + if (WebGUI::Privilege::canEditPage()) { + $widgetId = create(); + return ""; + } else { + return WebGUI::Privilege::insufficient(); + } +} + +#------------------------------------------------------------------- +sub www_addLink { + my ($output, $today); + if (WebGUI::Privilege::canEditPage()) { + ($today) = WebGUI::SQL->quickArray("select date_format(date_add(now(), interval 1 day),'%m/%d/%Y')",$session{dbh}); + $output = '

    Add Link

    '; + $output .= WebGUI::Form::hidden("wid",$session{form}{wid}); + $output .= WebGUI::Form::hidden("func","addLinkSave"); + $output .= ''; + $output .= ''; + $output .= ''; + $output .= ''; + $output .= ''; + $output .= '
    Name'.WebGUI::Form::text("name",20,30).'
    URL'.WebGUI::Form::text("url",20,1024).'
    Description'.WebGUI::Form::textArea("description",'',50,10).'
    '.WebGUI::Form::submit("save").'
    '; + return $output; + } else { + return WebGUI::Privilege::insufficient(); + } + return $output; +} + +#------------------------------------------------------------------- +sub www_addLinkSave { + my ($linkId, $nextSeq); + if (WebGUI::Privilege::canEditPage()) { + ($nextSeq) = WebGUI::SQL->quickArray("select max(sequenceNumber)+1 from link where widgetId=$session{form}{wid}",$session{dbh}); + $linkId = getNextId("linkId"); + WebGUI::SQL->write("insert into link set widgetId=$session{form}{wid}, linkId=$linkId, name=".quote($session{form}{name}).", sequenceNumber='$nextSeq', url=".quote($session{form}{url}).", description=".quote($session{form}{description}),$session{dbh}); + return www_edit(); + } else { + return WebGUI::Privilege::insufficient(); + } +} + +#------------------------------------------------------------------- +sub www_deleteLink { + my ($output); + if (WebGUI::Privilege::canEditPage()) { + $output = '

    Please Confirm

    '; + $output = 'Are you certain that you want to delete this link?

    '; + return $output; + } else { + return WebGUI::Privilege::insufficient(); + } +} + +#------------------------------------------------------------------- +sub www_deleteLinkConfirm { + my ($output); + if (WebGUI::Privilege::canEditPage()) { + WebGUI::SQL->write("delete from link where linkId=$session{form}{lid}",$session{dbh}); + _reorderLinks($session{form}{wid}); + return www_edit(); + } else { + return WebGUI::Privilege::insufficient(); + } +} + +#------------------------------------------------------------------- +sub www_edit { + my ($output, %data, @link, $sth); + if (WebGUI::Privilege::canEditPage()) { + %data = WebGUI::SQL->quickHash("select widget.title, widget.displayTitle from widget where widget.widgetId=$session{form}{wid}",$session{dbh}); + $output = '

    Edit Link List

    '; + $output .= WebGUI::Form::hidden("wid",$session{form}{wid}); + $output .= WebGUI::Form::hidden("func","editSave"); + $output .= ''; + $output .= ''; + $output .= ''; + $output .= ''; + $output .= '
    Title'.WebGUI::Form::text("title",20,30,$data{title}).'
    Display the title?'.WebGUI::Form::checkbox("displayTitle","1",$data{displayTitle}).'
    '.WebGUI::Form::submit("save").'
    '; + $output .= '

    Add New Link

    '; + $output .= ''; + $sth = WebGUI::SQL->read("select linkId, name from link where widgetId='$session{form}{wid}' order by sequenceNumber",$session{dbh}); + while (@link = $sth->array) { + $output .= ''; + } + $sth->finish; + $output .= '
    '.$link[1].'
    '; + return $output; + } else { + return WebGUI::Privilege::insufficient(); + } +} + +#------------------------------------------------------------------- +sub www_editSave { + if (WebGUI::Privilege::canEditPage()) { + update(); + return ""; + } else { + return WebGUI::Privilege::insufficient(); + } +} + +#------------------------------------------------------------------- +sub www_editLink { + my ($output, %link); + if (WebGUI::Privilege::canEditPage()) { + %link = WebGUI::SQL->quickHash("select name, url, description from link where linkId='$session{form}{lid}'",$session{dbh}); + $output = '

    Edit Link

    '; + $output .= WebGUI::Form::hidden("wid",$session{form}{wid}); + $output .= WebGUI::Form::hidden("lid",$session{form}{lid}); + $output .= WebGUI::Form::hidden("func","editEventSave"); + $output .= ''; + $output .= ''; + $output .= ''; + $output .= ''; + $output .= ''; + $output .= '
    Name'.WebGUI::Form::text("name",20,30,$link{name}).'
    URL'.WebGUI::Form::text("url",20,2048,$link{url}).'
    Description'.WebGUI::Form::textArea("description",$link{description},50,10).'
    '.WebGUI::Form::submit("save").'
    '; + return $output; + } else { + return WebGUI::Privilege::insufficient(); + } + return $output; +} + +#------------------------------------------------------------------- +sub www_editLinkSave { + if (WebGUI::Privilege::canEditPage()) { + WebGUI::SQL->write("update link set name=".quote($session{form}{name}).", url=".quote($session{form}{url}).", description=".quote($session{form}{description})." where linkId=$session{form}{lid}",$session{dbh}); + return ""; + } else { + return WebGUI::Privilege::insufficient(); + } +} + +#------------------------------------------------------------------- +sub www_moveLinkDown { + my (@data, $thisSeq); + if (WebGUI::Privilege::canEditPage()) { + ($thisSeq) = WebGUI::SQL->quickArray("select sequenceNumber from link where linkId=$session{form}{lid}",$session{dbh}); + @data = WebGUI::SQL->quickArray("select linkId, min(sequenceNumber) from link where widgetId=$session{form}{wid} and sequenceNumber>$thisSeq group by widgetId",$session{dbh}); + if ($data[0] ne "") { + WebGUI::SQL->write("update link set sequenceNumber=sequenceNumber+1 where linkId=$session{form}{lid}",$session{dbh}); + WebGUI::SQL->write("update link set sequenceNumber=sequenceNumber-1 where linkId=$data[0]",$session{dbh}); + } + return www_edit(); + } else { + return WebGUI::Privilege::insufficient(); + } +} + +#------------------------------------------------------------------- +sub www_moveLinkUp { + my (@data, $thisSeq); + if (WebGUI::Privilege::canEditPage()) { + ($thisSeq) = WebGUI::SQL->quickArray("select sequenceNumber from link where linkId=$session{form}{lid}",$session{dbh}); + @data = WebGUI::SQL->quickArray("select linkId, max(sequenceNumber) from link where widgetId=$session{form}{wid} and sequenceNumber<$thisSeq group by widgetId",$session{dbh}); + if ($data[0] ne "") { + WebGUI::SQL->write("update link set sequenceNumber=sequenceNumber-1 where linkId=$session{form}{lid}",$session{dbh}); + WebGUI::SQL->write("update link set sequenceNumber=sequenceNumber+1 where linkId=$data[0]",$session{dbh}); + } + return www_edit(); + } else { + return WebGUI::Privilege::insufficient(); + } +} + +#------------------------------------------------------------------- +sub www_view { + my (%data, @link, $output, $widgetId, $sth); + $widgetId = shift; + %data = WebGUI::SQL->quickHash("select widget.title, widget.displayTitle from widget where widget.widgetId='$widgetId'",$session{dbh}); + if (defined %data) { + if ($data{displayTitle} == 1) { + $output = "

    ".$data{title}."

    "; + } + $sth = WebGUI::SQL->read("select name, url, description from link where widgetId='$widgetId' order by sequenceNumber",$session{dbh}); + while (@link = $sth->array) { + $output .= '
  • '.$link[0].''; + if ($link[2] ne "") { + $output .= ' - '.$link[2]; + } + $output .= '
    '; + } + $sth->finish; + } + return $output; +} + + + + + + + +1; diff --git a/lib/WebGUI/Widget/MessageBoard.pm b/lib/WebGUI/Widget/MessageBoard.pm new file mode 100644 index 000000000..55ae9523d --- /dev/null +++ b/lib/WebGUI/Widget/MessageBoard.pm @@ -0,0 +1,359 @@ +package WebGUI::Widget::MessageBoard; + +#------------------------------------------------------------------- +# WebGUI is Copyright 2001 Plain Black Software. +#------------------------------------------------------------------- +# Please read the legal notices (docs/legal.txt) and the license +# (docs/license.txt) that came with this distribution before using +# this software. +#------------------------------------------------------------------- +# http://www.plainblack.com info@plainblack.com +#------------------------------------------------------------------- + +use strict; +use WebGUI::Privilege; +use WebGUI::Session; +use WebGUI::SQL; +use WebGUI::Utility; +use WebGUI::Widget; + +#------------------------------------------------------------------- +sub _getBoardProperties { + my (%board); + %board = WebGUI::SQL->quickHash("select widget.title, widget.displayTitle, widget.description, MessageBoard.groupToPost, MessageBoard.messagesPerPage, MessageBoard.editTimeout from widget left join MessageBoard on (widget.widgetId=MessageBoard.widgetId) where widget.widgetId=$_[0]",$session{dbh}); + return %board; +} + +#------------------------------------------------------------------- +sub _traverseReplyTree { + my ($sth, @data, $html, $depth, $i); + for ($i=0;$i<=$_[1];$i++) { + $depth .= "  "; + } + $sth = WebGUI::SQL->read("select messageId,substring(subject,1,30),username,date_format(dateOfPost,'%c/%e %l:%i%p') from message where pid=$_[0] order by messageId", $session{dbh}); + while (@data = $sth->array) { + $html .= ''.$data[1].''.$data[2].''.$data[3].''; + $html .= _traverseReplyTree($data[0],$_[1]+1); + } + $sth->finish; + return $html; +} + +#------------------------------------------------------------------- +sub widgetName { + return "Message Board"; +} + +#------------------------------------------------------------------- +sub www_add { + my ($output, %hash); + tie %hash, "Tie::IxHash"; + if (WebGUI::Privilege::canEditPage()) { + $output = '

    Add Message Board

    '; + $output .= WebGUI::Form::hidden("widget","MessageBoard"); + $output .= WebGUI::Form::hidden("func","addSave"); + $output .= ''; + $output .= ''; + $output .= ''; + $output .= ''; + %hash = WebGUI::SQL->buildHash("select groupId,groupName from groups where groupName<>'Reserved' order by groupName",$session{dbh}); + $output .= ''; + $output .= ''; + $output .= ''; + $output .= ''; + $output .= '
    Title'.WebGUI::Form::text("title",20,30).'
    Display the title?'.WebGUI::Form::checkbox("displayTitle",1,1).'
    Description'.WebGUI::Form::textArea("description",'').'
    Who can post?'.WebGUI::Form::selectList("groupToPost",\%hash,'',1).'
    Messages Per Page'.WebGUI::Form::text("messagesPerPage",20,2,50).'
    Edit Timeout'.WebGUI::Form::text("editTimeout",20,3,1).'
    '.WebGUI::Form::submit("save").'
    '; + return $output; + } else { + return WebGUI::Privilege::insufficient(); + } + return $output; +} + +#------------------------------------------------------------------- +sub www_addSave { + my ($widgetId); + if (WebGUI::Privilege::canEditPage()) { + $widgetId = create(); + WebGUI::SQL->write("insert into MessageBoard set widgetId=$widgetId, groupToPost=$session{form}{groupToPost}, messagesPerPage=$session{form}{messagesPerPage}, editTimeout=$session{form}{editTimeout}",$session{dbh}); + return ""; + } else { + return WebGUI::Privilege::insufficient(); + } +} + +#------------------------------------------------------------------- +sub www_edit { + my ($output, %board, %hash, @array); + tie %hash, "Tie::IxHash"; + if (WebGUI::Privilege::canEditPage()) { + %board = _getBoardProperties($session{form}{wid}); + $output = '

    Edit Message Board

    '; + $output .= WebGUI::Form::hidden("wid",$session{form}{wid}); + $output .= WebGUI::Form::hidden("func","editSave"); + $output .= ''; + $output .= ''; + $output .= ''; + $output .= ''; + %hash = WebGUI::SQL->buildHash("select groupId,groupName from groups where groupName<>'Reserved' order by groupName",$session{dbh}); + $array[0] = $board{groupToPost}; + $output .= ''; + $output .= ''; + $output .= ''; + $output .= ''; + $output .= '
    Title'.WebGUI::Form::text("title",20,30,$board{title}).'
    Display the title?'.WebGUI::Form::checkbox("displayTitle","1",$board{displayTitle}).'
    Description'.WebGUI::Form::textArea("description",$board{description}).'
    Who can post?'.WebGUI::Form::selectList("groupToPost",\%hash,\@array,1).'
    Messages Per Page'.WebGUI::Form::text("messagesPerPage",20,2,$board{messagesPerPage}).'
    Edit Timeout'.WebGUI::Form::text("editTimeout",20,2,$board{editTimeout}).'
    '.WebGUI::Form::submit("save").'
    '; + return $output; + } else { + return WebGUI::Privilege::insufficient(); + } + return $output; +} + +#------------------------------------------------------------------- +sub www_editSave { + if (WebGUI::Privilege::canEditPage()) { + update(); + WebGUI::SQL->write("update MessageBoard set groupToPost=$session{form}{groupToPost}, messagesPerPage=$session{form}{messagesPerPage}, editTimeout=$session{form}{editTimeout} where widgetId=$session{form}{wid}",$session{dbh}); + return ""; + } else { + return WebGUI::Privilege::insufficient(); + } +} + +#------------------------------------------------------------------- +sub www_editMessage { + my ($html, %board, %message); + %board = _getBoardProperties($session{form}{wid}); + if (WebGUI::Privilege::isInGroup($board{groupToPost},$session{user}{userId})) { + %message = WebGUI::SQL->quickHash("select * from message where messageId=$session{form}{mid}",$session{dbh}); + $html .= '
    '; + if ($board{displayTitle}) { + $html .= $board{title}; + } + $html .= 'Editing Message...
    '; + $html .= '
    '; + $html .= WebGUI::Form::hidden("func","editMessageSave"); + $html .= WebGUI::Form::hidden("wid",$session{form}{wid}); + $html .= WebGUI::Form::hidden("mid",$session{form}{mid}); + $html .= ''; + $html .= ''; + $html .= ''; + $html .= '
    Subject'.WebGUI::Form::text("subject",30,255,$message{subject}).'
    Message'.WebGUI::Form::textArea("message",$message{message},50,6,1).'
    '.WebGUI::Form::submit("Save This Edit").'
    '; + $html .= www_showMessage(); + } else { + $html = WebGUI::Privilege::insufficient(); + } + return $html; +} + +#------------------------------------------------------------------- +sub www_editMessageSave { + my (%board); + %board = _getBoardProperties($session{form}{wid}); + if (WebGUI::Privilege::isInGroup($board{groupToPost},$session{user}{userId})) { + if ($session{form}{subject} eq "") { + $session{form}{subject} = 'no subject'; + } + if ($session{form}{message} eq "") { + $session{form}{subject} .= ' (eom)'; + } + WebGUI::SQL->write("update message set subject=".quote($session{form}{subject}).", message=".quote("\n --- (Edited at ".localtime(time).") --- \n\n".$session{form}{message})." where messageId=$session{form}{mid}",$session{dbh}); + return www_showMessage(); + } else { + return WebGUI::Privilege::insufficient(); + } +} + +#------------------------------------------------------------------- +sub www_postNewMessage { + my ($html, %board); + %board = _getBoardProperties($session{form}{wid}); + if (WebGUI::Privilege::isInGroup($board{groupToPost},$session{user}{userId})) { + $html .= '
    '; + if ($board{displayTitle}) { + $html .= $board{title}; + } + $html .= 'Posting New Message...
    '; + $html .= '
    '; + $html .= WebGUI::Form::hidden("func","postNewMessageSave"); + $html .= WebGUI::Form::hidden("wid",$session{form}{wid}); + $html .= ''; + $html .= ''; + $html .= ''; + $html .= '
    Subject'.WebGUI::Form::text("subject",30,255).'
    Message'.WebGUI::Form::textArea("message",'',50,6,1).'
    '.WebGUI::Form::submit("Post This Message").'
    '; + } else { + $html = WebGUI::Privilege::insufficient(); + } + return $html; +} + +#------------------------------------------------------------------- +sub www_postNewMessageSave { + my ($mid, %board); + %board = _getBoardProperties($session{form}{wid}); + if (WebGUI::Privilege::isInGroup($board{groupToPost},$session{user}{userId})) { + if ($session{form}{subject} eq "") { + $session{form}{subject} = 'no subject'; + } + if ($session{form}{message} eq "") { + $session{form}{subject} .= ' (eom)'; + } + $mid = getNextId("messageId"); + WebGUI::SQL->write("insert into message set messageId=$mid, userId=$session{user}{userId}, username=".quote($session{user}{username}).", subject=".quote($session{form}{subject}).", message=".quote($session{form}{message}).", widgetId=$session{form}{wid}, pid=0, dateOfPost=now()",$session{dbh}); + WebGUI::SQL->write("update message set rid=$mid where messageId=$mid",$session{dbh}); + return www_view($session{form}{wid}); + } else { + return WebGUI::Privilege::insufficient(); + } +} + +#------------------------------------------------------------------- +sub www_postReply { + my ($html, %board, $subject); + %board = _getBoardProperties($session{form}{wid}); + if (WebGUI::Privilege::isInGroup($board{groupToPost},$session{user}{userId})) { + ($subject) = WebGUI::SQL->quickArray("select subject from message where messageId=$session{form}{mid}", $session{dbh}); + $subject = "Re: ".$subject; + $html .= '
    '; + if ($board{displayTitle}) { + $html .= $board{title}; + } + $html .= 'Posting Reply...
    '; + $html .= '
    '; + $html .= WebGUI::Form::hidden("func","postReplySave"); + $html .= WebGUI::Form::hidden("wid",$session{form}{wid}); + $html .= WebGUI::Form::hidden("mid",$session{form}{mid}); + $html .= ''; + $html .= ''; + $html .= ''; + $html .= '
    Subject'.WebGUI::Form::text("subject",30,255,$subject).'
    Message'.WebGUI::Form::textArea("message",'',50,6,1).'
    '.WebGUI::Form::submit("Post This Reply").'
    '; + $html .= www_showMessage(); + } else { + $html = WebGUI::Privilege::insufficient(); + } + return $html; +} + +#------------------------------------------------------------------- +sub www_postReplySave { + my ($rid, %board); + %board = _getBoardProperties($session{form}{wid}); + if (WebGUI::Privilege::isInGroup($board{groupToPost},$session{user}{userId})) { + if ($session{form}{subject} eq "") { + $session{form}{subject} = 'no subject'; + } + if ($session{form}{message} eq "") { + $session{form}{subject} .= ' (eom)'; + } + ($rid) = WebGUI::SQL->quickArray("select rid from message where messageId=$session{form}{mid}",$session{dbh}); + WebGUI::SQL->write("insert into message set userId=$session{user}{userId}, username=".quote($session{user}{username}).", subject=".quote($session{form}{subject}).", message=".quote($session{form}{message}).", rid=$rid, widgetId=$session{form}{wid}, pid=$session{form}{mid}, dateOfPost=now()", $session{dbh}); + return www_showMessage(); + } else { + return WebGUI::Privilege::insufficient(); + } +} + +#------------------------------------------------------------------- +sub www_showMessage { + my (@data, $html, %board, %message); + %message = WebGUI::SQL->quickHash("select * from message where messageId=$session{form}{mid}",$session{dbh}); + %board = _getBoardProperties($session{form}{wid}); + $html .= '
    '; + if ($board{displayTitle}) { + $html .= $board{title}; + } + $html .= ''; + @data = WebGUI::SQL->quickArray("select unix_timestamp()-unix_timestamp(dateOfPost) from message where messageId=$session{form}{mid}",$session{dbh}); + if ($data[0] < 3600*$board{editTimeout} && $message{'userId'} eq $session{user}{userId}) { + $html .= 'Edit Message · '; + } + $html .= 'Post Reply
    '; + $html .= ''; + $html .= '
    '; + $html .= "Subject: ".$message{subject}."
    "; + $html .= "Author: ".$message{username}."
    "; + $html .= "Date: ".$message{dateOfPost}."
    "; + $html .= "Message ID: ".$message{widgetId}."-".$message{rid}."-".$message{pid}."-".$message{mid}."
    "; + $html .= '
    '; + $message{message} =~ s/\n/\/g; + $html .= $message{message}; + $html .= '

    '; + @data = WebGUI::SQL->quickArray("select max(messageId) from message where widgetId=$message{widgetId} and pid=0 and messageId<$message{rid}",$session{dbh}); + if ($data[0] ne "") { + $html .= '« Previous Thread'; + } else { + $html .= '« Previous Thread'; + } + $html .= ' · Back To Message List · '; + @data = WebGUI::SQL->quickArray("select min(messageId) from message where widgetId=$message{widgetId} and pid=0 and messageId>$message{rid}",$session{dbh}); + if ($data[0] ne "") { + $html .= 'Next Thread »'; + } else { + $html .= 'Next Thread »'; + } + $html .= '
    '; + $html .= ''; + @data = WebGUI::SQL->quickArray("select messageId,substring(subject,1,30),username,date_format(dateOfPost,'%c/%e %l:%i%p') from message where messageId=$message{rid}",$session{dbh}); + $html .= ''.$data[1].''; + $html .= _traverseReplyTree($message{rid},1); + $html .= "
    SubjectAuthorDate
    '.$data[2].''.$data[3].'
    "; + return $html; +} + +#------------------------------------------------------------------- +sub www_view { + my ($sth, @data, $html, %board, $itemsPerPage, $currentPage, $totalItems); + %board = _getBoardProperties($_[0]); + $itemsPerPage = $board{messagesPerPage}; + if ($session{form}{pageNumber} < 1) { + $currentPage = 1; + } else { + $currentPage = $session{form}{pageNumber}; + } + if ($board{description} ne "") { + $html .= $board{description}.'

    '; + } + ($totalItems) = WebGUI::SQL->quickArray("select count(*) from message where widgetId=$_[0]",$session{dbh}); + $html .= '
    '; + if ($board{displayTitle}) { + $html .= $board{title}; + } + $html .= 'Post New Message
    '; + $html .= ''; + $html .= ''; + $sth = WebGUI::SQL->read("select messageId,substring(subject,1,30),count(messageId)-1,username,date_format(dateOfPost,'%c/%e %l:%i%p'),date_format(max(dateOfPost),'%c/%e %l:%i%p'),max(messageId) from message where widgetId=$_[0] group by rid order by messageId desc limit ".(($currentPage*$itemsPerPage)-$itemsPerPage).",".$itemsPerPage, $session{dbh}); + while (@data = $sth->array) { + $html .= ''; + } + $html .= "
    SubjectAuthorThread StartedRepliesLast Reply
    '.$data[1].''.$data[3].''.$data[4].''.$data[2].''.$data[5].'
    "; + $sth->finish; + $html .= '

    '; + return $html; +} + + + + + + + +1; diff --git a/lib/WebGUI/Widget/Poll.pm b/lib/WebGUI/Widget/Poll.pm new file mode 100644 index 000000000..f033e07fc --- /dev/null +++ b/lib/WebGUI/Widget/Poll.pm @@ -0,0 +1,182 @@ +package WebGUI::Widget::Poll; + +#------------------------------------------------------------------- +# WebGUI is Copyright 2001 Plain Black Software. +#------------------------------------------------------------------- +# Please read the legal notices (docs/legal.txt) and the license +# (docs/license.txt) that came with this distribution before using +# this software. +#------------------------------------------------------------------- +# http://www.plainblack.com info@plainblack.com +#------------------------------------------------------------------- + +use strict; +use WebGUI::Privilege; +use WebGUI::Session; +use WebGUI::SQL; +use WebGUI::Utility; +use WebGUI::Widget; + +#------------------------------------------------------------------- +sub _viewPoll { + my (%poll, $i, $output, $widgetId); + $widgetId = shift; + %poll = WebGUI::SQL->quickHash("select * from widget,Poll where widget.widgetId=Poll.widgetId and widget.widgetId='$widgetId'",$session{dbh}); + if (defined %poll) { + if ($poll{displayTitle} == 1) { + $output = "

    ".$poll{title}."

    "; + } + $output .= '
    '; + $output .= WebGUI::Form::hidden('wid',$widgetId); + $output .= WebGUI::Form::hidden('func','vote'); + $output .= ''.$poll{question}.'
    '; + for ($i=1; $i<=20; $i++) { + if ($poll{'a'.$i} ne "") { + $output .= WebGUI::Form::radio("answer",'a'.$i).' '.$poll{'a'.$i}.'
    '; + } + } + $output .= '
    '.WebGUI::Form::submit('Vote!'); + + $output .= '
    '; + } + return $output; +} + +#------------------------------------------------------------------- +sub _viewResults { + my (%poll, @data, $i, $output, $widgetId, $totalResponses); + $widgetId = shift; + %poll = WebGUI::SQL->quickHash("select * from widget,Poll where widget.widgetId=Poll.widgetId and widget.widgetId='$widgetId'",$session{dbh}); + if (defined %poll) { + if ($poll{displayTitle} == 1) { + $output = "

    ".$poll{title}."

    "; + } + $output .= ''.$poll{question}.''; + ($totalResponses) = WebGUI::SQL->quickArray("select count(*) from pollAnswer where widgetId=$widgetId",$session{dbh}); + if ($totalResponses < 1) { + $totalResponses = 1; + } + for ($i=1; $i<=20; $i++) { + if ($poll{'a'.$i} ne "") { + $output .= '
    '.$poll{'a'.$i}.'
    '; + @data = WebGUI::SQL->quickArray("select count(*), answer from pollAnswer where answer='a$i' group by answer",$session{dbh}); + $output .= '
      '.round(100*$data[0]/$totalResponses).'%
    '; + } + } + } + return $output; +} + +#------------------------------------------------------------------- +sub widgetName { + return "Poll"; +} + +#------------------------------------------------------------------- +sub www_add { + my ($output, %hash); + tie %hash, "Tie::IxHash"; + if (WebGUI::Privilege::canEditPage()) { + $output = '

    Add Poll

    '; + $output .= WebGUI::Form::hidden("widget","Poll"); + $output .= WebGUI::Form::hidden("func","addSave"); + $output .= ''; + $output .= ''; + $output .= ''; + $output .= ''; + %hash = WebGUI::SQL->buildHash("select groupId,groupName from groups where groupName<>'Reserved' order by groupName",$session{dbh}); + $output .= ''; + $output .= ''; + $output .= ''; + $output .= ''; + $output .= '
    Title'.WebGUI::Form::text("title",20,30).'
    Display the title?'.WebGUI::Form::checkbox("displayTitle",1).'
    Active'.WebGUI::Form::checkbox("active",1,1).'
    Who can vote?'.WebGUI::Form::selectList("voteGroup",\%hash,).'
    Question'.WebGUI::Form::text("question",50,255).'
    Answers
    (Enter one answer per line. No more than 20.)
    '.WebGUI::Form::textArea("answers",'',50,8,0,'on').'
    '.WebGUI::Form::submit("save").'
    '; + return $output; + } else { + return WebGUI::Privilege::insufficient(); + } + return $output; +} + +#------------------------------------------------------------------- +sub www_addSave { + my ($widgetId, @answer); + if (WebGUI::Privilege::canEditPage()) { + $widgetId = create(); + @answer = split("\n",$session{form}{answers}); + WebGUI::SQL->write("insert into Poll set widgetId=$widgetId, active='$session{form}{active}', voteGroup='$session{form}{voteGroup}', question=".quote($session{form}{question}).", a1=".quote($answer[0]).", a2=".quote($answer[1]).", a3=".quote($answer[2]).", a4=".quote($answer[3]).", a5=".quote($answer[4]).", a6=".quote($answer[5]).", a7=".quote($answer[6]).", a8=".quote($answer[7]).", a9=".quote($answer[8]).", a10=".quote($answer[9]).", a11=".quote($answer[10]).", a12=".quote($answer[11]).", a13=".quote($answer[12]).", a14=".quote($answer[13]).", a15=".quote($answer[14]).", a16=".quote($answer[15]).", a17=".quote($answer[16]).", a18=".quote($answer[17]).", a19=".quote($answer[18]).", a20=".quote($answer[19])."",$session{dbh}); + return ""; + } else { + return WebGUI::Privilege::insufficient(); + } +} + +#------------------------------------------------------------------- +sub www_edit { + my ($output, %data, %hash, @array); + tie %hash, "Tie::IxHash"; + if (WebGUI::Privilege::canEditPage()) { + %data = WebGUI::SQL->quickHash("select * from widget,Poll where widget.widgetId=Poll.widgetId and widget.widgetId=$session{form}{wid}",$session{dbh}); + $output = '

    Edit Poll

    '; + $output .= WebGUI::Form::hidden("wid",$session{form}{wid}); + $output .= WebGUI::Form::hidden("func","editSave"); + $output .= ''; + $output .= ''; + $output .= ''; + $output .= ''; + %hash = WebGUI::SQL->buildHash("select groupId,groupName from groups where groupName<>'Reserved' order by groupName",$session{dbh}); + $array[0] = $data{voteGroup}; + $output .= ''; + $output .= ''; + $output .= ''; + $output .= ''; + $output .= '
    Title'.WebGUI::Form::text("title",20,30,$data{title}).'
    Display the title?'.WebGUI::Form::checkbox("displayTitle",1,$data{displayTitle}).'
    Active'.WebGUI::Form::checkbox("active",1,$data{active}).'
    Who can vote?'.WebGUI::Form::selectList("voteGroup",\%hash,\@array).'
    Question'.WebGUI::Form::text("question",50,255,$data{question}).'
    Answers
    (Enter one answer per line. No more than 20.)
    '.WebGUI::Form::textArea("answers",$data{a1}."\n".$data{a2}."\n".$data{a3}."\n".$data{a4}."\n".$data{a5}."\n".$data{a6}."\n".$data{a7}."\n".$data{a8}."\n".$data{a9}."\n".$data{a10}."\n".$data{a11}."\n".$data{a12}."\n".$data{a13}."\n".$data{a14}."\n".$data{a15}."\n".$data{a16}."\n".$data{a17}."\n".$data{a18}."\n".$data{a19}."\n".$data{a20}."\n",50,8,0,'on').'
    '.WebGUI::Form::submit("save").'
    '; + return $output; + } else { + return WebGUI::Privilege::insufficient(); + } +} + +#------------------------------------------------------------------- +sub www_editSave { + my (@answer); + if (WebGUI::Privilege::canEditPage()) { + update(); + @answer = split("\n",$session{form}{answers}); + WebGUI::SQL->write("update Poll set active='$session{form}{active}', voteGroup='$session{form}{voteGroup}', question=".quote($session{form}{question}).", a1=".quote($answer[0]).", a2=".quote($answer[1]).", a3=".quote($answer[2]).", a4=".quote($answer[3]).", a5=".quote($answer[4]).", a6=".quote($answer[5]).", a7=".quote($answer[6]).", a8=".quote($answer[7]).", a9=".quote($answer[8]).", a10=".quote($answer[9]).", a11=".quote($answer[10]).", a12=".quote($answer[11]).", a13=".quote($answer[12]).", a14=".quote($answer[13]).", a15=".quote($answer[14]).", a16=".quote($answer[15]).", a17=".quote($answer[16]).", a18=".quote($answer[17]).", a19=".quote($answer[18]).", a20=".quote($answer[19])." where widgetId=$session{form}{wid}",$session{dbh}); + return ""; + } else { + return WebGUI::Privilege::insufficient(); + } +} + +#------------------------------------------------------------------- +sub www_view { + my ($hasVoted, %data, $output); + %data = WebGUI::SQL->quickHash("select * from widget,Poll where widget.widgetId=Poll.widgetId and widget.widgetId='$_[0]'",$session{dbh}); + if ($data{active} eq "0") { + $output = _viewResults($_[0]); + } elsif (WebGUI::Privilege::isInGroup($data{voteGroup},$session{user}{userId})) { + ($hasVoted) = WebGUI::SQL->quickArray("select count(*) from pollAnswer where userId=$session{user}{userId} and widgetId=$_[0]",$session{dbh}); + if ($hasVoted) { + $output = _viewResults($_[0]); + } else { + $output = _viewPoll($_[0]); + } + } else { + $output = _viewResults($_[0]); + } + return $output; +} + +#------------------------------------------------------------------- +sub www_vote { + WebGUI::SQL->write("insert into pollAnswer set widgetId=$session{form}{wid}, userId=$session{user}{userId}, answer='$session{form}{answer}'",$session{dbh}); + return _viewResults($session{form}{wid}); +} + + + + + + +1; diff --git a/lib/WebGUI/Widget/SQLReport.pm b/lib/WebGUI/Widget/SQLReport.pm new file mode 100644 index 000000000..9964f2cc7 --- /dev/null +++ b/lib/WebGUI/Widget/SQLReport.pm @@ -0,0 +1,146 @@ +package WebGUI::Widget::SQLReport; + +#------------------------------------------------------------------- +# WebGUI is Copyright 2001 Plain Black Software. +#------------------------------------------------------------------- +# Please read the legal notices (docs/legal.txt) and the license +# (docs/license.txt) that came with this distribution before using +# this software. +#------------------------------------------------------------------- +# http://www.plainblack.com info@plainblack.com +#------------------------------------------------------------------- + +use strict; +use WebGUI::Macro; +use WebGUI::Privilege; +use WebGUI::Session; +use WebGUI::SQL; +use WebGUI::Utility; +use WebGUI::Widget; + +#------------------------------------------------------------------- +sub widgetName { + return "SQL Report"; +} + +#------------------------------------------------------------------- +sub www_add { + my ($output); + if (WebGUI::Privilege::canEditPage()) { + $output = '

    Add SQL Report

    '; + $output .= WebGUI::Form::hidden("widget","SQLReport"); + $output .= WebGUI::Form::hidden("func","addSave"); + $output .= ''; + $output .= ''; + $output .= ''; + $output .= ''; + $output .= ''; + $output .= ''; + $output .= ''; + $output .= ''; + $output .= ''; + $output .= ''; + $output .= ''; + $output .= '
    Title'.WebGUI::Form::text("title",20,30).'
    Display the title?'.WebGUI::Form::checkbox("displayTitle",1,1).'
    Process macros?'.WebGUI::Form::checkbox("processMacros",1,1).'
    Description'.WebGUI::Form::textArea("description",'','','',1).'
    Template'.WebGUI::Form::textArea("template",'','','',1).'
    Query'.WebGUI::Form::textArea("dbQuery",'').'
    DSN'.WebGUI::Form::text("DSN",20,255,"DBI:mysql:").'
    Database User'.WebGUI::Form::text("username",20,255).'
    Database Password'.WebGUI::Form::password("identifier",20,255).'
    '.WebGUI::Form::submit("save").'
    '; + return $output; + } else { + return WebGUI::Privilege::insufficient(); + } + return $output; +} + +#------------------------------------------------------------------- +sub www_addSave { + my ($widgetId); + if (WebGUI::Privilege::canEditPage()) { + $widgetId = create(); + WebGUI::SQL->write("insert into SQLReport set widgetId=$widgetId, template=".quote($session{form}{template}).", dBquery=".quote($session{form}{dbQuery}).", DSN=".quote($session{form}{DSN}).", username=".quote($session{form}{username}).", identifier=".quote($session{form}{identifier}),$session{dbh}); + return ""; + } else { + return WebGUI::Privilege::insufficient(); + } +} + +#------------------------------------------------------------------- +sub www_edit { + my ($output, %data); + if (WebGUI::Privilege::canEditPage()) { + %data = WebGUI::SQL->quickHash("select * from widget,SQLReport where widget.widgetId=$session{form}{wid}",$session{dbh}); + $output = '

    Edit SQL Report

    '; + $output .= WebGUI::Form::hidden("wid",$session{form}{wid}); + $output .= WebGUI::Form::hidden("func","editSave"); + $output .= ''; + $output .= ''; + $output .= ''; + $output .= ''; + $output .= ''; + $output .= ''; + $output .= ''; + $output .= ''; + $output .= ''; + $output .= ''; + $output .= ''; + $output .= '
    Title'.WebGUI::Form::text("title",20,30,$data{title}).'
    Display the title?'.WebGUI::Form::checkbox("displayTitle","1",$data{displayTitle}).'
    Process macros?'.WebGUI::Form::checkbox("processMacros","1",$data{processMacros}).'
    Description'.WebGUI::Form::textArea("description",$data{description},50,10,1).'
    Template'.WebGUI::Form::textArea("template",$data{template},50,10,1).'
    Query'.WebGUI::Form::textArea("dbQuery",$data{dbQuery},50,10,1).'
    DSN'.WebGUI::Form::text("DSN",20,255,$data{DSN}).'
    Database User'.WebGUI::Form::text("username",20,255,$data{username}).'
    Database Password'.WebGUI::Form::password("identifier",20,255,$data{identifier}).'
    '.WebGUI::Form::submit("save").'
    '; + return $output; + } else { + return WebGUI::Privilege::insufficient(); + } +} + +#------------------------------------------------------------------- +sub www_editSave { + my ($widgetId, $displayTitle, $image, $attachment); + if (WebGUI::Privilege::canEditPage()) { + update(); + WebGUI::SQL->write("update SQLReport set template=".quote($session{form}{template}).", dbQuery=".quote($session{form}{dbQuery}).", DSN=".quote($session{form}{DSN}).", username=".quote($session{form}{username}).", identifier=".quote($session{form}{identifier})." where widgetId=$session{form}{wid}",$session{dbh}); + return ""; + } else { + return WebGUI::Privilege::insufficient(); + } +} + +#------------------------------------------------------------------- +sub www_view { + my (%data, $output, $widgetId, $sth, $dbh, @result, @template, $temp); + $widgetId = shift; + %data = WebGUI::SQL->quickHash("select * from widget,SQLReport where widget.widgetId=$widgetId",$session{dbh}); + if (defined %data) { + if ($data{displayTitle} == 1) { + $output = "

    ".$data{title}."

    "; + } + if ($data{description} ne "") { + $output .= $data{description}.'

    '; + } + @template = split(/\^\-/,$data{template}); + $output .= $template[0]; + $dbh = DBI->connect($data{DSN}, $data{username}, $data{identifier}); + if (defined $dbh) { + $sth = WebGUI::SQL->read($data{dbQuery},$dbh); + if (defined $sth) { + while (@result = $sth->array) { + $temp = $template[1]; + $temp =~ s/\^(\d)/$result[$1]/g; + $output .= $temp; + } + $sth->finish; + } else { + $output .= 'Error: There was a problem with the query.'; + } + } else { + $output .= 'Error: Could not connect to remote database.'; + } + $output .= $template[2]; + } + if ($data{processMacros} == 1) { + $output = WebGUI::Macro::process($output); + } + return $output; +} + + + + + + + +1; diff --git a/lib/WebGUI/Widget/SearchMnoGo.pm b/lib/WebGUI/Widget/SearchMnoGo.pm new file mode 100644 index 000000000..69523cf3d --- /dev/null +++ b/lib/WebGUI/Widget/SearchMnoGo.pm @@ -0,0 +1,143 @@ +package WebGUI::Widget::SearchMnoGo; + +#------------------------------------------------------------------- +# WebGUI is Copyright 2001 Plain Black Software. +#------------------------------------------------------------------- +# Please read the legal notices (docs/legal.txt) and the license +# (docs/license.txt) that came with this distribution before using +# this software. +#------------------------------------------------------------------- +# http://www.plainblack.com info@plainblack.com +#------------------------------------------------------------------- + +use DBI; +use strict; +use WebGUI::Privilege; +use WebGUI::Session; +use WebGUI::SQL; +use WebGUI::Utility; +use WebGUI::Widget; + +#------------------------------------------------------------------- +sub _mnogoSearch { + my ($i, %match, $key, $sth, $dbh, $urlId, %data, $output, @keyword, $word, %result); + %data = @_; + @keyword = split(/ /,$session{form}{query}); + $dbh = DBI->connect($data{DSN},$data{username},$data{identifier}); + foreach $word (@keyword) { + $sth = WebGUI::SQL->read("select url_id from dict where soundex(word)=soundex(lcase('$word'))",$dbh); + while (($urlId) = $sth->array) { + $result{$urlId}++; + } + $sth->finish; + } + foreach $key (sort {$result{$b} <=> $result{$a}} keys %result) { + if ($i < 50) { + %match = WebGUI::SQL->quickHash("select url,title,txt from url where rec_id=$key",$dbh); + $output .= ''.$match{title}.' ('.$result{$key}.')
    '.$match{txt}.'
    '.$match{url}.'

    '; + } + $i++; + } + $dbh->disconnect(); + return $output; +} + +#------------------------------------------------------------------- +sub widgetName { + return "Search (MnoGo)"; +} + +#------------------------------------------------------------------- +sub www_add { + my ($output); + if (WebGUI::Privilege::canEditPage()) { + $output = '

    Add Search (MnoGo)

    '; + $output .= WebGUI::Form::hidden("widget","SearchMnoGo"); + $output .= WebGUI::Form::hidden("func","addSave"); + $output .= ''; + $output .= ''; + $output .= ''; + $output .= ''; + $output .= ''; + $output .= ''; + $output .= ''; + $output .= ''; + $output .= '
    Title'.WebGUI::Form::text("title",20,30).'
    Display the title?'.WebGUI::Form::checkbox("displayTitle",1).'
    Description'.WebGUI::Form::textArea("description",'',50,5,1).'
    DSN'.WebGUI::Form::text("DSN",20,255).'
    Database User'.WebGUI::Form::text("username",20,255).'
    Database Password'.WebGUI::Form::password("identifier",20,255).'
    '.WebGUI::Form::submit("save").'
    '; + return $output; + } else { + return WebGUI::Privilege::insufficient(); + } + return $output; +} + +#------------------------------------------------------------------- +sub www_addSave { + my ($widgetId); + if (WebGUI::Privilege::canEditPage()) { + $widgetId = create(); + WebGUI::SQL->write("insert into SearchMnoGo set widgetId=$widgetId, DSN=".quote($session{form}{DSN}).", username=".quote($session{form}{username}).", identifier=".quote($session{form}{identifier}),$session{dbh}); + return ""; + } else { + return WebGUI::Privilege::insufficient(); + } +} + +#------------------------------------------------------------------- +sub www_edit { + my ($output, %data); + if (WebGUI::Privilege::canEditPage()) { + %data = WebGUI::SQL->quickHash("select * from widget,SearchMnoGo where widget.widgetId=SearchMnoGo.widgetId and widget.widgetId=$session{form}{wid}",$session{dbh}); + $output = '

    Edit Search (MnoGo)

    '; + $output .= WebGUI::Form::hidden("wid",$session{form}{wid}); + $output .= WebGUI::Form::hidden("func","editSave"); + $output .= ''; + $output .= ''; + $output .= ''; + $output .= ''; + $output .= ''; + $output .= ''; + $output .= ''; + $output .= ''; + $output .= '
    Title'.WebGUI::Form::text("title",20,30,$data{title}).'
    Display the title?'.WebGUI::Form::checkbox("displayTitle","1",$data{displayTitle}).'
    Description'.WebGUI::Form::textArea("description",$data{description},50,10,1).'
    DSN'.WebGUI::Form::text("DSN",20,255,$data{DSN}).'
    Database Username'.WebGUI::Form::text("username",20,255,$data{username}).'
    Database Password'.WebGUI::Form::password("identifier",20,255,$data{identifier}).'
    '.WebGUI::Form::submit("save").'
    '; + return $output; + } else { + return WebGUI::Privilege::insufficient(); + } +} + +#------------------------------------------------------------------- +sub www_editSave { + if (WebGUI::Privilege::canEditPage()) { + update(); + WebGUI::SQL->write("update SearchMnoGo set DSN=".quote($session{form}{DSN}).", username=".quote($session{form}{username}).", identifier=".quote($session{form}{identifier})." where widgetId=$session{form}{wid}",$session{dbh}); + return ""; + } else { + return WebGUI::Privilege::insufficient(); + } +} + +#------------------------------------------------------------------- +sub www_view { + my (%data, @test, $output, $widgetId); + $widgetId = shift; + %data = WebGUI::SQL->quickHash("select * from widget,SearchMnoGo where widget.widgetId='$widgetId' and widget.WidgetId=SearchMnoGo.widgetId",$session{dbh}); + if (%data) { + if ($data{displayTitle} == 1) { + $output = "

    ".$data{title}."

    "; + } + if ($data{description} ne "") { + $output .= $data{description}.'

    '; + } + $output .= '

    '; + $output .= WebGUI::Form::text("query",20,255,$session{form}{query}); + $output .= WebGUI::Form::submit("search"); + $output .= '
    '; + $output .= _mnogoSearch(%data); + } + return $output; +} + + + + +1; diff --git a/lib/WebGUI/Widget/SiteMap.pm b/lib/WebGUI/Widget/SiteMap.pm new file mode 100644 index 000000000..1c648c699 --- /dev/null +++ b/lib/WebGUI/Widget/SiteMap.pm @@ -0,0 +1,142 @@ +package WebGUI::Widget::SiteMap; + +#------------------------------------------------------------------- +# WebGUI is Copyright 2001 Plain Black Software. +#------------------------------------------------------------------- +# Please read the legal notices (docs/legal.txt) and the license +# (docs/license.txt) that came with this distribution before using +# this software. +#------------------------------------------------------------------- +# http://www.plainblack.com info@plainblack.com +#------------------------------------------------------------------- + +use strict; +use WebGUI::Privilege; +use WebGUI::Session; +use WebGUI::SQL; +use WebGUI::Utility; +use WebGUI::Widget; + +#------------------------------------------------------------------- +sub _traversePageTree { + my ($sth, @data, $output, $depth, $i); + for ($i=0;$i<=$_[1];$i++) { + $depth .= "  "; + } + $sth = WebGUI::SQL->read("select urlizedTitle, title, pageId from page where parentId='$_[0]'",$session{dbh}); + while (@data = $sth->array) { + if (WebGUI::Privilege::canViewPage($data[2])) { + $output .= $depth.'· '.$data[1].'
    '; + $output .= _traversePageTree($data[2],$_[1]+1); + } + } + $sth->finish; + return $output; +} + +#------------------------------------------------------------------- +sub widgetName { + return "Site Map"; +} + +#------------------------------------------------------------------- +sub www_add { + my ($output); + if (WebGUI::Privilege::canEditPage()) { + $output = '

    Add Site Map

    '; + $output .= WebGUI::Form::hidden("widget","SiteMap"); + $output .= WebGUI::Form::hidden("func","addSave"); + $output .= ''; + $output .= ''; + $output .= ''; + $output .= ''; + $output .= ''; + $output .= ''; + $output .= ''; + $output .= '
    Title'.WebGUI::Form::text("title",20,30).'
    Disply title?'.WebGUI::Form::checkbox("displayTitle",1).'
    Description'.WebGUI::Form::textArea("description",'').'
    Starting from this level?'.WebGUI::Form::checkbox("startAtThisLevel",1,1).'
    Show only this level?'.WebGUI::Form::checkbox("showOnlyThisLevel",1,1).'
    '.WebGUI::Form::submit("save").'
    '; + return $output; + } else { + return WebGUI::Privilege::insufficient(); + } + return $output; +} + +#------------------------------------------------------------------- +sub www_addSave { + my ($widgetId, $displayTitle, $image, $attachment); + if (WebGUI::Privilege::canEditPage()) { + $widgetId = create(); + WebGUI::SQL->write("insert into SiteMap set widgetId=$widgetId, startAtThisLevel='$session{form}{startAtThisLevel}', showOnlyThisLevel='$session{form}{showOnlyThisLevel}'",$session{dbh}); + return ""; + } else { + return WebGUI::Privilege::insufficient(); + } +} + +#------------------------------------------------------------------- +sub www_edit { + my ($output, %data); + if (WebGUI::Privilege::canEditPage()) { + %data = WebGUI::SQL->quickHash("select * from widget,SiteMap where widget.widgetId=SiteMap.widgetId and widget.widgetId=$session{form}{wid}",$session{dbh}); + $output = '

    Edit Site Map

    '; + $output .= WebGUI::Form::hidden("wid",$session{form}{wid}); + $output .= WebGUI::Form::hidden("func","editSave"); + $output .= ''; + $output .= ''; + $output .= ''; + $output .= ''; + $output .= ''; + $output .= ''; + $output .= ''; + $output .= '
    Title'.WebGUI::Form::text("title",20,30,$data{title}).'
    Disply title?'.WebGUI::Form::checkbox("displayTitle",1,$data{displayTitle}).'
    Description'.WebGUI::Form::textArea("description",$data{description}).'
    Starting from this level?'.WebGUI::Form::checkbox("startAtThisLevel",1,$data{startAtThisLevel}).'
    Show only this level?uuuu'.WebGUI::Form::checkbox("showOnlyThisLevel",1,$data{showOnlyThisLevel}).'
    '.WebGUI::Form::submit("save").'
    '; + return $output; + } else { + return WebGUI::Privilege::insufficient(); + } +} + +#------------------------------------------------------------------- +sub www_editSave { + if (WebGUI::Privilege::canEditPage()) { + update(); + WebGUI::SQL->write("update SiteMap set startAtThisLevel='$session{form}{startAtThisLevel}', showOnlyThisLevel='$session{form}{showOnlyThisLevel}' where widgetId=$session{form}{wid}",$session{dbh}); + return ""; + } else { + return WebGUI::Privilege::insufficient(); + } +} + +#------------------------------------------------------------------- +sub www_view { + my (%data, $output, $sth, @root, $parent); + %data = WebGUI::SQL->quickHash("select * from widget,SiteMap where widget.widgetId=SiteMap.widgetId and widget.widgetId='$_[0]'",$session{dbh}); + if (defined %data) { + if ($data{displayTitle} eq 1) { + $output = '

    '.$data{title}.'

    '; + } + $output .= $data{description}.'

    '; + if ($data{startAtThisLevel} eq 1) { + $parent = $session{page}{pageId}; + } else { + $parent = 1; + } + $sth = WebGUI::SQL->read("select urlizedTitle, title, pageId from page where parentId='$parent'",$session{dbh}); + while (@root = $sth->array) { + if (WebGUI::Privilege::canViewPage($root[2])) { + $output .= '· '.$root[1].'
    '; + unless ($data{showOnlyThisLevel} eq 1) { + $output .= _traversePageTree($root[2],1); + } + } + } + } + return $output; +} + + + + + + + +1; diff --git a/lib/WebGUI/Widget/SyndicatedContent.pm b/lib/WebGUI/Widget/SyndicatedContent.pm new file mode 100644 index 000000000..735db6658 --- /dev/null +++ b/lib/WebGUI/Widget/SyndicatedContent.pm @@ -0,0 +1,112 @@ +package WebGUI::Widget::SyndicatedContent; + +#------------------------------------------------------------------- +# WebGUI is Copyright 2001 Plain Black Software. +#------------------------------------------------------------------- +# Please read the legal notices (docs/legal.txt) and the license +# (docs/license.txt) that came with this distribution before using +# this software. +#------------------------------------------------------------------- +# http://www.plainblack.com info@plainblack.com +#------------------------------------------------------------------- + +use strict; +use WebGUI::Macro; +use WebGUI::Privilege; +use WebGUI::Session; +use WebGUI::SQL; +use WebGUI::Utility; +use WebGUI::Widget; + +#------------------------------------------------------------------- +sub widgetName { + return "Syndicated Content"; +} + +#------------------------------------------------------------------- +sub www_add { + my ($output); + if (WebGUI::Privilege::canEditPage()) { + $output = '

    Add Syndicated Content

    '; + $output .= WebGUI::Form::hidden("widget","SyndicatedContent"); + $output .= WebGUI::Form::hidden("func","addSave"); + $output .= ''; + $output .= ''; + $output .= ''; + $output .= ''; + $output .= ''; + $output .= ''; + $output .= '
    Title'.WebGUI::Form::text("title",20,30).'
    Display the title?'.WebGUI::Form::checkbox("displayTitle",1,1).'
    Description'.WebGUI::Form::textArea("description",'','','',1).'
    URL to RSS File'.WebGUI::Form::text("rssUrl",20,2048).'
    '.WebGUI::Form::submit("save").'
    '; + return $output; + } else { + return WebGUI::Privilege::insufficient(); + } + return $output; +} + +#------------------------------------------------------------------- +sub www_addSave { + my ($widgetId); + if (WebGUI::Privilege::canEditPage()) { + $widgetId = create(); + WebGUI::SQL->write("insert into SyndicatedContent set widgetId=$widgetId, rssUrl=".quote($session{form}{rssUrl}).", content='Not yet fetched.'",$session{dbh}); + return ""; + } else { + return WebGUI::Privilege::insufficient(); + } +} + +#------------------------------------------------------------------- +sub www_edit { + my ($output, %data); + if (WebGUI::Privilege::canEditPage()) { + %data = WebGUI::SQL->quickHash("select * from widget,SyndicatedContent where widget.widgetId=$session{form}{wid}",$session{dbh}); + $output = '

    Edit Syndicated Content

    '; + $output .= WebGUI::Form::hidden("wid",$session{form}{wid}); + $output .= WebGUI::Form::hidden("func","editSave"); + $output .= ''; + $output .= ''; + $output .= ''; + $output .= ''; + $output .= ''; + $output .= ''; + $output .= ''; + $output .= ''; + $output .= ''; + $output .= '
    Title'.WebGUI::Form::text("title",20,30,$data{title}).'
    Display the title?'.WebGUI::Form::checkbox("displayTitle","1",$data{displayTitle}).'
    Description'.WebGUI::Form::textArea("description",$data{description},50,10,1).'
    URL to RSS File'.WebGUI::Form::text("rssUrl",20,2048,$data{rssUrl}).'
    '.WebGUI::Form::submit("save").'

    Last Fetched'.$data{lastFetched}.'
    Current Content'.$data{content}.'
    '; + return $output; + } else { + return WebGUI::Privilege::insufficient(); + } +} + +#------------------------------------------------------------------- +sub www_editSave { + if (WebGUI::Privilege::canEditPage()) { + update(); + WebGUI::SQL->write("update SyndicatedContent set rssUrl=".quote($session{form}{rssUrl})." where widgetId=$session{form}{wid}",$session{dbh}); + return ""; + } else { + return WebGUI::Privilege::insufficient(); + } +} + +#------------------------------------------------------------------- +sub www_view { + my (%data, $output, $widgetId); + $widgetId = shift; + %data = WebGUI::SQL->quickHash("select * from widget,SyndicatedContent where widget.widgetId=$widgetId",$session{dbh}); + if (defined %data) { + if ($data{displayTitle} == 1) { + $output = "

    ".$data{title}."

    "; + } + if ($data{description} ne "") { + $output .= $data{description}.'

    '; + } + $output .= $data{content}; + } + return $output; +} + + +1; diff --git a/lib/runHourly.pl b/lib/runHourly.pl new file mode 100644 index 000000000..7c7ab5e4d --- /dev/null +++ b/lib/runHourly.pl @@ -0,0 +1,109 @@ +#!/usr/bin/perl + +#------------------------------------------------------------------- +# WebGUI is Copyright 2001 Plain Black Software. +#------------------------------------------------------------------- +# Please read the legal notices (docs/legal.txt) and the license +# (docs/license.txt) that came with this distribution before using +# this software. +#------------------------------------------------------------------- +# http://www.plainblack.com info@plainblack.com +#------------------------------------------------------------------- + +use DBI; +use HTTP::Request; +use LWP::UserAgent; +use strict; +use WebGUI::Config; +use WebGUI::SQL; +use XML::RSS; + +my $config = new WebGUI::Config '../etc/WebGUI.conf'; +our $dbh = DBI->connect($config->param('dsn'), $config->param('dbuser'), $config->param('dbpass')); + +deleteExpiredSessions(); +updateSyndicatedContent(); + +$dbh->disconnect(); + +#------------------------------------------------------------------- +sub deleteExpiredSessions { + WebGUI::SQL->write("delete from session where expires $_[0]); + $response = $userAgent->request($request); + $rss = new XML::RSS; + $rss->parse($response->content); + return $rss; +} + +#------------------------------------------------------------------- +sub generateHTML { + my ($rss, $image, $content, $copyright, $title, $link, $description, $name, $url, $item, $html, $width, $height); + $rss = $_[0]; + #-- image + $url = $rss->{'image'}->{'url'}; + if ($url) { + $link = $rss->{'image'}->{'link'} || ""; + $title = $rss->{'image'}->{'title'} || ""; + $width = $rss->{'image'}->{'width'} || ""; + $height = $rss->{'image'}->{'height'} || ""; + $width = 'width="'.$width.'"' if ($width); + $height = 'height="'.$height.'"' if ($height); + $image = ''.$title.''; + $image = ''.$image.'' if ($link); + } + #-- items + $html = ($image) ? '

    $image
    ' : ""; + foreach $item (@{$rss->{'items'}}) { + next unless defined($item->{'title'}) && defined($item->{'link'}); + $title = $item->{'title'} if (defined ($item->{'title'})); + $description = $item->{'description'} if (defined ($item->{'description'})); + $url = $item->{'link'} if (defined ($item->{'link'})); + $html .= "
  • $title
    \n"; + } + #-- form + $title = $rss->{'textinput'}->{'title'}; + if ($title) { + $link = $rss->{'textinput'}->{'link'}; + $description = $rss->{'textinput'}->{'description'}; + $name = $rss->{'textinput'}->{'name'}; + $html .= '

    '; + $html .= $description.'
    '; + $html .= '
    '; + $html .= '
    '; + } + $copyright = $rss->{'channel'}->{'copyright'}; + #-- copyright + if ($copyright) { + $html .= "

    $copyright

    "; + } + #-- title + $title = $rss->{'channel'}->{'title'}; + $title =~ s/^\s*//; + return ($html); +} + +#------------------------------------------------------------------- +sub updateSyndicatedContent { + my ($sth, @data, $rss, $html); + $sth = WebGUI::SQL->read("select widget.widgetId, SyndicatedContent.rssURL, SyndicatedContent.content from widget,SyndicatedContent where widget.WidgetId=SyndicatedContent.widgetId and widget.pageId<>3",$dbh); + while (@data = $sth->array) { + $rss = getRSS($data[1]); + $html = generateHTML($rss); + if ($html ne "") { + WebGUI::SQL->write("update SyndicatedContent set content=".$dbh->quote($html).", lastFetched=now() where widgetId=$data[0]",$dbh); + } elsif (substr($data[2],6) ne "Unable" && substr($data[2],7) ne "Not yet") { + # then just leave the existing content in place + } else { + WebGUI::SQL->write("update SyndicatedContent set content='Unable to fetch content. Perhaps the RSS is improperly formated.', lastFetched=now() where widgetId=$data[0]",$dbh); + } + } + $sth->finish; +} + diff --git a/www/index.pl b/www/index.pl new file mode 100755 index 000000000..5ee39bfbc --- /dev/null +++ b/www/index.pl @@ -0,0 +1,18 @@ +#!/usr/bin/perl -I../lib/ + +#------------------------------------------------------------------- +# WebGUI is Copyright 2001 Plain Black Software. +#------------------------------------------------------------------- +# Please read the legal notices (docs/legal.txt) and the license +# (docs/license.txt) that came with this distribution before using +# this software. +#------------------------------------------------------------------- +# http://www.plainblack.com info@plainblack.com +#------------------------------------------------------------------- + +use CGI::Carp qw(fatalsToBrowser); +use strict; +use WebGUI; + +print WebGUI::page(); +