Changeset 1535
- Timestamp:
- 12/01/2009 04:26:58 PM (9 months ago)
- Location:
- branches/1.3
- Files:
-
- 2 added
- 8 removed
- 6 modified
- 2 copied
-
.htaccess (modified) (1 diff)
-
lang/en/defaults/TableMarkup.txt (added)
-
lang/en/defaults/TableMarkupReference.txt (added)
-
libs/Config.class.php (deleted)
-
libs/Wakka.class.php (modified) (5 diffs)
-
setup/check.php (deleted)
-
setup/css (deleted)
-
setup/default.php (modified) (1 diff)
-
setup/footer.php (copied) (copied from branches/1.2/setup/footer.php)
-
setup/grabinfo.php (deleted)
-
setup/header.php (copied) (copied from branches/1.2/setup/header.php)
-
setup/inc (deleted)
-
setup/index.php (deleted)
-
setup/install.php (modified) (11 diffs)
-
setup/links.php (deleted)
-
setup/setup.php (deleted)
-
setup/writeconfig.php (modified) (2 diffs)
-
wikka.php (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/1.3/.htaccess
r1515 r1535 6 6 7 7 <IfModule mod_rewrite.c> 8 #By default, RewriteEngine should be set to Off, to ensure at least installer works. 9 RewriteEngine Off 10 RewriteCond %{REQUEST_FILENAME} -d 11 RewriteRule ^(.*/[^\./]*[^/])$ $1/ 12 RewriteRule ^(.*)$ wikka.php?wakka=$1 [QSA,L] 13 </IfModule> 8 # turn on rewrite engine 9 RewriteEngine on 10 11 # if request is a directory, make sure it ends with a slash 12 RewriteCond %{REQUEST_FILENAME} -d 13 RewriteRule ^(.*/[^/]+)$ $1/ 14 15 # if not rewritten before, AND requested file is wikka.php 16 # turn request into a query for a default (unspecified) page 17 RewriteCond %{QUERY_STRING} !wakka= 18 RewriteCond %{REQUEST_FILENAME} wikka.php 19 RewriteRule ^(.*)$ wikka.php?wakka= [QSA,L] 20 21 # if not rewritten before, AND requested file is a page name 22 # turn request into a query for that page name for wikka.php 23 RewriteCond %{QUERY_STRING} !wakka= 24 RewriteRule ^(.*)$ wikka.php?wakka=$1 [QSA,L] -
branches/1.3/libs/Wakka.class.php
r1534 r1535 2715 2715 #echo 'handler: '.$handler.'<br/>'; 2716 2716 // now check if a handler by that name exists 2717 #echo 'checking path: '.$this->GetConfigValue(' wikka_handler_path').DIRECTORY_SEPARATOR.'page'.DIRECTORY_SEPARATOR.$handler.'.php'.'<br/>';2718 $exists = $this->BuildFullpathFromMultipath($handler.DIRECTORY_SEPARATOR.$handler.'.php', $this->GetConfigValue(' wikka_handler_path'));2717 #echo 'checking path: '.$this->GetConfigValue('handler_path').DIRECTORY_SEPARATOR.'page'.DIRECTORY_SEPARATOR.$handler.'.php'.'<br/>'; 2718 $exists = $this->BuildFullpathFromMultipath($handler.DIRECTORY_SEPARATOR.$handler.'.php', $this->GetConfigValue('handler_path')); 2719 2719 // return conclusion 2720 2720 if(TRUE===empty($exists)) … … 2785 2785 } 2786 2786 $result = 2787 $this->IncludeBuffered(strtolower($action_name).DIRECTORY_SEPARATOR.strtolower($action_name).'.php', 'Unknown action "'.$action_name.'"', $vars, $this->config[' wikka_action_path']);2787 $this->IncludeBuffered(strtolower($action_name).DIRECTORY_SEPARATOR.strtolower($action_name).'.php', 'Unknown action "'.$action_name.'"', $vars, $this->config['action_path']); 2788 2788 if ($link_tracking_state) 2789 2789 { … … 2795 2795 /** 2796 2796 * @uses Wakka::IncludeBuffered() 2797 * @uses Config::$ wikka_handler_path2797 * @uses Config::$handler_path 2798 2798 * @param $handler 2799 2799 * @return unknown_type … … 2823 2823 } 2824 2824 $handlerLocation = $handler.DIRECTORY_SEPARATOR.$handler.'.php'; #89 2825 return $this->IncludeBuffered($handlerLocation, 'Unknown handler "'.$handlerLocation.'"', '', $this->config[' wikka_handler_path']);2825 return $this->IncludeBuffered($handlerLocation, 'Unknown handler "'.$handlerLocation.'"', '', $this->config['handler_path']); 2826 2826 } 2827 2827 … … 2861 2861 // produce output 2862 2862 //$out = $this->IncludeBuffered($formatter_location, $this->GetConfigValue('wikka_formatter_path'), $formatter_not_found, FALSE, compact('text', 'format_option')); // @@@ 2863 $out = $this->IncludeBuffered($formatter_location, 2864 $formatter_not_found, compact('text', 'format_option'), $this->GetConfigValue('wikka_formatter_path')); 2863 $out = $this->IncludeBuffered($formatter_location, $formatter_not_found, compact('text', 'format_option'), $this->GetConfigValue('wikka_formatter_path')); 2865 2864 } 2866 2865 return $out; -
branches/1.3/setup/default.php
r1521 r1535 1 1 <?php 2 /** 3 * Display a configuration form to set language and database settings. 4 * 5 * @package Setup 6 * @version $Id: default.php 893 2008-02-07 08:27:40Z DotMG $ 7 * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 8 * @filesource 9 * 10 * @uses init_test_mod_rewrite() 11 * @todo make form accessible! 12 */ 2 3 // Start session 4 session_set_cookie_params(0, '/'); 5 session_name(md5('WikkaWiki')); 6 session_start(); 7 8 // Copy POST params to SESSION in preparation for redirect to install page 9 $_SESSION['post'] = array(); 10 $_SESSION['post'] = array_merge($_SESSION['post'], $_POST); 11 12 //Override default values with posted values 13 if (isset($_POST['config'])) 14 { 15 /* debug */ 16 //print_r($_POST['config']); 17 foreach($_POST['config'] as $key => $value) 18 { 19 $wakkaConfig[$key] = $value; 20 } 21 } 22 23 // Validate data 24 $error['flag'] = false; 25 if(isset($_SESSION['error_flag'])) 26 { 27 if (isset($_POST['config']['mysql_host']) && strlen($_POST['config']['mysql_host']) == 0) 28 { 29 $error['mysql_host'] = "Please fill in a valid MySQL host."; 30 $error['flag'] = true; 31 } 32 if (isset($_POST['config']['mysql_database']) && strlen($_POST['config']['mysql_database']) == 0) 33 { 34 $error['mysql_database'] = "Please fill in a valid database."; 35 $error['flag'] = true; 36 } 37 if (isset($_POST['config']['mysql_user']) && strlen($_POST['config']['mysql_user']) == 0) 38 { 39 $error['mysql_user'] = "Please fill in a valid MySQL username."; 40 $error['flag'] = true; 41 } 42 if (isset($_POST['config']['wakka_name']) && strlen($_POST['config']['wakka_name']) == 0) 43 { 44 $error['wakka_name'] = "Please fill in a title for your wiki. For example: <em>My Wikka website</em>"; 45 $error['flag'] = true; 46 } 47 if (isset($_POST['config']['root_page'])) 48 { 49 if (strlen($_POST['config']['root_page']) == 0 || preg_match('/^[A-Za-z0-9]{3,}$/', $_POST['config']['root_page']) == 0) 50 { 51 $error['root_page'] = "Please fill a valid name for your wiki's homepage. For example: <em>start</em> or <em>HomePage</em>"; 52 $error['flag'] = true; 53 } 54 } 55 if (isset($_POST['config']['admin_users'])) 56 { 57 if (strlen($_POST['config']['admin_users']) == 0) 58 { 59 $error['admin_users'] = "Please fill in an admin name."; 60 $error['flag'] = true; 61 } 62 else if (strlen($_POST['config']['admin_users']) > 0 && preg_match('/^[A-Z][a-z]+[A-Z0-9][A-Za-z0-9]*$/', $_POST['config']['admin_users']) == 0) 63 { 64 $error['admin_users'] = "Admin name must be formatted as a WikiName. For example: <em>JohnSmith</em> or <em>AbC</em> or <em>Ted22</em>"; 65 $error['flag'] = true; 66 } 67 } 68 if (isset($_POST['password'])) 69 { 70 if (strlen($_POST['password']) == 0) 71 { 72 $error['password'] = "Please fill in a password."; 73 $error['flag'] = true; 74 } 75 else if (strlen($_POST['password']) < 5) 76 { 77 $error['password'] = "Password must be at least five (5) characters long."; 78 $error['flag'] = true; 79 } 80 } 81 if (isset($_POST['password2'])) 82 { 83 if (strlen($_POST['password2']) == 0) 84 { 85 $error['password2'] = "Please confirm your password."; 86 $error['flag'] = true; 87 } 88 else if (strcmp($_POST['password'], $_POST['password2']) != 0) 89 { 90 $error['password2'] = "Passwords don't match."; 91 $error['flag'] = true; 92 } 93 } 94 if (isset($_POST['config']['admin_email'])) 95 { 96 if (strlen($_POST['config']['admin_email']) == 0) 97 { 98 $error['admin_email'] = "Please fill in your email address."; 99 $error['flag'] = true; 100 } 101 else if (preg_match("/^[A-Za-z0-9.!#$%&'*+\/=?^_`{|}~-]+@[A-Za-z0-9.-]+$/i", $_POST['config']['admin_email']) == 0) 102 { 103 $error['admin_email'] = "Please fill in a valid email address."; 104 $error['flag'] = true; 105 } 106 } 107 if (isset($_POST['config']['base_url']) && strlen($_POST['config']['base_url']) == 0) 108 { 109 $error['base_url'] = "Please fill in a valid base URL."; 110 $error['flag'] = true; 111 } 112 } 113 // i18n section 114 if (!defined('SITE_SUFFIX_INFO')) define ('SITE_SUFFIX_INFO', 'Suffix used for cookies and part of the session name. This allows you to run multiple Wikka installations on the same server by configuring them to use different wiki prefixes.'); 115 if (!defined('SITE_SUFFIX_LABEL')) define ('SITE_SUFFIX_LABEL', 'Your Wiki suffix:'); 116 117 if (!$wakkaConfig["wakka_version"]) 118 { 119 $_SESSION['error_flag'] = $error['flag']; 120 } 121 122 // Only redirect as a result of this page being POSTed! 123 if(false === $_SESSION['error_flag'] && 124 isset($_POST['submit'])) 125 { 126 header("Location: ".myLocation()."?installAction=install"); 127 } 128 13 129 ?> 14 <form action="<?php echo WIKKA_BASE_URL ?>setup/test/test-mod-rewrite.php" name="form1" method="post">130 <form action="<?php echo myLocation() ?>?installAction=default" name="form1" method="post"> 15 131 <table> 16 <?php 17 if (isset($config['wakka_version']) && ($config['wakka_version'])) 18 { 19 echo ' <tr><td> </td><td><h1>'.__('WikkaWiki Upgrade').' (1/5)</h1></td></tr>'."\n"; 20 echo '<tr><td> </td><td><p>'.sprintf(__('Welcome to the WikkaWiki Setup Wizard. Your installed WikkaWiki is reporting itself as %s'), '<tt>'.$config['wakka_version'].'</tt>').'</p><p>'.sprintf(__('You are about to %1$s WikkaWiki to version %2$s'), '<em>'.__('upgrade').'</em>', '<strong><tt>'.WAKKA_VERSION.'</tt></strong>').'. '.sprintf(__('Please refer to the %1$s for further instructions'), '<a href="http://docs.wikkawiki.org/UpgradeNotes" target="_blank">'.__('documentation').'</a>').'.</p></td></tr>'."\n"; 132 133 <tr><td></td><td><h1>Wikka Installation</h1></td></tr> 134 135 <?php 136 if ($wakkaConfig["wakka_version"]) 137 { 138 print("<tr><td></td><td>Your installed Wikka is reporting itself as <tt>".$wakkaConfig["wakka_version"]."</tt>. You are about to <strong>upgrade</strong> to Wikka ".WAKKA_VERSION.". Please review your configuration settings below.</td></tr>\n"); 139 // This needs to be set to false for redirect to install page 140 $_SESSION['error_flag'] = false; 21 141 } 22 142 else 23 143 { 24 echo ' <tr><td> </td><td><h1>'.__('WikkaWiki Installation').' (1/5)</h1></td></tr>'."\n"; 25 echo '<tr><td> </td><td><p>'.__('Welcome to the WikkaWiki Setup Wizard. Since there is no existing WikkaWiki configuration, this probably is a <em>fresh install</em>').'.</p><p>'.sprintf(__('You are about to install WikkaWiki (version %s). This wizard will guide you through the installation, which should take only a few minutes'), '<strong><tt>'.WAKKA_VERSION.'</tt></strong>').'. '.sprintf(__('Please refer to the %1$s for further instructions'), '<a href="http://docs.wikkawiki.org/WikkaInstallation" target="_blank">'.__('documentation').'</a>').'.</p></td></tr>'."\n"; 26 } 27 28 $setupfiles_to_update = array( 29 './.htaccess', './wikka.config.php', 'setup/test/.htaccess'); 30 $setup_files_not_writable = ''; 31 // Need to adjust setup/test/.htaccess if installed in a subdir 32 include_once('setup/inc/functions.inc.php'); 33 $htaccess = 'setup/test/.htaccess'; 34 if(setupfile_is_writable($htaccess)) 35 { 36 $htaccess_content = file($htaccess); 37 $new_htaccess_content = ''; 38 foreach($htaccess_content as $line) 39 { 40 if(preg_match("/^\\s*RewriteBase/i", $line)) 41 { 42 $line = 'RewriteBase '.WIKKA_BASE_URL_PATH.'setup/test'; 43 } 44 $new_htaccess_content .= $line; 45 } 46 print('<tr><td> </td><td class="note">'."\n"); 47 print('<h2>'.__('Setting up mod_rewrite autodetection').'</h2>'."\n"); 48 test(sprintf(__('Writing .htaccess file (%s)'), '<tt>'.$htaccess.'</tt>').'...', $f1 = @fopen($htaccess, "w"), "", 0); 49 print('</td></tr>'."\n"); 50 if ($f1) 51 { 52 fwrite($f1, $new_htaccess_content); 53 fclose($f1); 54 } 55 } 56 57 foreach ($setupfiles_to_update as $f1) 58 { 59 if (!setupfile_is_writable($f1)) 60 { 61 $setup_files_not_writable .= '<li><tt>'.$f1.'</tt></li>'; 62 } 63 } 64 if ($setup_files_not_writable) 65 { 66 printf('<tr><td> </td><td class="note"><p>'.__('The following files need to be written/updated by the installer: %s'. 67 'Please ensure that the file is writable. <b>When fixed, reload this page using the Reload button in your browser.</b> '). 68 '</p></td></tr>', '</p><ul>'.$setup_files_not_writable.'</ul><p>'); 69 } 70 init_test_mod_rewrite(); 71 // Language select 72 if (!isset($config['default_lang'])) 73 { 74 // use constant CONFIG_DEFAULT_LANGUAGE 75 #$config['default_lang'] = 'en'; 76 $config['default_lang'] = CONFIG_DEFAULT_LANGUAGE; 77 } 78 ?> 79 <tr><td> </td></tr> 80 <tr><td> </td><td><h2><?php echo __('Language settings'); ?></h2></td></tr> 81 <tr><td> </td><td><?php echo __('Please select a language for the default pages that Wikka will create:'); ?></td></tr> 82 <tr><td><?php echo __('Choose a default language'); ?>:</td><td><?php Language_selectbox($config['default_lang']); // @@@ does not actually display any language choice ?></td></tr> 83 <?php 84 if (!isset($config['wakka_version']) || (!$config['wakka_version'])) 85 { 86 ?> 87 <tr><td> </td></tr> 88 <tr><td> </td><td><h2><?php echo __('Database settings'); ?></h2></td></tr> 89 <tr><td> </td><td><?php echo __('WikkaWiki uses a MySQL database to store data. The wizard will start by checking the connection to the database.');?></td></tr> 90 <tr><td> </td><td><?php echo __('1. The host your MySQL server is running on. <span class="note">Usually <tt>localhost</tt> (i.e. the same machine your WikkaWiki site is on).</span>'); ?></td></tr> 91 <tr><td align="right" nowrap="nowrap"><?php echo __('MySQL host');?>:</td><td><input type="text" size="50" name="pconfig[mysql_host]" value="<?php echo $config["mysql_host"] ?>" /></td></tr> 92 <tr><td> </td><td><?php echo __('2. The name of the database WikkaWiki will use. <span class="note">Note that this database must already exist before you continue.</span>'); ?></td></tr> 93 <tr><td align="right" nowrap="nowrap"><?php echo __('MySQL database'); ?>:</td><td><input type="text" size="50" name="pconfig[mysql_database]" value="<?php echo $config["mysql_database"] ?>" /></td></tr> 94 <tr><td> </td><td><?php printf(__('3. Username and password to connect to your database. <span class="note">This user must exist and be granted access for <tt>%s</tt> operations to the database where WikkaWiki will be installed.</span>'), 'SELECT, INSERT, UPDATE, DELETE, ALTER TABLE'); ?></td></tr> 95 <tr><td align="right" nowrap="nowrap"><?php echo __('MySQL username'); ?>:</td><td><input type="text" size="50" name="pconfig[mysql_user]" value="<?php echo $config["mysql_user"] ?>" /></td></tr> 96 <tr><td align="right" nowrap="nowrap"><?php echo __('MySQL password'); ?>:</td><td><input type="password" size="50" name="pconfig[mysql_password]" value="" /></td></tr> 97 <?php 98 } 99 ?> 100 <tr><td> </td><td> 101 <input type="hidden" name="installAction" value="check" /> 102 <input type="submit" value="<?php echo _p('Continue');?>" /> 103 <input type="hidden" name="redirect_to" value="<?php echo $action_target; ?>" /> 104 </td></tr> 144 print("<tr><td></td><td>Since there is no existing Wikka configuration, this probably is a fresh Wikka install. You are about to install Wikka <tt>".WAKKA_VERSION."</tt>. Installing Wikka will take only a few minutes. To start the installation, please fill in the form below.</td></tr>\n"); 145 } 146 ?> 147 148 <tr><td></td><td><span class="note">NOTE: This installer will try to write the configuration data to a file called <tt>wikka.config.php</tt>, located in your Wikka directory. In order for this to work, you must make sure the web server has write access to that file! If you can't do this, you will have to edit the file manually (the installer will tell you how). Once Wikka is correctly installed, you will be able to modify its configuration by editing this file. See the <a href="http://docs.wikkawiki.org/WikkaInstallation" target="_blank">documentation</a> for details.</span></td></tr> 149 <?php if($error['flag']) 150 { 151 ?> 152 <tr><td></td><td><em class="error">Please correct the errors below to proceed with the installation.</em></td></tr> 153 <?php 154 } 155 if (!$wakkaConfig["wakka_version"]) 156 { 157 ?> 158 <tr><td></td><td><br /><h2>1. Database Configuration</h2></td></tr> 159 <tr><td></td><td>The host your MySQL server is running on. Usually "localhost" (ie, the same machine your Wikka site is on).</td></tr> 160 <?php if(isset($error['mysql_host'])) { ?> 161 <tr><td></td><td><em class="error"><?php echo $error['mysql_host']; ?></em></td></tr> 162 <?php } ?> 163 <tr><td align="right" nowrap="nowrap">MySQL host:</td><td><input type="text" size="50" name="config[mysql_host]" value="<?php echo $wakkaConfig["mysql_host"] ?>" /></td></tr> 164 <tr><td></td><td>The MySQL database Wikka should use. This database needs to exist already before you continue!</td></tr> 165 <?php if(isset($error['mysql_database'])) { ?> 166 <tr><td></td><td><em class="error"><?php echo $error['mysql_database']; ?></em></td></tr> 167 <?php } ?> 168 <tr><td align="right" nowrap="nowrap">MySQL database:</td><td><input type="text" size="50" name="config[mysql_database]" value="<?php echo $wakkaConfig["mysql_database"] ?>" /></td></tr> 169 <tr><td></td><td>Name and password of the MySQL user used to connect to your database.</td></tr> 170 <?php if(isset($error['mysql_user'])) { ?> 171 <tr><td></td><td><em class="error"><?php echo $error['mysql_user']; ?></em></td></tr> 172 <?php } ?> 173 <tr><td align="right" nowrap="nowrap">MySQL user name:</td><td><input type="text" size="50" name="config[mysql_user]" value="<?php echo $wakkaConfig["mysql_user"] ?>" /></td></tr> 174 <tr><td align="right" nowrap="nowrap">MySQL password:</td><td><input type="password" size="50" name="config[mysql_password]" value="<?php echo $wakkaConfig["mysql_password"] ?>" /></td></tr> 175 <tr><td></td><td>Prefix of all tables used by Wikka. This allows you to run multiple Wikka installations using the same MySQL database by configuring them to use different table prefixes.</td></tr> 176 <tr><td align="right" nowrap="nowrap">Table prefix:</td><td><input type="text" size="50" name="config[table_prefix]" value="<?php echo $wakkaConfig["table_prefix"] ?>" /></td></tr> 177 <?php 178 } 179 ?> 180 <tr><td></td><td><br /><h2>2. Wiki Configuration</h2></td></tr> 181 <tr><td></td><td>The name of your wiki, as it will be displayed in the title.</td></tr> 182 <?php if(isset($error['wakka_name'])) { ?> 183 <tr><td></td><td><em class="error"><?php echo $error['wakka_name']; ?></em></td></tr> 184 <?php } ?> 185 <tr><td align="right" nowrap="nowrap">Your wiki's name:</td><td><input type="text" size="50" name="config[wakka_name]" value="<?php echo $wakkaConfig["wakka_name"] ?>" /></td></tr> 186 <tr><td></td><td>Your wiki's home page. It should not contain any space or special character and be at least 3 characters long. It is typically formatted as a <abbr title="A WikiName is formed by two or more capitalized words without space, e.g. HomePage">WikiName</abbr>.</td></tr> 187 <?php if(isset($error['root_page'])) { ?> 188 <tr><td></td><td><em class="error"><?php echo $error['root_page']; ?></em></td></tr> 189 <?php } ?> 190 <tr><td align="right" nowrap="nowrap">Home page:</td><td><input type="text" size="50" name="config[root_page]" value="<?php echo $wakkaConfig["root_page"] ?>" /></td></tr> 191 192 <tr><td></td><td><?php echo SITE_SUFFIX_INFO; ?></td></tr> 193 <tr><td align="right" nowrap="nowrap"><?php echo SITE_SUFFIX_LABEL; ?></td><td><input type="text" size="50" name="config[wiki_suffix]" value="<?php echo $wakkaConfig["wiki_suffix"] ?>" /></td></tr> 194 195 <tr><td></td><td>Optional keywords/description to insert into the HTML meta headers.</td></tr> 196 <tr><td align="right" nowrap="nowrap">Meta Keywords:</td><td><input type="text" size="50" name="config[meta_keywords]" value="<?php if(isset($wakkaConfig["meta_keywords"])) echo $wakkaConfig["meta_keywords"] ?>" /></td></tr> 197 <tr><td align="right" nowrap="nowrap">Meta Description:</td><td><input type="text" size="50" name="config[meta_description]" value="<?php if(isset($wakkaConfig["meta_description"])) echo $wakkaConfig["meta_description"] ?>" /></td></tr> 198 <tr><td></td><td>Choose the <em>look and feel</em> of your wiki (you'll be able to change this later).</td></tr> 199 <tr><td align="right" nowrap="nowrap">Theme:</td><td><?php SelectTheme(); ?></td></tr> 200 201 <?php 202 $curversion_num = ($wakkaConfig['wakka_version']) ? str_replace('.','',$wakkaConfig['wakka_version']) : 0; 203 if (!$wakkaConfig["wakka_version"]) 204 { 205 ?> 206 <tr><td></td><td><br /><h2>3. Administrative Account Configuration</h2></td></tr> 207 208 <tr><td></td><td>This is the username of the person running this wiki. Later you'll be able to add other admins. The admin username should be formatted as a <abbr title="A WikiName is formed by two or more capitalized words without space, e.g. JohnDoe">WikiName</abbr>.</td></tr> 209 <?php if(isset($error['admin_users'])) { ?> 210 <tr><td></td><td><em class="error"><?php echo $error['admin_users']; ?></em></td></tr> 211 <?php } ?> 212 <tr><td align="right" nowrap="nowrap">Admin name:</td><td><input type="text" size="50" name="config[admin_users]" value="<?php echo $wakkaConfig["admin_users"] ?>" /></td></tr> 213 <tr><td></td><td>Choose a password for the wiki administrator (5+ chars)</td></tr> 214 <?php if(isset($error['password'])) { ?> 215 <tr><td></td><td><em class="error"><?php echo $error['password']; ?></em></td></tr> 216 <?php } ?> 217 <tr><td align="right" nowrap="nowrap">Enter password:</td><td><input type="password" size="50" name="password" value="<?php echo (isset($_POST['password']))? $_POST['password'] : ''; ?>" /></td></tr> 218 <?php if(isset($error['password2'])) { ?> 219 <tr><td></td><td><em class="error"><?php echo $error['password2']; ?></em></td></tr> 220 <?php } ?> 221 <tr><td align="right" nowrap="nowrap">Confirm password:</td><td><input type="password" size="50" name="password2" value="<?php echo (isset($_POST['password2']))? $_POST['password2'] : ''; ?>" /></td></tr> 222 <tr><td></td><td>Administrator email.</td></tr> 223 <?php if(isset($error['admin_email'])) { ?> 224 <tr><td></td><td><em class="error"><?php echo $error['admin_email']; ?></em></td></tr> 225 <?php } ?> 226 <tr><td align="right" nowrap="nowrap">Email:</td><td><input type="text" size="50" name="config[admin_email]" value="<?php echo $wakkaConfig["admin_email"] ?>" /></td></tr> 227 228 <tr><td></td><td><br /><h2>4. URL Configuration</h2><?php echo $wakkaConfig["wakka_version"] ? '' : '<span class="note">Since this is a new installation, the installer tried to guess the correct values of Rewrite Mode and Base URL.<br />Change them only if you know what you\'re doing! See the <a href="http://docs.wikkawiki.org/ModRewrite" target="_blank">documentation</a> for details.</span>' ?></td></tr> 229 <tr><td></td><td><strong>Rewrite Mode</strong> is used to produce a nicer URL for your wiki. If Rewrite mode is modified, the base URL should be changed accordingly. 230 <ul> 231 <li>With Rewrite Mode <em>disabled</em>, your site's URL will look like the following:<br /><tt>http://www.example.com/wikka.php?wakka=HomePage</tt></li> 232 <li>If Rewrite Mode is <em>enabled</em>, your site's URL will look like the following:<br /><tt>http://www.example.com/HomePage</tt></li> 233 </ul></td></tr> 234 <tr><td align="right" nowrap="nowrap">Rewrite mode:</td><td><input type="hidden" name="config[rewrite_mode]" value="0" /><input type="checkbox" name="config[rewrite_mode]" value="1" <?php echo ($wakkaConfig["rewrite_mode"])? 'checked="checked"' : ''; ?> /> Enabled</td></tr> 235 <tr><td></td><td>Your wiki's <strong>base URL</strong>. Page names get appended to it, so: <ul> 236 <li>if Rewrite Mode is not available on your server, the base URL should end with <tt>"wikka.php?wakka="</tt><br />e.g. <tt>http://www.example.com/wikka.php?wakka=</tt></li> 237 <li>if Rewrite Mode is enabled, make sure the base URL ends with a slash "/",<br />e.g. <tt>http://www.example.com/</tt></li> 238 </ul></td> 239 </tr> 240 <?php if(isset($error['base_url'])) { ?> 241 <tr><td></td><td><em class="error"><?php echo $error['base_url']; ?></em></td></tr> 242 <?php } ?> 243 <tr><td align="right" nowrap="nowrap">Base URL:</td><td><input type="text" size="50" name="config[base_url]" value="<?php echo $wakkaConfig["base_url"] ?>" /></td></tr> 244 <?php 245 } 246 ?> 247 248 <tr><td></td><td><br /><h2>5. Version update check</h2></td></tr> 249 <tr><td></td><td><span class="note">It is <strong>strongly recommended</strong> that you leave this option checked if your run your wiki on the internet. Administrator(s) will be notified automatically on the wiki if a new version of WikkaWiki is available for download. See the <a href="http://docs.wikkawiki.org/CheckVersionActionInfo" target="_blank">documentation</a> for details. 250 </span></td></tr> 251 <tr><td align="right" nowrap="nowrap"><label for="id_enable_version_check">Enable version checking:</label></td><td><input type="checkbox"<?php echo !isset($wakkaConfig["enable_version_check"]) || $wakkaConfig["enable_version_check"] == "1" ? ' checked="checked"' : ""; ?> name="config[enable_version_check]" value="1" id="id_enable_version_check" /></td></tr> 252 <tr><td></td><td><input type="submit" name="submit" value="Continue" /></td></tr> 253 105 254 </table> 106 255 </form> -
branches/1.3/setup/install.php
r1522 r1535 1 1 <?php 2 /** 3 * Perform the operations required for installing/upgrading Wikka. 4 * 5 * @package Setup 6 * @version $Id: install.php 1225 2008-09-07 04:55:03Z BrianKoontz $ 7 * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 8 * @filesource 9 * 10 * @todo i18n; 11 */ 2 3 // Start session 4 session_set_cookie_params(0, '/'); 5 session_name(md5('WikkaWiki')); 6 session_start(); 7 8 // Copy POST params from SESSION, then destroy SESSION 9 if(isset($_SESSION['post'])) 10 { 11 $_POST = array_merge($_POST, $_SESSION['post']); 12 } 13 $_SESSION=array(); 14 if(isset($_COOKIE[session_name()])) 15 { 16 setcookie(session_name(), '', time()-42000, '/'); 17 } 18 session_destroy(); 19 20 /* 21 foreach($_POST as $key=>$value) 22 { 23 print $key.":".$value."<br/>"; 24 } 25 foreach($_POST['config'] as $key=>$value) 26 { 27 print $key.":".$value."<br/>"; 28 } 29 exit; 30 */ 31 32 // i18n section 33 if (!defined('ADDING_CONFIG_ENTRY')) define('ADDING_CONFIG_ENTRY', 'Adding a new option to the wikka.config file: %s'); // %s - name of the config option 34 if (!defined('DELETING_COOKIES')) define('DELETING_COOKIES', 'Deleting wikka cookies since their name has changed.'); 35 36 // initialization 37 $config = array(); //required since PHP5, to avoid warning on array_merge #94 38 // fetch configuration 39 $config = $_POST["config"]; 40 41 /* 42 print "\$config:<br/>"; 43 foreach($config as $key=>$value) 44 { 45 print $key.":".$value."<br/>"; 46 } 47 exit; 48 */ 49 50 // if the checkbox was not checked, $_POST['config']['enable_version_check'] would not be defined. We must explicitly set it to "0" to overwrite any value already set (if exists). 51 if (!isset($config["enable_version_check"])) 52 { 53 $config["enable_version_check"] = "0"; 54 } 55 // merge existing configuration with new one 56 $config = array_merge($wakkaConfig, $config); 57 58 /* 59 print "\$config:<br/>"; 60 foreach($config as $key=>$value) 61 { 62 print $key.":".$value."<br/>"; 63 } 64 exit; 65 */ 12 66 13 67 // test configuration 14 if ($wakkaConfig['wakka_version']) 15 { 16 echo '<h1>'.__('Wikka Upgrade').' (4/5)</h1>'."\n"; 17 } 18 else 19 { 20 echo '<h1>'.__('Wikka Installation').' (4/5)</h1>'."\n"; 21 } 68 print("<h2>Testing Configuration</h2>\n"); 69 test("Testing MySQL connection settings...", $dblink = @mysql_connect($config["mysql_host"], $config["mysql_user"], $config["mysql_password"])); 70 test("Looking for database...", @mysql_select_db($config["mysql_database"], $dblink), "The database you configured was not found. Remember, it needs to exist before you can install/upgrade Wakka!\n\nPress the Back button and reconfigure the settings."); 71 print("<br />\n"); 22 72 23 73 // do installation stuff … … 25 75 26 76 // set upgrade note to be used when overwriting default pages 27 $upgrade_note = sprintf(__('Upgrading from %1$s to %2$s'), $version, WAKKA_VERSION); 28 $_SESSION['sconfig']['logged_in_navigation_links'] = str_replace('_rootpage', $config['root_page'], $_SESSION['sconfig']['logged_in_navigation_links']); 29 $_SESSION['sconfig']['navigation_links'] = str_replace('_rootpage', $config['root_page'], $_SESSION['sconfig']['navigation_links']); 30 31 $lang_defaults_fallback_path = WIKKA_LANG_PATH.DIRECTORY_SEPARATOR.DEFAULT_FALLBACK_LANGUAGE.DIRECTORY_SEPARATOR.'defaults'.DIRECTORY_SEPARATOR; 32 test('Checking availability of default pages...', is_dir($lang_defaults_fallback_path), 'default pages not found at '.$lang_defaults_fallback_path, 1); 33 $lang_defaults_path = WIKKA_LANG_PATH.DIRECTORY_SEPARATOR.$config['default_lang'].DIRECTORY_SEPARATOR.'defaults'.DIRECTORY_SEPARATOR; 34 // @@@ use test() here, too? (without stop on error but reporting back we're using sytem default language) 35 if (!is_dir($lang_defaults_path)) 36 { 37 // no directory for selected language: set equal to fallback so we can continue 38 $lang_defaults_path = $lang_defaults_fallback_path; 39 } 77 $upgrade_note = 'Upgrading from '.$version.' to '.WAKKA_VERSION; 40 78 41 79 switch ($version) … … 136 174 ") TYPE=MyISAM", $dblink), "Already exists?", 0); 137 175 138 $challenge = dechex(crc32(time())); 139 $pass_val = md5($challenge.md5(mysql_real_escape_string($_SESSION['wikka']['install']['password']))); 140 setcookie('user_name'.$config['wiki_suffix'], $config['admin_users'], time() + DEFAULT_COOKIE_EXPIRATION_HOURS * 60 * 60, WIKKA_COOKIE_PATH); 141 $_COOKIE['user_name'.$config['wiki_suffix']] = $config['admin_users']; 142 setcookie('pass'.$config['wiki_suffix'], $pass_val, time() + DEFAULT_COOKIE_EXPIRATION_HOURS * 60 * 60, WIKKA_COOKIE_PATH); 143 $_COOKIE['pass'.$config['wiki_suffix']] = $pass_val; 144 # first, I delete a previous entry in the table _users, in case this setup's 145 # script was run twice. If the following insert fails, the new Admin won't be auto-logged in. 146 @mysql_query('delete from '.$config['table_prefix'].'users where name = \''.$config['admin_users'].'\'', $dblink); 147 test(__('Adding admin user').'...', 148 @mysql_query("insert into ".$config["table_prefix"]."users set name = '".$config["admin_users"]."', password = md5('".mysql_real_escape_string($_SESSION['wikka']['install']['password'])."'), email = '".$config["admin_email"]."', signuptime = now(), challenge='".$challenge."'", $dblink), "Hmm!", 0); 149 150 update_default_page(array( 151 '_rootpage', 152 'AdminPages', 153 'AdminUsers', 154 'CategoryAdmin', 155 'CategoryCategory', 156 'CategoryWiki', 157 'DatabaseInfo', 158 'FormattingRules', 159 'HighScores', 160 'InterWiki', 161 'MyChanges', 162 'MyPages', 163 'OrphanedPages', 164 'OwnedPages', 165 'PageIndex', 166 'PasswordForgotten', 167 'RecentChanges', 168 'RecentlyCommented', 169 'SandBox', 170 'SysInfo', 171 'TextSearch', 172 'TextSearchExpanded', 173 'UserSettings', 174 'WantedPages', 175 'WikiCategory', 176 'WikkaDocumentation', 177 'WikkaReleaseNotes'), $dblink, $config, $lang_defaults_path, $lang_defaults_fallback_path); 178 179 // @@@ ?? *default* ACLs are in the configuration file; settings on UserSettings page are irrelevant for default ACLs! 180 // use page-specific "ACL" files to create page-specific ACLs (in update_default_page()!). 181 // @@@ use test() function to report actual results instead of assuming success! 182 test(__('Setting default ACL').'...', 1); 183 mysql_query("insert into ".$config["table_prefix"]."acls set page_tag = 'UserSettings', read_acl = '*', write_acl = '+', comment_read_acl = '*', comment_post_acl = '+'", $dblink); 184 test(__('Building links table').'...', 1); 176 177 test("Adding default pages...", 1); 178 // Do not create another (active) copy when re-running teh installer 179 if 180 (!Wakka::existsPage($config['root_page'],$config['table_prefix'],$dblink)) 181 mysql_query("insert into ".$config['table_prefix']."pages set tag = '".$config["root_page"]."', body = '{{image url=\"images/wikka_logo.jpg\" alt=\"wikka logo\" title=\"Welcome to your Wikka site\"}}\n{{checkversion}}\nThanks for installing Wikka! This wiki runs on version ##{{wikkaversion}}##, patch level ##{{wikkapatchlevel}}##. You may want to read the [[WikkaReleaseNotes release notes]] to learn what''s new in this release.\n\n>>==Keep up-to-date==\nTo receive the latest news from the Wikka Development Team, you can sign up to one of our [[http://wikkawiki.org/WikkaMailingLists lists]], subscribe to our [[http://blog.wikkawiki.org Blog]] or join us for a chat on [[http://wikkawiki.org/TheLounge IRC]].\n>>====Getting started====\nDouble-click on this page or click on the **Edit** link in the page footer to get started. If you are not sure how a wiki works, you can check out the [[FormattingRules Wikka formatting guide]] and play in the SandBox.\n\n>>==Need more help?==\nDon\'t forget to visit the [[http://wikkawiki.org WikkaWiki website]]!>>====Some useful pages====\n~-[[FormattingRules Wikka formatting guide]]\n~-[[WikkaDocumentation Documentation]]\n~-[[RecentChanges Recently modified pages]]\n~-[[SysInfo System Information]]\nYou will find more useful pages in the [[CategoryWiki Wiki category]] or in the PageIndex.', user = 'WikkaInstaller', owner = '".$config["admin_users"]."', time = now(), latest = 'Y'", $dblink); 182 if (!Wakka::existsPage('RecentChanges',$config['table_prefix'],$dblink)) mysql_query("insert into ".$config['table_prefix']."pages set tag = 'RecentChanges', body = '{{RecentChanges}}{{nocomments}}\n\n\n----\nCategoryWiki', owner = '(Public)', user = 'WikkaInstaller', time = now(), latest = 'Y'", $dblink); 183 if (!Wakka::existsPage('RecentlyCommented',$config['table_prefix'],$dblink)) mysql_query("insert into ".$config['table_prefix']."pages set tag = 'RecentlyCommented', body = '{{RecentlyCommented}}{{nocomments}}\n\n\n----\nCategoryWiki', owner = '(Public)', user = 'WikkaInstaller', time = now(), latest = 'Y'", $dblink); 184 if (!Wakka::existsPage('UserSettings',$config['table_prefix'],$dblink)) mysql_query("insert into ".$config['table_prefix']."pages set tag = 'UserSettings', body = '{{UserSettings}}{{nocomments}}\n\n\n----\nCategoryWiki', owner = '(Public)', user = 'WikkaInstaller', time = now(), latest = 'Y'", $dblink); 185 if (!Wakka::existsPage('PageIndex',$config['table_prefix'],$dblink)) mysql_query("insert into ".$config['table_prefix']."pages set tag = 'PageIndex', body = '{{PageIndex}}{{nocomments}}\n\n\n----\nCategoryWiki', owner = '(Public)', user = 'WikkaInstaller', time = now(), latest = 'Y'", $dblink); 186 if (!Wakka::existsPage('WikkaReleaseNotes',$config['table_prefix'],$dblink)) mysql_query("insert into ".$config['table_prefix']."pages set tag = 'WikkaReleaseNotes', body = '{{wikkachanges}}{{nocomments}}\n\n\n----\nCategoryWiki', owner = '(Public)', user = 'WikkaInstaller', time = now(), latest = 'Y'", $dblink); 187 if (!Wakka::existsPage('WikkaDocumentation',$config['table_prefix'],$dblink)) mysql_query("insert into ".$config['table_prefix']."pages set tag = 'WikkaDocumentation' , body = '=====Wikka Documentation=====\n\nComprehensive and up-to-date documentation on Wikka Wiki can be found on the [[http://docs.wikkawiki.org/ Wikka Documentation server]].', owner = '(Public)', user = 'WikkaInstaller', time = now(), latest = 'Y'", $dblink); 188 if (!Wakka::existsPage('WantedPages',$config['table_prefix'],$dblink)) mysql_query("insert into ".$config['table_prefix']."pages set tag = 'WantedPages', body = '{{WantedPages}}{{nocomments}}\n\n\n----\nCategoryWiki', owner = '(Public)', user = 'WikkaInstaller', time = now(), latest = 'Y'", $dblink); 189 if (!Wakka::existsPage('OrphanedPages',$config['table_prefix'],$dblink)) mysql_query("insert into ".$config['table_prefix']."pages set tag = 'OrphanedPages', body = '====Orphaned Pages====\n\nThe following list shows those pages held in the Wiki that are not linked to on any other pages.\n\n{{OrphanedPages}}{{nocomments}}\n\n\n----\nCategoryWiki', owner = '(Public)', user = 'WikkaInstaller', time = now(), latest = 'Y'", $dblink); 190 if (!Wakka::existsPage('TextSearch',$config['table_prefix'],$dblink)) mysql_query("insert into ".$config['table_prefix']."pages set tag = 'TextSearch', body = '{{TextSearch}}{{nocomments}}\n\n\n----\nCategoryWiki', owner = '(Public)', user = 'WikkaInstaller', time = now(), latest = 'Y'", $dblink); 191 if (!Wakka::existsPage('TextSearchExpanded',$config['table_prefix'],$dblink)) mysql_query("insert into ".$config['table_prefix']."pages set tag = 'TextSearchExpanded', body = '{{textsearchexpanded}}{{nocomments}}\n\n\n----\nCategoryWiki', owner = '(Public)', user = 'WikkaInstaller', time = now(), latest = 'Y'", $dblink); 192 if (!Wakka::existsPage('MyPages',$config['table_prefix'],$dblink)) mysql_query("insert into ".$config['table_prefix']."pages set tag = 'MyPages', body = '{{MyPages}}{{nocomments}}\n\n\n----\nCategoryWiki', owner = '(Public)', user = 'WikkaInstaller', time = now(), latest = 'Y'", $dblink); 193 if (!Wakka::existsPage('MyChanges',$config['table_prefix'],$dblink)) mysql_query("insert into ".$config['table_prefix']."pages set tag = 'MyChanges', body = '{{MyChanges}}{{nocomments}}\n\n\n----\nCategoryWiki', owner = '(Public)', user = 'WikkaInstaller', time = now(), latest = 'Y'", $dblink); 194 if (!Wakka::existsPage('InterWiki',$config['table_prefix'],$dblink)) mysql_query("insert into ".$config['table_prefix']."pages set tag = 'InterWiki', body = '{{interwikilist}}\n\n\n----\nCategoryWiki', owner = '(Public)', user = 'WikkaInstaller', time = now(), latest = 'Y'", $dblink); 195 if (!Wakka::existsPage('PasswordForgotten',$config['table_prefix'],$dblink)) mysql_query("insert into ".$config['table_prefix']."pages set tag = 'PasswordForgotten', body = '{{emailpassword}}\n\n\n----\nCategoryWiki', owner = '(Public)', user = 'WikkaInstaller', time = now(), latest = 'Y'", $dblink); 196 if (!Wakka::existsPage('WikiCategory',$config['table_prefix'],$dblink)) mysql_query("insert into ".$config['table_prefix']."pages set tag = 'WikiCategory', body = '=====How to use categories=====\nThis wiki is using a very flexible but simple categorizing system to keep everything properly organized.\n\n====1. Adding a page to an existing category====\nTo \'\'add a page to an existing category\'\' simply add a link to the relevant category page. For example, to mark page ##\"\"MyPage\"\"## as a child of category ##\"\"MyCategory\"\"##, just add a link to ##\"\"MyCategory\"\"## from ##\"\"MyPage\"\"##. This will automatically add ##\"\"MyPage\"\"## to the list of pages belonging to that category. Category links are put by convention at the end of the page, but the position of these links does not affect their behavior.\n\n====2. Adding a subcategory to an existing category====\nTo \'\'create a hierarchy of categories\'\', you can follow the same instructions to add pages to categories. For example, to mark category ##\"\"Category2\"\"## as a child (or subcategory) of another category ##\"\"Category1\"\"##, just add a link to ##\"\"Category1\"\"## in ##\"\"Category2\"\"##. This will automatically add ##\"\"Category2\"\"## to the list of ##\"\"Category1\"\"##\'s children.\n\n====3. Creating new categories====\nTo \'\'start a new category\'\' just create a page containing ##\"\"{{category}}\"\"##. This will mark the page as a special //category page// and will output a list of pages belonging to the category. Category page names start by convention with the word ##Category## but you can also create categories without following this convention. To add a new category to the master list of categories just add a link from it to CategoryCategory.\n\n====4. Browsing categories====\nTo \'\'browse the categories\'\' available on your wiki you can start from CategoryCategory. If all pages and subcategories are properly linked as described above, you will be able to browse the whole hierarchy of categories starting from this page.\n\n----\nCategoryWiki', owner = '(Public)', user = 'WikkaInstaller', time = now(), latest = 'Y'", $dblink); 197 if (!Wakka::existsPage('CategoryWiki',$config['table_prefix'],$dblink)) mysql_query("insert into ".$config['table_prefix']."pages set tag = 'CategoryWiki', body = '===Wiki Related Category===\nThis Category will contain links to pages talking about Wikis and Wikis specific topics. When creating such pages, be sure to include CategoryWiki at the bottom of each page, so that page shows listed.\n\n\n----\n\n{{category col=\"3\"}}\n\n\n----\n[[CategoryCategory List of all categories]]', owner = '(Public)', user = 'WikkaInstaller', time = now(), latest = 'Y'", $dblink); 198 if (!Wakka::existsPage('CategoryAdmin',$config['table_prefix'],$dblink)) mysql_query("insert into ".$config['table_prefix']."pages set tag = 'CategoryAdmin', body = '=====Wiki Administration Category=====\nThis category links to pages for wiki administration.\n\n\n----\n\n{{category}}\n\n\n----\n[[CategoryCategory List of all categories]]', owner = '(Public)', user = 'WikkaInstaller', time = now(), latest = 'Y'", $dblink); 199 if (!Wakka::existsPage('CategoryCategory',$config['table_prefix'],$dblink)) mysql_query("insert into ".$config['table_prefix']."pages set tag = 'CategoryCategory', body = '===List of All Categories===\nBelow is the list of all Categories existing on this Wiki, granted that users did things right when they created their pages or new Categories. See WikiCategory for how the system works.\n\n----\n\n{{Category}}', owner = '(Public)', user = 'WikkaInstaller', time = now(), latest = 'Y'", $dblink); 200 if (!Wakka::existsPage('FormattingRules',$config['table_prefix'],$dblink)) mysql_query("insert into ".$config['table_prefix']."pages set tag = 'FormattingRules', body = '======Wikka Formatting Guide======\n\n<<**Note:** Anything between 2 sets of double-quotes is not formatted.<<::c::\nOnce you have read through this, test your formatting skills in the SandBox.\n----\n===1. Text Formatting===\n\n~##\"\"**I\'m bold**\"\"##\n~**I\'m bold **\n\n~##\"\"//I\'m italic text!//\"\"##\n~//I\'m italic text!//\n\n~##\"\"And I\'m __underlined__!\"\"##\n~And I\'m __underlined__!\n\n~##\"\"##monospace text##\"\"##\n~##monospace text##\n\n~##\"\"\'\'highlight text\'\'\"\"## (using 2 single-quotes)\n~\'\'highlight text\'\'\n\n~##\"\"++Strike through text++\"\"##\n~++Strike through text++\n\n~##\"\"Press #%ANY KEY#%\"\"##\n~Press #%ANY KEY#%\n\n~##\"\"@@Center text@@\"\"##\n~@@Center text@@\n\n===2. Headers===\n\nUse between six ##=## (for the biggest header) and two ##=## (for the smallest header) on both sides of a text to render it as a header.\n\n~##\"\"====== Really big header ======\"\"##\n~====== Really big header ======\n \n~##\"\"===== Rather big header =====\"\"##\n~===== Rather big header =====\n\n~##\"\"==== Medium header ====\"\"##\n~==== Medium header ====\n\n~##\"\"=== Not-so-big header ===\"\"##\n~=== Not-so-big header ===\n\n~##\"\"== Smallish header ==\"\"##\n~== Smallish header ==\n\n===3. Horizontal separator===\n~##\"\"----\"\"##\n----\n\n===4. Forced line break===\n~##\"\"---\"\"##\n---\n\n===5. Lists and indents===\n\nYou can indent text using a **~**, a **tab** or **4 spaces** (which will auto-convert into a tab).\n\n##\"\"~This text is indented<br />~~This text is double-indented<br /> This text is also indented\"\"##\n\n~This text is indented\n~~This text is double-indented\n This text is also indented\n\nTo create bulleted/ordered lists, use the following markup (you can always use 4 spaces instead of a ##**~**##):\n\n**Bulleted lists**\n##\"\"~- Line one\"\"##\n##\"\"~- Line two\"\"##\n\n - Line one\n - Line two\n\n**Numbered lists**\n##\"\"~1) Line one\"\"##\n##\"\"~1) Line two\"\"##\n\n 1) Line one\n 1) Line two\n\n**Ordered lists using uppercase characters**\n##\"\"~A) Line one\"\"##\n##\"\"~A) Line two\"\"##\n\n A) Line one\n A) Line two\n\n**Ordered lists using lowercase characters**\n##\"\"~a) Line one\"\"##\n##\"\"~a) Line two\"\"##\n\n a) Line one\n a) Line two\n\n**Ordered lists using roman numerals**\n##\"\"~I) Line one\"\"##\n##\"\"~I) Line two\"\"##\n\n I) Line one\n I) Line two\n\n**Ordered lists using lowercase roman numerals**\n##\"\"~i) Line one\"\"##\n##\"\"~i) Line two\"\"##\n\n i) Line one\n i) Line two\n\n===6. Inline comments===\n\nTo format some text as an inline comment, use an indent ( **~**, a **tab** or **4 spaces**) followed by a **\"\"&\"\"**.\n\n**Example:**\n\n##\"\"~& Comment\"\"##\n##\"\"~~& Subcomment\"\"##\n##\"\"~~~& Subsubcomment\"\"##\n\n~& Comment\n~~& Subcomment\n~~~& Subsubcomment\n\n===7. Images===\n\nTo place images on a Wiki page, you can use the ##image## action.\n\n**Example:**\n\n~##\"\"{{image class=\"center\" alt=\"DVD logo\" title=\"An Image Link\" url=\"images/dvdvideo.gif\" link=\"RecentChanges\"}}\"\"##\n~{{image class=\"center\" alt=\"dvd logo\" title=\"An Image Link\" url=\"images/dvdvideo.gif\" link=\"RecentChanges\"}}\n\nLinks can be external, or internal Wiki links. You don\'t need to enter a link at all, and in that case just an image will be inserted. You can use the optional classes ##left## and ##right## to float images left and right. You don\'t need to use all those attributes, only ##url## is required while ##alt## is recommended for accessibility.\n\n===8. Links===\n\nTo create a **link to a wiki page** you can use any of the following options: ---\n~1) type a ##\"\"WikiName\"\"##: --- --- ##\"\"FormattingRules\"\"## --- FormattingRules --- ---\n~1) add a forced link surrounding the page name by ##\"\"[[\"\"## and ##\"\"]]\"\"## (everything after the first space will be shown as description): --- --- ##\"\"[[SandBox Test your formatting skills]]\"\"## --- [[SandBox Test your formatting skills]] --- --- ##\"\"[[SandBox 沙箱]]\"\"## --- [[SandBox 沙箱]] --- ---\n~1) add an image with a link (see instructions above).\n\nTo **link to external pages**, you can do any of the following: ---\n~1) type a URL inside the page: --- --- ##\"\"http://www.example.com\"\"## --- http://www.example.com --- --- \n~1) add a forced link surrounding the URL by ##\"\"[[\"\"## and ##\"\"]]\"\"## (everything after the first space will be shown as description): --- --- ##\"\"[[http://example.com/jenna/ Jenna\'s Home Page]]\"\"## --- [[http://example.com/jenna/ Jenna\'s Home Page]] --- --- ##\"\"[[mail@example.com Write me!]]\"\"## --- [[mail@example.com Write me!]] --- ---\n~1) add an image with a link (see instructions above);\n~1) add an interwiki link (browse the [[InterWiki list of available interwiki tags]]): --- --- ##\"\"WikiPedia:WikkaWiki\"\"## --- WikiPedia:WikkaWiki --- --- ##\"\"Google:CSS\"\"## --- Google:CSS --- --- ##\"\"Thesaurus:Happy\"\"## --- Thesaurus:Happy --- ---\n\n===9. Tables===\n\n<<The ##table## action has been deprecated as of Wikka version 1.2 and has been replaced with the syntax that follows. Please visit the [[Docs:TableActionInfo Wikka documentation server]] for information about the older ##table## action.<<::c::\nTables can be created using two pipe (##\"\"||\"\"##) symbols. Everything in a single line is rendered as a table row.\n\n**Example:**\n\n##\"\"||Cell 1||Cell 2||\"\"##\n\n||Cell 1||Cell 2||\n\nHeader cells can be rendered by placing an equals sign between the pipes.\n\n**Example:**\n\n##\"\"|=|Header 1|=|Header 2||\"\"##\n##\"\"||Cell 1||Cell 2||\"\"##\n\n|=|Header 1|=|Header 2||\n||Cell 1||Cell 2||\n\nRow and column spans are specified with ##x:## and ##y:## in parentheses just after the pipes.\n\n**Example:**\n\n##\"\"|=| |=|(x:2)Columns||\"\"##\n##\"\"|=|(y:2) Rows||Cell 1||Cell 2||\"\"##\n##\"\"||Cell 3||Cell 4||\"\"##\n\n|=| |=|(x:2)Columns||\n|=|(y:2) Rows||Cell 1||Cell 2||\n||Cell 3||Cell 4||\n\nMany additional features are available using table markup. A more comprehensive table markup guide is available on this server\'s TableMarkup page. A complete syntax reference is available on this server\'s TableMarkupReference page.\n\n===10. Colored Text===\n\nColored text can be created using the ##color## action:\n\n**Example:**\n\n~##\"\"{{color c=\"blue\" text=\"This is a test.\"}}\"\"##\n~{{color c=\"blue\" text=\"This is a test.\"}}\n\nYou can also use hex values:\n\n**Example:**\n\n~##\"\"{{color hex=\"#DD0000\" text=\"This is another test.\"}}\"\"##\n~{{color hex=\"#DD0000\" text=\"This is another test.\"}}\n\nAlternatively, you can specify a foreground and background color using the ##fg## and ##bg## parameters (they accept both named and hex values):\n\n**Examples:**\n\n~##\"\"{{color fg=\"#FF0000\" bg=\"#000000\" text=\"This is colored text on colored background\"}}\"\"##\n~{{color fg=\"#FF0000\" bg=\"#000000\" text=\"This is colored text on colored background\"}}\n\n~##\"\"{{color fg=\"yellow\" bg=\"black\" text=\"This is colored text on colored background\"}}\"\"##\n~{{color fg=\"yellow\" bg=\"black\" text=\"This is colored text on colored background\"}}\n\n\n===11. Floats===\n\nTo create a **left floated box**, use two ##<## characters before and after the block.\n\n**Example:**\n\n~##\"\"<<Some text in a left-floated box hanging around<< Some more text as a filler. Some more text as a filler. Some more text as a filler. Some more text as a filler. Some more text as a filler. Some more text as a filler. Some more text as a filler. Some more text as a filler.\"\"##\n\n<<Some text in a left-floated box hanging around<<Some more text as a filler. Some more text as a filler. Some more text as a filler. Some more text as a filler. Some more text as a filler. Some more text as a filler. Some more text as a filler. Some more text as a filler.\n\n::c::To create a **right floated box**, use two ##>## characters before and after the block.\n\n**Example:**\n\n~##\"\">>Some text in a right-floated box hanging around>> Some more text as a filler. Some more text as a filler. Some more text as a filler. Some more text as a filler. Some more text as a filler. Some more text as a filler. Some more text as a filler. Some more text as a filler.\"\"##\n\n >>Some text in a right-floated box hanging around>>Some more text as a filler. Some more text as a filler. Some more text as a filler. Some more text as a filler. Some more text as a filler. Some more text as a filler. Some more text as a filler. Some more text as a filler.\n\n::c:: Use ##\"\"::c::\"\"## to clear floated blocks.\n\n===12. Code formatters===\n\nYou can easily embed code blocks in a wiki page using a simple markup. Anything within a code block is displayed literally. \nTo create a **generic code block** you can use the following markup:\n\n~##\"\"%% This is a code block %%\"\"##. \n\n%% This is a code block %%\n\nTo create a **code block with syntax highlighting**, you need to specify a //code formatter// (see below for a list of available code formatters). \n\n~##\"\"%%(\"\"{{color c=\"red\" text=\"php\"}}\"\")<br /><?php<br />echo \"Hello, World!\";<br />?><br />%%\"\"##\n\n%%(php)\n<?php\necho \"Hello, World!\";\n?>\n%%\n\nYou can also specify an optional //starting line// number.\n\n~##\"\"%%(php;\"\"{{color c=\"red\" text=\"15\"}}\"\")<br /><?php<br />echo \"Hello, World!\";<br />?><br />%%\"\"##\n\n%%(php;15)\n<?php\necho \"Hello, World!\";\n?>\n%%\n\nIf you specify a //filename//, this will be used for downloading the code.\n\n~##\"\"%%(php;15;\"\"{{color c=\"red\" text=\"test.php\"}}\"\")<br /><?php<br />echo \"Hello, World!\";<br />?><br />%%\"\"##\n\n%%(php;15;test.php)\n<?php\necho \"Hello, World!\";\n?>\n%%\n\n**List of available code formatters:**\n{{table columns=\"6\" cellpadding=\"1\" cells=\"LANGUAGE;FORMATTER;LANGUAGE;FORMATTER;LANGUAGE;FORMATTER;ABAP;abap;Actionscript;actionscript;ADA;ada;Apache Log;apache;AppleScript; applescript;ASM;asm;ASP;asp;AutoIT;autoit;Axapta/Dynamics Ax X++;xpp;Bash;bash;BlitzBasic;blitzbasic;BNF;bnf;C;c;C for Macs;c_mac;c#;csharp;C++;cpp;C++ (QT extensions);cpp-qt;CAD DCL;caddcl;CadLisp;cadlisp;CFDG;cfdg;ColdFusion;cfm; CSS;css;D;d;Delphi;delphi;Diff-Output;diff;DIV; div;DOS;dos;dot;dot;Eiffel;eiffel;Fortran;fortran;FOURJ\'s Genero 4GL;genero;FreeBasic;freebasic;GML;gml;Groovy;groovy;Haskell;haskell;HTML;html4strict;INI;ini;IO;io;Inno Script;inno;Java 5;java5;Java;java;Javascript;javascript;LaTeX;latex;Lisp;lisp;Lua;lua;Matlab;matlab;Microchip Assembler;mpasm;Microsoft Registry;reg;mIRC;mirc;Motorola 68000 Assembler;m68k;MySQL;mysql;NSIS;nsis;Objective C;objc;OpenOffice BASIC;oobas;Objective Caml;ocaml;Objective Caml (brief);ocaml-brief;Oracle 8;oracle8;Pascal;pascal;Per (forms);per;Perl;perl;PHP;php;PHP (brief);php-brief;PL/SQL;plsql;Python;phyton;Q(uick)BASIC;qbasic;robots.txt;robots;Ruby;ruby;Ruby on Rails;rails;SAS;sas;Scheme;scheme;sdlBasic;sdlbasic;SmallTalk;smalltalk;Smarty;smarty;SQL;sql;TCL/iTCL;tcl;T-SQL;tsql;Text;text;thinBasic;thinbasic;Unoidl;idl;VB.NET;vbnet;VHDL;vhdl;Visual BASIC;vb;Visual Fox Pro;visualfoxpro;WinBatch;winbatch;XML;xml;ZiLOG Z80;z80;###\"}}\n\n===13. Mindmaps===\n\nWikka has native support for [[Docs:FreeMind mindmaps]]. There are two options for embedding a mindmap in a wiki page.\n\n**Option 1:** Upload a \"\"FreeMind\"\" file to a webserver, and then place a link to it on a wikka page:\n ##\"\"http://yourdomain.com/freemind/freemind.mm\"\"##\nNo special formatting is necessary.\n\n**Option 2:** Paste the \"\"FreeMind\"\" data directly into a wikka page:\n~- Open a \"\"FreeMind\"\" file with a text editor.\n~- Select all, and copy the data.\n~- Browse to your Wikka site and paste the Freemind data into a page. \n\n===14. Embedded HTML===\n\nYou can easily paste HTML in a wiki page by wrapping it into two sets of doublequotes. \n\n~##""[html code]""##\n\n**Examples:**\n\n~##""y = x<sup>n+1</sup>""##\n~\"\"y = x<sup>n+1</sup>\"\"\n\n~##""<acronym title=\"Cascade Style Sheet\">CSS</acronym>""##\n~\"\"<acronym title=\"Cascade Style Sheet\">CSS</acronym>\"\"\n\nBy default, some HTML tags are removed by the \"\"SafeHTML\"\" parser to protect against potentially dangerous code. The list of tags that are stripped can be found on the [[Docs:SafeHTML SafeHTML]] documentation page.\n\nIt is possible to allow //all// HTML tags to be used, see Docs:UsingHTML for more information.\n\n----\nCategoryWiki', owner = '(Public)', user = 'WikkaInstaller', time = now(), latest = 'Y'", $dblink); 201 if (!Wakka::existsPage('OwnedPages',$config['table_prefix'],$dblink)) mysql_query("insert into ".$config['table_prefix']."pages set tag = 'OwnedPages', body = '{{ownedpages}}{{nocomments}}These numbers merely reflect how many pages you have created, not how much content you have contributed or the quality of your contributions. To see how you rank with other members, you may be interested in checking out the HighScores. \n\n\n----\nCategoryWiki', owner = '(Public)', user = 'WikkaInstaller', time = now(), latest = 'Y'", $dblink); 202 if (!Wakka::existsPage('SandBox',$config['table_prefix'],$dblink)) mysql_query("insert into ".$config['table_prefix']."pages set tag = 'SandBox', body = 'Test your formatting skills here.\n\n\n\n\n----\nCategoryWiki', owner = '(Public)', user = 'WikkaInstaller', time = now(), latest = 'Y'", $dblink); 203 if (!Wakka::existsPage('SysInfo',$config['table_prefix'],$dblink)) mysql_query("insert into ".$config['table_prefix']."pages set tag = 'SysInfo', body = '{{checkversion}}\n===== System Information =====\n\n~-Wikka version: ##{{wikkaversion}}##\n~-Wikka patch level: ##{{wikkapatchlevel}}##\n~-PHP version: ##{{phpversion}}##\n~-\"\"MySQL\"\" version: ##{{mysqlversion}}##\n~-\"\"GeSHi\"\" version: ##{{geshiversion}}##\n~-Server:\n~~-Host: ##{{system show=\"host\"}}##\n~~-Operative System: ##{{system show=\"os\"}}##\n~~-Machine: ##{{system show=\"machine\"}}##\n\n{{wikkaconfig}}\n\n----\nCategoryWiki', owner = '(Public)', user = 'WikkaInstaller', time = now(), latest = 'Y'", $dblink); 204 if (!Wakka::existsPage('AdminUsers',$config['table_prefix'],$dblink)) mysql_query("insert into ".$config['table_prefix']."pages set tag = 'AdminUsers', body = '{{checkversion}}\n{{adminusers}}\n\n----\nCategoryAdmin', owner = '(Public)', user = 'WikkaInstaller', time = now(), latest = 'Y'", $dblink); 205 if (!Wakka::existsPage('AdminPages',$config['table_prefix'],$dblink)) mysql_query("insert into ".$config['table_prefix']."pages set tag = 'AdminPages', body = '{{checkversion}}\n{{adminpages}}\n\n----\nCategoryAdmin', owner = '(Public)', user = 'WikkaInstaller', time = now(), latest = 'Y'", $dblink); 206 if (!Wakka::existsPage('DatabaseInfo',$config['table_prefix'],$dblink)) mysql_query("insert into ".$config['table_prefix']."pages set tag = 'DatabaseInfo', body = '{{dbinfo}}\n\n----\nCategoryAdmin', owner = '(Public)', user = 'WikkaInstaller', time = now(), latest = 'Y'", $dblink); 207 if (!Wakka::existsPage('HighScores',$config['table_prefix'],$dblink)) mysql_query("insert into ".$config['table_prefix']."pages set tag = 'HighScores', body = '{{highscores}}\n\n----\nCategoryWiki', owner = '(Public)', user = 'WikkaInstaller', time = now(), latest = 'Y'", $dblink); 208 if (!Wakka::existsPage('TableMarkup',$config['table_prefix'],$dblink)) mysql_query("insert into ".$config['table_prefix']."pages set tag = 'TableMarkup', body = '=====Wikka Table Markup Guide=====\n>>==See also:==\n~-For earlier Wikka versions, check the [[Docs:TableActionInfo table]] action\n~-Updated versions of this page can be found on the [[Docs:TableMarkup Wikka documentation server]] \n~-For a more formal description, check this server\'s TableMarkupReference page.\n>>\nAs of ##1.2##, Wikka introduces a flexible markup for data tables. Any kind of tables allowed by XHTML can be created using this markup, from the most basic examples (e.g. simple rows of cells) to complex tables with full support for accessibility options.::c::\n\n====1. Table basics: cells, rows, columns====\n\nThe most basic element of a table is a **cell**. Single cells can be created using the standard delimiter ##\"\"||\"\"##, e.g.:\n\n##\"\"||Hello||\"\"##\n\n||Hello||\n\nNote that a cell must always be open and closed by delimiters. \n\n**Rows** can be created by adding on the same line multiple cells:\n\n##\"\"||Cell 1||Cell 2||Cell 3||\"\"##\n\n||Cell 1||Cell 2||Cell 3||\n\n**Columns** can be created by adding rows on separate lines:\n\n##\"\"||Cell 1||\"\"##\n##\"\"||Cell 2||\"\"##\n##\"\"||Cell 3||\"\"##\n\n||Cell 1||\n||Cell 2||\n||Cell 3||\n\nBy now you should be able to create simple tables with **multiple rows and columns**.\n\n##\"\"||Cell 1||Cell 2||Cell 3||\"\"##\n##\"\"||Cell 4||Cell 5||Cell 6||\"\"##\n##\"\"||Cell 7||Cell 8||Cell 9||\"\"##\n\n||Cell 1||Cell 2||Cell 3||\n||Cell 4||Cell 5||Cell 6||\n||Cell 7||Cell 8||Cell 9||\n\n====2. Headings====\n\nAs soon as you create slightly more complex data tables, you will need to specify column and row **headings**. Headings are special cells that specify what kind of data rows and columns contain. The most basic way of creating a heading is by using ##\"\"|=|\"\"## as a delimiter.\n\nThe following is an example of a simple table with **column headings**:\n\n##\"\"|=|Apples|=|Pears|=|\"\"##\n##\"\"||300Kg||480Kg||\"\"##\n\n|=|Apples|=|Pears|=|\n||300Kg||480Kg||\n\n**Row headings** are created in the same way. Since they are usually followed by normal cells, they must be terminated with the ##\"\"||\"\"## standard delimiter if the next element in the row is a simple cell:\n\n##\"\"|=|Apples||300Kg||\"\"##\n##\"\"|=|Pears||480Kg||\"\"##\n\n|=|Apples||300Kg||\n|=|Pears||480Kg||\n\nYou should be able by now to create simple tables with row and column headings:\n\n##\"\"|=| |=|Apples|=|Pears|=|\"\"##\n##\"\"|=|Mary||300Kg||320Kg||\"\"##\n##\"\"|=|John||400Kg||630Kg||\"\"##\n\n|=| |=|Apples|=|Pears|=|\n|=|Mary||300Kg||320Kg||\n|=|John||400Kg||630Kg||\n\nWe will describe later how to add accessibility parameters for row and column headings.\n\n====3. Captions====\n\nUsually tables are introduced with a caption that describes what the table contains. A caption element is introduced with a ##\"\"|?|\"\"## delimiter and terminated with a standard delimiter ##\"\"||\"\"##.\n\n##\"\"|?|Fruit production in 2006||\"\"##\n##\"\"|=| |=|Apples|=|Pears|=|\"\"##\n##\"\"|=|Mary||300Kg||320Kg||\"\"##\n##\"\"|=|John||400Kg||630Kg||\"\"##\n\n|?|Fruit production in 2006||\n|=| |=|Apples|=|Pears|=|\n|=|Mary||300Kg||320Kg||\n|=|John||400Kg||630Kg||\n\n====4. Spans====\n\n**Spans** are used to combine multiple cells or multiple headings vertically or horizontally and are created using the following [[TableMarkupReference attribute parameters]]:\n\n##\"\"||\"\"(\'\'span options\'\')Element content\"\"||\"\"##\n\nA **cell spanning multiple columns** is generated by prefixing the cell content with a ##(x:\'\'n\'\')## parameter, where ##\'\'n\'\'## is the number of columns to be spanned. The following example shows how to create a cell spanning two columns:\n\n##\"\"||(x:2)Cell spanning 2 columns||Cell 3||\"\"##\n##\"\"||Cell 4||Cell 5||Cell 6||\"\"##\n##\"\"||Cell 7||Cell 8||Cell 9||\"\"##\n\n||(x:2)Cell spanning 2 columns||Cell 3||\n||Cell 4||Cell 5||Cell 6||\n||Cell 7||Cell 8||Cell 9||\n\nSpans can also be applied to rows. A **cell spanning multiple rows** is generated by prefixing the cell content with a ##(y:\'\'n\'\')## parameter, where ##\'\'n\'\'## is the number of rows to be spanned. The following example shows how to create a cell spanning two rows:\n\n##\"\"||(y:2)Cell spanning 2 rows||Cell 2||Cell 3||\"\"##\n##\"\"||Cell 5||Cell 6||\"\"##\n##\"\"||Cell 7||Cell 8||Cell 9||\"\"##\n\n||(y:2)Cell spanning 2 rows||Cell 2||Cell 3||\n||Cell 5||Cell 6||\n||Cell 7||Cell 8||Cell 9||\n\nSpans are particularly useful to create **subheadings**:\n\n##\"\"|?|Fruit production in the last two years||\"\"##\n##\"\"|=| |=|(x:2)Apples|=|(x:2)Pears|=|\"\"##\n##\"\"|=| |=|2005|=|2006|=|2005|=|2006|=|\"\"##\n##\"\"|=|Mary||300Kg||320Kg||400kg||280Kg||\"\"##\n##\"\"|=|John||400Kg||630Kg||210Kg||300Kg||\"\"##\n\n|?|Fruit production in the last two years||\n|=| |=|(x:2)Apples|=|(x:2)Pears|=|\n|=| |=|2005|=|2006|=|2005|=|2006|=|\n|=|Mary||300Kg||320Kg||400kg||280Kg||\n|=|John||400Kg||630Kg||210Kg||300Kg||\n\nColumn and row spans can be combined to created funky table layouts:\n\n##\"\"||(x:2;y:2)2x2||(x:2)2x1||(y:2)1x2||\"\"##\n##\"\"||(y:2)1x2||1x1||\"\"##\n##\"\"||1x1||1x1||(x:2)2x1||\"\"##\n\n||(x:2;y:2)2x2||(x:2)2x1||(y:2)1x2||\n||(y:2)1x2||1x1||\n||1x1||1x1||(x:2)2x1||\n\n\n====5. Formatting text within tables====\n\nYou can use any kind of basic [[Docs:TextFormatting Wikka markup]] to render text within tables.\nThe following example adds basic formatting to cell content:\n\n##\"\"|?|Using text formatting within tables||\"\"##\n##\"\"||##Monospaced##||//Italics//||**Bold**||__Underlined__||\"\"##\n##\"\"||\'\'Highlighted\'\'||++Strikethrough++||(x:2)**//Bold italics//**||\"\"##\n\n|?|Using text formatting within tables||\n||##Monospaced##||//Italics//||**Bold**||__Underlined__||\n||\'\'Highlighted\'\'||++Strikethrough++||(x:2)**//Bold italics//**||\n\n====6. Adding actions and images within tables====\n\nSimple, content-generating [[Docs:UsingActions actions]] (including [[Docs:AddingImages images]]) can be added within table cells and headings.\n\n##\"\"|?|Using actions within tables||\"\"##\n##\"\"||This wiki contains {{countpages}} pages||\"\"##\n##\"\"||{{image url=\"images/wikka_logo.jpg\" class=\"center\" alt=\"a w\" title=\"w image\"}}||\"\"##\n##\"\"||{{color c=\"red\" text=\"some colored text\"}}||\"\"##\n\n|?|Using actions within tables||\n||This wiki contains {{countpages}} pages||\n||{{image url=\"images/wikka_logo.jpg\" class=\"center\" alt=\"a w\" title=\"w image\"}}||\n||{{color c=\"red\" text=\"some colored text\"}}||\n\n====7. Adding links within tables====\n\nAll the available options to create [[Docs:AddingLinks links]] can be used within table cells or headings:\n\n##\"\"|?|Adding links within tables||\"\"##\n##\"\"||Camelcase links: SandBox||\"\"##\n##\"\"||Escaped camelcase links: ""SandBox"" escaped||\"\"##\n##\"\"||Forced links: [[HomePage main]]||\"\"##\n##\"\"||Interwiki links: Wikipedia:Wikka||\"\"##\n##\"\"||Forced interwiki links: [[Wikipedia:Wikka Wikka article on Wikipedia]]||\"\"##\n##\"\"||External links: http://www.example.com ||\"\"##\n##\"\"||Forced external links: [[http://www.example.com Example.com]]||\"\"##\n##\"\"||Image links: {{image url=\"images/wizard.gif\" alt=\"wizard\" title=\"Display an index of pages on this wiki\" link=\"PageIndex\"}}||\"\"##\n\n|?|Adding links within tables||\n||Camelcase links: SandBox||\n||Escaped camelcase links: \"\"SandBox escaped\"\"||\n||Forced links: [[HomePage main]]||\n||Interwiki links: Wikipedia:Wikka||\n||Forced interwiki links: [[Wikipedia:Wikka Wikka article on Wikipedia]]||\n||External links: http://www.example.com ||\n||Forced external links: [[http://www.example.com Example.com]]||\n||Image links: {{image url=\"images/wizard.gif\" alt=\"wizard\" title=\"Display an index of pages on this wiki\" link=\"PageIndex\"}}||\n\n====8. Adding HTML within tables====\n\nYou can also use [[Docs:UsingHTML embedded HTML]] in table elements:\n\n##\"\"|?|Embedding HTML within tables||\"\"##\n##\"\"||Here\'s some superscript: ""a<sup>2+1</sup>""||\"\"##\n##\"\"||And here\'s some subscript too: ""a<sub>2k</sub>""||\"\"##\n##\"\"||I love acronyms: ""<acronym title=\"What You See Is What You Get\">WYSIWYG</acronym>""||\"\"##\n\n|?|Embedding HTML within tables||\n||Here\'s some superscript: \"\"a<sup>2+1</sup>\"\"||\n||And here\'s some subscript too: \"\"a<sub>2k</sub>\"\"||\n||I love acronyms: \"\"<acronym title=\"What You See Is What You Get\">WYSIWYG</acronym>\"\"||\n\n====9. Adding a touch of style====\n\nThe table markup introduces a new [[TableMarkupReference style selector]]. CSS style options can be added to any element by enclosing them within **single braces**, right before the element content, e.g.:\n##\"\"||\"\"{\'\'style options\'\'}Element content\"\"||\"\"##\n\nFor example, to render a cell with **red background** and **white text color**, you can do the following:\n\n##\"\"||{background-color:red; color:white}Hello||\"\"##\n\n||{background-color:red; color:white}Hello||\n\nYou can play with **font size** and **text alignment**:\n\n##\"\"|?|Adding some more style||\"\"##\n##\"\"||{font-size:190%; text-align:right}Please scale me!||\"\"##\n##\"\"||{font-size:170%; text-align:right}Please scale me!||\"\"##\n##\"\"||{font-size:150%; text-align:right}Please scale me!||\"\"##\n##\"\"||{font-size:130%; text-align:right}Please scale me!||\"\"##\n##\"\"||{font-size:110%; text-align:right}Please scale me!||\"\"##\n##\"\"||{font-size:90%; text-align:right}Please scale me!||\"\"##\n##\"\"||{font-size:70%; text-align:right}Please scale me!||\"\"##\n\n|?|Adding some more style||\n||{font-size:190%; text-align:right}Please scale me!||\n||{font-size:170%; text-align:right}Please scale me!||\n||{font-size:150%; text-align:right}Please scale me!||\n||{font-size:130%; text-align:right}Please scale me!||\n||{font-size:110%; text-align:right}Please scale me!||\n||{font-size:90%; text-align:right}Please scale me!||\n||{font-size:70%; text-align:right}Please scale me!||\n\nYou can also apply style to **headings** and **captions**:\n\n##\"\"|?|{border:1px dotted red; color:red}Style can be applied anywhere||\"\"##\n##\"\"|=|{color:#000; font-size:150%; font-style:italic; font-family:Georgia, Hoefler Text, Georgia, serif; font-weight:normal; line-height:150%}Emphemeral Quibus|=|\"\"##\n##\"\"||Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Duis auctor auctor pede.||\"\"##\n\n|?|{border:1px dotted red; color:red}Style can be applied anywhere||\n|=|{color:#000; font-size:150%; font-style:italic; font-family:Georgia, Hoefler Text, Georgia, serif; font-weight:normal; line-height:150%}Emphemeral Quibus|=|\n||Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Duis auctor auctor pede.||\n\nPlease note that **style parameters should always follow attribute parameters**, when both are specified for an element (see the [[TableMarkupReference table markup reference]]):\n\n##\"\"|?|Give priority||\"\"##\n##\"\"||(x:2;y:2){background-color:pink}2x2||(x:2){background-color:lightblue}2x1||(y:2){background-color:lightyellow}1x2||\"\"##\n##\"\"||(y:2){background-color:lightyellow}1x2||{background-color:#333;color:white}1x1||\"\"##\n##\"\"||{background-color:lightblue}1x1||{background-color:#333;color:white}1x1||(x:2){background-color:pink}2x1||\"\"##\n\n|?|Give priority||\n||(x:2;y:2){background-color:pink}2x2||(x:2){background-color:lightblue}2x1||(y:2){background-color:lightyellow}1x2||\n||(y:2){background-color:lightyellow}1x2||{background-color:#333;color:white}1x1||\n||{background-color:lightblue}1x1||{background-color:#333;color:white}1x1||(x:2){background-color:pink}2x1||\n\n====10. Adding style through classes====\n\nYou can apply existing classes from your stylesheet to any element using the class parameter ##(c:\'\'class\'\')##. Note that custom style declarations specified through braced markup override class attributes.\n\nThe following example applies to table cells two class selectors defined in the stylesheet. The third row shows how to override a class selector with custom style attributes:\n\n##\"\"|?|Using class selectors to add style to table elements||\"\"##\n##\"\"||(c:highlight)This cell uses the ##.highlight## class||\"\"##\n##\"\"||(c:smaller)This cell uses the ##.smaller## class||\"\"##\n##\"\"||(c:smaller){font-size:150%}This cell uses the ##.smaller## class overridden by custom style settings||\"\"##\n\n|?|Using class selectors to add style to table elements||\n||(c:highlight)This cell uses the ##.highlight## class||\n||(c:smaller)This cell uses the ##.smaller## class||\n||(c:smaller){font-size:150%}This cell uses a ##.smaller## class overridden by custom style settings||\n\n====11. Global table attributes====\n\nTable-level attributes can be specified by adding at the beginning of the table the following element: ##\"\"|!| ||\"\"##, which is used as a container for global table attributes. For example, you can specify **global style options** for a table by adding them to this element:\n\n##\"\"|!|{border:3px solid blue; background-color: black; color: white; width: 300px; text-align: center}||\"\"##\n##\"\"||Cell 1||\"\"##\n##\"\"||Cell 2||\"\"##\n##\"\"||Cell 3||\"\"##\n\n|!|{border:3px solid blue; background-color: black; color: white; width: 300px; text-align: center}||\n||Cell 1||\n||Cell 2||\n||Cell 3||\n\n====12. Referring to elements: the ##id## attribute====\n\n##id## attributes are used to refer to unique elements in a page and to provide an anchor for styling and linking. You can specify an ##id## for any table element by using the ##(i:\'\'id\'\')## parameter.\n\nFor example, the following markup creates a table with the ##id## \"main_table\" containing two cells with ##id##\'s \"cell_1\" and \"cell_2\"\n\n##\"\"|!|(i:main_table)||\"\"##\n##\"\"|?|Using id to refer to table elements||\"\"##\n##\"\"||(i:cell_1)This cell can be referred to by using the ##cell_1## id||\"\"##\n##\"\"||(i:cell_2)This cell can be referred to by using the ##cell_2## id||\"\"##\n\n|!|(i:main_table)||\n|?|Using id to refer to table elements||\n||(i:cell_1)This cell can be referred to by using the ##cell_1## id||\n||(i:cell_2)This cell can be referred to by using the ##cell_2## id||\n\n====13. Accessibility options: adding titles====\n\nAny table element can be given a ##title## attribute to enhance its accessibility. Titles are typically displayed in graphical browsers by hovering over the corresponding element and are useful to display unobtrusive descriptions about specific elements. You can specify a ##title## for any table element by using the ##(t:\'\'title\'\')## parameter.\n\nThe following example adds titles to several table elements (you can hover over the table to display them):\n\n##\"\"|!|(t:Comparative figures for fruit production in the last year){width: 350px}||\"\"##\n##\"\"|?|Fruit production in 2006||\"\"##\n##\"\"|=| |=|(t:yearly production of apples)Apples|=|(t:yearly production of pears)Pears|=|\"\"##\n##\"\"|=|(t:Mary\'s contribution to 2006 production)Mary||(t:Mary\'s production of apples in 2006){text-align:center}300Kg||(t:Mary\'s production of pears in 2006){text-align:center}320Kg||\"\"##\n##\"\"|=|(t:John\'s contribution to 2006 production)John||(t:John\'s production of apples in 2006){text-align:center}400Kg||(t:John\'s production of pears in 2006){text-align:center}630Kg||\"\"##\n\n|!|(t:Comparative figures for fruit production in the last year){width: 350px}||\n|?|Fruit production in 2006||\n|=| |=|(t:yearly production of apples)Apples|=|(t:yearly production of pears)Pears|=|\n|=|(t:Mary\'s contribution to 2006 production)Mary||(t:Mary\'s production of apples in 2006){text-align:center}300Kg||(t:Mary\'s production of pears in 2006){text-align:center}320Kg||\n|=|(t:John\'s contribution to 2006 production)John||(t:John\'s production of apples in 2006){text-align:center}400Kg||(t:John\'s production of pears in 2006){text-align:center}630Kg||\n\n====14. Accessibility options: adding a summary====\n\nTables can take an optional ##summary## attribute to describe the purpose and/or structure of the table. The description provided by the summary attribute is particularly helpful to users of non-visual browsers. You can specify a summary by adding a ##(u:\'\'Summary\'\')## parameter in the table global attributes.\n\nFor example, the following line:\n##\"\"|!|(u:This is a summary)||\"\"##\nwill add to the table a ##summary## attribute with the value ##This is a summary##.\n\n====15. Accessibility options: table head, table body and table foot====\n\nRows in a table can be grouped in a table head, table body and table foot. This division enables browsers to support scrolling of table bodies independently of the table head and foot. When long tables are printed, the table head and foot information may be repeated on each page that contains table data. The table head and table foot should contain information about the table\'s columns. The table body should contain rows of table data.\n\nWikka allows you to create groups of rows with special markers:\n~- The ##\"\"|[|\"\"## marker groups the rows it precedes as a **table head** block;\n~- The ##\"\"|]|\"\"## marker groups the rows it precedes as a **table foot** block;\n~- The ##\"\"|#|\"\"## marker groups the rows it precedes as a **table body**;\n\nThe following example shows how to use these elements to create row groups. Note that Wikka uses different backgrounds to differentiate column headings in the table head and foot from row headings in the table body:\n\n##\"\"|!|(u:A table with summary, caption, head, foot and body){width: 400px}||\"\"##\n##\"\"|?|Here\'s how you can group rows||\"\"##\n##\"\"|[|\"\"##\n##\"\"|=|Name|=|Place|=|Telephone||\"\"##\n##\"\"|]|\"\"##\n##\"\"|=|Name|=|Place|=|Telephone||\"\"##\n##\"\"|#|\"\"##\n##\"\"|=|John Smith||New York||555-1234||\"\"##\n##\"\"|=|Jane Smith||Los Angeles||555-2345||\"\"##\n##\"\"|=|John Doe||Unknown||Unknown||\"\"##\n##\"\"|=|Jane Doe||Unknown||Unknown||\"\"##\n\n|!|(u:A table with summary, caption, head, foot and body){width: 400px}||\n|?|Here\'s how you can group rows||\n|[|\n|=|Name|=|Place|=|Telephone||\n|]|\n|=|Name|=|Place|=|Telephone||\n|#|\n|=|John Smith||New York||555-1234||\n|=|Jane Smith||Los Angeles||555-2345||\n|=|John Doe||Unknown||Unknown||\n|=|Jane Doe||Unknown||Unknown||\n\n====16. Accessibility options: heading scope====\n\nTo be semantically correct and accessible to users with non-visual browsers, headings should contain scope attributes describing the cell range they refer to. \n~-Column heading scopes can be specified using the ##(o:col)## parameter in the corresponding column heading;\n~-Row heading scopes can be specified using the ##(o:row)## parameter in the corresponding row heading;\n\nThe following example shows how to correctly add column and row scopes to a table to make it accessible:\n\n##\"\"|!|(u:The number of employees and the foundation year of some imaginary companies.)||\"\"##\n##\"\"|?|Table 1: Company data||\"\"##\n##\"\"|[|\"\"##\n##\"\"|||=|(o:col)Employees|=|(o:col)Founded||\"\"##\n##\"\"|#|\"\"##\n##\"\"|=|(o:row)ACME Inc||1000||1947||\"\"##\n##\"\"|=|(o:row)XYZ Corp||2000||1973||\"\"##\n\n|!|(u:The number of employees and the foundation year of some imaginary companies.)||\n|?|Table 1: Company data||\n|[|\n|||=|(o:col)Employees|=|(o:col)Founded||\n|#|\n|=|(o:row)ACME Inc||1000||1947||\n|=|(o:row)XYZ Corp||2000||1973||\n\n\n----\nCategoryWiki', owner = '(Public)', user = 'WikkaInstaller', time = now(), latest = 'Y'", $dblink); 209 if (!Wakka::existsPage('TableMarkupReference',$config['table_prefix'],$dblink)) mysql_query("insert into ".$config['table_prefix']."pages set tag = 'TableMarkupReference', body = '======Wikka Table Markup Reference======\n>>==See also:==\n~-For an informal introduction to this markup and several examples consult this server\'s TableMarkup page.\n~-Updated versions of this page can be found on the [[Docs:TableMarkupReference Wikka documentation server]].\n>>\n==== 1. Table Markup Scheme ====\n\nThe generic markup for table elements follows this scheme:\n\n~**##{{color fg=\"#F00\" text=\"|*|\"}}{{color fg=\"blue\" text=\"(attribute parameters)\"}}{{color fg=\"green\" text=\"{style parameters}\"}}content{{color fg=\"#F00\" text=\"||\"}}##**\n\n==Example:==\n\n~##\"\"|=|(i:main_heading){text-size: 120%}This is the main heading||\"\"##\n\n===Understanding the Table Markup Scheme===\n\n~1)**Opening delimiter** --- **##{{color fg=\"#F00\" text=\"|*|\"}}##** is any of the delimiters described in the //elements table// below.\n~1)**Attributes** --- **##{{color fg=\"blue\" text=\"(attribute parameters)\"}}##** is an optional series of ##parameter:value## declarations enclosed in brackets. Valid parameters are described in the //attribute table// below. Multiple parameter declarations can be separated with a semicolon (**##;##**).\n~1)**Style** --- **##{{color fg=\"green\" text=\"{style parameters}\"}}##** is an optional series of CSS style declarations enclosed in braces. Multiple style declarations can be separated with a semicolon (**##;##**).\n~1)**Content** --- **##content##** can be any valid content for that element (including [[Docs:TextFormatting formatted text]]).\n~1)**Closing delimiter** --- **##{{color fg=\"#F00\" text=\"||\"}}##** is the standard delimiter.\n\n==Note:==\nSome elements are //self closing// and do not accept any attributes, style parameters or content. See the notes in the //elements table// below.\n\n==== 2. Elements ====\n\n|!|{width: 80%}||\n|?|Table Elements||\n|=|\"\"XHTML Elements\"\"|=|Delimiter|=|Notes||\n||##<table>##||##\"\"|!|\"\"##||Optional, only useful for adding attributes. **Must** be first in table markup if used. Should be on a line by itself.||\n||##<caption>##||##\"\"|?|\"\"##||||\n||##<colgroup>##||##\"\"|_|\"\"##||||\n||##<col />##||##\"\"|-|\"\"##||Selfclosing - must not be closed!||\n||##<thead>##||##\"\"|[|\"\"##||||\n||##<tfoot>##||##\"\"|]|\"\"##||||\n||##<tbody>##||##\"\"|#|\"\"##||||\n||##<tr>##||none||Will be opened for each row of table cells.||\n||##<th>##||##\"\"|=|\"\"##||||\n||##<td>##||##\"\"||\"\"##||||\n\n==== 3. Attributes ====\n\n|?|Table Attributes||\n|[|\n|=|Attribute|=|Markup key||\n|]|\n|=|Attribute|=|Markup key||\n|#|\n|=|(x:2)Core||\n||##id##||##i##||\n||##title##||##t##||\n||##class##||##c##||\n||##style##||##s##||\n|=|(x:2)i18n||\n||##xml:lang##||##l##||\n||##dir##||##d##||\n|=|(x:2)Table cells||\n||##colspan##||##x##||\n||##rowspan##||##y##||\n||##scope##||##o##||\n||##headers##||##h##||\n||##abbr##||##a##||\n||##axis##||##z##||\n|=|(x:2)Other Table elements||\n||##span##||##p##||\n||##summary##||##u##||\n\n\n----\nCategoryWiki', owner = '(Public)', user = 'WikkaInstaller', time = now(), latest = 'Y'", $dblink); 210 test('Building links table...', 1); 185 211 /** 186 212 * Script for (re)building links table. … … 188 214 include('links.php'); 189 215 190 break; 191 192 // The funny upgrading stuff. Make sure these are in order! // 193 // And yes, there are no break;s here. This is on purpose. // 216 // @@@ ?? *default* ACLs are in the configuration file; settings on UserSettings page are irrelevant for default ACLs! 217 // use page-specific "ACL" files to create page-specific ACLs (in update_default_page()!). 218 // @@@ use test() function to report actual results instead of assuming success! 194 219 test("Setting default ACL...", 1); 195 220 mysql_query("insert into ".$config['table_prefix']."acls set page_tag = 'UserSettings', read_acl = '*', write_acl = '+', comment_read_acl = '*', comment_post_acl = '+'", $dblink); … … 202 227 // 203 228 // Set default cookie path 229 test("Setting initial session cookies for auto-login...", 1); 204 230 $base_url_path = preg_replace('/wikka\.php/', '', $_SERVER['SCRIPT_NAME']); 205 231 $wikka_cookie_path = ('/' == $base_url_path) ? '/' : substr($base_url_path,0,-1); … … 207 233 SetCookie('user_name'.$config['wiki_suffix'], $config['admin_users'], time() + PERSISTENT_COOKIE_EXPIRY, $wikka_cookie_path); 208 234 $_COOKIE['user_name'.$config['wiki_suffix']] = $config['admin_users']; 209 SetCookie('pass'.$config['wiki_suffix'], md5(mysql_real_escape_string($_POST['password'])), time() + PERSISTENT_COOKIE_EXPIRY, $wikka_cookie_path);210 $_COOKIE['pass'.$config['wiki_suffix']] = md5(mysql_real_escape_string($_POST['password']));235 SetCookie('pass'.$config['wiki_suffix'], $pass_val, time() + PERSISTENT_COOKIE_EXPIRY, $wikka_cookie_path); 236 $_COOKIE['pass'.$config['wiki_suffix']] = $pass_val; 211 237 212 238 break; 213 239 214 240 // The funny upgrading stuff. Make sure these are in order! // 215 // And yes, there are no break ;s here. This is on purpose. //241 // And yes, there are no breaks here. This is on purpose. // 216 242 217 243 // from 0.1 to 0.1.1 … … 339 365 case "1.1.5.2": 340 366 case "1.1.5.3": 341 update_default_page(array('WikkaReleaseNotes', 'WikkaDocumentation'), $dblink, $config, $lang_defaults_path, $lang_defaults_fallback_path); 367 test("Adding WikkaReleaseNotes page...", 368 mysql_query("insert into ".$config['table_prefix']."pages set tag = 'WikkaReleaseNotes', body = '{{wikkachanges}}{{nocomments}}\n\n\n----\nCategoryWiki', owner = '(Public)', user = 'WikkaInstaller', time = now(), latest = 'Y'", $dblink), "Already done? OK!", 0); 369 test("Adding WikkaDocumentation page...", 370 mysql_query("insert into ".$config['table_prefix']."pages set tag = 'WikkaDocumentation' , body = '=====Wikka Documentation=====\n\nComprehensive and up-to-date documentation on Wikka Wiki can be found on the [[http://docs.wikkawiki.org/ Wikka Documentation server]].', owner = '(Public)', user = 'WikkaInstaller', time = now(), latest = 'Y'", $dblink), "Already done? OK!", 0); 342 371 // cookie names have changed -- logout user and delete the old cookies 343 372 test(DELETING_COOKIES, 1); … … 365 394 DeleteCookie("wikka_user_name"); 366 395 DeleteCookie("wikka_pass"); 396 //adding SysInfo page 397 test("Adding SysInfo page...", 398 mysql_query("insert into ".$config['table_prefix']."pages set tag = 'SysInfo', body = '===== System Information =====\n\n~-Wikka version: ##{{wikkaversion}}##\n~-PHP version: ##{{phpversion}}##\n~-\"\"MySQL\"\" version: ##{{mysqlversion}}##\n~-\"\"GeSHi\"\" version: ##{{geshiversion}}##\n~-Server:\n~~-Host: ##{{system show=\"host\"}}##\n~~-Operative System: ##{{system show=\"os\"}}##\n~~-Machine: ##{{system show=\"machine\"}}##\n\n----\nCategoryWiki', owner = '(Public)', note='".$upgrade_note."', user = 'WikkaInstaller', time = now(), latest = 'Y'", $dblink), "Already done? OK!", 0); 367 399 case "1.1.6.2-alpha": 368 400 case "1.1.6.2-beta": … … 373 405 test(sprintf(ADDING_CONFIG_ENTRY, 'wikka_template_path' ), 1); 374 406 $config["wikka_template_path"] = 'templates'; 407 test("Adding HighScores page...", 408 mysql_query("insert into ".$config['table_prefix']."pages set tag = 'HighScores', body = '{{highscores}}\n\n----\nCategoryWiki', owner = '(Public)', note='".$upgrade_note."', user = 'WikkaInstaller', time = now(), latest = 'Y'", $dblink), "Already done? OK!", 0); 409 test("Adding CategoryAdmin page...", 410 mysql_query("insert into ".$config['table_prefix']."pages set tag = 'CategoryAdmin', body = '=====Wiki Administration Category=====\nThis category links to pages for wiki administration.\n\n\n----\n\n{{category}}\n\n\n----\n[[CategoryCategory List of all categories]]', owner = '(Public)', note='".$upgrade_note."', user = 'WikkaInstaller', time = now(), latest = 'Y'", $dblink), "Already done? OK!", 0); 411 test("Adding DatabaseInfo page...", 412 mysql_query("insert into ".$config['table_prefix']."pages set tag = 'DatabaseInfo', body = '{{dbinfo}}\n\n----\nCategoryAdmin', owner = '(Public)', note='".$upgrade_note."', user = 'WikkaInstaller', time = now(), latest = 'Y'", $dblink), "Already done? OK!", 0); 413 test("Setting ACL for DatabaseInfo...", 414 mysql_query("insert into ".$config['table_prefix']."acls set page_tag = 'DatabaseInfo', read_acl = '!*', write_acl = '!*', comment_acl = '!*'", $dblink), "Already done? OK!", 0); 415 test("Adding AdminUsers page...", 416 mysql_query("insert into ".$config['table_prefix']."pages set tag = 'AdminUsers', body = '{{checkversion}}\n{{adminusers}}\n\n----\nCategoryAdmin', owner = '(Public)', note='".$upgrade_note."', user = 'WikkaInstaller', time = now(), latest = 'Y'", $dblink), "Already done? OK!", 0); 417 test("Setting ACL for AdminUsers...", 418 mysql_query("insert into ".$config['table_prefix']."acls set page_tag = 'AdminUsers', read_acl = '!*', write_acl = '!*', comment_acl = '!*'", $dblink), "Already done? OK!", 0); 419 test("Adding AdminPages page...", 420 mysql_query("insert into ".$config['table_prefix']."pages set tag = 'AdminPages', body = '{{checkversion}}\n{{adminpages}}\n\n----\nCategoryAdmin', owner = '(Public)', note='".$upgrade_note."', user = 'WikkaInstaller', time = now(), latest = 'Y'", $dblink), "Already done? OK!", 0); 421 test("Setting ACL for AdminPages...", 422 mysql_query("insert into ".$config['table_prefix']."acls set page_tag = 'AdminPages', read_acl = '!*', write_acl = '!*', comment_acl = '!*'", $dblink), "Already done? OK!", 0); 423 test("Archiving latest SysInfo revision...", 424 mysql_query("update ".$config["table_prefix"]."pages set latest = 'N' where tag = 'SysInfo'"), "Already done? OK!", 0); 425 test("Updating SysInfo page...", 426 mysql_query("insert into ".$config['table_prefix']."pages set tag = 'SysInfo', body = '{{checkversion}}\n===== System Information =====\n\n~-Wikka version: ##{{wikkaversion}}##\n~-PHP version: ##{{phpversion}}##\n~-\"\"MySQL\"\" version: ##{{mysqlversion}}##\n~-\"\"GeSHi\"\" version: ##{{geshiversion}}##\n~-Server:\n~~-Host: ##{{system show=\"host\"}}##\n~~-Operative System: ##{{system show=\"os\"}}##\n~~-Machine: ##{{system show=\"machine\"}}##\n\n{{wikkaconfig}}\n\n----\nCategoryWiki', owner = '(Public)', note='".$upgrade_note."', user = 'WikkaInstaller', time = now(), latest = 'Y'", $dblink), "Already done? OK!", 0); 427 test("Archiving latest WikiCategory revision...", 428 mysql_query("update ".$config["table_prefix"]."pages set latest = 'N' where tag = 'WikiCategory'"), "Already done? OK!", 0); 429 test("Updating WikiCategory page...", 430 mysql_query("insert into ".$config['table_prefix']."pages set tag = 'WikiCategory', body = '=====How to use categories=====\nThis wiki is using a very flexible but simple categorizing system to keep everything properly organized.\n\n====1. Adding a page to an existing category====\nTo \'\'add a page to an existing category\'\' simply add a link to the relevant category page. For example, to mark page ##\"\"MyPage\"\"## as a child of category ##\"\"MyCategory\"\"##, just add a link to ##\"\"MyCategory\"\"## from ##\"\"MyPage\"\"##. This will automatically add ##\"\"MyPage\"\"## to the list of pages belonging to that category. Category links are put by convention at the end of the page, but the position of these links does not affect their behavior.\n\n====2. Adding a subcategory to an existing category====\nTo \'\'create a hierarchy of categories\'\', you can follow the same instructions to add pages to categories. For example, to mark category ##\"\"Category2\"\"## as a child (or subcategory) of another category ##\"\"Category1\"\"##, just add a link to ##\"\"Category1\"\"## in ##\"\"Category2\"\"##. This will automatically add ##\"\"Category2\"\"## to the list of ##\"\"Category1\"\"##\'s children.\n\n====3. Creating new categories====\nTo \'\'start a new category\'\' just create a page containing ##\"\"{{category}}\"\"##. This will mark the page as a special //category page// and will output a list of pages belonging to the category. Category page names start by convention with the word ##Category## but you can also create categories without following this convention. To add a new category to the master list of categories just add a link from it to CategoryCategory.\n\n====4. Browsing categories====\nTo \'\'browse the categories\'\' available on your wiki you can start from CategoryCategory. If all pages and subcategories are properly linked as described above, you will be able to browse the whole hierarchy of categories starting from this page.\n\n----\nCategoryWiki', owner = '(Public)', note='".$upgrade_note."', user = 'WikkaInstaller', time = now(), latest = 'Y'", $dblink), "Already done? OK!", 0); 375 431 test("Adding status field to users table...", 376 432 mysql_query("alter table ".$config['table_prefix']."users add column status enum ('invited','signed-up','pending','active','suspended','banned','deleted')"), "Already done? OK!", 0); … … 379 435 test('Dropping obsolete index `from_tag`...', 380 436 mysql_query('alter table '.$config['table_prefix'].'links drop index `idx_from`'), 'Already done? OK!', 0); 381 update_default_page(array('HighScores', 'FormattingRules', 'WikiCategory', 'DatabaseInfo', 'SysInfo', 'AdminUsers', 'AdminPages'), $dblink, $config, $lang_defaults_path, $lang_defaults_fallback_path);382 test("Setting ACL for DatabaseInfo...",383 mysql_query("insert into ".$config['table_prefix']."acls set page_tag = 'DatabaseInfo', read_acl = '!*', write_acl = '!*', comment_acl = '!*'", $dblink), "Already done? OK!", 0);384 test("Setting ACL for AdminUsers...",385 mysql_query("insert into ".$config['table_prefix']."acls set page_tag = 'AdminUsers', read_acl = '!*', write_acl = '!*', comment_acl = '!*'", $dblink), "Already done? OK!", 0);386 test("Setting ACL for AdminPages...",387 mysql_query("insert into ".$config['table_prefix']."acls set page_tag = 'AdminPages', read_acl = '!*', write_acl = '!*', comment_acl = '!*'", $dblink), "Already done? OK!", 0);388 437 case "1.1.6.4": 389 438 case "1.1.6.5": 390 update_default_page('FormattingRules', $dblink, $config, $lang_defaults_path, $lang_defaults_fallback_path);391 @unlink('handlers'.DIRECTORY_SEPARATOR.'referrers_sites'.DIRECTORY_SEPARATOR.'referrers_sites.php');392 rmdirr('handlers'.DIRECTORY_SEPARATOR.'referrers_sites');393 439 case "1.1.6.6": 394 440 case "1.1.6.7": 395 441 case "1.2": 396 update_default_page(array('FormattingRules', 'TableMarkup', 'TableMarkupReference'), $dblink, $config, $lang_defaults_path, $lang_defaults_fallback_path);397 442 test(sprintf(ADDING_CONFIG_ENTRY, 'enable_user_host_lookup' ), 1); 398 443 $config['enable_user_host_lookup'] = '1'; 444 test("Archiving latest FormattingRules revision...", 445 mysql_query("update ".$config["table_prefix"]."pages set latest = 'N' where tag = 'FormattingRules'"), "Already done? OK!", 0); 446 test("Updating FormattingRules page...", 447 mysql_query("insert into ".$config['table_prefix']."pages set tag = 'FormattingRules', body = '======Wikka Formatting Guide======\n\n<<**Note:** Anything between 2 sets of double-quotes is not formatted.<<::c::\nOnce you have read through this, test your formatting skills in the SandBox.\n----\n===1. Text Formatting===\n\n~##\"\"**I\'m bold**\"\"##\n~**I\'m bold **\n\n~##\"\"//I\'m italic text!//\"\"##\n~//I\'m italic text!//\n\n~##\"\"And I\'m __underlined__!\"\"##\n~And I\'m __underlined__!\n\n~##\"\"##monospace text##\"\"##\n~##monospace text##\n\n~##\"\"\'\'highlight text\'\'\"\"## (using 2 single-quotes)\n~\'\'highlight text\'\'\n\n~##\"\"++Strike through text++\"\"##\n~++Strike through text++\n\n~##\"\"Press #%ANY KEY#%\"\"##\n~Press #%ANY KEY#%\n\n~##\"\"@@Center text@@\"\"##\n~@@Center text@@\n\n===2. Headers===\n\nUse between six ##=## (for the biggest header) and two ##=## (for the smallest header) on both sides of a text to render it as a header.\n\n~##\"\"====== Really big header ======\"\"##\n~====== Really big header ======\n \n~##\"\"===== Rather big header =====\"\"##\n~===== Rather big header =====\n\n~##\"\"==== Medium header ====\"\"##\n~==== Medium header ====\n\n~##\"\"=== Not-so-big header ===\"\"##\n~=== Not-so-big header ===\n\n~##\"\"== Smallish header ==\"\"##\n~== Smallish header ==\n\n===3. Horizontal separator===\n~##\"\"----\"\"##\n----\n\n===4. Forced line break===\n~##\"\"---\"\"##\n---\n\n===5. Lists and indents===\n\nYou can indent text using a **~**, a **tab** or **4 spaces** (which will auto-convert into a tab).\n\n##\"\"~This text is indented<br />~~This text is double-indented<br /> This text is also indented\"\"##\n\n~This text is indented\n~~This text is double-indented\n This text is also indented\n\nTo create bulleted/ordered lists, use the following markup (you can always use 4 spaces instead of a ##**~**##):\n\n**Bulleted lists**\n##\"\"~- Line one\"\"##\n##\"\"~- Line two\"\"##\n\n - Line one\n - Line two\n\n**Numbered lists**\n##\"\"~1) Line one\"\"##\n##\"\"~1) Line two\"\"##\n\n 1) Line one\n 1) Line two\n\n**Ordered lists using uppercase characters**\n##\"\"~A) Line one\"\"##\n##\"\"~A) Line two\"\"##\n\n A) Line one\n A) Line two\n\n**Ordered lists using lowercase characters**\n##\"\"~a) Line one\"\"##\n##\"\"~a) Line two\"\"##\n\n a) Line one\n a) Line two\n\n**Ordered lists using roman numerals**\n##\"\"~I) Line one\"\"##\n##\"\"~I) Line two\"\"##\n\n I) Line one\n I) Line two\n\n**Ordered lists using lowercase roman numerals**\n##\"\"~i) Line one\"\"##\n##\"\"~i) Line two\"\"##\n\n i) Line one\n i) Line two\n\n===6. Inline comments===\n\nTo format some text as an inline comment, use an indent ( **~**, a **tab** or **4 spaces**) followed by a **\"\"&\"\"**.\n\n**Example:**\n\n##\"\"~& Comment\"\"##\n##\"\"~~& Subcomment\"\"##\n##\"\"~~~& Subsubcomment\"\"##\n\n~& Comment\n~~& Subcomment\n~~~& Subsubcomment\n\n===7. Images===\n\nTo place images on a Wiki page, you can use the ##image## action.\n\n**Example:**\n\n~##\"\"{{image class=\"center\" alt=\"DVD logo\" title=\"An Image Link\" url=\"images/dvdvideo.gif\" link=\"RecentChanges\"}}\"\"##\n~{{image class=\"center\" alt=\"dvd logo\" title=\"An Image Link\" url=\"images/dvdvideo.gif\" link=\"RecentChanges\"}}\n\nLinks can be external, or internal Wiki links. You don\'t need to enter a link at all, and in that case just an image will be inserted. You can use the optional classes ##left## and ##right## to float images left and right. You don\'t need to use all those attributes, only ##url## is required while ##alt## is recommended for accessibility.\n\n===8. Links===\n\nTo create a **link to a wiki page** you can use any of the following options: ---\n~1) type a ##\"\"WikiName\"\"##: --- --- ##\"\"FormattingRules\"\"## --- FormattingRules --- ---\n~1) add a forced link surrounding the page name by ##\"\"[[\"\"## and ##\"\"]]\"\"## (everything after the first space will be shown as description): --- --- ##\"\"[[SandBox Test your formatting skills]]\"\"## --- [[SandBox Test your formatting skills]] --- --- ##\"\"[[SandBox 沙箱]]\"\"## --- [[SandBox 沙箱]] --- ---\n~1) add an image with a link (see instructions above).\n\nTo **link to external pages**, you can do any of the following: ---\n~1) type a URL inside the page: --- --- ##\"\"http://www.example.com\"\"## --- http://www.example.com --- --- \n~1) add a forced link surrounding the URL by ##\"\"[[\"\"## and ##\"\"]]\"\"## (everything after the first space will be shown as description): --- --- ##\"\"[[http://example.com/jenna/ Jenna\'s Home Page]]\"\"## --- [[http://example.com/jenna/ Jenna\'s Home Page]] --- --- ##\"\"[[mail@example.com Write me!]]\"\"## --- [[mail@example.com Write me!]] --- ---\n~1) add an image with a link (see instructions above);\n~1) add an interwiki link (browse the [[InterWiki list of available interwiki tags]]): --- --- ##\"\"WikiPedia:WikkaWiki\"\"## --- WikiPedia:WikkaWiki --- --- ##\"\"Google:CSS\"\"## --- Google:CSS --- --- ##\"\"Thesaurus:Happy\"\"## --- Thesaurus:Happy --- ---\n\n===9. Tables===\n\n<<The ##table## action has been deprecated as of Wikka version 1.2 and has been replaced with the syntax that follows. Please visit the [[Docs:TableActionInfo Wikka documentation server]] for information about the older ##table## action.<<::c::\nTables can be created using two pipe (##\"\"||\"\"##) symbols. Everything in a single line is rendered as a table row.\n\n**Example:**\n\n##\"\"||Cell 1||Cell 2||\"\"##\n\n||Cell 1||Cell 2||\n\nHeader cells can be rendered by placing an equals sign between the pipes.\n\n**Example:**\n\n##\"\"|=|Header 1|=|Header 2||\"\"##\n##\"\"||Cell 1||Cell 2||\"\"##\n\n|=|Header 1|=|Header 2||\n||Cell 1||Cell 2||\n\nRow and column spans are specified with ##x:## and ##y:## in parentheses just after the pipes.\n\n**Example:**\n\n##\"\"|=| |=|(x:2)Columns||\"\"##\n##\"\"|=|(y:2) Rows||Cell 1||Cell 2||\"\"##\n##\"\"||Cell 3||Cell 4||\"\"##\n\n|=| |=|(x:2)Columns||\n|=|(y:2) Rows||Cell 1||Cell 2||\n||Cell 3||Cell 4||\n\nMany additional features are available using table markup. A more comprehensive table markup guide is available on this server\'s TableMarkup page. A complete syntax reference is available on this server\'s TableMarkupReference page.\n\n===10. Colored Text===\n\nColored text can be created using the ##color## action:\n\n**Example:**\n\n~##\"\"{{color c=\"blue\" text=\"This is a test.\"}}\"\"##\n~{{color c=\"blue\" text=\"This is a test.\"}}\n\nYou can also use hex values:\n\n**Example:**\n\n~##\"\"{{color hex=\"#DD0000\" text=\"This is another test.\"}}\"\"##\n~{{color hex=\"#DD0000\" text=\"This is another test.\"}}\n\nAlternatively, you can specify a foreground and background color using the ##fg## and ##bg## parameters (they accept both named and hex values):\n\n**Examples:**\n\n~##\"\"{{color fg=\"#FF0000\" bg=\"#000000\" text=\"This is colored text on colored background\"}}\"\"##\n~{{color fg=\"#FF0000\" bg=\"#000000\" text=\"This is colored text on colored background\"}}\n\n~##\"\"{{color fg=\"yellow\" bg=\"black\" text=\"This is colored text on colored background\"}}\"\"##\n~{{color fg=\"yellow\" bg=\"black\" text=\"This is colored text on colored background\"}}\n\n\n===11. Floats===\n\nTo create a **left floated box**, use two ##<## characters before and after the block.\n\n**Example:**\n\n~##\"\"<<Some text in a left-floated box hanging around<< Some more text as a filler. Some more text as a filler. Some more text as a filler. Some more text as a filler. Some more text as a filler. Some more text as a filler. Some more text as a filler. Some more text as a filler.\"\"##\n\n<<Some text in a left-floated box hanging around<<Some more text as a filler. Some more text as a filler. Some more text as a filler. Some more text as a filler. Some more text as a filler. Some more text as a filler. Some more text as a filler. Some more text as a filler.\n\n::c::To create a **right floated box**, use two ##>## characters before and after the block.\n\n**Example:**\n\n~##\"\">>Some text in a right-floated box hanging around>> Some more text as a filler. Some more text as a filler. Some more text as a filler. Some more text as a filler. Some more text as a filler. Some more text as a filler. Some more text as a filler. Some more text as a filler.\"\"##\n\n >>Some text in a right-floated box hanging around>>Some more text as a filler. Some more text as a filler. Some more text as a filler. Some more text as a filler. Some more text as a filler. Some more text as a filler. Some more text as a filler. Some more text as a filler.\n\n::c:: Use ##\"\"::c::\"\"## to clear floated blocks.\n\n===12. Code formatters===\n\nYou can easily embed code blocks in a wiki page using a simple markup. Anything within a code block is displayed literally. \nTo create a **generic code block** you can use the following markup:\n\n~##\"\"%% This is a code block %%\"\"##. \n\n%% This is a code block %%\n\nTo create a **code block with syntax highlighting**, you need to specify a //code formatter// (see below for a list of available code formatters). \n\n~##\"\"%%(\"\"{{color c=\"red\" text=\"php\"}}\"\")<br /><?php<br />echo \"Hello, World!\";<br />?><br />%%\"\"##\n\n%%(php)\n<?php\necho \"Hello, World!\";\n?>\n%%\n\nYou can also specify an optional //starting line// number.\n\n~##\"\"%%(php;\"\"{{color c=\"red\" text=\"15\"}}\"\")<br /><?php<br />echo \"Hello, World!\";<br />?><br />%%\"\"##\n\n%%(php;15)\n<?php\necho \"Hello, World!\";\n?>\n%%\n\nIf you specify a //filename//, this will be used for downloading the code.\n\n~##\"\"%%(php;15;\"\"{{color c=\"red\" text=\"test.php\"}}\"\")<br /><?php<br />echo \"Hello, World!\";<br />?><br />%%\"\"##\n\n%%(php;15;test.php)\n<?php\necho \"Hello, World!\";\n?>\n%%\n\n**List of available code formatters:**\n{{table columns=\"6\" cellpadding=\"1\" cells=\"LANGUAGE;FORMATTER;LANGUAGE;FORMATTER;LANGUAGE;FORMATTER;ABAP;abap;Actionscript;actionscript;ADA;ada;Apache Log;apache;AppleScript; applescript;ASM;asm;ASP;asp;AutoIT;autoit;Axapta/Dynamics Ax X++;xpp;Bash;bash;BlitzBasic;blitzbasic;BNF;bnf;C;c;C for Macs;c_mac;c#;csharp;C++;cpp;C++ (QT extensions);cpp-qt;CAD DCL;caddcl;CadLisp;cadlisp;CFDG;cfdg;ColdFusion;cfm; CSS;css;D;d;Delphi;delphi;Diff-Output;diff;DIV; div;DOS;dos;dot;dot;Eiffel;eiffel;Fortran;fortran;FOURJ\'s Genero 4GL;genero;FreeBasic;freebasic;GML;gml;Groovy;groovy;Haskell;haskell;HTML;html4strict;INI;ini;IO;io;Inno Script;inno;Java 5;java5;Java;java;Javascript;javascript;LaTeX;latex;Lisp;lisp;Lua;lua;Matlab;matlab;Microchip Assembler;mpasm;Microsoft Registry;reg;mIRC;mirc;Motorola 68000 Assembler;m68k;MySQL;mysql;NSIS;nsis;Objective C;objc;OpenOffice BASIC;oobas;Objective Caml;ocaml;Objective Caml (brief);ocaml-brief;Oracle 8;oracle8;Pascal;pascal;Per (forms);per;Perl;perl;PHP;php;PHP (brief);php-brief;PL/SQL;plsql;Python;phyton;Q(uick)BASIC;qbasic;robots.txt;robots;Ruby;ruby;Ruby on Rails;rails;SAS;sas;Scheme;scheme;sdlBasic;sdlbasic;SmallTalk;smalltalk;Smarty;smarty;SQL;sql;TCL/iTCL;tcl;T-SQL;tsql;Text;text;thinBasic;thinbasic;Unoidl;idl;VB.NET;vbnet;VHDL;vhdl;Visual BASIC;vb;Visual Fox Pro;visualfoxpro;WinBatch;winbatch;XML;xml;ZiLOG Z80;z80;###\"}}\n\n===13. Mindmaps===\n\nWikka has native support for [[Docs:FreeMind mindmaps]]. There are two options for embedding a mindmap in a wiki page.\n\n**Option 1:** Upload a \"\"FreeMind\"\" file to a webserver, and then place a link to it on a wikka page:\n ##\"\"http://yourdomain.com/freemind/freemind.mm\"\"##\nNo special formatting is necessary.\n\n**Option 2:** Paste the \"\"FreeMind\"\" data directly into a wikka page:\n~- Open a \"\"FreeMind\"\" file with a text editor.\n~- Select all, and copy the data.\n~- Browse to your Wikka site and paste the Freemind data into a page. \n\n===14. Embedded HTML===\n\nYou can easily paste HTML in a wiki page by wrapping it into two sets of doublequotes. \n\n~##""[html code]""##\n\n**Examples:**\n\n~##""y = x<sup>n+1</sup>""##\n~\"\"y = x<sup>n+1</sup>\"\"\n\n~##""<acronym title=\"Cascade Style Sheet\">CSS</acronym>""##\n~\"\"<acronym title=\"Cascade Style Sheet\">CSS</acronym>\"\"\n\nBy default, some HTML tags are removed by the \"\"SafeHTML\"\" parser to protect against potentially dangerous code. The list of tags that are stripped can be found on the [[Docs:SafeHTML SafeHTML]] documentation page.\n\nIt is possible to allow //all// HTML tags to be used, see Docs:UsingHTML for more information.\n\n----\nCategoryWiki', owner = '(Public)', user = 'WikkaInstaller', note='".$upgrade_note."', time = now(), latest = 'Y'", $dblink), "Already done? OK!", 0); 448 test("Adding TableMarkup page...", 449 mysql_query("insert into ".$config['table_prefix']."pages set tag = 'TableMarkup', body = '======Wikka Table Markup Guide======\n>>==See also:==\n~-For earlier Wikka versions, check the [[Docs:TableActionInfo table]] action\n~-Updated versions of this page can be found on the [[Docs:TableMarkup Wikka documentation server]] \n~-For a more formal description, check this server\'s TableMarkupReference page.\n>>\nAs of ##1.2##, Wikka introduces a flexible markup for data tables. Any kind of tables allowed by XHTML can be created using this markup, from the most basic examples (e.g. simple rows of cells) to complex tables with full support for accessibility options.::c::\n\n====1. Table basics: cells, rows, columns====\n\nThe most basic element of a table is a **cell**. Single cells can be created using the standard delimiter ##\"\"||\"\"##, e.g.:\n\n##\"\"||Hello||\"\"##\n\n||Hello||\n\nNote that a cell must always be open and closed by delimiters. \n\n**Rows** can be created by adding on the same line multiple cells:\n\n##\"\"||Cell 1||Cell 2||Cell 3||\"\"##\n\n||Cell 1||Cell 2||Cell 3||\n\n**Columns** can be created by adding rows on separate lines:\n\n##\"\"||Cell 1||\"\"##\n##\"\"||Cell 2||\"\"##\n##\"\"||Cell 3||\"\"##\n\n||Cell 1||\n||Cell 2||\n||Cell 3||\n\nBy now you should be able to create simple tables with **multiple rows and columns**.\n\n##\"\"||Cell 1||Cell 2||Cell 3||\"\"##\n##\"\"||Cell 4||Cell 5||Cell 6||\"\"##\n##\"\"||Cell 7||Cell 8||Cell 9||\"\"##\n\n||Cell 1||Cell 2||Cell 3||\n||Cell 4||Cell 5||Cell 6||\n||Cell 7||Cell 8||Cell 9||\n\n====2. Headings====\n\nAs soon as you create slightly more complex data tables, you will need to specify column and row **headings**. Headings are special cells that specify what kind of data rows and columns contain. The most basic way of creating a heading is by using ##\"\"|=|\"\"## as a delimiter.\n\nThe following is an example of a simple table with **column headings**:\n\n##\"\"|=|Apples|=|Pears|=|\"\"##\n##\"\"||300Kg||480Kg||\"\"##\n\n|=|Apples|=|Pears|=|\n||300Kg||480Kg||\n\n**Row headings** are created in the same way. Since they are usually followed by normal cells, they must be terminated with the ##\"\"||\"\"## standard delimiter if the next element in the row is a simple cell:\n\n##\"\"|=|Apples||300Kg||\"\"##\n##\"\"|=|Pears||480Kg||\"\"##\n\n|=|Apples||300Kg||\n|=|Pears||480Kg||\n\nYou should be able by now to create simple tables with row and column headings:\n\n##\"\"|=| |=|Apples|=|Pears|=|\"\"##\n##\"\"|=|Mary||300Kg||320Kg||\"\"##\n##\"\"|=|John||400Kg||630Kg||\"\"##\n\n|=| |=|Apples|=|Pears|=|\n|=|Mary||300Kg||320Kg||\n|=|John||400Kg||630Kg||\n\nWe will describe later how to add accessibility parameters for row and column headings.\n\n====3. Captions====\n\nUsually tables are introduced with a caption that describes what the table contains. A caption element is introduced with a ##\"\"|?|\"\"## delimiter and terminated with a standard delimiter ##\"\"||\"\"##.\n\n##\"\"|?|Fruit production in 2006||\"\"##\n##\"\"|=| |=|Apples|=|Pears|=|\"\"##\n##\"\"|=|Mary||300Kg||320Kg||\"\"##\n##\"\"|=|John||400Kg||630Kg||\"\"##\n\n|?|Fruit production in 2006||\n|=| |=|Apples|=|Pears|=|\n|=|Mary||300Kg||320Kg||\n|=|John||400Kg||630Kg||\n\n====4. Spans====\n\n**Spans** are used to combine multiple cells or multiple headings vertically or horizontally and are created using the following [[TableMarkupReference attribute parameters]]:\n\n##\"\"||\"\"(\'\'span options\'\')Element content\"\"||\"\"##\n\nA **cell spanning multiple columns** is generated by prefixing the cell content with a ##(x:\'\'n\'\')## parameter, where ##\'\'n\'\'## is the number of columns to be spanned. The following example shows how to create a cell spanning two columns:\n\n##\"\"||(x:2)Cell spanning 2 columns||Cell 3||\"\"##\n##\"\"||Cell 4||Cell 5||Cell 6||\"\"##\n##\"\"||Cell 7||Cell 8||Cell 9||\"\"##\n\n||(x:2)Cell spanning 2 columns||Cell 3||\n||Cell 4||Cell 5||Cell 6||\n||Cell 7||Cell 8||Cell 9||\n\nSpans can also be applied to rows. A **cell spanning multiple rows** is generated by prefixing the cell content with a ##(y:\'\'n\'\')## parameter, where ##\'\'n\'\'## is the number of rows to be spanned. The following example shows how to create a cell spanning two rows:\n\n##\"\"||(y:2)Cell spanning 2 rows||Cell 2||Cell 3||\"\"##\n##\"\"||Cell 5||Cell 6||\"\"##\n##\"\"||Cell 7||Cell 8||Cell 9||\"\"##\n\n||(y:2)Cell spanning 2 rows||Cell 2||Cell 3||\n||Cell 5||Cell 6||\n||Cell 7||Cell 8||Cell 9||\n\nSpans are particularly useful to create **subheadings**:\n\n##\"\"|?|Fruit production in the last two years||\"\"##\n##\"\"|=| |=|(x:2)Apples|=|(x:2)Pears|=|\"\"##\n##\"\"|=| |=|2005|=|2006|=|2005|=|2006|=|\"\"##\n##\"\"|=|Mary||300Kg||320Kg||400kg||280Kg||\"\"##\n##\"\"|=|John||400Kg||630Kg||210Kg||300Kg||\"\"##\n\n|?|Fruit production in the last two years||\n|=| |=|(x:2)Apples|=|(x:2)Pears|=|\n|=| |=|2005|=|2006|=|2005|=|2006|=|\n|=|Mary||300Kg||320Kg||400kg||280Kg||\n|=|John||400Kg||630Kg||210Kg||300Kg||\n\nColumn and row spans can be combined to created funky table layouts:\n\n##\"\"||(x:2;y:2)2x2||(x:2)2x1||(y:2)1x2||\"\"##\n##\"\"||(y:2)1x2||1x1||\"\"##\n##\"\"||1x1||1x1||(x:2)2x1||\"\"##\n\n||(x:2;y:2)2x2||(x:2)2x1||(y:2)1x2||\n||(y:2)1x2||1x1||\n||1x1||1x1||(x:2)2x1||\n\n\n====5. Formatting text within tables====\n\nYou can use any kind of basic [[TextFormatting Wikka markup]] to render text within tables.\nThe following example adds basic formatting to cell content:\n\n##\"\"|?|Using text formatting within tables||\"\"##\n##\"\"||##Monospaced##||//Italics//||**Bold**||__Underlined__||\"\"##\n##\"\"||\'\'Highlighted\'\'||++Strikethrough++||(x:2)**//Bold italics//**||\"\"##\n\n|?|Using text formatting within tables||\n||##Monospaced##||//Italics//||**Bold**||__Underlined__||\n||\'\'Highlighted\'\'||++Strikethrough++||(x:2)**//Bold italics//**||\n\n====6. Adding actions and images within tables====\n\nSimple, content-generating [[Docs:UsingActions actions]] (including [[Docs:AddingImages images]]) can be added within table cells and headings.\n\n##\"\"|?|Using actions within tables||\"\"##\n##\"\"||This wiki contains {{countpages}} pages||\"\"##\n##\"\"||{{image url=\"images/wikka_logo.jpg\" class=\"center\" alt=\"a w\" title=\"w image\"}}||\"\"##\n##\"\"||{{color c=\"red\" text=\"some colored text\"}}||\"\"##\n\n|?|Using actions within tables||\n||This wiki contains {{countpages}} pages||\n||{{image url=\"images/wikka_logo.jpg\" class=\"center\" alt=\"a w\" title=\"w image\"}}||\n||{{color c=\"red\" text=\"some colored text\"}}||\n\n====7. Adding links within tables====\n\nAll the available options to create [[Docs:AddingLinks links]] can be used within table cells or headings:\n\n##\"\"|?|Adding links within tables||\"\"##\n##\"\"||Camelcase links: SandBox||\"\"##\n##\"\"||Escaped camelcase links: ""SandBox"" escaped||\"\"##\n##\"\"||Forced links: [[HomePage main]]||\"\"##\n##\"\"||Interwiki links: Wikipedia:Wikka||\"\"##\n##\"\"||Forced interwiki links: [[Wikipedia:Wikka Wikka article on Wikipedia]]||\"\"##\n##\"\"||External links: http://www.example.com ||\"\"##\n##\"\"||Forced external links: [[http://www.example.com Example.com]]||\"\"##\n##\"\"||Image links: {{image url=\"images/wizard.gif\" alt=\"wizard\" title=\"Display an index of pages on this wiki\" link=\"PageIndex\"}}||\"\"##\n\n|?|Adding links within tables||\n||Camelcase links: SandBox||\n||Escaped camelcase links: \"\"SandBox escaped\"\"||\n||Forced links: [[HomePage main]]||\n||Interwiki links: Wikipedia:Wikka||\n||Forced interwiki links: [[Wikipedia:Wikka Wikka article on Wikipedia]]||\n||External links: http://www.example.com ||\n||Forced external links: [[http://www.example.com Example.com]]||\n||Image links: {{image url=\"images/wizard.gif\" alt=\"wizard\" title=\"Display an index of pages on this wiki\" link=\"PageIndex\"}}||\n\n====8. Adding HTML within tables====\n\nYou can also use [[Docs:UsingHTML embedded HTML]] in table elements:\n\n##\"\"|?|Embedding HTML within tables||\"\"##\n##\"\"||Here\'s some superscript: ""a<sup>2+1</sup>""||\"\"##\n##\"\"||And here\'s some subscript too: ""a<sub>2k</sub>""||\"\"##\n##\"\"||I love acronyms: ""<acronym title=\"What You See Is What You Get\">WYSIWYG</acronym>""||\"\"##\n\n|?|Embedding HTML within tables||\n||Here\'s some superscript: \"\"a<sup>2+1</sup>\"\"||\n||And here\'s some subscript too: \"\"a<sub>2k</sub>\"\"||\n||I love acronyms: \"\"<acronym title=\"What You See Is What You Get\">WYSIWYG</acronym>\"\"||\n\n====9. Adding a touch of style====\n\nThe table markup introduces a new [[TableMarkupReference style selector]]. CSS style options can be added to any element by enclosing them within **single braces**, right before the element content, e.g.:\n##\"\"||\"\"{\'\'style options\'\'}Element content\"\"||\"\"##\n\nFor example, to render a cell with **red background** and **white text color**, you can do the following:\n\n##\"\"||{background-color:red; color:white}Hello||\"\"##\n\n||{background-color:red; color:white}Hello||\n\nYou can play with **font size** and **text alignment**:\n\n##\"\"|?|Adding some more style||\"\"##\n##\"\"||{font-size:190%; text-align:right}Please scale me!||\"\"##\n##\"\"||{font-size:170%; text-align:right}Please scale me!||\"\"##\n##\"\"||{font-size:150%; text-align:right}Please scale me!||\"\"##\n##\"\"||{font-size:130%; text-align:right}Please scale me!||\"\"##\n##\"\"||{font-size:110%; text-align:right}Please scale me!||\"\"##\n##\"\"||{font-size:90%; text-align:right}Please scale me!||\"\"##\n##\"\"||{font-size:70%; text-align:right}Please scale me!||\"\"##\n\n|?|Adding some more style||\n||{font-size:190%; text-align:right}Please scale me!||\n||{font-size:170%; text-align:right}Please scale me!||\n||{font-size:150%; text-align:right}Please scale me!||\n||{font-size:130%; text-align:right}Please scale me!||\n||{font-size:110%; text-align:right}Please scale me!||\n||{font-size:90%; text-align:right}Please scale me!||\n||{font-size:70%; text-align:right}Please scale me!||\n\nYou can also apply style to **headings** and **captions**:\n\n##\"\"|?|{border:1px dotted red; color:red}Style can be applied anywhere||\"\"##\n##\"\"|=|{color:#000; font-size:150%; font-style:italic; font-family:Georgia, Hoefler Text, Georgia, serif; font-weight:normal; line-height:150%}Emphemeral Quibus|=|\"\"##\n##\"\"||Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Duis auctor auctor pede.||\"\"##\n\n|?|{border:1px dotted red; color:red}Style can be applied anywhere||\n|=|{color:#000; font-size:150%; font-style:italic; font-family:Georgia, Hoefler Text, Georgia, serif; font-weight:normal; line-height:150%}Emphemeral Quibus|=|\n||Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Duis auctor auctor pede.||\n\nPlease note that **style parameters should always follow attribute parameters**, when both are specified for an element (see the [[TableMarkupReference table markup reference]]):\n\n##\"\"|?|Give priority||\"\"##\n##\"\"||(x:2;y:2){background-color:pink}2x2||(x:2){background-color:lightblue}2x1||(y:2){background-color:lightyellow}1x2||\"\"##\n##\"\"||(y:2){background-color:lightyellow}1x2||{background-color:#333;color:white}1x1||\"\"##\n##\"\"||{background-color:lightblue}1x1||{background-color:#333;color:white}1x1||(x:2){background-color:pink}2x1||\"\"##\n\n|?|Give priority||\n||(x:2;y:2){background-color:pink}2x2||(x:2){background-color:lightblue}2x1||(y:2){background-color:lightyellow}1x2||\n||(y:2){background-color:lightyellow}1x2||{background-color:#333;color:white}1x1||\n||{background-color:lightblue}1x1||{background-color:#333;color:white}1x1||(x:2){background-color:pink}2x1||\n\n====10. Adding style through classes====\n\nYou can apply existing classes from your stylesheet to any element using the class parameter ##(c:\'\'class\'\')##. Note that custom style declarations specified through braced markup override class attributes.\n\nThe following example applies to table cells two class selectors defined in the stylesheet. The third row shows how to override a class selector with custom style attributes:\n\n##\"\"|?|Using class selectors to add style to table elements||\"\"##\n##\"\"||(c:highlight)This cell uses the ##.highlight## class||\"\"##\n##\"\"||(c:smaller)This cell uses the ##.smaller## class||\"\"##\n##\"\"||(c:smaller){font-size:150%}This cell uses the ##.smaller## class overridden by custom style settings||\"\"##\n\n|?|Using class selectors to add style to table elements||\n||(c:highlight)This cell uses the ##.highlight## class||\n||(c:smaller)This cell uses the ##.smaller## class||\n||(c:smaller){font-size:150%}This cell uses a ##.smaller## class overridden by custom style settings||\n\n====11. Global table attributes====\n\nTable-level attributes can be specified by adding at the beginning of the table the following element: ##\"\"|!| ||\"\"##, which is used as a container for global table attributes. For example, you can specify **global style options** for a table by adding them to this element:\n\n##\"\"|!|{border:3px solid blue; background-color: black; color: white; width: 300px; text-align: center}||\"\"##\n##\"\"||Cell 1||\"\"##\n##\"\"||Cell 2||\"\"##\n##\"\"||Cell 3||\"\"##\n\n|!|{border:3px solid blue; background-color: black; color: white; width: 300px; text-align: center}||\n||Cell 1||\n||Cell 2||\n||Cell 3||\n\n====12. Referring to elements: the ##id## attribute====\n\n##id## attributes are used to refer to unique elements in a page and to provide an anchor for styling and linking. You can specify an ##id## for any table element by using the ##(i:\'\'id\'\')## parameter.\n\nFor example, the following markup creates a table with the ##id## \"main_table\" containing two cells with ##id##\'s \"cell_1\" and \"cell_2\"\n\n##\"\"|!|(i:main_table)||\"\"##\n##\"\"|?|Using id to refer to table elements||\"\"##\n##\"\"||(i:cell_1)This cell can be referred to by using the ##cell_1## id||\"\"##\n##\"\"||(i:cell_2)This cell can be referred to by using the ##cell_2## id||\"\"##\n\n|!|(i:main_table)||\n|?|Using id to refer to table elements||\n||(i:cell_1)This cell can be referred to by using the ##cell_1## id||\n||(i:cell_2)This cell can be referred to by using the ##cell_2## id||\n\n====13. Accessibility options: adding titles====\n\nAny table element can be given a ##title## attribute to enhance its accessibility. Titles are typically displayed in graphical browsers by hovering over the corresponding element and are useful to display unobtrusive descriptions about specific elements. You can specify a ##title## for any table element by using the ##(t:\'\'title\'\')## parameter.\n\nThe following example adds titles to several table elements (you can hover over the table to display them):\n\n##\"\"|!|(t:Comparative figures for fruit production in the last year){width: 350px}||\"\"##\n##\"\"|?|Fruit production in 2006||\"\"##\n##\"\"|=| |=|(t:yearly production of apples)Apples|=|(t:yearly production of pears)Pears|=|\"\"##\n##\"\"|=|(t:Mary\'s contribution to 2006 production)Mary||(t:Mary\'s production of apples in 2006){text-align:center}300Kg||(t:Mary\'s production of pears in 2006){text-align:center}320Kg||\"\"##\n##\"\"|=|(t:John\'s contribution to 2006 production)John||(t:John\'s production of apples in 2006){text-align:center}400Kg||(t:John\'s production of pears in 2006){text-align:center}630Kg||\"\"##\n\n|!|(t:Comparative figures for fruit production in the last year){width: 350px}||\n|?|Fruit production in 2006||\n|=| |=|(t:yearly production of apples)Apples|=|(t:yearly production of pears)Pears|=|\n|=|(t:Mary\'s contribution to 2006 production)Mary||(t:Mary\'s production of apples in 2006){text-align:center}300Kg||(t:Mary\'s production of pears in 2006){text-align:center}320Kg||\n|=|(t:John\'s contribution to 2006 production)John||(t:John\'s production of apples in 2006){text-align:center}400Kg||(t:John\'s production of pears in 2006){text-align:center}630Kg||\n\n====14. Accessibility options: adding a summary====\n\nTables can take an optional ##summary## attribute to describe the purpose and/or structure of the table. The description provided by the summary attribute is particularly helpful to users of non-visual browsers. You can specify a summary by adding a ##(u:\'\'Summary\'\')## parameter in the table global attributes.\n\nFor example, the following line:\n##\"\"|!|(u:This is a summary)||\"\"##\nwill add to the table a ##summary## attribute with the value ##This is a summary##.\n\n====15. Accessibility options: table head, table body and table foot====\n\nRows in a table can be grouped in a table head, table body and table foot. This division enables browsers to support scrolling of table bodies independently of the table head and foot. When long tables are printed, the table head and foot information may be repeated on each page that contains table data. The table head and table foot should contain information about the table\'s columns. The table body should contain rows of table data.\n\nWikka allows you to create groups of rows with special markers:\n~- The ##\"\"|[|\"\"## marker groups the rows it precedes as a **table head** block;\n~- The ##\"\"|]|\"\"## marker groups the rows it precedes as a **table foot** block;\n~- The ##\"\"|#|\"\"## marker groups the rows it precedes as a **table body**;\n\nThe following example shows how to use these elements to create row groups. Note that Wikka uses different backgrounds to differentiate column headings in the table head and foot from row headings in the table body:\n\n##\"\"|!|(u:A table with summary, caption, head, foot and body){width: 400px}||\"\"##\n##\"\"|?|Here\'s how you can group rows||\"\"##\n##\"\"|[|\"\"##\n##\"\"|=|Name|=|Place|=|Telephone||\"\"##\n##\"\"|]|\"\"##\n##\"\"|=|Name|=|Place|=|Telephone||\"\"##\n##\"\"|#|\"\"##\n##\"\"|=|John Smith||New York||555-1234||\"\"##\n##\"\"|=|Jane Smith||Los Angeles||555-2345||\"\"##\n##\"\"|=|John Doe||Unknown||Unknown||\"\"##\n##\"\"|=|Jane Doe||Unknown||Unknown||\"\"##\n\n|!|(u:A table with summary, caption, head, foot and body){width: 400px}||\n|?|Here\'s how you can group rows||\n|[|\n|=|Name|=|Place|=|Telephone||\n|]|\n|=|Name|=|Place|=|Telephone||\n|#|\n|=|John Smith||New York||555-1234||\n|=|Jane Smith||Los Angeles||555-2345||\n|=|John Doe||Unknown||Unknown||\n|=|Jane Doe||Unknown||Unknown||\n\n====16. Accessibility options: heading scope====\n\nTo be semantically correct and accessible to users with non-visual browsers, headings should contain scope attributes describing the cell range they refer to. \n~-Column heading scopes can be specified using the ##(o:col)## parameter in the corresponding column heading;\n~-Row heading scopes can be specified using the ##(o:row)## parameter in the corresponding row heading;\n\nThe following example shows how to correctly add column and row scopes to a table to make it accessible:\n\n##\"\"|!|(u:The number of employees and the foundation year of some imaginary companies.)||\"\"##\n##\"\"|?|Table 1: Company data||\"\"##\n##\"\"|[|\"\"##\n##\"\"|||=|(o:col)Employees|=|(o:col)Founded||\"\"##\n##\"\"|#|\"\"##\n##\"\"|=|(o:row)ACME Inc||1000||1947||\"\"##\n##\"\"|=|(o:row)XYZ Corp||2000||1973||\"\"##\n\n|!|(u:The number of employees and the foundation year of some imaginary companies.)||\n|?|Table 1: Company data||\n|[|\n|||=|(o:col)Employees|=|(o:col)Founded||\n|#|\n|=|(o:row)ACME Inc||1000||1947||\n|=|(o:row)XYZ Corp||2000||1973||\n\n\n----\nCategoryWiki', owner = '(Public)', note='".$upgrade_note."', user = 'WikkaInstaller', time = now(), latest = 'Y'", $dblink), 'Already done? OK!', 0); 450 test("Adding TableMarkupReference page...", 451 mysql_query("insert into ".$config['table_prefix']."pages set tag = 'TableMarkupReference', body = '=====Wikka Table Markup Reference=====\n>>==See also:==\n~-For an informal introduction to this markup and several examples consult this server\'s TableMarkup page.\n~-Updated versions of this page can be found on the [[Docs:TableMarkupReference Wikka documentation server]].\n>>\n==== 1. Table Markup Scheme ====\n\nThe generic markup for table elements follows this scheme:\n\n~**##{{color fg=\"#F00\" text=\"|*|\"}}{{color fg=\"blue\" text=\"(attribute parameters)\"}}{{color fg=\"green\" text=\"{style parameters}\"}}content{{color fg=\"#F00\" text=\"||\"}}##**\n\n==Example:==\n\n~##\"\"|=|(i:main_heading){text-size: 120%}This is the main heading||\"\"##\n\n===Understanding the Table Markup Scheme===\n\n~1)**Opening delimiter** --- **##{{color fg=\"#F00\" text=\"|*|\"}}##** is any of the delimiters described in the //elements table// below.\n~1)**Attributes** --- **##{{color fg=\"blue\" text=\"(attribute parameters)\"}}##** is an optional series of ##parameter:value## declarations enclosed in brackets. Valid parameters are described in the //attribute table// below. Multiple parameter declarations can be separated with a semicolon (**##;##**).\n~1)**Style** --- **##{{color fg=\"green\" text=\"{style parameters}\"}}##** is an optional series of CSS style declarations enclosed in braces. Multiple style declarations can be separated with a semicolon (**##;##**).\n~1)**Content** --- **##content##** can be any valid content for that element (including [[TextFormatting formatted text]]).\n~1)**Closing delimiter** --- **##{{color fg=\"#F00\" text=\"||\"}}##** is the standard delimiter.\n\n==Note:==\nSome elements are //self closing// and do not accept any attributes, style parameters or content. See the notes in the //elements table// below.\n\n==== 2. Elements ====\n\n|!|{width: 80%}||\n|?|Table Elements||\n|=|\"\"XHTML Elements\"\"|=|Delimiter|=|Notes||\n||##<table>##||##\"\"|!|\"\"##||Optional, only useful for adding attributes. **Must** be first in table markup if used. Should be on a line by itself.||\n||##<caption>##||##\"\"|?|\"\"##||||\n||##<colgroup>##||##\"\"|_|\"\"##||||\n||##<col />##||##\"\"|-|\"\"##||Selfclosing - must not be closed!||\n||##<thead>##||##\"\"|[|\"\"##||||\n||##<tfoot>##||##\"\"|]|\"\"##||||\n||##<tbody>##||##\"\"|#|\"\"##||||\n||##<tr>##||none||Will be opened for each row of table cells.||\n||##<th>##||##\"\"|=|\"\"##||||\n||##<td>##||##\"\"||\"\"##||||\n\n==== 3. Attributes ====\n\n|?|Table Attributes||\n|[|\n|=|Attribute|=|Markup key||\n|]|\n|=|Attribute|=|Markup key||\n|#|\n|=|(x:2)Core||\n||##id##||##i##||\n||##title##||##t##||\n||##class##||##c##||\n||##style##||##s##||\n|=|(x:2)i18n||\n||##xml:lang##||##l##||\n||##dir##||##d##||\n|=|(x:2)Table cells||\n||##colspan##||##x##||\n||##rowspan##||##y##||\n||##scope##||##o##||\n||##headers##||##h##||\n||##abbr##||##a##||\n||##axis##||##z##||\n|=|(x:2)Other Table elements||\n||##span##||##p##||\n||##summary##||##u##||\n\n\n----\nCategoryWiki', owner = '(Public)', note='".$upgrade_note."', user = 'WikkaInstaller', time = now(), latest = 'Y'", $dblink), 'Already done? OK!', 0); 399 452 test("Adding theme field to user preference table...", 400 453 @mysql_query("ALTER TABLE ".$config['table_prefix']."users ADD theme varchar(50) default ''", $dblink), "Failed.", 1); 401 454 case "1.3": 402 455 // Dropping obsolete "handler" field from pages table, refs #452 403 test( __('Removing handler field from the pages table').'...',456 test('Removing handler field from the pages table...', 404 457 @mysql_query("ALTER TABLE ".$config["table_prefix"]."pages DROP handler", $dblink), __('Already done? Hmm!'), 1); 405 458 // Support for threaded comments … … 412 465 // Create new fields for comment_read_acl and comment_post_acl, 413 466 // and copy existing comment_acl values to these new fields 414 test( __('Creating new comment_read_acl field').'...',467 test('Creating new comment_read_acl field...', 415 468 @mysql_query("alter table ".$config['table_prefix']."acls add comment_read_acl text not null", $dblink), __('Already done? OK!'), 0); 416 test( __('Creating new comment_post_acl field').'...',469 test('Creating new comment_post_acl field...', 417 470 @mysql_query("alter table ".$config['table_prefix']."acls add comment_post_acl text not null", $dblink), __('Already done? OK!'), 0); 418 test( __('Copying existing comment_acls to new fields').'...',471 test('Copying existing comment_acls to new fields...', 419 472 @mysql_query("update ".$config['table_prefix']."acls as a inner join(select page_tag, comment_acl from ".$config['table_prefix']."acls) as b on a.page_tag = b.page_tag set a.comment_read_acl=b.comment_acl, a.comment_post_acl=b.comment_acl", $dblink), __('Failed').'. ?', 1); 420 test("Setting default ACL for UserSettings...",473 test("Setting default UserSettings ACL...", 421 474 @mysql_query("insert into ".$config['table_prefix']."acls set page_tag = 'UserSettings', comment_read_acl = '*', comment_post_acl = '+'", $dblink), __('Already done? OK!'), 0); 422 test("Setting default A CL for AdminUsers...",475 test("Setting default AdminUsers ACL...", 423 476 @mysql_query("insert into ".$config['table_prefix']."acls set page_tag = 'AdminUsers', comment_read_acl = '!*', comment_post_acl = '!*'", $dblink), __('Already done? OK!'), 0); 424 test("Setting default A CL for AdminPages...",477 test("Setting default AdminPages ACL...", 425 478 @mysql_query("insert into ".$config['table_prefix']."acls set page_tag = 'AdminPages', comment_read_acl = '!*', comment_post_acl = '!*'", $dblink), __('Already done? OK!'), 0); 426 test("Setting default ACL for DatabaseInfo...",479 test("Setting default DatabaseInfo ACL...", 427 480 @mysql_query("insert into ".$config['table_prefix']."acls set page_tag = 'DatabaseInfo', comment_read_acl = '!*', comment_post_acl = '!*'", $dblink), __('Already done? OK!'), 0); 428 case "trunk": // Latest development version from SVN repo - do not remove 429 break; 430 } 431 432 // (directly) use configured location SITE_CONFIGFILE 433 if (!file_exists(SITE_CONFIGFILE) || !is_writeable(SITE_CONFIGFILE)) 434 { 481 } 482 483 // #600: Force reloading of stylesheet. 484 // #6: Append this to individual theme stylesheets 485 $config['stylesheet_hash'] = substr(md5(time()),1,5); 435 486 ?> 436 <p><?php 437 printf(__('In the next step, the installer will try to write the updated configuration file, %s').'. ', '<tt>'.SITE_CONFIGFILE.'</tt>'); 438 echo __('Please make sure the web server has write access to the file, or you will have to edit it manually').'.'; 439 printf(__('Once again, see %s for details'), '<a href="http://docs.wikkawiki.org/WikkaInstallation" target="_blank">Wikka:WikkaInstallation</a>'); 440 ?>.487 488 <p> 489 In the next step, the installer will try to write the updated configuration file, <tt><?php echo $wakkaConfigLocation ?></tt>. 490 Please make sure the web server has write access to the file, or you will have to edit it manually. 491 Once again, see <a href="http://docs.wikkawiki.org/WikkaInstallation" target="_blank">WikkaInstallation</a> for details. 441 492 </p> 442 <?php 443 } 444 ?> 445 446 <form action="<?php echo $action_target; ?>" method="post"> 447 <input type="hidden" name="installAction" value="writeconfig" /> 448 <input type="submit" value="<?php echo _p('Continue');?>" /> 493 494 <form action="<?php echo myLocation(); ?>?installAction=writeconfig" method="post"> 495 <input type="hidden" name="config" value="<?php echo Wakka::hsc_secure(serialize($config)) ?>" /><?php /* #427 */ ?> 496 <input type="submit" value="Continue" /> 449 497 </form> 450 <?php /* echo '<pre>'; print_r($_SESSION); echo '</pre>'; */ ?> -
branches/1.3/setup/writeconfig.php
r1515 r1535 1 1 <?php 2 /** 3 * Store the configuration in a file called wikka.config.php 4 * 5 * @package Setup 6 * @version $Id: writeconfig.php 1340 2009-03-03 01:42:06Z BrianKoontz $ 7 * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 8 * @filesource 9 */ 2 // fetch config 3 $config = $config2 = unserialize($_POST["config"]); 10 4 11 // remove config values for whatever reason 12 unset($config['allow_doublequote_html']); 5 // merge existing configuration with new one 6 $config = array_merge($wakkaConfig, $config); 7 8 // remove obsolete config settings if present 9 unset($config["allow_doublequote_html"]); 10 unset($config["header_action"]); 11 unset($config["footer_action"]); 12 unset($config["external_link_tail"]); 13 14 // Parse navlinks, convert to menu configuration files, #891 (since 1.2) 15 // Check to see if config is writeable... 16 if(!is_writeable('config')) 17 { 18 print("<p><span class=\"failed\">WARNING:</span> The <tt>config</tt> directory is not writeable; therefore, conversion of old navigation links to new menu items cannot be performed. Please give your web server temporary write access to the <tt>config</tt> directory (<tt>chmod 777 config</tt>; don't forget to remove write access later, i.e. <tt>chmod 555 config</tt>). If you are unable to make this directory writeable, you will need to manually edit the menu files in the <tt>config</tt> directory. You will also need to remove the <tt>navigation_links</tt> and <tt>logged_in_navigation_links</tt> parameters in your <tt>wikka.config.php</tt> file. If you are still having difficulties, please visit <a href=\"http://docs.wikkawiki.org/WikkaInstallation\">WikkaInstallation</a>.</p>\n"); 19 ?> 20 <form action="<?php echo myLocation() ?>?installAction=writeconfig" method="post"> 21 <input type="hidden" name="config" value="<?php echo Wakka::hsc_secure(serialize($config2)) ?>" /><?php /* #427 */ ?> 22 <input type="submit" value="Try again" /> 23 </form> 24 <?php 25 return; 26 } 27 $path = 'config'.DIRECTORY_SEPARATOR; 28 if(isset($config['navigation_links'])) 29 { 30 $navlinks = $config['navigation_links']; 31 $links = array(); 32 if(FALSE!==preg_match_all('/[A-ZÄÖÜ]+[a-zßäöü]+[A-Z0-9ÄÖÜ][A-Za-z0-9ÄÖÜßäöü]*|\[\[.*?\]\]/', $navlinks, $links)) 33 { 34 if(file_exists($path.'main_menu.inc')) 35 { 36 rename($path.'main_menu.inc', $path.'main_menu.orig.inc'); 37 } 38 $h = fopen($path.'main_menu.inc', 'w'); 39 foreach($links[0] as $link) 40 { 41 fwrite($h, $link."\n"); 42 } 43 fwrite($h, "{{searchform}}\n"); 44 fwrite($h, 'Your hostname is {{whoami}}'); 45 fclose($h); 46 } 47 unset($config['navigation_links']); 48 } 49 if(isset($config['logged_in_navigation_links'])) 50 { 51 $navlinks = $config['logged_in_navigation_links']; 52 $links = array(); 53 if(FALSE!==preg_match_all('/[A-ZÄÖÜ]+[a-zßäöü]+[A-Z0-9ÄÖÜ][A-Za-z0-9ÄÖÜßäöü]*|\[\[.*?\]\]/', $navlinks, $links)) 54 { 55 if(file_exists($path.'main_menu.user.inc')) 56 { 57 rename($path.'main_menu.user.inc', $path.'main_menu.user.orig.inc'); 58 } 59 $h = fopen($path.'main_menu.user.inc', 'w'); 60 foreach($links[0] as $link) 61 { 62 fwrite($h, $link."\n"); 63 } 64 fwrite($h, "{{searchform}}\n"); 65 fwrite($h, 'You are {{whoami}}'); 66 fclose($h); 67 } 68 unset($config['logged_in_navigation_links']); // since 1.2 69 } 13 70 14 71 // set version to current version, yay! 15 $config['wakka_version'] = WAKKA_VERSION; 16 // initialize! Suppose rewrite_mode unavailable. 17 if (!isset($config['rewrite_mode'])) 18 { 19 $config['rewrite_mode'] = 0; 20 if (($_SESSION['server_info']['mod_rewrite']) && (file_exists($htaccessLocation)) && (is_writeable($htaccessLocation))) 21 { 22 $config['rewrite_mode'] = 1; 23 } 24 } 72 $config["wakka_version"] = WAKKA_VERSION; 25 73 26 if ($wakkaConfig['wakka_version'])27 {28 echo '<h1>'.__('Wikka Upgrade').' (5/5)</h1>'."\n";29 }30 else31 {32 echo '<h1>'.__('Wikka Installation').' (5/5)</h1>'."\n";33 }34 35 // Writing .htaccess36 // Flag registering status of attempt to update .htaccess37 $htaccess_updated = 0;38 if ($config['rewrite_mode'] == 1)39 {40 $htaccess_content = file($htaccessLocation);41 $new_htaccess_content = '';42 $on_rewrite_section = 0;43 foreach ($htaccess_content as $line)44 {45 if ((preg_match("/^(\\s*Rewrite(Engine|Base)|#---WIKKA-REWRITING-BEGIN)/i", $line)) && ($on_rewrite_section == 1))46 {47 $line = '';48 }49 if (preg_match("/^(\\s*)<IfModule\\s+mod_rewrite.c>/i", $line , $m))50 {51 $line .= '#---WIKKA-REWRITING-BEGIN'."\r\n";52 $line .= $m[1].' RewriteEngine On'."\r\n";53 $line .= $m[1].' RewriteBase '.WIKKA_BASE_URL_PATH."\r\n";54 $on_rewrite_section = 1;55 }56 if (($on_rewrite_section == 1) && (preg_match("/^(\\s*)<\\/IfModule>/i", $line)))57 {58 $on_rewrite_section = 2;59 }60 $new_htaccess_content .= $line;61 }62 print('<h2>'.__('Updating .htaccess').'</h2>'."\n");63 test(__('Updating rewriting rules').'...', $on_rewrite_section, '', 0);64 if ($on_rewrite_section)65 {66 test(sprintf(__('Writing .htaccess file (%s)'), '<tt>'.$htaccessLocation.'</tt>').'...', $f1 = @fopen($htaccessLocation, "w"), "", 0);67 if ($f1)68 {69 fwrite($f1, $new_htaccess_content);70 fclose($f1);71 $htaccess_updated = 1;72 }73 }74 }75 $config['rewrite_mode'] = $htaccess_updated;76 // #600: Force reloading of stylesheets. @@@ Do this in StaticHref()77 if (!empty($config['stylesheet']))78 {79 $config['stylesheet'] = preg_replace('/(&|\\?)(.*)$/', '', $config['stylesheet']); // Needed in case of reinstall80 $config['stylesheet'] .= strstr($config['stylesheet'], '?') ? '&' : '?';81 $config['stylesheet'] .= substr(md5(time()),1,5);82 }83 if (!empty($config['comment_stylesheet']))84 {85 $config['comment_stylesheet'] = preg_replace('/(&|\\?)(.*)$/', '', $config['comment_stylesheet']);86 $config['comment_stylesheet'] .= strstr($config['comment_stylesheet'], '?') ? '&' : '?';87 $config['comment_stylesheet'] .= substr(md5(time()),1,5);88 }89 74 // convert config array into PHP code 90 75 $double_backslash = '\\\\'; … … 93 78 foreach ($config as $k => $v) 94 79 { 95 if ($k !== 0) 96 { 97 // @@@ make sure to write strings as strings, numbers as numbers, and booleans as booleans! 98 // we can use datatypes in the default config for this! 99 $entries[] = "\t'".$k."' => '".preg_replace('/['.$double_backslash.$single_quote.']/', $double_backslash.'$0', $v)."'"; // #5 100 } 80 $entries[] = "\t'".$k."' => '".preg_replace('/['.$double_backslash.$single_quote.']/', $double_backslash.'$0', $v)."'"; // #5 101 81 } 102 82 $configCode .= implode(",\n", $entries).");\n?>"; 103 83 104 84 // try to write configuration file 105 print('<h2>'.__('Writing configuration').'</h2>'."\n"); 106 // (directly) use configured location SITE_CONFIGFILE 107 #test(sprintf(__('Writing configuration file %s'), '<tt>'.$wakkaConfigLocation.'</tt>...'), $fp = @fopen($wakkaConfigLocation, "w"), "", 0); 108 test(sprintf(__('Writing configuration file %s'), '<tt>'.SITE_CONFIGFILE.'</tt>...'), $fp = @fopen(SITE_CONFIGFILE, "w"), "", 0); 85 print("<h2>Writing configuration</h2>\n"); 86 test("Writing configuration file <tt>".$wakkaConfigLocation."</tt>...", $fp = @fopen($wakkaConfigLocation, "w"), "", 0); 109 87 110 88 if ($fp) 111 89 { 112 $_SESSION['server_info'] = $_SESSION['sconfig'] = $_SESSION['wikka'] = null;113 90 fwrite($fp, $configCode); 114 91 // write 115 92 fclose($fp); 116 printf('<p>'.__('That\'s all! You can now %1$sreturn to your WikkaWiki site%2$s'), '<a href="'.WIKKA_BASE_URL.'">', '</a>'); 117 echo '. '."\n"; 118 printf(__('However, you are advised to remove write access to %s again now that it\'s been written. Leaving the file writable can be a security risk'), '<tt>wikka.config.php</tt>'); 119 echo '!</p>'; 93 94 print("<p>That's all! You can now <a href=\"".$config["base_url"]."\">return to your Wikka site</a>. However, you are advised to remove write access to <tt>wikka.config.php</tt> again now that it's been written. Leaving the file writable can be a security risk!</p>"); 120 95 } 121 96 else 122 97 { 123 98 // complain 124 print('<p><span class="failed">'.__('WARNING').':</span> '); 125 printf(__('The file %1$s could not be written. You will need to give your web server temporary write access to either your wikka directory, or a blank file called %1$s'), '<tt>'.SITE_CONFIGFILE.'</tt>'); 126 echo ' (<kbd>touch wikka.config.php ; chmod 666 wikka.config.php</kbd>) ; '; 127 printf(__('don\'t forget to remove write access again later, ie %s'), '<kbd>chmod 644 '.SITE_CONFIGFILE.'</kbd>'); 128 echo ".\n"; 129 printf(__('If, for any reason, you can\'t do this, you\'ll have to copy the text below into a new file and save/upload it as %1$s'), '<tt>'.SITE_CONFIGFILE.'</tt>'); 130 printf(__('Once you\'ve done this, your Wikka site should work. If not, please visit %s'), '<a href="http://docs.wikkawiki.org/WikkaInstallation">WikkaInstallation</a>'); 131 echo '.</p>'."\n"; 99 print("<p><span class=\"failed\">WARNING:</span> The configuration file <tt>".$wakkaConfigLocation."</tt> could not be written. You will need to give your web server temporary write access to either your wakka directory, or a blank file called <tt>wikka.config.php</tt> (<tt>touch wikka.config.php ; chmod 666 wikka.config.php</tt>; don't forget to remove write access again later, ie <tt>chmod 644 wikka.config.php</tt>). If, for any reason, you can't do this, you'll have to copy the text below into a new file and save/upload it as <tt>wikka.config.php</tt> into the Wikka directory. Once you've done this, your Wikka site should work. If not, please visit <a href=\"http://docs.wikkawiki.org/WikkaInstallation\">WikkaInstallation</a>.</p>\n"); 132 100 ?> 133 <form action="<?php echo $action_target; ?>" method="post">134 <input type="hidden" name=" installAction" value="writeconfig" />135 <input type="submit" value=" <?php echo _p('Try again'); ?>" />101 <form action="<?php echo myLocation() ?>?installAction=writeconfig" method="post"> 102 <input type="hidden" name="config" value="<?php echo Wakka::hsc_secure(serialize($config2)) ?>" /><?php /* #427 */ ?> 103 <input type="submit" value="Try again" /> 136 104 </form> 137 105 <?php 138 echo '<div><textarea readonly="readonly" style="width: 80%; height: 600px;">'.str_replace(array('&', '<'), array('&', '<'), $configCode)."</textarea></div>\n"; //TODO:make code block downloadable106 print("<xmp>".$configCode."</xmp>\n"); //TODO: replace xmp and make code block downloadable 139 107 } 140 108 -
branches/1.3/wikka.php
r1520 r1535 5 5 * This file is called each time a request is made from the browser. 6 6 * Most of the core methods used by the engine are located in the Wakka class. 7 * @see Wakka7 * @see Wakka 8 8 * This file was originally written by Hendrik Mans for WakkaWiki 9 9 * and released under the terms of the modified BSD license 10 * @see /docs/WakkaWiki.LICENSE11 * 12 * @package Wikka13 * @subpackage Core14 * @version $Id: wikka.php 1293 2009-01-12 17:06:21Z DarTar$15 * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License16 * @see /docs/Wikka.LICENSE10 * @see /docs/WakkaWiki.LICENSE 11 * 12 * @package Wikka 13 * @subpackage Core 14 * @version $Id$ 15 * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 16 * @see /docs/Wikka.LICENSE 17 17 * @filesource 18 18 * … … 24 24 * @author {@link http://wikkawiki.org/DarTar Dario Taraborelli} 25 25 * @author {@link http://wikkawiki.org/BrianKoontz Brian Koontz} 26 * @author {@link http://www.tormodh.net/ Tormod Haugen} 27 * 28 * @copyright Copyright 2002-2003, Hendrik Mans <hendrik@mans.de> 29 * @copyright Copyright 2004-2005, Jason Tourtelotte <wikka-admin@jsnx.com> 30 * @copyright Copyright 2006-2009, {@link http://wikkawiki.org/CreditsPage Wikka Development Team} 31 * 32 * @uses getmicrotime() for determining page generation time 33 * @uses magicQuotesWorkaround() to overcome magic quotes that may be imposed 34 * on a system 35 * @uses instantiate() for a version-independent method to instantiate a class 36 * @uses getMysqlVersion() to retrieve MySQL version for a requirements check 37 * 38 * @todo use templating class for page generation; 39 */ 40 41 require_once('libs'.DIRECTORY_SEPARATOR.'Compatibility.lib.php'); 42 43 // ---------------------- DEBUGGING AND ERROR REPORTING ----------------------- 44 /** 45 * Controls generation of debug messages. 46 * 47 * May cause quirks mod in browser! 48 * By using a 'debug' key file during development (and keeping this out of the 49 * repository!) it's is simple to trigger debug messages without needing to edit 50 * (this) code. 51 */ 52 $debug = (file_exists('debug')) ? TRUE : FALSE; 53 /** 54 * Controls error_reporting mode: E_ALL if TRUE, E_ALL ^ E_NOTICE if FALSE. 55 * 56 * By using a 'errors' key file during development (and keeping this out of the 57 * repository!) it's is simple to test a system without needing to edit (this) 58 * code. 59 */ 60 $track_errors = (file_exists('errors')) ? TRUE : FALSE; 61 ob_start(); // need to pick up tracing messages 62 /** 63 * Interpret debugging and development/production modes. 64 */ 65 if ($debug || $track_errors) 66 { 67 error_reporting(E_ALL); // always on for debug mode 68 } 69 else 70 { 71 error_reporting(E_ALL ^ E_NOTICE); // production mode 72 } 73 // -------------------- END DEBUGGING AND ERROR REPORTING --------------------- 74 75 // ---------------------------- VERSIONING ------------------------------------ 76 include_once('./version.php'); 77 78 /**#@-*/ 26 * @author {@link http://wikkawiki.org/TormodHaugen Tormod Haugen} 27 * 28 * @copyright Copyright 2002-2003, Hendrik Mans <hendrik@mans.de> 29 * @copyright Copyright 2004-2005, Jason Tourtelotte <wikka-admin@jsnx.com> 30 * @copyright Copyright 2006-2009, {@link http://wikkawiki.org/CreditsPage Wikka Development Team} 31 * 32 * @todo use templating class for page generation; 33 * @todo add phpdoc documentation for configuration array elements; 34 */ 35 36 //error_reporting(E_ALL); 37 error_reporting (E_ALL ^ E_NOTICE); 38 39 // If you need to use this installation with a configuration file outside the 40 // installation directory uncomment the following line and adapt it to reflect 41 // the (filesystem) path to where your configuration file is located. 42 // This would make it possible to store the configuration file outside of the 43 // webroot, or to share one configuration file between several Wikka Wiki 44 // installations. 45 // This replaces the use of the environment variable WAKKA_CONFIG for security 46 // reasons. [SEC] 47 #if (!defined('WAKKA_CONFIG')) define('WAKKA_CONFIG','path/to/your/wikka.config.php'); 48 79 49 /** 80 * Defines the current Wikka patch level. This should be 0 by default,81 * and does not need to be changed for major/minor releases.50 * Include language file if it exists. 51 * @see /lang/en.inc.php 82 52 */ 83 if(!defined('WIKKA_PATCH_LEVEL')) define('WIKKA_PATCH_LEVEL', '1'); 84 85 // ----------------------------- BASIC CONSTANTS ------------------------------- 86 /** 87 * Defines the basic name the session name will be derived from. 88 */ 89 if (!defined('BASIC_SESSION_NAME')) define('BASIC_SESSION_NAME', 'Wikkawiki'); 90 91 /** 92 * Path where the Wikka installer is located. 93 */ 94 if (!defined('WIKKA_SETUP_PATH')) define('WIKKA_SETUP_PATH', 'setup'); 53 $default_lang_path = 'lang'.DIRECTORY_SEPARATOR.'en'.DIRECTORY_SEPARATOR.'en.inc.php'; 54 if (file_exists($default_lang_path)) require_once($default_lang_path); 55 else die('Language file '.$default_lang_path.' not found! Please add the file.'); 56 57 /** 58 * Defines the current Wikka version. Do not change the version number or you will have problems upgrading. 59 */ 60 if (!defined('WAKKA_VERSION')) define('WAKKA_VERSION', '1.2'); 61 62 /** 63 * Defines the current Wikka patch level. This should be 0 by default, 64 * and does not need to be changed for major/minor releases. 65 */ 66 if(!defined('WIKKA_PATCH_LEVEL')) define('WIKKA_PATCH_LEVEL', '1'); 67 95 68 96 69 /**#@+ 97 * Minimum version requirement. 98 */ 99 if (!defined('MINIMUM_PHP_VERSION')) define('MINIMUM_PHP_VERSION', '4.1'); 100 if (!defined('MINIMUM_MYSQL_VERSION')) define('MINIMUM_MYSQL_VERSION', '3.23'); // 3.23.23 referred to in commented-out code 70 * Simple constant. May be made a configurable value. 71 */ 72 /** 73 * Defines the default cookie name. 74 */ 75 if (!defined('BASIC_COOKIE_NAME')) define('BASIC_COOKIE_NAME', 'Wikkawiki'); 76 /** 77 * Length to use for generated part of id attribute. 78 */ 79 define('ID_LENGTH',10); // @@@ maybe make length configurable 80 /** 81 * Character used for multi-path lists 82 */ 83 if(!defined('PATH_DIVIDER')) define('PATH_DIVIDER', ','); 101 84 /**#@-*/ 102 85 103 // The following error messages are in English only, because at the point these 104 // messages need to be shown, no language preference may have been set yet, no 105 // language file loaded yet, or even the language file could not be loaded(!). 106 107 /**#@+ 108 * Error message constant. 109 */ 110 define('ERROR_WRONG_PHP_VERSION', 'Wikka requires PHP %s or higher!'); // %s - version number 111 define('ERROR_LANGUAGE_FILE_MISSING', 'Language file (%s) not found! Please add the file.'); // %s - path to default language file 112 /**#@-*/ 113 // --------------------------- END BASIC CONSTANTS ----------------------------- 114 115 116 // --------------------------- VERSION CHECK (PHP) ----------------------------- 86 // Sanity checks - we die if these conditions aren't met 87 117 88 // More intelligent version check, more intelligently placed ;) 118 // Basically if we are going to fail, we want to do that as soon as possible.119 // BUT: to have the error message localized, the desied language file must have120 // been loaded already; and that in turn depends on a bunch of other things...121 //122 // So here we use one of the few exceptions: an error message in English because123 // we don't have a language file loaded yet. (The installer needs to start in124 // English anyway, and the error message when the language file *cannot* be loaded125 // will also have to be English!)126 //127 // Given the above, it doesn't need any of the constant definitions, except the128 // error message and version constants, so it can go way up now!129 if ($debug) echo "PHP version check...<br/>\n";130 89 if (!function_exists('version_compare') || 131 90 version_compare(phpversion(),MINIMUM_PHP_VERSION,'<') // < PHP minimum version?? … … 135 94 die($php_version_error); # fatalerror !!! default error in English 136 95 } 137 // ------------------------- END VERSION CHECK (PHP) --------------------------- 96 // MySQL needs to be installed and available 97 // @@@ message could be refined by detecting detect OS (mention module name) and maybe server name 98 if (!function_exists('mysql_connect')) 99 { 100 die(ERROR_MYSQL_SUPPORT_MISSING); 101 } 102 103 /** 104 * Include main library if it exists. 105 * @see libs/Wakka.class.php 106 */ 107 if (file_exists('libs/Wakka.class.php')) 108 { 109 require_once('libs/Compatibility.lib.php'); 110 require_once('libs/Wakka.class.php'); 111 } 112 else 113 { 114 die(ERROR_WAKKA_LIBRARY_MISSING); 115 } 116 117 // Sanity checks OK - start rolling.... 118 119 ob_start(); 120 global $tstart; 121 $tstart = getmicrotime(); 122 set_magic_quotes_runtime(0); 123 if (get_magic_quotes_gpc()) 124 { 125 magicQuotesWorkaround($_POST); 126 magicQuotesWorkaround($_GET); 127 magicQuotesWorkaround($_COOKIE); 128 } 129 130 /** 131 * Default configuration. 132 */ 133 // attempt to derive base URL fragments and whether rewrite mode is enabled (#438) 134 $t_domain = $_SERVER['SERVER_NAME']; 135 $t_scheme = ((isset($_SERVER['HTTPS'])) && !empty($_SERVER['HTTPS']) && 'off' != $_SERVER['HTTPS']) ? 'https://' : 'http://'; 136 $t_port = ':'.$_SERVER['SERVER_PORT']; 137 if ((('http://' == $t_scheme) && (':80' == $t_port)) || (('https://' == $t_scheme) && (':443' == $t_port))) 138 { 139 $t_port = ''; 140 } 141 $t_request = $_SERVER['REQUEST_URI']; 142 // append slash if $t_request does not end with either a slash or the string .php 143 if (!preg_match('@(\\.php|/)$@i', $t_request)) 144 { 145 $t_request .= '/'; 146 } 147 148 if (preg_match('@\.php$@', $t_request) && !preg_match('@wikka\.php$@', $t_request)) 149 { 150 // handle "overridden" redirect from index.php 151 $t_request = preg_replace('@/[^.]+\.php@', '/wikka.php', $t_request); // handle "overridden" redirect from index.php 152 } 153 154 if ( !preg_match('@wakka=@',$_SERVER['REQUEST_URI']) && isset($_SERVER['QUERY_STRING']) && preg_match('@wakka=@',$_SERVER['QUERY_STRING'])) 155 { 156 // looks like we got a rewritten request via .htaccess 157 // remove 'wikka.php' and request (page name) from 'request' part: should not be part of base_url! 158 $query_part = preg_replace('@wakka=@', '', $_SERVER['QUERY_STRING']); 159 $t_request = preg_replace('@'.preg_quote('wikka.php').'@', '', $t_request); 160 $t_request = preg_replace('@'.preg_quote($query_part).'@', '', $t_request); 161 $t_query = ''; 162 $t_rewrite_mode = 1; 163 } 164 else 165 { 166 // no rewritten request apparent 167 $t_query = '?wakka='; 168 $t_rewrite_mode = 0; 169 } 138 170 139 171 // ---------------------- DEFINE URL DOMAIN / PATH ----------------------------- … … 154 186 * URL fragment consisting of scheme + domain part. 155 187 * Represents the domain URL where the current instance of Wikka is located. 188 * This variable can be overriden in {@link override.config.php} 156 189 * 157 190 * @var string … … 187 220 // ----------------------- END URL DOMAIN / PATH ------------------------------- 188 221 189 // ------------------------ DEFINE & DERIVE CORE PATHS ------------------------- 190 // Universal path divider; path parser also recognizes Unix-style 191 // dividers (:) and Windows-style dividers (;) 192 define('PATH_DIVIDER', ','); 193 194 if ($debug) echo "default filesystem paths...<br/>\n"; 195 196 /** 197 * Default filesystem path for the <b>site</b> configuration 198 * <b>file</b>. 199 */ 200 if(!defined('DEFAULT_SITE_CONFIGFILE')) define ('DEFAULT_SITE_CONFIGFILE', 'wikka.config.php'); 201 // For backwards compatibility with existing code...probably needs to 202 // be removed at some point 203 if(!defined('SITE_CONFIGFILE')) define ('SITE_CONFIGFILE', DEFAULT_SITE_CONFIGFILE); 204 205 if ($debug) echo "core component paths...<br/>\n"; 206 207 /** 208 * Effective path to the Wikka code library which contains core components. 209 */ 210 if (!defined('WIKKA_LIBRARY_PATH')) define('WIKKA_LIBRARY_PATH', 'libs'); 211 212 /** 213 * Effective path to the Wikka language library which contains language files 214 * and localized system content. 215 */ 216 if (!defined('WIKKA_LANG_PATH')) define('WIKKA_LANG_PATH', 'lang'); 217 218 /** 219 * Default <b>directory</b> where actions bundled with Wikka are 220 * stored. 221 */ 222 if(!defined('DEFAULT_ACTION_PATH')) define('DEFAULT_ACTION_PATH', 'plugins/actions'.PATH_DIVIDER.'actions'); 223 224 /** 225 * Default <b>directory</b> where handlers bundled with Wikka are 226 * stored. 227 */ 228 if(!defined('DEFAULT_HANDLER_PATH')) define('DEFAULT_HANDLER_PATH', 'plugins/handlers'.PATH_DIVIDER.'handlers'); 229 230 /** 231 * Default <b>directory</b> where formatters bundled with Wikka are 232 * stored. 233 */ 234 if(!defined('DEFAULT_FORMATTER_PATH')) define('DEFAULT_FORMATTER_PATH', 'plugins/formatters'.PATH_DIVIDER.'formatters'); 235 236 /** 237 * Default <b>directory</b> where templates bundled with Wikka are 238 * stored. 239 */ 240 if(!defined('DEFAULT_TEMPLATE_PATH')) define('DEFAULT_TEMPLATE_PATH', 'plugins/templates'.PATH_DIVIDER.'templates'); 241 242 /** 243 * Directory for 3rd-party components 244 */ 245 if(!defined('DEFAULT_3RDPARTY_PATH')) define('DEFAULT_3RDPARTY_PATH', '3rdparty'); 246 247 /** Default <b>directory</b> where 3rdparty core components bundled 248 * with Wikka are stored. These components are required for basic 249 * Wikka functionality. 250 */ 251 if(!defined('DEFAULT_3RDPARTY_CORE_PATH')) define('DEFAULT_3RDPARTY_CORE_PATH', DEFAULT_3RDPARTY_PATH.DIRECTORY_SEPARATOR.'core'); 252 253 /** Default <b>directory</b> where 3rdparty plugin components bundled 254 * with Wikka are stored. These components are optional and extend 255 * Wikka functionality. 256 */ 257 if(!defined('DEFAULT_3RDPARTY_PLUGIN_PATH')) define('DEFAULT_3RDPARTY_PLUGIN_PATH', DEFAULT_3RDPARTY_PATH.DIRECTORY_SEPARATOR.'plugin'); 258 259 /** 260 * Default <b>directory</b> for the FeedCreator 3rd party component. 261 */ 262 if(!defined('DEFAULT_FEEDCREATOR_PATH')) define('DEFAULT_FEEDCREATOR_PATH', DEFAULT_3RDPARTY_CORE_PATH.DIRECTORY_SEPARATOR.'feedcreator'); 263 264 /** 265 * Default <b>directory</b> for the SafeHTML 3rd party component. 266 */ 267 if(!defined('DEFAULT_SAFEHTML_PATH')) define('DEFAULT_SAFEHTML_PATH', DEFAULT_3RDPARTY_CORE_PATH.DIRECTORY_SEPARATOR.'safehtml'); 268 269 /** 270 * Default <b>directory</b> for the optional GeSHi 3rd party plugin component. 271 */ 272 if(!defined('DEFAULT_GESHI_PATH')) define('DEFAULT_GESHI_PATH', DEFAULT_3RDPARTY_PLUGIN_PATH.DIRECTORY_SEPARATOR.'geshi'); 273 274 /** 275 * Default <b>directory</b> for the language files for the GeSHi 3rd 276 * party plugin component. 277 */ 278 if(!defined('DEFAULT_GESHI_LANG_PATH')) define('DEFAULT_GESHI_LANG_PATH', DEFAULT_GESHI_PATH.DIRECTORY_SEPARATOR.'geshi'); 279 280 /** 281 * Default <b>directory</b> for the optional Onyx-RSS 3rd party 282 * plugin component. 283 */ 284 if(!defined('DEFAULT_ONYX_PATH')) define('DEFAULT_ONYX_PATH', DEFAULT_3RDPARTY_PLUGIN_PATH.DIRECTORY_SEPARATOR.'onyx-rss'); 285 286 /** 287 * <b>URL path component</b> pointing to the location of the WikiEdit scripts. 288 * This path will be extended by the system with the file name for each of 289 * the required scripts. 290 */ 291 if(!defined('DEFAULT_WIKIEDIT_URIPATH')) define('DEFAULT_WIKIEDIT_URIPATH', filesys2uri(DEFAULT_3RDPARTY_PLUGIN_PATH).DIRECTORY_SEPARATOR.'wikiedit'); 292 293 /** 294 * <b>URL path component</b> for the FreeMind display applet. 295 * This path will be extended by the system with the file name for the 296 * applet's jar archive. 297 */ 298 if(!defined('DEFAULT_FREEMIND_URIPATH')) define('DEFAULT_FREEMIND_URIPATH', filesys2uri(DEFAULT_3RDPARTY_PLUGIN_PATH).DIRECTORY_SEPARATOR.'freemind'); 299 300 // ------------------- COMPONENT PATHS DEFINED -------------------- 301 302 // -------------------------------- START TIMER -------------------------------- 303 if ($debug) echo "start timer...<br/>\n"; 304 // --- this requires a function from the Compatibility library, so it must come 305 // at least after loading that library 306 // Now that all paths and other basic settings are known, start page generation 307 // timer. 308 $tstart = getmicrotime(TRUE); 309 // ------------------------------- TIMER STARTED ------------------------------- 310 311 // ----------------------------- GATHER CONFIGURATION -------------------------- 312 if ($debug) echo "gather configuration...<br/>\n"; 313 // --- this requires a function from the Compatibility library, so it must come 314 // at least after loading that library; it also uses the effective locations 315 // for the configuration files, so these locations must have been derived. 316 /** 317 * 1. Get the default configuration. 318 */ 319 require_once('libs'.DIRECTORY_SEPARATOR.'Config.class.php'); 320 $DefaultConfig = instantiate('Config'); 321 $wakkaDefaultConfig = get_object_vars($DefaultConfig); 322 unset($DefaultConfig); 323 // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 324 /** 325 * 2. Load and update the (current) user configuration if it exists. 326 */ 327 $wakkaConfig = array(); // empty array in case there's no user configuration yet 328 329 // Get any inherited configuration from Wakka 330 if (file_exists('wakka.config.php')) 331 { 332 rename('wakka.config.php', 'wikka.config.php'); 333 } 334 if(file_exists(SITE_CONFIGFILE)) 335 { 336 include SITE_CONFIGFILE; 337 } 338 339 // migrate some old to new variable names (should come before merge!) 340 //TODO move these checks to a directive file to be used by the installer/upgrader, #97 341 if (isset($wakkaConfig['action_path']) && !isset($wakkaConfig['wikka_action_path'])) 342 { 343 $wakkaConfig['wikka_action_path'] = $wakkaConfig['action_path']; 344 unset($wakkaConfig['action_path']); //since 1.1.7 345 } 346 if (isset($wakkaConfig['handler_path']) && !isset($wakkaConfig['wikka_handler_path'])) 347 { 348 $wakkaConfig['wikka_handler_path'] = $wakkaConfig['handler_path']; 349 unset($wakkaConfig['handler_path']); //since 1.1.7 350 } 222 223 $wakkaDefaultConfig = array( 224 'mysql_host' => 'localhost', 225 'mysql_database' => 'wikka', 226 'mysql_user' => 'wikka', 227 'table_prefix' => 'wikka_', 228 229 'root_page' => 'HomePage', 230 'wakka_name' => 'MyWikkaSite', 231 'base_url' => $t_scheme.$t_domain.$t_port.$t_request.$t_query, 232 'rewrite_mode' => $t_rewrite_mode, 233 'wiki_suffix' => '@wikka', 234 'enable_user_host_lookup' => '1', #enable (1, default) or disable (0) lookup of user hostname from IP address 235 236 'action_path' => 'plugins/actions'.PATH_DIVIDER.'actions', 237 'handler_path' => 'plugins/handlers'.PATH_DIVIDER.'handlers', 238 'gui_editor' => '1', 239 'default_comment_display' => '1', 240 'theme' => 'light', 241 242 // formatter and code highlighting paths 243 'wikka_formatter_path' => 'plugins/formatters'.PATH_DIVIDER.'formatters', # (location of Wikka formatter - REQUIRED) 244 'wikka_highlighters_path' => 'formatters', # (location of Wikka code highlighters - REQUIRED) 245 'geshi_path' => '3rdparty/plugins/geshi', # (location of GeSHi package) 246 'geshi_languages_path' => '3rdparty/plugins/geshi/geshi', # (location of GeSHi language highlighting files) 247 248 // template 249 'wikka_template_path' => 'plugins/templates'.PATH_DIVIDER.'templates', # (location of Wikka template files - REQUIRED) 250 'feedcreator_path' => '3rdparty/core/feedcreator', 251 'safehtml_path' => '3rdparty/core/safehtml', 252 'referrers_purge_time' => '30', 253 'pages_purge_time' => '0', 254 'xml_recent_changes' => '10', 255 'hide_comments' => '0', 256 'comment_stylesheet' => 'boxed-comments.css', 257 'require_edit_note' => '0', # edit note optional (0, default), edit note required (1) edit note disabled (2) 258 'anony_delete_own_comments' => '1', 259 'public_sysinfo' => '0', # enable or disable public display of system information in SysInfo 260 'double_doublequote_html' => 'safe', 261 'external_link_tail' => '<span class="exttail">∞</span>', 262 'sql_debugging' => '0', 263 'admin_users' => '', 264 'admin_email' => '', 265 'upload_path' => 'uploads', 266 'mime_types' => 'mime_types.txt', 267 268 // code hilighting with GeSHi 269 'geshi_header' => 'div', # 'div' (default) or 'pre' to surround code block 270 'geshi_line_numbers' => '1', # disable line numbers (0), or enable normal (1) or fancy line numbers (2) 271 'geshi_tab_width' => '4', # set tab width 272 'grabcode_button' => '1', # allow code block downloading 273 274 'wikiping_server' => '', 275 276 'default_write_acl' => '+', 277 'default_read_acl' => '*', 278 'default_comment_read_acl' => '*', 279 'default_comment_post_acl' => '+', 280 'allow_user_registration' => '1', 281 'enable_version_check' => '1', 282 'version_check_interval' => '1h' 283 ); 284 285 // load config 286 $wakkaConfig = array(); 287 if (file_exists('wakka.config.php')) rename('wakka.config.php', 'wikka.config.php"'); // upgrade from Wakka 288 #if (!$configfile = GetEnv("WAKKA_CONFIG")) $configfile = "wikka.config.php"; 289 if (defined('WAKKA_CONFIG')) // use a define instead of GetEnv [SEC] 290 { 291 $configfile = WAKKA_CONFIG; 292 } 293 else 294 { 295 $configfile = 'wikka.config.php'; 296 } 297 if (file_exists($configfile)) include($configfile); 298 $wakkaConfigLocation = $configfile; 351 299 352 300 // remove obsolete config settings (should come before merge!) … … 354 302 if (isset($wakkaConfig['header_action'])) 355 303 { 356 unset($wakkaConfig['header_action']); //since 1.1. 7357 } 358 if (isset($wakkaConfig['footer_action'])) //since 1.1. 7304 unset($wakkaConfig['header_action']); //since 1.1.6.4 305 } 306 if (isset($wakkaConfig['footer_action'])) //since 1.1.6.4 359 307 { 360 308 unset($wakkaConfig['footer_action']); 361 309 } 362 if (isset($wakkaConfig['stylesheet'])) 363 { 364 unset($wakkaConfig['stylesheet']); //since 1.2 365 } 366 if (isset($wakkaConfig['navigation_links'])) 367 { 368 unset($wakkaConfig['navigation_links']); //since 1.2 369 } 370 if (isset($wakkaConfig['logged_in_navigation_links'])) 371 { 372 unset($wakkaConfig['logged_in_navigation_links']); //since 1.2 373 } 374 375 // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 376 /** 377 * 3. Now, the default configuration is merged with any already-existing (and 378 * maybe updated) site configuration. 379 * If a new install or upgrade is needed, the installer will ultimately write an 380 * (updated) site configuration. 381 */ 382 $wakkaConfig = array_merge($wakkaDefaultConfig, $wakkaConfig); 383 //--------------------- (DEFAULT) CONFIGURATION READY -------------------------- 384 385 386 // ------------------------------ LANGUAGE FILE -------------------------------- 387 // --- In an existing installation, the actual language choice is picked up from 388 // the configuration; otherwise an initial 'default_language' setting is 389 // created using the system language default. 390 // --- Dependencies: 391 // - CONFIG_DEFAULT_LANGUAGE and WIKKA_LANG_PATH must have been defined 392 // - Error message to show when no language file could be loaded must 393 // have been defined 394 // @@@ maybe NOT load this when we don't have a configuration file (and thus 395 // need to do a NEW install)? isset($wakkaConfig['default_lang']) - it would 396 // prevent dynamic language switching during installation...? 397 if ($debug) echo "get language file...<br/>\n"; 398 /** 399 * Include language file if one exists. 400 * 401 * Language files are bundled under <b>lang/</b> in a 402 * folder named after their ISO 639-1 code (e.g. 'en' for English). 403 * 404 * Other language files that exist in the language folder will be 405 * included as well (useful for plugins that define their own 406 * language strings). 407 */ 408 $default_lang = $wakkaConfig['default_lang']; 409 $lang_base_dir = 'lang'; 410 $fallback_lang = 'en'; // should always be available 411 $default_language_file = $lang_base_dir.DIRECTORY_SEPARATOR.$default_lang.DIRECTORY_SEPARATOR.$default_lang.'.inc.php'; 412 $fallback_language_file = $lang_base_dir.$fallback_lang.DIRECTORY_SEPARATOR.$fallback_lang.'.inc.php'; 413 $language_file_not_found = sprintf(ERROR_LANGUAGE_FILE_MISSING,$default_language_file); 414 // load language package if it exists 415 if (file_exists($default_language_file)) 416 { 417 /** 418 * Check for other language files (i.e., for plugins) 419 */ 420 $lang_dir = $lang_base_dir.DIRECTORY_SEPARATOR.$default_lang; 421 $hdir = opendir($lang_dir); 422 if(FALSE !== $hdir) 423 { 424 while(FALSE !== ($file = readdir($hdir))) 425 { 426 if(0 == preg_match('/\.inc\.php$/', $file)) 427 { 428 continue; // .inc.php files only! 429 } 430 require_once $lang_dir.DIRECTORY_SEPARATOR.$file; 431 } 432 } 433 434 /** 435 * Language file for configured default language. 436 */ 437 require_once $default_language_file; 438 } 439 elseif (file_exists($fallback_language_file)) 440 { 441 /** 442 * Check for other language files (i.e., for plugins) 443 */ 444 $lang_dir = $lang_base_dir.DIRECTORY_SEPARATOR.$fallback_lang; 445 $hdir = opendir($lang_dir); 446 if(FALSE !== $hdir) 447 { 448 while(FALSE !== ($file = readdir($hdir))) 449 { 450 if(0 == preg_match('/\.inc\.php$/', $file)) 451 { 452 continue; // .inc.php files only! 453 } 454 require_once $lang_dir.DIRECTORY_SEPARATOR.$file; 455 } 456 } 457 458 /** 459 * Language file for system default language: fallback. 460 */ 461 require_once $fallback_language_file; // silent fallback 462 } 463 else 464 { 465 die($language_file_not_found); # fatalerror - local error message in English because we don't _have_ a language file(!) 466 } 467 468 /* 469 * Defines the (configurable) default language. Wikka will attempt to 470 * oad the corresponding language file. This value is directly used 471 * here in wikka.php but also used as the default value in the default 472 * configuration file. 473 */ 474 if (!defined('DEFAULT_FALLBACK_LANGUAGE')) define('DEFAULT_FALLBACK_LANGUAGE' , $fallback_lang); 475 476 // ---------------------------- END LANGUAGE FILE ------------------------------ 477 478 479 //------------------------------ ENVIRONMENT ----------------------------------- 480 if ($debug) echo "handle magic quotes...<br/>\n"; 481 // --- needed (just) before we start looking at cookies and get / post parameters 482 set_magic_quotes_runtime(0); 483 if (get_magic_quotes_gpc()) 484 { 485 magicQuotesWorkaround($_POST); 486 magicQuotesWorkaround($_GET); 487 magicQuotesWorkaround($_COOKIE); 488 } 489 //---------------------------- END ENVIRONMENT --------------------------------- 490 491 492 // ----------------------------- MAINTENANCE LOCK ------------------------------ 493 if ($debug) echo "maintenance lock (if needed)...<br/>\n"; 494 // --- requires SOME language file to be loaded with error message definition 495 // --- BUT requires a USER-defined config value, so installer needs to have run 496 // at some time - IOW we need an existing installation for this to work 310 311 // Remove old stylesheet, #6 312 if(isset($wakkaConfig['stylesheet'])) 313 { 314 unset($wakkaConfig['stylesheet']); // since 1.2 315 } 316 317 // Add plugin paths if they do not already exist 318 if(isset($wakkaConfig['action_path']) && preg_match('/plugins\/actions/', $wakkaConfig['action_path']) <= 0) 319 $wakkaConfig['action_path'] = "plugins/actions," . $wakkaConfig['action_path']; 320 if(isset($wakkaConfig['handler_path']) && preg_match('/plugins\/handlers/', $wakkaConfig['handler_path']) <= 0) 321 $wakkaConfig['handler_path'] = "plugins/handlers," . $wakkaConfig['handler_path']; 322 if(isset($wakkaConfig['wikka_template_path']) && preg_match('/plugins\/templates/', $wakkaConfig['wikka_template_path']) <= 0) 323 $wakkaConfig['wikka_template_path'] = "plugins/templates," . $wakkaConfig['wikka_template_path']; 324 if(isset($wakkaConfig['wikka_formatter_path']) && preg_match('/plugins\/formatters/', $wakkaConfig['wikka_formatter_path']) <= 0) 325 $wakkaConfig['wikka_formatter_path'] = "plugins/formatters," . $wakkaConfig['wikka_formatter_path']; 326 327 $wakkaConfig = array_merge($wakkaDefaultConfig, $wakkaConfig); // merge defaults with config from file 328 497 329 /** 498 330 * Check for locking. … … 500 332 if (file_exists('locked')) 501 333 { 502 // init503 $ask = 0;504 505 334 // read password from lockfile 506 $lines = file( 'locked');335 $lines = file("locked"); 507 336 $lockpw = trim($lines[0]); 508 337 509 // is authentication given? 510 if (isset($_SERVER['PHP_AUTH_USER'])) 511 { 512 if (!(($_SERVER['PHP_AUTH_USER'] == 'admin') && ($_SERVER['PHP_AUTH_PW'] == $lockpw))) 513 { 338 // is authentification given? 339 if (isset($_SERVER["PHP_AUTH_USER"])) { 340 if (!(($_SERVER["PHP_AUTH_USER"] == "admin") && ($_SERVER["PHP_AUTH_PW"] == $lockpw))) { 514 341 $ask = 1; 515 342 } 516 // authenticated 343 } else { 344 $ask = 1; 345 } 346 347 if ($ask) { 348 header("WWW-Authenticate: Basic realm=\"".$wakkaConfig["wakka_name"]." Install/Upgrade Interface\""); 349 header("HTTP/1.0 401 Unauthorized"); 350 print WIKI_UPGRADE_NOTICE; 351 exit; 352 } 353 } 354 355 /** 356 * Compare versions, start installer if necessary. 357 */ 358 if (!isset($wakkaConfig['wakka_version'])) $wakkaConfig['wakka_version'] = 0; 359 if ($wakkaConfig['wakka_version'] !== WAKKA_VERSION) 360 { 361 /** 362 * Start installer. 363 * 364 * Data entered by the user is submitted in $_POST, next action for the 365 * installer (which will receive this data) is passed as a $_GET parameter! 366 */ 367 $installAction = 'default'; 368 if (isset($_GET['installAction'])) $installAction = trim($_GET['installAction']); #312 369 if (file_exists('setup'.DIRECTORY_SEPARATOR.'header.php')) 370 include('setup'.DIRECTORY_SEPARATOR.'header.php'); else print '<em class="error">'.ERROR_SETUP_HEADER_MISSING.'</em>'; #89 371 if 372 (file_exists('setup'.DIRECTORY_SEPARATOR.$installAction.'.php')) 373 include('setup'.DIRECTORY_SEPARATOR.$installAction.'.php'); else print '<em class="error">'.ERROR_SETUP_FILE_MISSING.'</em>'; #89 374 if (file_exists('setup'.DIRECTORY_SEPARATOR.'footer.php')) 375 include('setup'.DIRECTORY_SEPARATOR.'footer.php'); else print '<em class="error">'.ERROR_SETUP_FOOTER_MISSING.'</em>'; #89 376 exit; 377 } 378 379 /** 380 * Start session. 381 */ 382 $base_url_path = preg_replace('/wikka\.php/', '', $_SERVER['SCRIPT_NAME']); 383 $wikka_cookie_path = ('/' == $base_url_path) ? '/' : substr($base_url_path,0,-1); 384 session_set_cookie_params(0, $wikka_cookie_path); 385 session_name(md5(BASIC_COOKIE_NAME.$wakkaConfig['wiki_suffix'])); 386 session_start(); 387 388 // fetch wakka location 389 /** 390 * Fetch wakka location (requested page + parameters) 391 * 392 * @todo files action uses POST, everything else uses GET #312 393 */ 394 $wakka = $_GET['wakka']; #312 395 396 /** 397 * Remove leading slash. 398 */ 399 $wakka = preg_replace("/^\//", "", $wakka); 400 401 /** 402 * Extract pagename and handler from URL 403 * 404 * Note this splits at the FIRST / so $handler may contain one or more slashes; 405 * this is not allowed, and ultimately handled in the Handler() method. [SEC] 406 */ 407 if (preg_match("#^(.+?)/(.*)$#", $wakka, $matches)) list(, $page, $handler) = $matches; 408 else if (preg_match("#^(.*)$#", $wakka, $matches)) list(, $page) = $matches; 409 //Fix lowercase mod_rewrite bug: URL rewriting makes pagename lowercase. #135 410 if ((strtolower($page) == $page) && (isset($_SERVER['REQUEST_URI']))) #38 411 { 412 $pattern = preg_quote($page, '/'); 413 if (preg_match("/($pattern)/i", urldecode($_SERVER['REQUEST_URI']), $match_url)) 414 { 415 $page = $match_url[1]; 416 } 417 } 418 419 /** 420 * Create Wakka object 421 */ 422 $wakka = instantiate('Wakka',$wakkaConfig); 423 424 /** 425 * Check for database access. 426 */ 427 if (!$wakka->dblink) 428 { 429 echo '<em class="error">'.ERROR_NO_DB_ACCESS.'</em>'; 430 exit; 431 } 432 433 /** 434 * Save session ID 435 */ 436 $user = $wakka->GetUser(); 437 // Only store sessions for real users! 438 if(NULL != $user) 439 { 440 $res = $wakka->LoadSingle("SELECT * FROM ".$wakka->config['table_prefix']."sessions WHERE sessionid='".session_id()."' AND userid='".$user['name']."'"); 441 if(isset($res)) 442 { 443 // Just update the session_start time 444 $wakka->Query("UPDATE ".$wakka->config['table_prefix']."sessions SET session_start=FROM_UNIXTIME(".$wakka->GetMicroTime().") WHERE sessionid='".session_id()."' AND userid='".$user['name']."'"); 517 445 } 518 446 else 519 447 { 520 $ask = 1; 448 // Create new session record 449 $wakka->Query("INSERT INTO ".$wakka->config['table_prefix']."sessions (sessionid, userid, session_start) VALUES('".session_id()."', '".$user['name']."', FROM_UNIXTIME(".$wakka->GetMicroTime()."))"); 521 450 } 522 523 // request authentication 524 if ($ask) 525 { 526 header('WWW-Authenticate: Basic realm="'.$wakkaConfig['wakka_name'].' Install/Upgrade Interface"'); 527 header('HTTP/1.0 401 Unauthorized'); 528 die(STATUS_WIKI_UPGRADE_NOTICE); #fatalerror 529 } 530 } 531 // --------------------------- END MAINTENANCE LOCK ---------------------------- 532 533 534 // ---------------------------------- INSTALLER -------------------------------- 535 if ($debug) echo "installer (if needed)...<br/>\n"; 536 // --- requires at least default configuration to be present 537 // constants WAKKA_VERSION, SITE_CONFIGFILE and WIKKA_SETUP_PATH must have been defined 538 // language file must be loaded for error message 539 /** 540 * Compare versions, start installer if necessary. 541 */ 542 if (!isset($wakkaConfig['wakka_version'])) 543 { 544 $wakkaConfig['wakka_version'] = 0; 545 } 546 $version1 = array(); 547 $version2 = array(); 548 // We are interested in the version root (i.e., given "trunk-r1009" or 549 // "trunk_r1009", we only want to compare against "trunk"). 550 $version1 = preg_split('/-|_/', WAKKA_VERSION); 551 // There is some weirdness with the way PHP either (1) returns from 552 // preg_replace when the search string is "0", or (2) a type 553 // comparison beetween a string and an integer 0. In any case, 554 // remove the if clause below at your own risk. 555 if(0 === $wakkaConfig['wakka_version']) 556 { 557 $version2[0] = $wakkaConfig['wakka_version']; 558 } 559 else 560 { 561 $version2 = preg_split('/-|_/', $wakkaConfig['wakka_version']); 562 } 563 if ( $version1[0] !== $version2[0] ) 564 //if($wakkaConfig['wakka_version'] !== WAKKA_VERSION) 565 { 566 // set up (intended) config location for the installer 567 #$wakkaConfigLocation = SITE_CONFIGFILE; // @@@ use directly in installer 568 if ($debug) echo 'site configuration file (to be) lodated at: '.SITE_CONFIGFILE."<br/>\n"; 569 $htaccessLocation = str_replace('\\', '/', dirname(__FILE__)).DIRECTORY_SEPARATOR.'.htaccess'; 570 #if (file_exists('setup'.DIRECTORY_SEPARATOR.'index.php')) #89 571 if (file_exists(WIKKA_SETUP_PATH.DIRECTORY_SEPARATOR.'index.php')) # #89 572 { 573 // run the installer 574 #include 'setup'.DIRECTORY_SEPARATOR.'index.php'; #89 575 include WIKKA_SETUP_PATH.DIRECTORY_SEPARATOR.'index.php'; # #89 576 return; // prevent "fall-through" 577 } 578 else 579 { 580 // installer can not be run 581 die(WIKKA_ERROR_SETUP_FILE_MISSING); #fatalerror 582 } 583 } 584 // -------------------------------- END INSTALLER ------------------------------ 585 586 587 // ---------------------------- GET READY TO ROLL ------------------------------ 588 if ($debug) echo "get ready to roll...<br/>\n"; 589 if ($debug) echo '=> register_globals: '.ini_get('register_globals')."</br>\n"; 590 // --- - requires SOME language file to be loaded for error messages 591 // - constants WIKKA_LIBRARY_PATH, BASIC_SESSION_NAME and MINIMUM_MYSQL_VERSION 592 // must have been defined 593 // - Compatibility library must be included for MySQL version check 594 /** 595 * Include main library if it exists. 596 * 597 * @see libs/Wakka.class.php 598 */ 599 $wakka_library = WIKKA_LIBRARY_PATH.DIRECTORY_SEPARATOR.'Wakka.class.php'; 600 $wakka_library_missing = sprintf(ERROR_WAKKA_LIBRARY_MISSING, $wakka_library); 601 if (file_exists($wakka_library)) 602 { 603 require_once $wakka_library; 604 } 605 else 606 { 607 die($wakka_library_missing); #fatalerror 608 } 609 610 /** 611 * Start session. 612 * @todo consider whether to derive the complete set of paths (but earlier) 613 * and pass them to the Wakka object; that way we still derive only once 614 * but the installer can use them as well. 615 */ 616 617 // start session 618 session_name(md5(BASIC_SESSION_NAME.$wakkaConfig['wiki_suffix'])); 619 session_set_cookie_params(0, WIKKA_COOKIE_PATH); // default path is '/' - we don't want that! this call overrides php.ini settings 620 session_cache_limiter(''); # #279 621 session_start(); 622 623 /** 624 * Fetch wakka value (requested page + parameters) 625 * 626 * @todo files action uses POST, everything else uses GET #312 627 * @todo use different name - $wakka clashes with $wakka object (which should be #Wakka) 628 */ 629 $wakka_request = $_GET['wakka']; # #312 630 631 /** 632 * Remove leading slash. 633 * 634 * @todo use different name - $wakka_request clashes with $wakka_request object (which should be #Wakka) 635 */ 636 $wakka_request = preg_replace("/^\//", "", $wakka_request); 637 638 /** 639 * Extract pagename and handler from URL 640 * 641 * Note this splits at the FIRST '/', so $method may contain one or more slashes; 642 * this is not allowed, and ultimately handled in the Method() method. [SEC] 643 * 644 * @todo devise a more intelligent page and handler derivation and error out 645 * when URL syntax isn't correct. E.g., explode at '/' - there may only 646 * be one or two elements in the resulting array [SEC] 647 */ 648 // init 649 $handler = ''; 650 // analyze request to derive page and handler 651 if (preg_match("#^(.+?)/(.*)$#", $wakka_request, $matches)) 652 { 653 list(, $page, $handler) = $matches; 654 } 655 else if (preg_match("#^(.*)$#", $wakka_request, $matches)) 656 { 657 list(, $page) = $matches; 658 } 659 660 //Fix lowercase mod_rewrite bug: URL rewriting makes pagename lowercase. #135 661 if ((strtolower($page) == $page) && (isset($_SERVER['REQUEST_URI']))) # #38 662 { 663 $pattern = preg_quote($page, '/'); 664 if (preg_match('/('.$pattern.')/i', urldecode($_SERVER['REQUEST_URI']), $match_url)) 665 { 666 $page = $match_url[1]; 667 } 668 } 669 if ($debug) echo 'page: '.$page."<br/>\n"; 670 if ($debug) echo 'handler: '.$handler."<br/>\n"; 671 672 /** 673 * Create Wakka object. 674 * 675 * @todo use name with Capital for object 676 */ 677 $wakka = instantiate('Wakka',$wakkaConfig); 678 679 /** 680 * Check if we have database access. 681 * @todo use name with Capital for object 682 */ 683 if (!$wakka->dblink) 684 { 685 $mysql_access_error = STATUS_WIKI_UNAVAILABLE.'<br/>'.ERROR_NO_DB_ACCESS; 686 die($mysql_access_error); #FatalErrorAfterLangFileIncluded 687 } 688 689 /** 690 * We have database access: now check if the version is one we support. 691 */ 692 $errors = array(); 693 $mysql_version = getMysqlVersion($errors); 694 if (($n = count($errors)) > 0) 695 { 696 for ($i=0; $i <= $n; $i++) 697 { 698 #echo 'MySQL error: '.$errors['no'][$i].' - '.$errors['txt'][$i]."<br/>\n"; # i18n @@@ 699 printf(WIKKA_ERROR_MYSQL_ERROR, $errors['no'][$i], $errors['txt'][$i]); 700 echo "<br/>\n"; 701 } 702 $mysql_version_retrieval_error = ERROR_RETRIEVAL_MYSQL_VERSION; 703 die($mysql_version_retrieval_error); 704 } 705 if ($debug) echo 'MySQL version: '.$mysql_version."<br/>\n"; 706 if ($mysql_version !== FALSE && 707 version_compare($mysql_version, MINIMUM_MYSQL_VERSION,'<') // < MYSQL minimum version?? 708 ) 709 { 710 $mysql_version_error = sprintf(ERROR_WRONG_MYSQL_VERSION, MINIMUM_MYSQL_VERSION); 711 die($mysql_version_error); #FatalErrorAfterLangFileIncluded 712 } 713 714 /** 715 * Save session ID 716 */ 717 $user = $wakka->GetUser(); 718 // Only store sessions for real users! 719 if(NULL != $user) 720 { 721 $res = $wakka->LoadSingle("SELECT * FROM ".$wakka->config['table_prefix']."sessions WHERE sessionid='".session_id()."' AND userid='".$user['name']."'"); 722 if(!empty($res)) 723 { 724 // Just update the session_start time 725 $wakka->Query("UPDATE ".$wakka->config['table_prefix']."sessions SET session_start=NOW() WHERE sessionid='".session_id()."' AND userid='".$user['name']."'"); 726 } 727 else 728 { 729 // Create new session record 730 $wakka->Query("INSERT INTO ".$wakka->config['table_prefix']."sessions (sessionid, userid, session_start) VALUES('".session_id()."', '".$user['name']."', NOW())"); 731 } 732 } 733 734 // ---------------------------- READY TO ROLL NOW ------------------------------ 735 // ---------------------------------- ROLL! ------------------------------------ 736 // --- Dependencies: 737 // - language file loaded 738 // ....- configuration defined 739 // - Wakka class instantiated 740 // - Compatibility library loaded 741 if ($debug) echo "roll...<br/>\n"; 742 $debug_info = ''; 743 if (!$debug) 744 { 745 $debug_info = ob_get_contents(); 746 @ob_end_clean(); // in case there was a previous buffer left from debug mode! 747 ob_start(); // start buffering output 748 } 451 } 452 749 453 /** 750 454 * Run the engine. 751 * 752 * @todo use name with Capital for object; also clashes with $wakka (above) now 753 */ 754 $wakka->Run($page, $handler); // This is where it all happens! 755 // ------------------------------- PAGE ROLLED --------------------------------- 756 757 758 // ------------------------- WRAP UP AND DISPLAY PAGE -------------------------- 759 if ($debug) echo "wrap up...<br/>\n"; 760 $content = ob_get_contents(); // pick up contents of buffer 455 */ 456 if (!isset($handler)) $handler=''; 457 $wakka->Run($page, $handler); 458 $content = ob_get_contents(); 761 459 /** 762 460 * Use gzip compression if possible. 763 * 764 * @todo use config value to optionally turn off gzip-encoding here #541 765 */ 766 if (isset($_SERVER['HTTP_ACCEPT_ENCODING']) && 767 strstr($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip') && 768 function_exists('gzencode') # #38 769 ) 461 */ 462 /* 463 if ( isset($_SERVER['HTTP_ACCEPT_ENCODING']) && strstr ($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip') && function_exists('gzencode') ) #38 770 464 { 771 465 // Tell the browser the content is compressed with gzip 772 header ('Content-Encoding: gzip');466 header ("Content-Encoding: gzip"); 773 467 $page_output = gzencode($content); 774 //$page_length = strlen($page_output); // We no longer send Content-Length header - see below 775 } 776 else 777 { 468 $page_length = strlen($page_output); 469 } else { 470 */ 778 471 $page_output = $content; 779 //$page_length = strlen($page_output); // We no longer send Content-Length header - see below 780 } 781 782 $etag = md5($content); 783 header('ETag: '.$etag); // @@@ should not contain footer with page generation time! 784 785 if (!isset($wakka->do_not_send_anticaching_headers) || 786 (!$wakka->do_not_send_anticaching_headers) # #279 787 ) 788 { 789 header('Expires: Thu, 19 Nov 1981 08:52:00 GMT'); 790 header('Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0'); 791 header('Pragma: no-cache'); 792 } 793 794 /** 795 * We no longer send Content-Length header, due to a bug in PHP {@link http://wush.net/trac/wikka/ticket/152}. 796 * The Webserver will be clever enough to use chunked transfer encoding. #152 797 * @todo remove $page_length calculation above. 798 */ 799 //header('Content-Length: '.$page_length); 800 @ob_end_clean(); 472 $page_length = strlen($page_output); 473 //} 474 475 // header("Cache-Control: pre-check=0"); 476 header("Cache-Control: no-cache"); 477 // header("Pragma: "); 478 // header("Expires: "); 479 480 $etag = md5($content); 481 header('ETag: '.$etag); 482 483 header('Content-Length: '.$page_length); 484 ob_end_clean(); 801 485 802 486 /** … … 804 488 */ 805 489 echo $page_output; 806 // --------------------------------- ALL DONE ----------------------------------807 490 ?>