Probléme sur un fichier php

Résolu/Fermé
nonotv - 20 janv. 2009 à 08:33
ThEBiShOp Messages postés 8378 Date d'inscription jeudi 22 mars 2007 Statut Contributeur Dernière intervention 8 février 2021 - 20 janv. 2009 à 16:01
Bonjour

voila je revient ici,car j ai trouver cela>>> http://www.commentcamarche.net/faq/sujet 4308 webmaster faire facilement un espace d upload

ca marche nikel ,sauf que je suis limiter a 8MB alors je voudrais savoir si il est possible de passer en GO,juste 1GOou2GO si possible??
merci de m aider

nonotv
A voir également:

5 réponses

kikilolo Messages postés 757 Date d'inscription lundi 22 janvier 2007 Statut Membre Dernière intervention 15 juillet 2009 57
20 janv. 2009 à 08:44
Bonjour,
Cela dépend de l"espace qui t'a été alloué chez ton FAI.
0
ben je suis mon propre hébergeur,j ai un serveur chez moi.

j héberge mes site et je suis pas limiter sur la place car je fais de l hébergement video audio logiciel photo ect...


mais je vois pas comment on peux changer ca car 8 MB on fais rien quoi.
0
toujour pas daide????


de l aide svp
0
bon alors vue que personne ne peux m aider,alors que cette fonction a bien étais mi sur ce forum lien sur le premier poste...!!!!!


je me permét de poster le scrit(je cherche comment pourvoir envoyer un fichier plus gros que 8 MB) du genre 1GO ca serais pas mal.

voici le script php.


<?php
/**
* @file
* File Thingie version 2.5.3 - Andreas Haugstrup Pedersen <andreas@solitude.dk>
* The newest version of File Thingie can be found at <http://www.solitude.dk/filethingie/>
* Comments, suggestions etc. are welcome and encouraged at the above e-mail.
*
* LICENSE INFORMATION FOR FILE THINGIE:
* File Thingie is Copyright (c) 2003-2008 Andreas Haugstrup Pedersen. All Rights Reserved.
*
* File Thingie is free for non-commercial use. Commercial use costs $20 per copy of File Thingie.
* Read more at: http://www.solitude.dk/filethingie/download
* Contact <andreas@solitude.dk> for bulk discounts.
*/

# Version information #
define("VERSION", "2.5.3"); // Current version of File Thingie.
define("INSTALL", "SIMPLE"); // Type of File Thingie installation. EXPANDED or SIMPLE.
define("MUTEX", $_SERVER['PHP_SELF']);
$ft = array();
$ft['settings'] = array();
$ft['groups'] = array();
$ft['users'] = array();
$ft['plugins'] = array();

# Settings - Change as appropriate. See online documentation for explanations. #
define("USERNAME", "nono"); // Your default username.
define("PASSWORD", "0650"); // Your default password.

$ft["settings"]["DIR"] = "C:\wamp\www\envoi" ; // Your default directory. Do NOT include a trailing slash!
$ft["settings"]["LANG"] = "en"; // Language. Do not change unless you have downloaded language file.
$ft["settings"]["MAXSIZE"] = 99999999; // Maximum file upload size - in bytes.
$ft["settings"]["PERMISSION"] = 0644; // Permission for uploaded files.
$ft["settings"]["LOGIN"] = TRUE; // Set to FALSE if you want to disable password protection.
$ft["settings"]["UPLOAD"] = TRUE; // Set to FALSE if you want to disable file uploads.
$ft["settings"]["FILEACTIONS"] = TRUE; // Set to FALSE if you want to disable file actions (rename, move, delete, edit, duplicate).
$ft["settings"]["HIDEFILEPATHS"] = FALSE; // Set to TRUE to not pass downloads through File Thingie.
$ft["settings"]["FILEBLACKLIST"] = "ft2.php filethingie.js ft.css ft_config.php index.php"; // Specific files that will not be shown.
$ft["settings"]["FOLDERBLACKLIST"] = "ft_plugins"; // Specifies folders that will not be shown. No starting or trailing slashes!
$ft["settings"]["FILETYPEBLACKLIST"] = "php phtml php3 php4 php5 doc xls"; // File types that are not allowed for upload.
$ft["settings"]["FILETYPEWHITELIST"] = ""; // Add file types here to *only* allow those types to be uploaded.
$ft["settings"]["ADVANCEDACTIONS"] = FALSE; // Set to TRUE to enable advanced actions like chmod and symlinks.
$ft["settings"]["LIMIT"] = 0; // Restrict total dir file usage to this amount of bytes. Set to "0" for no limit.
$ft["settings"]["REQUEST_URI"] = FALSE; // Installation path. You only need to set this if $_SERVER['REQUEST_URI'] is not being set by your server.
$ft["settings"]["HTTPS"] = FALSE; // Change to TRUE to enable HTTPS support.
$ft["settings"]["AUTOUPDATES"] = "0"; // Number of days between checking for updates. Set to '0' to turn off.
$ft["settings"]["REMEMBERME"] = FALSE; // Set to TRUE to enable the "remember me" feature at login.
$ft["settings"]["PLUGINDIR"] = 'ft_plugins'; // Set to the path to your plugin folder. Do NOT include a trailing slash!
# Colours #
$ft["settings"]["COLOURONE"] = "#326532"; // Dark background colour - also used on menu links.
$ft["settings"]["COLOURONETEXT"] = "#fff"; // Text for the dark background.
$ft["settings"]["COLOURTWO"] = "#DAE3DA"; // Brighter color (for table rows and sidebar background).
$ft["settings"]["COLOURTEXT"] = "#000"; // Regular text colour.
$ft["settings"]["COLOURHIGHLIGHT"] = "#ffc"; // Hightlight colour for status messages.

# Plugin settings #
$ft["plugins"]["search"] = TRUE;
$ft["plugins"]["edit"] = array(
"settings" => array(
"editlist" => "txt html htm css",
"converttabs" => FALSE
)
);
/*
$ft["plugins"]["tinymce"] = array(
"settings" => array(
"path" => "tinymce/jscripts/tiny_mce/tiny_mce.js",
"list" => "html htm"
)
);
*/

# Additional users - See guide at http://www.solitude.dk/filethingie/documentation/users #

/*
$ft['users']['REPLACE_WITH_USERNAME'] = array(
'password' => 'REPLACE_WITH_PASSWORD',
'group' => 'REPLACE_WITH_GROUPNAME'
);
*/

# User groups for additional users - - See guide at http://www.solitude.dk/filethingie/documentation/users #

/*
$ft['groups']['REPLACE_WITH_GROUPNAME'] = array(
'DIR' => 'REPLACE_WITH_CUSTOM_DIR',
);
*/


