예제 #1
0
function is__writable($path)
{
    //will work in despite of Windows ACLs bug
    //NOTE: use a trailing slash for folders!!!
    //see http://bugs.php.net/bug.php?id=27609
    //see http://bugs.php.net/bug.php?id=30931
    if ($path[strlen($path) - 1] == '/') {
        // recursively return a temporary file path
        return is__writable($path . uniqid(mt_rand()) . '.tmp');
    } else {
        if (is_dir($path)) {
            return is__writable($path . '/' . uniqid(mt_rand()) . '.tmp');
        }
    }
    // check tmp file for read/write capabilities
    $rm = file_exists($path);
    $f = @fopen($path, 'a');
    if ($f === false) {
        return false;
    }
    fclose($f);
    if (!$rm) {
        unlink($path);
    }
    return true;
}
예제 #2
0
function validate_writable($continue, $path)
{
    if (!is__writable($path)) {
        printalert("danger", "Failed to get write permissions on " . htmlentities($path));
        return false;
    }
    return $continue;
}
예제 #3
0
function is__writable($path)
{
    if ($path[strlen($path) - 1] == '/') {
        return is__writable($path . uniqid(mt_rand()) . '.tmp');
    }
    if (file_exists($path)) {
        if (!($f = @fopen($path, 'r+'))) {
            return false;
        }
        fclose($f);
        return true;
    }
    if (!($f = @fopen($path, 'w'))) {
        return false;
    }
    fclose($f);
    unlink($path);
    return true;
}
/**
 * Checks whether the folder is writable
 *
 * @param	string	$path	The path to the folder to check
 * @return	bool	Return true if folder is writable; false if not
 */
