Plugin Directory

Changeset 1232492


Ignore:
Timestamp:
08/27/2015 06:42:21 PM (11 years ago)
Author:
m.tiggelaar
Message:

commit for version 1.3.1

Location:
key4ce-osticket-bridge
Files:
124 added
14 edited

Legend:

Unmodified
Added
Removed
  • key4ce-osticket-bridge/trunk/admin/admin_create_ticket.php

    r1226493 r1232492  
    77
    88// Start File system changes
    9 $fileconfig=key4ce_FileConfigValue();
    10 $filedata=json_decode($fileconfig);
    119if($keyost_version==193)
    1210{
     
    1816else
    1917{
     18$fileconfig=key4ce_FileConfigValue();
     19$filedata=json_decode($fileconfig);
    2020$attachement_status=$filedata->attachments;
    2121$max_user_file_uploads=$filedata->max;
     
    119119            return false;
    120120        });
     121        $("#deptId").change(function() {
     122        var dept_final_id=$("#deptId").val();
     123        var data = {
     124            action: 'get_helptopic_dropdown',
     125            dept_id: dept_final_id
     126        };
     127        // since 2.8 ajaxurl is always defined in the admin header and points to admin-ajax.php
     128        jQuery.post(ajaxurl, data, function(response) {
     129        if(response!="")
     130        {           
     131            $("#key4ce_new_ticket_helptopic").css("display", "block");
     132            $("#key4ce_new_ticket_helptopic_input").html(response);
     133            $("#key4ce_new_ticket_helptopic_input").css("display", "block");           
     134        }
     135        else if(response=="")
     136        {
     137            $("#key4ce_new_ticket_helptopic").css("display", "none");
     138            $("#key4ce_new_ticket_helptopic_input").css("display", "none");
     139        }       
     140        });
     141});
    121142    });
    122143</script>
     
    240261                </div>
    241262                <div style="clear: both"></div>
     263            <!--
    242264            <div id="key4ce_new_ticket_helptopic"><?php echo __("Help Topic", 'key4ce-osticket-bridge'); ?>:</div>
    243265            <div id="key4ce_new_ticket_helptopic_input">
    244266                <select id="topicId" name="topicId" style="width: 155px;">
    245                     <option value="" selected="selected"><?php echo __("Select a Help Topic", 'key4ce-osticket-bridge'); ?></option>
     267                    <option value="" selected="selected"><?php //echo __("Select a Help Topic", 'key4ce-osticket-bridge'); ?></option>
    246268                    <?php
    247                     foreach ($topic_opt as $topic) {
    248                         echo '<option value="' . $topic->topic_id . '">' . $topic->topic . '</option>';
    249                     }
     269                   // foreach ($topic_opt as $topic) {
     270                   //     echo '<option value="' . $topic->topic_id . '">' . $topic->topic . '</option>';
     271                   // }
    250272                    ?>
    251273                </select><font class="error">&nbsp;*</font>
    252274            </div>
     275            -->
     276            <!-- Help Topic Start Here -->
     277            <div id="key4ce_new_ticket_helptopic" style="display:none;"><?php echo __('Help Topic','key4ce-osticket-bridge'); ?>:</div>
     278            <div id="key4ce_new_ticket_helptopic_input" style="display:none;"></div>
     279            <!-- Help Topic End Here -->
    253280            <div style="clear: both"></div>
    254281            <div id="key4ce_new_ticket_priority"><?php echo __("Priority", 'key4ce-osticket-bridge'); ?>:</div>
  • key4ce-osticket-bridge/trunk/admin/adminticketmail.php

    r1226493 r1232492  
    328328$dept_user_details = $ost_wpdb->get_row("SELECT $ost_email.name,$ost_email.email FROM $dept_table INNER JOIN $ost_email ON $dept_table.email_id=$ost_email.email_id WHERE $dept_table.dept_id=$dep_id");
    329329$dept_user_name = $dept_user_details->name;
    330 $dept_user_email = $dept_user_details->email;$user_email_subject=Format::stripslashes($_REQUEST['user_subject']);$ussubject=Format::stripslashes($_REQUEST['user_subject']);$user_email_template=Format::stripslashes($_REQUEST['user_email_template']);eval("\$user_email_template=\"$user_email_template\";");
     330$dept_user_email = $dept_user_details->email;
     331$user_email_subject=Format::stripslashes($_REQUEST['user_subject']);
     332$ussubject=Format::stripslashes($_REQUEST['user_subject']);
     333$user_email_template=Format::stripslashes($_REQUEST['user_email_template']);
     334eval("\$user_email_template=\"$user_email_template\";");
    331335if($smtp_status=="enable")
    332336    $SMTPAuth="true";
     
    360364{
    361365$phpmailer->CharSet = 'UTF-8';
    362 $phpmailer->setFrom($dept_user_email, $dept_user_name);
    363 $phpmailer->addReplyTo($dept_user_email, $dept_user_name);
     366$phpmailer->IsSendmail(); // telling the class to use SendMail transport
     367$phpmailer->AddReplyTo("$dept_user_email","$dept_user_name");
     368$phpmailer->From =  "$dept_user_name";
     369$phpmailer->FromName = "$dept_user_email";
     370$phpmailer->AddAddress($to, $usname);
    364371add_filter('wp_mail_content_type',create_function('', 'return "text/html"; '));
    365 $phpmailer->Subject = $user_email_subject;
    366 $phpmailer->Body       = key4ce_wpetss_forum_text($user_email_template);   
     372$phpmailer->Subject    =$user_email_subject;
     373$phpmailer->Body       = key4ce_wpetss_forum_text($user_email_template); 
     374$phpmailer->AltBody    = "To view the message, please use an HTML compatible email viewer!"; // optional, comment out and test
    367375$phpmailer->MsgHTML('<div style="display: none;">-- do not reply below this line -- <br/><br/></div>' . $user_email_template);
    368 $phpmailer->AltBody = 'This is a plain-text message body';
    369 $phpmailer->AddAddress($wp_user_email_id);
    370 $phpmailer->send();
     376$phpmailer->Send();
    371377}
    372378
  • key4ce-osticket-bridge/trunk/admin/ost-config.php

    r1226493 r1232492  
    2525    @$googlesecretkey=$_REQUEST['googlesecretkey'];
    2626    @$googlesitekey=$_REQUEST['googlesitekey'];
    27     $config=array('host'=>$host, 'database'=>$database, 'username'=>$username,'password'=>$password,'keyost_prefix'=>$keyost_prefix,'keyost_version'=>$keyost_version,'keyost_usercloseticket'=>$keyost_usercloseticket,'supportpage'=>$supportpage,'contactticketpage'=>$contactticketpage,'thankyoupage'=>$thankyoupage,'googlesecretkey'=>$googlesecretkey,'googlesitekey'=>$googlesitekey);         
     27    @$keyost_departmentsetting = ($_REQUEST['keyost_departmentsetting']=="on") ? '1' : '0';
     28    @$keyost_defaultdepartmentsetting = $_REQUEST['keyost_defaultdepartmentsetting'];
     29    @$keyost_helptopicsetting = ($_REQUEST['keyost_helptopicsetting']=="on") ? '1' : '0';
     30    @$keyost_defaulthelptopicsetting = $_REQUEST['keyost_defaulthelptopicsetting'];
     31    $config=array('host'=>$host, 'database'=>$database, 'username'=>$username,'password'=>$password,'keyost_prefix'=>$keyost_prefix,'keyost_version'=>$keyost_version,'keyost_usercloseticket'=>$keyost_usercloseticket,'supportpage'=>$supportpage,'contactticketpage'=>$contactticketpage,'thankyoupage'=>$thankyoupage,'googlesecretkey'=>$googlesecretkey,'googlesitekey'=>$googlesitekey,'keyost_departmentsetting'=>$keyost_departmentsetting,'keyost_defaultdepartmentsetting'=>$keyost_defaultdepartmentsetting,
     32    'keyost_helptopicsetting'=>$keyost_helptopicsetting,'keyost_defaulthelptopicsetting'=>$keyost_defaulthelptopicsetting);         
    2833    if (($_REQUEST['host']=="") || ($_REQUEST['database']=="") || ($_REQUEST['username']=="") || ($_REQUEST['supportpage']=="") )
    2934    {
     
    6368    $config = get_option('os_ticket_config');
    6469    extract($config);
    65     $config = get_option('os_ticket_config');
    66     extract($config);
    6770    $ost_wpdb = new wpdb($username, $password, $database, $host);
    6871    $ticket_cdata=$keyost_prefix.'ticket__cdata';
     
    209212<td><input type="text" name="googlesitekey" id="googlesitekey" size="40" value="<?php echo @$googlesitekey;?>"/>&nbsp;&nbsp;<?php echo __("(Your Google reCAPTCHA Sitekey Goest Here)", 'key4ce-osticket-bridge'); ?></td>
    210213</tr>
     214
     215<!-- Department Configuration for Contact page start here-->
     216<tr>
     217<td class="key4ce_config_td"><label class="key4ce_config_label"><?php echo __("Enable Department on Contact Page:", 'key4ce-osticket-bridge'); ?></label></td>               
     218<td><input type="checkbox" name="keyost_departmentsetting" id="keyost_departmentsetting" <?php echo (@$keyost_departmentsetting=="1") ? 'checked' : ''; ?>/>&nbsp;&nbsp;</td>
     219</tr>
     220<?php
     221$config = get_option('os_ticket_config');
     222extract($config);
     223if((($host!="") || ($database!="") || ($username!="") || ($password!="")) && $keyost_departmentsetting=="0")
     224{
     225?>
     226<tr>
     227<td class="key4ce_config_td"><label class="key4ce_config_label"><?php echo __("Default Department on Contact Page:", 'key4ce-osticket-bridge'); ?></label></td>               
     228<td>
     229<?php
     230$ost_wpdb = new wpdb($username, $password, $database, $host);
     231$dept_table=$keyost_prefix."department";
     232$dept_opt = $ost_wpdb->get_results("SELECT dept_name,dept_id FROM $dept_table where ispublic=1");
     233?>
     234<select id="keyost_defaultdepartmentsetting" name="keyost_defaultdepartmentsetting">
     235<option value="0" selected="selected"><?php echo __('Select a Department','key4ce-osticket-bridge'); ?></option>
     236<?php
     237foreach ($dept_opt as $dept) {
     238        if($keyost_defaultdepartmentsetting==$dept->dept_id)
     239            $keyost_defaultdepartmentsetting_select="selected='selected'";
     240        else
     241            $keyost_defaultdepartmentsetting_select="";
     242    echo '<option value="' . $dept->dept_id . '" '.$keyost_defaultdepartmentsetting_select.'>' . $dept->dept_name . '</option>';
     243}
     244?>
     245</select>&nbsp;&nbsp;<?php echo __("(Default Department on Contact Page:)", 'key4ce-osticket-bridge'); ?>
     246</td>
     247</tr>
     248<?php } ?>
     249<!-- Department Configuration for Contact page end here-->
     250<!-- Helptopic Configuration for Contact page start here-->
     251<tr>
     252<td class="key4ce_config_td"><label class="key4ce_config_label"><?php echo __("Enable Helptopic on Contact Page:", 'key4ce-osticket-bridge'); ?></label></td>               
     253<td><input type="checkbox" name="keyost_helptopicsetting" id="keyost_helptopicsetting" <?php echo (@$keyost_helptopicsetting=="1") ? 'checked' : ''; ?>/>&nbsp;&nbsp;</td>
     254</tr>
     255<?php
     256if((($host!="") || ($database!="") || ($username!="") || ($password!="")) && $keyost_helptopicsetting=="0")
     257{
     258$topic_table=$keyost_prefix."help_topic";
     259$topic_opt = $ost_wpdb->get_results("SELECT topic_id,topic FROM $topic_table  where ispublic=1 and isactive=1 ORDER BY `sort` ASC ");
     260?>
     261<tr>
     262<td class="key4ce_config_td"><label class="key4ce_config_label"><?php echo __("Default Helptopic on Contact Page:", 'key4ce-osticket-bridge'); ?></label></td>               
     263<td>
     264<select id="keyost_defaulthelptopicsetting" name="keyost_defaulthelptopicsetting">
     265<option value="0" selected="selected"><?php echo __('Select a Help Topic','key4ce-osticket-bridge'); ?></option>
     266<?php foreach ($topic_opt as $topic) {
     267        if($keyost_defaulthelptopicsetting==$topic->topic_id)
     268            $keyost_defaulthelptopicsetting_select="selected='selected'";
     269        else
     270            $keyost_defaulthelptopicsetting_select="";
     271        echo '<option value="' . $topic->topic_id . '" '.$keyost_defaulthelptopicsetting_select.'>' . $topic->topic . '</option>';
     272        }
     273        ?>               
     274</select>&nbsp;&nbsp;<?php echo __("(Default Helptopic on Contact Page:)", 'key4ce-osticket-bridge'); ?>
     275</td>
     276</tr>
     277<?php
     278}
     279?>
     280<!-- Helptopic Configuration for Contact page end here-->
    211281</table>
    212282<div style="padding: 30px;">
  • key4ce-osticket-bridge/trunk/admin/ost-postreplymail.php

    r1226493 r1232492  
    88INNER JOIN $ost_email ON $ost_email.email_id=$dept_table.email_id
    99WHERE `number`=$ticket_number");
    10 if($ticket_details.email_id==0)
     10if($ticket_details->email_id==0)
    1111{
    1212$default_email_id=key4ce_getKeyValue('default_email_id');
     
    2020$ticket_detail_dept_email=$ticket_details->email;
    2121}
    22 
    2322$signature=$ticket_details->dept_signature;
    2423$department_id=$ticket_details->dept_id;
    2524// Start File system changes
    26 $fileconfig=key4ce_FileConfigValue();
    27 $filedata=json_decode($fileconfig);
    28 if($keyost_version==194 || $keyost_version==195 || $keyost_version==193)
     25if($keyost_version==193)
    2926{
    3027$attachement_status=key4ce_getKeyValue('allow_attachments');
     
    3532else
    3633{
     34$fileconfig=key4ce_FileConfigValue();
     35$filedata=json_decode($fileconfig);
    3736$attachement_status=$filedata->attachments;
    3837$max_user_file_uploads=$filedata->max;
    3938$max_file_size=$filedata->size;
    4039$fileextesnions=$filedata->extensions;
    41 }   
     40}
    4241// End file system changes
    4342if($signature_type=="mine")
     
    6160if (!empty($_FILES['file']['name'][0]))
    6261{   
    63    $fileids=array();
     62   $fileids=array();   
    6463   for ($i = 0; $i < count($_FILES['file']['name']); $i++)
    6564    {
    6665    $fullfinalpath= key4ce_getKeyValue('uploadpath');
     66   
     67   
    6768    $key4ce_generateHashKey = key4ce_generateHashKey(33);
    6869    $key4ce_generateHashSignature = key4ce_generateHashSignature(33);
     
    8788        } else {
    8889            move_uploaded_file($_FILES["file"]["tmp_name"][$i], $structure . "/" . $newfilename);
     90            $attached_file_for_user=$structure . "/" . $newfilename;
    8991        }
    9092    }
     
    185187$phpmailer->AltBody    = "To view the message, please use an HTML compatible email viewer!"; // optional, comment out and test
    186188$phpmailer->MsgHTML('<div style="display: none;">-- do not reply below this line -- <br/><br/></div>' . $message);
     189if (!empty($_FILES['file']['name'][0]))
     190{
     191$helpdesk_url=key4ce_getKeyValue('helpdesk_url');
     192$file_url=$helpdesk_url."file.php?key=".$key4ce_generateHashKey."&expires=1440720000&signature=".$key4ce_generateHashSignature;
     193$phpmailer->AddAttachment($file_url,$realfilename);
     194}
    187195$phpmailer->AddAddress($to);
    188196$phpmailer->Send();
     
    195203$phpmailer->From =  "$ticket_detail_dept_email";
    196204$phpmailer->FromName = "$ticket_detail_dept_name";
    197 //$phpmailer->SetFrom('$ticket_detail_dept_email', '$ticket_detail_dept_name');
    198205$phpmailer->AddAddress($to, $usname);
    199206add_filter('wp_mail_content_type',create_function('', 'return "text/html"; '));
     
    201208$phpmailer->AltBody    = "To view the message, please use an HTML compatible email viewer!"; // optional, comment out and test
    202209$phpmailer->MsgHTML('<div style="display: none;">-- do not reply below this line -- <br/><br/></div>' . $message);
     210if (!empty($_FILES['file']['name'][0]))
     211{
     212 $minage = $minage ?: 43200;
     213 $gmnow = time()-date('Z') + $minage;
     214 $expires = $gmnow + 86400 - ($gmnow % 86400);
     215 $table_prefix_osticket=$keyost_prefix;
     216 $admin_email_mail=key4ce_getKeyValue('helpdesk_url');
     217 $secret_salt=md5($table_prefix_osticket.$admin_email_mail);
     218function genUrlSignature($id, $key, $signature, $expires) {
     219        $pieces = array(
     220            'Host='.$_SERVER['HTTP_HOST'],
     221            'Path=http://ticket.zovira.com/ticket1912/',
     222            'Id='.$id,
     223            'Key='.strtolower($key),
     224            'Hash='.$signature,
     225            'Expires='.$expires,
     226        );
     227        return hash_hmac('sha1', implode("\n", $pieces), $secret_salt);
     228        }
     229$helpdesk_url=key4ce_getKeyValue('helpdesk_url');
     230$disposition=false;
     231$signature =genUrlSignature($file_id,$key4ce_generateHashKey,$key4ce_generateHashSignature,$expires);
     232$args = array(
     233            'key' => strtolower($key4ce_generateHashKey),
     234            'expires' => $expires,
     235            'signature' => $signature,
     236        );
     237echo $file_url=$helpdesk_url."file.php?".http_build_query($args);
     238exit;
     239$phpmailer->AddAttachment($file_url,$realfilename);
     240}
    203241$phpmailer->Send();
    204 /*
    205 $phpmailer->CharSet = 'UTF-8';
    206 $phpmailer->setFrom("$ticket_detail_dept_name", "$ticket_detail_dept_email");
    207 $phpmailer->addReplyTo("$ticket_detail_dept_name", "$ticket_detail_dept_email");
    208 $phpmailer->addAddress($to);
    209 add_filter('wp_mail_content_type',create_function('', 'return "text/html"; '));
    210 $phpmailer->Subject = $subject;
    211 $phpmailer->MsgHTML('<div style="display: none;">-- do not reply below this line -- <br/><br/></div>' . $message);
    212 $phpmailer->AltBody = 'This is a plain-text message body';
    213 $phpmailer->send();
    214 */
    215 }
     242}
     243exit;
    216244?>
  • key4ce-osticket-bridge/trunk/admin/ost-tickets.php

    r1226493 r1232492  
    7979 }
    8080 
    81  $( document ).ready(function() {
    82   $('#ui-id-7 td.noEdit').click(function(e){
     81 jQuery(document).ready(function() {
     82  jQuery('#ui-id-7 td.noEdit').click(function(e){
    8383   e.stopPropagation();
    8484});
  • key4ce-osticket-bridge/trunk/css/style.css

    r1226493 r1232492  
    242242input[readonly], input[readonly="readonly"], input[readonly="true"] {
    243243    background-color: #ddd;
     244    color: #707070;
    244245}
    245246
  • key4ce-osticket-bridge/trunk/includes/contactticketmail.php

    r1226493 r1232492  
    2222$os_admin_email_id = $os_admin_email->value;
    2323$os_admin_email_address = $ost_wpdb->get_row("SELECT email,name FROM " . $keyost_prefix . "email where email_id=" . $os_admin_email_id . "");
    24 $dep_id = @$_REQUEST['deptId'];
     24if($keyost_defaultdepartmentsetting!="" && $keyost_defaultdepartmentsetting==0)
     25    $dep_id = @$_REQUEST['deptId'];
     26else
     27    $dep_id=@$keyost_defaultdepartmentsetting;
     28
    2529$sla_id = 1;
    2630$pri_id = 2;
    27 @$top_id = $_REQUEST['topicId'];
     31if($keyost_defaulthelptopicsetting!="" && $keyost_defaulthelptopicsetting==0)
     32    @$top_id = $_REQUEST['topicId'];
     33else
     34    $top_id=@$keyost_defaulthelptopicsetting;
    2835$staff_id = 0;
    2936$team_id = 0;
     
    5966}
    6067if (isset($_REQUEST['create-contact-ticket']) && $response['success']==true) {
     68if($keyost_version==193)
     69{
     70$attachement_status=key4ce_getKeyValue('allow_attachments');
     71$max_user_file_uploads=key4ce_getKeyValue('max_user_file_uploads');
     72$max_file_size=key4ce_getKeyValue('max_file_size');
     73$fileextesnions=key4ce_getKeyValue('allowed_filetypes');
     74}
     75else
     76{
     77$fileconfig=key4ce_FileConfigValue();
     78$filedata=json_decode($fileconfig);
     79$attachement_status=$filedata->attachments;
     80$max_user_file_uploads=$filedata->max;
     81$max_file_size=$filedata->size;
     82$fileextesnions=$filedata->extensions;
     83}
    6184// Added by Pratik Maniar on 29-04-2014 Start Here
    6285    $dept_details = $ost_wpdb->get_row("SELECT dept_id,dept_name FROM $dept_table WHERE dept_id=$dep_id");
     
    7699        $last_ost_user_id = $ost_wpdb->get_var("SELECT id FROM " . $keyost_prefix . "user WHERE default_email_id = '" . @$last_ost_user_email_id . "'");
    77100    } else {
    78         $ost_wpdb->query("INSERT INTO " . $keyost_prefix . "user (id, default_email_id, name, created, updated) VALUES ('','" . $last_ost_user_email_id . "', '" . $nam . "', '" . $cre . "', '" . $cre . "')
     101        $ost_wpdb->query("INSERT INTO " . $keyost_prefix . "user (id, default_email_id, name, created, updated) VALUES ('','" . $last_ost_user_email_id . "', '" . $fullname . "', '" . $cre . "', '" . $cre . "')
    79102    ");
    80103        $last_ost_user_id = $ost_wpdb->insert_id;
     
    94117    $ost_wpdb->insert($ticket_table, array('number' => $tic_ID, 'user_id' => $last_ost_user_id, 'user_email_id' => $last_ost_user_email_id, 'dept_id' => $dep_id, 'sla_id' => $sla_id, 'topic_id' => $top_id, 'staff_id' => $staff_id, 'team_id' => $team_id, 'email_id' => $last_ost_user_email_id, 'ip_address' => $ip_add, 'status' => $ticketstate, 'source' => $sour, 'isoverdue' => $isoverdue, 'isanswered' => $isans, 'lastmessage' => $las_msg, 'created' => $cre), array('%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%s', '%s', '%s', '%s', '%s', '%s', '%s'));
    95118    }
    96    
    97 
    98119    $lastid = $ost_wpdb->insert_id;
    99120    $stat = "created";
     
    101122    $annulled = 0;
    102123    $ost_wpdb->insert($ticket_event_table, array('ticket_id' => $lastid, 'staff_id' => $staff_id, 'team_id' => $team_id, 'dept_id' => $dep_id, 'topic_id' => $top_id, 'state' => $stat, 'staff' => $staf, 'annulled' => $annulled, 'timestamp' => $cre), array('%d', '%d', '%d', '%d', '%d', '%s', '%s', '%s', '%s'));
    103 
     124    // File Table Entry Code Start Here By Pratik Maniar on 26/08/2015
     125if (!empty($_FILES['file']['name'][0]))
     126{   
     127   $fileids=array();
     128   for ($i = 0; $i < count($_FILES['file']['name']); $i++)
     129    {   
     130    $fullfinalpath= key4ce_getKeyValue('uploadpath');
     131    $key4ce_generateHashKey = key4ce_generateHashKey(33);
     132    $key4ce_generateHashSignature = key4ce_generateHashSignature(33);
     133    $dir_name = substr($key4ce_generateHashKey, 0, 1);
     134    $structure = $fullfinalpath."/".$dir_name;
     135    //$structure."<br>";
     136    if (!is_dir($structure)) {
     137        mkdir($structure, 0355);
     138    }
     139    $alowaray = explode(".",str_replace(' ', '',$fileextesnions));
     140    $strplc = str_replace(".", "",str_replace(' ', '',$fileextesnions));
     141    $allowedExts = explode(",", $strplc);
     142    $allowextscnt=count($allowedExts);
     143    $temp = explode(".", $_FILES['file']['name'][$i]);
     144    $extension = end($temp); //return uploaded file extension
     145    $newfilename = $key4ce_generateHashKey;
     146    $realfilename = $_FILES['file']['name'][$i];
     147    $filetype = $_FILES["file"]["type"][$i];
     148    $filesize = $_FILES["file"]["size"][$i];
     149    //$structure . "/" . $newfilename;
     150    if (($_FILES["file"]["size"][$i] < $max_file_size) && (in_array($extension, $allowedExts) || $allowextscnt)) {
     151        if ($_FILES["file"]["error"][$i] > 0) {
     152            echo "Return Code: " . $_FILES["file"]["error"][$i] . "<br>";
     153            exit;
     154        } else {
     155            move_uploaded_file($_FILES["file"]["tmp_name"][$i], $structure . "/" . $newfilename);
     156        }
     157    }
     158     $ost_wpdb->insert($keyost_prefix . "file", array('ft' => 'T', 'bk' => 'F', 'type' => $filetype,
     159        'size' => $filesize, 'key' => $key4ce_generateHashKey, 'signature' => $key4ce_generateHashSignature,
     160        'name' => $realfilename, 'attrs' => '', 'created' => $cre), array('%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s'));
     161    $file_id = $ost_wpdb->insert_id;
     162    array_push($fileids, $file_id);
     163    }       
     164}
     165// File Table Entry Code End Here By Pratik Maniar on 26/08/2015 
    104166    $pid = 0;
    105167    $thread_type = "M";
    106 
    107     $ost_wpdb->insert($thread_table, array('pid' => $pid, 'ticket_id' => $lastid, 'staff_id' => $staff_id, 'thread_type' => $thread_type, 'poster' => $nam, 'source' => $sour, 'title' => "", 'body' => key4ce_wpetss_forum_text($user_message), 'ip_address' => $ip_add, 'created' => $cre), array('%d', '%d', '%d', '%s', '%s', '%s', '%s', '%s', '%s', '%s'));
    108 
     168    $ost_wpdb->insert($thread_table, array('pid' => $pid, 'ticket_id' => $lastid, 'staff_id' => $staff_id, 'thread_type' => $thread_type, 'poster' => $fullname, 'source' => $sour, 'title' => "", 'body' => key4ce_wpetss_forum_text($user_message), 'ip_address' => $ip_add, 'created' => $cre), array('%d', '%d', '%d', '%s', '%s', '%s', '%s', '%s', '%s', '%s'));
     169    $thread_id = $ost_wpdb->insert_id;
     170     if (!empty($_FILES['file']['name'][0]))
     171    {   
     172        foreach($fileids as $file_id)
     173        {
     174    // File Attachment Table Entry Code Start Here By Pratik Maniar on 26/08/2015
     175        $ost_wpdb->insert($keyost_prefix . "ticket_attachment", array('ticket_id' => $lastid, 'file_id' => $file_id, 'ref_id' => $thread_id, 'inline' => '0', 'created' => $cre), array('%d', '%d', '%d', '%d', '%s'));
     176    // File Attachment Table Entry Code End Here By Pratik Maniar on 26/08/2015
     177        }
     178    }
    109179    if($keyost_version==194 || $keyost_version==195 || $keyost_version==1951)
    110180    {
  • key4ce-osticket-bridge/trunk/includes/functions.php

    r1119633 r1232492  
    113113   
    114114}
    115 
    116115?>
  • key4ce-osticket-bridge/trunk/includes/versionData.php

    r1226493 r1232492  
    11<?php
     2if($_POST['department_id'] && wp_verify_nonce( $_POST['ajax_security'],'key4ce-ajax-sec'))
     3{
     4    echo $help_topic_opt = $ost_wpdb->get_results("SELECT topic_id,topic FROM $topic_table  where ispublic=1 and isactive=1 and dept_id='".$_POST['department_id']."' ORDER BY `sort` ASC ");
     5    exit;
     6    foreach ($help_topic_opt as $help_topic)
     7    {
     8       $options .='<option value="' . $help_topic->topic_id . '">' . $help_topic->topic . '</option>';
     9    }
     10    echo $options;
     11}
    212$topic_opt = $ost_wpdb->get_results("SELECT topic_id,topic FROM $topic_table  where ispublic=1 and isactive=1 ORDER BY `sort` ASC ");
    313$pri_opt = $ost_wpdb->get_results("SELECT priority_desc,priority_id FROM $priority_table");
    414$dept_opt = $ost_wpdb->get_results("SELECT dept_name,dept_id FROM $dept_table where ispublic=1");
    5 require_once( WP_PLUGIN_DIR . '/key4ce-osticket-bridge/includes/database.php' );
     15require_once( WP_PLUGIN_DIR . '/key4ce-osticket-bridge/includes/database.php' );
     16require_once( WP_PLUGIN_DIR . '/key4ce-osticket-bridge/includes/functions.php' );
     17
    618?>
  • key4ce-osticket-bridge/trunk/ost-bridge.php

    r1226493 r1232492  
    33Plugin Name: Key4ce osTicket Bridge
    44Plugin URI: https://key4ce.com/projects/key4ce-osticket-bridge
    5 Description: Integrate osTicket (v1.9.3 - 1.9.11) into wordpress. including user integration and scp
    6 Version: 1.3.0
     5Description: Integrate osTicket (v1.9.3 - 1.9.12) into wordpress. including user integration and scp
     6Version: 1.3.1
    77Author: Key4ce
    88Author URI: https://key4ce.com
     
    4040
    4141add_action( 'init', 'keyost_load_textdomain', 1 );
    42 
    4342function mb_settings_link($actions, $file) {
    4443if(false !== strpos($file, 'ost-bridge'))
     
    358357    }
    359358}
     359add_action('wp_ajax_get_helptopic_dropdown', 'get_helptopic_dropdown_callback');
     360add_action('wp_ajax_nopriv_get_helptopic_dropdown', 'get_helptopic_dropdown_callback');
     361function get_helptopic_dropdown_callback(){
     362    //ob_clean(); // Only enabled if need
     363    if($_POST['dept_id'] > 0 && $_POST['dept_id']!="")
     364    {
     365        $config = get_option('os_ticket_config');
     366        extract($config);
     367        $ost_wpdb = new wpdb($username, $password, $database, $host);
     368        $topic_table=$keyost_prefix."help_topic";   
     369        $help_topic_opt = $ost_wpdb->get_results("SELECT topic_id,topic FROM $topic_table  where ispublic=1 and isactive=1 and dept_id='".$_POST['dept_id']."' ORDER BY `sort` ASC ");
     370        $rowCount = $ost_wpdb->num_rows;
     371        if($rowCount > 0 )
     372        {
     373            $helptopic_dropdown="<select id=\"topicId\" name=\"topicId\">";
     374            foreach ($help_topic_opt as $help_topic)
     375            {
     376               $helptopic_dropdown.="<option value=". $help_topic->topic_id.">".$help_topic->topic."</option>";
     377            }
     378            $helptopic_dropdown.="</select>";               
     379            echo $helptopic_dropdown;
     380            die();
     381        }
     382        else
     383        {
     384            echo "";
     385            die();
     386        }
     387    }
     388    else
     389        die();
     390}
    360391function ost_tickets_page() {
    361392$config = get_option('os_ticket_config');
  • key4ce-osticket-bridge/trunk/osticket-wp.php

    r1226493 r1232492  
    77    extract($config);
    88    wp_enqueue_style('ost-bridge', plugins_url('css/style.css', __FILE__));
     9
    910    ?>
    1011    <div id="ost_container"><!--ost_container Start-->
  • key4ce-osticket-bridge/trunk/readme.txt

    r1226503 r1232492  
    44Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=paypal%40key4ce%2ecom
    55Requires at least: 3.5
    6 Tested up to: 4.2
    7 Stable tag: 1.3.0
     6Tested up to: 4.3
     7Stable tag: 1.3.1
    88License: GPLv3
    99License URI: http://www.gnu.org/licenses/gpl-3.0.html
    10 
    11 Get your own advanced ticket system in Wordpress and Integrate osTicket into your wordpress site. Works with osTicket 1.9.3 - 1.9.11
     10Get your own advanced ticket system in Wordpress and Integrate osTicket into your wordpress site. Works with osTicket 1.9.3 - 1.9.12
    1211
    1312== Description ==
    14 
    1513This is a rebuild of the original OSTicket WP Bridge plugin
    1614Because the original plugin was no longer developed we decided to make a new plugin out of it.
    1715adding new features, fixing old bugs and security flaws.
    1816
    19 
    2017= Basic Features: =
    21 
    22 * Compatible with osTicket 1.9.3 - 1.9.11
     18* Compatible with osTicket 1.9.3 - 1.9.12
    2319* POP / IMAP functionality stays intact
    2420* You can use both osTicket scp, reply to email OR use Wordpress for all tickets
     
    3228* Multi-language support
    3329
    34 
    3530= Features scheduled for next release: =
    36 
    3731- Ticket user linked to WP / Woo Commerce users.
    38 - Improved Contact page shortcode
    39 - Support for view ticket without login.
    40 
    4132
    4233= Translations available =
    43 
    4434* English
    4535* Dutch
    4636* Arabic - by mbnoimi
    4737* German - by Adrian Oeschger
    48 
    4938* If you would like to contribute your own language please don't hesitate to contact us!
    5039
    51 
    5240= If you like this plugin please leave a good review behind and help us to promote it. =
    53 
    5441This plugin is powered by Key4ce - IT Professionals :: https://key4ce.com
    5542
    56 
    57 
    5843== Installation ==
    5944
    60 
    61 
    6245= Prerequisites: =
    63 
    6446* Make sure that osTicket is installed
    65 
    66 * Make sure that your osTicket version is 1.9.3, 1.9.4 1.9.5, 1.9.6, 1.9.8, 1.9.9, 1.9.10 or 1.9.11(all subversions should work).
    67 
     47* Make sure that your osTicket version is 1.9.3, 1.9.4 1.9.5, 1.9.6, 1.9.8, 1.9.9, 1.9.10, 1.9.11 or 1.9.12 (all subversions should work).
    6848* osTicket can be downloaded from http://osticket.com/download
    69 
    70 * For Attachments to work with the Key4ce osTicket Bridge plugin, please download and configure the osTicket plugin: Storage :: Attachments on the Filesystem
    71 
     49* For Attachments to work with the Key4ce osTicket Bridge plugin, please download and configure the osTicket plugin: Storage :: Attachments on the Filesystem.
    7250* osTicket Storage :: Attachments on the Filesystem plugin can be downloaded here: http://osticket.com/download/go?dl=plugin%2Fstorage-fs.phar
    73 
    7451* Our plugin will make use of Department, help topic alert & Email settings. Please set them carefully in osTicket settings.
    75 
    76 * Create a Contact Ticket Page. This is the page the plugin will modify and AUTOMATICALLY insert the [addoscontact] shortcode which will display a contact form which allows guests to submit tickets
    77 
    78 * Create a Thank You Page for all ticket submissions
    79 
     52* Create a Contact Ticket Page. This is the page the plugin will modify and AUTOMATICALLY insert the [addoscontact] shortcode which will display a contact form which allows guests to submit tickets.
     53* Create a Thank You Page for all ticket submissions.
    8054* Make sure the email template subject matches your osticket email subjects.
    81 
    82 * Fill in google's re-captcha code for contact page
    83 
    84 
     55* Fill in google's re-captcha code for contact page.
    8556
    8657= Shortcodes: =
    87 
    8858[addosticket] Ticket listing and creation of tickets for logged in customers/clients (see Screenshots tab).
    89 
    9059[addoscontact] Guest ticket submission form with CAPTCHA (a WordPress user login is not required to submit a ticket - see Screenshots tab).
    91 
    9260[addosopenticketcount] Display the amount of open tickets for the logged in user anywhere in wordpress.
    9361
    94 
    95 
    9662= Install Instructions: =
    97 
    98631. Install key4ce-osticket-bridge folder to the /wp-content/plugins/ directory.
    99 
    100642. Activate the plugin through the "Plugins" menu in WordPress.
    101 
    102653. osTicket Bridge plugin settings are located in Dashboard--> Tickets --> osT-Config (DO NOT name your "Landing Page Name" the same name as the folder you have osTicket installed).
    103 
    104664. osTicket DB configuration settings are located in Dashboard--> Tickets --> Settings
    105 
    106675. Email template settings are located in Dashboard--> Tickets--> Email Templates
    107 
    108686. Add a contact page and a thank you page for [addoscontact]
    109 
    110697. Set the landing page (ticket list + create ticket page)
    111 
    112708. Set the contact page and Contact thank you page
    113 
    114719. Set googles re-captcha keys for the contact page (can be found at: https://www.google.com/recaptcha/admin#list)
    11572
    116 
    117 
    11873= IMPORTANT NOTE: =
    119 
    12074You CANNOT use the shortcode: [addosticket] and [addoscontact] on more than one page. Please make sure you select the corresponding pages you applied the shortcodes to in the osTicket Bridge plugin settings (located in Dashboard--> Tickets --> osT-Config).
    12175
    122 
    123 
    12476== Frequently Asked Questions ==
    12577
    126 
    127 
    12878= Where does the osTicket need to be Installed? =
    129 
    13079Can be anywhere, just make sure you know it's Database settings and fill them in accordingly in osT-Config page.
    13180
    132 
    133 
    13481= What version of osTicket can i use? =
    135 
    136 osTicket v1.9.3 to v1.9.11 (all subversions are generally supported).
    137 
    138 
     82osTicket v1.9.3 to v1.9.12 (all subversions are generally supported).
    13983
    14084= Where can I download the tested osTicket versions? =
    141 
    14285http://osticket.com/download
    14386
    144 
    145 
    14687== Screenshots ==
    14788
    148 
    149 
    150891. Shows the Client ticket list.
    151 
    152902. Shows how the client views the ticket.
    153 
    154913. Shows how the Wordpress admin views the ticket list.
    155 
    156924. Shows how the Wordpress admin views the
    157 
    158935. Shows the [addoscontact] shortcode forms
    159 
    160946. HTML Email template example (with signature).
    16195
    162 
    163 
    16496== Changelog ==
     97= 1.3.1 =
     98- Added help topic based up on department.
     99- Contact form attachments, department and help topic selection options added.
     100- osticket 1.9.12 compatability added.
     101- Fixed: some styling issues.
     102- Fixed: Full name field properly adds full name.
     103- Fixed: Google re-captcha fields in the right order.
    165104
    166105= 1.3.0 =
     
    169108- osticket 1.9.11 compatible
    170109- Email template subjects added to email templates
    171 - Google re-captcha added to contact page
    172 - Redesigned the tables for responsive grid.
     110- Google re-captcha added to contact form.
    173111
    174112= 1.2.9 =
    175 
    176113- Added additional File attachment functionality to ignore empty extensions
    177 
    178114- Fixed up queries for shortcode/ forum contact page
    179115
    180 
    181 
    182116= 1.2.8 =
    183 
    184117- Added support for 1.9.5.1 and 1.9.6
    185 
    186118- fixed Attachment support for higher versions
    187119
    188 
    189 
    190120= 1.2.7 =
    191 
    192121- Functions all have prefixes to avoid conflicts with other plugins
    193 
    194122- Multi language support added
    195123
    196 
    197 
    198124= 1.2.6 =
    199 
    200125- Fixes for 1.9.4 fresh installation
    201 
    202126- Email customer reply fix
    203127
    204 
    205 
    206128= 1.2.5 =
    207 
    208129- osticket 1.9.4 support added
    209 
    210130- added osticket version selection
    211131
    212 
    213 
    214132= 1.2.4 =
    215 
    216133- Open ticket count fixed
    217 
    218134- Option to enable ticket close for client
    219 
    220135- Client layout fixed
    221 
    222136- Client main page fixed
    223 
    224137- Small other changes in code.
    225138
    226 
    227 
    228139= 1.2.3 =
    229 
    230140- Admin can create tickets with auto search in WP Database.
    231 
    232141- Mass close tickets on client ticket listing.
    233 
    234142- Shortcode for viewing open tickets
    235 
    236143- File attachment error in Admin fixed.
    237 
    238144- Bugged users will now be automatically updated and fixed.
    239 
    240145- contact form bug fixed.
    241146
    242 
    243 
    244147= 1.2.2 =
    245 
    246148- Multiple file attachments
    247 
    248149- File attachment location from osTicket
    249 
    250150- mysql query fix- contact form sender name and email fix.
    251 
    252151- minor issues fixed.- updated installations (Contributed by: DivaVocals)
    253152
    254 
    255 
    256153= 1.2.1 =
    257 
    258154- Fixed infected javascript files.
    259155
    260 
    261 
    262156= 1.2.0 =
    263 
    264157- Single file Attachments
    265 
    266158- File Attachement configuration based on OSticket(Filesize,File Type,File Attachement enable/disable)
    267 
    268159- Corrected Admin ticket counting (Open,Closed,Answered,All)
    269 
    270160- HTML Email Template
    271 
    272161- Admin and Department Signature in Email template (based up on osTicket signature)
    273 
    274162- Mass delete/ Close tickets from Admin ticket listing
    275 
    276163- Fixed names in ticket thread
    277 
    278164- Fixed time equal to osTicket settings.
    279 
    280165- Tested with Wordpress 4.0
    281166
    282 
    283 
    284167= 1.1.5 =
    285 
    286168- Shortcode for Contact style form with captcha
    287 
    288169- Shortcode placement fix for ticket list and ticket create
    289 
    290170- CSS/ JS inclusion fix ** Submitted by Steffen Andre Langnes **
    291 
    292171- Login Redirect ** Submitted by Steffen Andre Langnes **
    293172
    294 
    295 
    296173= 1.1.4 =
    297 
    298174- Prefix fix for existing plugin users
    299 
    300175- mysql DB errors fixed- RevSlider conflict fixed
    301 
    302176- Activate / Deactivate warning messages fixed.
    303 
    304177- If wrong database info blank page issue fixed.
    305178
    306 
    307 
    308179= 1.1.3 =
    309 
    310180- Added database keyost_prefix field
    311 
    312181- Fixed mysql bugs
    313 
    314182- Fixed first time user issue.
    315 
    316183- Headers already sent fixed.
    317 
    318184- Creating multiple ticket pages on save has been resolved.
    319185
    320 
    321 
    322186= 1.1.2 =
    323 
    324187- Shows name in ticket threads.
    325 
    326188- SMTP save field fix- Offline / Offline mode fix
    327 
    328189- Cleaned up legacy code
    329190
    330 
    331 
    332191= 1.1.1 =
    333 
    334192- Shortcode redirect fix
    335 
    336193- Login fields added
    337 
    338194- Register link with redirect added
    339 
    340195- Premalink related issues fixed
    341 
    342196- Adding new users to OSticket fixed
    343 
    344197- Form validation fixed
    345198
    346 
    347 
    348199= 1.1 =
    349 
    350200- Shortcode implementation
    351 
    352201- Cleaned up code issues
    353 
    354202- Admin Alert Email now looks into group members aswell
    355 
    356203- implemented Reply Separator Tag- Fixed: Email From name
    357 
    358204- Fixed: Many code warnings and errors in Debug mode- And much more..
    359205
    360 
    361 
    362206= 1.0 =
    363 
    364207- New design for both Admin and Client end
    365 
    366208- Uses OSTicket email address and name based up on the department
    367 
    368209- Full HTML capable with rich text editor for both client and admin
    369 
    370210- Admin side menu displays the amount of open tickets
    371 
    372211- Displays "Open tickets" in the top admin menu when open tickets are available Displays "Support tickets" when no open ticket is available.
    373 
    374212- Added Answered status to both admin and client side
    375 
    376213- Security Fix: Client no longer able to see everyones ticket by entering the ticket id in the url.
    377 
    378214- Fix: User/ priority/ status fields compatible with OSTicket 1.9
    379 
    380215- Fix: Using department instead of Topic
    381 
    382216- Fix: If not logged in to Wordpress it will redirect you to the Wordpress login (works with Theme my login plugin)
    383217
    384 
    385 
    386218== Upgrade Notice ==
     219= 1.3.1 =
     220added help topic based up on department, contact form department, help topic and attachments options added, added support for osticket 1.9.12
    387221
    388222= 1.3.0 =
    389 Added help topic functionality, added email subjects to mail templates, google re-captcha to contact page, fixed time issue, and more..
     223Added help topic functionality, added email subjects to mail templates, fixed time issue, and more..
    390224
    391225= 1.2.9 =
    392 
    393226Added better attachment support and fixed up some queries for contact page.
    394227
    395 
    396 
    397228= 1.2.8 =
    398 
    399229Added support for 1.9.5.1 and 1.9.6
    400230
    401 
    402 
    403231= 1.2.7 =
    404 
    405232Added multi language support.
    406233
    407 
    408 
    409234= 1.2.6 =
    410 
    411235Added osticket 1.9.4 fresh installation support and small email customer reply bug.
    412236
    413 
    414 
    415237= 1.2.5 =
    416 
    417238Added osticket 1.9.4 support.
    418239
    419 
    420 
    421240= 1.2.4 =
    422 
    423241Option to enable or disable client close ticket feature, and small bug fixes.
    424242
    425 
    426 
    427243= 1.2.3 =
    428 
    429244Several minor bug fixes, new Admin create ticket functionality, and more..
    430245
    431 
    432 
    433246= 1.2.2 =
    434 
    435247Multiple file atachment now possible, and small bug fixes have been made.
    436248
    437 
    438 
    439249= 1.2.1 =
    440 
    441250Emergency update: Javascripts where infected please update asap. Our apologies for the inconvenience
    442251
    443 
    444 
    445252= 1.2.0 =
    446 
    447253Multiple new and convenient features, Attachments, signatures and more.
    448254
    449 
    450 
    451255= 1.1.5 =
    452 
    453256Shortcode fixes, css/js inclusion fixes, new Contact style shortcode
    454257
    455 
    456 
    457258= 1.1.4 =
    458 
    459259Urgent update fixing multiple issues caused by update 1.1.3.
    460260
    461 
    462 
    463261= 1.1.3 =
    464 
    465262Database keyost_prefix field added, and mysql bugs fixed.
    466263
    467 
    468 
    469264= 1.1.2 =
    470 
    471265Minor update: Cleaned up legacy code and fixed:smtp fields and offline mode
    472266
    473 
    474 
    475267= 1.1.1 =
    476 
    477268Shortcode related issues fixed, osTicket user related issues fixed.
    478269
    479 
    480 
    481270= 1.1 =
    482 
    483271Shortcode implementation and many code fixes.
    484272
    485 
    486 
    487273= 1.0 =
    488 
    489274Initial version
  • key4ce-osticket-bridge/trunk/templates/contact_ticket.php

    r1226493 r1232492  
    2626$default_email_id_data = $ost_wpdb->get_row("SELECT name FROM " . $keyost_prefix . "email WHERE `email_id` =$default_email_id");
    2727$title_name = $default_email_id_data->name;
    28 ?>
     28if($keyost_version==193)
     29{
     30$attachement_status=key4ce_getKeyValue('allow_attachments');
     31$max_user_file_uploads=key4ce_getKeyValue('max_user_file_uploads');
     32$max_file_size=key4ce_getKeyValue('max_file_size');
     33$fileextesnions=key4ce_getKeyValue('allowed_filetypes');
     34}
     35else
     36{
     37$fileconfig=key4ce_FileConfigValue();
     38$filedata=json_decode($fileconfig);
     39$attachement_status=$filedata->attachments;
     40$max_user_file_uploads=$filedata->max;
     41$max_file_size=$filedata->size;
     42$fileextesnions=$filedata->extensions;
     43}
     44$alowaray = explode(".",str_replace(' ', '',$fileextesnions));
     45$strplc = str_replace(".", "",str_replace(' ', '',$fileextesnions));
     46$allowedExts = explode(",", $strplc);
     47function add_quotes($str) {
     48    return sprintf("'%s'", $str);
     49}
     50$extimp = implode(',', array_map('add_quotes', $allowedExts));
     51$finalary = "'" . $extimp . "'";
     52?>
     53<script type="text/javascript">
     54var ajaxurl = '<?php echo admin_url('admin-ajax.php'); ?>';
     55</script>
     56<script language="javascript" src="<?php echo $url.'/key4ce-osticket-bridge/js/validate.js'; ?>"></script>
     57<script language="javascript" src="<?php echo plugin_dir_url(__FILE__) . '../js/jquery_1_7_2.js'; ?>"></script>
     58<script type="text/javascript">
     59    $(function() {
     60        var addDiv = $('#addinput');
     61        var i = $('#addinput p').size() + 1;
     62        var MaxFileInputs = <?php echo $max_user_file_uploads; ?>;
     63        $('#addNew').live('click', function() {
     64            if (i <= MaxFileInputs)
     65            {
     66                $('<p><span style="color:#000;"><?php echo __("Attachment", 'key4ce-osticket-bridge'); ?> ' + i + ':</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="file" id="p_new_' + i + '" name="file[]" onchange="return checkFile(this);"/>&nbsp;&nbsp;&nbsp;<a href="#" id="remNew"><?php echo __("Remove", 'key4ce-osticket-bridge'); ?></a>&nbsp;&nbsp;&nbsp;<span style="color: red;font-size: 11px;"><?php echo __("Max file upload size", 'key4ce-osticket-bridge'); ?> : <?php echo ($max_file_size * .0009765625) * .0009765625; ?>MB</span></p>').appendTo(addDiv);
     67                i++;
     68            }
     69            else
     70            {
     71                alert("<?php echo __("You have exceeds your file upload limit", 'key4ce-osticket-bridge'); ?>");
     72                return false;
     73            }
     74            return false;
     75        });
     76
     77        $('#remNew').live('click', function() {
     78            if (i > 2) {
     79                $(this).parents('p').remove();
     80                i--;
     81            }
     82            return false;
     83        });
     84        $("#deptId").change(function() {
     85        var dept_final_id=$("#deptId").val();
     86        var data = {
     87            action: 'get_helptopic_dropdown',
     88            dept_id: dept_final_id
     89        };
     90        // since 2.8 ajaxurl is always defined in the admin header and points to admin-ajax.php
     91        jQuery.post(ajaxurl, data, function(response) {
     92        if(response!="")
     93        {           
     94            $("#key4ce_new_ticket_helptopic").css("display", "block");
     95            $("#key4ce_new_ticket_helptopic_input").html(response);
     96            $("#key4ce_new_ticket_helptopic_input").css("display", "block");           
     97        }
     98        else if(response=="")
     99        {
     100            $("#key4ce_new_ticket_helptopic").css("display", "none");
     101            $("#key4ce_new_ticket_helptopic_input").css("display", "none");
     102        }       
     103        });
     104});
     105    });
     106</script>
     107<script type="text/javascript">
     108    function checkFile(fieldObj)
     109    {
     110        var FileName = fieldObj.value;
     111        var FileId = fieldObj.id;
     112        var FileExt = FileName.substr(FileName.lastIndexOf('.') + 1);
     113        var FileSize = fieldObj.files[0].size;
     114        var FileSizeMB = (FileSize / 10485760).toFixed(2);
     115        var FileExts = new Array(<?php echo $extimp; ?>);
     116       
     117        if ((FileSize > <?php echo $max_file_size; ?>))
     118        {
     119            alert("<?php echo __("Please make sure your file is less than", 'key4ce-osticket-bridge'); ?> <?php echo ($max_file_size* .0009765625) * .0009765625; ?>MB.");
     120            document.getElementById(FileId).value = "";
     121            return false;
     122        }
     123        if(FileExts!="")
     124        {
     125            if (FileExts.indexOf(FileExt) < 0)
     126            {
     127                error = "<?php echo __("Please make sure your file extension should be :", 'key4ce-osticket-bridge'); ?> \n";
     128                error += FileExts;
     129                alert(error);
     130                document.getElementById(FileId).value = "";
     131                return false;
     132            }
     133        }
     134        return true;
     135    }
     136</script>
    29137<style>
    30138#key4ce_wp-message-wrap{border:2px solid #CCCCCC;border-radius: 5px;padding: 5px;width: 75%;}
     
    33141.entry-content{max-width: 700px;}
    34142</style>
    35 <script language="javascript" src="<?php echo $url.'/key4ce-osticket-bridge/js/validate.js'; ?>"></script>
    36 <script src='https://www.google.com/recaptcha/api.js'></script>
    37143<?php
    38144if(isset($_POST['g-recaptcha-response']))
     
    64170            <input type="hidden" name="sdirna" value="<?php echo $dirname; ?>"/>
    65171            <input type="hidden" name="newtickettemp" value="<?php echo $newticket; ?>"/>
     172            <input type="hidden" value="2" name="priorityId" id="priority"/>
    66173<div id="key4ce_new_ticket_name"><?php echo __('Full Name:','key4ce-osticket-bridge'); ?></div>
    67174<div id="key4ce_new_ticket_name_input"><input class="ost" id="cur-name" type="text" name="cur-name" size="30"></div>
     
    70177<div id="key4ce_new_ticket_email_input"><input class="ost" id="email" type="text" name="email" size="30"></div>
    71178<div style="clear: both"></div>
     179<?php 
     180if($keyost_departmentsetting==1)
     181{
     182?>
    72183<div id="key4ce_new_ticket_catagory"><?php echo __('Catagories:','key4ce-osticket-bridge'); ?></div>
    73184<div id="key4ce_new_ticket_catagory_input">
     
    81192?>
    82193</select><font class="error">&nbsp;*</font></div>
    83 <div style="clear: both"></div>
    84 <!-- Help Topic Start Here -->         
    85 <div id="key4ce_new_ticket_helptopic">
    86         <?php echo __('Help Topic','key4ce-osticket-bridge'); ?>:
    87 </div>
    88 <div id="key4ce_new_ticket_helptopic_input">
    89 <select id="topicId" name="topicId">
    90 <option value="" selected="selected"><?php echo __('Select a Help Topic','key4ce-osticket-bridge'); ?></option>
    91 <?php foreach ($topic_opt as $topic) {
    92         echo '<option value="' . $topic->topic_id . '">' . $topic->topic . '</option>';
    93         }
    94         ?>               
    95         </select><font class="key4ce_error">&nbsp;*</font>
    96         </div>
    97 <div style="clear: both"></div>         <!-- Help Topic End Here -->
    98 <input type="hidden" value="2" name="priorityId" id="priority"/>
     194<div style="clear: both"></div> 
     195<?php
     196}
     197?>
     198<?php 
     199if($keyost_helptopicsetting==1)
     200{
     201?> 
     202<!-- Help Topic Start Here -->
     203<div id="key4ce_new_ticket_helptopic" style="display:none;"><?php echo __('Help Topic','key4ce-osticket-bridge'); ?>:</div>
     204<div id="key4ce_new_ticket_helptopic_input" style="display:none;"></div>
     205<div style="clear: both"></div>
     206<!-- Help Topic End Here -->
     207<?php
     208}
     209?>
    99210<div id="key4ce_new_ticket_subject"><?php echo __('Subject','key4ce-osticket-bridge'); ?>:</div>
    100211<div id="key4ce_new_ticket_subject_input">
     
    102213<div style="clear: both"></div>
    103214</div>
    104 <table align="center" cellpadding="3" cellspacing="3" border="0">
     215<table class="key4ce_welcome key4ce_nobd" align="center" cellpadding="3" cellspacing="3" border="0">
    105216<tr>
    106217<td class="key4ce_nobd" align="center"><div align="center" style="padding-bottom: 5px;"><?php echo __('To best assist you, please be specific and detailed in your message','key4ce-osticket-bridge'); ?><font class="error">&nbsp;*</font></div></td>
     
    115226<div class="key4ce_clear" style="padding: 5px;"></div></td>
    116227</tr>
     228    <?php
     229if ($attachement_status==1 || $attachement_status==true) {
     230    if(key4ce_getPluginValue('Attachments on the filesystem')==1)
     231    {
     232        ?>
     233            <tr><td>
     234                    <div id="addinput">
     235                        <p>
     236                            <span style="color:#000;"><?php echo __('Attachment 1:','key4ce-osticket-bridge'); ?></span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="file" id="p_new" name="file[]" onchange="return checkFile(this);"/>&nbsp;&nbsp;&nbsp;<a href="#" id="addNew"><?php echo __('Add','key4ce-osticket-bridge'); ?></a>&nbsp;&nbsp;&nbsp;<span style="color: red;font-size: 11px;"><?php echo __('Max file upload size :','key4ce-osticket-bridge'); ?><?php echo ($max_file_size * .0009765625) * .0009765625; ?>MB</span>
     237                        </p>
     238                    </div>
     239                </td></tr>
     240    <?php } else
     241    {
     242    ?>
     243     <tr><td><?php echo __('Attachments on the Filesystem plugin can be downloaded here:','key4ce-osticket-bridge'); ?><a href="http://osticket.com/download/go?dl=plugin%2Fstorage-fs.phar" title="Attachement Filesystem Plugin" target="_blank"><?php echo __('Attachement Filesystem Plugin','key4ce-osticket-bridge'); ?></a></td></tr>
     244    <?php
     245    }
     246    }
     247    ?>
     248<?php
     249if($googlesecretkey!="" && $googlesitekey!="")
     250{
     251?>
     252<script src='https://www.google.com/recaptcha/api.js'></script>
    117253<tr><td style="text-align: center;">
    118254<div class="g-recaptcha" data-sitekey="<?php echo $siteKey; ?>"></div>
    119 </td></tr>
     255</td>
     256</tr>
     257<?php } ?>
    120258<tr>
    121259<td class="nobd" align="center">
  • key4ce-osticket-bridge/trunk/templates/new_ticket.php

    r1226553 r1232492  
    11<?php
    22/* Template Name: new_ticket.php */
     3?>
     4<script type="text/javascript">
     5var ajaxurl = '<?php echo admin_url('admin-ajax.php'); ?>';
     6</script>
     7<?php
    38if($keyost_version==193)
    49{
     
    2328    return sprintf("'%s'", $str);
    2429}
    25 
    2630$extimp = implode(',', array_map('add_quotes', $allowedExts));
    2731$finalary = "'" . $extimp . "'";
     
    5458            return false;
    5559        });
     60        $("#deptId").change(function() {
     61        var dept_final_id=$("#deptId").val();
     62        var data = {
     63            action: 'get_helptopic_dropdown',
     64            dept_id: dept_final_id
     65        };
     66        // since 2.8 ajaxurl is always defined in the admin header and points to admin-ajax.php
     67        jQuery.post(ajaxurl, data, function(response) {
     68        if(response!="")
     69        {           
     70            $("#key4ce_new_ticket_helptopic").css("display", "block");
     71            $("#key4ce_new_ticket_helptopic_input").html(response);
     72            $("#key4ce_new_ticket_helptopic_input").css("display", "block");           
     73        }
     74        else if(response=="")
     75        {
     76            $("#key4ce_new_ticket_helptopic").css("display", "none");
     77            $("#key4ce_new_ticket_helptopic_input").css("display", "none");
     78        }       
     79        });
     80});
    5681    });
    5782</script>
     
    5984    function checkFile(fieldObj)
    6085    {
    61 
    6286        var FileName = fieldObj.value;
    6387        var FileId = fieldObj.id;
     
    6791        var FileExts = new Array(<?php echo $extimp; ?>);
    6892       
    69         if ((FileSize > <?php echo $max_file_size; ?>) || )
     93        if ((FileSize > <?php echo $max_file_size; ?>))
    7094        {
    7195            alert("<?php echo __("Please make sure your file is less than", 'key4ce-osticket-bridge'); ?> <?php echo ($max_file_size* .0009765625) * .0009765625; ?>MB.");
     
    133157            <div id="key4ce_new_ticket_catagory"><?php echo __('Catagories','key4ce-osticket-bridge'); ?>:</div>
    134158            <div id="key4ce_new_ticket_catagory_input">
     159            <!--onchange="loadHelptopic(this.value);" -->
    135160                <select id="deptId" name="deptId">
    136                     <option value="" selected="selected"><?php echo __('Select a Category','key4ce-osticket-bridge'); ?></option>
     161                    <option value="0" selected="selected"><?php echo __('Select a Category','key4ce-osticket-bridge'); ?></option>
    137162                    <?php
    138163                    foreach ($dept_opt as $dept) {
     
    142167                </select><font class="key4ce_error">&nbsp;*</font></div>
    143168            <div style="clear: both"></div>
     169           
    144170            <!-- Help Topic Start Here -->
    145             <div id="key4ce_new_ticket_helptopic"><?php echo __('Help Topic','key4ce-osticket-bridge'); ?>:</div>
    146             <div id="key4ce_new_ticket_helptopic_input">
    147                 <select id="topicId" name="topicId">
    148                     <option value="" selected="selected"><?php echo __('Select a Help Topic','key4ce-osticket-bridge'); ?></option>
    149                     <?php
    150                     foreach ($topic_opt as $topic) {
    151                         echo '<option value="' . $topic->topic_id . '">' . $topic->topic . '</option>';
    152                     }
    153                     ?>
    154                 </select><font class="key4ce_error">&nbsp;*</font></div>
     171            <div id="key4ce_new_ticket_helptopic" style="display:none;"><?php echo __('Help Topic','key4ce-osticket-bridge'); ?>:</div>
     172            <div id="key4ce_new_ticket_helptopic_input" style="display:none;"></div>
    155173            <div style="clear: both"></div>
    156174            <!-- Help Topic End Here -->
Note: See TracChangeset for help on using the changeset viewer.