/**
* Check if a login cookie is valid.
*
* @param $c
* The login cookie from $_COOKIE.
* @return The username of the cookie user. FALSE if cookie is not valid.
*/
function ft_check_cookie($c) {
global $ft;
// Check primary user.
if ($c == md5(USERNAME.PASSWORD)) {
return USERNAME;
}
// Check users array.
if (is_array($ft['users']) && sizeof($ft['users']) > 0) {
// Loop through users.
foreach ($ft['users'] as $user => $a) {
if ($c == md5($user.$a['password'])) {
return $user;
}
}
}
return FALSE;
}

/**
* Check if directory is on the blacklist.
*
* @param $dir
* Directory path.
* @return TRUE if directory is not blacklisted.
*/
function ft_check_dir($dir) {
// Check against folder blacklist.
if (FOLDERBLACKLIST != "") {
$blacklist = explode(" ", FOLDERBLACKLIST);
foreach ($blacklist as $c) {
if (substr($dir, 0, strlen(ft_get_root().'/'.$c)) == ft_get_root().'/'.$c) {
return FALSE;
}
}
return TRUE;
} else {
return TRUE;
}
}

/**
* Check if file actions are allowed in the current directory.
*
* @return TRUE is file actions are allowed.
*/
function ft_check_fileactions() {
if (FILEACTIONS === TRUE) {
// Uploads are universally turned on.
return TRUE;
} else if (FILEACTIONS == TRUE && FILEACTIONS == substr(ft_get_dir(), 0, strlen(FILEACTIONS))) {
// Uploads are allowed in the current directory and subdirectories only.
return TRUE;
}
return FALSE;
}

/**
* Check if file is on the blacklist.
*
* @param $file
* File name.
* @return TRUE if file is not blacklisted.
*/
function ft_check_file($file) {
// Check against file blacklist.
if (FILEBLACKLIST != "") {
$blacklist = explode(" ", FILEBLACKLIST);
if (in_array(strtolower($file), $blacklist)) {
return FALSE;
} else {
return TRUE;
}
} else {
return TRUE;
}
}

/**
* Check if file type is on the blacklist.
*
* @param $file
* File name.
* @return TRUE if file is not blacklisted.
*/
function ft_check_filetype($file) {
$type = strtolower(ft_get_ext($file));
// Check if we are using a whitelist.
if (FILETYPEWHITELIST != "") {
// User wants a whitelist
$whitelist = explode(" ", FILETYPEWHITELIST);
if (in_array($type, $whitelist)) {
return TRUE;
} else {
return FALSE;
}
} else {
// Check against file blacklist.
if (FILETYPEBLACKLIST != "") {
$blacklist = explode(" ", FILETYPEBLACKLIST);
if (in_array($type, $blacklist)) {
return FALSE;
} else {
return TRUE;
}
} else {
return TRUE;
}
}
}

/**
* Check if a user is authenticated to view the page or not. Must be called on all pages.
*
* @return TRUE if the user is authenticated.
*/
function ft_check_login() {
global $ft;
$valid_login = 0;
if (LOGIN == TRUE) {
if (empty($_SESSION['ft_user_'.MUTEX])) {
$cookie_mutex = str_replace('.', '_', MUTEX);
// Session variable has not been set. Check if there is a valid cookie or login form has been submitted or return false.
if (REMEMBERME == TRUE && !empty($_COOKIE['ft_user_'.$cookie_mutex])) {
// Verify cookie.
$cookie = ft_check_cookie($_COOKIE['ft_user_'.$cookie_mutex]);
if (!empty($cookie)) {
// Cookie valid. Login.
$_SESSION['ft_user_'.MUTEX] = $cookie;
ft_redirect();
}
}
if (!empty($_POST['act']) && $_POST['act'] == "dologin") {
// Check username and password from login form.
if (!empty($_POST['ft_user']) && $_POST['ft_user'] == USERNAME && $_POST['ft_pass'] == PASSWORD) {
// Valid login.
$_SESSION['ft_user_'.MUTEX] = USERNAME;
$valid_login = 1;
}
// Default user was not valid, we check additional users (if any).
if (is_array($ft['users']) && sizeof($ft['users']) > 0) {
// Check username and password.
if (array_key_exists($_POST['ft_user'], $ft['users']) && $ft['users'][$_POST['ft_user']]['password'] == $_POST['ft_pass']) {
// Valid login.
$_SESSION['ft_user_'.MUTEX] = $_POST['ft_user'];
$valid_login = 1;
}
}
if ($valid_login == 1) {
// Set cookie.
if (!empty($_POST['ft_cookie']) && REMEMBERME) {
setcookie('ft_user_'.MUTEX, md5($_POST['ft_user'].$_POST['ft_pass']), time()+60*60*24*3);
} else {
// Delete cookie
setcookie('ft_user_'.MUTEX, md5($_POST['ft_user'].$_POST['ft_pass']), time()-3600);
}
ft_redirect();
} else {
ft_redirect("act=error");
}
}
return FALSE;
} else {
return TRUE;
}
} else {
return TRUE;
}
}

/**
* Check if a move action is inside the file actions area if FILEACTIONS is set to a specific director.
*
* @param $dest
* The directory to move to.
* @return TRUE if move action is allowed.
*/
function ft_check_move($dest) {
if (FILEACTIONS === TRUE) {
return TRUE;
}
// Check if destination is within the fileactions area.
$dest = substr($dest, 0, strlen($dest));
$levels = substr_count(substr(ft_get_dir(), strlen(FILEACTIONS)), '/');
if ($levels <= substr_count($dest, '../')) {
return TRUE;
} else {
return FALSE;
}
}

/**
* Check if uploads are allowed in the current directory.
*
* @return TRUE if uploads are allowed.
*/
function ft_check_upload() {
if (UPLOAD === TRUE) {
// Uploads are universally turned on.
return TRUE;
} else if (UPLOAD == TRUE && UPLOAD == substr(ft_get_dir(), 0, strlen(UPLOAD))) {
// Uploads are allowed in the current directory and subdirectories only.
return TRUE;
}
return FALSE;
}

/**
* Check if a user exists.
*
* @param $username
* Username to check.
* @return TRUE if user exists.
*/
function ft_check_user($username) {
global $ft;
if ($username == USERNAME) {
return TRUE;
} elseif (is_array($ft['users']) && sizeof($ft['users']) > 0 && array_key_exists($username, $ft['users'])) {
return TRUE;
}
return FALSE;
}

