|
Support Incident Tracker GIT4.x
|
Go to the source code of this file.
Functions | |
| get_globalsignature ($sig_id) | |
| delete_signature ($sig_id) | |
Variables | |
| $permission = PERM_GLOBALSIG_EDIT | |
| $title = $strGlobalSignature | |
| $action = clean_fixed_list($_REQUEST['action'], array('new','delete','edit')) | |
| $sig_id = clean_int($_REQUEST['sig_id']) | |
| $signature = clean_dbstring($_REQUEST['signature']) | |
| $formaction = clean_fixed_list($_REQUEST['formaction'], array('new','edit')) | |
| delete_signature | ( | $ | sig_id | ) |
Definition at line 31 of file edit_global_signature.php.
References $dbEmailSig, $sql, E_USER_ERROR, exit, html_redirect(), and journal().
{
global $dbEmailSig;
$sql = "DELETE FROM `{$dbEmailSig}` WHERE id = {$sig_id}";
mysql_query($sql);
if (mysql_error()) trigger_error("MySQL Query Error ".mysql_error(), E_USER_ERROR);
journal(CFG_LOGGING_NORMAL, 'Global Signature deleted', "A global signature was deleted", CFG_JOURNAL_ADMIN, 0);
html_redirect("edit_global_signature.php");
exit;
}
require ('core.php');
$permission = PERM_GLOBALSIG_EDIT; // Edit global signature
require (APPLICATION_LIBPATH . 'functions.inc.php');
// This page requires authentication
require (APPLICATION_LIBPATH . 'auth.inc.php');
$title = $strGlobalSignature;
// External variables
$action = clean_fixed_list($_REQUEST['action'], array('new','delete','edit'));
$sig_id = clean_int($_REQUEST['sig_id']);
$signature = clean_dbstring($_REQUEST['signature']);
$formaction = clean_fixed_list($_REQUEST['formaction'], array('new','edit'));
if (!empty($signature))
{
//we've been passed a signature - ie we must either be deleting or editing on actual signature
switch ($formaction)
{
case 'new':
//then we're adding a new signature
$sql = "INSERT INTO `{$dbEmailSig}` (signature) VALUES ('$signature') ";
mysql_query($sql);
if (mysql_error()) trigger_error("MySQL Query Error ".mysql_error(), E_USER_ERROR);
journal(CFG_LOGGING_NORMAL, 'Global Signature added', "A new global signature was added", CFG_JOURNAL_ADMIN, 0);
html_redirect("edit_global_signature.php");
break;
case 'edit':
$sql = "UPDATE `{$dbEmailSig}` SET signature = '$signature' WHERE id = {$sig_id}";
mysql_query($sql);
if (mysql_error()) trigger_error("MySQL Query Error ".mysql_error(), E_USER_ERROR);
journal(CFG_LOGGING_NORMAL, 'Global Signature updated', "A global signature was updated", CFG_JOURNAL_ADMIN, 0);
html_redirect("edit_global_signature.php");
break;
}
}
elseif (empty($action))
{
//The just view the global signatures
include (APPLICATION_INCPATH . 'htmlheader.inc.php');
echo "<h2>".icon('edit', 32)." {$title}</h2>";
$sql = "SELECT id, signature FROM `{$dbEmailSig}` ORDER BY id ASC";
$result = mysql_query($sql);
if (mysql_error()) trigger_error(mysql_error(), E_USER_WARNING);
echo "<p align='center'>{$strOneOfTheSignaturesWillBeInserted}<br /><br />";
echo "{$strGlobalSignatureRemember}</p>";
echo "<p align='center'><a href='edit_global_signature.php?action=new'>{$strNew}</a></p>";
echo "<table align='center' width='60%'>";
echo "<tr><th>{$strGlobalSignature}</th><th>{$strActions}</th></tr>";
while ($signature = mysql_fetch_object($result))
{
$id = $signature->id;
echo "<tr>";
echo "<td class='shade1' width='70%'>".ereg_replace("\n", "<br />", $signature->signature)."</td>";
echo "<td class='shade2' align='center'><a href='edit_global_signature.php?action=edit&sig_id={$id}'>{$strEdit}</a> | ";
echo "<a href='edit_global_signature.php?action=delete&sig_id={$id}'>{$strDelete}</a></td>";
echo "</tr>";
}
echo "</table>";
include (APPLICATION_INCPATH . 'htmlfooter.inc.php');
}
elseif (!empty($action))
{
include (APPLICATION_INCPATH . 'htmlheader.inc.php');
switch ($action)
{
case 'new':
echo "<h2>".icon('edit', 32)." {$strGlobalSignature}: {$strNew}</h2>";
echo "<form action='{$_SERVER['PHP_SELF']}' method='post'>";
echo "<input type='hidden' name='formaction' value='new' />";
echo "<table class='vertical' width='50%'>";
echo "<tr>";
echo "<td align='right' valign='top' class='shade1'><strong>{$strGlobalSignature}</strong>:<br />\n";
echo "{$strGlobalSignatureDescription}<br /><br />";
echo $strGlobalSignatureRemember;
echo "</td>";
echo "<td class='shade1'><textarea name='signature' rows='15' cols='65'></textarea></td>";
echo "</tr>";
echo "</table>";
echo "<p class='formbuttoms'><input name='reset' type='reset' value='{$strReset}' /> <input name='submit' type='submit' value=\"{$strSave}\" /></p>";
echo "<p class='return'><a href=\"{$_SERVER['PHP_SELF']}\">{$strReturnWithoutSaving}</a></p>";
echo "</form>\n";
break;
case 'delete':
delete_signature($sig_id);
break;
case 'edit':
echo "<h2>".icon('edit', 32)." {$strGlobalSignature}: {$strEdit}</h2>";
echo "<form action='{$_SERVER['PHP_SELF']}' method='post'>";
echo "<input type='hidden' name='formaction' value='edit' />";
echo "<input type='hidden' name='sig_id' value='{$sig_id}' />";
echo "<table class='vertical' width='50%'>";
echo "<tr>";
echo "<td align='right' valign='top' class='shade1'><strong>{$strGlobalSignature}</strong>:<br />\n";
echo "{$strGlobalSignatureDescription}<br /><br />";
echo $strGlobalSignatureRemember;
echo "</td>";
echo "<td class='shade1'><textarea name='signature' rows='15' cols='65'>".get_globalsignature($sig_id)."</textarea></td>";
echo "</tr>";
echo "</table>";
echo "<p class='formbuttoms'><input name='reset' type='reset' value='{$strReset}' /> <input name='submit' type='submit' value=\"{$strSave}\" /></p>";
echo "<p class='return'><a href=\"{$_SERVER['PHP_SELF']}\">{$strReturnWithoutSaving}</a></p>";
echo "</form>\n";
break;
}
include (APPLICATION_INCPATH . 'htmlfooter.inc.php');
}
| get_globalsignature | ( | $ | sig_id | ) |
Definition at line 20 of file edit_global_signature.php.
References $dbEmailSig, $result, $signature, $sql, and E_USER_WARNING.
{
global $dbEmailSig;
$sql = "SELECT signature FROM `{$dbEmailSig}` WHERE id = {$sig_id}";
$result = mysql_query($sql);
if (mysql_error()) trigger_error("MySQL Query Error ".mysql_error(), E_USER_WARNING);
list($signature) = mysql_fetch_row($result);
mysql_free_result($result);
return $signature;
}
Definition at line 52 of file edit_global_signature.php.
| $formaction = clean_fixed_list($_REQUEST['formaction'], array('new','edit')) |
Definition at line 55 of file edit_global_signature.php.
| $permission = PERM_GLOBALSIG_EDIT |
Definition at line 44 of file edit_global_signature.php.
| $sig_id = clean_int($_REQUEST['sig_id']) |
Definition at line 53 of file edit_global_signature.php.
| $signature = clean_dbstring($_REQUEST['signature']) |
Definition at line 54 of file edit_global_signature.php.
Referenced by get_globalsignature(), and global_signature().
| $title = $strGlobalSignature |
Definition at line 49 of file edit_global_signature.php.