diff --git a/language/english.php b/language/english.php index f3507026f..582108e3b 100644 --- a/language/english.php +++ b/language/english.php @@ -1360,6 +1360,32 @@ 'value' => 'Value', ); +############################################################################### +# admin/router.php + +$LANG_ROUTER = array( + 1 => 'URL routing', + 2 => 'Routing Manager', + 3 => 'ID', + 4 => 'method', + 5 => 'rule', + 6 => 'route', + 7 => 'priority', + 8 => 'Increase priority', + 9 => 'Decrease priority', + 10 => 'Edit routing', + 11 => 'To modify or delete a route, click on the route\'s edit icon below. To create a new route, click on "Create New" above. When you use placeholders (@), you must define the same placeholders in a rule and its route.', + 12 => 'Bad request method', + 13 => 'Rule is a mandatory item.', + 14 => 'Route is a mandatory item.', + 15 => 'Placeholders (@) in a rule and those in a route must be the same.', + 16 => 'Route must not start with "/index.php/".', + 17 => 'Database error occurred.', + 18 => 'To enable URL routing, you have to enable URL rewrite in the Configuration.', + 19 => 'To enable URL routing, you have to enable URL routing in the Configuration.', + 20 => '', +); + ############################################################################### # confirmation and error messages @@ -1476,6 +1502,9 @@ 118 => 'Click to select a date', 119 => 'More..', 120 => 'Send this?', + 121 => 'Saved a URL routing item.', + 122 => 'Could not save a URL routing item.', + 123 => 'Deleted a URL routing item.', 130 => 'Your language item has been successfully deleted.', 131 => 'Your language item has been successfully saved.', 140 => 'Deleted comment(s).', @@ -2178,6 +2207,7 @@ 'censorlist' => "Censor List", 'ip_lookup' => "IP Lookup", 'url_rewrite' => "Enable URL Rewrite", + 'url_routing' => 'Enable URL routing', 'cdn_hosted' => "Use CDN-hosted copy of jQuery", 'meta_tags' => "Meta Tags", 'meta_description' => "Default Meta Description", @@ -2400,7 +2430,8 @@ 33 => array('Disabled' => 0, 'Enabled' => 1, 'Enabled (No Links)' => 2, 'Enabled (No Outbound Links)' => 3), 34 => array('grid' => 'grid', 'list' => 'list'), 35 => array('default' => 'default', 'Name (asc)' => 'NAME_ASC', 'Name (desc)' => 'NAME_DESC', 'Type (asc)' => 'TYPE_ASC', 'Type (desc)' => 'TYPE_DESC', 'Modified (asc)' => 'MODIFIED_ASC', 'Modified (desc)' => 'MODIFIED_DESC'), - 36 => array('False' => 'false', 'Frontpage only' => 'frontpage', 'Frontpage and Topics' => 'frontpage_topics') + 36 => array('False' => 'false', 'Frontpage only' => 'frontpage', 'Frontpage and Topics' => 'frontpage_topics'), + 37 => array('Disabled' => 0, 'Enabled(with "index.php")' => 1, 'Enabled(without "index.php")' => 2), ); ################################################################################ diff --git a/language/english_utf-8.php b/language/english_utf-8.php index 52c3bc4ac..ad1dbf406 100644 --- a/language/english_utf-8.php +++ b/language/english_utf-8.php @@ -1351,6 +1351,31 @@ 55 => 'Articles' ); +############################################################################### +# admin/router.php + +$LANG_ROUTER = array( + 1 => 'URL routing', + 2 => 'Routing Manager', + 3 => 'ID', + 4 => 'method', + 5 => 'rule', + 6 => 'route', + 7 => 'priority', + 8 => 'Increase priority', + 9 => 'Decrease priority', + 10 => 'Edit routing', + 11 => 'To modify or delete a route, click on the route\'s edit icon below. To create a new route, click on "Create New" above. When you use placeholders (@), you must define the same placeholders in a rule and its route.', + 12 => 'Bad request method', + 13 => 'Rule is a mandatory item.', + 14 => 'Route is a mandatory item.', + 15 => 'Placeholders (@) in a rule and those in a route must be the same.', + 16 => 'Route must not start with "/index.php/".', + 17 => 'Database error occurred.', + 18 => 'To enable URL routing, you have to enable URL rewrite.', + 19 => '', +); + ############################################################################### # confirmation and error messages @@ -1467,6 +1492,9 @@ 118 => 'Click to select a date', 119 => 'More..', 120 => 'Send this?', + 121 => 'Saved a URL routing item.', + 122 => 'Could not save a URL routing item.', + 123 => 'Deleted a URL routing item.', 130 => 'Deleted comment(s).', 131 => 'Failed to delete a comment.', 132 => 'Approved comment(s).', @@ -2176,6 +2204,7 @@ 'censorlist' => "Censor List", 'ip_lookup' => "IP Lookup", 'url_rewrite' => "Enable URL Rewrite", + 'url_routing' => 'Enable URL routing', 'cdn_hosted' => "Use CDN-hosted copy of jQuery", 'meta_tags' => "Meta Tags", 'meta_description' => "Default Meta Description", diff --git a/language/japanese_utf-8.php b/language/japanese_utf-8.php index 56cc9154b..372097ddb 100644 --- a/language/japanese_utf-8.php +++ b/language/japanese_utf-8.php @@ -1362,6 +1362,32 @@ 'value' => '値', ); +############################################################################### +# admin/router.php + +$LANG_ROUTER = array( + 1 => 'URLルーティング', + 2 => 'ルーティング管理', + 3 => 'ID', + 4 => 'メソッド', + 5 => 'ルール', + 6 => 'ルート', + 7 => '優先順位', + 8 => '優先順位を上げる', + 9 => '優先順位を下げる', + 10 => 'ルーティングの編集', + 11 => '

ルーティングの編集・削除は編集アイコンを、作成は上の「新規作成」をクリックしてください。優先順位の変更は、[↑][↓]をクリックしてください。