/**
* Check if the a new version of File Thingie is available.
*
* @return A string describing the results. Contains a changelog if a new version is available.
*/
function ft_check_version() {
// Get newest version.
if ($c = ft_get_url("http://www.solitude.dk/filethingie/versioninfo2.php?act=check&from=".urlencode('http://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']))) {
$c = explode('||', $c);
$version = trim($c[0]);
$log = trim($c[1]);
// Compare versions.
if (version_compare($version, VERSION) == 1) {
// New version available.
return '<p>'.t('A new version of File Thingie (!version) is available.', array('!version' => $version)).'</p>'.$log.'<p><strong><a href="http://www.solitude.dk/filethingie/download">'.t('Download File Thingie !version', array('!version' => $version)).'</a></strong></p>';
} else {
// Running newest version.
return '<p>'.t('No updates available.').'</p><ul><li>'.t('Your version:').' '.VERSION.'</li><li>'.t('Newest version:').' '.$version.'</li></ul>';
}
return "<p>".t('Newest version is:')." {$version}</p>";
} else {
return "<p class='error'>".t('Could not connect (possible error: URL wrappers not enabled).')."</p>";
}
}

/**
* Run all system actions based on the value of $_REQUEST['act'].
*/
function ft_do_action() {
if (!empty($_REQUEST['act'])) {

// Only one callback action is allowed. So only the first hook that acts on an action is run.
ft_invoke_hook('action', $_REQUEST['act']);

# mkdir
if ($_REQUEST['act'] == "createdir" && ft_check_upload() === TRUE) {
$_POST['newdir'] = trim($_POST['newdir']);
if ($_POST['type'] == 'file') {
// Check file against blacklists
if (strlen($_POST['newdir']) > 0 && ft_check_filetype($_POST['newdir']) && ft_check_file($_POST['newdir'])) {
// Create file.
$newfile = ft_get_dir()."/{$_POST['newdir']}";
if (file_exists($newfile)) {
// Redirect
ft_set_message(t("File could not be created. File already exists."), 'error');
ft_redirect("dir=".$_REQUEST['dir']);
} elseif (@touch($newfile)) {
// Redirect.
ft_set_message(t("File created."));
ft_redirect("dir=".$_REQUEST['dir']);
} else {
// Redirect
ft_set_message(t("File could not be created."), 'error');
ft_redirect("dir=".$_REQUEST['dir']);
}
} else {
// Redirect
ft_set_message(t("File could not be created."), 'error');
ft_redirect("dir=".$_REQUEST['dir']);
}
} elseif ($_POST['type'] == 'url') {
// Create from URL.
$newname = trim(substr($_POST['newdir'], strrpos($_POST['newdir'], '/')+1));
if (strlen($newname) > 0 && ft_check_filetype($newname) && ft_check_file($newname)) {
// Open file handlers.
$rh = fopen($_POST['newdir'], 'rb');
if ($rh === FALSE) {
ft_set_message(t("Could not open URL. Possible reason: URL wrappers not enabled."), 'error');
ft_redirect("dir=".$_REQUEST['dir']);
}
$wh = fopen(ft_get_dir().'/'.$newname, 'wb');
if ($wh === FALSE) {
ft_set_message(t("File could not be created."), 'error');
ft_redirect("dir=".$_REQUEST['dir']);
}
// Download anf write file.
while (!feof($rh)) {
if (fwrite($wh, fread($rh, 1024)) === FALSE) {
ft_set_message(t("File could not be saved."), 'error');
}
}
fclose($rh);
fclose($wh);
ft_redirect("dir=".$_REQUEST['dir']);
} else {
// Redirect
ft_set_message(t("File could not be created."), 'error');
ft_redirect("dir=".$_REQUEST['dir']);
}
} else {
// Create directory.
// Check input.
// if (strstr($_POST['newdir'], ".")) {
// Throw error (redirect).
// ft_redirect("status=createddirfail&dir=".$_REQUEST['dir']);
// } else {
$_POST['newdir'] = ft_stripslashes($_POST['newdir']);
$newdir = ft_get_dir()."/{$_POST['newdir']}";
$oldumask = umask(0);
if (strlen($_POST['newdir']) > 0 && @mkdir($newdir, 0777)) {
ft_set_message(t("Directory created."));
ft_redirect("dir=".$_REQUEST['dir']);
} else {
// Redirect
ft_set_message(t("Directory could not be created."), 'error');
ft_redirect("dir=".$_REQUEST['dir']);
}
umask($oldumask);
// }
}
# Move
} elseif ($_REQUEST['act'] == "move" && ft_check_fileactions() === TRUE) {
// Check that both file and newvalue are set.
$file = trim(ft_stripslashes($_REQUEST['file']));
$dir = trim(ft_stripslashes($_REQUEST['newvalue']));
if (substr($dir, -1, 1) != "/") {
$dir .= "/";
}
// Check for level.
if (substr_count($dir, "../") <= substr_count(ft_get_dir(), "/") && ft_check_move($dir) === TRUE) {
$dir = ft_get_dir()."/".$dir;
if (!empty($file) && file_exists(ft_get_dir()."/".$file)) {
// Check that destination exists and is a directory.
if (is_dir($dir)) {
// Move file.
if (@rename(ft_get_dir()."/".$file, $dir."/".$file)) {
// Success.
ft_set_message(t("!old was moved to !new", array('!old' => $file, '!new' => $dir)));
ft_redirect("dir={$_REQUEST['dir']}");
} else {
// Error rename failed.
ft_set_message(t("!old could not be moved.", array('!old' => $file)), 'error');
ft_redirect("dir={$_REQUEST['dir']}");
}
} else {
// Error dest. isn't a dir or doesn't exist.
ft_set_message(t("Could not move file. !old does not exist or is not a directory.", array('!old' => $dir)), 'error');
ft_redirect("dir={$_REQUEST['dir']}");
}
} else {
// Error source file doesn't exist.
ft_set_message(t("!old could not be moved. It doesn't exist.", array('!old' => $file)), 'error');
ft_redirect("dir={$_REQUEST['dir']}");
}
} else {
// Error level
ft_set_message(t("!old could not be moved outside the base directory.", array('!old' => $file)), 'error');
ft_redirect("dir={$_REQUEST['dir']}");
}
# Delete
} elseif ($_REQUEST['act'] == "delete" && ft_check_fileactions() === TRUE) {
// Check that file is set.
$file = ft_stripslashes($_REQUEST['file']);
if (!empty($file) && ft_check_file($file)) {
if (is_dir(ft_get_dir()."/".$file)) {
if (!@rmdir(ft_get_dir()."/".$file)) {
ft_set_message(t("!old could not be deleted.", array('!old' => $file)), 'error');
ft_redirect("dir={$_REQUEST['dir']}");
} else {
ft_set_message(t("!old deleted.", array('!old' => $file)));
ft_redirect("dir={$_REQUEST['dir']}");
}
} else {
if (!@unlink(ft_get_dir()."/".$file)) {
ft_set_message(t("!old could not be deleted.", array('!old' => $file)), 'error');
ft_redirect("dir={$_REQUEST['dir']}");
} else {
ft_set_message(t("!old deleted.", array('!old' => $file)));
ft_redirect("dir={$_REQUEST['dir']}");
}
}
} else {
ft_set_message(t("!old could not be deleted.", array('!old' => $file)), 'error');
ft_redirect("dir={$_REQUEST['dir']}");
}
# Rename && Duplicate && Symlink
} elseif ($_REQUEST['act'] == "rename" || $_REQUEST['act'] == "duplicate" || $_REQUEST['act'] == "symlink" && ft_check_fileactions() === TRUE) {
// Check that both file and newvalue are set.
$old = trim(ft_stripslashes($_REQUEST['file']));
$new = trim(ft_stripslashes($_REQUEST['newvalue']));
if ($_REQUEST['act'] == 'rename') {
$m['typefail'] = t("!old was not renamed to !new (type not allowed).", array('!old' => $old, '!new' => $new));
$m['writefail'] = t("!old could not be renamed (write failed).", array('!old' => $old));
$m['destfail'] = t("File could not be renamed to !new since it already exists.", array('!new' => $new));
$m['emptyfail'] = t("File could not be renamed since you didn't specify a new name.");
} elseif ($_REQUEST['act'] == 'duplicate') {
$m['typefail'] = t("!old was not duplicated to !new (type not allowed).", array('!old' => $old, '!new' => $new));
$m['writefail'] = t("!old could not be duplicated (write failed).", array('!old' => $old));
$m['destfail'] = t("File could not be duplicated to !new since it already exists.", array('!new' => $new));
$m['emptyfail'] = t("File could not be duplicated since you didn't specify a new name.");
} elseif ($_REQUEST['act'] == 'symlink') {
$m['typefail'] = t("Could not create symlink to !old (type not allowed).", array('!old' => $old, '!new' => $new));
$m['writefail'] = t("Could not create symlink to !old (write failed).", array('!old' => $old));
$m['destfail'] = t("Could not create symlink !new since it already exists.", array('!new' => $new));
$m['emptyfail'] = t("Symlink could not be created since you didn't specify a name.");
}
if (!empty($old) && !empty($new)) {
if (ft_check_filetype($new) && ft_check_file($new)) {
// Make sure destination file doesn't exist.
if (!file_exists(ft_get_dir()."/".$new)) {
// Check that file exists.
if (is_writeable(ft_get_dir()."/".$old)) {
if ($_REQUEST['act'] == "rename") {
if (@rename(ft_get_dir()."/".$old, ft_get_dir()."/".$new)) {
// Success.
ft_set_message(t("!old was renamed to !new", array('!old' => $old, '!new' => $new)));
ft_redirect("dir={$_REQUEST['dir']}");
} else {
// Error rename failed.
ft_set_message(t("!old could not be renamed.", array('!old' => $old)), 'error');
ft_redirect("dir={$_REQUEST['dir']}");
}
} elseif ($_REQUEST['act'] == 'symlink') {
if (ADVANCEDACTIONS == TRUE) {
if (@symlink(realpath(ft_get_dir()."/".$old), ft_get_dir()."/".$new)) {
@chmod(ft_get_dir()."/{$new}", PERMISSION);
// Success.
ft_set_message(t("Created symlink !new", array('!old' => $old, '!new' => $new)));
ft_redirect("dir={$_REQUEST['dir']}");
} else {
// Error symlink failed.
ft_set_message(t("Symlink to !old could not be created.", array('!old' => $old)), 'error');
ft_redirect("dir={$_REQUEST['dir']}");
}
}
} else {
if (@copy(ft_get_dir()."/".$old, ft_get_dir()."/".$new)) {
// Success.
ft_set_message(t("!old was duplicated to !new", array('!old' => $old, '!new' => $new)));
ft_redirect("dir={$_REQUEST['dir']}");
} else {
// Error rename failed.
ft_set_message(t("!old could not be duplicated.", array('!old' => $old)), 'error');
ft_redirect("dir={$_REQUEST['dir']}");
}
}
} else {
// Error old file isn't writeable.
ft_set_message($m['writefail'], 'error');
ft_redirect("dir={$_REQUEST['dir']}");
}
} else {
// Error destination exists.
ft_set_message($m['destfail'], 'error');
ft_redirect("dir={$_REQUEST['dir']}");
}
} else {
// Error file type not allowed.
ft_set_message($m['typefail'], 'error');
ft_redirect("dir={$_REQUEST['dir']}");
}
} else {
// Error. File name not set.
ft_set_message($m['emptyfail'], 'error');
ft_redirect("dir={$_REQUEST['dir']}");
}
# upload
} elseif ($_REQUEST['act'] == "upload" && ft_check_upload() === TRUE && (LIMIT <= 0 || LIMIT > ROOTDIRSIZE)) {
// If we are to upload a file we will do so.
$msglist = 0;
foreach ($_FILES as $k => $c) {
if (!empty($c['name'])) {
$c['name'] = ft_stripslashes($c['name']);
if ($c['error'] == 0) {
// Upload was successfull
if (ft_check_filetype($c['name']) && ft_check_file($c['name'])) {
if (file_exists(ft_get_dir()."/{$c['name']}")) {
$msglist++;
ft_set_message(t('!file was not uploaded.', array('!file' => ft_get_nice_filename($c['name'], 20))) . ' ' . t("File already exists"), 'error');
} else {
if (@move_uploaded_file($c['tmp_name'], ft_get_dir()."/{$c['name']}")) {
@chmod(ft_get_dir()."/{$c['name']}", PERMISSION);
// Success!
$msglist++;
ft_set_message(t('!file was uploaded.', array('!file' => ft_get_nice_filename($c['name'], 20))));
} else {
// File couldn't be moved. Throw error.
$msglist++;
ft_set_message(t('!file was not uploaded.', array('!file' => ft_get_nice_filename($c['name'], 20))) . ' ' . t("File couldn't be moved"), 'error');
}
}
} else {
// File type is not allowed. Throw error.
$msglist++;
ft_set_message(t('!file was not uploaded.', array('!file' => ft_get_nice_filename($c['name'], 20))) . ' ' . t("File type not allowed"), 'error');
}
} else {
// An error occurred.
switch($_FILES["localfile"]["error"]) {
case 1:
$msglist++;
ft_set_message(t('!file was not uploaded.', array('!file' => ft_get_nice_filename($c['name'], 20))) . ' ' . t("The file was too large"), 'error');
break;
case 2:
$msglist++;
ft_set_message(t('!file was not uploaded.', array('!file' => ft_get_nice_filename($c['name'], 20))) . ' ' . t("The file was larger than MAXSIZE setting."), 'error');
break;
case 3:
$msglist++;
ft_set_message(t('!file was not uploaded.', array('!file' => ft_get_nice_filename($c['name'], 20))) . ' ' . t("Partial upload. Try again"), 'error');
break;
case 4:
$msglist++;
ft_set_message(t('!file was not uploaded.', array('!file' => ft_get_nice_filename($c['name'], 20))) . ' ' . t("No file was uploaded. Please try again"), 'error');
break;
default:
$msglist++;
ft_set_message(t('!file was not uploaded.', array('!file' => ft_get_nice_filename($c['name'], 20))) . ' ' . t("Unknown error"), 'error');
break;
}
}
}
}
if ($msglist > 0) {
ft_redirect("dir=".$_REQUEST['dir']);
} else {
ft_set_message(t("Upload failed."), 'error');
ft_redirect("dir=".$_REQUEST['dir']);
}
# Unzip
} elseif ($_REQUEST['act'] == "unzip" && ft_check_fileactions() === TRUE) {
// Check that file is set.
$file = ft_stripslashes($_REQUEST['file']);
if (!empty($file) && ft_check_file($file) && ft_check_filetype($file) && strtolower(ft_get_ext($file)) == 'zip' && is_file(ft_get_dir()."/".$file)) {
$escapeddir = escapeshellarg(ft_get_dir()."/");
$escapedfile = escapeshellarg(ft_get_dir()."/".$file);
if (!@exec("unzip -n ".$escapedfile." -d ".$escapeddir)) {
ft_set_message(t("!old could not be unzipped.", array('!old' => $file)), 'error');
ft_redirect("dir={$_REQUEST['dir']}");
} else {
ft_set_message(t("!old unzipped.", array('!old' => $file)));
ft_redirect("dir={$_REQUEST['dir']}");
}
} else {
ft_set_message(t("!old could not be unzipped.", array('!old' => $file)), 'error');
ft_redirect("dir={$_REQUEST['dir']}");
}
# chmod
} elseif ($_REQUEST['act'] == "chmod" && ft_check_fileactions() === TRUE && ADVANCEDACTIONS == TRUE) {
// Check that file is set.
$file = ft_stripslashes($_REQUEST['file']);
if (!empty($file) && ft_check_file($file) && ft_check_filetype($file)) {
// Check that chosen permission i valid
if (is_numeric($_REQUEST['newvalue'])) {
$chmod = $_REQUEST['newvalue'];
if (substr($chmod, 0, 1) == '0') {
$chmod = substr($chmod, 0, 4);
} else {
$chmod = '0'.substr($chmod, 0, 3);
}
// Chmod
if (chmod(ft_get_dir()."/".$file, intval($chmod, 8))) {
ft_set_message(t("Permissions changed for !old.", array('!old' => $file)));
ft_redirect("dir={$_REQUEST['dir']}");
clearstatcache();
} else {
ft_set_message(t("Could not change permissions for !old.", array('!old' => $file)), 'error');
ft_redirect("dir={$_REQUEST['dir']}");
}
} else {
ft_set_message(t("Could not change permissions for !old.", array('!old' => $file)), 'error');
ft_redirect("dir={$_REQUEST['dir']}");
}
} else {
ft_set_message(t("Could not change permissions for !old.", array('!old' => $file)), 'error');
ft_redirect("dir={$_REQUEST['dir']}");
}
# logout
} elseif ($_REQUEST['act'] == "logout") {
$_SESSION = array();
if (isset($_COOKIE[session_name()])) {
setcookie(session_name(), '', time()-42000, '/');
}
session_destroy();
// Delete persistent cookie
setcookie('ft_user_'.MUTEX, '', time()-3600);
ft_redirect();
}
}
}

/**
* Convert PHP ini shorthand notation for file size to byte size.
*
* @return Size in bytes.
*/
function ft_get_bytes($val) {
$val = trim($val);
$last = strtolower($val{strlen($val)-1});
switch($last) {
// The 'G' modifier is available since PHP 5.1.0
case 'g':
$val *= 1024;
case 'm':
$val *= 1024;
case 'k':
$val *= 1024;
}
return $val;
}

/**
* Get the total disk space consumed by files available to the current user.
* Files and directories on blacklists are not counted.
*
* @param $dirname
* Name of the directory to scan.
* @return Space consumed by this directory in bytes (not counting files and directories on blacklists).
*/
function ft_get_dirsize($dirname) {
if (!is_dir($dirname) || !is_readable($dirname)) {
return false;
}
$dirname_stack[] = $dirname;
$size = 0;
do {
$dirname = array_shift($dirname_stack);
$handle = opendir($dirname);
while (false !== ($file = readdir($handle))) {
if ($file != '.' && $file != '..' && is_readable($dirname . '/' . $file)) {
if (is_dir($dirname . '/' . $file)) {
if (ft_check_dir($dirname . '/' . $file)) {
$dirname_stack[] = $dirname . '/' . $file;
}
} else {
if (ft_check_file($file) && ft_check_filetype($file)) {
$size += filesize($dirname . '/' . $file);
}
}
}
}
closedir($handle);
} while (count($dirname_stack) > 0);
return $size;
}

