ModuleCode: urlrewrite 0.03
ModuleDescription: Url Rewrite
Directory: /modules/urlrewrite/admin
File: /modules/urlrewrite/admin/create.php
File: /modules/urlrewrite/admin/createurl.php
File: /modules/urlrewrite/admin/delete.php
File: /modules/urlrewrite/admin/edit.php
File: /modules/urlrewrite/admin/htaccess.php
File: /modules/urlrewrite/admin/index.php
File: /modules/urlrewrite/admin/menu.php
File: /modules/urlrewrite/admin/new.php
File: /modules/urlrewrite/admin/save.php
File: /modules/urlrewrite/admin/smarty.php
Directory: /modules/urlrewrite/blocks
File: /modules/urlrewrite/blocks/stub.php
Directory: /modules/urlrewrite/class
File: /modules/urlrewrite/class/dependence.php
File: /modules/urlrewrite/class/htaccess.php
File: /modules/urlrewrite/class/stub.php
File: /modules/urlrewrite/class/url.php
Directory: /modules/urlrewrite/images
Directory: /modules/urlrewrite/include
File: /modules/urlrewrite/include/smarty.php
File: /modules/urlrewrite/index.php
Directory: /modules/urlrewrite/sql
File: /modules/urlrewrite/sql/mysql.sql
Directory: /modules/urlrewrite/templates
Directory: /modules/urlrewrite/templates/blocks
File: /modules/urlrewrite/templates/blocks/urlrewrite_block_stub.html
File: /modules/urlrewrite/templates/urlrewrite_admin_create.html
File: /modules/urlrewrite/templates/urlrewrite_admin_createurl.html
File: /modules/urlrewrite/templates/urlrewrite_admin_delete.html
File: /modules/urlrewrite/templates/urlrewrite_admin_edit.html
File: /modules/urlrewrite/templates/urlrewrite_admin_htaccess.html
File: /modules/urlrewrite/templates/urlrewrite_admin_index.html
File: /modules/urlrewrite/templates/urlrewrite_admin_smarty.html
File: /modules/urlrewrite/xoops_version.php
ModuleDescription: Url Rewrite
Directory: /modules/urlrewrite/admin
File: /modules/urlrewrite/admin/create.php
<?php
include dirname(__FILE__).'/../../../include/cp_header.php';
xoops_cp_header();
require_once XOOPS_ROOT_PATH.'/class/template.php';
require_once XOOPS_ROOT_PATH.'/class/theme.php';
require_once XOOPS_ROOT_PATH.'/class/theme_blocks.php';
$xoopsThemeFactory =& new xos_opal_ThemeFactory();
$xoTheme =& $xoopsThemeFactory->createInstance();
$xoopsTpl =& $xoTheme->template;
/* @var $xoopsTpl XoopsTpl */
require_once XOOPS_ROOT_PATH.'/class/xoopsformloader.php';
$create_form = new XoopsSimpleForm("", "create_form",
XOOPS_URL."/modules/urlrewrite/admin/new.php");
$create_form->addElement(new XoopsFormText("", "pattern", 50, 50), true);
$create_form->addElement(new XoopsFormText("", "target_url", 50, 50), true);
$create_form->addElement(new XoopsFormRadioYN("", "enabled", true));
$create_form->addElement(new XoopsFormButton("", "submit", _SUBMIT, "submit"));
$create_form->assign($xoopsTpl);
$xoopsTpl->display("db:urlrewrite_admin_create.html");
xoops_cp_footer();
?>
File: /modules/urlrewrite/admin/createurl.php
<?php
include dirname(__FILE__).'/../../../include/cp_header.php';
if (false === isset($_GET["script_url"])) {
redirect_header(XOOPS_URL."/modules/urlrewrite/admin/index.php");
}
$script_url = $_GET["script_url"];
xoops_cp_header();
require_once XOOPS_ROOT_PATH.'/class/template.php';
require_once XOOPS_ROOT_PATH.'/class/theme.php';
require_once XOOPS_ROOT_PATH.'/class/theme_blocks.php';
$xoopsThemeFactory =& new xos_opal_ThemeFactory();
$xoTheme =& $xoopsThemeFactory->createInstance();
$xoopsTpl =& $xoTheme->template;
/* @var $xoopsTpl XoopsTpl */
$xoopsTpl->assign_by_ref("script_url", $script_url);
require_once XOOPS_ROOT_PATH.'/class/xoopsformloader.php';
$create_form = new XoopsSimpleForm("", "create_form",
XOOPS_URL."/modules/urlrewrite/admin/new.php");
$create_form->addElement(new XoopsFormText("", "pattern", 50, 50), true);
$create_form->addElement(new XoopsFormHidden("target_url", $script_url), true);
$create_form->addElement(new XoopsFormRadioYN("", "enabled", true));
$create_form->addElement(new XoopsFormButton("", "submit", _SUBMIT, "submit"));
$create_form->assign($xoopsTpl);
$xoopsTpl->display("db:urlrewrite_admin_createurl.html");
xoops_cp_footer();
?>
File: /modules/urlrewrite/admin/delete.php
<?php
include dirname(__FILE__).'/../../../include/cp_header.php';
if (false === isset($_GET["id"])) {
redirect_header(XOOPS_URL."/modules/urlrewrite/admin/index.php");
}
$urlhandler = xoops_getmodulehandler("url", "urlrewrite");
/* @var $urlhandler urlrewriteurlhandler */
$url = $urlhandler->get($_GET["id"]);
/* @var $url urlrewriteurl */
if (false === isset($url)) {
redirect_header(XOOPS_URL."/modules/urlrewrite/admin/index.php");
}
if ("POST" === $_SERVER['REQUEST_METHOD']) {
$urlhandler->delete($url);
redirect_header(XOOPS_URL."/modules/urlrewrite/admin/index.php");
}
xoops_cp_header();
require_once XOOPS_ROOT_PATH.'/class/template.php';
require_once XOOPS_ROOT_PATH.'/class/theme.php';
require_once XOOPS_ROOT_PATH.'/class/theme_blocks.php';
$xoopsThemeFactory =& new xos_opal_ThemeFactory();
$xoTheme =& $xoopsThemeFactory->createInstance();
$xoopsTpl =& $xoTheme->template;
/* @var $xoopsTpl XoopsTpl */
$xoopsTpl->assign_by_ref("url", $url);
$xoopsTpl->display("db:urlrewrite_admin_delete.html");
if ("POST" !== $_SERVER['REQUEST_METHOD']) {
xoops_confirm(array(), "", "Are you sure want to delete?");
}
xoops_cp_footer();
?>
File: /modules/urlrewrite/admin/edit.php
<?php
include dirname(__FILE__).'/../../../include/cp_header.php';
if (false === isset($_GET["id"])) {
redirect_header(XOOPS_URL."/modules/urlrewrite/admin/index.php");
}
$urlhandler = xoops_getmodulehandler("url", "urlrewrite");
/* @var $urlhandler urlrewriteurlhandler */
$url = $urlhandler->get($_GET["id"]);
/* @var $url urlrewriteurl */
if (false === isset($url)) {
redirect_header(XOOPS_URL."/modules/urlrewrite/admin/index.php");
}
xoops_cp_header();
require_once XOOPS_ROOT_PATH.'/class/template.php';
require_once XOOPS_ROOT_PATH.'/class/theme.php';
require_once XOOPS_ROOT_PATH.'/class/theme_blocks.php';
$xoopsThemeFactory =& new xos_opal_ThemeFactory();
$xoTheme =& $xoopsThemeFactory->createInstance();
$xoopsTpl =& $xoTheme->template;
/* @var $xoopsTpl XoopsTpl */
$xoopsTpl->assign_by_ref("id", $url->get_primary_key());
require_once XOOPS_ROOT_PATH.'/class/xoopsformloader.php';
$edit_form = new XoopsSimpleForm("", "edit_form",
XOOPS_URL."/modules/urlrewrite/admin/save.php");
$edit_form->addElement(new XoopsFormHidden("id", $url->get_primary_key()));
$edit_form->addElement(
new XoopsFormText("", "pattern", 50, 50, $url->get_pattern()), true);
$edit_form->addElement(
new XoopsFormText("", "target_url", 50, 50, $url->get_target_url()), true);
$edit_form->addElement(
new XoopsFormRadioYN("", "enabled", $url->get_enabled()));
$edit_form->addElement(new XoopsFormButton("", "submit", _SUBMIT, "submit"));
$edit_form->assign($xoopsTpl);
$xoopsTpl->display("db:urlrewrite_admin_edit.html");
xoops_cp_footer();
?>
File: /modules/urlrewrite/admin/htaccess.php
<?php
include dirname(__FILE__).'/../../../include/cp_header.php';
$htaccesshandler = xoops_getmodulehandler("htaccess", "urlrewrite");
/* @var $htaccesshandler urlrewritehtaccesshandler */
if ("POST" === $_SERVER['REQUEST_METHOD']) {
$htaccesshandler->save();
redirect_header(XOOPS_URL."/modules/urlrewrite/admin/index.php");
}
xoops_cp_header();
require_once XOOPS_ROOT_PATH.'/class/template.php';
require_once XOOPS_ROOT_PATH.'/class/theme.php';
require_once XOOPS_ROOT_PATH.'/class/theme_blocks.php';
$xoopsThemeFactory =& new xos_opal_ThemeFactory();
$xoTheme =& $xoopsThemeFactory->createInstance();
$xoopsTpl =& $xoTheme->template;
/* @var $xoopsTpl XoopsTpl */
$xoopsTpl->assign_by_ref("text", $htaccesshandler->get_text());
$xoopsTpl->assign_by_ref("rows", $htaccesshandler->get_rows());
$xoopsTpl->display("db:urlrewrite_admin_htaccess.html");
xoops_confirm(array(), "", "Are you sure want to save as '".
$htaccesshandler->get_htaccess_path()."'?");
xoops_cp_footer();
?>
File: /modules/urlrewrite/admin/index.php
<?php
include dirname(__FILE__).'/../../../include/cp_header.php';
xoops_cp_header();
$dependencehandler = xoops_getmodulehandler("dependence", "urlrewrite");
/* @var $dependencehandler urlrewritedependencehandler */
if(false === $dependencehandler->check_url_rewrite()) {
xoops_error("The urlrewrite module required apache mod_rewrite.");
}
require_once XOOPS_ROOT_PATH.'/class/template.php';
require_once XOOPS_ROOT_PATH.'/class/theme.php';
require_once XOOPS_ROOT_PATH.'/class/theme_blocks.php';
$xoopsThemeFactory =& new xos_opal_ThemeFactory();
$xoTheme =& $xoopsThemeFactory->createInstance();
$xoopsTpl =& $xoTheme->template;
/* @var $xoopsTpl XoopsTpl */
$urlhandler = xoops_getmodulehandler("url", "urlrewrite");
/* @var $urlhandler urlrewriteurlhandler */
$xoopsTpl->assign_by_ref("urls", $urlhandler->getObjects());
$xoopsTpl->display("db:urlrewrite_admin_index.html");
xoops_cp_footer();
?>
File: /modules/urlrewrite/admin/menu.php
<?php
if (false === defined('XOOPS_ROOT_PATH')){
exit();
}
$adminmenu = array();
$i = 1;
$adminmenu[$i]["link"] = "admin/index.php";
$adminmenu[$i]["title"] = "URL List";
$i++;
$adminmenu[$i]["link"] = "admin/create.php";
$adminmenu[$i]["title"] = "Create URL";
$i++;
$adminmenu[$i]["link"] = "admin/htaccess.php";
$adminmenu[$i]["title"] = "Generate .htaccess";
$i++;
$adminmenu[$i]["link"] = "admin/smarty.php";
$adminmenu[$i]["title"] = "Smarty Support";
?>
File: /modules/urlrewrite/admin/new.php
<?php
include dirname(__FILE__).'/../../../include/cp_header.php';
$urlhandler = xoops_getmodulehandler("url", "urlrewrite");
/* @var $urlhandler urlrewriteurlhandler */
$url = $urlhandler->create();
/* @var $url urlrewriteurl */
$url->set_pattern($_POST["pattern"]);
$url->set_target_url($_POST["target_url"]);
$url->set_enabled($_POST["enabled"]);
$urlhandler->insert($url);
redirect_header(XOOPS_URL."/modules/urlrewrite/admin/index.php");
?>
File: /modules/urlrewrite/admin/save.php
<?php
include dirname(__FILE__).'/../../../include/cp_header.php';
if (false === isset($_POST["id"])) {
redirect_header(XOOPS_URL."/modules/urlrewrite/admin/index.php");
}
$urlhandler = xoops_getmodulehandler("url", "urlrewrite");
/* @var $urlhandler urlrewriteurlhandler */
$url = $urlhandler->get($_POST["id"]);
/* @var $url urlrewriteurl */
if (false === isset($url)) {
redirect_header(XOOPS_URL."/modules/urlrewrite/admin/index.php");
}
$url->set_pattern($_POST["pattern"]);
$url->set_target_url($_POST["target_url"]);
$url->set_enabled($_POST["enabled"]);
$urlhandler->insert($url);
redirect_header(XOOPS_URL."/modules/urlrewrite/admin/index.php");
?>
File: /modules/urlrewrite/admin/smarty.php
<?php
include dirname(__FILE__).'/../../../include/cp_header.php';
xoops_cp_header();
$dependencehandler = xoops_getmodulehandler("dependence", "urlrewrite");
/* @var $dependencehandler urlrewritedependencehandler */
if(false === $dependencehandler->check_htaccess()) {
xoops_error("The .htaccess is invalid.");
}
require_once XOOPS_ROOT_PATH.'/class/template.php';
require_once XOOPS_ROOT_PATH.'/class/theme.php';
require_once XOOPS_ROOT_PATH.'/class/theme_blocks.php';
$xoopsThemeFactory =& new xos_opal_ThemeFactory();
$xoTheme =& $xoopsThemeFactory->createInstance();
$xoopsTpl =& $xoTheme->template;
/* @var $xoopsTpl XoopsTpl */
require_once XOOPS_ROOT_PATH."/modules/urlrewrite/include/smarty.php";
$htaccesshandler = xoops_getmodulehandler("htaccess", "urlrewrite");
/* @var $htaccesshandler urlrewritehtaccesshandler */
$xoopsTpl->assign_by_ref("urls", $htaccesshandler->get_urls());
$xoopsTpl->display("db:urlrewrite_admin_smarty.html");
xoops_cp_footer();
?>
Directory: /modules/urlrewrite/blocks
File: /modules/urlrewrite/blocks/stub.php
<?php
if (false === defined("XOOPS_ROOT_PATH")) {
exit();
}
function b_urlrewrite_stub () {
$stubhandler = xoops_getmodulehandler("stub", "urlrewrite");
/* @var $stubhandler urlrewritestubhandler */
if (true === $stubhandler->get_in_xoops()) {
$block = array();
$block["script_url"] = $stubhandler->get_script_url();
$block["is_redirect"] = $stubhandler->get_is_redirect();
$block["patterns"] = $stubhandler->get_patterns();
$block["target_urls"] = $stubhandler->get_target_urls();
return $block;
} else {
return false;
}
}
?>
Directory: /modules/urlrewrite/class
File: /modules/urlrewrite/class/dependence.php
<?php
if (false === defined("XOOPS_ROOT_PATH")) {
exit();
}
final class urlrewritedependencehandler {
/* override */
public function __construct() {
return;
}
private function __clone () {
return;
}
/* operation */
public function check_url_rewrite () {
return true === in_array("mod_rewrite", apache_get_modules());
}
public function check_htaccess () {
return "1" === $_SERVER["XOOPS_URLREWRITE_HTACCESS"];
}
}
?>
File: /modules/urlrewrite/class/htaccess.php
<?php
if (false === defined("XOOPS_ROOT_PATH")) {
exit();
}
final class urlrewritehtaccesshandler {
private $urls;
private $text;
private $rows;
/* override */
public function __construct() {
return;
}
private function __clone () {
return;
}
/* cache */
private function ensure_urls () {
if (true === isset($this->urls)) {
return;
}
$urlhandler = xoops_getmodulehandler("url", "urlrewrite");
/* @var $urlhandler urlrewriteurlhandler */
$criteria = new CriteriaCompo();
$criteria->add(new Criteria("enabled", true));
$this->urls = $urlhandler->getObjects($criteria);
return;
}
private function ensure_text () {
if (true === isset($this->text)) {
return;
}
$this->ensure_urls();
$this->text = "<IfModule rewrite_module>n";
$this->text .= "<IfModule env_module>n";
$this->text .= "SetEnv XOOPS_URLREWRITE_HTACCESS 1n";
$this->text .= "</IfModule>n";
$this->text .= "RewriteEngine onn";
foreach ($this->urls as $url) {
/* @var $url urlrewriteurl */
$this->text .= "RewriteRule ^".preg_quote($url->get_pattern())."$ ".
$url->get_target_url()." [L,QSA]n";
}
$this->text .= "</IfModule>";
$this->rows = count(explode("n", $this->text));
return;
}
/* operation */
public function get_urls () {
$this->ensure_urls();
return $this->urls;
}
public function get_text () {
$this->ensure_text();
return $this->text;
}
public function get_rows () {
$this->ensure_text();
return $this->rows;
}
public function get_htaccess_path () {
return XOOPS_ROOT_PATH."/.htaccess";
}
public function get_target_urls_path () {
$cache_dir = XOOPS_UPLOAD_PATH."/urlrewrite";
if (false === is_dir($cache_dir)) {
mkdir($cache_dir);
}
return $cache_dir."/target_urls.php";
}
public function save () {
$this->ensure_text();
file_put_contents($this->get_htaccess_path(), $this->text);
$target_urls = array();
foreach ($this->urls as $url) {
/* @var $url urlrewriteurl */
$target_urls[$url->get_target_url()] = $url->get_pattern();
}
$target_urls_content = "<?phpnreturn ".var_export($target_urls, true).
";n?>";
file_put_contents($this->get_target_urls_path(), $target_urls_content);
return;
}
}
?>
File: /modules/urlrewrite/class/stub.php
<?php
if (false === defined("XOOPS_ROOT_PATH")) {
exit();
}
final class urlrewritestubhandler {
private $in_xoops;
private $script_url;
private $is_redirect;
private $patterns;
private $target_urls;
/* override */
public function __construct() {
$parse_xoops_url = parse_url(XOOPS_URL);
$xoops_url_path = $parse_xoops_url["path"];
$parse_request_uri = parse_url($_SERVER["REQUEST_URI"]);
$request_uri_path =$parse_request_uri["path"];
if (substr($request_uri_path, 0, strlen($xoops_url_path) + 1) ===
$xoops_url_path."/") {
$this->in_xoops = true;
$script_name = $_SERVER["SCRIPT_NAME"];
if (substr($script_name, 0, strlen($xoops_url_path) + 1) ===
$xoops_url_path."/") {
$this->script_url =
substr($script_name, strlen($xoops_url_path) + 1);
} else {
$this->script_url = "";
}
$target_url = substr($request_uri_path,
strlen($xoops_url_path) + 1);
$urlhandler = xoops_getmodulehandler("url", "urlrewrite");
/* @var $urlhandler urlrewriteurlhandler */
if (true === isset($_SERVER["REDIRECT_URL"])) {
$this->is_redirect = true;
$criteria = new CriteriaCompo();
$criteria->add(new Criteria("pattern", $target_url));
$this->patterns = $urlhandler->getObjects($criteria);
} else {
$this->is_redirect = false;
$criteria = new CriteriaCompo();
$criteria->add(new Criteria("target_url", $target_url));
$this->target_urls = $urlhandler->getObjects($criteria);
}
} else {
$this->in_xoops = false;
}
return;
}
private function __clone () {
return;
}
/* operation */
public function get_in_xoops () {
return $this->in_xoops;
}
public function get_script_url () {
return $this->script_url;
}
public function get_is_redirect () {
return $this->is_redirect;
}
public function get_patterns () {
return $this->patterns;
}
public function get_target_urls () {
return $this->target_urls;
}
}
?>
File: /modules/urlrewrite/class/url.php
<?php
if (false === defined("XOOPS_ROOT_PATH")) {
exit();
}
if (false === defined("FRAMEWORKS_ART_FUNCTIONS_INI")) {
require_once XOOPS_ROOT_PATH.'/Frameworks/art/functions.ini.php';
}
load_object();
final class urlrewriteurl extends ArtObject {
/* override */
public function __construct() {
parent::ArtObject(urlrewriteurlhandler::TABLE);
parent::initVar(urlrewriteurlhandler::PRIMARY_KEY, XOBJ_DTYPE_INT);
parent::initVar("pattern", XOBJ_DTYPE_TXTBOX);
parent::initVar("target_url", XOBJ_DTYPE_TXTBOX);
parent::initVar("enabled", XOBJ_DTYPE_INT);
return;
}
private function __clone () {
return;
}
/* getter / setter */
public function get_primary_key () {
return intval(parent::getVar(urlrewriteurlhandler::PRIMARY_KEY));
}
public function get_pattern () {
return strval(parent::getVar("pattern"));
}
public function set_pattern ($pattern) {
return parent::setVar("pattern", strval($pattern));
}
public function get_target_url () {
return strval(parent::getVar("target_url"));
}
public function set_target_url ($target_url) {
return parent::setVar("target_url", strval($target_url));
}
public function get_enabled () {
$enabled = parent::getVar("enabled");
settype($enabled, "boolean");
return $enabled;
}
public function set_enabled ($enabled) {
settype($enabled, "boolean");
return parent::setVar("enabled", $enabled);
}
}
final class urlrewriteurlhandler extends ArtObjectHandler {
const TABLE = "urlrewrite_url";
const PRIMARY_KEY = "id";
/* override */
public function __construct($db) {
parent::ArtObjectHandler($db, self::TABLE, "urlrewriteurl",
self::PRIMARY_KEY);
return;
}
private function __clone () {
return;
}
/* operation */
}
?>
Directory: /modules/urlrewrite/images
Directory: /modules/urlrewrite/include
File: /modules/urlrewrite/include/smarty.php
<?php
$xoopsTpl->register_modifier("urlrewrite", "smarty_urlrewrite");
if (true === function_exists("smarty_urlrewrite")) {
return;
}
function smarty_urlrewrite ($value) {
if ("1" !== $_SERVER["XOOPS_URLREWRITE_HTACCESS"]) {
return $value;
}
static $target_urls;
if (false === isset($target_urls)) {
$target_urls_file = XOOPS_UPLOAD_PATH."/urlrewrite/target_urls.php";
if (true === is_file($target_urls_file)) {
$target_urls = require $target_urls_file;
} else {
$target_urls = array();
}
}
if (array() === $target_urls) {
return $value;
}
if (substr($value, 0, strlen(XOOPS_URL) + 1) === XOOPS_URL."/") {
$xoops_uri = substr($value, strlen(XOOPS_URL) + 1);
$parse_xoops_uri = parse_url($xoops_uri);
$xoops_uri_path = $parse_xoops_uri["path"];
if (true === array_key_exists($xoops_uri_path, $target_urls)) {
$redirect_url = XOOPS_URL."/".$target_urls[$xoops_uri_path];
if (true === isset($parse_xoops_uri["query"])) {
$redirect_url .= "?".$parse_xoops_uri["query"];
}
if (true === isset($parse_xoops_uri["fragment"])) {
$redirect_url .= "#".$parse_xoops_uri["fragment"];
}
return $redirect_url;
} else {
return $value;
}
} else {
return $value;
}
}
?>
File: /modules/urlrewrite/index.php
<?php
require_once dirname(__FILE__)."/../../mainfile.php";
require_once XOOPS_ROOT_PATH."/header.php";
require_once XOOPS_ROOT_PATH."/footer.php";
?>
Directory: /modules/urlrewrite/sql
File: /modules/urlrewrite/sql/mysql.sql
CREATE TABLE urlrewrite_url (
id INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,
pattern VARCHAR(255) NOT NULL DEFAULT '',
target_url VARCHAR(255) NOT NULL DEFAULT '',
enabled INT(1) NOT NULL DEFAULT 0,
PRIMARY KEY (id)
) ENGINE = MyISAM;
Directory: /modules/urlrewrite/templates
Directory: /modules/urlrewrite/templates/blocks
File: /modules/urlrewrite/templates/blocks/urlrewrite_block_stub.html
<{strip}>
<{if true === $block.is_redirect}>
<{if array() === $block.patterns}>
This page is redirect from "<{$smarty.server.REDIRECT_URL}>" to "<{$smarty.server.SCRIPT_NAME}>".
<{else}>
<table>
<tr>
<th>
This page is redirect to
</th>
<th>
Enabled
</th>
</tr>
<{foreach from=$block.patterns item="pattern"}>
<tr class="<{cycle values='odd,even'}>">
<td>
<a href="<{$xoops_url}>/modules/urlrewrite/admin/edit.php?id=<{$pattern->get_primary_key()}>" target="_blank">
<{$pattern->get_target_url()}>
</a>
</td>
<td>
<{if true === $pattern->get_enabled()}>
<{$smarty.const._YES}>
<{else}>
<{$smarty.const._NO}>
<{/if}>
</td>
</tr>
<{/foreach}>
</table>
<{/if}>
<{else}>
<{if array() === $block.target_urls}>
<{else}>
<table>
<tr>
<th>
This page is able to redirect from
</th>
<th>
Enabled
</th>
</tr>
<{foreach from=$block.target_urls item="target_url"}>
<tr class="<{cycle values='odd,even'}>">
<td>
<a href="<{$xoops_url}>/modules/urlrewrite/admin/edit.php?id=<{$target_url->get_primary_key()}>" target="_blank">
<{$target_url->get_pattern()}>
</a>
</td>
<td>
<{if true === $target_url->get_enabled()}>
<{$smarty.const._YES}>
<{else}>
<{$smarty.const._NO}>
<{/if}>
</td>
</tr>
<{/foreach}>
</table>
<{/if}>
<{/if}>
<{if "" !== $block.script_url}>
<a href="<{$xoops_url}>/modules/urlrewrite/admin/createurl.php?script_url=<{$block.script_url}>" target="_blank">
Create redirect to "<{$block.script_url}>".
</a>
<{/if}>
<{/strip}>
File: /modules/urlrewrite/templates/urlrewrite_admin_create.html
<{strip}>
<form name="<{$create_form.name}>" action="<{$create_form.action}>" method="<{$create_form.method}>" <{$create_form.extra}> >
<{$create_form.javascript}>
<table style="width: 100%;">
<tr>
<th>
Pattern
</th>
<td class="<{cycle values='even,odd'}>">
<{$create_form.elements.pattern.body}>
</td>
</tr>
<tr>
<th>
Target URL
</th>
<td class="<{cycle values='even,odd'}>">
<{$create_form.elements.target_url.body}>
</td>
</tr>
<tr>
<th>
Enabled
</th>
<td class="<{cycle values='even,odd'}>">
<{$create_form.elements.enabled.body}>
</td>
</tr>
<tr>
<th>
</th>
<td class="<{cycle values='even,odd'}>">
<{$create_form.elements.submit.body}>
</td>
</tr>
</table>
</form>
<{/strip}>
File: /modules/urlrewrite/templates/urlrewrite_admin_createurl.html
<{strip}>
<form name="<{$create_form.name}>" action="<{$create_form.action}>" method="<{$create_form.method}>" <{$create_form.extra}> >
<{$create_form.javascript}>
<table style="width: 100%;">
<tr>
<th>
Pattern
</th>
<td class="<{cycle values='even,odd'}>">
<{$create_form.elements.pattern.body}>
</td>
</tr>
<tr>
<th>
Target URL
</th>
<td class="<{cycle values='even,odd'}>">
<{$create_form.elements.target_url.body}>
<{$script_url|escape}>
</td>
</tr>
<tr>
<th>
Enabled
</th>
<td class="<{cycle values='even,odd'}>">
<{$create_form.elements.enabled.body}>
</td>
</tr>
<tr>
<th>
</th>
<td class="<{cycle values='even,odd'}>">
<{$create_form.elements.submit.body}>
</td>
</tr>
</table>
</form>
<{/strip}>
File: /modules/urlrewrite/templates/urlrewrite_admin_delete.html
<{strip}>
<table style="width: 100%;">
<tr>
<th>
ID
</th>
<td class="<{cycle values='even,odd'}>">
<{$url->get_primary_key()}>
</td>
</tr>
<tr>
<th>
Pattern
</th>
<td class="<{cycle values='even,odd'}>">
<{$url->get_pattern()}>
</td>
</tr>
<tr>
<th>
Target URL
</th>
<td class="<{cycle values='even,odd'}>">
<{$url->get_target_url()}>
</td>
</tr>
<tr>
<th>
Enabled
</th>
<td class="<{cycle values='even,odd'}>">
<{if true === $url->get_enabled()}>
<{$smarty.const._YES}>
<{else}>
<{$smarty.const._NO}>
<{/if}>
</td>
</tr>
</table>
<{/strip}>
File: /modules/urlrewrite/templates/urlrewrite_admin_edit.html
<{strip}>
<form name="<{$edit_form.name}>" action="<{$edit_form.action}>" method="<{$edit_form.method}>" <{$edit_form.extra}> >
<{$edit_form.javascript}>
<{$edit_form.elements.id.body}>
<table style="width: 100%;">
<tr>
<th>
ID
</th>
<td class="<{cycle values='even,odd'}>">
<{$id}>
</td>
</tr>
<tr>
<th>
Pattern
</th>
<td class="<{cycle values='even,odd'}>">
<{$edit_form.elements.pattern.body}>
</td>
</tr>
<tr>
<th>
Target URL
</th>
<td class="<{cycle values='even,odd'}>">
<{$edit_form.elements.target_url.body}>
</td>
</tr>
<tr>
<th>
Enabled
</th>
<td class="<{cycle values='even,odd'}>">
<{$edit_form.elements.enabled.body}>
</td>
</tr>
<tr>
<th>
</th>
<td class="<{cycle values='even,odd'}>">
<{$edit_form.elements.submit.body}>
</td>
</tr>
</table>
</form>
<{/strip}>
File: /modules/urlrewrite/templates/urlrewrite_admin_htaccess.html
<{strip}>
<textarea style="width:100%;" rows="<{$rows}>" readonly>
<{$text|escape}>
</textarea>
<{/strip}>
File: /modules/urlrewrite/templates/urlrewrite_admin_index.html
<{strip}>
<table style="width: 100%;">
<tr>
<th>
ID
</th>
<th>
Pattern
</th>
<th>
Target URL
</th>
<th>
Enabled
</th>
<th>
<{$smarty.const._EDIT}>
</th>
<th>
<{$smarty.const._DELETE}>
</th>
</tr>
<{foreach from=$urls item="url"}>
<tr class="<{cycle values='even,odd'}>">
<td>
<{$url->get_primary_key()}>
</td>
<td>
<a href="<{$xoops_url}>/<{$url->get_pattern()}>" target="_blank">
<{$url->get_pattern()}>
</a>
</td>
<td>
<a href="<{$xoops_url}>/<{$url->get_target_url()}>" target="_blank">
<{$url->get_target_url()}>
</a>
</td>
<td>
<{if true === $url->get_enabled()}>
<{$smarty.const._YES}>
<{else}>
<{$smarty.const._NO}>
<{/if}>
</td>
<td>
<a href="<{$xoops_url}>/modules/urlrewrite/admin/edit.php?id=<{$url->get_primary_key()}>">
<{$smarty.const._EDIT}>
</a>
</td>
<td>
<a href="<{$xoops_url}>/modules/urlrewrite/admin/delete.php?id=<{$url->get_primary_key()}>">
<{$smarty.const._DELETE}>
</a>
</td>
</tr>
<{/foreach}>
</table>
<{/strip}>
File: /modules/urlrewrite/templates/urlrewrite_admin_smarty.html
<{strip}>
<fieldset>
<legend>
Enable URL rewrite in Smarty (Use the code below after $xoopsTpl initialization)
</legend>
require_once XOOPS_ROOT_PATH."/modules/urlrewrite/include/smarty.php";
</fieldset>
<fieldset>
<legend>
Smarty Rewrite Sample
</legend>
<{if 0 < count($urls)}>
<table style="width: 100%;">
<{foreach from=$urls item="url"}>
<tr>
<th>
ID
</th>
<th>
<{$url->get_primary_key()}>
</th>
</tr>
<tr>
<th>
Pattern
</th>
<td class="<{cycle values='odd,even'}>">
<a href="<{$xoops_url}>/<{$url->get_pattern()}>" target="_blank">
<{$url->get_pattern()}>
</a>
</td>
</tr>
<tr>
<th>
Target URL
</th>
<td class="<{cycle values='odd,even'}>">
<a href="<{$xoops_url}>/<{$url->get_target_url()}>" target="_blank">
<{$url->get_target_url()}>
</a>
</td>
</tr>
<tr>
<th>
Smarty Sample
</th>
<td class="<{cycle values='odd,even'}>">
<{ldelim}>"<{$xoops_url}>/<{$url->get_target_url()}>"|smarty_urlrewrite<{rdelim}>
</td>
</tr>
<tr>
<th>
Smarty Result
</th>
<td class="<{cycle values='odd,even'}>">
<{$xoops_url|cat:"/"|cat:$url->get_target_url()|smarty_urlrewrite|escape}>
</td>
</tr>
<{/foreach}>
</table>
<{/if}>
</fieldset>
<{/strip}>
File: /modules/urlrewrite/xoops_version.php
<?php
if (false === defined("XOOPS_ROOT_PATH")) {
exit();
}
$modversion["name"] = "Url Rewrite";
$modversion["version"] = 0.03;
$modversion["description"] = "Url Rewrite";
$modversion["author"] = "Hu Zhenghui http://xoops.org.cn/userinfo.php?uid=8616 QQ: 443089607 QQMail: hu_zhenghui@qq.com Skype: huzhenghui GMail: huzhengh@gmail.com GTalk: huzhengh";
$modversion['license'] = "All rights reserved.";
$modversion['image'] = "images/logo.gif";
$modversion['dirname'] = "urlrewrite";
$modversion['sqlfile']['mysql'] = "sql/mysql.sql";
$modversion['tables'] = array(
'urlrewrite_url'
);
$modversion["hasMain"] = 1;
$modversion['hasAdmin'] = 1;
$modversion['adminindex'] = "admin/index.php";
$modversion['adminmenu'] = "admin/menu.php";
$i = 1;
$modversion['blocks'][$i]['file'] = "stub.php";
$modversion['blocks'][$i]['name'] = "URL Rewrite Stub";
$modversion['blocks'][$i]['description'] = "URL Rewrite Stub";
$modversion['blocks'][$i]['show_func'] = "b_urlrewrite_stub";
$modversion['blocks'][$i]['template'] = 'urlrewrite_block_stub.html';
$i = 1;
$modversion['templates'][$i]['file'] = 'urlrewrite_admin_index.html';
$modversion['templates'][$i]['description'] = '';
$i++;
$modversion['templates'][$i]['file'] = 'urlrewrite_admin_create.html';
$modversion['templates'][$i]['description'] = '';
$i++;
$modversion['templates'][$i]['file'] = 'urlrewrite_admin_createurl.html';
$modversion['templates'][$i]['description'] = '';
$i++;
$modversion['templates'][$i]['file'] = 'urlrewrite_admin_edit.html';
$modversion['templates'][$i]['description'] = '';
$i++;
$modversion['templates'][$i]['file'] = 'urlrewrite_admin_delete.html';
$modversion['templates'][$i]['description'] = '';
$i++;
$modversion['templates'][$i]['file'] = 'urlrewrite_admin_htaccess.html';
$modversion['templates'][$i]['description'] = '';
$i++;
$modversion['templates'][$i]['file'] = 'urlrewrite_admin_smarty.html';
$modversion['templates'][$i]['description'] = '';
?>