예제 #1
0
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.

 * See docs/COPYING for the complete license.
*/
//Make sure the file isn't accessed directly.
defined('IN_PLUCK') or exit('Access denied!');
//If we want to restore a page.
if ($var2 == 'page' && file_exists('data/trash/pages/' . $var1 . '.php')) {
    //We can't restore the page if there is a page with the same name.
    if (get_page_filename($var1) != false) {
        show_error($lang['trashcan']['same_page_name'], 1);
        redirect('?action=trashcan', 3);
    } else {
        $pages = read_dir_contents(PAGE_DIR, 'files');
        if ($pages == false) {
            $next_number = 1;
        } else {
            $next_number = count($pages) + 1;
        }
        rename('data/trash/pages/' . $var1 . '.php', PAGE_DIR . '/' . $next_number . '.' . $var1 . '.php');
        //Redirect.
        show_error($lang['trashcan']['restoring'], 3);
        redirect('?action=trashcan', 1);
    }
} elseif ($var2 == 'file' && file_exists('data/trash/files/' . $var1)) {
    //First check if there isn't an image with the same name.
    if (!file_exists('files/' . $var1)) {
        copy('data/trash/files/' . $var1, 'files/' . $var1);
        chmod('files/' . $var1, 0777);
예제 #2
0
파일: deletepage.php 프로젝트: MenZil/pluck
                }
                unset($page);
            }
        }
    }
    //Move the file.
    rename(PAGE_DIR . '/' . get_page_filename($var1), 'data/trash/pages/' . $newfile . '.php');
    //Then move the sub-pages, if any.
    if (isset($sub_pages)) {
        foreach ($sub_pages as $sub_page) {
            rename(PAGE_DIR . '/' . $sub_page, 'data/trash/pages/' . str_replace(get_sub_page_dir(get_page_seoname($sub_page)) . '/', '', get_page_seoname($sub_page)) . '.php');
        }
        //Delete the dir where the sub-pages were in.
        rmdir(PAGE_DIR . '/' . $var1);
    }
    //If it's a sub-page, we have to do a few things.
    if (strpos($var1, '/') !== false) {
        //Delete the dir, if there are no other pages.
        if (read_dir_contents(PAGE_DIR . '/' . get_sub_page_dir($var1), 'files') == false) {
            rmdir(PAGE_DIR . '/' . get_sub_page_dir($var1));
        } else {
            reorder_pages(PAGE_DIR . '/' . get_sub_page_dir($var1));
        }
    } else {
        reorder_pages(PAGE_DIR);
    }
    //Show message.
    show_error($lang['trashcan']['moving_item'], 3);
}
//Redirect user.
redirect('?action=page', 0);
예제 #3
0
/**
 * Generates page menu. Only for internal use. For themes, use theme_menu().
 *
 * @since 4.7
 * @package site
 */