/**
* Get the current directory.
*
* @return The current directory.
*/
function ft_get_dir() {
if (empty($_REQUEST['dir'])) {
return ft_get_root();
} else {
return ft_get_root().$_REQUEST['dir'];
}
}
/**
* Get file extension from a file name.
*
* @param $name
* File name.
* @return The file extension without the '.'
*/
function ft_get_ext($name) {
if (strstr($name, ".")) {
$ext = str_replace(".", "", strrchr($name, "."));
} else {
$ext = "";
}
return $ext;
}

/**
* Get a list of files in a directory with metadata.
*
* @param $dir
* The directory to scan.
* @param $sort
* Sorting parameter. Possible values: name, type, size, date. Defaults to 'name'.
* @return An array of files. Each item is an array:
* array(
* 'name' => '', // File name.
* 'shortname' => '', // File name.
* 'type' => '', // 'file' or 'dir'.
* 'ext' => '', // File extension.
* 'writeable' => '', // TRUE if writeable.
* 'perms' => '', // Permissions.
* 'modified' => '', // Last modified. Unix timestamp.
* 'size' => '', // File size in bytes.
* 'extras' => '' // Array of extra classes for this file.
* )
*/
function ft_get_filelist($dir, $sort = 'name') {
$filelist = array();
$subdirs = array();
if (ft_check_dir($dir) && $dirlink = @opendir($dir)) {
// Creates an array with all file names in current directory.
while (($file = readdir($dirlink)) !== false) {
if ($file != "." && $file != ".." && ((!is_dir("{$dir}/{$file}") && ft_check_file($file) && ft_check_filetype($file)) || is_dir("{$dir}/{$file}") && ft_check_dir("{$dir}/{$file}"))) { // Hide these two special cases and files and filetypes in blacklists.
$c = array();
$c['name'] = $file;
// $c['shortname'] = ft_get_nice_filename($file, 20);
$c['shortname'] = $file;
$c['type'] = "file";
$c['ext'] = ft_get_ext($file);
$c['writeable'] = is_writeable("{$dir}/{$file}");

// Grab extra options from plugins.
$c['extras'] = array();
$c['extras'] = ft_invoke_hook('fileextras', $file, $dir);

// File permissions.
if ($c['perms'] = @fileperms("{$dir}/{$file}")) {
if (is_dir("{$dir}/{$file}")) {
$c['perms'] = substr(base_convert($c['perms'], 10, 8), 2);
} else {
$c['perms'] = substr(base_convert($c['perms'], 10, 8), 3);
}
}
$c['modified'] = @filemtime("{$dir}/{$file}");
$c['size'] = @filesize("{$dir}/{$file}");
if (ft_check_dir("{$dir}/{$file}") && is_dir("{$dir}/{$file}")) {
$c['size'] = 0;
$c['type'] = "dir";
if ($sublink = @opendir("{$dir}/{$file}")) {
while (($current = readdir($sublink)) !== false) {
if ($current != "." && $current != ".." && ft_check_file($current)) {
$c['size']++;
}
}
closedir($sublink);
}
$subdirs[] = $c;
} else {
$filelist[] = $c;
}
}
}
closedir($dirlink);
// sort($filelist);

// Obtain a list of columns
$ext = array();
$name = array();
$date = array();
$size = array();
foreach ($filelist as $key => $row) {
$ext[$key] = strtolower($row['ext']);
$name[$key] = strtolower($row['name']);
$date[$key] = $row['modified'];
$size[$key] = $row['size'];
}

if ($sort == 'type') {
// Sort by file type and then name.
array_multisort($ext, SORT_ASC, $name, SORT_ASC, $filelist);
} elseif ($sort == 'size') {
// Sort by filesize date and then name.
array_multisort($size, SORT_ASC, $name, SORT_ASC, $filelist);
} elseif ($sort == 'date') {
// Sort by last modified date and then name.
array_multisort($date, SORT_DESC, $name, SORT_ASC, $filelist);
} else {
// Sort by file name.
array_multisort($name, SORT_ASC, $filelist);
}
// Always sort dirs by name.
sort($subdirs);
return array_merge($subdirs, $filelist);
} else {
return "dirfail";
}
}