', + 12 => 'リクエストメソッドが不正です。', + 13 => 'ルールは必須項目です。', + 14 => 'ルートは必須項目です。', + 15 => 'ルールとルートで同じプレースホルダー(@)を定義しなければなりません。', + 16 => 'ルートの先頭を "/index.php/" とすることはできません。', + 17 => 'データベース操作でエラーが発生しました。', + 18 => 'URLルーティングを有効にするには、コンフィギュレーションでURLリライトを有効にしてください。', + 19 => 'URLルーティングを有効にするには、コンフィギュレーションでURLルーティングを有効にしてください。', + 20 => '', +); + ############################################################################### # confirmation and error messages @@ -1478,6 +1504,9 @@ 118 => 'クリックして日付を選択してください', 119 => 'More..', 120 => 'この項目を送信しますか?', + 121 => 'URLルーティングのデータを保存しました。', + 122 => 'URLルーティングのデータを保存できませんでした。', + 123 => 'URLルーティングのデータを削除しました。', 130 => '言語アイテムを削除しました。', 131 => '言語アイテムを保存しました。', 140 => 'コメントを削除しました。', @@ -2194,6 +2223,7 @@ 'censorlist' => 'バッドワード', 'ip_lookup' => 'IPアドレス検索', 'url_rewrite' => 'URLリライト', + 'url_routing' => 'URLルーティング', 'cdn_hosted' => 'CDNのjQueryを使用する', 'meta_tags' => 'メタタグ', 'meta_description' => 'サイトの説明文のメタタグ', @@ -2410,7 +2440,8 @@ 33 => array('無効にする' => 0, '有効にする' => 1, '有効にする(リンクなし)' => 2, '有効にする(外部リンクなし)' => 3), 34 => array('グリッド' => 'grid', 'リスト' => 'list'), 35 => array('デフォルト' => 'default', '名前(昇順)' => 'NAME_ASC', '名前(降順)' => 'NAME_DESC', '種類(昇順)' => 'TYPE_ASC', '種類(降順)' => 'TYPE_DESC', '変更日時(昇順)' => 'MODIFIED_ASC', '変更日時(降順)' => 'MODIFIED_DESC'), - 36 => array('False' => 'false', 'Frontpage only' => 'frontpage', 'Frontpage and Topics' => 'frontpage_topics') + 36 => array('False' => 'false', 'Frontpage only' => 'frontpage', 'Frontpage and Topics' => 'frontpage_topics'), + 37 => array('無効' => 0, '有効(index.phpあり)' => 1, '有効(index.phpなし)' => 2), ); ############################################################################### diff --git a/public_html/admin/configuration_validation.php b/public_html/admin/configuration_validation.php index 6f0e01443..6999b7166 100644 --- a/public_html/admin/configuration_validation.php +++ b/public_html/admin/configuration_validation.php @@ -2,7 +2,7 @@ /* Reminder: always indent with 4 spaces (no tabs). */ // +---------------------------------------------------------------------------+ -// | Geeklog 1.7 | +// | Geeklog 2.1 | // +---------------------------------------------------------------------------+ // | configuration_validation.php | // | | @@ -30,7 +30,7 @@ // | | // +---------------------------------------------------------------------------+ -if (strpos(strtolower($_SERVER['PHP_SELF']), 'configuration_validation.php') !== false) { +if (stripos($_SERVER['PHP_SELF'], 'configuration_validation.php') !== false) { die('This file can not be used on its own!'); } @@ -50,6 +50,7 @@ 'message' => isset($LANG_VALIDATION['yearOrRange']) ? $LANG_VALIDATION['yearOrRange'] : $LANG_VALIDATION['default'] ); $_CONF_VALIDATE['Core']['url_rewrite'] = array('rule' => 'boolean'); +$_CONF_VALIDATE['Core']['url_routing'] = array('rule' => array('inList', array(0, 1, 2), false)); $_CONF_VALIDATE['Core']['cdn_hosted'] = array('rule' => 'boolean'); $_CONF_VALIDATE['Core']['meta_tags'] = array('rule' => array('inList', array(0, 1, 2), false)); $_CONF_VALIDATE['Core']['meta_description'] = array('rule' => 'stringOrEmpty'); @@ -719,5 +720,3 @@ // Subgroup Filemanager, Tab Audios $_CONF_VALIDATE['Core']['filemanager_show_audio_player'] = array('rule' => 'boolean'); //$_CONF_VALIDATE['Core']['filemanager_audios_ext'] = array('rule' => 'boolean'); - -?> diff --git a/public_html/admin/install/config-install.php b/public_html/admin/install/config-install.php index 19fd43f97..01deee8da 100644 --- a/public_html/admin/install/config-install.php +++ b/public_html/admin/install/config-install.php @@ -2,7 +2,7 @@ /* Reminder: always indent with 4 spaces (no tabs). */ // +---------------------------------------------------------------------------+ -// | Geeklog 1.6 | +// | Geeklog 2.1 | // +---------------------------------------------------------------------------+ // | config-install.php | // | | @@ -54,6 +54,7 @@ function install_config() $c->add('owner_name','','text',0,0,NULL,1000,TRUE, $me, 0); $c->add('copyrightyear',date('Y'),'text',0,0,NULL,1440,FALSE, $me, 0); $c->add('url_rewrite',FALSE,'select',0,0,1,1800,TRUE, $me, 0); + $c->add('url_routing',0,'select',0,0,37,1850,TRUE, $me, 0); $c->add('cdn_hosted',FALSE,'select',0,0,1,1900,TRUE, $me, 0); $c->add('meta_tags',0,'select',0,0,23,2000,TRUE, $me, 0); $c->add('meta_description','Geeklog - The secure Content Management System.','textarea',0,0,NULL,2010,TRUE, $me, 0); diff --git a/public_html/admin/install/lib-upgrade.php b/public_html/admin/install/lib-upgrade.php index 821d7a4ae..341183f9c 100644 --- a/public_html/admin/install/lib-upgrade.php +++ b/public_html/admin/install/lib-upgrade.php @@ -518,6 +518,15 @@ function INST_doDatabaseUpgrades($current_gl_version) $_SQL = ''; break; + case '2.1.0': + require_once $_CONF['path'] . 'sql/updates/' . $_DB_dbms . '_2.1.0_to_2.1.2.php'; + INST_updateDB($_SQL); + + update_ConfValuesFor212(); + $current_gl_version = '2.1.2'; + $_SQL = ''; + break; + default: $done = true; } diff --git a/public_html/admin/router.php b/public_html/admin/router.php new file mode 100644 index 000000000..3f248b30f --- /dev/null +++ b/public_html/admin/router.php @@ -0,0 +1,569 @@ + $MESSAGE[30]) + ); + COM_accessLog("User {$_USER['username']} tried to illegally access the URL routing administration screen"); + COM_output($display); + exit; +} + +/** + * Shows the URL routing editor + * This will show a URL routing edit form. + * + * @param int $rid ID of URL routing rule to edit + * @return string HTML for URL routing editor + */ +function getRouteEditor($rid = 0) +{ + global $_CONF, $_TABLES, $LANG_ROUTER, $LANG_ADMIN, $MESSAGE, $securityToken; + + $retval = ''; + + $A = array( + 'rid' => $rid, + 'method' => Router::HTTP_REQUEST_GET, + 'rule' => '', + 'route' => '', + 'priority' => Router::DEFAULT_PRIORITY, + ); + $rid = intval($rid, 10); + + if ($rid > 0) { + if (DB_count($_TABLES['routes'], 'rid', $rid) == 1) { + $sql = "SELECT * FROM {$_TABLES['routes']} WHERE rid =" . DB_escapeString($rid); + $result = DB_query($sql); + $A = DB_fetchArray($result); + } else { + // Non-existent route + $rid = 0; + $A['rid'] = $rid; + } + } + + $T = COM_newTemplate($_CONF['path_layout'] . 'admin/router'); + $T->set_file('editor', 'routereditor.thtml'); + $routerStart = COM_startBlock($LANG_ROUTER[10], '', COM_getBlockTemplate('_admin_block', 'header')) + . LB . SEC_getTokenExpiryNotice($securityToken); + $T->set_var('start_router_editor', $routerStart); + + if ($rid > 0) { + $deleteButton = ''; + $jsConfirm = ' onclick="return confirm(\'' . $MESSAGE[76] . '\');"'; + $T->set_var(array( + 'delete_option' => sprintf($deleteButton, $jsConfirm), + 'delete_option_no_confirmation' => sprintf($deleteButton, ''), + )); + } + + $T->set_var(array( + 'rid' => $A['rid'], + 'method' => $A['method'], + 'rule' => $A['rule'], + 'route' => $A['route'], + 'priority' => $A['priority'], + 'gltoken_name' => CSRF_TOKEN, + 'gltoken' => $securityToken, + )); + $T->set_var(array( + 'lang_router_rid' => $LANG_ROUTER[3], + 'lang_router_method' => $LANG_ROUTER[4], + 'lang_router_rule' => $LANG_ROUTER[5], + 'lang_router_route' => $LANG_ROUTER[6], + 'lang_router_priority' => $LANG_ROUTER[7], + 'lang_router_notice' => $LANG_ROUTER[20], + 'lang_save' => $LANG_ADMIN['save'], + 'lang_cancel' => $LANG_ADMIN['cancel'], + )); + + $T->set_var( + 'end_block', + COM_endBlock(COM_getBlockTemplate('_admin_block', 'footer')) + ); + $T->parse('output', 'editor'); + $retval .= $T->finish($T->get_var('output')); + + return $retval; +} + +/** + * Field function + * + * @param string $fieldName + * @param string $fieldValue + * @param array $A + * @param array $iconArray + * @param string $extra + * @return string + * @throws InvalidArgumentException + */ +function ADMIN_getListFieldRoutes($fieldName, $fieldValue, $A, $iconArray, $extra = '') +{ + global $_CONF, $LANG_ROUTER, $_IMAGE_TYPE, $securityToken; + + switch ($fieldName) { + case 'rid': + $fieldValue = '' + . $iconArray['edit'] . ''; + break; + + case 'method': + switch (intval($fieldValue, 10)) { + case Router::HTTP_REQUEST_GET: + $fieldValue = 'GET'; + break; + + case Router::HTTP_REQUEST_POST: + $fieldValue = 'POST'; + break; + + case Router::HTTP_REQUEST_PUT: + $fieldValue = 'PUT'; + break; + + case Router::HTTP_REQUEST_DELETE: + $fieldValue = 'DELETE'; + break; + + case Router::HTTP_REQUEST_HEAD: + $fieldValue = 'HEAD'; + break; + + default: + throw new InvalidArgumentException(__FUNCTION__ . ': unknown method "' . $fieldValue . '" was given'); + } + + break; + + case 'rule': + break; + + case 'route': + break; + + case 'priority': + $rid = $A['rid']; + $baseUrl = $_CONF['site_admin_url'] . '/router.php?mode=move&rid=' . $rid . '&' + . CSRF_TOKEN . '=' . $securityToken; + $fieldValue = '' + . '' . $LANG_ROUTER[8] . '' + . $fieldValue + . '' + . '' . $LANG_ROUTER[9] . ''; + break; + + default: + throw new InvalidArgumentException(__FUNCTION__ . ': unknown field name "' . $fieldName . '" was given'); + } + + return $fieldValue; +} + +/** + * Display a list of routes + * + * @return string HTML for the list + */ +function listRoutes() +{ + global $_CONF, $_TABLES, $LANG_ADMIN, $LANG_ROUTER, $_IMAGE_TYPE, $securityToken; + + require_once $_CONF['path_system'] . 'lib-admin.php'; + + // Writing the menu on top + $menu_arr = array( + array( + 'url' => $_CONF['site_admin_url'] . '/router.php?mode=edit&rid=0', + 'text' => $LANG_ADMIN['create_new'], + ), + array( + 'url' => $_CONF['site_admin_url'], + 'text' => $LANG_ADMIN['admin_home'], + ), + ); + + $notice = $LANG_ROUTER[11]; + + if (!isset($_CONF['url_rewrite']) || empty($_CONF['url_rewrite'])) { + $notice .= ' ' . $LANG_ROUTER[18]; + } + + if (!isset($_CONF['url_routing']) || ($_CONF['url_routing'] == Router::ROUTING_DISABLED)) { + $notice .= ' ' . $LANG_ROUTER[19]; + } + + $retval = COM_startBlock($LANG_ROUTER[2], '', COM_getBlockTemplate('_admin_block', 'header')) + . ADMIN_createMenu( + $menu_arr, + $notice, + $_CONF['layout_url'] . '/images/icons/router.' . $_IMAGE_TYPE + ); + + $headerArray = array( # display 'text' and use table field 'field' + array( + 'text' => $LANG_ADMIN['edit'], + 'field' => 'rid', + 'sort' => false, + ), + array( + 'text' => $LANG_ROUTER[4], + 'field' => 'method', + 'sort' => true, + ), + array( + 'text' => $LANG_ROUTER[5], + 'field' => 'rule', + 'sort' => true, + ), + array( + 'text' => $LANG_ROUTER[6], + 'field' => 'route', + 'sort' => true, + ), + array( + 'text' => $LANG_ROUTER[7], + 'field' => 'priority', + 'sort' => true, + ), + ); + + $defaultSortArray = array( + 'field' => 'priority', + 'direction' => 'asc', + ); + + $textArray = array( + 'has_extras' => false, + 'title' => $LANG_ROUTER[1], + 'form_url' => $_CONF['site_admin_url'] . '/router.php', + ); + + $queryArray = array( + 'table' => 'routes', + 'sql' => "SELECT * FROM {$_TABLES['routes']} WHERE (1 = 1) ", + 'query_fields' => array('rule', 'route', 'priority'), + 'default_filter' => COM_getPermSql('AND'), + ); + + $retval .= ADMIN_list( + 'routes', 'ADMIN_getListFieldRoutes', $headerArray, $textArray, + $queryArray, $defaultSortArray, '', $securityToken, '' + ); + + $retval .= COM_endBlock(COM_getBlockTemplate('_admin_block', 'footer')); + + return $retval; +} + +/** + * Save a route into database + * + * @param int $rid + * @param int $method + * @param string $rule + * @param string $route + * @param int $priority + * @return string + */ +function saveRoute($rid, $method, $rule, $route, $priority) +{ + global $_CONF, $_TABLES, $MESSAGE, $LANG_ROUTER; + + $messageText = ''; + + $rid = intval($rid, 10); + $method = intval($method, 10); + $rule = trim($rule); + $route = trim($route); + $priority = intval($priority, 10); + + if (($method < Router::HTTP_REQUEST_GET) || ($method > Router::HTTP_REQUEST_HEAD)) { + $messageText = $LANG_ROUTER[12]; + } elseif ($rule === '') { + $messageText = $LANG_ROUTER[13]; + } elseif ($route === '') { + $messageText = $LANG_ROUTER[14]; + } elseif (substr_count($rule, '@') !== substr_count($route, '@')) { + $messageText = $LANG_ROUTER[15]; + } + + // If a rule doesn't begin with a slash, then add one silently + if (strpos($rule, '/') !== 0) { + $rule = '/' . $rule; + } + + // If a rule starts with "/index.php", then remove it silently + if (stripos($rule, '/index.php') === 0) { + $rule = preg_replace('|^/index\.php|i', '', $rule); + } + + // If a route doesn't begin with a slash, then add one silently + if (strpos($route, '/') !== 0) { + $route = '/' . $route; + } + + // If a route starts with "/index.php/", then make it an error to prevent the script + // from going an infinite loop + if (stripos($route, '/index.php/') === 0) { + $messageText = $LANG_ROUTER[16]; + } + + // Replace & with & + $rule = str_ireplace('&', '&', $rule); + $route = str_ireplace('&', '&', $route); + + // Check if placeholders are the same + $numPlaceHoldersInRule = preg_match_all(Router::PLACEHOLDER_MATCH, $rule, $matchesRule, PREG_SET_ORDER); + $numPlaceHoldersInRoute = preg_match_all(Router::PLACEHOLDER_MATCH, $route, $matchesRoute, PREG_SET_ORDER); + + if ($numPlaceHoldersInRule === $numPlaceHoldersInRoute) { + if ($numPlaceHoldersInRule > 0) { + array_shift($matchesRule); + array_shift($matchesRoute); + + foreach ($matchesRule as $r) { + if (!in_array($r, $matchesRoute)) { + $messageText = $LANG_ROUTER[15]; + break; + } + } + } + } else { + $messageText = $LANG_ROUTER[15]; + } + + // If priority is out of range, then fix it silently + if (($priority < 1) || ($priority > 65535)) { + $priority = Router::DEFAULT_PRIORITY; + } + + if ($messageText !== '') { + $content = COM_showMessageText($messageText, $MESSAGE[122]) . getRouteEditor($rid); + $retval = COM_createHTMLDocument( + $content, + array( + 'pagetitle' => $MESSAGE[122], + ) + ); + + return $retval; + } + + // Save data into database + $rid = DB_escapeString($rid); + $method = DB_escapeString($method); + $rule = DB_escapeString($rule); + $route = DB_escapeString($route); + $priority = DB_escapeString($priority); + + $count = intval(DB_count($_TABLES['routes'], 'rid', $rid), 10); + + if ($count === 0) { + $sql = "INSERT INTO {$_TABLES['routes']} (rid, method, rule, route, priority) " + . "VALUES (NULL, {$method}, '{$rule}', '{$route}', {$priority})"; + } else { + $sql = "UPDATE {$_TABLES['routes']} " + . "SET method = {$method}, rule = '{$rule}', route = '{$route}', priority = {$priority} " + . "WHERE rid = {$rid} "; + } + + for ($i = 0; $i < 5; $i++) { + DB_query($sql); + + if (!DB_error()) { + reorderRoutes(); + + return COM_refresh($_CONF['site_admin_url'] . '/router.php?msg=121'); + } + + // Retry + } + + $content = COM_showMessageText($LANG_ROUTER[17], DB_error()) . getRouteEditor($rid); + $retval = COM_createHTMLDocument( + $content, + array( + 'pagetitle' => $MESSAGE[122], + ) + ); + + return $retval; +} + +/** + * Re-orders all routes in increments of 10 + */ +function reorderRoutes() +{ + global $_TABLES; + + $sql = "SELECT rid FROM {$_TABLES['routes']} ORDER BY priority"; + $result = DB_query($sql); + $rids = array(); + + while (($A = DB_fetchArray($result, false)) !== false) { + $rids[] = intval($A['rid'], 10); + } + + $priority = 100; + $step = 10; + + foreach ($rids as $rid) { + $sql = "UPDATE {$_TABLES['routes']} SET priority = " . DB_escapeString($priority) + . " WHERE rid = " . DB_escapeString($rid); + DB_query($sql); + $priority += $step; + } +} + +/** + * Move a route UP or Down + * + * @param int $rid + */ +function moveRoute($rid) +{ + global $_TABLES, $_FINPUT; + + $rid = intval($rid, 10); + $direction = $_FINPUT->get('dir', ''); + + // if the router id exists + if (DB_count($_TABLES['routes'], 'rid', $rid)) { + $rid = DB_escapeString($rid); + + if ($direction === 'up') { + $sql = "UPDATE {$_TABLES['routes']} SET priority = priority - 11 WHERE rid = " . $rid; + DB_query($sql); + reorderRoutes(); + } elseif ($direction === 'down') { + $sql = "UPDATE {$_TABLES['routes']} SET priority = priority + 11 WHERE rid = " . $rid; + DB_query($sql); + reorderRoutes(); + } + } else { + COM_errorLog("block admin error: Attempt to move an non-existing route id: {$rid}"); + } +} + +/** + * Delete a route + * + * @param int $rid id of block to delete + * @return string HTML redirect or error message + */ +function deleteRoute($rid) +{ + global $_CONF, $_TABLES; + + $rid = intval($rid, 10); + DB_delete($_TABLES['routes'], 'rid', $rid); + reorderRoutes(); + + return COM_refresh($_CONF['site_admin_url'] . '/router.php?msg=123'); +} + +// MAIN +$display = ''; + +$mode = $_FINPUT->get('mode', $_FINPUT->post('mode', '')); +$rid = $_FINPUT->get('rid', $_FINPUT->post('rid', 0)); +$rid = intval($rid, 10); +$securityToken = SEC_createToken(); + +switch ($mode) { + case $LANG_ADMIN['delete']: + if ($rid === 0) { + COM_errorLog('Attempted to delete route, rid empty or null, value =' . $rid); + $display = COM_refresh($_CONF['site_admin_url'] . '/router.php'); + } elseif (SEC_checkToken()) { + $display = deleteRoute($rid); + } else { + COM_accessLog("User {$_USER['username']} tried to illegally delete route {$rid} and failed CSRF checks."); + $display = COM_refresh($_CONF['site_admin_url'] . '/index.php'); + } + + echo $display; + die(); + break; + + case $LANG_ADMIN['save']: + if (!SEC_checkToken()) { + COM_accessLog("User {$_USER['username']} tried to illegally save route {$rid} and failed CSRF checks."); + echo COM_refresh($_CONF['site_admin_url'] . '/index.php'); + die(); + } + + $method = $_FINPUT->post('method', ''); + $rule = $_INPUT->post('rule', ''); + $route = $_INPUT->post('route', ''); + $priority = $_FINPUT->post('priority', Router::DEFAULT_PRIORITY); + $display = saveRoute($rid, $method, $rule, $route, $priority); + break; + + case 'edit': + $content = getRouteEditor($rid); + $display = COM_createHTMLDocument($content, array('pagetitle' => $LANG_ROUTER[2])); + break; + + case 'move': + if (SEC_checkToken()) { + moveRoute($rid); + } + + $content = listRoutes(); + $display = COM_createHTMLDocument($content, array('pagetitle' => $LANG_ROUTER[2])); + break; + + default: // 'cancel' or no mode at all + $content = COM_showMessageFromParameter() . listRoutes(); + $display = COM_createHTMLDocument($content, array('pagetitle' => $LANG_ROUTER[2])); +} + +COM_output($display); diff --git a/public_html/docs/docstyle.css b/public_html/docs/docstyle.css index eb8cf064a..1102f27a4 100644 --- a/public_html/docs/docstyle.css +++ b/public_html/docs/docstyle.css @@ -123,3 +123,6 @@ a.wikipedia { border-bottom: 1px dotted black; } +span.tt { + font-family:'Lucida Console', monospace; +} diff --git a/public_html/docs/english/config.html b/public_html/docs/english/config.html index 74e9fc7dc..be04d732c 100644 --- a/public_html/docs/english/config.html +++ b/public_html/docs/english/config.html @@ -14,10 +14,10 @@

