Revision 1908
Added by Dietmar over 11 years ago
functions.php | ||
---|---|---|
4 | 4 |
* @category frontend |
5 | 5 |
* @package framework |
6 | 6 |
* @author Ryan Djurovich,WebsiteBaker Project |
7 |
* @copyright 2009-2012, WebsiteBaker Org. e.V.
|
|
8 |
* @link http://www.websitebaker2.org/
|
|
7 |
* @copyright 2009-2013, WebsiteBaker Org. e.V.
|
|
8 |
* @link http://www.websitebaker.org/ |
|
9 | 9 |
* @license http://www.gnu.org/licenses/gpl.html |
10 |
* @platform WebsiteBaker 2.8.x
|
|
10 |
* @platform WebsiteBaker 2.8.4
|
|
11 | 11 |
* @requirements PHP 5.2.2 and higher |
12 | 12 |
* @version $Id$ |
13 | 13 |
* @filesource $HeadURL$ |
... | ... | |
525 | 525 |
$menu_title = $database->get_one($sql); |
526 | 526 |
return $menu_title; |
527 | 527 |
} |
528 |
// Function to get a pages filename in sub |
|
529 |
function get_sub_filename($id) |
|
530 |
{ |
|
531 |
$database = WbDatabase::getInstance(); |
|
532 |
// Get title |
|
533 |
$sql = 'SELECT `link` FROM `'.TABLE_PREFIX.'pages` ' |
|
534 |
.'WHERE `page_id` = '.$id.' ' |
|
535 |
. 'AND `level`>=0'; |
|
536 |
$sRetval = basename($database->get_one($sql)); |
|
537 |
return $sRetval; |
|
538 |
} |
|
528 | 539 |
|
529 | 540 |
// Function to get all parent page titles |
530 | 541 |
function get_parent_titles($parent_id) |
531 | 542 |
{ |
532 |
$titles[] = get_menu_title($parent_id);
|
|
543 |
$titles[] = get_sub_filename($parent_id);
|
|
533 | 544 |
if(is_parent($parent_id) != false) { |
534 | 545 |
$parent_titles = get_parent_titles(is_parent($parent_id)); |
535 | 546 |
$titles = array_merge($titles, $parent_titles); |
... | ... | |
660 | 671 |
global $admin, $MESSAGE; |
661 | 672 |
$retVal = array(); |
662 | 673 |
$wb_path = rtrim(str_replace('\/\\', '/', WB_PATH), '/'); |
663 |
if( ($sAbsDir=='') || ($sAbsDir == $wb_path) ) { return $retVal;}
|
|
674 |
if( ($sAbsDir=='') || ($sAbsDir == $wb_path) ) { return $retVal;}
|
|
664 | 675 |
|
665 | 676 |
if ( $make_dir==true ) { |
666 | 677 |
// Check to see if the folder already exists |
... | ... | |
675 | 686 |
return $retVal; |
676 | 687 |
} |
677 | 688 |
|
689 |
//$retVal[] = $sAbsDir; |
|
690 |
//return $retVal; |
|
691 |
|
|
678 | 692 |
if( is_writable($sAbsDir) ) |
679 | 693 |
{ |
680 | 694 |
// if(file_exists($sAbsDir.'/index.php')) { unlink($sAbsDir.'/index.php'); } |
681 | 695 |
// Create default "index.php" file |
682 | 696 |
$rel_pages_dir = str_replace($wb_path, '', dirname($sAbsDir) ); |
683 | 697 |
$step_back = str_repeat( '../', substr_count($rel_pages_dir, '/')+1 ); |
684 |
|
|
685 | 698 |
$sResponse = $_SERVER['SERVER_PROTOCOL'].' 301 Moved Permanently'; |
686 | 699 |
$content = |
687 | 700 |
'<?php'."\n". |
... | ... | |
1387 | 1400 |
* try to remove access files and build new folder protect files |
1388 | 1401 |
*/ |
1389 | 1402 |
$sTempDir = (defined('PAGES_DIRECTORY') && (PAGES_DIRECTORY != '') ? PAGES_DIRECTORY : ''); |
1390 |
// if(($sTempDir!='') && is_writeable(WB_PATH.$sTempDir)==true) {
|
|
1391 |
// if(rm_full_dir (WB_PATH.$sTempDir, true )==false) {
|
|
1392 |
// $retVal[] = 'Could not delete existing access files';
|
|
1393 |
// }
|
|
1394 |
// }
|
|
1403 |
if(($sTempDir!='') && is_writeable(WB_PATH.$sTempDir)==true) { |
|
1404 |
if(rm_full_dir (WB_PATH.$sTempDir, true )==false) { |
|
1405 |
$retVal[] = 'Could not delete existing access files'; |
|
1406 |
} |
|
1407 |
} |
|
1395 | 1408 |
$retVal = createFolderProtectFile(rtrim( WB_PATH.PAGES_DIRECTORY,'/') ); |
1396 | 1409 |
/** |
1397 | 1410 |
* Reformat/rebuild all existing access files |
Also available in: Unified diff
! class.admin.php corrected url_help,
add Translat::disableAddon() in methode print_footer
! frontend.functions.php page_content() set $sSectionIdPrefix to the right format
! functions.php change get_parent_titles from menu_title to filename