Beispiel #1
0
 function checkFileTypes()
 {
     $mes = e107::getMessage();
     $this->allowed_types = get_filetypes();
     // Get allowed types according to filetypes.xml or filetypes.php
     if (count($this->allowed_types) == 0) {
         $this->allowed_types = array('zip' => 1, 'gz' => 1, 'jpg' => 1, 'png' => 1, 'gif' => 1);
         $mes->addInfo("Setting default filetypes: " . implode(', ', array_keys($this->allowed_types)));
     }
 }
Beispiel #2
0
 function renderForm()
 {
     /*
     		$template = "
     		<div class='form-group'>
             <label for='firstname' class='col-sm-3 control-label'>First Name:**</label>
             <div class='col-sm-9'>
                     <input id='firstname' class=\"form-control tbox\" type=\"text\" name=\"FIRSTNAME\" size=\"20\" maxlength=\"20\" value=\"". $_POST['FIRSTNAME']. "\" required />
             </div>
          	 </div>	";
     */
     $ns = e107::getRender();
     $tp = e107::getParser();
     $text = "<div style='text-align:center'>\n\t\t\t<form enctype='multipart/form-data' method='post' onsubmit='return frmVerify()' action='" . e_SELF . "'>\n\t\t\t<table style='" . USER_WIDTH . "' class='table fborder'>\n\t\t\t<colgroup>\n\t\t\t<col style='width:30%' />\n\t\t\t<col style='width:70%' />\n\t\t\t</colgroup>\n\t\t\t<tr>\n\t\t\t<td class='forumheader3'>" . DOWLAN_11 . ":</td>\n\t\t\t<td class='forumheader3'>";
     require_once e_CORE . "shortcodes/batch/download_shortcodes.php";
     $dlparm = isset($download_category) ? $download_category : "";
     $text .= $tp->parseTemplate("{DOWNLOAD_CATEGORY_SELECT={$dlparm}}", true, $download_shortcodes);
     //FIXME - move to e_upload.php
     $text .= "</td>\n\t\t\t</tr>\n\t\t\n\t\t\t<tr>\n\t\t\t<td style='text-align:center' class='forumheader3'>" . LAN_419 . "</td>\n\t\t\t<td class='forumheader3'>";
     //	$text .= "<b>".LAN_406."</b><br />".LAN_419.":";
     $a_filetypes = get_filetypes();
     if (count($a_filetypes) == 0) {
         $ns->tablerender(LAN_417, LAN_UL_025);
         return;
     }
     $max_upload_size = calc_max_upload_size(-1);
     // Find overriding maximum upload size
     $max_upload_size = set_max_size($a_filetypes, $max_upload_size);
     if (ADMIN) {
         $upper_limit = calc_max_upload_size();
         $allowed_filetypes = "<table class='table table-striped table-bordered'><tr><th class='text-center'>" . LAN_UL_023 . "&nbsp;&nbsp;</th><th style='text-align:right'>" . LAN_UL_024 . "</th></tr>";
         foreach ($a_filetypes as $type => $size) {
             $allowed_filetypes .= "<tr><td>{$type}</td><td style='text-align:right'>" . eHelper::parseMemorySize($size, 0) . "</td></tr>";
         }
         $allowed_filetypes .= "</table>";
     } else {
         $a_filetypes = array_keys($a_filetypes);
         $allowed_filetypes = implode(' | ', $a_filetypes);
     }
     $text .= " " . $allowed_filetypes;
     $text .= "<div class='alert alert-block alert-danger'>" . LAN_407 . "<br />" . LAN_418 . eHelper::parseMemorySize($max_upload_size, 0) . " (" . LAN_UL_022 . ")<br />";
     $text .= "<span style='text-decoration:underline'>" . LAN_408 . "</span> " . LAN_420;
     $text .= "</div>";
     $text .= "</td></tr>";
     //TODO Replcae all form inputs with $frm methods.
     if (!USER) {
         $text .= "<tr>\n\t\t\t<td class='forumheader3'>" . LAN_61 . "</td>\n\t\t\t<td class='forumheader3'><input class='tbox form-control' style='width:90%' name='file_poster' type='text' size='50' maxlength='100' value='{$poster}' /></td>\n\t\t\t</tr>\n\t\t\n\t\t\t<tr>\n\t\t\t<td class='forumheader3'><span style='text-decoration:underline'>" . LAN_112 . "</span></td>\n\t\t\t<td class='forumheader3'><input class='tbox form-control' style='width:90%' name='file_email' id='user_email' type='text' size='50' maxlength='100' value='" . $postemail . "' required /></td>\n\t\t\t</tr>";
     }
     $text .= "\n\t\t\t<tr>\n\t\t\t<td class='forumheader3'><span style='text-decoration:underline'>" . LAN_409 . "</span></td>\n\t\t\t<td class='forumheader3'><input class='tbox form-control' style='width:90%'  name='file_name' id='file_name' type='text' size='50' maxlength='100' required /></td>\n\t\t\t</tr>\n\t\t\n\t\t\t<tr>\n\t\t\t<td class='forumheader3'>" . LAN_410 . "</td>\n\t\t\t<td class='forumheader3'><input class='tbox form-control' style='width:90%' name='file_version' type='text' size='10' maxlength='10' /></td>\n\t\t\t</tr>\n\t\t\n\t\t\n\t\t\t<tr>\n\t\t\t<td class='forumheader3'><span style='text-decoration:underline'>" . LAN_411 . "</span></td>\n\t\t\t<td class='forumheader3'><input class='tbox' style='width:90%'  id='file_realpath' name='file_userfile[]' type='file' size='47' /></td>\n\t\t\t</tr>\n\t\t\n\t\t\t<tr>\n\t\t\t<td class='forumheader3'>" . LAN_412 . "</td>\n\t\t\t<td class='forumheader3'><input class='tbox' style='width:90%' name='file_userfile[]' type='file' size='47' /></td>\n\t\t\t</tr>\n\t\t\n\t\t\t<tr>\n\t\t\t<td class='forumheader3'><span style='text-decoration:underline'>" . LAN_413 . "</span></td>\n\t\t\t<td class='forumheader3'><textarea class='tbox form-control' style='width:90%' name='file_description' id='file_description' cols='59' rows='6' required></textarea></td>\n\t\t\t</tr>\n\t\t\n\t\t\t<tr>\n\t\t\t<td class='forumheader3'>" . LAN_144 . "</td>\n\t\t\t<td class='forumheader3'><input class='tbox form-control' style='width:90%' name='file_website' type='text' size='50' maxlength='100' value='" . (defined(USERURL) ? USERURL : "") . "' /></td>\n\t\t\t</tr>\n\t\t\n\t\t\t<tr>\n\t\t\t<td class='forumheader3'>" . LAN_414 . "<br /><span class='smalltext'>" . LAN_415 . "</span></td>\n\t\t\t<td class='forumheader3'><input class='tbox form-control' style='width:90%' name='file_demo' type='text' size='50' maxlength='100' /></td>\n\t\t\t</tr>\n\t\t\n\t\t\t<tr>\n\t\t\t<td style='text-align:center' colspan='2' class='forumheader'><input class='btn btn-primary button' type='submit' name='upload' value='" . LAN_416 . "' /></td>\n\t\t\t</tr>\n\t\t\t</table>\n\t\t\t</form>\n\t\t\t</div>";
     $ns->tablerender(LAN_417, $text);
 }
Beispiel #3
0
 /**
  *	Get an array of permitted filetypes according to a set hierarchy.
  *	If a specific file name given, that's used. Otherwise the default hierarchy is used
  *
  *	@param string $file_mask - comma-separated list of allowed file types
  *	@param string $filename - optional override file name - defaults ignored
  *
  *	@return array of filetypes
  */
 function getFiletypeLimits($file_mask = false, $filename = '')
 {
     require_once e_HANDLER . "upload_handler.php";
     $limits = get_filetypes($file_mask, $filename);
     ksort($limits);
     return $limits;
 }
Beispiel #4
0
function get_user_max_upload()
{
    $a_filetypes = get_filetypes();
    if (count($a_filetypes) == 0) {
        return 0;
    }
    // Return if no upload allowed
    $max_upload_size = calc_max_upload_size(-1);
    // Find overriding maximum upload size
    $max_upload_size = set_max_size($a_filetypes, $max_upload_size);
    return $max_upload_size;
}
Beispiel #5
0
	{
    	$text = ADLAN_ERR_5." <b>".$thef."</b>:<br /><br /><ul>";
		foreach($mod_found as $val){
			$text .= "<li>".str_replace("../","",$val)."</li>\n";
		}
		$text .="</ul><br />
		<form method='post' action='".e_ADMIN."db.php' id='upd'>
		<a href='#' onclick=\"document.getElementById('upd').submit()\">".ADLAN_ERR_6."</a>
		<input type='hidden' name='plugin_scan' value='1' />
		</form>";
		$ns -> tablerender(ADLAN_ERR_4,$text);
	}
}
*/
// check for file-types;
$allowed_types = get_filetypes();
// Get allowed types according to filetypes.xml or filetypes.php
if (count($allowed_types) == 0) {
    $allowed_types = array('zip' => 1, 'gz' => 1, 'jpg' => 1, 'png' => 1, 'gif' => 1);
    $emessage->add("Setting default filetypes: " . implode(', ', array_keys($allowed_types)), E_MESSAGE_INFO);
}
//echo "Allowed filetypes = ".implode(', ',array_keys($allowed_types)).'<br />';
// avatar check.
$public = array(e_UPLOAD, e_UPLOAD . 'avatars');
$exceptions = array(".", "..", "/", "CVS", "avatars", "Thumbs.db", ".ftpquota", ".htaccess", "php.ini", ".cvsignore", 'e107.htaccess');
//TODO use $file-class to grab list and perform this check.
foreach ($public as $dir) {
    if (is_dir($dir)) {
        if ($dh = opendir($dir)) {
            while (($file = readdir($dh)) !== false) {
                if (is_dir($dir . "/" . $file) == FALSE && !in_array($file, $exceptions)) {
Beispiel #6
0
    }
}
if ($message) {
    $text = "<div style=\"text-align:center\"><b>" . $message . "</b></div>";
    $ns->tablerender("", $text);
    require_once FOOTERF;
    exit;
}
$text = "<div style='text-align:center'>\n\t<form enctype='multipart/form-data' method='post' onsubmit='return frmVerify()' action='" . e_SELF . "'>\n\t<table style='" . USER_WIDTH . "' class='fborder'>\n\t<colgroup>\n\t<col style='width:30%' />\n\t<col style='width:70%' />\n\t</colgroup>\n\t<tr>\n\t<td class='forumheader3'>" . DOWLAN_11 . ":</td>\n\t<td class='forumheader3'>";
require_once e_CORE . "shortcodes/batch/download_shortcodes.php";
$dlparm = isset($download_category) ? $download_category : "";
$text .= $tp->parseTemplate("{DOWNLOAD_CATEGORY_SELECT={$dlparm}}", true, $download_shortcodes);
$text .= "\n\t</td>\n\t</tr>\n\n\t<tr>\n\t<td style='text-align:center' colspan='2' class='forumheader3'>";
$text .= "<b>" . LAN_406 . "</b><br />" . LAN_419 . ":";
require_once e_HANDLER . 'upload_handler.php';
$a_filetypes = get_filetypes();
if (count($a_filetypes) == 0) {
    $text .= LAN_UL_025 . "</td></tr></table>\n\t</form>\n\t</div>";
    $ns->tablerender(LAN_417, $text);
    require_once FOOTERF;
}
$max_upload_size = calc_max_upload_size(-1);
// Find overriding maximum upload size
$max_upload_size = set_max_size($a_filetypes, $max_upload_size);
if (ADMIN) {
    $upper_limit = calc_max_upload_size();
    $allowed_filetypes = "<table><tr><td>" . LAN_UL_023 . "&nbsp;&nbsp;</td><td style='text-align:right'>" . LAN_UL_024 . "</td></tr>";
    foreach ($a_filetypes as $type => $size) {
        $allowed_filetypes .= "<tr><td>{$type}</td><td style='text-align:right'>" . $e107->parseMemorySize($size, 0) . "</td></tr>";
    }
    $allowed_filetypes .= "</table>";