Permalink
Browse files

Merge pull request #62 from ZetaTwo/master

Relative links and UTF8 support. -- Thank you to @ZetaTwo!
  • Loading branch information...
Datawalke committed Oct 11, 2012
2 parents 7377425 + 7afa239 commit a7aa26a264188936ef925b874126b504892f88f7
View
@@ -45,8 +45,8 @@ public function beforeFilter() {
}
public function getWidgets($page='') {
- if(empty($page)) { $page = $_SERVER['REQUEST_URI']; }
- if(strpos($_SERVER['REQUEST_URI'], 'questions/') == 1) { $page = '/questions/view'; }
+ if(empty($page)) { $page = Router::url(null, false); }
+ //if(strpos($_SERVER['REQUEST_URI'], 'questions/') == 1) { $page = '/questions/view'; }
$this->set('widgets', $this->Widget->findPage($page));
}
View
@@ -33,7 +33,7 @@
* In production mode, flash messages redirect after a time interval.
* In development mode, you need to click the flash message to continue.
*/
- Configure::write('debug', 2);
+ Configure::write('debug', 0);
/**
* CakePHP Log Level:
@@ -307,4 +307,4 @@
Configure::write('recaptcha.publickey', '6LcgswkAAAAAAC15Pg3j8YDKFCi-mHYO_qHpoPH6');
Configure::write('recaptcha.privatekey', '6LcgswkAAAAAAApN8RkAjBhu2RgDGXGwh5onuUpW');
- Configure::write('Config.language', 'fre');
+ Configure::write('Config.language', 'eng');
@@ -84,6 +84,7 @@ class DATABASE_CONFIG {
'login' => 'username',
'password' => '',
'database' => '',
+ 'encoding' => 'utf8',
);
}
@@ -10,15 +10,16 @@ public function beforeFilter() {
//$this->Auth->allow('*');
}
- public function start() {
- $this->set('write_config', is_writable(APP.'/config'));
- $this->set('write_tmp', is_writable(TMP));
- $this->set('write_uploads', is_writable(APP.'/webroot/img/uploads/users'));
- $this->set('write_thumbs', is_writable(APP.'/webroot/img/thumbs'));
- $this->set('write_database', is_writable(APP.'/config/database.php'));
- if(is_writable(APP.'/config/database.php') && is_writable(TMP) && is_writable(APP.'/webroot/img/uploads/users') && is_writable(APP.'/webroot/img/thumbs')) {
- $this->set('continue', true);
- }
+ public function start() {
+ $writeChecks = array(
+ 'config' => is_writable(APP.'/config'),
+ 'tmp' => is_writable(TMP),
+ 'tmp_cache' => is_writable(TMP.'/cache'),
+ 'uploads' => is_writable(APP.'/webroot/img/uploads/users'),
+ 'thumbs' => is_writable(APP.'/webroot/img/thumbs'),
+ 'database' => is_writable(APP.'/config/database.php')
+ );
+ $this->set('writeChecks', $writeChecks);
}
public function license() {
@@ -60,6 +61,7 @@ class DATABASE_CONFIG {
'login' => '" . $this->data['Database']['login'] . "',
'password' => '" . $this->data['Database']['password'] . "',
'database' => '" . $this->data['Database']['database'] . "',
+ 'encoding' => 'utf8',
);
}
?>
@@ -42,7 +42,7 @@ public function add() {
$this->set('referer', $this->referer());
if(!empty($this->data)) {
$this->data['Widget']['global'] = ($this->data['Widget']['global'] == 'on') ? 1 : 0;
- $page = str_replace(array('/widgets/add', '?'), array('',''), $_SERVER['REQUEST_URI']);
+ $page = end(explode('/widgets/add', Router::url(null, false)));
$this->data['Widget']['page'] = $page;
if(strpos($page, 'questions/') == 1) { $this->data['Widget']['page'] = '/questions/view'; }
if($this->Widget->save($this->data)) {
View
@@ -51,11 +51,7 @@ class Post extends AppModel {
);
public function niceUrl($url) {
- $prohibited = array(' ', '!', "'", '"', '@', '#', '$', '%', '^', '&', '*', '?', ',', '/', '<', '>', ':', ';',
- 'é', 'è', '{', '}', ')', '(');
- $replace = array('-', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '',
- 'e', 'e', '', '', '', '');
- return strtolower(str_replace($prohibited, $replace, $url));
+ return preg_replace("/[^0-9a-zA-Z-]/", "", str_replace(' ', '-', $url));
}
public function monsterSearch($type, $page, $search) {
@@ -1,10 +1,10 @@
<div id="admin_header" class="wrapper">
<h2><?=$selected;?></h2>
<ul class="tabs">
- <li <? if($selected == 'Settings') { echo 'class="selected"'; } ?>><a href="/admin">Settings</a></li>
- <li <? if($selected == 'Flagged Posts') { echo 'class="selected"'; } ?>><a href="/admin/flagged">Flagged Posts</a></li>
- <li <? if($selected == 'Users') { echo 'class="selected"'; } ?>><a href="/admin/users">Users</a></li>
- <li <? if($selected == 'Blacklist') { echo 'class="selected"'; } ?>><a href="/admin/blacklist">Blacklist</a></li>
- <li <? if($selected == 'Remote Settings') { echo 'class="selected"'; } ?>><a href="/admin/remote_settings">Remote Settings</a></li>
+ <li <? if($selected == 'Settings') { echo 'class="selected"'; } ?>><?=$html->link(__('Settings',true),'/admin');?></li>
+ <li <? if($selected == 'Flagged Posts') { echo 'class="selected"'; } ?>><?=$html->link(__('Flagged Posts',true),'/admin/flagged');?></li>
+ <li <? if($selected == 'Users') { echo 'class="selected"'; } ?>><?=$html->link(__('Users',true),'/admin/users');?></li>
+ <li <? if($selected == 'Blacklist') { echo 'class="selected"'; } ?>><?=$html->link(__('Blacklist',true),'/admin/blacklist');?></li>
+ <li <? if($selected == 'Remote Settings') { echo 'class="selected"'; } ?>><?=$html->link(__('Remote Settings',true),'/admin/remote_settings');?></li>
</ul>
</div>
@@ -14,24 +14,27 @@
<p>Directory permission tests:</p>
<ul>
- <li>/app/config <?if($write_config) { echo '<span class="success">is writable.</span>'; }
+ <li>/app/config <?if($writeChecks['config']) { echo '<span class="success">is writable.</span>'; }
else { echo '<span class="error">is not writable.</span>';}?>
</li>
- <li>/app/config/database.php <?if($write_database) { echo '<span class="success">is writable.</span>'; }
+ <li>/app/config/database.php <?if($writeChecks['database']) { echo '<span class="success">is writable.</span>'; }
else { echo '<span class="error">is not writable.</span>';}?>
</li>
- <li>/app/tmp <?if($write_tmp) { echo '<span class="success">is writable.</span>'; }
+ <li>/app/tmp <?if($writeChecks['tmp']) { echo '<span class="success">is writable.</span>'; }
else { echo '<span class="error">is not writable.</span>';}?>
</li>
- <li>/app/webroot/img/thumbs <?if($write_thumbs) { echo '<span class="success">is writable.</span>'; }
+ <li>/app/tmp/cache <?if($writeChecks['tmp_cache']) { echo '<span class="success">is writable.</span>'; }
+ else { echo '<span class="error">is not writable.</span>';}?>
+ </li>
+ <li>/app/webroot/img/thumbs <?if($writeChecks['thumbs']) { echo '<span class="success">is writable.</span>'; }
else { echo '<span class="error">is not writable.</span>';}?>
</li>
- <li>/app/webroot/img/uploads/users <?if($write_uploads) { echo '<span class="success">is writable.</span>'; }
+ <li>/app/webroot/img/uploads/users <?if($writeChecks['uploads']) { echo '<span class="success">is writable.</span>'; }
else { echo '<span class="error">is not writable.</span>';}?>
</li>
</ul>
-<? if($continue) { ?>
+<? if(!in_array(false, $writeChecks)) { ?>
<p>Looks like you are good to go. <a href="install/database-config">Lets Continue!</a></p>
<? } else { ?>
<p><span class="error">Look above for errors you must fix.</span></p>
Oops, something went wrong.

0 comments on commit a7aa26a

Please sign in to comment.