/**
* Determine the max. size for uploaded files.
*
* @return Human-readable string of upload limit.
*/
function ft_get_max_upload() {
$post_max = ft_get_bytes(ini_get('post_max_size'));
$upload = ft_get_bytes(ini_get('upload_max_filesize'));
// Compare ini settings.
if ($post_max > $upload) {
$max = $post_max;
} else {
$max = $upload;
}
// Compare with MAXSIZE.
if ($max > MAXSIZE) {
$max = MAXSIZE;
}
return ft_get_nice_filesize($max);
}

/**
* Shorten a file name to a given length maintaining the file extension.
*
* @param $name
* File name.
* @param $limit
* The maximum length of the file name.
* @return The shortened file name.
*/
function ft_get_nice_filename($name, $limit = -1) {
if ($limit > 0) {
$noext = $name;
if (strstr($name, '.')) {
$noext = substr($name, 0, strrpos($name, '.'));
}
$ext = ft_get_ext($name);
if (strlen($noext)-3 > $limit) {
$name = substr($noext, 0, $limit).'...';
if ($ext != '') {
$name = $name. '.' .$ext;
}
}
}
return $name;
}

/**
* Convert a number of bytes to a human-readable format.
*
* @param $size
* Integer. File size in bytes.
* @return String. Human-readable file size.
*/
function ft_get_nice_filesize($size) {
if (empty($size)) {
return "—";
} elseif (strlen($size) > 6) { // Convert to megabyte
return round($size/(1024*1024), 2)." MB";
} elseif (strlen($size) > 4 || $size > 1024) { // Convert to kilobyte
return round($size/1024, 0)." Kb";
} else {
return $size." b";
}
}

/**
* Get the root directory.
*
* @return The root directory.
*/
function ft_get_root() {
return DIR;
}

/**
* Get the name of the File Thingie file. Used in <form> actions.
*
* @return File name.
*/
function ft_get_self() {
return basename($_SERVER['PHP_SELF']);
}

/**
* Retrieve the contents of a URL.
*
* @return The contents of the URL as a string.
*/
function ft_get_url($url) {
$url_parsed = parse_url($url);
$host = $url_parsed["host"];
$port = 0;
$in = '';
if (!empty($url_parsed["port"])) {
$port = $url_parsed["port"];
}
if ($port==0) {
$port = 80;
}
$path = $url_parsed["path"];
if ($url_parsed["query"] != "") {
$path .= "?".$url_parsed["query"];
}
$out = "GET $path HTTP/1.0\r\nHost: $host\r\n\r\n";
$fp = fsockopen($host, $port, $errno, $errstr, 30);
fwrite($fp, $out);
$body = false;
while (!feof($fp)) {
$s = fgets($fp, 1024);
if ( $body ) {
$in .= $s;
}
if ( $s == "\r\n" ) {
$body = true;
}
}
fclose($fp);
return $in;
}
/**
* Get users in a group.
*
* @param $group
* Name of group.
* @return Array of usernames.
*/
function ft_get_users_by_group($group) {
global $ft;
$userlist = array();
foreach ($ft['users'] as $user => $c) {
if (!empty($c['group']) && $c['group'] == $group) {
$userlist[] = $user;
}
}
return $userlist;
}

/**
* Invoke a hook in all loaded plugins.
*
* @param $hook
* Name of the hook to invoke.
* @param ...
* Arguments to pass to the hook.
* @return Array of results from all hooks run.
*/
function ft_invoke_hook() {
global $ft;
$args = func_get_args();
$hook = $args[0];
unset($args[0]);
// Loop through loaded plugins.
$return = array();
if (isset($ft['loaded_plugins']) && is_array($ft['loaded_plugins'])) {
foreach ($ft['loaded_plugins'] as $name) {
if (function_exists('ft_'.$name.'_'.$hook)) {
$result = call_user_func_array('ft_'.$name.'_'.$hook, $args);
if (isset($result) && is_array($result)) {
$return = array_merge_recursive($return, $result);
}
else if (isset($result)) {
$return[] = $result;
}
}
}
}
return $return;
}

/**
* Create HTML for the page body. Defaults to a file list.
*/
function ft_make_body() {
$str = "";

// Make system messages.
$status = '';
if (ft_check_upload() === TRUE && is_writeable(ft_get_dir()) && (LIMIT > 0 && LIMIT < ROOTDIRSIZE)) {
$status = '<p class="error">' . t('Upload disabled. Total disk space use of !size exceeds the limit of !limit.', array('!limit' => ft_get_nice_filesize(LIMIT), '!size' => ft_get_nice_filesize(ROOTDIRSIZE))) . '</p>';
}
$status .= ft_make_messages();
if (empty($status)) {
$str .= "<div id='status' class='hidden'></div>";
} else {
$str .= "<div id='status' class='section'>{$status}</div>";
}

// Invoke page hook if an action has been set.
if (!empty($_REQUEST['act'])) {
return $str . '<div id="main">'.implode("\r\n", ft_invoke_hook('page', $_REQUEST['act'])).'</div>';
}

// If no action has been set, show a list of files.

if (empty($_REQUEST['act']) && (empty($_REQUEST['status']) || $_REQUEST['status'] != "dirfail")) { // No action set - we show a list of files if directory has been proven openable.
$totalsize = 0;
// Set sorting type. Default to 'name'.
$sort = 'name';
$cookie_mutex = str_replace('.', '_', MUTEX);
// If there's a GET value, use that.
if (!empty($_GET['sort'])) {
// Set the cookie.
setcookie('ft_sort_'.MUTEX, $_GET['sort'], time()+60*60*24*365);
$sort = $_GET['sort'];
} elseif (!empty($_COOKIE['ft_sort_'.$cookie_mutex])) {
// There's a cookie, we'll use that.
$sort = $_COOKIE['ft_sort_'.$cookie_mutex];
}
$files = ft_get_filelist(ft_get_dir(), $sort);
if (!is_array($files)) {
// List couldn't be fetched. Throw error.
// ft_set_message(t("Could not open directory."), 'error');
// ft_redirect();
$str .= '<p class="error">'.t("Could not open directory.").'</p>';
} else {
// Show list of files in a table.
$str .= "<table id='filelist'>";
$str .= "<thead><tr><th colspan=\"3\"><div style='float:left;'>".t('Files')."</div>";
$str .= "<form action='".ft_get_self()."' id='sort_form' method='get'><div><!--<label for='sort'>Sort by: </label>--><select id='sort' name='sort'>";
$sorttypes = array('name' => t('Sort by name'), 'size' => t('Sort by size'), 'type' => t('Sort by type'), 'date' => t('Sort by date'));
foreach ($sorttypes as $k => $v) {
$str .= "<option value='{$k}'";
if ($sort == $k) {
$str .= " selected='selected'";
}
$str .= ">{$v}</option>";
}
$str .= "</select><input type=\"hidden\" name=\"dir\" value=\"".$_REQUEST['dir']."\" /></div></form></th>";
$str .= "</tr></thead>";
$str .= "<tbody>";
$countfiles = 0;
$countfolders = 0;
if (count($files) <= 0) {
$str .= "<tr><td colspan='3' class='error'>".t('Directory is empty.')."</td></tr>";
} else {
$i = 0;
$previous = $files[0]['type'];
foreach ($files as $c) {
$odd = "";
$class = '';
if ($c['writeable']) {
$class = "show writeable ";
}
if ($c['type'] == 'dir' && $c['size'] == 0) {
$class .= " empty";
}
// Loop through extras and set classes.
foreach ($c['extras'] as $extra) {
$class .= " {$extra}";
}

if (isset($c['perms'])) {
$class .= " perm-{$c['perms']} ";
}
if (!empty($_GET['highlight']) && $c['name'] == $_GET['highlight']) {
$class .= " highlight ";
$odd = "highlight ";
}
if ($i%2 != 0) {
$odd .= "odd";
}
if ($previous != $c['type']) {
// Insert seperator.
$odd .= " seperator ";
}
$previous = $c['type'];
$str .= "<tr class='{$c['type']} $odd'>";
if ($c['writeable'] && ft_check_fileactions() === TRUE) {
$str .= "<td class='details'><span class='{$class}'>◊</span><span class='hide' style='display:none;'>◊</span></td>";
} else {
$str .= "<td class='details'>—</td>";
}
$plugin_data = implode('', ft_invoke_hook('filename', $c['name']));
if ($c['type'] == "file"){
$link = "<a href=\"".ft_get_dir()."/".rawurlencode($c['name'])."\" title=\"" .t('Show !file', array('!file' => $c['name'])). "\">{$c['shortname']}</a>";
if (HIDEFILEPATHS == TRUE) {
$link = ft_make_link($c['shortname'], 'method=getfile&dir='.rawurlencode($_REQUEST['dir']).'&file='.$c['name'], t('Show !file', array('!file' => $c['name'])));
}
$str .= "<td class='name'>{$link}{$plugin_data}</td><td class='size'>".ft_get_nice_filesize($c['size']);
$countfiles++;
} else {
$str .= "<td class='name'>".ft_make_link($c['shortname'], "dir=".rawurlencode($_REQUEST['dir'])."/".rawurlencode($c['name']), t("Show files in !folder", array('!folder' => $c['name'])))."{$plugin_data}</td><td class='size'>{$c['size']} ".t('files');
$countfolders++;
}
// Add filesize to total.
if ($c['type'] == 'file') {
$totalsize = $totalsize+$c['size'];
}
// if (isset($c['modified']) && $c['modified'] > 0) {
// $str .= "</td><td class='date'>".date(DATEFORMAT, $c['modified'])."</td></tr>";
// } else {
// $str .= "</td><td class='date'>—</td></tr>";
// }
$str .= "</td></tr>";
$i++;
}
}
if ($totalsize == 0) {
$totalsize = '';
} else {
$totalsize = " (".ft_get_nice_filesize($totalsize).")";
}
$str .= "</tbody><tfoot><tr><td colspan=\"3\">".$countfolders." ".t('folders')." - ".$countfiles." ".t('files')."{$totalsize}</td></tr></tfoot>";
$str .= "</table>";
}
}
return $str;
}

/**
* Create HTML for page footer.
*/
function ft_make_footer() {
return "<div id=\"footer\"><p><a href=\"http://www.solitude.dk/filethingie/\" target=\"_BLANK\">File Thingie • PHP File Manager</a> © <!-- Copyright --> 2003-".date("Y")." <a href=\"http://www.solitude.dk\" target=\"_BLANK\">Andreas Haugstrup Pedersen</a>.</p><p><a href=\"http://www.solitude.dk/filethingie/documentation\" target=\"_BLANK\">".t('Online documentation')."</a> • <a href='http://www.solitude.dk/filethingie/download' id=\"versioncheck\" target=\"_BLANK\">".t('Check for new version')."</a></p><div id='versioninfo'></div></div>";
}