Geeklog Configuration

Configuration files

-

Previous versions of Geeklog used one huge file called config.php +

Previous versions of Geeklog used one huge file called config.php that held all the core configuration options. As of Geeklog 1.5.0, most of the configuration options have been moved to the database and can now be -reached from the Configuration admin panel within Geeklog.

+reached from the Configuration admin panel within Geeklog.

For technical reasons, some configuration options still have to be stored in files. There are two such configuration files now:

@@ -63,7 +63,7 @@

Site: Site

Base URL of the admin area of your site (no trailing slash). You won't have to change this normally, but some hosting services use a predefined "admin" directory for other purposes. In this case, you can - rename Geeklog's admin directory and adjust the URL accordingly to + rename Geeklog's admin directory and adjust the URL accordingly to avoid conflicts. site_name @@ -80,14 +80,14 @@

Site: Site

disabled. If the text begins with "http:" then visitors are redirected to that URL.
Note: The option which actually disables the site can be found - in the siteconfig.php file. + in the siteconfig.php file. owner_name The name of the owner of the site. This is used in the copyright notice if set, else the site name is used. copyrightyear - (disabled) + (disabled) Set this to the year you want to appear in the copyright notice of your site's footer. If not set, Geeklog will use the current year. @@ -95,6 +95,11 @@

