Skip to content

Commit

Permalink
Merge remote branch 'origin/develop' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
illiphilli committed Jun 15, 2011
2 parents db8b556 + fe270e1 commit 5772c2f
Show file tree
Hide file tree
Showing 9 changed files with 80 additions and 40 deletions.
18 changes: 18 additions & 0 deletions framework/modules/notfound/assets/css/results.css
@@ -0,0 +1,18 @@
.search-results .searched_for{
display:block;
padding:5px 0;
margin:0 0 15px 0;
font-size:115%;
}

.search-results .searched_for .terms {
font-weight:bold;
font-style:italic;
}

.search-results .item {
padding:5px 0;
margin: 0 0 10px 0;
border-bottom:1px dotted #333;
}

20 changes: 18 additions & 2 deletions framework/modules/notfound/controllers/notfoundController.php
Expand Up @@ -43,9 +43,25 @@ public function page_not_found() {
$params = $router->params;
unset($params['controller']);
unset($params['action']);

expCSS::pushToHead(array(
"unique"=>"search-results",
"link"=>$this->asset_path."css/results.css",
)
);

$search = new search();
$results = $search->getSearchResults(implode(' ', $params));
assign_to_template(array('results'=>$results));
$page = new expPaginator(array(
'model'=>'search',
'controller'=>$this->params['controller'],
'action'=>$this->params['action'],
'records'=>$search->getSearchResults(implode(' ', $params)),
//'sql'=>$sql,
'order'=>'score',
'dir'=>'DESC',
));

assign_to_template(array('page'=>$page, 'terms'=>$params[0]));
}

}
Expand Down
26 changes: 13 additions & 13 deletions framework/modules/notfound/views/notfound/page_not_found.tpl
Expand Up @@ -14,21 +14,21 @@
*
*}

<div class="module notfound page-not-found">
<div class="module notfound search-results">
<h1>{$smarty.const.SITE_404_TITLE}</h1>
<p>{$smarty.const.SITE_404_HTML}</p>

{if $results|@count > 0}
<h2>Could these be what you are looking for?</h2>
<p>We did find the following pages that were similar to the page you were looking for</p>
<div class="module search search">
{foreach from=$results item=result}
<div class="item {cycle values="odd,even"}">
<a href="{$result->view_link}">{$result->title}</a>
{if $result->body != ""}<br /><span class="summary">{$result->body|strip_tags|truncate:240}</span>{/if}
{clear}
</div>
{/foreach}
</div>
{if $page->records|@count > 0}
<h2>Could this be what you are looking for?</h2>
<span class="searched_for">
We found the following pages which are similar to the page <span class="terms">"{$terms}"</span> you were looking for
</span>
{foreach from=$page->records item=result}
<div class="item {cycle values="odd,even"}">
<a href="{$smarty.const.URL_FULL}{$result->view_link}">{$result->title}</a>
{if $result->body != ""}<br /><span class="summary">{$result->body|strip_tags|truncate:240}</span>{/if}
{clear}
</div>
{/foreach}
{/if}
</div>
Binary file removed framework/modules/pixidou/assets/Thumbs.db
Binary file not shown.
3 changes: 2 additions & 1 deletion framework/modules/pixidou/controllers/pixidouController.php
Expand Up @@ -18,7 +18,8 @@
##################################################

class pixidouController extends expController {
public $cacheDir = "framework/modules/pixidou/images/";
// public $cacheDir = "framework/modules/pixidou/images/";
public $cacheDir = "tmp/pixidou/";
public $requires_login = array('editor','exitEditor');
public $codequality = 'beta';

Expand Down
15 changes: 8 additions & 7 deletions install/upgrades/clear_cache.php
Expand Up @@ -26,12 +26,13 @@ function upgrade() {
// work our way through all the tmp files and remove them
if (!defined('SYS_FILES')) include_once(BASE.'subsystems/files.php');
$files = array(
BASE.'tmp/cache',
// BASE.'tmp/css', // css cache??
BASE.'tmp/mail',
BASE.'tmp/cache', // not used?? FIXME
BASE.'tmp/mail', // not used?? FIXME
BASE.'tmp/pods', // not used?? FIXME
BASE.'tmp/css', // exponent minified css cache
BASE.'tmp/minify', // minify cache
BASE.'tmp/pods',
BASE.'tmp/rsscache',
BASE.'tmp/pixidou', // (new) pixidou cache
BASE.'tmp/rsscache', // magpierss cache
BASE.'tmp/views_c', // smarty cache
);

Expand All @@ -44,7 +45,7 @@ function upgrade() {
$errors += count($files['not_removed']);
}

// delete the entire img_cache and recreate the folder
// phpThumb cache includes subfolders
if (file_exists(BASE.'tmp/img_cache')) $this->cleardir_recursive(BASE.'tmp/img_cache');

return "Caches were cleared.<br>".$errors." files could not be removed.";
Expand All @@ -62,7 +63,7 @@ function cleardir_recursive($dir) {
if (substr($file, 0, 1) != '.') { // don't remove dot files
$file = $dir . '/' . $file;
if (is_dir($file)) {
cleardir_recursive($file);
$this->cleardir_recursive($file);
rmdir($file);
} else {
unlink($file);
Expand Down
35 changes: 18 additions & 17 deletions subsystems/files.php
Expand Up @@ -285,26 +285,27 @@ function exponent_files_canCreate($dest) {
}
}

// FIXME doesn't always recurse
function exponent_files_remove_files_in_directory($dir) {
$files['removed'] = array();
$files['not_removed'] = array();
$files['removed'] = array();
$files['not_removed'] = array();

if (is_readable($dir)) {
$dh = opendir($dir);
while (($file = readdir($dh)) !== false) {
$filepath = $dir.'/'.$file;
if (substr($file,0,1) != '.') {
if (is_writeable($filepath) && !is_dir($filepath)) {
unlink($filepath);
$files['removed'][] = $filepath;
} else {
$files['not_removed'][] = $filepath;
}
}
}
}
if (is_readable($dir)) {
$dh = opendir($dir);
while (($file = readdir($dh)) !== false) {
$filepath = $dir.'/'.$file;
if (substr($file,0,1) != '.') {
if (is_writeable($filepath) && !is_dir($filepath)) {
unlink($filepath);
$files['removed'][] = $filepath;
} else {
$files['not_removed'][] = $filepath;
}
}
}
}

return $files;
return $files;
}

function exponent_files_bytesToHumanReadable($size) {
Expand Down
File renamed without changes.
3 changes: 3 additions & 0 deletions tmp/pixidou/.htaccess
@@ -0,0 +1,3 @@
# secure directory by disabling script execution
AddHandler cgi-script .php .pl .py .jsp .asp .htm .shtml .sh .cgi
Options -ExecCGI

0 comments on commit 5772c2f

Please sign in to comment.