/**
* Create HTML for top header that shows breadcumb navigation.
*/
function ft_make_header() {
global $ft;
$str = "<h1 id='title'>".ft_make_link(t("Home"), '', t("Go to home folder"))." ";
if (empty($_REQUEST['dir'])) {
$str .= "/</h1>";
} else {
// Get breadcrumbs.
if (!empty($_REQUEST['dir'])) {
$crumbs = explode("/", $_REQUEST['dir']);
// Remove first empty element.
unset($crumbs[0]);
// Output breadcrumbs.
$path = "";
foreach ($crumbs as $c) {
$path .= "/{$c}";
$str .= "/";
$str .= ft_make_link($c, "dir=".rawurlencode($path), t("Go to folder"));
}
}
$str .= "</h1>";
}
// Display logout link.
if (LOGIN == TRUE) {
$str .= '<div id="logout"><p>';
if (isset($ft['users']) && @count($ft['users']) > 0 && LOGIN == TRUE) {
$str .= t('Logged in as !user ', array('!user' => $_SESSION['ft_user_'.MUTEX]));
}
$str .= ft_make_link(t("[logout]"), "act=logout", t("Logout of File Thingie")).'</p>';
$str .= '<div id="secondary_menu">' . implode("", ft_invoke_hook('secondary_menu')) . '</div>';
$str .= '</div>';
}
return $str;
}

/**
* Create HTML for error message in case output was sent to the browser.
*/
function ft_make_headers_failed() {
return "<h1>File Thingie Cannot Run</h1><div style='margin:1em;width:76ex;'><p>Your copy of File Thingie has become damaged and will not function properly. The most likely explanation is that the text editor you used when setting up your username and password added invisible garbage characters. Some versions of Notepad on Windows are known to do this.</p><p>To use File Thingie you should <strong><a href='http://www.solitude.dk/filethingie/'>download a fresh copy</a></strong> from the official website and use a different text editor when editing the file. On Windows you may want to try using <a href='http://www.editpadpro.com/editpadlite.html'>EditPad Lite</a> as your text editor.</p></div>";
}

/**
* Create an internal HTML link.
*
* @param $text
* Link text.
* @param $query
* The query string for the link. Optional.
* @param $title
* String for the HTML title attribute. Optional.
* @return String containing the HTML link.
*/
function ft_make_link($text, $query = "", $title = "") {
$str = "<a href=\"".ft_get_self();
if (!empty($query)) {
$str .= "?{$query}";
}
$str .= "\"";
if (!empty($title)) {
$str .= "title=\"{$title}\"";
}
$str .= ">{$text}</a>";
return $str;
}

/**
* Create HTML for login box.
*/
function ft_make_login() {
$str = "<h1>".t('File Thingie Login')."</h1>";
$str .= '<form action="'.ft_get_self().'" method="post" id="loginbox">';
if (!empty($_REQUEST['act']) && $_REQUEST['act'] == "error") {
$str .= "<p class='error'>".t('Invalid username or password')."</p>";
}
$str .= '<div>
<div>
<label for="ft_user" class="login"><input type="text" size="25" name="ft_user" id="ft_user" tabindex="1" /> '.t('Username:').'</label>
</div>
<div>
<label for="ft_pass" class="login"><input type="password" size="25" name="ft_pass" id="ft_pass" tabindex="2" /> '.t('Password:').'</label>
<input type="hidden" name="act" value="dologin" />
</div> <div class="checkbox">
<input type="submit" value="'.t('Login').'" id="login_button" tabindex="10" />';
if (REMEMBERME) {
$str .= '<label for="ft_cookie" id="cookie_label"><input type="checkbox" name="ft_cookie" id="ft_cookie" tabindex="3" /> '.t('Remember me').'</label>';
}
$str .= '</div></div>
</form>';
return $str;
}

/**
* Create HTML for current status messages and reset status messages.
*/
function ft_make_messages() {
$str = '';
$msgs = array();
if (isset($_SESSION['ft_status']) && is_array($_SESSION['ft_status'])) {
foreach ($_SESSION['ft_status'] as $type => $messages) {
if (is_array($messages)) {
foreach ($messages as $m) {
$msgs[] = "<p class='{$type}'>{$m}</p>";
}
}
}
// Reset messages.
unset($_SESSION['ft_status']);
}
if (count($msgs) == 1) {
return $msgs[0];
} elseif (count($msgs) > 1) {
$str .= "<ul>";
foreach ($msgs as $c) {
$str .= "<li>{$c}</li>";
}
$str .= "</ul>";
}
return $str;
}

/**
* Create and output <script> tags for the page.
*/
function ft_make_scripts() {
global $ft;
$scripts = array();
if (INSTALL != "SIMPLE") {
$scripts[] = 'jquery-1.2.1.pack.js';
$scripts[] = 'filethingie.js';
if (AUTOUPDATES != "0") {
$scripts[] = 'jquery.cookie.js';
}
}
$result = ft_invoke_hook('add_js_file');
$scripts = array_merge($scripts, $result);
foreach ($scripts as $c) {
echo "<script type='text/javascript' charset='utf-8' src='{$c}'></script>\r\n";
}
}

/**
* Create inline javascript for the HTML footer.
*
* @return String containing inline javascript.
*/
function ft_make_scripts_footer() {
$result = ft_invoke_hook('add_js_call_footer');
$str = "\r\n";
if (count($result) > 0) {
$str .= '<script type="text/javascript" charset="utf-8">';
$str .= implode('', $result);
$str .= '</script>';
}
return $str;
}

/**
* Create HTML for sidebar.
*/
function ft_make_sidebar() {
$str = '<div id="sidebar">';
// $status = '';
// if (ft_check_upload() === TRUE && is_writeable(ft_get_dir()) && (LIMIT > 0 && LIMIT < ROOTDIRSIZE)) {
// $status = '<p class="alarm">' . t('Upload disabled. Total disk space use of !size exceeds the limit of !limit.', array('!limit' => ft_get_nice_filesize(LIMIT), '!size' => ft_get_nice_filesize(ROOTDIRSIZE))) . '</p>';
// }
// $status .= ft_make_messages();
// if (empty($status)) {
// $str .= "<div id='status' class='hidden'></div>";
// } else {
// $str .= "<div id='status' class='section'><h2>".t('Results')."</h2>{$status}</div>";
// }
if (ft_check_upload() === TRUE && is_writeable(ft_get_dir())) {
if (LIMIT <= 0 || LIMIT > ROOTDIRSIZE) {
$str .= '
<div class="section" id="create">
<h2>'.t('Upload files').'</h2>
<form action="'.ft_get_self().'&q
0

Vous n’avez pas trouvé la réponse que vous recherchez ?

Posez votre question
ThEBiShOp Messages postés 8378 Date d'inscription jeudi 22 mars 2007 Statut Contributeur Dernière intervention 8 février 2021 1 566
20 janv. 2009 à 16:01
et tu veux qu'on fasse quoi au juste avec ton roman ?

si tu avais fait un minimum de recherches tu aurais trouvé rapidement... au lieu d'attendre une hypothétique réponse sur un forum...

dans ton code :

$ft["settings"]["MAXSIZE"] = 99999999; // Maximum file upload size - in bytes.

et grâce à ton copain google (quoi que visiblement vous êtes fâchés) :

http://www.radinks.com/upload/config.php
0