Site: Site

false Enable (true) or disable (false) URL rewriting.
Also see the section on URL Rewriting below. + + url_routing + Disabled + Enable or disable URL routing. Caution: This feature takes effect only when URL Rewriting is enabled.
+ Also see the section on URL Routing below. cdn_hosted false @@ -139,11 +144,11 @@

Site: Mail

Used to select how to send email. Can be one of 'smtp', 'sendmail', or 'mail'. sendmail_path - /usr/bin/sendmail + /usr/bin/sendmail If you chose 'sendmail' for the backend setting, this specifies the complete path to the sendmail binary. sendmail_args - '' (empty) + '' (empty) If you chose 'sendmail' for the backend setting, this variable can be used to pass additional parameters to the sendmail binary. @@ -274,7 +279,7 @@

Site: PEAR

use the PEAR packages installed in $_CONF['path_pear'] (see below) path_pear - /path/to/geeklog/system/pear/ + /path/to/geeklog/system/pear/ When $_CONF['have_pear'] (see above) is set to false, this is the path where Geeklog expects to find the PEAR packages it requires (e.g. @@ -324,7 +329,7 @@

Site: Search

search_limits 10,15,25,30 - The result limits a user can select. Each value must be separated with a comma. + The result limits a user can select. Each value must be separated with a comma. num_search_results 30 @@ -525,7 +530,7 @@

Stories and Trackback: Trackback

check (but using option 1 and 2 doesn't make sense and will be treated as if you requested option 2).
Options are: 0 = don't perform any checks, 1 = check only for your site's main URL ($_CONF['site_url']), 2 = check for the exact URL of the entry (e.g. an article) on your site, 4 = check IP address of the sender of the trackback against the site referred to in the trackback URL.
- Example: $_CONF['check_trackback_link'] = 6; // check for the exact URL (2) and proper IP address (4) + Example: $_CONF['check_trackback_link'] = 6; // check for the exact URL (2) and proper IP address (4) multiple_trackbacks 0 @@ -587,22 +592,22 @@

Theme: Theme

Document Type Declaration (aka DOCTYPE aka DTD) to use for all the themes on your - site, assuming they use the {doctype} variable instead of a - hard-coded DOCTYPE in their header.thtml. + site, assuming they use the {doctype} variable instead of a + hard-coded DOCTYPE in their header.thtml. menu_elements array('contribute', 'search', 'stats', 'directory', 'plugins') Specifies which entries are displayed in the site's menu bar (if your theme uses the {menu_elements} variable to display - the menu bar). Can be any combination of 'home', - 'contribute', 'search', 'stats', - 'directory', 'login', 'prefs', 'plugins', and - 'custom' where 'plugins' is the same as the + the menu bar). Can be any combination of 'home', + 'contribute', 'search', 'stats', + 'directory', 'login', 'prefs', 'plugins', and + 'custom' where 'plugins' is the same as the {plg_menu_elements} variable, i.e. a list of the menu entries - provided by plugins, and 'custom' displays the entries returned by + provided by plugins, and 'custom' displays the entries returned by a custom function CUSTOM_menuEntries (see - lib-custom.php for details). + lib-custom.php for details). path_themes path/to/path_themes @@ -610,7 +615,7 @@

Theme: Theme

cache_templates true - If set to true, all templates will be cached, which + If set to true, all templates will be cached, which should improve performance of the web site. In some cases, caching could slow performance down. For example, if the disk access is slow on the web server or if the web server is accessing Windows shared drives, setting this @@ -618,7 +623,7 @@

Theme: Theme

cache_mobile true - If set to true, mobile devices (phones and tablets) will be cached + If set to true, mobile devices (phones and tablets) will be cached separately from computers. This includes the template files, blocks, articles and other plugins which may use Geeklog's template cache system. You should only set this to false if you do not plan to display different information depending on if a mobile device is detected being used by the user. Performance will be improved slightly if set to false since @@ -634,7 +639,7 @@

Theme: Advanced Settings

show_right_blocks false - If set to true, the right-side column of blocks + If set to true, the right-side column of blocks will be displayed on all pages (instead of only on the index page). @@ -670,7 +675,7 @@

Blocks: Admin Block

sort_admin false - If set to true will sort the entries in the Admin's + If set to true will sort the entries in the Admin's block and the icons on the Command and Control page alphabetically. link_documentation @@ -790,7 +795,7 @@

Users and Submissions: Users

disable_new_user_registration false - When set to true completely disables all options + When set to true completely disables all options to sign up as a new user. allow_user_themes @@ -826,13 +831,13 @@

Users and Submissions: Users

If you allow users to log in with accounts on remote services (like LDAP or LiveJournal), this option will at the service's name to the username to avoid confusion with local users of the same name. Set to - false to disable. + false to disable. custom_registration false When set to true, Geeklog will let you use your own signup form for new user registrations. Please see the file - lib-custom.php that ships with Geeklog for an example. + lib-custom.php that ships with Geeklog for an example. standard true @@ -846,11 +851,11 @@

Users and Submissions: Users

3rdparty false - Allow (when set to true) users who already have + Allow (when set to true) users who already have an account with some other service to log into your Geeklog site with the login for that service. Currently supported: LDAP and LiveJournal.
Please note that to enable login for a specific service, you need an - authorization class in system/classes/authentication. If you only + authorization class in system/classes/authentication. If you only want to allow LDAP but not LiveJournal users (or vice versa), simply remove the class file for the unwanted service(s).
See Remote Authentication in Geeklog for more information. @@ -865,7 +870,7 @@

Users and Submissions: Users

facebook_login false - Allow (when set to true) users who already have + Allow (when set to true) users who already have an account with Facebook to log into Geeklog with said account using OAuth. You must set the Facebook application ID and secret. facebook_consumer_key @@ -882,7 +887,7 @@

Users and Submissions: Users

linkedin_login false - Allow (when set to true) users who already have + Allow (when set to true) users who already have an account with LinkedIn to log into Geeklog with said account using OAuth. You must set the LinkedIn API and secret key. linkedin_consumer_key @@ -899,7 +904,7 @@

Users and Submissions: Users

twitter_login false - Allow (when set to true) users who already have + Allow (when set to true) users who already have an account with Twitter to log into Geeklog with said account using OAuth. You must set the Twitter consumer key and secret. twitter_consumer_key @@ -916,7 +921,7 @@

Users and Submissions: Users

google_login false - Allow (when set to true) users who already have + Allow (when set to true) users who already have an account with Google to log into Geeklog with said account using OAuth. You must set the Google client id and client secret. google_consumer_key @@ -933,7 +938,7 @@

Users and Submissions: Users

microsoft_login false - Allow (when set to true) users who already have + Allow (when set to true) users who already have an account with Microsoft to log into Geeklog with said account using OAuth. You must set the Microsoft client id and client secret. microsoft_consumer_key @@ -950,7 +955,7 @@

Users and Submissions: Users

yahoo_login false - Allow (when set to true) users who already have + Allow (when set to true) users who already have an account with Yahoo to log into Geeklog with said account using OAuth. You must set the Yahoo consumer key and consumer secret. yahoo_consumer_key @@ -967,7 +972,7 @@

Users and Submissions: Users

github_login false - Allow (when set to true) users who already have + Allow (when set to true) users who already have an account with GitHub to log into Geeklog with said account using OAuth. You must set the GitHub client id and client secret. github_consumer_key @@ -1108,7 +1113,7 @@

Users and Submissions: User Submission

comma-separated list of domain names from which user submissions will not be queued (but approved automatically). Regular expressions are also allowed and interpreted.
Example: - 'mycompany.com,myothercompany.com' + 'mycompany.com,myothercompany.com' disallow_domains '' @@ -1118,7 +1123,7 @@

Users and Submissions: User Submission

when the user submission queue has been switched off. Again, regular expression can be used.
Example disallow email addresses with a certain domain name and from any ".edu" domain: - 'somebaddomain.com,\.edu$' + 'somebaddomain.com,\.edu$'

Users and Submissions: Submission Settings

@@ -1135,7 +1140,7 @@

Users and Submissions: Submission Settingslistdraftstories 0 When set to 1, this will display an additional block on the - submissions page (moderation.php) that lists all the stories that + submissions page (moderation.php) that lists all the stories that have the 'draft' flag set. postmode @@ -1263,15 +1268,15 @@

Images: Image Library

images to be resized or if you don't have those packages available. path_to_mogrify - (disabled) + (disabled) If you chose 'imagemagick' for $_CONF['image_lib'] above, then this should hold the complete path to the mogrify executable (from the ImageMagick package), e.g. - '/usr/bin/mogrify' (ImageMagick 5.4.9 or newer recommended). + '/usr/bin/mogrify' (ImageMagick 5.4.9 or newer recommended). path_to_netpbm - (disabled) + (disabled) If you chose 'netpbm' for $_CONF['image_lib'] above, then this should hold the complete path to the directory where the binaries from the Netpbm package are kept, e.g. @@ -1295,11 +1300,11 @@

Images: Upload

1 When unscaled images are kept (see above), this option lets the user chose between using the scaled or unscaled image in the story, i.e. - enables the [unscaledX] image tag (in addition to the - [imageX] tag). + enables the [unscaledX] image tag (in addition to the + [imageX] tag). jpeg_quality - (disabled) + (disabled) Control the image quality when resizing JPEGs. All the image libraries supported by Geeklog are based on the IJG JPEG library which uses an arbitrary range of 0-100 to specify the "quality" (note that this is @@ -1314,7 +1319,7 @@

Images: Upload

debug_image_upload false When set to true, this option enables debugging - output to be written into Geeklog's error.log file during the + output to be written into Geeklog's error.log file during the upload of an image. This is useful to track down problems with the image upload and resizing. @@ -1339,7 +1344,7 @@

Images: Images in Articles

$_CONF['image_lib'] above). max_image_size - 1048576 (equals 1 MB) + 1048576 (equals 1 MB) Max. size of an image in bytes. If it exceeds this, it is is rejected (even if you're using a graphics package to resize images). @@ -1364,7 +1369,7 @@

Images: Topic Icons

$_CONF['image_lib'] above). max_topicicon_size - 65536 (equals 64 KB) + 65536 (equals 64 KB) Max. size of a topic icon in bytes. If it exceeds this, it is rejected (even if you're using a graphics package to resize images). @@ -1389,12 +1394,12 @@

Images: Photos

$_CONF['image_lib'] above). max_photo_size - 65536 (equals 64 KB) + 65536 (equals 64 KB) Max. size of a user photo in bytes. If it exceeds this, it is rejected (even if you're using a graphics package to resize images). force_photo_width - (disabled) + (disabled) This option, when enabled, will only apply when displaying a user photo. The <img> tag for the user photo will be emitted with a max. width, as specified by this option. @@ -1403,7 +1408,7 @@

Images: Photos

shaped user photos to break your page's layout (e.g. in a forum). default_photo - (disabled) + (disabled) When enabled, this option should point to an image (full URL required!) that should be displayed for users without a user photo. When this option is not set and a user does not have a user photo (or an Images: Gravatar use_gravatar false - If enabled (set to true), a user's avatar image will + If enabled (set to true), a user's avatar image will be requested from gravatar.com if the user didn't upload a user photo (i.e. an uploaded photo always takes precedence).
@@ -1428,7 +1433,7 @@

Images: Gravatar

a lot of userphotos for different users (e.g. forum threads). gravatar_rating - (disabled) + (disabled) Avatars submitted to gravatar.com are rated with the rating system used for movies (in the U.S.), i.e. the letters G, PG, R, or X. This option will let you chose the maximum allowed rating for an avatar. @@ -1459,7 +1464,7 @@

Languages and Locale: Language

If set to 1, users can select the language for the site labels from My Account. language_files - (disabled) + (disabled) For multi-lingual content setups only: A list mapping language shortcuts ('en', 'de', etc.) to the Geeklog language files to use. These shortcuts must each contain the same number of characters and the language file must exist in the Geeklog languages directory.
@@ -1470,7 +1475,7 @@

Languages and Locale: Language

Both must either be enabled (for multi-language content) or disabled (for content of only one language). languages - (disabled) + (disabled) For multi-lingual content setups only: A list mapping language shortcuts ('en', 'de', etc.) to the language's native name ("English", "Deutsch", etc.). These shortcuts must match the shortcuts set in the "Language Files" configuration option.
@@ -1522,7 +1527,7 @@

Languages and Locale: Locale

week_start Sun - First day of the week in the calendar. Can be either 'Sun' (Sunday) or 'Mon' (Monday). + First day of the week in the calendar. Can be either 'Sun' (Sunday) or 'Mon' (Monday). hour_mode 12 @@ -1543,7 +1548,7 @@

Languages and Locale: Locale

How many decimal places to display. timezone - (disabled) + (disabled) If your server is located in a different timezone, use this option to set your local (i.e. your own) timezone, so that the time and date on the site match your own.
@@ -1609,7 +1614,7 @@

Miscellaneous: Cookies

Cookie path (see the PHP manual for details). cookiedomain - (empty) + (empty) The domain that the cookie is available. Geeklog will attempt to guess the correct value for this setting (based on the 'site_url' variable). See the PHP manual for details. cookiesecure @@ -1626,11 +1631,11 @@

Miscellaneous: Miscellaneous

notification array() - Send an email notification to $_CONF['site_email'] + Send an email notification to $_CONF['site_email'] when a new story, comment, trackback or pingback has been submitted - or a new user has registered with the site. The array() can hold - any combination of the strings 'story', 'comment', - 'trackback', 'pingback', and 'user' (separated + or a new user has registered with the site. The array() can hold + any combination of the strings 'story', 'comment', + 'trackback', 'pingback', and 'user' (separated by commas), depending on which notification(s) you want.
Example: array('story','user'); would send notifications when a new story has been submitted or a new user has @@ -1642,7 +1647,7 @@

Miscellaneous: Miscellaneous

Geeklog can emulate a cronjob, i.e. trigger a certain action at a given time. The code to be executed can be provided by a plugin or through the CUSTOM_runScheduledTask function in your - lib-custom.php. The value given is in seconds and specifies the + lib-custom.php. The value given is in seconds and specifies the interval in which the code should be executed (e.g. 86400 for daily activation).
Please note that to trigger this action, you will need to have someone @@ -1682,7 +1687,7 @@

Miscellaneous: Miscellaneous

href="http://en.wikipedia.org/wiki/Clickjacking">Clickjacking: This option indicates that the site's content should not be displayed in a frame. This only works, however, when the visitor's browser respects the - X-FRAME-OPTIONS HTTP header. Options are to disallow all framing + X-FRAME-OPTIONS HTTP header. Options are to disallow all framing (Strict), only allow framing from within the same site (Same Origin), or to allow all framing (disabled). We strongly suggest not to disable this option. @@ -1722,7 +1727,7 @@

Miscellaneous: Debug

for debugging purposes!
Tip: If an error prevents you from logging into your site to enable that option, you can also enable it in your - siteconfig.php file. + siteconfig.php file.

Miscellaneous: Daily Digest

@@ -1741,7 +1746,7 @@

Miscellaneous: Daily Digest

1 When emailstories (above) is enabled, send only the title and the link to the new stories (0), or send the entire introtext (1) or send - the first n characters from the introtext (where n = any other number) + the first n characters from the introtext (where n = any other number) emailstoriesperdefault 0 @@ -1801,7 +1806,7 @@

Miscellaneous: Censoring

Text to replace a censored word with censorlist - array(a list of "bad" words goes here ...) + array(a list of "bad" words goes here ...) An array of censored words @@ -1813,7 +1818,7 @@

Miscellaneous: IP Lookup

Description ip_lookup - not set + not set The IP addresses of comment posters are logged and displayed for admin users. When this variable is set to point to a service that can do IP address lookups, it's possible to lookup the owner of an IP address by clicking on it, making it easier to report abuse to ISPs, etc.
$_CONF['ip_lookup'] should hold the complete URL to the lookup service, with a '*' marking the place where the IP address should go. It's also possible to use Tom Willet's NetTools package, in which case the correct setting would be $_CONF['ip_lookup'] = $_CONF['site_url'] . '/nettools/whois.php?domain=*'; @@ -1832,7 +1837,7 @@

Miscellaneous: Webservices

restrict_webservices false Set this to true to restrict webservices usage - to users with the webservices.atompub permission (e.g. those in + to users with the webservices.atompub permission (e.g. those in the predefined "Webservices Users" group). atom_max_stories @@ -2022,7 +2027,7 @@

File Manager: Audios

db-config.php

-

As the name implies, the file db-config.php contains the database +

As the name implies, the file db-config.php contains the database configuration. This information is put there during the initial install and you should not normally have to edit this file.

@@ -2032,7 +2037,7 @@

db-config.php

Description _DB_host localhost - Database Server (to be entered in the form: hostname:port:unixsocket). In most cases you won't need to change the default value. + Database Server (to be entered in the form: hostname:port:unixsocket). In most cases you won't need to change the default value. _DB_name geeklog Database Name @@ -2056,7 +2061,7 @@

db-config.php

siteconfig.php

-

The siteconfig.php file holds configuration data that can not be +

The siteconfig.php file holds configuration data that can not be stored in the database. Again, most of this information is put there during the installation and you should not normally have to edit this file.

@@ -2087,13 +2092,13 @@

siteconfig.php

set is recommended. rootdebug - (disabled) + (disabled) Same as the 'rootdebug' option in the Configuration. However, sometimes an error may occur that prevents you from logging into your site and enabling the 'rootdebug' option. In such a case, you can uncomment this line and enable the option here.
In addition to 'true' and 'false', you can also set this option to 'force' - (only in siteconfig.php). This will enable displaying of sensitive + (only in siteconfig.php). This will enable displaying of sensitive information like passwords and cookies.
In any case, the same strong warning as above applies here, too: Do not leave this option enabled on a "live" @@ -2109,9 +2114,9 @@

URL Rewriting

supported for URLs to stories, static pages, the article directory, and links.

URL rewriting means that your URLs will look like this

-

http://www.geeklog.net/article.php/20021022234959146

+

http://www.geeklog.net/article.php/20021022234959146

instead of like this

-

http://www.geeklog.net/article.php?story=20021022234959146

+

http://www.geeklog.net/article.php?story=20021022234959146

While some search engines will pick up the second form, Google seems to prefer the first format and often ignores the second format.

Note: This feature may not work with all web servers. It @@ -2120,6 +2125,112 @@

URL Rewriting

with your site.

+

URL Routing

+ +

This feature enhances the above URL Rewriting feature and makes + public_html/index.php work like a front controller. So, in order to use URL Routing feature, + you have to enable URL Rewriting beforehand. Currently, the following rules are predefined.

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
RuleRoutePriority
http://yourdomain/article/@sid/printhttp://yourdomain/article.php?story=@sid&mode=print100
http://yourdomain/article/@sidhttp://yourdomain/article.php?story=@sid110
http://yourdomain/archives/@topic/@year/@monthhttp://yourdomain/directory.php?topic=@topic&year=@year&month=@month120
http://yourdomain/page/@pagehttp://yourdomain/staticpages/index.php?page=@page130
http://yourdomain/links/portal/@itemhttp://yourdomain/links/portal.php?what=link&item=@item140
http://yourdomain/links/category/@cathttp://yourdomain/links/index.php?category=@cat150
http://yourdomain/topic/@topichttp://yourdomain/index.php?topic=@topic160
+ +

Look at the first row in the table. This means if you access "http://yourdomain/index.php/article/@sid/print", + then you will be redirected to "http://yourdomain/article.php?story=@sid&mode=print". + @sid is a story ID.

+

Then, look at the third row. You will see an at mark (@), followed by alphabetical + letters. This is a placeholder. For instance, when you access + "http://yourdomain/index.php/archives/all/2016/1", @topic matches "all", @year matches "2016", + and @month matches "1" in the rule. Then, all placeholders in the route will be replaced with + the matched values. And you will be redirected to "http://yourdomain/directory.php?topic=all&year=2016&month=1".

+

You don't have to include "/index.php" in a rule.

+

You must NOT start a route with "/index.php/", since this will cause an infinite loop. However, you can start + with a route with "/index.php?".

+

A placeholder starts with @ and an alphabetical letter or letters follow it. + Placeholders are case-sensitive.

+

URL Routing works in the reverse way as well. When you output a URL in your plugin or custom + function, you can URL-route it by using COM_buildURL function and adding your own rule and + route in the URL Routing screen (admin/router.php).

+

Note: This feature may not work with all web servers. It uses PHP's + $_SERVER['PATH_INFO'] variable. Please try it out before you go public with your site.

+

Advanced feature: If you use Apache as a Web server and want to remove "index.php" + from URLs you access, you have to do the following things. Be warned! + Unless you are familiar with Web server configurations, you might as well not use this feature.

+
    +
  1. Enable the rewrite module of your web server. In "httpd.conf", look for
    + # LoadModule rewrite_module modules/mod_rewrite.so
    + and uncomment the line by removing # at the top of the line. Don't forget to + reboot your Web server.
  2. +
  3. Create a file named ".htaccess" in the top of the public directory of your + Geeklog installation (where lib-common.php is located) and add the following lines.
    +
    +        <IfModule mod_rewrite.c>
    +            RewriteEngine On
    +            # RewriteBase /
    +            # Directs all Geeklog requests through the site index file
    +            RewriteCond %{REQUEST_FILENAME} !-f
    +            RewriteCond %{REQUEST_FILENAME} !-d
    +            RewriteRule ^(.*)$ /index.php/$1 [L]
    +        </IfModule>
    +    

    + If you have installed Geeklog in a subdirectory of the document root, you will + have to change the line
    +
    +            RewriteRule ^(.*)$ /index.php/$1 [L]
    +    
    into
    +
    +            RewriteRule ^(.*)$ [sub_directory]/index.php/$1 [L]
    +        

    + or
    +
    +            RewriteRule ^(.*)$ /[sub_directory]/index.php/$1 [L]
    +        
    +
  4. +
  5. + Finally, log in as admin and go to the Configuration screen, and set URL Routing + to 'Enabled (without "index.php")'. +
  6. +
+ +

Localization

Localizing Geeklog is fairly easy. All strings are contained in a @@ -2137,9 +2248,9 @@

Locale and Date Formats

will pull the default locale from the operating system. The date formats are handled by your locale. Isn't that smart? Locale names are OS dependent. On most UNIX hosts, you can find locale codes in the -/usr/share/locale/locale.alias file and on some systems the command -locale -a will display all available locales on a system. If a -locale doesn't exist you can create it using the localedef command.

+/usr/share/locale/locale.alias file and on some systems the command +locale -a will display all available locales on a system. If a +locale doesn't exist you can create it using the localedef command.

More info on locale: http://www.opengroup.org/onlinepubs/7908799/xbd/locale.html
@@ -2149,39 +2260,39 @@

Locale and Date Formats

Date Format Syntax