News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

affilaite system problem

Started by p4e, October 16, 2005, 10:34:05 AM

Previous topic - Next topic

p4e

I have a problem with te affilaite system script from my community forum.
I tried to duplicate the news system and rename it to affliate system
But it wouldn't work :(
Can you help me??
Here's the script i already changed:

ManageNews.template.php

echo '
<form action="', $scripturl, '?action=news;sa=editaff" method="post" name="postmodify" id="postmodify">
<table width="85%" cellpadding="3" cellspacing="0" border="0" align="center" class="tborder">
<tr class="titlebg">
<th width="50%"></th>
<th align="left" width="45%">', affilaites, '</th>
<th align="center" width="5%"><input type="checkbox" class="check" onclick="invertAll(this, this.form);" /></th>
</tr>';

// Loop through all the current news items so you can edit/remove them.
foreach ($context['admin_current_aff'] as $admin_aff)
echo '
<tr class="windowbg2">
<td align="center">
<div style="margin-bottom: 2ex;"><textarea rows="3" cols="65" name="aff[]" style="width: 85%;">', $admin_aff['unparsed'], '</textarea></div>
</td><td align="left" valign="top">
<div style="overflow: auto; width: 100%; height: 10ex;">', $admin_aff['parsed'], '</div>
</td><td align="center">
<input type="checkbox" name="remove[]" value="', $admin_aff['id'], '" class="check" />
</td>
</tr>';

// This provides an empty text box to add a news item to the site.
echo '
<tr class="windowbg2">
<td align="center">

</td>
<td colspan="2" valign="bottom" align="right" style="padding: 1ex;">
<input type="submit" name="save_items" value="', $txt[10], '" /> <input type="submit" name="delete_selection" value="', $txt['editaff_remove_selected'], '" onclick="return confirm(\'', $txt['editaff_remove_confirm'], '\');" />
</td>
</tr>
</table>
<input type="hidden" name="sc" value="', $context['session_id'], '" />
</form>';
}

function template_email_members()
{
global $context, $settings, $options, $txt, $scripturl;

echo '
<form action="', $scripturl, '?action=news;sa=mailingcompose" method="post">
<table width="600" cellpadding="5" cellspacing="0" border="0" align="center" class="tborder">
<tr class="titlebg">
<td>', $txt[6], '</td>
</tr><tr class="windowbg">
<td class="smalltext" style="padding: 2ex;">', $txt['smf250'], '</td>
</tr><tr>
<td class="windowbg2">';

foreach ($context['groups'] as $group)
echo '
<label for="who[', $group['id'], ']"><input type="checkbox" name="who[', $group['id'], ']" id="who[', $group['id'], ']" value="', $group['id'], '" checked="checked" class="check" /> ', $group['name'], '</label> <i>(', $group['member_count'], ')</i><br />';

echo '
<br />
<label for="checkAllGroups"><input type="checkbox" id="checkAllGroups" checked="checked" onclick="invertAll(this, this.form, \'who\');" class="check" /> <i>', $txt[737], '</i></label><br />

<hr />
</td>
</tr><tr>
<td class="windowbg2">';

if ($context['can_send_pm'])
echo '
<label for="sendPM"><input type="checkbox" name="sendPM" id="sendPM" value="1" class="check" /> ', $txt['email_as_pms'], '</label><br />';

echo '
<label for="email_force"><input type="checkbox" name="email_force" id="email_force" value="1" class="check" /> ', $txt['email_force'], '</label>
</td>
</tr><tr>
<td class="windowbg2" style="padding-bottom: 1ex;" align="center">
<input type="submit" value="', $txt[65], '" />
</td>
</tr>
</table>
<input type="hidden" name="sc" value="', $context['session_id'], '" />
</form>';


ManageNews.php

function Editaff()
{
global $txt, $modSettings, $context, $db_prefix, $sourcedir, $user_info;

require_once($sourcedir . '/Subs-Post.php');

// The 'remove selected' button was pressed.
if (!empty($_POST['delete_selection']) && !empty($_POST['remove']))
{
checkSession();

// Store the news temporarily in this array.
$temp_aff = explode("\n", $modSettings['aff']);

// Remove the items that were selected.
foreach ($temp_aff as $i => $aff)
if (in_array($i, $_POST['remove']))
unset($temp_aff[$i]);

// Update the database.
updateSettings(array('aff' => addslashes(implode("\n", $temp_aff))));

logAction('aff');
}
// The 'Save' button was pressed.
elseif (!empty($_POST['save_items']))
{
checkSession();

foreach ($_POST['aff'] as $i => $aff)
{
if (trim($aff) == '')
unset($_POST['aff'][$i]);
else
preparsecode($_POST['aff'][$i]);
}

// Send the new news to the database.
updateSettings(array('aff' => implode("\n", $_POST['aff'])));

// Log this into the moderation log.
logAction('aff');
}

// Ready the current news.
foreach (explode("\n", $modSettings['aff']) as $id => $line)
$context['admin_current_aff'][$id] = array(
'id' => $id,
'unparsed' => htmlspecialchars(un_preparsecode($line)),
'parsed' => preg_replace('~<([/]?)form[^>]*?[>]*>~i', '<em class="smalltext">&lt;$1form&gt;</em>', parse_bbc($line)),
);

$context['sub_template'] = 'edit_aff';
$context['page_title'] = edite aff;
}


index.template

echo '

<div class="headertitles" style="width: 260px;"><img src="', $settings['images_url'], '/blank.gif" height="12" alt="" /></div>
<div class="headerbodies" style="width: 260px; position: relative; background-image: url(', $settings['images_url'], '/box_bg.gif);"> <img src="', $settings['images_url'], '/', $context['user']['language'], '/aff.gif" style="position: absolute; left: -1px; top: -16px;" alt="" />
                     <div style="height: 50px; overflow: auto; padding: 5px;" class="smalltext">', $context['random_aff_line'], '</div>
</td>


sorry for my bad english, i'm dutch
Greetz, p4e

Purplemadness

And in the second box, he displays the nothing, and not the affliate
I already maked the row aff in smf_settings in my database

(i'm p4e's friend)
Dutch power!

Purplemadness

Does anyone know something?
We really need it!! :(
Dutch power!

Advertisement: