Customizing SMF > Mod Requests

Download System

<< < (2/6) > >>

Texan78:
Would this be the Downloads2.php? I don't have a Downloads.php in my Sources folder?

-Thanks

Texan78:

--- Quote from: vbgamer45 on May 15, 2012, 06:59:57 PM ---Modify the Downloads.php in the Sources folder look at the AddDownload2 function and find the createpost function and add have it include the description of the download into  message body of that function call

--- End quote ---

Here is the AddDownload two function but I can not fine the createpost function.


--- Code: ---function Downloads_AddDownload()
{
global $context, $mbname, $txt, $modSettings, $user_info, $smcFunc, $sourcedir;

isAllowedTo('downloads_add');

if (isset($_REQUEST['cat']))
$cat = (int) $_REQUEST['cat'];
else
$cat = 0;

$context['down_cat'] = $cat;

Downloads_GetCatPermission($cat,'addfile');

if ($user_info['is_guest'])
$groupid = -1;
else
$groupid =  $user_info['groups'][0];

$dbresult = $smcFunc['db_query']('', "
SELECT
c.ID_CAT, c.title, p.view, p.addfile
FROM {db_prefix}down_cat AS c
LEFT JOIN {db_prefix}down_catperm AS p ON (p.ID_GROUP = $groupid AND c.ID_CAT = p.ID_CAT)
WHERE c.redirect = 0 ORDER BY c.roworder ASC");
if ($smcFunc['db_num_rows']($dbresult) == 0)
fatal_error($txt['downloads_error_no_catexists'] , false);

$context['downloads_cat'] = array();
while($row = $smcFunc['db_fetch_assoc']($dbresult))
{
// Check if they have permission to add to this category.
if ($row['view'] == '0' || $row['addfile'] == '0' )
continue;

$context['downloads_cat'][] = array(
'ID_CAT' => $row['ID_CAT'],
'title' => $row['title'],
);
}
$smcFunc['db_free_result']($dbresult);

$result = $smcFunc['db_query']('', "
SELECT
title, defaultvalue, is_required, ID_CUSTOM
FROM  {db_prefix}down_custom_field
WHERE ID_CAT = " . $cat);
$context['downloads_custom'] = array();
while ($row = $smcFunc['db_fetch_assoc']($result))
{
$context['downloads_custom'][] = array(
'ID_CUSTOM' => $row['ID_CUSTOM'],
'title' => $row['title'],
'defaultvalue' => $row['defaultvalue'],
'is_required' => $row['is_required'],
);
}
$smcFunc['db_free_result']($result);

// Get Quota Limits to Display
$context['quotalimit'] = Downloads_GetQuotaGroupLimit($user_info['id']);
$context['userspace'] = Downloads_GetUserSpaceUsed($user_info['id']);

$context['sub_template']  = 'add_download';

$context['page_title'] = $mbname . ' - ' . $txt['downloads_text_title'] . ' - ' . $txt['downloads_form_adddownload'];

// Check if spellchecking is both enabled and actually working.
$context['show_spellchecking'] = !empty($modSettings['enableSpellChecking']) && function_exists('pspell_new');

// Needed for the WYSIWYG editor.
require_once($sourcedir . '/Subs-Editor.php');

// Now create the editor.
$editorOptions = array(
'id' => 'descript',
'value' => '',
'width' => '90%',
'form' => 'picform',
'labels' => array(
'post_button' => '',
),
);
create_control_richedit($editorOptions);
$context['post_box_name'] = $editorOptions['id'];


}

function Downloads_AddDownload2()
{
global $txt, $scripturl, $modSettings, $sourcedir, $gd2, $user_info, $smcFunc;

isAllowedTo('downloads_add');

// If we came from WYSIWYG then turn it back into BBC regardless.
if (!empty($_REQUEST['descript_mode']) && isset($_REQUEST['descript']))
{
require_once($sourcedir . '/Subs-Editor.php');

$_REQUEST['descript'] = html_to_bbc($_REQUEST['descript']);

// We need to unhtml it now as it gets done shortly.
$_REQUEST['descript'] = un_htmlspecialchars($_REQUEST['descript']);

}


--- End code ---

vbgamer45:
Your missing the rest of Downloads_AddDownload2() That is part I am looking for.

Texan78:
I've attached the Downloads2.php I found several refrences to AddDownloads2 and createpost function but, I didn't find those together. So not sure where to go from there or what exactly I am looking for or what variable to insert where. Any assistance would be great!

-Thanks!

vbgamer45:
File isn't usable there looks like Mac formatting html around everything.

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version