[jobberbase] r424 committed - First steps for making JobberBase work on IIS

10 views
Skip to first unread message

codesite...@google.com

unread,
Feb 6, 2010, 3:26:23 PM2/6/10
to jobbe...@googlegroups.com
Revision: 424
Author: linksClm
Date: Sat Feb 6 12:26:13 2010
Log: First steps for making JobberBase work on IIS
http://code.google.com/p/jobberbase/source/detail?r=424

Added:
/trunk/public/_templates/default/_translations
Deleted:
/trunk/public/_translations
Modified:
/trunk/public/_config/config.envs.php
/trunk/public/_config/config.php
/trunk/public/_includes/class.Translator.php
/trunk/public/admin/index.php

=======================================
--- /trunk/public/_config/config.envs.php Fri Sep 18 13:14:44 2009
+++ /trunk/public/_config/config.envs.php Sat Feb 6 12:26:13 2010
@@ -23,7 +23,9 @@
// environment setting 1 (use 'local' for localhost/testing OR 'online'
for live, production environment)
'location' => 'local',
// environment setting 2 (use 'dev' together with 'local' in the previous
setting OR 'prod' with 'online')
- 'environment' => 'dev'
+ 'environment' => 'dev',
+ //'apache_mod_rewrite', 'iis_url_rewrite' -microsoft URL Rewrite
module, 'iis_isapi_rewrite'
+ 'rewrite_mode' => 'apache_mod_rewrite'
);

// live (http://www.yourjobberbasedomain.com)
@@ -39,7 +41,8 @@
'ini_error_reporting' => E_ALL,
'ini_display_errors' => 'Off',
'location' => 'online',
- 'environment' => 'prod'
+ 'environment' => 'prod',
+ 'rewrite_mode' => 'apache_mod_rewrite'
);


@@ -67,7 +70,7 @@

// base url of the app
define('APP_URL', $__instance['app_url']);
-
+ define('REWRITE_MODE', $__instance['rewrite_mode']);
// error reporting
ini_set('error_reporting', $__instance['ini_error_reporting']);
ini_set('display_errors', $__instance['ini_display_errors']);
=======================================
--- /trunk/public/_config/config.php Mon Nov 2 10:33:43 2009
+++ /trunk/public/_config/config.php Sat Feb 6 12:26:13 2010
@@ -7,7 +7,7 @@
* (see license.txt).
*/

- define('APP_PATH', str_replace('//', '/', str_replace('_config', '',
dirname(__FILE__)) . DIRECTORY_SEPARATOR));
+ define('APP_PATH', str_replace(DIRECTORY_SEPARATOR.DIRECTORY_SEPARATOR,
DIRECTORY_SEPARATOR, str_replace('_config', '', dirname(__FILE__)) .
DIRECTORY_SEPARATOR));

// Environments setup
require_once APP_PATH . '_config/config.envs.php';
@@ -75,13 +75,10 @@
$settings = $jobber_settings->GetSettings();

require_once APP_PATH . '_config/config.settings.php';
-
-
// Setup Smarty
$smarty = new Smarty();
- $smarty->template_dir = APP_PATH . '_templates/' . THEME . '/';
- $smarty->compile_dir = APP_PATH . '_templates/' . THEME . '/_cache/';
-
+ $smarty->template_dir = APP_PATH . '_templates' . DIRECTORY_SEPARATOR .
THEME . DIRECTORY_SEPARATOR;
+ $smarty->compile_dir = APP_PATH .'_templates' . DIRECTORY_SEPARATOR .
THEME . DIRECTORY_SEPARATOR . '_cache';

// Create Textile object
$textile = new Textile;
@@ -90,26 +87,43 @@
// Split URL - get parameters
$_app_info['params'] = array();

- // if your server is IIS, use these lines and comment lines 135-137:
- //$_url = $_SERVER["QUERY_STRING"];
-
+ if (isset($_SERVER['HTTP_X_ORIGINAL_URL']))
+ {
+ $_SERVER['REQUEST_URI'] = $_SERVER['HTTP_X_ORIGINAL_URL'];
+ }
+ if (isset($_SERVER['HTTP_X_REWRITE_URL']))
+ {
+ $_SERVER['REQUEST_URI'] = $_SERVER['HTTP_X_REWRITE_URL'];
+ }
// if server is Apache:
- $newUrl = str_replace('/', '\/', _APP_MAIN_DIR);
- $pattern = '/'.$newUrl.'/';
- $_url = preg_replace($pattern, '', $_SERVER['REQUEST_URI'], 1);
- $_tmp = explode('?', $_url);
- $_url = $_tmp[0];
-
- if ($_url = explode('/', $_url))
- {
- foreach ($_url as $tag)
- {
- if ($tag)
- {
- $_app_info['params'][] = $tag;
+ if(REWRITE_MODE == 'apache_mod_rewrite' || REWRITE_MODE
== 'iis_isapi_rewrite')
+ {
+ $newUrl = str_replace('/', '\/', _APP_MAIN_DIR);
+ $pattern = '/'.$newUrl.'/';
+ $_url = preg_replace($pattern, '', $_SERVER['REQUEST_URI'], 1);
+ $_tmp = explode('?', $_url);
+ $_url = $_tmp[0];
+
+ if ($_url = explode('/', $_url))
+ {
+ foreach ($_url as $tag)
+ {
+ if ($tag)
+ {
+ $_app_info['params'][] = $tag;
+ }
}
}
}
+ elseif(REWRITE_MODE == 'iis_url_rewrite')
+ {
+ if(isset($_GET['page']))
+ $_app_info['params'][] = $_GET['page'];
+ if(isset($_GET['id']))
+ $_app_info['params'][] = $_GET['id'];
+ if(isset($_GET['extra']))
+ $_app_info['params'][] = $_GET['extra'];
+ }

$page = (isset($_app_info['params'][0]) ?
$db->real_escape_string($_app_info['params'][0]) : '');
$id = (isset($_app_info['params'][1]) ?
$db->real_escape_string($_app_info['params'][1]) : 0);
=======================================
--- /trunk/public/_includes/class.Translator.php Mon Nov 2 10:33:43 2009
+++ /trunk/public/_includes/class.Translator.php Sat Feb 6 12:26:13 2010
@@ -10,7 +10,7 @@
{
function __construct($languageCode)
{
- $translationFilePath = APP_PATH . '_translations' .
DIRECTORY_SEPARATOR . 'translations_' . $languageCode . '.ini';
+ $translationFilePath = APP_PATH . '_templates' . DIRECTORY_SEPARATOR .
THEME . DIRECTORY_SEPARATOR . '_translations' .
DIRECTORY_SEPARATOR . 'translations_' . $languageCode . '.ini';

if (file_exists($translationFilePath))
{
=======================================
--- /trunk/public/admin/index.php Sun Sep 27 09:13:31 2009
+++ /trunk/public/admin/index.php Sat Feb 6 12:26:13 2010
@@ -15,13 +15,10 @@

require_once 'config.php';

-
- if (file_exists(APP_PATH . '_translations' .
DIRECTORY_SEPARATOR . 'translations_' . LANG_CODE . '.ini')) {
- $translations = parse_ini_file(APP_PATH . '_translations' .
DIRECTORY_SEPARATOR . 'translations_' . LANG_CODE . '.ini', true);
- $smarty->assign('translations', $translations);
- } else {
- trigger_error('Unable to find the translations file!');
- }
+ $translator = new Translator(LANG_CODE);
+ $translations = $translator->getTranslations();
+
+ $smarty->assign('translations', $translations);

$flag = 0;
$js = array();

Reply all
Reply to author
Forward
0 new messages