function theme_menu_data($block, $inline, $active_id, $level, $dir)
{
    //If specified directory does not exist, just return.
    if (!is_dir($dir)) {
        return;
    }
    $files = read_dir_contents($dir, 'files');
    if ($files) {
        //Sort the array.
        natcasesort($files);
        echo '<' . $block . '>';
        foreach ($files as $file) {
            include $dir . '/' . $file;
            $file = get_page_seoname($dir . '/' . $file);
            //Only display in menu if page isn't hidden by user.
            if (isset($hidden) && $hidden == 'no') {
                //Get parents of the currently displayed page
                $parents = get_page_parents(CURRENT_PAGE_SEONAME);
                //Strip parents from $file, but only if it's a sub page
                if (strpos($file, '/') !== false && file_exists(PAGE_DIR . '/' . get_page_filename($file))) {
                    $file_levels = preg_split('|\\/|', $file);
                    $file_stripped = $file_levels[count($file_levels) - 1];
                } else {
                    $file_stripped = $file;
                }
                //Show an active inline for current page...
                if ($active_id && CURRENT_PAGE_SEONAME == $file) {
                    echo '<' . $inline . ' class="' . $active_id . '" id="' . $active_id . '">';
                } elseif ($active_id && $parents && array_search($file_stripped, $parents) !== false) {
                    echo '<' . $inline . ' class="' . $active_id . '">';
                } else {
                    echo '<' . $inline . '>';
                }
                //Unset parents array
                unset($parents);
                //Display link
                echo '<a href="' . SITE_URL . '/' . PAGE_URL_PREFIX . $file . '" >' . $title . '</a>';
                preg_match_all('|\\/|', $file, $page_level);
                $page_level = count($page_level[0]);
                if ($level > $page_level && is_dir(PAGE_DIR . '/' . $file)) {
                    theme_menu_data($block, $inline, $active_id, $level, PAGE_DIR . '/' . $file);
                }
                echo '</' . $inline . '>';
            }
        }
        unset($file);
        echo '</' . $block . '>';
    }
}
예제 #4
0
파일: trashcan.php 프로젝트: MenZil/pluck
				</a>
			</span>
		</div>
	<?php 
    }
    unset($image);
}
?>
	<br /><br />
	<span class="kop2"><?php 
echo $lang['general']['files'];
?>
</span>
<?php 
//Read files in array
$files = read_dir_contents('data/trash/files', 'files');
if ($files == false) {
    echo '<span class="kop4">' . $lang['general']['nothing_yet'] . '</span>';
} else {
    foreach ($files as $file) {
        ?>
		<div class="menudiv">
			<span>
				<img src="data/image/file.png" alt="" />
			</span>
			<span style="width: 350px;">
				<span style="font-size: 17pt;"><?php 
        echo $file;
        ?>
</span>
			</span>
예제 #5
0
function albums_page_admin_imagedown()
{
    global $lang, $var1, $var2;
    //Check if images exist.
    if (isset($var1, $var2) && file_exists(ALBUMS_DIR . '/' . $var1 . '/' . albums_get_php_filename($var1, $var2))) {
        $current_parts = explode('.', albums_get_php_filename($var1, $var2));
        $files = read_dir_contents(ALBUMS_DIR . '/' . $var1, 'files');
        $number_of_files = 0;
        //Count the number of PHP files.
        foreach ($files as $file) {
            $file_parts = explode('.', $file);
            if (isset($file_parts[3])) {
                $number_of_files++;
            }
        }
        //We can't lower the last image, so we have to check.
        if ($number_of_files == $current_parts[0]) {
            show_error($lang['albums']['already_last'], 2);
            redirect('?module=albums&page=editalbum&var1=' . $var1, 2);
            include_once 'data/inc/footer.php';
            exit;
        }
        //Now we need to find the name of the other image, so we can switch numbers.
        foreach ($files as $file) {
            $file_parts = explode('.', $file);
            if ($current_parts[0] + 1 == $file_parts[0]) {
                $next_parts = $file_parts;
                break;
            }
        }
        unset($file);
        //Switch the numbers.
        $current_image_new = $next_parts[0] . '.' . $current_parts[1] . '.' . $current_parts[2] . '.php';
        $next_image_new = $current_parts[0] . '.' . $next_parts[1] . '.' . $next_parts[2] . '.php';
        //And finally, rename the files.
        rename(ALBUMS_DIR . '/' . $var1 . '/' . implode('.', $current_parts), ALBUMS_DIR . '/' . $var1 . '/' . $current_image_new);
        rename(ALBUMS_DIR . '/' . $var1 . '/' . implode('.', $next_parts), ALBUMS_DIR . '/' . $var1 . '/' . $next_image_new);
        //Show message.
        show_error($lang['general']['changing_rank'], 3);
    }
    //Redirect.
    redirect('?module=albums&page=editalbum&var1=' . $var1, 0);
}
예제 #6
0
파일: images.php 프로젝트: MenZil/pluck
            ?>
</strong>
				</div>
			<?php 
        }
    }
}
//Display list of uploaded pictures.
?>
<span class="kop2"><?php 
echo $lang['images']['uploaded'];
?>
</span>
<?php 
//Show the uploaded images
$images = read_dir_contents('images', 'files');
if ($images) {
    natcasesort($images);
    foreach ($images as $image) {
        ?>
			<div class="menudiv">
				<span>
					<img src="data/image/image.png" alt="" />
				</span>
				<span class="title-page"><?php 
        echo $image;
        ?>
</span>
				<span>
					<a href="images/<?php 
        echo $image;
예제 #7
0
파일: functions.php 프로젝트: MenZil/pluck
/**
 * Load categories in an array. Will return FALSE if no categories exist.
 * @param bool $only_return_title If set to TRUE, only the title will be returned (seoname will be discarded).
 * @return mixed
 */
function blog_get_categories($only_return_title = FALSE)
{
    $files = read_dir_contents(BLOG_CATEGORIES_DIR, 'files');
    if ($files) {
        natcasesort($files);
        foreach ($files as $category) {
            include BLOG_CATEGORIES_DIR . '/' . $category;
            if ($only_return_title == TRUE) {
                $categories[] = $category_title;
            } else {
                $categories[] = array('title' => $category_title, 'seoname' => str_replace('.php', '', $category));
            }
        }
        unset($category);
        return $categories;
    } else {
        return false;
    }
}
예제 #8
0
파일: pagedown.php 프로젝트: MenZil/pluck
//Make sure the file isn't accessed directly.
defined('IN_PLUCK') or exit('Access denied!');
//Check if file exists.
if (file_exists(PAGE_DIR . '/' . get_page_filename($var1))) {
    $current_page_filename = get_page_filename($var1);
    if (strpos($current_page_filename, '/') !== false) {
        $patch = explode('/', $current_page_filename);
        $count = count($patch);
        $current_page_filename = $patch[$count - 1];
        unset($patch[$count - 1]);
        $patch = implode('/', $patch);
        $patch = '/' . $patch;
    } else {
        $patch = '';
    }
    $pages = read_dir_contents(PAGE_DIR . $patch, 'files');
    sort($pages, SORT_NUMERIC);
    //Find current page number, and the next page number and filename.
    foreach ($pages as $number => $page) {
        if ($current_page_filename == $page) {
            $current_page_number = $number - 1;
            $next_page_number = $number;
        } elseif (isset($current_page_number)) {
            $not_last_page = true;
        }
    }
    //Check if the page isn't already the last one.
    if (!isset($not_last_page)) {
        show_error($lang['page']['last'], 2);
        redirect('?action=page', 2);
        include_once 'data/inc/footer.php';
예제 #9
0
 * (at your option) any later version.

 * See docs/COPYING for the complete license.
*/
//Make sure the file isn't accessed directly.
defined('IN_PLUCK') or exit('Access denied!');
?>
<p>
	<strong><?php 
echo $lang['theme_uninstall']['message'];
?>
</strong>
</p>

<?php 
$dirs = read_dir_contents('data/themes', 'dirs');
if ($dirs) {
    natcasesort($dirs);
    foreach ($dirs as $dir) {
        if (file_exists('data/themes/' . $dir . '/info.php')) {
            include_once 'data/themes/' . $dir . '/info.php';
            //If theme is current theme, dont show it
            if ($themedir !== THEME) {
                ?>
			<div class="menudiv">
				<span>
					<img src="data/image/themes.png" alt="" />
				</span>
				<span class="title-module"><?php 
                echo $themename;
                ?>
예제 #10
0
             $tar = new TarLib($dir . '/' . $filename);
             //And extract it.
             $tar->Extract(FULL_ARCHIVE, $dir);
             //After extraction: delete the tar.gz-file.
             unlink($dir . '/' . $filename);
             $dirtocreate = str_replace('.tar.gz', '', $filename);
         } else {
             //if not tar.gz then this file must be zip
             $zip = new UnZIP($dir . '/' . $filename);
             //And extract it.
             $zip->extract();
             //After extraction: delete the zip-file.
             unlink($dir . '/' . $filename);
             $dirtocreate = str_replace('.zip', '', $filename);
             //If there is a subdirectory like: module/module
             if (is_dir('data/modules/' . $dirtocreate . '/' . $dirtocreate) && !read_dir_contents('data/modules/' . $dirtocreate, 'files')) {
                 rename('data/modules/' . $dirtocreate, 'data/modules/_157#93_');
                 rename('data/modules/_157#93_/' . $dirtocreate, 'data/modules/' . $dirtocreate);
                 rmdir('data/modules/_157#93_');
             }
         }
         //Make directory for module settings (if it doesn't exist).
         if (!file_exists('data/settings/modules/' . $dirtocreate)) {
             mkdir('data/settings/modules/' . $dirtocreate);
             chmod('data/settings/modules/' . $dirtocreate, 0777);
         }
         //Display success message.
         show_error($lang['modules_install']['success'], 3);
         redirect('?action=managemodules', 2);
     }
 }
예제 #11
0
/**
 * Gets the filename of the php-config file of an image.
 * @param string $album The album containing the image.
 * @param string $seoname The seoname of the image.
 * @return string The filename.
 */
function albums_get_php_filename($album, $seoname)
{
    $files = read_dir_contents(ALBUMS_DIR . '/' . $album, 'files');
    foreach ($files as $file) {
        $parts = explode('.', $file);
        if (count($parts) == 4) {
            list($number, $fdirname, $ext, $php) = $parts;
            if ($seoname == $fdirname && file_exists(ALBUMS_DIR . '/' . $album . '/' . $fdirname . '.' . $ext)) {
                return $file;
            }
        }
    }
    return false;
}
예제 #12
0
function albums_theme_main($area, $category)
{
    //Only show category listing if category = null
    if ($category == null) {
        $albums = albums_get_albums();
        if ($albums != FALSE) {
            //Loop through dirs.
            foreach ($albums as $album) {
                include ALBUMS_DIR . '/' . $album['seoname'] . '.php';
                //Find the first image.
                $files = read_dir_contents(ALBUMS_DIR . '/' . $album['seoname'], 'files');
                //Only display album if it contains images.
                if (!empty($files)) {
                    natcasesort($files);
                    foreach ($files as $file) {
                        $parts = explode('.', $file);
                        if (count($parts) == 4) {
                            list($number, $fdirname, $ext, $php) = $parts;
                            $first_image = $fdirname . '.' . $ext;
                            break;
                        }
                    }
                    unset($file);
                    ?>
					<div class="album">
						<table>
							<tr>
								<td>
									<a href="<?php 
                    echo SITE_URL . '/' . PAGE_URL_PREFIX . CURRENT_PAGE_SEONAME . ALBUM_URL_PREFIX . $album['seoname'];
                    ?>
" title="album <?php 
                    echo $album['title'];
                    ?>
">
										<img alt="<?php 
                    echo $album['title'];
                    ?>
" title="<?php 
                    echo $album['title'];
                    ?>
" src="<?php 
                    echo SITE_URL;
                    ?>
/data/modules/albums/albums_getimage.php?image=<?php 
                    echo $album['seoname'];
                    ?>
/thumb/<?php 
                    echo $first_image;
                    ?>
" />
									</a>
								</td>
								<td>
									<span class="albuminfo">
										<a href="<?php 
                    echo SITE_URL . '/' . PAGE_URL_PREFIX . CURRENT_PAGE_SEONAME . ALBUM_URL_PREFIX . $album['seoname'];
                    ?>
" title="<?php 
                    echo $album['title'];
                    ?>
"><?php 
                    echo $album['title'];
                    ?>
</a>
									</span>
								</td>
							</tr>
						</table>
					</div>
					<?php 
                }
            }
            unset($albums);
        }
    } else {
        albums_site_show_images(seo_url($category));
    }
}
예제 #13
0
파일: update.php 프로젝트: MenZil/pluck
     //Delete categories file
     unlink('data/settings/modules/blog/categories.dat');
 }
 //----------------
 //Albums
 //----------------
 //Check if there are albums to convert
 if (file_exists('data/settings/modules/albums')) {
     $albums = read_dir_contents('data/settings/modules/albums', 'dirs');
     if ($albums != FALSE) {
         foreach ($albums as $album) {
             //Save album file
             $data['album_name'] = $album;
             save_file('data/settings/modules/albums/' . $album . '.php', $data);
             //Convert images
             $images = read_dir_contents('data/settings/modules/albums/' . $album, 'files');
             if (isset($images)) {
                 natcasesort($images);
                 $count = 1;
                 foreach ($images as $image) {
                     //Get image file extension (.jpg or .jpeg)
                     if (file_exists('data/settings/modules/albums/' . $album . '/' . str_replace('.php', '', $image) . '.jpg')) {
                         $ext = '.jpg';
                     }
                     if (file_exists('data/settings/modules/albums/' . $album . '/' . str_replace('.php', '', $image) . '.jpeg')) {
                         $ext = '.jpeg';
                     }
                     if (strpos($image, '.php')) {
                         rename('data/settings/modules/albums/' . $album . '/' . $image, 'data/settings/modules/albums/' . $album . '/' . $count . '.' . str_replace('.php', '', $image) . $ext . '.php');
                         $count++;
                     }
예제 #14
0
 /** Reads contents of directory
  * @param string $dir
  * @param array $files
  * @param array $directories
  * @param array $used
  * @deprecated Replaced by System\Directory::find
  * @return void
  */
 function read_dir_contents($dir, array &$files = array(), array &$directories = array(), array &$used = array())
 {
     $od = opendir($dir);
     while ($f = readdir($od)) {
         if ($f != '.' && $f != '..') {
             $fp = $dir . '/' . $f;
             if (is_dir($fp)) {
                 read_dir_contents($fp, $files, $directories, $used);
                 if (!in_array($fp, $used)) {
                     $directories[] = $fp;
                     $used[] = $fp;
                 }
             } else {
                 if (!in_array($fp, $used)) {
                     $files[] = $fp;
                     $used[] = $fp;
                 }
             }
         }
     }
     closedir($od);
 }
예제 #15
0
unset($page_dir);
if (file_exists('data/settings/themepref.php')) {
    define('THEME', $themepref);
    define('THEME_DIR', 'data/themes/' . $themepref);
}
if (isset($direction) && ($direction = 'rtl')) {
    define('DIRECTION_RTL', true);
} else {
    define('DIRECTION_RTL', false);
}
if (isset($_GET['module'])) {
    define('MODULE_DIR', 'data/modules/' . $_GET['module']);
    define('MODULE_SETTINGS_DIR', 'data/settings/modules/' . $_GET['module']);
}
if (file_exists(PAGE_DIR)) {
    $homepage = read_dir_contents(PAGE_DIR, 'files');
    if ($homepage != false) {
        sort($homepage, SORT_NUMERIC);
        $homepage = get_page_seoname($homepage[0]);
    } else {
        $homepage = '404';
    }
    $page_url_prefix = '?file=';
    run_hook('page_url_prefix', array(&$page_url_prefix));
    define('PAGE_URL_PREFIX', $page_url_prefix);
    unset($page_url_prefix);
    $homepage = SITE_URI . '/' . PAGE_URL_PREFIX . $homepage;
    run_hook('const_home_page', array(&$homepage));
    define('HOME_PAGE', $homepage);
    unset($homepage);
}
예제 #16
0
/**
 * Save a page with a lot of options.
 *
 * @since 4.7
 * @package admin
 * @param mixed $title if string - The title, if array title => The title, seo_name => The seo_name.
 * @param string $content The content.
 * @param string $hidden Should it be hidden ('yes' or 'no')?
 * @param string $subpage Specifies the parent page, if the saved page should be a sub page. Default to null.
 * @param string $description Description of the page. Defaults to null.
 * @param string $keywords Keywords of the page. Defaults to null.
 * @param array $module_additional_data Additional data variable, can be edited by modules through hooks (admin_save_page_module_additional_data). Defaults to null.
 * @param string $current_seoname Current seoname of the page, if we are editing a page. Defaults to null.
 * @return string Seoname of the saved page.
 */
function save_page($title, $content, $hidden, $subpage = null, $description = null, $keywords = null, $module_additional_data = null, $current_seoname = null)
{
    //Run a few hooks.
    run_hook('admin_save_page', array(&$title, &$content));
    run_hook('admin_save_page_meta', array(&$description, &$keywords));
    run_hook('admin_save_page_module_additional_data', array(&$module_additional_data));
    //Configure title and seo_name
    if (is_array($title)) {
        if (!empty($title['seo_name'])) {
            $seo_title = $title['seo_name'];
            $title = $title['title'];
        } else {
            $seo_title = seo_url($title['title']);
            $title = $title['title'];
        }
    } else {
        $seo_title = seo_url($title);
    }
    //Check if the seo url  is empty.
    if (empty($seo_title)) {
        return false;
    }
    //Check if a page already exists with the name.
    if ((!isset($current_seoname) || $current_seoname != $subpage . $seo_title) && get_page_filename($subpage . $seo_title) != false) {
        return false;
    }
    //Do we want to create a new page?
    if (!isset($current_seoname)) {
        //Check if we want a sub-page.
        if (!empty($subpage)) {
            //We need to make sure that the dir exists, and if not, create it.
            if (!file_exists(PAGE_DIR . '/' . rtrim($subpage, '/'))) {
                mkdir(PAGE_DIR . '/' . rtrim($subpage, '/'));
                chmod(PAGE_DIR . '/' . rtrim($subpage, '/'), 0777);
            }
            $pages = read_dir_contents(PAGE_DIR . '/' . rtrim($subpage, '/'), 'files');
        } else {
            $pages = read_dir_contents(PAGE_DIR, 'files');
        }
        //Are there any pages?
        if ($pages == false) {
            $number = 1;
        } else {
            $number = count($pages) + 1;
        }
        $newfile = $subpage . $number . '.' . $seo_title;
    } else {
        $filename = get_page_filename($current_seoname);
        //the old file name
        //Is it a sub-page, or do we want to make it one?
        if (strpos($current_seoname, '/') !== false || !empty($subpage)) {
            $page_name = explode('/', $subpage);
            $count = count($page_name);
            unset($page_name[$count]);
            $dir = get_sub_page_dir($current_seoname);
            $filename_array = str_replace($dir . '/', '', $filename);
            $filename_array = explode('.', $filename_array);
            $newfilename = implode('/', $page_name) . '/' . $filename_array[0] . '.' . $seo_title;
            $newdir = get_sub_page_dir($newfilename);
            //We need to make sure that the dir exists, and if not, create it.
            if (!file_exists(PAGE_DIR . '/' . $newdir)) {
                mkdir(PAGE_DIR . '/' . $newdir);
                chmod(PAGE_DIR . '/' . $newdir, 0777);
            }
            //If the name isn't the same as before, we have to find the correct number.
            if ($newfilename . '.php' != $filename) {
                //If the sub-folder is the same, use the same number as before.
                if ($dir . '/' == $newdir) {
                    $number = $filename_array[0];
                } else {
                    $pages = read_dir_contents(PAGE_DIR . '/' . $newdir, 'files');
                    if ($pages) {
                        $count = count($pages);
                        $number = $count + 1;
                    } else {
                        $number = 1;
                    }
                }
                $newfile = implode('/', $page_name) . $number . '.' . $seo_title;
            }
        } else {
            $filename_array = explode('.', $filename);
            $newfile = $filename_array[0] . '.' . $seo_title;
        }
    }
    //Save the title, content and hidden status.
    $data = '<?php' . "\n" . '$title = \'' . sanitize($title) . '\';' . "\n" . '$seoname = \'' . sanitize($seo_title) . '\';' . "\n" . '$content = \'' . sanitize($content, false) . '\';' . "\n" . '$hidden = \'' . $hidden . '\';';
    //Save the description and keywords, if any.
    if ($description != null) {
        $data .= "\n" . '$description = \'' . sanitize($description) . '\';';
    }
    if ($keywords != null) {
        $data .= "\n" . '$keywords = \'' . sanitize($keywords) . '\';';
    }
    //If modules have supplied additional data, save it.
    if ($module_additional_data != null && is_array($module_additional_data)) {
        foreach ($module_additional_data as $var => $value) {
            $data .= "\n" . '$' . $var . ' = \'' . $value . '\';';
        }
    }
    $data .= "\n" . '?>';
    //Save the file.
    save_file(PAGE_DIR . '/' . $newfile . '.php', $data);
    //Do a little cleanup if we are editing a page.
    if (isset($current_seoname)) {
        //Check if the title is different from what we started with.
        if ($newfile . '.php' != $filename) {
            //If there are sub-pages, rename the folder.
            if (file_exists(PAGE_DIR . '/' . get_page_seoname($filename))) {
                rename(PAGE_DIR . '/' . get_page_seoname($filename), PAGE_DIR . '/' . get_page_seoname($newfile . '.php'));
            }
            //Remove the old file.
            unlink(PAGE_DIR . '/' . $filename);
            //If there are no files in the old dir, delete it.
            if (isset($dir) && read_dir_contents(PAGE_DIR . '/' . $dir, 'files') == false) {
                rmdir(PAGE_DIR . '/' . $dir);
            } elseif (isset($dir)) {
                reorder_pages(PAGE_DIR . '/' . $dir);
            } else {
                reorder_pages(PAGE_DIR);
            }
        }
    }
    //Return the seoname.
    return get_page_seoname($newfile . '.php');
}
예제 #17
0
/**
 * Get the filename of a page.
 *
 * @since 4.7
 * @package all
 * @param string $seoname The seoname
 * @return string The filename
 */
function get_page_filename($seoname)
{
    //Remove PAGE_DIR from the seoname, if present.
    if (strpos($seoname, PAGE_DIR . '/') === 0) {
        $seoname = substr($seoname, strlen(PAGE_DIR) + 1);
    }
    $path = '';
    $pos = strrpos($seoname, '/');
    if ($pos !== false) {
        $path = substr($seoname, 0, $pos);
    }
    //Read the pages.
    $pages = read_dir_contents(PAGE_DIR . '/' . $path, 'files');
    //Are there any pages?
    if ($pages != false) {
        $page = basename($seoname);
        foreach ($pages as $filename) {
            if (strpos($filename, '.' . $page . '.')) {
                return ($path != '' ? $path . '/' : '') . $filename;
            }
        }
    }
    return false;
}
예제 #18
0
파일: files.php 프로젝트: MenZil/pluck
        //TODO: Need to show this message another place, and with show_error().
        ?>
</strong>
				</div>
			<?php 
    }
}
//Display list of uploaded pictures.
?>
<span class="kop2"><?php 
echo $lang['files']['uploaded'];
?>
</span>
<?php 
//Show the uploaded images
$files = read_dir_contents('files', 'files');
if ($files) {
    natcasesort($files);
    foreach ($files as $file) {
        ?>
			<div class="menudiv">
				<span>
					<img src="data/image/file.png" alt="" />
				</span>
				<span class="title-page"><?php 
        echo $file;
        ?>
</span>
				<span>
					<a href="files/<?php 
        echo $file;