Hy,
Ich habe mir nen Mod für men phpbb Forum installiert! Der funktioniert ja auch ganz gut, bis auf eine Kleinigkeit! Im Administrationsmenü kann man vorhandene Daten nicht updaten! Hierbei gibt es eine dropdown list in der man 1 v. 2 Werten auswählen kann! Doch egal welcher Wert ausgewählt wird, nach dem drücken des update buttons wird immer nur Wert 1 (="public") in die DB geschrieben! Wert2 (=private) bleibt unbeachtet!
Im Code sieht dies folgendermaßen aus:
Ich fange bei den Editiermöglichkeiten an:
So............jetzt werden noch einige Werte in die DB geschrieben die alle stimmen....
----------------------------------------------------------------------------------------------------------------------------
Jetzt der query für die dropdown list: (type)
HTML mäßig in der .tpl datei sieht das so aus:
Hm, ich hab keine Ahnung was da falsch ist! Ich hoffe Ihr könnt mir helfen!
mfg
dust
Ich habe mir nen Mod für men phpbb Forum installiert! Der funktioniert ja auch ganz gut, bis auf eine Kleinigkeit! Im Administrationsmenü kann man vorhandene Daten nicht updaten! Hierbei gibt es eine dropdown list in der man 1 v. 2 Werten auswählen kann! Doch egal welcher Wert ausgewählt wird, nach dem drücken des update buttons wird immer nur Wert 1 (="public") in die DB geschrieben! Wert2 (=private) bleibt unbeachtet!
Im Code sieht dies folgendermaßen aus:
Ich fange bei den Editiermöglichkeiten an:
PHP:
}
elseif ($action == 'editjob')
{
if ( isset($HTTP_GET_VARS['job']) || isset($HTTP_POST_VARS['job']) ) { $job = ( isset($HTTP_POST_VARS['job']) ) ? intval($HTTP_POST_VARS['job']) : intval($HTTP_GET_VARS['job']); }
$template->set_filenames(array(
'body' => 'admin/jobs_edit_body.tpl')
);
$sql = "SELECT *
FROM " . JOBS_TABLE . "
WHERE id='$job'";
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, sprintf($lang['jobs_error_selecting'], 'jobs'), '', __LINE__, __FILE__, $sql);
}
if (!( $row = $db->sql_fetchrow($result) ))
{
message_die(GENERAL_ERROR, sprintf($lang['jobs_error_selecting'], 'jobs'), '', __LINE__, __FILE__, $sql);
}
$public_selected = ( $row['type'] == 'public' ) ? 'SELECTED' : '';
$private_selected = ( $row['type'] != 'public' ) ? 'SELECTED' : '';
$template->assign_vars(array(
'S_CONFIG_ACTION' => append_sid('admin_jobs.' . $phpEx),
'L_JOB_NAME' => $lang['jobs_job_name'],
'L_MAX_POSITIONS' => $lang['jobs_job_positions'],
'L_PAY_AMOUNT' => $lang['jobs_job_pay'],
'L_PAY_TIME' => $lang['jobs_job_time'],
'L_REQUIREMENTS' => $lang['jobs_job_requirements'],
'L_TYPE' => $lang['jobs_job_type'],
'L_SECONDS' => $lang['jobs_seconds'],
'L_PRIVATE' => $lang['jobs_private'],
'L_PUBLIC' => $lang['jobs_public'],
'L_UPDATE_JOB' => $lang['jobs_button_update_job'],
'L_DELETE_JOB' => $lang['jobs_button_delete_job'],
'L_IMP' => 'Jobs Modification (1.1.0): Copyright © 2004, <a href="http://www.knightsofchaos.com/zarath/mods/" class="navsmall">Zarath Technologies</a>.',
'JOB_NAME' => $row['name'],
'JOB_ID' => $row['id'],
'JOB_POSITIONS' => $row['positions'],
'JOB_PAY' => $row['pay'],
'JOB_PAYTIME' => $row['payouttime'],
'JOB_REQUIREMENTS' => $row['requires'],
'JOB_PUBLIC_SELECTED' => $public_selected,
'JOB_PRIVATE_SELECTED' => $private_selected,
'POINTS_NAME' => $board_config['points_name'],
'TABLE_TITLE' => $lang['jobs_edit_job'],
'TITLE' => $lang['jobs_editor'],
'EXPLAIN' => $lang['jobs_explain_jobs'])
);
}
elseif ($action == 'updatejob')
{
if ( isset($HTTP_GET_VARS['jobid']) || isset($HTTP_POST_VARS['jobid']) ) { $jobid = ( isset($HTTP_POST_VARS['jobid']) ) ? intval($HTTP_POST_VARS['jobid']) : intval($HTTP_GET_VARS['jobid']); }
if( isset($HTTP_GET_VARS['paytime']) || isset($HTTP_POST_VARS['paytime']) ) { $paytime = ( isset($HTTP_POST_VARS['paytime']) ) ? intval($HTTP_POST_VARS['paytime']) : intval($HTTP_GET_VARS['paytime']); }
if( isset($HTTP_GET_VARS['positions']) || isset($HTTP_POST_VARS['positions']) ) { $positions = ( isset($HTTP_POST_VARS['positions']) ) ? intval($HTTP_POST_VARS['positions']) : intval($HTTP_GET_VARS['positions']); }
if( isset($HTTP_GET_VARS['pay']) || isset($HTTP_POST_VARS['pay']) ) { $pay = ( isset($HTTP_POST_VARS['pay']) ) ? intval($HTTP_POST_VARS['pay']) : intval($HTTP_GET_VARS['pay']); }
if( isset($HTTP_GET_VARS['requirements']) || isset($HTTP_POST_VARS['requirements']) ) { $requirements = ( isset($HTTP_POST_VARS['requirements']) ) ? $HTTP_POST_VARS['requirements'] : $HTTP_GET_VARS['requirements']; }
if( isset($HTTP_GET_VARS['name']) || isset($HTTP_POST_VARS['name']) ) { $name = ( isset($HTTP_POST_VARS['name']) ) ? $HTTP_POST_VARS['name'] : $HTTP_GET_VARS['name']; }
if( isset($HTTP_GET_VARS['delete']) || isset($HTTP_POST_VARS['delete']) ) { $delete = ( isset($HTTP_POST_VARS['delete']) ) ? $HTTP_POST_VARS['delete'] : $HTTP_GET_VARS['delete']; }
if ( (!is_numeric($paytime)) || ($paytime < 0) ) { $paytime = 500000; }
if ( (!is_numeric($positions)) || ($positions < 0) ) { $positions = 0; }
if ( (!is_numeric($pay)) || ($pay < 0) ) { $pay = 5; }
if (strlen($requirements) < 3) { $requirements = "none"; }
if (strlen($name) > 30) { message_die(GENERAL_MESSAGE, $lang['jobs_invalid_name'] . "<br /><br />" . sprintf($lang['jobs_main_link'], "<a href=\"" . append_sid("admin_jobs.$phpEx") . "\">", "</a>") . "<br /><br />" . sprintf($lang['Click_return_admin_index'], "<a href=\"" . append_sid("index.$phpEx?pane=right") . "\">", "</a>")); }
$jobtype = ( $jobtype != "private" ) ? 'public' : 'private';
So............jetzt werden noch einige Werte in die DB geschrieben die alle stimmen....
----------------------------------------------------------------------------------------------------------------------------
Jetzt der query für die dropdown list: (type)
PHP:
$sql = "UPDATE " . JOBS_TABLE . "
SET name='$name', positions='$positions', pay='$pay', payouttime='$paytime', requires='$requirements', type='$jobtype'
WHERE id='$jobid'";
if ( !($db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, sprintf($lang['jobs_error_updating'], 'jobs'), '', __LINE__, __FILE__, $sql);
}
message_die(GENERAL_MESSAGE, $lang['job_updated'] . "<br /><br />" . sprintf($lang['jobs_main_link'], "<a href=\"" . append_sid("admin_jobs.$phpEx") . "\">", "</a>") . "<br /><br />" . sprintf($lang['Click_return_admin_index'], "<a href=\"" . append_sid("index.$phpEx?pane=right") . "\">", "</a>"));
}
}
HTML mäßig in der .tpl datei sieht das so aus:
Code:
<tr>
<td class="row2"><span class="gensmall">{L_TYPE}</span></td>
<td class="row2">
<select name="type">
<option value="public" {JOB_PUBLIC_SELECTED}>{L_PUBLIC}</option>
<option value="private" {JOB_PRIVATE_SELECTED}>{L_PRIVATE}</option>
</select>
</td>
</tr>
Hm, ich hab keine Ahnung was da falsch ist! Ich hoffe Ihr könnt mir helfen!
mfg
dust