<?php
/**************************************************************************
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
@Authors: Ryan Thompson(hide@address.com)
***************************************************************************/
include("./data.php");
$service['add_header'] = TRUE;
include("../config.inc.php");
include($here. "/class.admin.php");
$admin = new admin;
echo $layout->page_header;
echo $layout->service_header($text['service_name'] . ' - '. $text['edit_messages'],$admin->nav_buttons());
if(isset($_POST['update_text']) && !empty($_POST['text_message']))
{
$str = str_replace('\n', "\n", $_POST['text_message']);
$sql = "UPDATE o_text SET messages='$str' WHERE service='{$_POST['service']}' AND
id_text='{$_POST['message_id']}' AND language='{$_GET['lang']}'";
$db->query($sql);
}
$sql = "SELECT * FROM o_services LEFT JOIN o_text ON o_text.service=o_services.code WHERE o_text.id_text='service_name'";
$db->query($sql);
?>
<form action="<?php echo $_SERVER['PHP_SELF']?>?lang=<?php echo $_GET['lang']?>" method="post">
<table>
<tr>
<td class="input_header"><?php echo $text['select_service']?></td>
<td>
<select name="service">
<option value='gl'>Global</option>
<?php
while($db->fetch_results())
{
include("{$O->dir}/{$db->record['location']}/data.php");
echo "<option value=\"{$db->record['code']}\"";
if($_POST['service'] == $db->record['code'])
{
echo " selected=\"selected\"";
}
echo ">{$db->record['messages']}</option>\n";
}
?>
</select>
</td>
</tr>
<tr>
<td class="input_header"><?php echo $text['select_id']?></td>
<td>
<select name="message_id" onchange="print_message(this.form)">
<?php
$sql = "SELECT id_text FROM o_text WHERE service='{$_POST['service']}'";
$db->query($sql);
while($db->fetch_results())
{
echo "<option value=\"{$db->record['id_text']}\"";
if($_POST['message_id'] == $db->record['id_text'])
{
echo " selected=\"selected\"";
}
echo ">{$db->record['id_text']}</option>\n";
}
if(!empty($_POST['message_id']))
{
$sql = "SELECT * FROM o_text WHERE service='{$_POST['service']}' AND id_text='{$_POST['message_id']}'
AND language='{$_GET['lang']}'";
$db->query($sql);
$db->fetch_results();
$message = $db->record['messages'];
}
?>
</select>
<input type="submit" name="select_service" value="<?php echo $text['edit']?>" class="button1">
</td>
</tr>
<tr>
<td class="input_header"><?php echo $text['message']?></td>
<td>
<textarea name="text_message" cols="75" rows="10"><?php echo $message?></textarea></td>
</tr>
<tr>
<td></td>
<td><input type="submit" name="update_text" value="<?php echo $text['update_message']?>" class="button1">
</table>
</form>
<br />
<?php
echo $layout->create_footer();
?>