TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

Members
Stats
  • Total Posts: 196,027
  • Total Topics: 21,334
  • Online today: 519
  • Online ever: 8,223 (February 19, 2025, 04:35:35 AM)
Users Online
  • Users: 0
  • Guests: 192
  • Total: 192

Quick Upload Block for SmfHacks Gallery Lite

Started by Jpg, March 18, 2007, 06:08:35 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Jpg

Made a code as a request for someone at Smfhacks.com
I felt like it was a good idea so I did it for them...I might as well share it here as well.. :P


global $scripturl, $modSettings, $db_prefix, $txt, $context, $settings, $boarddir;
// gallery.index.php is not loaded yet, so load it here
require_once($boarddir.'/Themes/default/languages/Gallery.english.php');

// text area tag var
$ta_tag = "TEXTAREA";

//Get the category
@$cat = (int) $_REQUEST['cat'];

// display the block info
echo '
<div class="tborder">
<form method="POST" enctype="multipart/form-data" name="picform" id="picform" action="' . $scripturl . '?action=gallery&sa=add2">
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr class="catbg">
<td class="smalltext" width="50%" colspan="1" height="19" align="left"><b>Quick Gallery Upload</b></td>
</tr>
<tr class="windowbg2">
<td class="smalltext"><b>Title:</b><br /><input type="text" name="title" size="15" /></td>
</tr>
<tr class="windowbg2">
<td class="smalltext" align="left"><b>Category</b> </td>
</tr>
<tr class="windowbg2">
<td class="smalltext"><select name="cat">';


// get our query results to create select box
$dbresult = db_query("SELECT ID_CAT, title FROM {$db_prefix}gallery_cat ORDER BY roworder ASC", __FILE__, __LINE__);
while ($row = mysql_fetch_assoc($dbresult)){
echo '
<option value="' . $row['ID_CAT']  . '" ' . (($cat == $row['ID_CAT']) ? ' selected="selected"' : '') .'>' . $row['title'] . '</option>';
}


echo '
</select>
</td>
</tr>
<tr class="windowbg2">
<td class="smalltext" align="left"><b>Description:</b> </td>
</tr>
<tr class="windowbg2">
<td class="smalltext"><'.$ta_tag.' name="description" rows="6" cols="16"></'.$ta_tag.'></td>
</tr>
<tr class="windowbg2">
<td class="smalltext" align="left"><b>Keywords:</b> </td>
</tr>
<tr class="windowbg2">
<td class="smalltext"><input type="text" name="keywords" maxlength="100" size="15" /></td>
</tr>
<tr class="windowbg2">
<td class="smalltext" align="left"><b>' . $txt['gallery_form_uploadpic'] . '</b> </td>
</tr>
<tr class="windowbg2">
<td class="smalltext"><input type="file" size="12" name="picture" /></td>
</tr>';

if(!empty($modSettings['gallery_commentchoice'])){
echo '
<tr class="windowbg2">
<td class="smalltext" align="left"><b>' . $txt['gallery_form_additionaloptions'] . '</b> </td>
</tr>
<tr class="windowbg2">
<td class="smalltext"><input type="checkbox" name="allowcomments" checked="checked" /><b>Allow Comments</b></td>
</tr>';
}

echo '
<tr class="windowbg2">
<td class="smalltext" width="28%" colspan="2" height="26" align="left" class="windowbg2"><input type="submit" value="Add Picture" name="submit" /></td>
</tr>';

if(!allowedTo('smfgallery_autoapprove')){
echo '
<tr class="windowbg2">
<td class="smalltext">'.$txt['gallery_form_notapproved'].'</td>
</tr>';
}

echo '
</table></form></div>
';


Put this is a Php box.
Updated Thanks to Thurnok :P

pvisser

is this going in an PHP box, because when i do then after enable the box and then edit the box again the coding is runnen past the coding box is the box settings. Its to wide. Whel its a supper idear.

edwardsiow

"is this going in an PHP box, because when i do then after enable the box and then edit the box again the coding is runnen past the coding box"

this happen on me too...but everytime i want to edit, i have to delete the phpbox first....then add a new one....is it the TP bugs or?

Jpg

#3
I said it doesn't work well with Internet explorer. :P
And yeah I think it might be a Tp error.

Thurnok

#4
This is not a TP bug.

This is simply a peculiarity that one must be aware of when operating from within EVAL() functions which TP uses for blocks.  Since the editor for blocks is a TEXTAREA you cannot embed a </textarea> tag in your block directly since it will close the editor textarea tag.

Instead, you need to break it up or call it as a variable so that it is parsed after the EVAL().

See the modified code in JPGs first post.
Thurnok
The one, the only!

Jpg

Ah I see, it edits onto the code that Tp uses for blocks...I see. :P

superQ

#6
This one is nice, but when I looked at it in edit the code did not stay in the box in any theme. It went in right  then when I look at it asfter saving it it is out... Happened 3 times--and currently?


G6Cad

What have you done there ?

You seem to have errors in the templatefiles aswell.
Reupload the TP files to your forum again, Use the Manual install package and just replace the files with the old you have.

Jpg

#8
Lol, blame Thurnok...*points to Thurnok*  :D

I guess it's a one time edit deal for now...

[Same thing happens to me G6..it's the php block's code..not Tp itself...]

superQ

I was wondering why I don't see any errors ... I meant to ask if you had that prob JPG.  :coolsmiley:

I Think I have become pre-programmed to think I did something to screw it up :o My first thought is usually "what did the Q do now" :uglystupid2:

This website is proudly hosted on Crocweb Cloud Website Hosting.