Fixing the mp3 add process + adds possibility to upload 10Mb mp3 files
parent
a30cdac875
commit
4161a79b86
|
|
@ -149,7 +149,7 @@ if ($user->isAdmin()) {
|
||||||
} ?>
|
} ?>
|
||||||
</ul>
|
</ul>
|
||||||
<p> </p>
|
<p> </p>
|
||||||
<form action="bm.php" method="post" <?php echo (isset($_GET["new"]) && $_GET["new"]=="photo") ? "enctype=\"multipart/form-data\"" : ""?> name="frmAdd" class="newpost">
|
<form action="bm.php" method="post" <?php echo (isset($_GET["new"]) && ($_GET["new"]=="photo" || $_GET["new"]=="mp3")) ? "enctype=\"multipart/form-data\"" : ""?> name="frmAdd" class="newpost">
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<?php
|
<?php
|
||||||
$date = time();
|
$date = time();
|
||||||
|
|
@ -191,7 +191,7 @@ if ($user->isAdmin()) {
|
||||||
$input = array("{type}", "{date}", "{id_user}", "{editUrl}", "{editBody}");
|
$input = array("{type}", "{date}", "{id_user}", "{editUrl}", "{editBody}");
|
||||||
$output = array("7", $date, $_SESSION['user_id'], $url, $body);
|
$output = array("7", $date, $_SESSION['user_id'], $url, $body);
|
||||||
|
|
||||||
$template->cargarPlantilla($input, $output, "template_add_mp3");
|
$template->cargarPlantilla($input, $output, "template_add_mp3_bm");
|
||||||
$template->mostrarPlantilla();
|
$template->mostrarPlantilla();
|
||||||
break;
|
break;
|
||||||
} ?>
|
} ?>
|
||||||
|
|
|
||||||
|
|
@ -60,15 +60,22 @@ if ($user->isAuthenticated()) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($_POST["type"]=="7") { // is MP3 type
|
if ($_POST["type"]=="7") { // is MP3 type
|
||||||
set_time_limit(300);
|
set_time_limit(300);
|
||||||
$mp3Name = $util_class->getFileName($_POST["url"]);
|
if (isset($_POST["url"]) && $_POST["url"]!="") {
|
||||||
if (!$tumble->saveMP3($_POST["url"])) {
|
$mp3Name = $util_class->getFileName($_POST["url"]);
|
||||||
header("Location: ".$conf->urlSorbet."/admin/index.php?mp3=false");
|
if (!$tumble->saveMP3($_POST["url"])) {
|
||||||
die();
|
header("Location: ".$conf->urlSorbet."/admin/index.php?mp3=false");
|
||||||
}
|
die();
|
||||||
if ($util_class->isMP3($remoteFileName)) {
|
}
|
||||||
$_POST["url"] = $conf->urlSorbet."/uploads/".$mp3Name;
|
$_POST["url"] = $conf->urlSorbet."/uploads/".$mp3Name;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (move_uploaded_file($_FILES['mp3']['tmp_name'], "../uploads/".$util_class->sanitizeName($_FILES['mp3']['name']))) {
|
||||||
|
$_POST["url"] = $conf->urlSorbet."/uploads/".$util_class->sanitizeName($_FILES['mp3']['name']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
unset($_POST["mp3"]);
|
||||||
|
unset($_POST["MAX_FILE_SIZE"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!get_magic_quotes_gpc()) {
|
if (!get_magic_quotes_gpc()) {
|
||||||
|
|
@ -178,6 +185,7 @@ if ($user->isAuthenticated()) {
|
||||||
$_GET['new'] = 'post';
|
$_GET['new'] = 'post';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$form = new themes;
|
$form = new themes;
|
||||||
$form->set('date', $date);
|
$form->set('date', $date);
|
||||||
$form->set('id_user', $_SESSION['user_id']);
|
$form->set('id_user', $_SESSION['user_id']);
|
||||||
|
|
|
||||||
|
|
@ -70,7 +70,7 @@
|
||||||
{if $action.deleted or $action.modified or $action.added}<div class="exito" id="divMessages">{exito}</div>{/if}
|
{if $action.deleted or $action.modified or $action.added}<div class="exito" id="divMessages">{exito}</div>{/if}
|
||||||
{if $error}<div class="error"><strong>{error}</div>{/if}
|
{if $error}<div class="error"><strong>{error}</div>{/if}
|
||||||
|
|
||||||
<form action="index.php" method="post" {if $new=='photo'}enctype="multipart/form-data"{/if} name="frmAdd" id="autosave" class="newpost">
|
<form action="index.php" method="post" {if $new=='photo' || $new=='mp3'}enctype="multipart/form-data"{/if} name="frmAdd" id="autosave" class="newpost">
|
||||||
<fieldset>
|
<fieldset>
|
||||||
{if $postId}<input type="hidden" name="id_post" id="id_post" value="{postId}" />{/if}
|
{if $postId}<input type="hidden" name="id_post" id="id_post" value="{postId}" />{/if}
|
||||||
{form}
|
{form}
|
||||||
|
|
|
||||||
|
|
@ -1,35 +1,76 @@
|
||||||
|
|
||||||
<div>
|
|
||||||
<label for="url">MP3 URL</label>
|
|
||||||
<br /><input class="txt" type="text" name="url" id="url" value="{editUrl}" size="80" />
|
|
||||||
<div style="color: rgb(136, 136, 136); margin-bottom: 5px; font-size: 11px; font-weight: bold;">
|
|
||||||
This is the MP3 file URL or a GoEar URL or an Odeo URL.<br>
|
|
||||||
<span style="font-size: 10px; font-weight: normal;">(ie. http://www.goear.com/listen.php?v=c0a2c85)</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<label for="description">Caption <span class="option">(optional)</span></label><br />
|
|
||||||
<textarea rows="12" cols="84" name="description" id="description" tabindex="2">{editBody}</textarea>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<input type="hidden" name="title" id="title" value="" />
|
|
||||||
<input type="hidden" name="type" id="type" value="{type}" />
|
<div id="mp3_upload">
|
||||||
<input type="hidden" name="date" id="date" value="{date}" />
|
<label for="description">MP3</label>
|
||||||
<input type="hidden" name="id_user" id="id_user" value="{id_user}" />
|
<br /><input type="file" name="mp3" id="mp3" enctype="multipart/form-data"/>
|
||||||
|
<div style="font-size:11px; color:#666; margin-top:5px;">
|
||||||
|
Supports MP3. <strong>Max size is 10 MB.</strong>
|
||||||
|
</div>
|
||||||
|
<div style="font-size:11px; color:#666; margin-top:5px;">
|
||||||
|
<a href="#" class="linkFrm">Use a URL instead</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="mp3_url">
|
||||||
|
<label for="description">MP3 URL</label>
|
||||||
|
<br /><input class="input-text" type="text" name="url" id="url" value="{editUrl}" style="width:400px"/>
|
||||||
|
<div style="font-size:11px; color:#666; margin-top:5px;">
|
||||||
|
<a href="#" class="linkFrm">Use a upload form instead</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<label for="description" style="display:block;">Caption <span class="option">(optional)</span></label>
|
||||||
|
<textarea rows="12" cols="84" name="description" id="description">{editBody}</textarea>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<input type="hidden" name="title" id="title" value="" />
|
||||||
|
<input type="hidden" name="MAX_FILE_SIZE" value="10485760" />
|
||||||
|
<input type="hidden" name="type" id="type" value="{type}" />
|
||||||
|
<input type="hidden" name="date" id="date" value="{date}" />
|
||||||
|
<input type="hidden" name="id_user" id="id_user" value="{id_user}" />
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
$('#mp3_url').css('display','none');
|
||||||
$("#autosave").validate({
|
$("#autosave").validate({
|
||||||
rules: {
|
rules: {
|
||||||
url: {
|
mp3: {
|
||||||
required: true,
|
required: function() {
|
||||||
|
return ($('#mp3_upload').css('display')!= 'none') ? true : false;
|
||||||
|
},
|
||||||
|
accept: "(mp3)"
|
||||||
|
},
|
||||||
|
url: {
|
||||||
|
required: function() {
|
||||||
|
return ($('#mp3_url').css('display')!= 'none') ? true : false;
|
||||||
|
},
|
||||||
url: true
|
url: true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
errorElement: "span",
|
errorElement: "span",
|
||||||
errorClass: "validate_span",
|
errorClass: "validate_span",
|
||||||
errorPlacement: function(label, element) {
|
errorPlacement: function(label, element) {
|
||||||
label.prependTo(element.prev())
|
label.prependTo(element.prev())
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
</script>
|
|
||||||
|
$("#mp3_upload a.linkFrm").click( function() {
|
||||||
|
$('#mp3_upload').css('display','none');
|
||||||
|
$('#mp3_url').css('display','block');
|
||||||
|
$('#mp3').val('');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
$("#mp3_url a.linkFrm").click( function() {
|
||||||
|
$('#mp3_url').css('display','none');
|
||||||
|
$('#mp3_upload').css('display','block');
|
||||||
|
$('#url').val('');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,68 @@
|
||||||
|
|
||||||
|
<div id="mp3_upload">
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="mp3_url">
|
||||||
|
<label for="description">MP3 URL</label>
|
||||||
|
<br /><input class="input-text" type="text" name="url" id="url" value="{editUrl}" style="width:400px"/>
|
||||||
|
<div style="font-size:11px; color:#666; margin-top:5px;">
|
||||||
|
<a href="#" class="linkFrm">Use a upload form instead</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<label for="description" style="display:block;">Caption <span class="option">(optional)</span></label>
|
||||||
|
<textarea rows="12" cols="84" name="description" id="description">{editBody}</textarea>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<input type="hidden" name="title" id="title" value="" />
|
||||||
|
<input type="hidden" name="MAX_FILE_SIZE" value="10485760" />
|
||||||
|
<input type="hidden" name="type" id="type" value="{type}" />
|
||||||
|
<input type="hidden" name="date" id="date" value="{date}" />
|
||||||
|
<input type="hidden" name="id_user" id="id_user" value="{id_user}" />
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<script>
|
||||||
|
$('#mp3_url').css('display','none');
|
||||||
|
$("#autosave").validate({
|
||||||
|
rules: {
|
||||||
|
mp3: {
|
||||||
|
required: function() {
|
||||||
|
return ($('#mp3_upload').css('display')!= 'none') ? true : false;
|
||||||
|
},
|
||||||
|
accept: "(mp3)"
|
||||||
|
},
|
||||||
|
url: {
|
||||||
|
required: function() {
|
||||||
|
return ($('#mp3_url').css('display')!= 'none') ? true : false;
|
||||||
|
},
|
||||||
|
url: true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
errorElement: "span",
|
||||||
|
errorClass: "validate_span",
|
||||||
|
errorPlacement: function(label, element) {
|
||||||
|
label.prependTo(element.prev())
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
$("#mp3_upload a.linkFrm").click( function() {
|
||||||
|
$('#mp3_upload').css('display','none');
|
||||||
|
$('#mp3_url').css('display','block');
|
||||||
|
$('#mp3').val('');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
$("#mp3_url a.linkFrm").click( function() {
|
||||||
|
$('#mp3_url').css('display','none');
|
||||||
|
$('#mp3_upload').css('display','block');
|
||||||
|
$('#url').val('');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
@ -155,6 +155,7 @@ class sorbet
|
||||||
|
|
||||||
public function saveMP3($remoteFileName)
|
public function saveMP3($remoteFileName)
|
||||||
{
|
{
|
||||||
|
$util_class = new util();
|
||||||
if ($util_class->getMP3File($remoteFileName)) {
|
if ($util_class->getMP3File($remoteFileName)) {
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -164,6 +165,7 @@ class sorbet
|
||||||
|
|
||||||
public function savePhoto($remoteFileName)
|
public function savePhoto($remoteFileName)
|
||||||
{
|
{
|
||||||
|
$util_class = new util();
|
||||||
if ($util_class->getPhotoFile($remoteFileName)) {
|
if ($util_class->getPhotoFile($remoteFileName)) {
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -201,9 +203,10 @@ class sorbet
|
||||||
}
|
}
|
||||||
public function getMp3Player($url)
|
public function getMp3Player($url)
|
||||||
{
|
{
|
||||||
|
$util_class = new util();
|
||||||
|
$global_url = $this->conf->urlSorbet;
|
||||||
if ($util_class->isMP3($url)) {
|
if ($util_class->isMP3($url)) {
|
||||||
$playerUrl = $conf->urlSorbet."/admin/scripts/player.swf?soundFile=".$url;
|
return "\t\t\t<audio src=\"".$url."\" title=\"Track Name\" data-artist=\"Artist\" controls>Your browser does not support the <code>audio</code> element.</audio>\n";
|
||||||
return "\t\t\t<object type=\"application/x-shockwave-flash\" data=\"" . $playerUrl . "\" width=\"290\" height=\"24\"><param name=\"movie\" value=\"" . $playerUrl . "\" /><param name=\"quality\" value=\"high\" /><param name=\"menu\" value=\"false\" /><param name=\"wmode\" value=\"transparent\" /></object>\n";
|
|
||||||
} elseif ($util_class->isGoEar($url)) {
|
} elseif ($util_class->isGoEar($url)) {
|
||||||
return "\t\t\t<object type=\"application/x-shockwave-flash\" data=\"http://www.goear.com/files/external.swf\" width=\"366\" height=\"130\"><param name=\"movie\" value=\"http://www.goear.com/files/external.swf\" /><param name=\"quality\" value=\"high\" /><param name=\"FlashVars\" value=\"file=".$util_class->getGoEarCode($url)."\" /><param name=\"wmode\" value=\"transparent\" /></object>\n";
|
return "\t\t\t<object type=\"application/x-shockwave-flash\" data=\"http://www.goear.com/files/external.swf\" width=\"366\" height=\"130\"><param name=\"movie\" value=\"http://www.goear.com/files/external.swf\" /><param name=\"quality\" value=\"high\" /><param name=\"FlashVars\" value=\"file=".$util_class->getGoEarCode($url)."\" /><param name=\"wmode\" value=\"transparent\" /></object>\n";
|
||||||
} elseif ($util_class->isOdeo($url)) {
|
} elseif ($util_class->isOdeo($url)) {
|
||||||
|
|
|
||||||
|
|
@ -185,7 +185,7 @@
|
||||||
<footer style="text-align:center;margin:20px">
|
<footer style="text-align:center;margin:20px">
|
||||||
<a href="{URL_Tumble}/archive.php">{__("Archive")}</a> /
|
<a href="{URL_Tumble}/archive.php">{__("Archive")}</a> /
|
||||||
{__("Subscribe via")} <a href="{URL_Tumble}/rss.php">RSS</a> /
|
{__("Subscribe via")} <a href="{URL_Tumble}/rss.php">RSS</a> /
|
||||||
{__("Powered by")} Sorbet CMS
|
{__("Powered by")} <a href="https://framagit.org/sorbetcms/sorbetcms">Sorbet CMS</a>
|
||||||
</footer>
|
</footer>
|
||||||
</div>
|
</div>
|
||||||
<script type="text/javascript" src="{URL_Tumble}/admin/scripts/jquery.js"></script>
|
<script type="text/javascript" src="{URL_Tumble}/admin/scripts/jquery.js"></script>
|
||||||
|
|
|
||||||
|
|
@ -185,7 +185,7 @@
|
||||||
<footer style="text-align:center;margin:20px">
|
<footer style="text-align:center;margin:20px">
|
||||||
<a href="{URL_Tumble}/archive.php">{__("Archive")}</a> /
|
<a href="{URL_Tumble}/archive.php">{__("Archive")}</a> /
|
||||||
{__("Subscribe via")} <a href="{URL_Tumble}/rss.php">RSS</a> /
|
{__("Subscribe via")} <a href="{URL_Tumble}/rss.php">RSS</a> /
|
||||||
{__("Powered by")} Sorbet CMS
|
{__("Powered by")} <a href="https://framagit.org/sorbetcms/sorbetcms">Sorbet CMS</a>
|
||||||
</footer>
|
</footer>
|
||||||
</div>
|
</div>
|
||||||
<script type="text/javascript" src="{URL_Tumble}/admin/scripts/jquery.js"></script>
|
<script type="text/javascript" src="{URL_Tumble}/admin/scripts/jquery.js"></script>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue