web-archive-bg.com » BG » F » FREE.BG

Total: 15

Choose link from "Titles, links and description words view":

Or switch to "Titles and links view".
  • General Public License
    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

    Original URL path: http://darkspace.free.bg/cgi-php/phpbb3/install_phpbb3/index.php?mode=overview&sub=license&language=nb (2015-11-27)
    Open archived version from archive

  • Support
    Oversikt Installer Introduksjon Lisens Support Support For alle stabile utgaver av phpBB vil full støtte bli gitt Dette inkluderer installasjon konfigurering tekniske spørsmål problemer relatert til potensielle bugs i koden oppdatering fra Releasekandidatversjoner RC til siste stabile utgave konvertering fra phpBB 2 0 x til phpBB3 konvertering fra andre forumsystemer til phpBB3 les mer i Konverteringsforumet Vi anbefaler alle som fortsatt bruker BETA versjoner av phpBB3 til å erstatte installasjonen med en fersk kopi av siste versjon da det ikke er mulig å oppgradere fra BETA versjoner Modifikasjoner og design For problemer relatert til modifikasjoner vennligst still spørsmålet i modifikasjonsforumet For problemer relatert til ulike design still spørsmålet i designforumet Hvis spørsmålet ditt relaterer seg til en spesifik modifikasjon eller et spesifikt design stiller du spørsmålet i emnet som er dedikert denne pakken Hvordan få hjelp phpBBs velkomstpakke Supportseksjonen Hurtigstartsguide For å forsikre deg om at du alltid får med deg informasjon om nye utgaver kan du mailinglisten phpBB på norsk phpBB er mye brukt av nordmenn og en gjeng dedikerte phpBB brukere har derfor startet en norsk nettside for phpBB Her finner du alt du trenger til phpBB på norsk Vi hjelper deg med alle problemer du måtte ha

    Original URL path: http://darkspace.free.bg/cgi-php/phpbb3/install_phpbb3/index.php?mode=overview&sub=support&language=nb (2015-11-27)
    Open archived version from archive

  • phpBB3 • Install
    are not sure what these settings mean proceed to the final step and finish the installation If the installation was successful you can now use the Login button to visit the Administration Control Panel Congratulations you have installed phpBB3 successfully But there is still work ahead If you are unable to get phpBB3 installed even after reading this guide please look at the support section to find out where you can ask for further assistance At this point if you are converting from phpBB 2 0 x you should refer to the conversion steps for further information If not you should remove the install directory from your server as you will only be able to access the Administration Control Panel whilst it is present Back to Top 4 Updating from stable releases of phpBB 3 0 x If you are currently using a stable release of phpBB3 updating to this version is straightforward You would have downloaded one of four packages and your choice determines what you need to do Please Note That before updating we heavily recommend you do a full backup of your database and existing phpBB3 files If you are unsure how to achieve this please ask your hosting provider for advice Please make sure you update your phpBB3 source files too even if you run the database update php file 4 i Full package The full package is normally meant for new installations only but if you want to replace all source files this package comes in handy First you should make a copy of your existing config php file keep it in a safe place Next delete all the existing phpBB3 files you may want to leave your files and images directory in place You can leave alternative styles in place too With this complete you can upload the new phpBB3 files see New installation for details if necessary Once complete copy back your saved config php replacing the new one Another method is to just replace the existing files with the files from the full package though make sure you do not overwrite your config php file You should now run install database update php which depending on your previous version will make a number of database changes You may receive FAILURES during this procedure they should not be a cause for concern unless you see an actual ERROR in which case the script will stop in this case you should seek help via our forums or bug tracker Once the install database update php has completed you may proceed to the Administration Control Panel and check remove the install directory as advised 4 ii Changed files only This package is meant for those wanting to only replace changed files from a previous version to the latest version This package normally contains the changed files from up to five previous versions This package contains a number of archives each contains the files changed from a given release to the latest version You should select the appropriate archive for your current version e g if you currently have 3 0 4 you should select the phpBB 3 0 4 to 3 0 5 zip tar gz file The directory structure has been preserved enabling you if you wish to simply upload the contents of the archive to the appropriate location on your server i e simply overwrite the existing files with the new versions Do not forget that if you have installed any MODs these files will overwrite the originals possibly destroying them in the process You will need to re add MODs to any affected file before uploading As for the other update procedures you should run install database update php after you have finished updating the files This will update your database schema and increment the version number 4 iii Patch file The patch file package is for those wanting to update through the patch application and being comfortable with it The patch file is one solution for those with many Modifications MODs or other changes who do not want to re add them back to all the changed files if they use the method explained above To use this you will need command line access to a standard UNIX type patch application If you do not have access to such an application but still want to use this update approach we strongly recommend the Automatic update package explained below It is also the preferred update method A number of patch files are provided to allow you to update from previous stable releases Select the correct patch e g if your current version is 3 0 4 you need the phpBB 3 0 4 to 3 0 5 patch file Place the correct patch in the parent directory containing the phpBB3 core files i e index php viewforum php etc With this done you should run the following command patch cl d PHPBB DIRECTORY p1 PATCH NAME where PHPBB DIRECTORY is the directory name your phpBB Installation resides in for example phpBB3 and where PATCH NAME is the relevant filename of the selected patch file This should complete quickly hopefully without any HUNK FAILED comments If you do get failures you should look at using the Changed files only package to replace the files which failed to patch please note that you will need to manually re add any Modifications MODs to these particular files Alternatively if you know how you can examine the rej files to determine what failed where and make manual adjustments to the relevant source You should of course delete the patch file or files after use As for the other update procedures you should run install database update php after you have finished updating the files This will update your database schema and data if appropriate and increment the version number 4 iv Automatic update package This update method is the preferred method for updating This package allows detecting changed files automatically and merges changes if needed The

    Original URL path: http://darkspace.free.bg/cgi-php/phpbb3/docs/INSTALL.html (2015-11-27)
    Open archived version from archive

  • Påkrevde detaljer
    Hopp til innhold Oversikt Installer Introduksjon Påkrevde detaljer Databaseinnstillinger Administratordetaljer Konfigurasjonsfil Avanserte innstillinger Lag databasetabeller Siste trinn Installasjonskompitabilitet Start installasjon Start installasjon Powered by phpBB 2000 2002 2005 2007 phpBB

    Original URL path: http://darkspace.free.bg/cgi-php/phpbb3/install_phpbb3/index.php?mode=install&sub=requirements&language=nb (2015-11-27)
    Open archived version from archive

  • phpBB3 • Readme
    accessed from the following location http www phpbb com support documentation 3 0 This covers everything from installation through setting permissions and managing users 3 ii Community Forums phpBB Group maintains a thriving community where a number of people have generously decided to donate their time to help support users This site can be found at http www phpbb com If you do seek help via our forums please be sure to do a Search before posting This may well save both you and us time and allow the developer moderator and support groups to spend more time responding to people with unknown issues and problems Please also remember that phpBB is an entirely volunteer effort no one receives any compensation for the time they give this includes moderators as well as developers So please be respectful and mindful when awaiting responses 3 iii Internet Relay Chat Another place you may find help is our IRC channel This operates on the Freenode IRC network irc freenode net and the channel is phpbb and can be accessed by any good IRC client such as mIRC XChat etc Again please do not abuse this service and be respectful of other users Back to Top 4 Status of this version This is the third stable release of phpBB The 3 0 x line is essentially feature frozen with only point releases seeing fixes for bugs and security issues though feature alterations and minor feature additions may be done if deemed absolutely required Our next major release will be phpBB 3 2 and the planning phase has begun the unstable development version is 3 1 Please do not post questions asking when 3 2 will be available no release date has been set For those interested in the development of phpBB should keep an eye on the community forums to see how things are progressing http area51 phpbb com phpBB Please note that this forum should NOT be used to obtain support for or ask questions about phpBB 2 0 x or phpBB 3 0 x the main community forums are the place for this Any such posts will be locked and go unanswered Back to Top 5 Reporting Bugs The phpBB Group uses a bug tracking system to store list and manage all reported bugs it can be found at the location listed below Please DO NOT post bug reports to our forums they will be locked In addition please DO NOT use the bug tracker for support requests Posting such a request will only see you directed to the support forums while taking time away from working on real bugs http www phpbb com bugs While we very much appreciate receiving bug reports the more reports the more stable phpBB will be we ask you carry out a few steps before adding new entries Firstly determine if your bug is reproduceable how to determine this depends on the bug in question Only if the bug is reproduceable it is likely to be

    Original URL path: http://darkspace.free.bg/cgi-php/phpbb3/docs/README.html (2015-11-27)
    Open archived version from archive

  • phpBB3 • FAQ
    they probably are not phpBB uses sessions to keep track of users as they move between pages The session information tells us who this user is Therefore in order to determine what a user can do on a page we first need the session details Once this data is available we can check whether the user is permitted to do whatever it is they are trying to do This can result in it appearing as if a user is reading a topic in a forum they should not be able to access Or perhaps viewing private messages when they are only guests etc In practice the user is not doing these things they are viewing a You are not permitted to do this type message The session data has simply been updated before we were able to determine what the user could or could not do Of course this only applies where permissions have been set correctly Back to Top I keep getting Mail sending errors when I or my users post send PM s etc This error will occur if phpBB cannot send mail phpBB can send email two ways using the PHP mail function or directly via SMTP Some hosting providers limit the mail function to prevent its use in spamming others may rename it or limit its functionality If the mail function got renamed you are able to enter the correct name within the administration control panel In either case you may need to make use of SMTP This requires that you have access to such a facility e g your hosting provider may provide one perhaps requiring specific written authorisation etc Please see www phpbb com for additional help on this matter If you do require SMTP services please do not ask on our forums or elsewhere for someone to provide you with one Open relays are now things of the past thanks to the unthinking spammers out there Therefore you are unlikely to find someone willing to offer you free services Back to Top My users are complaining that emails are not in their selected language You must have deleted a language pack or the language pack is incomplete phpBB will try to send emails in the users selected language If it cannot find a suitable email template it will switch to the boards default language Back to Top My AOL based users keep getting logged out phpBB uses sessions to keep track of users as they browse the board These sessions use a combination of a unique session id the users IP and if specified the users browser and or the users x forwarded for header to identify each user We make use of all of this as an extra safe guard to help prevent sessions being hijacked by discovering the unique session id Unfortunately this only works when the users IP is constant as they browse the board For most users this will be the case However certain providers route their users via

    Original URL path: http://darkspace.free.bg/cgi-php/phpbb3/docs/FAQ.html (2015-11-27)
    Open archived version from archive

  • phpBB3 • Coding Guidelines
    supported DB s MySQL3 4 5 MSSQL 7 0 and 2000 PostgreSQL 7 0 Firebird SQLite Oracle8 ODBC generalised if possible All SQL commands should utilise the DataBase Abstraction Layer DBAL SQL code layout SQL Statements are often unreadable without some formatting since they tend to be big at times Though the formatting of sql statements adds a lot to the readability of code SQL statements should be formatted in the following way basically writing keywords sql SELECT one tab FROM SOME TABLE one tab WHERE a 1 two tabs AND b 2 three tabs OR b 3 one tab ORDER BY b Here the example with the tabs applied sql SELECT FROM SOME TABLE WHERE a 1 AND b 2 OR b 3 ORDER BY b SQL Quotes Double quotes where applicable The variables in these examples are typecasted to integers before examples These are wrong UPDATE SOME TABLE SET something something else WHERE a b UPDATE SOME TABLE SET something user id WHERE a something These are right UPDATE SOME TABLE SET something something else WHERE a b UPDATE SOME TABLE SET something user id WHERE a something In other words use single quotes where no variable substitution is required or where the variable involved shouldn t appear within double quotes Otherwise use double quotes Avoid DB specific SQL The not equals operator as defined by the SQL 2003 standard is This is wrong sql SELECT FROM SOME TABLE WHERE a 2 This is right sql SELECT FROM SOME TABLE WHERE a 2 Common DBAL methods sql escape Always use db sql escape if you need to check for a string within an SQL statement even if you are sure the variable cannot contain single quotes never trust your input for example sql SELECT FROM SOME TABLE WHERE username db sql escape username sql query limit We do not add limit statements to the sql query but instead use db sql query limit You basically pass the query the total number of lines to retrieve and the offset Note Since Oracle handles limits differently and because of how we implemented this handling you need to take special care if you use sql query limit with an sql query retrieving data from more than one table Make sure when using something like SELECT x y jars that there is not a column named jars in x make sure that there is no overlap between an implicit column and the explicit columns sql build array If you need to UPDATE or INSERT data make use of the db sql build array function This function already escapes strings and checks other types so there is no need to do this here The data to be inserted should go into an array sql ary or directly within the statement if one or two variables needs to be inserted updated An example of an insert statement would be sql ary array somedata my string otherdata an int moredata another int db sql query INSERT INTO SOME TABLE db sql build array INSERT sql ary To complete the example this is how an update statement would look like sql ary array somedata my string otherdata an int moredata another int sql UPDATE SOME TABLE SET db sql build array UPDATE sql ary WHERE user id int user id db sql query sql The db sql build array function supports the following modes INSERT example above INSERT SELECT building query for INSERT INTO table SELECT value column statements UPDATE example above and SELECT for building WHERE statement AND logic sql multi insert If you want to insert multiple statements at once please use the separate sql multi insert method An example sql ary array sql ary array somedata my string 1 otherdata an int 1 moredata another int 1 sql ary array somedata my string 2 otherdata an int 2 moredata another int 2 db sql multi insert SOME TABLE sql ary sql in set The db sql in set function should be used for building IN and NOT IN constructs Since specifically MySQL tend to be faster if for one value to be compared the and operator is used we let the DBAL decide what to do A typical example of doing a positive match against a number of values would be sql SELECT FROM FORUMS TABLE WHERE db sql in set forum id forum ids db sql query sql Based on the number of values in forum ids the query can look differently SQL Statement if forum ids array 1 2 3 SELECT FROM phpbb forums WHERE forum id IN 1 2 3 SQL Statement if forum ids array 1 or forum ids 1 SELECT FROM phpbb forums WHERE forum id 1 Of course the same is possible for doing a negative match against a number of values sql SELECT FROM FORUMS TABLE WHERE db sql in set forum id forum ids true db sql query sql Based on the number of values in forum ids the query can look differently here too SQL Statement if forum ids array 1 2 3 SELECT FROM phpbb forums WHERE forum id NOT IN 1 2 3 SQL Statement if forum ids array 1 or forum ids 1 SELECT FROM phpbb forums WHERE forum id 1 If the given array is empty an error will be produced sql build query The db sql build query function is responsible for building sql statements for select and select distinct queries if you need to JOIN on more than one table or retrieving data from more than one table while doing a JOIN This needs to be used to make sure the resulting statement is working on all supported db s Instead of explaining every possible combination i will give a short example sql array array SELECT f ft mark time FROM array FORUMS WATCH TABLE fw FORUMS TABLE f LEFT JOIN array array FROM array FORUMS TRACK TABLE ft ON ft user id user data user id AND ft forum id f forum id WHERE fw user id user data user id AND f forum id fw forum id ORDER BY left id sql db sql build query SELECT sql array The possible first parameter for sql build query is SELECT or SELECT DISTINCT As you can see the logic is pretty self explaining For the LEFT JOIN key just add another array if you want to join on to tables for example The added benefit of using this construct is that you are able to easily build the query statement based on conditions for example the above LEFT JOIN is only necessary if server side topic tracking is enabled a slight adjustement would be sql array array SELECT f FROM array FORUMS WATCH TABLE fw FORUMS TABLE f WHERE fw user id user data user id AND f forum id fw forum id ORDER BY left id if config load db lastread sql array LEFT JOIN array array FROM array FORUMS TRACK TABLE ft ON ft user id user data user id AND ft forum id f forum id sql array SELECT ft mark time else Here we read the cookie data sql db sql build query SELECT sql array 2 iv Optimizations Operations in loop definition Always try to optimize your loops if operations are going on at the comparing part since this part is executed every time the loop is parsed through For assignments a descriptive name should be chosen Example On every iteration the sizeof function is called for i 0 i sizeof post data i do something You are able to assign the not changing result within the loop itself for i 0 size sizeof post data i size i do something Use of in array Try to avoid using in array on huge arrays and try to not place them into loops if the array to check consist of more than 20 entries in array can be very time consuming and uses a lot of cpu processing time For little checks it is not noticable but if checked against a huge array within a loop those checks alone can be a bunch of seconds If you need this functionality try using isset on the arrays keys instead actually shifting the values into keys and vice versa A call to isset array var is a lot faster than in array var array keys array for example 2 v General Guidelines General things Never trust user input this also applies to server variables as well as cookies Try to sanitize values returned from a function Try to sanitize given function variables within your function The auth class should be used for all authorisation checking No attempt should be made to remove any copyright information either contained within the source or displayed interactively when the source is run compiled neither should the copyright information be altered in any way it may be added to Variables Make use of the request var function for anything except for submit or single checking params The request var function determines the type to set from the second parameter which determines the default value too If you need to get a scalar variable type you need to tell this the request var function explicitly Examples Old method do not use it start isset HTTP GET VARS start intval HTTP GET VARS start intval HTTP POST VARS start submit isset HTTP POST VARS submit true false Use request var and define a default variable use the correct type start request var start 0 submit isset POST submit true false start is an int the following use of request var therefore is not allowed start request var start 0 Getting an array keys are integers value defaults to 0 mark array request var mark array 0 Getting an array keys are strings value defaults to 0 action ary request var action array 0 Login checks redirection To show a forum login box use login forum box forum data else use the login box function The login box function can have a redirect as the first parameter As a thumb of rule specify an empty string if you want to redirect to the users current location else do not add the SID to the redirect string for example within the ucp login we redirect to the board index because else the user would be redirected to the login screen Sensitive Operations For sensitive operations always let the user confirm the action For the confirmation screens make use of the confirm box function Altering Operations For operations altering the state of the database for instance posting always verify the form token unless you are already using confirm box To do so make use of the add form key and check form key functions add form key my form if submit if check form key my form trigger error FORM INVALID The string passed to add form key needs to match the string passed to check form key Another requirement for this to work correctly is that all forms include the S FORM TOKEN template variable Sessions Sessions should be initiated on each page as near the top as possible using the following code user session begin auth acl user data user setup The user setup call can be used to pass on additional language definition and a custom style used in viewforum Errors and messages All messages errors should be outputed by calling trigger error using the appropriate message type and language string Example trigger error NO FORUM trigger error user lang NO FORUM trigger error NO MODE E USER ERROR Url formatting All urls pointing to internal files need to be prepended by the phpbb root path variable Within the administration control panel all urls pointing to internal files need to be prepended by the phpbb admin path variable This makes sure the path is always correct and users being able to just rename the admin folder and the acp still working as intended though some links will fail and the code need to be slightly adjusted The append sid function from 2 0 x is available too though does not handle url alterations automatically Please have a look at the code documentation if you want to get more details on how to use append sid A sample call to append sid can look like this append sid phpbb root path memberlist phpEx mode group amp g row group id General function usage Some of these functions are only chosen over others because of personal preference and having no other benefit than to be consistant over the code Use sizeof instead of count Use strpos instead of strstr Use else if instead of elseif Use false lowercase instead of FALSE Use true lowercase instead of TRUE Exiting Your page should either call page footer in the end to trigger output through the template engine and terminate the script or alternatively at least call the exit handler That call is necessary because it provides a method for external applications embedding phpBB to be called at the end of the script Back to Top 3 Styling 3 i Style Config Files Style cfg files are simple name value lists with the information necessary for installing a style Similar cfg files exist for templates themes and imagesets These follow the same principle and will not be introduced individually Styles can use installed components by using the required theme required template required imageset entries The important part of the style configuration file is assigning an unique name General Information about this style name prosilver duplicate copyright phpBB Group 2007 version 3 0 3 required template prosilver required theme prosilver required imageset prosilver 3 2 General Styling Rules Templates should be produced in a consistent manner Where appropriate they should be based off an existing copy e g index viewforum or viewtopic the combination of which implement a range of conditional and variable forms Please also note that the intendation and coding guidelines also apply to templates where possible The outer table class forumline has gone and is replaced with tablebg When writing table the order table class cellspacing cellpadding border align creates consistency and allows everyone to easily see which table produces which look The same applies to most other tags for which additional parameters can be set consistency is the major aim here Each block level element should be indented by one tab same for tabular elements e g tr td etc whereby the intendiation of table and the following ending tr should be on the same line This applies not to div elements of course Don t use span more than is essential the CSS is such that text sizes are dependent on the parent class So writing span class gensmall span class gensmall TEST span span will result in very very small text Similarly don t use span at all if another element can contain the class definition e g td span class gensmall TEST span td can just as well become td class gensmall TEST td Try to match text class types with existing useage e g don t use the nav class where viewtopic uses gensmall for example Row colours classes are now defined by the template use an IF S ROW COUNT switch see viewtopic or viewforum for an example Remember block level ordering is important while not all pages validate as XHTML 1 0 Strict compliant it is something we re trying to work too Use a standard cellpadding of 2 and cellspacing of 0 on outer tables Inner tables can vary from 0 to 3 or even 4 depending on the need Use div container css for styling and table for data representation The separate catXXXX and thXXX classes are gone When defining a header cell just use th rather than th class thHead etc Similarly for cat don t use td class catLeft use td class cat etc Try to retain consistency of basic layout and class useage i e EXPLAIN text should generally be placed below the title it explains e g L POST USERNAME br span class gensmall L POST USERNAME EXPLAIN span is the typical way of handling this there may be exceptions and this isn t a hard and fast rule Try to keep template conditional and other statements tabbed in line with the block to which they refer this is correct BEGIN test tr td test TEXT td tr END test this is also correct BEGIN test tr td test TEXT td tr END test it gives immediate feedback on exactly what is looping decide which way to use based on the readability Back to Top 4 Templating 4 i General Templating File naming Firstly templates now take the suffix html rather than tpl This was done simply to make the lifes of some people easier wrt syntax highlighting etc Variables All template variables should be named appropriately using underscores for spaces language entries should be prefixed with L system data with S urls with U javascript urls with UA language to be put in javascript statements with LA all other variables should be presented as is L template variables are automatically tried to be mapped to the corresponding language entry if the code does not set and therefore overwrite this variable specifically For example L USERNAME maps to user lang USERNAME The LA template variables are handled within the same way but properly escaped to be put in javascript code This should reduce the need to assign loads of new lang vars in Modifications Blocks Loops The basic block level loop remains and takes the form BEGIN loopname markup loopname X YYYYY etc END loopname A bit later loops will be explained further To not irritate you we will explain conditionals as well as other statements first Including files Something that existed in 2 0 x which no longer exists in 3 0 x is the ability to assign a template to a variable This was used for example to output the jumpbox Instead perhaps better perhaps not but certainly more flexible we now have INCLUDE This takes the simple form INCLUDE filename You will note in the 3 0 templates the major sources start with INCLUDE overall header html or INCLUDE simple header html etc In 2 0 x control of which header to use was defined entirely within the code In 3 0 x the template designer can output what they like Note that you can introduce new templates i e other than those in the default set using this system and include them as you wish perhaps useful for a common menu bar or some such No need to modify loads of files as with 2 0 x PHP A contentious decision has seen the ability to include PHP within the template introduced This is achieved by enclosing the PHP within relevant tags PHP echo hello ENDPHP You may also include PHP from an external file using INCLUDEPHP somefile php it will be included and executed inline A note it is very much encouraged that template designers do not include PHP The ability to include raw PHP was introduced primarily to allow end users to include banner code etc without modifying multiple files as with 2 0 x It was not intended for general use hence www phpbb com will not make available template sets which include PHP And by default templates will have PHP disabled the admin will need to specifically activate PHP for a template Conditionals Control structures The most significant addition to 3 0 x are conditions or control structures if something then do this else do that The system deployed is very similar to Smarty This may confuse some people at first but it offers great potential and great flexibility with a little imagination In their most simple form these constructs take the form IF expr markup ENDIF expr can take many forms for example IF loop S ROW COUNT is even markup ENDIF This will output the markup if the S ROW COUNT variable in the current iteration of loop is an even value i e the expr is TRUE You can use various comparison methods standard as well as equivalent textual versions noted in square brackets including not or and eq neq is should be used if possible for better readability eq neq ne same as not equivalent in value and type equivalent in value and type gt lt gte lte and or mod not bitwise shift left bitwise shift right bitwise or bitwise xor bitwise and bitwise not is can be used to join comparison operations Basic parenthesis can also be used to enforce good old BODMAS rules Additionally some basic comparison types are defined even odd div Beyond the simple use of IF you can also do a sequence of comparisons using the following IF expr1 markup ELSEIF expr2 markup ELSEIF exprN markup ELSE markup ENDIF Each statement will be tested in turn and the relevant output generated when a match if a match is found It is not necessary to always use ELSEIF ELSE can be used alone to match everything else So what can you do with all this Well take for example the colouration of rows in viewforum In 2 0 x row colours were predefined within the source as either row color1 row color2 or row class1 row class2 In 3 0 x this is moved to the template it may look a little daunting at first but remember control flows from top to bottom and it s not too difficult table IF loop S ROW COUNT is even tr class row1 ELSE tr class row2 ENDIF td HELLO td tr table This will cause the row cell to be output using class row1 when the row count is even and class row2 otherwise The S ROW COUNT parameter gets assigned to loops by default Another example would be the following table IF loop S ROW COUNT 10 tr bgcolor FF0000 ELSEIF loop S ROW COUNT 5 tr bgcolor 00FF00 ELSEIF loop S ROW COUNT 2 tr bgcolor 0000FF ELSE tr bgcolor FF00FF ENDIF td hello td tr table This will output the row cell in purple for the first two rows blue for rows 2 to 5 green for rows 5 to 10 and red for remainder So you could produce a nice gradient effect for example What else can you do Well you could use IF to do common checks on for example the login state of a user IF S USER LOGGED IN markup ENDIF This replaces the existing fudged method in 2 0 x using a zero length array and BEGIN END Extended syntax for Blocks Loops Back to our loops they had been extended with the following additions Firstly you can set the start and end points of the loop For example BEGIN loopname 2 markup END loopname Will start the loop on the third entry note that indexes start at zero Extensions of this are loopname 2 Will start the loop on the 3rd entry loopname 2 Will start the loop two entries from the end loopname 3 4 Will start the loop on the fourth entry and end it on the fifth loopname 3 4 Will start the loop on the fourth entry and end it four from last A further extension to begin is BEGINELSE BEGIN loop markup BEGINELSE markup END loop This will cause the markup between BEGINELSE and END to be output if the loop contains no values This is useful for forums with no topics for example in some ways it replaces bits of the existing switch type control the rest being replaced by conditionals Another way of checking if a loop contains values is by prefixing the loops name with a dot IF loop BEGIN loop markup END loop ELSE markup ENDIF You are even able to check the number of items within a loop by comparing it with values within the IF condition IF loop 2 BEGIN loop markup END loop ELSE markup ENDIF Nesting loops cause the conditionals needing prefixed with all loops from the outer one to the inner most An illustration of this BEGIN firstloop firstloop MY VARIABLE FROM FIRSTLOOP BEGIN secondloop firstloop secondloop MY VARIABLE FROM SECONDLOOP END secondloop END firstloop Sometimes it is necessary to break out of nested loops to be able to call another loop within the current iteration This sounds a little bit confusing and it is not used very often The following rather complex example shows this quite good it also shows how you test for the first and last row in a loop i will explain the example in detail further down BEGIN l block1 IF l block1 S SELECTED strong l block1 L TITLE strong IF S PRIVMSGS the at the beginning of the loop name forces the loop to be not a nested one of l block1 BEGIN folder IF folder S FIRST ROW ul class nav ENDIF li a href folder U FOLDER folder FOLDER NAME a li IF folder S LAST ROW ul ENDIF END folder ENDIF ul class nav BEGIN l block2 li IF l block1 l block2 S SELECTED strong l block1 l block2 L TITLE strong ELSE a href l block1 l block2 U TITLE l block1 l block2 L TITLE a ENDIF li END l block2 ul ELSE a class nav href l block1 U TITLE l block1 L TITLE a ENDIF END l block1 Let us first concentrate on this part of the example BEGIN l block1 IF l block1 S SELECTED markup ELSE a class nav href l block1 U TITLE l block1 L TITLE a ENDIF END l block1 Here we open the loop l block1 and doing some things if the value S SELECTED within the current loop iteration is true else we write the blocks link and title Here you see l block1 L TITLE referenced you remember that L variables get automatically assigned the corresponding language entry This is true but not within loops The L TITLE variable within the loop l block1 is assigned within the code itself Let s have a closer look to the markup BEGIN l block1 IF S PRIVMSGS BEGIN folder IF folder S FIRST ROW ul class nav ENDIF li a href folder U FOLDER folder FOLDER NAME a li IF folder S LAST ROW ul ENDIF END folder ENDIF END l block1 The IF S PRIVMSGS statement clearly checks a global variable and not one within the loop since the loop is not given here So if S PRIVMSGS is true we execute the shown markup Now you see the BEGIN folder statement The exclamation mark is responsible for instructing the template engine to iterate through the main loop folder So we are now within the loop folder with BEGIN folder we would have been within the loop l block1 folder automatically as is the case with l block2 BEGIN l block1 ul class nav BEGIN l block2 li IF l block1 l block2 S SELECTED strong l block1 l block2 L TITLE strong ELSE a href l block1 l block2 U TITLE l block1 l block2 L TITLE a ENDIF li END l block2 ul END l block1 You see the difference The loop l block2 is a member of the loop l block1 but the loop folder is a main loop Now back to our folder loop IF folder S FIRST ROW ul class nav ENDIF li a href folder U FOLDER folder FOLDER NAME a li IF folder S LAST ROW ul ENDIF You may have wondered what the comparison to S FIRST ROW and S LAST ROW is about If you haven t guessed already it is checking for the first iteration of the loop with S FIRST ROW and the last iteration with S LAST ROW This can come in handy quite often if you want to open or close design elements like the above list Let us imagine a folder loop build with three iterations it would go this way ul class nav written on first iteration li first element li written on first iteration li second element li written on second iteration li third element li written on third iteration ul written on third iteration As you can see all three elements are written down as well as the markup for the first iteration and the last one Sometimes you want to omit writing the general markup for example IF folder S FIRST ROW ul class nav ELSEIF folder S LAST ROW ul ELSE li a href folder U FOLDER folder FOLDER NAME a li ENDIF would result in the following markup ul class nav written on first iteration li second element li written on second iteration ul written on third iteration Just always remember that processing is taking place from up to down Forms If a form is used for a non trivial operation i e more than a jumpbox then it should include the S FORM TOKEN template variable form method post id mcp action U POST ACTION fieldset class submit buttons input type reset value L RESET name reset class button2 gt input type submit name action add warning value L SUBMIT class button1 gt S FORM TOKEN fieldset gt form gt 4 ii Template Inheritance When basing a new template on an existing one it is not necessary to provide all template files By declaring the template to be inheriting in the template configuration file The limitation on this is that the base style has to be installed and complete meaning that it is not itself inheriting The effect of doing so is that the template engine will use the files in the new template where they exist but fall back to files in the base template otherwise Declaring a style to be inheriting also causes it to use some of the configuration settings of the base style notably database storage We strongly encourage the use of inheritance for styles based on the bundled styles as it will ease the update procedure General Information about this template name inherits copyright phpBB Group 2007 version 3 0 3 Defining a different template bitfield template bitfield lNg Are we inheriting inherit from prosilver Back to Top 5 Character Sets and Encodings What are Unicode UCS and UTF 8 The Universal Character Set UCS described in ISO IEC 10646 consists of a large amount of characters Each of them has a unique name and a code point which is an integer number Unicode which is an industry standard complements the Universal Character Set with further information about the characters properties and alternative character encodings More information on Unicode can be found on the Unicode Consortium s website One of the Unicode encodings is the 8 bit Unicode Transformation Format UTF 8 It encodes characters with up to four bytes aiming for maximum compatibility with the American Standard Code for Information Interchange which is a 7 bit encoding of a relatively small subset of the UCS phpBB s use of Unicode Unfortunately PHP does not faciliate the use of Unicode prior to version 6 Most functions simply treat strings as sequences of bytes assuming that each character takes up exactly one byte This behaviour still allows for storing UTF 8 encoded text in PHP strings but many operations on strings have unexpected results To circumvent this problem we have created some alternative functions to PHP s native string operations which use code points instead of bytes These functions can be found in includes utf utf tools php They are also covered in the phpBB3 Sourcecode Documentation A lot of native PHP functions still work with UTF 8 as long as you stick to certain restrictions For example explode still works as long as the first and the last character of the delimiter string are ASCII characters phpBB only uses the ASCII and the UTF 8 character encodings Still all Strings are UTF 8 encoded because ASCII is a subset of UTF 8 The only exceptions to this rule are code sections which deal with external systems which use other encodings and character sets Such external data should be converted to UTF 8 using the utf8 recode function supplied with phpBB It supports a variety of other character sets and encodings a full list can be found below With request var you can either allow all UCS characters in user input or restrict user input to ASCII characters This feature is controlled by the function s third parameter called multibyte You should allow multibyte characters in posts PMs topic titles forum names etc but it s not necessary for internal uses like a mode variable which should only hold a predefined list of ASCII strings anyway an input string containing a multibyte character REQUEST multibyte string Käse print request variable as a UTF 8 string allowing multibyte characters echo request var multibyte string true print request variable as ASCII string echo request var multibyte string This code snippet will generate the following output Käse K se Unicode Normalization If you retrieve user input with multibyte characters you should additionally normalize the string using utf8 normalize nfc before you work with it This is necessary to make sure that equal characters can only occur in one particular binary representation For example the character Å can be represented either as U 00C5 LATIN CAPITAL LETTER A WITH RING ABOVE or as U 212B ANGSTROM SIGN phpBB uses Normalization Form Canonical Composition NFC for all text So the correct version of the above example would look like this REQUEST multibyte string Käse normalize multibyte strings echo utf8 normalize nfc request var multibyte string true ASCII strings do not need to be normalized echo request var multibyte string Case Folding Case insensitive comparison of strings is no longer possible with strtolower or strtoupper as some characters have multiple lower case or multiple upper case forms depending on their position in a word The utf8 strtolower and the utf8 strtoupper functions suffer from the same problem so they can only be used to display upper lower case versions of a string but they cannot be used for case insensitive comparisons either So instead you should use case folding which gives you a case insensitive version of the string which can be used for case insensitive comparisons An NFC normalized string can be case folded using utf8 case fold nfc Bad The strings might be the same even if strtolower differs if strtolower string1 strtolower string2 echo string1 and string2 are equal or differ in case Good Case folding is really case insensitive if utf8 case fold nfc string1 utf8 case fold nfc string2 echo string1 and string2 are equal or differ in case Confusables Detection phpBB offers a special method utf8 clean string which can be used to make sure string identifiers are unique This method uses Normalization Form Compatibility Composition NFKC instead of NFC and replaces similarly looking characters with a particular representative of the equivalence class This method is currently used for usernames and group names to avoid confusion with similarly looking names Back to Top 6 Translation i18n L10n Guidelines 6 i Standardisation Reason phpBB is one of the most translated open source projects with the current stable version being available in over 60 localisations Whilst the ad hoc approach to the naming of language packs has worked for phpBB3 and beyond we hope to make this process saner which will allow for better interoperation with current and future web browsers Encoding With phpBB3 the output encoding for the forum in now UTF 8 a Universal Character Encoding by the Unicode Consortium that is by design a superset to US ASCII and ISO 8859 1 By using one character set which simultaenously supports all scripts which previously would have required different encodings eg ISO 8859 1 to ISO 8859

    Original URL path: http://darkspace.free.bg/cgi-php/phpbb3/docs/coding-guidelines.html (2015-11-27)
    Open archived version from archive