Heute habe ich mich über das Upgrade auf die neuerste phpWebSite Version getraut. Sie verlief im wesentlichen Erfolgreich, nur der Newsfeed-Reader und die Remember-Me Option funktionieren noch nicht.
MOD-Rewrite Hack 0.3 Releasenotes | |
---|---|
AuthorEloi George <eloi@NOSPAM.bygeorgeware.com> Version0.3 Updated7/1/2004 This is a mod_rewrite hack for phpWS that I created to make phpWS URLs look like static files, so that links like www.mysite.com/index.php?module=article&view=31 are replaced by shorter ones like www.mysite.com/article31.html It also convinces the search engines that they're not indexing dynamic pages. I've been tweaking it for a few weeks now to get all the bugs I could find worked out of it, but it needs a wider test before we can start pushing to get it added to the phpWS core code. It should work on all Apache webservers running the mod-rewrite module. While creating this thing, I had concerns about what delimiter to use (see http://sourceforge.net/forum/forum.php?thread_id=928884&forum_id=163758). I settled on '~', but some people preferred other symbols. In that case, all you have to do is change the code in 3 places - 1 line in index.php and 2 lines in the moduleLink function in /core/Text.php. Below are notes of the changes I made to all applicable phpWS files. To save you the trouble of applying patches to your code, I made packages that contain all the files you need to modify a phpWS 0.9.3-1 installation. You can download the .zip or .tar from byGeorge!Ware. If you find any bugs or have any suggestions, leave a message in the forum so we can all talk about it. TTYL, /.htaccessThis is where most of the URL decoding is done via the ReweriteRule statements. If you want to add your own custom lines here, be sure to read httpd.apache.org/docs/mod/mod_rewrite.html before you start. This file must be placed at the site root directory. If there's a .htaccess there already, you'll have to merge the code in both files together manually. If your installation has branches, this file must be placed at the root of those sites as well. /Index.phpInsert URL translating code at line 20. Only 1 copy of this is needed per installation. DO NOT replace any of your branches' index.php files! /core/Core.phpInsert MOD_REWRITE_ENABLED constant at line 6. This constant variable turns the hack on and off. If you need to go back to the old way of operation, there's no need to change any files back -- just set MOD_REWRITE_ENABLED to FALSE. /core/Text.phpThis is the workhorse of the entire hack. All of the new links are produced here. ATTENTION DEVELOPERS: If you have hardcoded links and need to convert them to use the moduleLink function, only convert those links that a siteop would want search engines to follow. The server has to execute more code every time moduleLink is run, so having a dynamically-created link to a data entry page isn't worth it. The moduleLink function has been changed so that it will create optimized phpWS URLs if the MOD_REWRITE_ENABLED constant is set to "true". Customized urls can be created by changing or adding code inside the SWITCH statement. We also added two parameters to moduleLink ($class and $anchor) that lets you specify what CSS class to assign to the displayed linktext and at what part of the new web page to position the browser display. We also inserted a new method called parseLink, which takes a text link like "index.php?module=pagemaster&PAGE_user_op=view_page&PAGE_id=3423" as input and returns an array with 2 main elements -- one containing the module name and the other containing an array of getvar/getvalue pairs. This had to be done to allow modules to send customized URLs to Pager, FatCat, and MenuMan without changing their existing code. /core/Pager.phpFor some reason Pager doesn't use the moduleLink function, hardcoding the links instead. I had to change that. Now the setBackLink function expects an array in the parseLink format (see Text.php). If the module sends the normal string link to it, the string is parsed into the proper array format. From there, all other $GET value pairs are added with the $linkback array. Added Functions
Changed Functions
FatCat's saveSelect method doesn't use the moduleLink function, accepting hardcoded links instead. So we'll just change the code so that when it receives the viewing link, it calls PHPWS_Core:::parseLink on line 95 to turn it into an array that gets sent to moduleLink for processing. mod/menuman/class/MenuItem.phpMenuMan's menu_item method doesn't use the moduleLink function, accepting hardcoded links instead. So we'll just change the code so that when it receives the viewing link, it calls PHPWS_Core:::parseLink to turn it into an array that gets sent to moduleLink for processing. Afterwards, the HTML tags get stripped back out. mod/layout/index.phpLayout is using an old method to handle redirects to the previous page that causes the Layout Control Panel to break when MOD_REWRITE_ENABLED is enabled. We'll borrow the linkback fuctionality from Comments and apply it to this module. Replace all instances of the line header("location: " . preg_replace("/.*(index\.php.*|)$/Ui", "", $_SERVER['HTTP_REFERER'])); with header('location: ' . $_SESSION['OBJ_layout']->linkBack); Then replace if ($_SESSION["OBJ_layout"]->_panel) with if ($_SESSION["OBJ_layout"]->_panel){ if ($_SESSION["OBJ_layout"]->_userPanel){ |
![]() |
The comments are owned by the poster. We are not responsible for its content. |
AdministrativeTexts
updated by freddiemac1993, 2013-06-14
wiki
Re: adventures
created by brittdavis10, 2012-02-23 (1 rply, 3 views)
thread
Re: how to run phpwebsite...
created by alexander, 2011-08-25 (2 rpls, 3607 views)
thread
Re: Forum tags
created by HaroldFaragher, 2011-08-22 (3 rpls, 8488 views)
thread