function is__writable($path)
{
    if ($path[strlen($path) - 1] == '/') {
        return is__writable($path . uniqid(mt_rand()) . '.tmp');
    } else {
        if (is_dir($path)) {
            return is__writable($path . '/' . uniqid(mt_rand()) . '.tmp');
        }
    }
    $rm = file_exists($path);
    $f = @fopen($path, 'a');
    if ($f === false) {
        return false;
    }
    fclose($f);
    if (!$rm) {
        unlink($path);
    }
    return true;
}
예제 #5
0
 //$guess_path = pullout($_SERVER['DOCUMENT_ROOT']);
 //$guess_path .= $_SERVER['PHP_SELF'];
 //$guess_path = pathinfo($guess_path);
 //$guess_path = $guess_path['dirname'];
 //$guess_path = eregi_replace("admin","",$guess_path);
 //echo $guess_path."images/</b></i><p />
 echo "<b>{$admin_lang_pp_imagepath_conf} </b> " . $cfgrow['imagepath'] . " <p />";
 //echo "<i><b>$admin_lang_pp_thumbnailpath  {//$guess_path}thumbnails/</b></i><p />";
 echo "<b>{$admin_lang_pp_thumbnailpath_conf}</b> " . $cfgrow['thumbnailpath'] . "<p />";
 $work_path = eregi_replace("images/", "", $cfgrow['imagepath']);
 if (!is__writable($cfgrow['imagepath'])) {
     $chmod_message = "<b><font color=\"red\">ERROR - " . $admin_lang_pp_img_chmod1 . "</font></b><br />" . $admin_lang_pp_img_chmod2 . " " . $admin_lang_pp_img_chmod3;
 } else {
     $chmod_message = "<b><font color=\"green\">OK</font></b> - " . $admin_lang_pp_img_chmod4;
 }
 if (!is__writable($cfgrow['thumbnailpath'])) {
     $chmod_messagethumb = "<b><font color=\"red\">ERROR - " . $admin_lang_pp_img_chmod5 . "</font></b><br />" . $admin_lang_pp_img_chmod2 . " " . $admin_lang_pp_img_chmod3;
 } else {
     $chmod_messagethumb = "<b><font color=\"green\">OK</font></b> - " . $admin_lang_pp_img_chmod4;
 }
 echo "<b>{$admin_lang_pp_imgfolder}</b> ";
 if (file_exists($cfgrow['imagepath'])) {
     echo $chmod_message . " Current CHMOD: " . substr(sprintf('%o', fileperms($cfgrow['imagepath'])), -4) . "<p />";
 } else {
     echo $admin_lang_pp_folder_missing . " " . $work_path . "images) - " . $chmod_message . "<p />";
 }
 echo "<b>{$admin_lang_pp_thumbfolder}</b> ";
 if (file_exists($cfgrow['thumbnailpath'])) {
     echo $chmod_messagethumb . " Current CHMOD: " . substr(sprintf('%o', fileperms($cfgrow['thumbnailpath'])), -4) . "<p />";
 } else {
     echo $admin_lang_pp_folder_missing . "  " . $work_path . "thumbnails) - " . $chmod_messagethumb . "<p />";
예제 #6
0
        return true;
    } else {
        return false;
    }
}
function redirect($location)
{
    header("location:" . $location);
}
if ($_GET["step"] == "1") {
    echo " <div class='section_box'>Check chmod:<br /><br />";
    $error = "1";
    $path = 'upload';
    echo "<b><u>Folders:</u></b><br />\n";
    $path_check = array('libs/cache', 'libs/cache/compile_tpl', 'libs/db.php');
    if (is__writable($path_check)) {
        echo "</div><br /><a href=\"install.php?step=2\" class=\"button\">Step 2</a>\n";
        $_SESSION['step_one'] = 'ok';
    } else {
        echo "</div><br /><a href=\"install.php?step=1\" class=\"button\">Permissions test</a>\n";
    }
}
if ($_GET["step"] == "2") {
    if (empty($_GET["action"])) {
        ?>
<form action="<?php 
        echo $_SERVER['PHP_SELF'];
        ?>
?step=2&action=test" id="mail" method="post">

<table cellpadding="2">
예제 #7
0
 public function __construct()
 {
     $message = $this->testTheEnvironment();
     if (is__writable("./") && !file_exists(".htaccess")) {
         file_put_contents(".htaccess", htaccess());
     }
     $this->generateSiteUrl();
     if (!empty($message)) {
         printHeader();
         echo $message;
         echo "</body>";
         echo "</html>";
     } elseif ($this->runForm()) {
         unlink(__FILE__);
         header("Location:" . $this->siteUrl . "add/post");
         exit;
     } else {
         $updater = new Updater();
         $version = $updater->getInfos();
         printHeader($version);
         printForm();
         echo "</body>";
         echo "</html>";
     }
 }
예제 #8
0
 private function is__writable($path)
 {
     //Make sure to use a "/" after trailing folders
     if ($path[strlen($path) - 1] == '/') {
         return is__writable($path . uniqid(mt_rand()) . '.tmp');
     } else {
         if (is_dir($path)) {
             return is__writable($path . '/' . uniqid(mt_rand()) . '.tmp');
         }
     }
     // check tmp file for read/write capabilities
     $rm = file_exists($path);
     $f = @fopen($path, 'a');
     if ($f == false) {
         return FALSE;
     }
     fclose($f);
     if (!$rm) {
         unlink($path);
     }
     return TRUE;
 }
예제 #9
0
<?php

require_once 'rl_init.php';
ignore_user_abort(true);
login_check();
// If configs/files.lst is not writable, give a warning
if (!is__writable(CONFIG_DIR . 'files.lst')) {
    html_error(lang(304));
}
// If the download path is not writable, show error
if (!is__writable(DOWNLOAD_DIR)) {
    html_error(DOWNLOAD_DIR . lang(305));
}
purge_files($options['delete_delay']);
register_shutdown_function('pause_download');
$_REQUEST = $_GET = array_merge($_GET, $_POST);
$_REQUEST['premium_acc'] = $_POST['premium_acc'] = $_GET['premium_acc'] = isset($_REQUEST['premium_acc']) && $_REQUEST['premium_acc'] == 'on' ? 'on' : false;
$_REQUEST['cookieuse'] = $_POST['cookieuse'] = $_GET['cookieuse'] = isset($_REQUEST['cookieuse']) && $_REQUEST['cookieuse'] == 'on' ? 'on' : false;
require_once CLASS_DIR . 'cookie.php';
if (!@file_exists(HOST_DIR . 'download/hosts.php')) {
    html_error(lang(127));
}
// require "hosts.php";
require_once HOST_DIR . 'download/hosts.php';
if (!empty($_GET['image'])) {
    require_once CLASS_DIR . 'http.php';
    require_once CLASS_DIR . 'image.php';
    exit;
}
if (isset($_GET['useproxy']) && (empty($_GET['proxy']) || strpos($_GET['proxy'], ':') === false)) {
    html_error(lang(324));
예제 #10
0
function checkExistence()
{
    global $options, $L;
    //Checking DOWNLOAD_DIR
    if (file_exists(DOWNLOAD_DIR)) {
        if (!is__writable(DOWNLOAD_DIR)) {
            html_error($L->sprintf($L->say['not_writable'], DOWNLOAD_DIR));
        }
    } else {
        html_error($L->sprintf($L->say['dir_not_exists'], DOWNLOAD_DIR));
    }
    // Check FILES_LST is not writable,
    if (file_exists(FILES_LST)) {
        if (!is__writable(FILES_LST)) {
            html_error($L->sprintf($L->say['not_writable'], FILES_LST));
        }
        return @filesize(FILES_LST);
    } else {
        html_error($L->sprintf($L->say['file_not_exists'], FILES_LST));
    }
}
예제 #11
0
                 } else {
                     $datetime = gmdate("Y-m-d H:i:s", time() + 3600 * $tz);
                 }
             }
             // NEW WORKSPACE ADDED
             eval_addon_admin_workspace_menu('image_upload_succesful');
         } else {
             // something went wrong, try to describe what
             if ($_FILES['userfile']['error'] != '0') {
                 $result = check_upload($_FILES['userfile']['error']);
             } else {
                 $result = "{$admin_lang_ni_upload_error} ";
             }
             echo "<div id='warning'>{$admin_lang_error}  ";
             echo "<br/>{$result}";
             if (!is__writable($upload_dir)) {
                 echo "<br/>{$admin_lang_pp_img_chmod1}";
             }
             echo "</div><hr/>";
             // NEW WORKSPACE ADDED
             eval_addon_admin_workspace_menu('image_upload_failed');
         }
         // end move
     } else {
         // image is not an image.
         echo "<div id='warning'>{$admin_lang_error}  ";
         echo "<br/>{$admin_lang_pp_up_not_an_image}";
         echo "</div><hr/>";
     }
 }
 // end prepare of file ($_FILES['userfile'] != "")
예제 #12
0
<strong>2、目录、文件权限检测</strong>
<table width="100%" cellpadding="0" cellspacing="1" bgcolor="#DDDDDD" border="0">
	<tr>
		<th bgcolor="#EEEEEE" height="28">文件或目录</th>
		<th bgcolor="#EEEEEE" width="70">写入权限</th>
	</tr>
	<?php 
foreach ($check_file as $n) {
    ?>
	<tr>
		<td bgcolor="#FFFFFF" height="28">&nbsp;&nbsp;&nbsp;<?php 
    echo $n;
    ?>
</td>
		<td bgcolor="#FFFFFF" align="center"><?php 
    echo is__writable(WCROOT . '/' . $n) ? status(1) : status(0);
    ?>
</td>
	</tr>
	<?php 
}
?>
</table>
<table width="100%"><tr>
<td width="80" height="80">&nbsp;</td>
<td align="center"><a href="index.php?step=1" onfocus="this.blur()"><img src="images/button_prev.png" width="112" height="35" /></a></td>
<td align="center">
	<?php 
if ($check_result) {
    ?>
<a href="index.php?step=3" onfocus="this.blur()"><img src="images/button_next.png" width="112" height="35" /></a>
예제 #13
0
/**
 * Will work despite of Windows ACLs bug
 *
 * NOTE: use a trailing slash for folders!!!
 *
 * See http://bugs.php.net/bug.php?id=27609 AND http://bugs.php.net/bug.php?id=30931
 * Source: <http://www.php.net/is_writable#73596>
 *
 */
function is__writable($path)
{
    // recursively return a temporary file path
    if ($path[strlen($path) - 1] == '/') {
        return is__writable($path . uniqid(mt_rand()) . '.tmp');
    } elseif (is_dir($path)) {
        return is__writable($path . '/' . uniqid(mt_rand()) . '.tmp');
    }
    // check tmp file for read/write capabilities
    $rm = file_exists($path);
    $f = @fopen($path, 'a');
    if ($f === false) {
        return false;
    }
    fclose($f);
    if (!$rm) {
        unlink($path);
    }
    return true;
}
예제 #14
0
 public function get_flags($set_file)
 {
     $flags = array();
     $flags['flag'] = true;
     $flags['color1'] = $flags['color10'] = $flags['color11'] = $flags['color0'] = $flags['color3'] = $flags['color4'] = $flags['color5'] = "label label-success";
     $flags['text1'] = $flags["text10"] = $flags["text11"] = $flags["text0"] = $flags["text3"] = $flags["text4"] = $flags['text5'] = "is writable";
     if (!is_writable("../hardcode.php")) {
         $flags['flag'] = false;
         $flags['color1'] = "label label-important";
         $flags['text1'] = "is not writable (change file permissions to 0777)";
     }
     if (!is_writable("../cache/perm/request.001")) {
         $flags['flag'] = false;
         $flags['color3'] = "label label-important";
         $flags['text3'] = "is not writable (change file permissions to 0777)";
     }
     if (!is__writable('../client/plugins/upload/upload')) {
         $flags['flag'] = false;
         $flags['color5'] = "label label-important";
         $flags['text5'] = "is not writable (change file permissions to 0777)";
     }
     if (!is__writable("../cache/temp/")) {
         $flags['flag'] = false;
         $flags['color4'] = "label label-important";
         $flags['text4'] = "is not writable (change folder permissions to 0777)";
     }
     if (!is__writable("../client/themes")) {
         $flags['flag'] = false;
         $flags['color10'] = "label label-important";
         $flags['text10'] = "is not writable (change folder permissions to 0777)";
     }
     if ($_SESSION['cms'] == 'Custom') {
         if (!is_writable("../server/drivers/Custom.php")) {
             $flags['flag'] = false;
             $flags['color11'] = "label label-important";
             $flags['text11'] = "is not writable (change file permissions to 0777)";
         }
     }
     if (isset($_SESSION['config_path']) == true) {
         if (is_readable($_SESSION['config_path'])) {
             $this->correct_to_freichat_path($set_file);
             $flags['color2'] = "label label-success";
             $flags['text2'] = "is readable";
         } else {
             $flags['flag'] = false;
             $flags['color2'] = "label label-important";
             $flags['text2'] = "is not readable";
         }
     }
     return $flags;
 }
예제 #15
0
<?php

require_once "helper.php";
$tmpdir = "C:/ms4w/apps/flexmapviewer/tmp/";
$head = "MAP\r\n\tNAME FLEX_LAYERS\r\n\tSTATUS ON\r\n\tSIZE 256 256\r\n\t#EXTENT -125.107805 32.291815 -113.505409 42.246534\r\n\tUNITS meters\r\n\r\n\tPROJECTION\r\n\t  'proj=longlat'\r\n\t  'ellps=WGS84'\r\n\t  'datum=WGS84'\r\n\t  'no_defs'\r\n\t  ''\r\n\tEND\r\n\t\r\n\tIMAGECOLOR 192 192 192\r\n\tIMAGEQUALITY 95\r\n\tIMAGETYPE png\r\n\tOUTPUTFORMAT\r\n\t\tNAME png\r\n\t\tDRIVER 'GD/PNG'\r\n\t\tMIMETYPE 'image/png'\r\n\t\tEXTENSION 'png'\r\n\t\tTRANSPARENT ON\r\n\tEND\r\n\r\n\tQUERYMAP\r\n\t  STYLE HILITE\r\n\t  COLOR 255 0 0\r\n\tEND\r\n";
$filename = $tmpdir . "a.txt";
if (is__writable($filename)) {
    echo "Writable";
    $handle = fopen($filename, 'w');
    fwrite($handle, $head);
    fclose($handle);
} else {
    echo "Not writable";
}
예제 #16
0
파일: index.php 프로젝트: Sywooch/forums
}
// ######################### START REQUIREMENTS ##########################
if ($page == "requirements") {
    $pass_img = '<img src="./images/reserve_tab_checked.png" alt="" />';
    $fail_img = '<img src="./images/reserve_tab_unchecked.png" alt="" />';
    $configwrite = false;
    $cachewrite = false;
    $includewrite = false;
    $dbcheck = false;
    if (is__writable(dirname(dirname(__FILE__)) . DIRECTORY_SEPARATOR . "includes" . DIRECTORY_SEPARATOR . "config.new.php")) {
        $configwrite = true;
    }
    if (is__writable(dirname(dirname(__FILE__)) . DIRECTORY_SEPARATOR . "cache" . DIRECTORY_SEPARATOR)) {
        $cachewrite = true;
    }
    if (is__writable(dirname(dirname(__FILE__)) . DIRECTORY_SEPARATOR . "includes" . DIRECTORY_SEPARATOR)) {
        $includewrite = true;
    }
    // Disabling the mySQL database check for now
    //if (checkDB())
    //{
    $dbcheck = true;
    //}
    require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . "layout" . DIRECTORY_SEPARATOR . "pages_requirements.php";
    if ($configwrite and $cachewrite and $includewrite and $dbcheck) {
        $next = array('0' => 'Next', '1' => 'onClick="window.location.href=\'?mode=database\';"');
    } else {
        $next = array('0' => 'Test Again', '1' => 'onClick="window.location.reload();this.className=\'buttondown\'"');
    }
}
// ######################### START DATABASE SETUP ##########################