Location: PHPKode > projects > Php4dvd - movie database > php4dvd/install/files/perm.php
<?php
/**
================================================================================
 LISENCE
================================================================================

    This file is part of php4dvd.

    php4dvd is free software: you can redistribute it and/or modify
    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.

    php4dvd is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with php4dvd. If not, see <http://www.gnu.org/licenses/>.
**/

/**
    This page of the installer will check permissions. If any are incorrect it will
    notify the user and not let them to the next page. If/Once everything is good
    a link is created to the next page.
 */

//Directory permissions error, only true if a permission fails.
$Dir_Err = false;
?>
<p>You need to give the following files/folders full permissions (777). Typically you
        can right click on the files/folders in your ftp utility to update its permissions.</p>

<table>
<?php

//check permissions on a couple folders
echo "	<tr><td width='200'>/install/</td><td>".   get_perm("../install/")          ."</td></tr>
		<tr><td>/cache/</td><td>".                 get_perm("../cache")            	."</td></tr>
		<tr><td>/config/</td><td>".                get_perm("../config")            ."</td></tr>
		<tr><td>/smarty/compiled/</td><td>".       get_perm("../smarty/compiled")   ."</td></tr>
		<tr><td>/movies/</td><td>".                get_perm("../movies")            ."</td></tr>
		<tr><td>/movies/covers/</td><td>".         get_perm("../movies/covers")     ."</td></tr>
		<tr><td>&nbsp;</td></tr>";

//If there was an error dont let them go on, if no errors provide a link.
if ($Dir_Err) {
 echo "<tr><td colspan='2'>Fix the problem and <a href=''>refresh the page</a></td></tr>";
} else {
 echo "<tr><td colspan='2'><a href='?go=type'>Next</a></td></tr>";
}

//This gets the permssions of a directory. If not writable $Dir_Err gets set to true
function get_perm($dir) {
        global $Dir_Err;
        if (is_writable($dir)) {
                return "is writable";
        }elseif (is_dir($dir) || is_file($dir)) {
                $Dir_Err = true;
                return "<span class='inputerror'>is readable</span>";
        } else {
                $Dir_Err = true;
                return "<span class='inputerror'>doesn't exist</span>";
        }
}
?>
</table>
Return current item: Php4dvd - movie database