NOTE: Nov 26 2012
All further support and development for this addon have been moved over to Sumale.nin. Which will provide support and furture development. Thank you for all your support guys and wish you all the best of luck.Description:This script is designed to give your users the ability to make trouble tickets when problems occur on your gallery. All data is kept in MYSQL tables and can be viewed later for future reference in case the problem arises again. Below is a list of features and tested version(s) of the 4image gallery.
Features:--Individual User Access(Only the user that makes the ticket can view it, except in control panel)
--Customizable Category Fields
--Logs User's IP(s) of all replies and tickets
--Able to Close,Open Tickets
--Lock Tickets from being reopen
--When ticket is close, it may be allowed to reopen in case if problem is not completed.
--Remove specific users from using ticket system
--Supports Captcha to reduce spamming
--Able to hide closed tickets by default in the ticket console.
--Separate Ticket Console to View/Edit tickets.
--Status Marker Posts to show any changes to the physical ticket.
--Enable and Disable Ticket System via Admin Settings.
--Ability to upload images(JPG only) for screenshot purposes
--Ability to search for tickets by(Priority, Status, Category, Ticket ID, User ID, Subject, Date Created)
--Paging on Ticket List
--View Ticket Link will blink when tickets have been updated, but not read yet.
Tested on:1.7.6 - 1.7.7
Updated on: 9/5/089/2 - Simplified Step 7a(Thanks to:Phisker B)
9/3 - Added German Translation(Thanks to:Phisker B)
9/3 - Supports Backup of the table files
9/5 - Blinking indication of an updated ticket.
Add On:Spellchecker Mod by Phisker BModded Files:include/constants.php
include/page_header.php
include/functions.php
admin/settings.php
admin/index.php
admin/users.php
admin/backup.php
lang/english/admin.php
lang/english/main.php
/template/YOUR TEMPLATE/style.css
/template/YOUR TEMPLATE/user_logininfo.html
New Files:/template/YOUR TEMPLATE/Support.html
/template/YOUR TEMPLATE/ticket_bit.html
/template/YOUR TEMPLATE/support_new_ticket.html
/template/YOUR TEMPLATE/support_menu.html
/template/YOUR TEMPLATE/support_read_ticket.html
/template/YOUR TEMPLATE/reply_bit.html
support.php
support_install.php
admin/support.php
Mods You Will Need:[MOD] Drop down options for custom database fields
WARNING: PLEASE BACKUP DATABASE AND WEBSITE DATA.Step 1. Download the file support_files at the bottom of this post and place the files in the order below.
./template/YOUR TEMPLATE/Support.html
./template/YOUR TEMPLATE/ticket_bit.html
./template/YOUR TEMPLATE/support_new_ticket.html
./template/YOUR TEMPLATE/support_menu.html
./template/YOUR TEMPLATE/support_read_ticket.html
./template/YOUR TEMPLATE/reply_bit.html
./support.php
./support_install.php
./admin/support.php
Step 2. Open
includes/constants.phpFind:
define('LIGHTBOXES_TABLE', $table_prefix.'lightboxes');
Paste After:
define('SUPPORT_TABLE', $table_prefix.'support');
Step 3a. Open
includes/page_header.phpFind:
"url_lightbox" => $site_sess->url(ROOT_PATH."lightbox.php"),
Paste After:
"url_support_ticket" => (!empty($url_support_check_ticket)) ? $site_sess->url($url_support_check_ticket) : "<a href=\"".$site_sess->url(ROOT_PATH."support.php")."\">".$lang['support_view']."</a>",
"url_support_ticket_new" => (!empty($url_support_ticket)) ? $site_sess->url($url_support_ticket) : $site_sess->url(ROOT_PATH."support.php?action=newticket"),
"support_ticket_activ" => $config['trouble_ticket_activate'],
Step 3b.Find:
"lang_advanced_search" => $lang['advanced_search'],
"lang_lightbox" => $lang['lightbox'],
Paste After:
"lang_support_new" => $lang['support_new'],
Step 3c.Find:
$total_categories = $data['total_categories'];
$auth_cat_sql['auth_viewcat']['IN'] = $data['auth_viewcat']['IN'];
$auth_cat_sql['auth_viewcat']['NOTIN'] = $data['auth_viewcat']['NOTIN'];
}
Paste After:
$url_support_check_ticket = "";
if(new_ticket_check($user_info['user_id'],$user_info['user_name'])){
$url_support_check_ticket .= "<script language=\"JavaScript\">\n<!--\n var flg2=0;\n function new_tick_blink(){\n var myElement=document.getElementById('blnk2');\n flg2^=1;\n if(flg2==1){\n myElement.style.visibility='hidden';\n }\n else{\n myElement.style.visibility='visible';\n }\n timerID = setTimeout( 'new_tick_blink()' , 500 );\n }\n //-->\n</script>\n";
$url_support_check_ticket .= "<span id=\"blnk2\"><a href=\"".$site_sess->url(ROOT_PATH."support.php")."\">".$lang['support_view']."</a></span></a><script language=\"JavaScript\">new_tick_blink();</script>";
}
Step 4. Open
includes/functions.phpBefore
?> at the end of the file. Paste:
function post_ticket($id="",$status="",$subject="none",$message="none",$priority="low",$catagory="none",$attachment="") {
global $user_info, $site_db, $session_info, $config;
$user_info_id = "";
$current_time = "";
$user_name = $user_info['user_name'];
$user_info_id = $user_info['user_id'];
if($id==$user_info['user_name']){$current_time = time();}
if($config['trouble_ticket_ip_log'] && $user_info['user_level'] != ADMIN){$ip_info=$session_info['session_ip'];}
else{$ip_info="";}
$sql = "INSERT INTO ".SUPPORT_TABLE." (`id` ,`status` ,`create_date` ,`last_update` ,`user_id` ,`catagory` ,`message` ,`priority` ,`ip`,`attachment`,`last_reply`,`subject`,`reply_id`)
VALUES('','$status','$current_time','".time()."','$user_info_id','$catagory','$message','$priority','$ip_info','$attachment','$user_name','$subject','$id')";
if ($site_db->query($sql)) {
if ($id=="") {return true;}
else{
$sql = "UPDATE ".SUPPORT_TABLE."
SET last_update = ".time()." , last_reply = '".$user_info['user_name']."', is_read = '0'
WHERE id = $id";
if ($site_db->query($sql)){return true;}
else{return false;}
}
}
else{return false;}
}
function get_total_user_tickets($user) {
global $site_db;
$sql = "SELECT *
FROM ".SUPPORT_TABLE."
WHERE user_id = $user AND reply_id = 0";
$result = $site_db->query($sql);
return $site_db->get_numrows($result);
}
function check_closed_ticket($id) {
global $site_db;
$sql = "SELECT status
FROM ".SUPPORT_TABLE."
WHERE id = $id";
$status_row = $site_db->query_firstrow($sql);
return ($status_row['status'] == "Closed") ? 1 : 0;
}
function reopen_ticket($id) {
global $site_db,$user_info;
$sql = "UPDATE ".SUPPORT_TABLE."
SET status = 'Reopen'
WHERE id = $id";
$ticket_msg = "***Reopend Request Placed By: ".$user_info['user_name']."***";
if ($site_db->query($sql)){
if (post_ticket($id,"","**REOPENED**",$ticket_msg,"","","")){
return true;
}
else{return false;}
}
else{return false;}
}
function new_ticket_check($user_id,$user_name){
global $site_db;
$sql = "SELECT *
FROM ".SUPPORT_TABLE."
WHERE user_id = '$user_id' AND is_read = '0' AND last_reply != '$user_name'";
$result = $site_db->query($sql);
$num_tick = $site_db->get_numrows($result);
if($num_tick != 0){
return true;
}
else{
return false;
}
}
Step 5. Open
admin/settings.phpThe
XX need to be replaced with 8, BUT if you have installed other mods that have been placed in here look for the last "show_table_separator($setting_group" and there will be a number in the [] brackets. Take that number and add one to it and place it in place of the
XX. Make sure you keep the number, you will need it later.
Find:
show_form_footer($lang['save_changes'], "", 2);
Before it Paste:
show_table_separator($setting_group[XX], 2, "setting_group_XX");
show_setting_row("trouble_ticket_activate", "radio");
show_setting_row("trouble_ticket_ip_log", "radio");
show_setting_row("trouble_ticket_attachment", "radio");
show_setting_row("trouble_ticket_captcha", "radio");
show_setting_row("hide_closed_tickets", "radio");
show_setting_row("trouble_ticket_img_size");
show_setting_row("trouble_ticket_catagories");
show_setting_row("trouble_ticket_priority");
Step 6. Open
admin/index.phpFind:
show_nav_option($lang['nav_general_settings'], "settings.php?action=modifysettings");
Paste After:
show_nav_option($lang['nav_general_tickets'], "support.php");
Step 7a. Open
admin/users.phpFind:
$user_invisible = intval($HTTP_POST_VARS['user_invisible']);
Paste After:
$user_support = intval($HTTP_POST_VARS['user_support']);
Step 7b. (Updated 9/3/08 Step Simplified)
Find:
"user_icq")." = '$user_icq'
Paste After:
, user_support = '$user_support'
Step 7c.Find:
show_radio_row($lang['field_invisible'], "user_invisible", $user_row['user_invisible']);
Paste After:
show_radio_row($lang['nav_general_tickets'], "user_support", $user_row['user_support']);
Step 8. English: Open
lang/LANGUAGE/main.phpBefore the ?> at the end of the file paste:
//-----------------------------------------------------
//--- Sopport Ticket ----------------------------------
//-----------------------------------------------------
$lang['support_register_no_priv'] = "You must register or log in to view your support ticket(s)";
$lang['stream_support'] = "Support Ticket System";
$lang['support_view'] = "View Support Ticket(s)";
$lang['support_new'] = "Start New Ticket";
$lang['new_support_ticket'] = "New Ticket";
$lang['catagory'] = "Catagory";
$lang['priority'] = "Priority";
$lang['ticket_status'] = "Current ticket status:";
$lang['attachments'] = "Attachemnts";
$lang['support_register_no_activ'] = "Trouble Ticket System is Disabled";
$lang['ticket_subject_required'] = "Subject is required before submiting";
$lang['ticket_message_required'] = "Message is required before submiting";
$lang['ticket_error_upload'] = "Error: A problem occurred during file upload!";
$lang['ticket_error_rename'] = "Error: Please rename your file.";
$lang['ticket_error_size'] = "Error: Only .jpg images under {max_size} are accepted for upload";
$lang['ticket_error_unknown'] = "Error: Please Contact Admin or Try back later";
$lang['ticket_new_passed'] = "<center>Your ticket has been successfully added. We process tickets as they come in. Please be patient. To view your tickets <a href=\"{url_support_ticket}\">Click Here</a> or visit the `View Support Ticket(s)` in your control panel.</center>";
$lang['ticket_last_reply'] = "Last Replier";
$lang['ticket_last_update'] = "Last Update Date";
$lang['ticket_create_date'] = "Ticket Create Date";
$lang['ticket_last_reply'] = "Replied By:";
$lang['click_for_img'] = "Click for attached Image";
$lang['ticket_reopen_passed'] = "Your ticket has been reopened. An Administrator will view it as soon as possible.";
$lang['ticket_error_reopen'] = "There was an error when reopening your ticket. Try again later";
$lang['close_ticket_disclose'] = "<p style=\"font-weight:bold\" align=\"center\">Your ticket is currently closed out. This states that the problem has been corrected and this ticket no longer needs to be noticed. The admin will no longer view this ticket and all methods of replying have been disabled.</br></br>If you feel the problem has not been corrected or the problem continues. Click the button bellow to reopen the ticket and reply with the description of the problem. An Administrator will view it as soon as possible.</p></br>";
$lang['perm_locked'] = "<p style=\"font-weight:bold\" align=\"center\">Your ticket has been closed and locked from any type of reopening. The information will continue to be stored here for future reference if the problem would occur in the future. DO NOT submit another ticket in reference to this problem. Thank you for notifing us of this problem.</p></br>";
$lang['support_register_ban'] = "You have been locked out of the Support Ticket System, this may have occured due to harassment or spamming of the system. You will be locked out until further notice from the admin. Please contact admin for questions on the reason for the ban.";
German: Open
lang/LANGUAGE/main.phpBefore the ?> at the end of the file paste:
$lang['support_register_no_priv'] = "Du musst eingeloggt sein um deine Support Tickets zu sehen!";
$lang['stream_support'] = "Support Ticket System";
$lang['support_view'] = "Support Tickes ansehen";
$lang['support_new'] = "Neues Ticket starten";
$lang['new_support_ticket'] = "Neues Ticket";
$lang['catagory'] = "Kategorie";
$lang['priority'] = "Priorität";
$lang['ticket_status'] = "Aktueller Ticketstatus:";
$lang['attachments'] = "Attachemnts";
$lang['support_register_no_activ'] = "Support Ticket System ist deaktiviert!";
$lang['ticket_subject_required'] = "Es muss ein Betreff gewält werden!";
$lang['ticket_message_required'] = "Es muss eine Nachricht angegeben werden!";
$lang['ticket_error_upload'] = "Ooops!: Ein Problem beim Upload ist aufgetreten!";
$lang['ticket_error_rename'] = "Ooops!: Benenne deine Datei um.";
$lang['ticket_error_size'] = "Ooops!: Nur *.jpg Dateien unter {max_size} sind erlaubt!";
$lang['ticket_error_unknown'] = "Ooops!: Kontaktiere den Webmaster oder versuche es später nocheinmal!";
$lang['ticket_new_passed'] = "<center>Dein Ticket wurde erfolgreich aufgenommen. Wir bearbeiten die Tickets schnellst möglich. Bitte habe etwas Geduld. Um deine Tickets anzusehen, <a href=\"{url_support_ticket}\">Klicke hier</a> oder klicke im Controlpanel auf `Support Tickets ansehen`!</center>";
$lang['ticket_last_reply'] = "Letzte Antwort";
$lang['ticket_last_update'] = "Letzter Update Tag";
$lang['ticket_create_date'] = "Tag der erstellung";
$lang['ticket_last_reply'] = "Geantwortet von:";
$lang['click_for_img'] = "Klicke für beigefügte Datei";
$lang['ticket_reopen_passed'] = "Dein Ticket ist wieder eröffnet worden. Ein Administrator betrachtet es sobald wie möglich.";
$lang['ticket_error_reopen'] = "Ooops! Es gab ein Fehler beim öffnen deines Tickets. Bitte komme später wieder!";
$lang['close_ticket_disclose'] = "<p style=\"font-weight:bold\" align=\"center\">Dein Ticket wurde nun geschlossen. Dies gibt an, dass das Problem korrigiert worden ist, und dieses Ticket nicht mehr beachtet werden muss. Wenn du der Meinung bist, dass dein Problem nicht gelöst worden ist, dann klicke auf auf wieder öffnen des Tickets mit Angabe warum und ein Admin wird sich um das Problem bemühen!</p></br>";
$lang['perm_locked'] = "<p style=\"font-weight:bold\" align=\"center\">Dein Ticket wurde gscchlossen und kann nicht mehr geöffnet werden! Das Ticket wird aber für eine Gewisse Zeit gespeichert, falls ein Problem gleichermassen auftreten sollte, damit man dieses Ticket noch einmal abfangen kann! Bitte eröffne kein weiteres Ticket för das gleiche Problem. Wir danken für dein Verständniss!</p></br>";
$lang['support_register_ban'] = "Du wurdest vom Ticketsystem ausgeschlossen! Dies kann mehrere Gründe haben und liegt allein im Interesse der Administration!";
Step 9.English: Open
lang/LANGUAGE/admin.phpThe number in the step 5, I aksed you to remember, replace the
XX with that number.
Before the ?> at the end of the file paste:
/*-- Setting-Group XX --*/
$setting_group[XX]="Trouble Ticket System";
$setting['trouble_ticket_activate'] = "Enable Trouble Ticket System";
$setting['trouble_ticket_catagories'] = "Trouble Ticket Catagories List<br /><span class=\"smalltext\">Seperate catagories with a , between them</span>";
$setting['trouble_ticket_priority'] = "Trouble Ticket Priority List<br /><span class=\"smalltext\">Seperate catagories with a , between them and they will be sorted based on the order they are in</span>";
$setting['trouble_ticket_ip_log'] = "Log IP Address on all submited tickets";
$setting['trouble_ticket_attachment'] = "Allow users to upload attachments<br /><span class=\"smalltext\">JPEG attachments only, Just for screenshot purposes</span>";
$setting['trouble_ticket_captcha'] = "Uses Captcha when submiting a new ticket<br /><span class=\"smalltext\">Enabling helps reduce spam tickets showing up in the list</span>";
$setting['trouble_ticket_img_size'] = "MAX File size that can be uploaded in KB's";
$setting['hide_closed_tickets'] = "Hide closed tickets by default<br /><span class=\"smalltext\">This feature will auto hide all closed tickets. If you use search to view closed tickets it will show closed tickets the results.</span>";
$lang['nav_general_tickets'] = "Trouble Ticket System";
$lang['ticket_id'] = "Ticket ID";
$lang['ticket_subject'] = "Subject";
$lang['date_created'] = "Date Created";
$lang['date_updated'] = "Last Updated";
$lang['ticket_user_id'] = "User ID";
$lang['ticket_status'] = "Status";
$lang['ticket_cat'] = "Catagory";
$lang['ticket_prio'] = "Priority";
$lang['ticket_ip'] = "User IP";
$lang['ticket_replies'] = "Ticket Replies";
$lang['ticket_reply_to'] = "Rpley To Ticket";
$lang['ticket_search_header'] = "Search Ticket System";
$lang['status_any'] = "Any";
$lang['status_open'] = "Open";
$lang['field_closed'] = "Closed";
$lang['no_log_ip'] = "No Loged IP";
$lang['status_reopen'] = "Reopen";
$lang['update_ticket'] = "Update Ticket";
$lang['ticket_attachment'] = "Attachment";
$lang['perm_lock'] = "Permanently Locked";
German: Open
lang/LANGUAGE/admin.phpThe number in the step 5, I aksed you to remember, replace the
XX with that number.
Before the ?> at the end of the file paste:
/*-- Setting-Group xx --*/
$setting_group[xx]="Support Ticket System";
$setting['trouble_ticket_activate'] = "Schalte das Ticket System ein";
$setting['trouble_ticket_catagories'] = "Ticket Kategorien<br /><span class=\"smalltext\">Mit einem , (KOMMA) werden die Kategorien getrennt</span>";
$setting['trouble_ticket_priority'] = "Ticket Präoritäts Liste<br /><span class=\"smalltext\">Mit einem , (KOMMA) werden die Präoritäten getrennt und sie werden auf Grundlage von der ausgewählten Kategorie sortiert</span>";
$setting['trouble_ticket_ip_log'] = "Logge bei jedem Ticke die IP mit";
$setting['trouble_ticket_attachment'] = "Erlaube den Usern ein Datei mitzusenden<br /><span class=\"smalltext\">Nur JPG Dateien sind erlaubt, da nur Screenshots akzeptiert werden</span>";
$setting['trouble_ticket_captcha'] = "Benutze den Captchacode für die Tickets<br /><span class=\"smalltext\">Dies beugt Spam vor und sollte eingeschaltet sein</span>";
$setting['trouble_ticket_img_size'] = "MAXIMALE Dateigrösse die erlaubt ist. Angabe in KB";
$setting['hide_closed_tickets'] = "Blende geschlossene Tickets aus<br /><span class=\"smalltext\">Diese Option blendet geschlossen Tickest aus. Können aber dennoch eingesehen werden!</span>";
$lang['nav_general_tickets'] = "Support Ticket System";
$lang['ticket_id'] = "Ticket ID";
$lang['ticket_subject'] = "Betreff";
$lang['date_created'] = "Erstellungsdatum";
$lang['date_updated'] = "Letztes Update";
$lang['ticket_user_id'] = "User ID";
$lang['ticket_status'] = "Status";
$lang['ticket_cat'] = "Kategorie";
$lang['ticket_prio'] = "Präriotät";
$lang['ticket_ip'] = "User IP";
$lang['ticket_replies'] = "Ticket Antworten";
$lang['ticket_reply_to'] = "Rpley To Ticket";
$lang['ticket_search_header'] = "Durchsuche das Ticket System";
$lang['status_any'] = "Irgendwelche";
$lang['status_open'] = "Offen";
$lang['field_closed'] = "Geschlossen";
$lang['no_log_ip'] = "Keine IP geloggt";
$lang['status_reopen'] = "Neu-Öffnen";
$lang['update_ticket'] = "Update Ticket";
$lang['ticket_attachment'] = "Upload";
$lang['perm_lock'] = "Permanent schliessen";
Step 10. Open
/template/YOUR TEMPLATE/style.cssPaste this at the end of the file:
.open {
font-family: Tahoma,Verdana,Arial,Helvetica,sans-serif;
font-size: 11px;
color: #32cd32;
}
.close {
font-family: Tahoma,Verdana,Arial,Helvetica,sans-serif;
font-size: 12px;
font-weight:bold;
color: #ff0000;
}
.wait_reply {
font-family: Tahoma,Verdana,Arial,Helvetica,sans-serif;
font-size: 12px;
font-weight:bold;
}
Step 11. Open
/template/YOUR TEMPLATE/user_logininfo.htmlFind:
» <a href="{url_control_panel}">{lang_control_panel}</a><br />
» <a href="{url_logout}">{lang_logout}</a><br />
Paste After:
{if support_ticket_activ}
<br />
» {url_support_ticket}<br />
» <a href="{url_support_ticket_new}">{lang_support_new}</a><br />
<br />
{endif support_ticket_activ}
Step 12. Open admin/backup.php (Updated 9/3/08 Added Step for Backup)
Find:
WORDLIST_TABLE,
Paste After:
SUPPORT_TABLE,
Step 13.Go to your root directory where your 4image gallery is installed go to the data folder and make a folder called "support_media". This is where all images that are sent in your tickets will be stored.
Now run the support_install.php and make sure it goes thought with no errors. Once done your ready. Go to you settings section in you admin control panel and adjust the settings to suit your needs. I hope you enjoy the addition and just give a shout out if you would like to see an other mods on it.