Jump to content

SMF Addon editing please help!


Marsha

Recommended Posts

Heya,

I have SMF 1.1.10, I installed a Mod called Download System.

This allows users to upload files and let other people access them, The only problem is that it doesn't have a Image uploader to go with each file, so that you can add an Image with it.

I added a script to it and I think it works but I cannot find the place it is uploading the image to so It might not work.

Each file uploaded has it's information stored in MySQL, I have made an extra column for the filename of the image, but how would I enable it so when you Upload the Image, It updates it in MySQL.

Also if you spot any problems with this script please let me know as I am not 100% sure that it works as I either cannot find the Images on FTP or It doesn't work.

Thanks

echo '<form method="post" enctype="multipart/form-data" name="picform"

 

id="picform" action="' . $scripturl . '?action=downloads&sa=add2">

<table border="0" cellpadding="0" cellspacing="0" width="100%">

  <tr class="catbg">

    <td width="50%" colspan="2"  align="center">

    <b>', $txt['downloads_form_adddownload'], '</b></td>

  </tr>

  <tr class="windowbg2">

  <td align="right"><b>' . $txt['downloads_form_title'] . '</b> </td>

  <td><input type="text" name="title" size="50" /></td>

  </tr>

  <tr class="windowbg2">

  <td align="right"><b>' . $txt['downloads_form_category'] . '</b> </td>

  <td><select name="cat">';

 

foreach ($context['downloads_cat'] as $i => $category)

{

echo '<option value="' . $category['ID_CAT']  . '" ' . (($cat ==

 

$category['ID_CAT']) ? ' selected="selected"' : '') .'>' . $category['title'] .

 

'</option>';

}

 

echo '</select>

  </td>

  </tr>

  <tr class="windowbg2">

  <td align="right"><b>' . $txt['downloads_form_description'] . '</b> </td>

  <td>

  <tr>

  <td class="windowbg2" colspan="2" align="center">

  <table>

  ';

  theme_postbox('');

  echo '</table>';

 

    if ($context['show_spellchecking'])

    echo '

    <br /><input

 

type="button" value="', $txt['spell_check'], '" onclick="spellCheck(\'picform\',

 

\'description\');" />';

 

echo '

  </td>

  </tr>

  <tr class="windowbg2">

  <td align="right"><b>', $txt['downloads_form_keywords'], '</b> </td>

  <td><input type="text" name="keywords" maxlength="100" size="50" />

  </tr>

  <tr class="windowbg2">

  <td align="right"><b>', $txt['downloads_form_uploadfile'], '</b> </td>

 

    <td><input type="file" size="48" name="download" /></td>

</td>

</tr>

  <tr class="windowbg2">

  <td align="right"><b>', $txt['downloads_form_uploadurl'], '</b> </td>

  <td>';

if ($_REQUEST[completed] == 1) {

$newname = uniqid("whc").".jpg";

move_uploaded_file($_FILES['mailfile']['tmp_name'],

"images/$newname");

} ?>

<body>

<?php if ($_REQUEST[completed] != 1) { ?>

<b>Please upload an image</b><br>

<input type=hidden name=MAX_FILE_SIZE value=1500000>

<input type=hidden name=completed value=1>

<input type=file name=mailfile>

<b>Yum, Yum. I enjoyed that</b>

<hr>

Copyright, etc

</body><?php echo '</tr>

  <tr>

 

  <td colspan="2" class="windowbg2"><hr /></td>

  </tr>';

 

 

 

foreach ($context['downloads_custom'] as $i => $custom)

{

echo '<tr>

<td class="windowbg2" align="right"><b>', $custom['title'],

 

($custom['is_required'] ? '<font color="#FF0000">*</font>' : ''), '</b></td>

<td class="windowbg2"><input type="text" name="cus_',

 

$custom['ID_CUSTOM'],'" value="' , $custom['defaultvalue'], '" /></td>

 

</tr>

';

}

 

 

echo '

    <tr class="windowbg2">

<td align="right"><b>' . $txt['downloads_form_additionaloptions'] .

 

'</b> </td>

<td><input type="checkbox" name="sendemail" checked="checked" /><b>' .

 

$txt['downloads_notify_title'] .'</b>

  </tr>

  ';

 

  if ($modSettings['down_commentchoice'])

  {

echo '

  <tr class="windowbg2">

<td align="right"> </td>

<td><input type="checkbox" name="allowcomments" checked="checked"

 

/><b>' . $txt['downloads_form_allowcomments'] .'</b>

  </tr>';

  }

 

  // Display the file quota information

  if ($context['quotalimit'] != 0)

  {

echo '

  <tr class="windowbg2">

<td align="right">',$txt['downloads_quotagrouplimit'],' </td>

<td>',format_size($context['quotalimit'], 2),'</td>

  </tr>

  <tr class="windowbg2">

<td align="right">',$txt['downloads_quotagspaceused'],' </td>

<td>',format_size($context['userspace'], 2),'</td>

  </tr>

  <tr class="windowbg2">

<td align="right">',$txt['downloads_quotaspaceleft'],' </td>

<td><b>' . format_size(($context['quotalimit']-$context['userspace']),

 

2) . '</b></td>

  </tr>

 

  ';

  }

 

echo '

  <tr class="windowbg2">

    <td width="28%" colspan="2"  align="center" class="windowbg2">

 

    <input type="submit" value="', $txt['downloads_form_adddownload'], '"

 

name="submit" /><br />';

} else { }

 

  if (!allowedTo('downloads_autoapprove'))

  echo $txt['downloads_form_notapproved'];

 

echo '

    </td>

  </tr>

</table>

 

</form>

Attached is also the full File

 

[attachment deleted by admin]

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.