Skip to content
This repository was archived by the owner on Jul 30, 2021. It is now read-only.

Commit f5237cb

Browse files
committed
restored original files and go to Versino 1.6 ST.
1 parent 39b5779 commit f5237cb

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+952
-577
lines changed

api/api.inc.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
File included on every API page...handles security and abuse issues
66
77
Peter Rotich <[email protected]>
8-
Copyright (c) 2006,2007,2008,2009 osTicket
8+
Copyright (c) 2006-2010 osTicket
99
http://www.osticket.com
1010
1111
Released under the GNU General Public License WITHOUT ANY WARRANTY.

api/cron.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
File to handle cron job calls (local and remote).
66
77
Peter Rotich <[email protected]>
8-
Copyright (c) 2006,2007,2008,2009 osTicket
8+
Copyright (c) 2006-2010 osTicket
99
http://www.osticket.com
1010
1111
Released under the GNU General Public License WITHOUT ANY WARRANTY.

api/pipe.php

+8-12
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
Converts piped emails to ticket. Both local and remote!
77
88
Peter Rotich <[email protected]>
9-
Copyright (c) 2006,2007,2008,2009 osTicket
9+
Copyright (c) 2006-2010 osTicket
1010
http://www.osticket.com
1111
1212
Released under the GNU General Public License WITHOUT ANY WARRANTY.
@@ -89,7 +89,7 @@
8989
$var['pri']=$cfg->useEmailPriority()?$parser->getPriority():0;
9090

9191
$ticket=null;
92-
if(ereg ("[[][#][0-9]{1,10}[]]",$var['subject'],$regs)) {
92+
if(preg_match ("[[#][0-9]{1,10}]",$var['subject'],$regs)) {
9393
$extid=trim(preg_replace("/[^0-9]/", "", $regs[0]));
9494
$ticket= new Ticket(Ticket::getIdByExtId($extid));
9595
//Allow mismatched emails?? For now hell NO.
@@ -115,19 +115,15 @@
115115
}
116116
}
117117
//Ticket created...save attachments if enabled.
118-
$struct=$parser->getStruct();
119-
if($struct && $struct->parts && $cfg->allowEmailAttachments()) {
120-
for($i = 0; $i < count($struct->parts); $i++) {
121-
$part=$struct->parts[$i];
122-
if($part->disposition
123-
&& (!strcasecmp($part->disposition,'attachment') || !strcasecmp($part->disposition,'inline') || !strcasecmp($part->ctype_primary,'image'))){
124-
$filename=$part->d_parameters['filename'];
125-
if($filename && $cfg->canUploadFileType($filename)) {
126-
$ticket->saveAttachment($filename,$part->body,$msgid,'M');
118+
if($cfg->allowEmailAttachments()) {
119+
if($attachments=$parser->getAttachments()){
120+
//print_r($attachments);
121+
foreach($attachments as $k=>$attachment){
122+
if($attachment['filename'] && $cfg->canUploadFileType($attachment['filename'])) {
123+
$ticket->saveAttachment($attachment['filename'],$attachment['body'],$msgid,'M');
127124
}
128125
}
129126
}
130127
}
131-
//print_r($var);
132128
api_exit(EX_SUCCESS);
133129
?>

images/fibres.png

8.31 KB
Loading

images/home.gif

96 Bytes
Loading

images/icons/ticket.gif

117 Bytes
Loading

images/icons/ticket_source_email.gif

105 Bytes
Loading

images/icons/ticket_source_other.gif

117 Bytes
Loading

images/icons/ticket_source_phone.gif

96 Bytes
Loading

images/icons/ticket_source_web.gif

102 Bytes
Loading

images/lipsum.png

7.25 KB
Loading

images/logo2.jpg

-23.3 KB
Loading

images/logout.gif

216 Bytes
Loading

images/my_tickets.gif

-40 Bytes
Loading

images/new_ticket.gif

-39 Bytes
Loading

images/new_ticket_icon.jpg

19.5 KB
Loading

images/rainbow.png

16.9 KB
Loading

images/refresh_btn.gif

509 Bytes
Loading

images/ticket_status.gif

-39 Bytes
Loading

images/ticket_status_icon.jpg

19.2 KB
Loading

images/view_closed_btn.gif

4 Bytes
Loading

images/view_open_btn.gif

0 Bytes
Loading

include/ajax.kbase.php

+10-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
AJAX interface for knowledge base related...allowed methods.
66
77
Peter Rotich <[email protected]>
8-
Copyright (c) 2006,2007,2008,2009 osTicket
8+
Copyright (c) 2006-2010 osTicket
99
http://www.osticket.com
1010
1111
Released under the GNU General Public License WITHOUT ANY WARRANTY.
@@ -25,6 +25,15 @@ function cannedResp($params) {
2525
if(($res=db_query($sql)) && db_num_rows($res))
2626
list($response)=db_fetch_row($res);
2727

28+
if($response && $params['tid'] && strpos($response,'%')!==false) {
29+
include_once(INCLUDE_DIR.'class.ticket.php');
30+
31+
$ticket = new Ticket($params['tid']);
32+
if($ticket && $ticket->getId()){
33+
$response=$ticket->replaceTemplateVars($response);
34+
}
35+
}
36+
2837
return $response;
2938
}
3039
}

include/ajax.tickets.php

+23-3
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
AJAX interface for tickets
66
77
Peter Rotich <[email protected]>
8-
Copyright (c) 2006,2007,2008,2009 osTicket
8+
Copyright (c) 2006-2010 osTicket
99
http://www.osticket.com
1010
1111
Released under the GNU General Public License WITHOUT ANY WARRANTY.
@@ -23,7 +23,7 @@ class TicketsAjaxAPI{
2323

2424
function searchbyemail($params) {
2525

26-
$input = strtolower($params['input']);
26+
$input = db_input(strtolower($params['input']),false);
2727
$len = strlen($input);
2828
$limit = isset($params['limit']) ? (int) $params['limit']:25;
2929
$items=array();
@@ -41,7 +41,7 @@ function searchbyemail($params) {
4141

4242
function search($params) {
4343

44-
$input = strtolower($params['input']);
44+
$input = db_input(strtolower($params['input']),false);
4545
$len = strlen($input);
4646
$limit = isset($params['limit']) ? (int) $params['limit']:25;
4747
$items=array();
@@ -117,5 +117,25 @@ function renewLock($params) {
117117

118118
return '{"id":'.$lock->getId().', "time":'.$lock->getTime().'}';
119119
}
120+
121+
function releaseLock($params) {
122+
global $thisuser;
123+
124+
if($params['id'] && is_numeric($params['id'])){ //Lock Id provided!
125+
126+
$lock= new TicketLock($params['id']);
127+
//Already gone?
128+
if(!$lock->load() || !$lock->getStaffId() || $lock->isExpired()) //Said lock doesn't exist or is is expired
129+
return 1;
130+
131+
//make sure the user actually owns the lock before releasing it.
132+
return ($lock->getStaffId()==$thisuser->getId() && $lock->release())?1:0;
133+
134+
}elseif($params['tid']){ //release all the locks the user owns on the ticket.
135+
return TicketLock::removeStaffLocks($thisuser->getId(),$params['tid'])?1:0;
136+
}
137+
138+
return 0;
139+
}
120140
}
121141
?>

include/class.api.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ class.api.php
55
Api related functions...
66
77
Peter Rotich <[email protected]>
8-
Copyright (c) 2006,2007,2008,2009 osTicket
8+
Copyright (c) 2006-2010 osTicket
99
http://www.osticket.com
1010
1111
Released under the GNU General Public License WITHOUT ANY WARRANTY.

include/class.banlist.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ class.banlist.php
55
Banned emails handle.
66
77
Peter Rotich <[email protected]>
8-
Copyright (c) 2006,2007,2008,2009 osTicket
8+
Copyright (c) 2006-2010 osTicket
99
http://www.osticket.com
1010
1111
Released under the GNU General Public License WITHOUT ANY WARRANTY.

include/class.captcha.php

+55
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
<?php
2+
/*********************************************************************
3+
class.captcha.php
4+
5+
Very basic captcha class.
6+
7+
Peter Rotich <[email protected]>
8+
Copyright (c) 2006-2010 osTicket
9+
http://www.osticket.com
10+
11+
Released under the GNU General Public License WITHOUT ANY WARRANTY.
12+
See LICENSE.TXT for details.
13+
14+
vim: expandtab sw=4 ts=4 sts=4:
15+
$Id: $
16+
**********************************************************************/
17+
class Captcha {
18+
var $hash;
19+
var $bgimages=array('cottoncandy.png','grass.png','ripple.png','silk.png','whirlpool.png',
20+
'bubbles.png','crackle.png','lines.png','sand.png','snakeskin.png');
21+
var $font = 10;
22+
function Captcha($len=6,$font=7,$bg=''){
23+
24+
$this->hash = strtoupper(substr(md5(rand(0, 9999)),rand(0, 24),$len));
25+
$this->font = $font;
26+
27+
if($bg && !is_dir($bg)){ //bg file provided?
28+
$this->bgimg=$bg;
29+
}else{ //assume dir provided or defaults to local.
30+
$this->bgimg=rtrim($bg,'/').'/'.$this->bgimages[array_rand($this->bgimages, 1)];
31+
}
32+
}
33+
34+
function getImage(){
35+
36+
if(!extension_loaded('gd') || !function_exists('gd_info')) //GD ext required.
37+
return;
38+
39+
$_SESSION['captcha'] =''; //Clear
40+
41+
list($w,$h) = getimagesize($this->bgimg);
42+
$x = round(($w/2)-((strlen($this->hash)*imagefontwidth($this->font))/2), 1);
43+
$y = round(($h/2)-(imagefontheight($this->font)/2));
44+
45+
$img= imagecreatefrompng($this->bgimg);
46+
imagestring($img,$this->font, $x, $y,$this->hash,imagecolorallocate($img,0, 0, 0));
47+
48+
Header ("(captcha-content-type:) image/png");
49+
imagepng($img);
50+
imagedestroy($img);
51+
$_SESSION['captcha'] = md5($this->hash);
52+
}
53+
}
54+
55+
?>

include/class.client.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ class.client.php
88
At the moment we will play off the email + ticket ID authentication.
99
1010
Peter Rotich <[email protected]>
11-
Copyright (c) 2006,2007,2008,2009 osTicket
11+
Copyright (c) 2006-2010 osTicket
1212
http://www.osticket.com
1313
1414
Released under the GNU General Public License WITHOUT ANY WARRANTY.

include/class.config.php

+41-3
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ class.config.php
55
osTicket config info manager.
66
77
Peter Rotich <[email protected]>
8-
Copyright (c) 2006,2007,2008,2009 osTicket
8+
Copyright (c) 2006-2010 osTicket
99
http://www.osticket.com
1010
1111
Released under the GNU General Public License WITHOUT ANY WARRANTY.
@@ -258,6 +258,10 @@ function getLogGracePeriod(){
258258
return $this->config['log_graceperiod'];
259259
}
260260

261+
function logTicketActivity(){
262+
return $this->config['log_ticket_activity'];
263+
}
264+
261265
function clickableURLS() {
262266
return $this->config['clickable_urls']?true:false;
263267
}
@@ -266,6 +270,19 @@ function canFetchMail() {
266270
return $this->config['enable_mail_fetch']?true:false;
267271
}
268272

273+
function enableStaffIPBinding(){
274+
return $this->config['staff_ip_binding']?true:false;
275+
}
276+
277+
function enableCaptcha() {
278+
279+
//Checking it in real time!
280+
if(!extension_loaded('gd') || !function_exists('gd_info'))
281+
return false;
282+
283+
return $this->config['enable_captcha']?true:false;
284+
}
285+
269286
function enableAutoCron() {
270287
return $this->config['enable_auto_cron']?true:false;
271288
}
@@ -311,6 +328,11 @@ function autoRespONNewTicket() {
311328
function autoRespONNewMessage() {
312329
return $this->config['message_autoresponder']?true:false;
313330
}
331+
332+
function notifyONNewStaffTicket(){
333+
return $this->config['ticket_notice_active']?true:false;
334+
}
335+
314336
function alertONNewMessage() {
315337
return $this->config['message_alert_active']?true:false;
316338
}
@@ -498,12 +520,26 @@ function updatePref($var,&$errors) {
498520
if($var['strip_quoted_reply'] && !$var['reply_separator'])
499521
$errors['reply_separator']='Reply separator required (?)';
500522

523+
if($var['enable_captcha']){
524+
if (!extension_loaded('gd'))
525+
$errors['enable_captcha']='The GD extension required';
526+
elseif(!function_exists('imagepng'))
527+
$errors['enable_captcha']='PNG support required for Image Captcha';
528+
}
529+
530+
if(!$errors['admin_email'] && Email::getIdByEmail($var['admin_email'])) //Make sure admin email is not also a system email.
531+
$errors['admin_email']='Email already setup as system email';
532+
533+
534+
535+
501536
if($errors) return false; //No go!
502537

503538
//We are good to go...blanket update!
504539
$sql= 'UPDATE '.CONFIG_TABLE.' SET isonline='.db_input($var['isonline']).
505540
',timezone_offset='.db_input($var['timezone_offset']).
506541
',enable_daylight_saving='.db_input(isset($var['enable_daylight_saving'])?1:0).
542+
',staff_ip_binding='.db_input(isset($var['staff_ip_binding'])?1:0).
507543
',staff_max_logins='.db_input($var['staff_max_logins']).
508544
',staff_login_timeout='.db_input($var['staff_login_timeout']).
509545
',staff_session_timeout='.db_input($var['staff_session_timeout']).
@@ -526,16 +562,18 @@ function updatePref($var,&$errors) {
526562
',clickable_urls='.db_input(isset($var['clickable_urls'])?1:0).
527563
',allow_priority_change='.db_input(isset($var['allow_priority_change'])?1:0).
528564
',use_email_priority='.db_input(isset($var['use_email_priority'])?1:0).
565+
',enable_captcha='.db_input(isset($var['enable_captcha'])?1:0).
529566
',enable_auto_cron='.db_input(isset($var['enable_auto_cron'])?1:0).
530567
',enable_mail_fetch='.db_input(isset($var['enable_mail_fetch'])?1:0).
531568
',enable_email_piping='.db_input(isset($var['enable_email_piping'])?1:0).
532569
',send_sql_errors='.db_input(isset($var['send_sql_errors'])?1:0).
533570
',send_login_errors='.db_input(isset($var['send_login_errors'])?1:0).
534571
',save_email_headers='.db_input(isset($var['save_email_headers'])?1:0).
535572
',strip_quoted_reply='.db_input(isset($var['strip_quoted_reply'])?1:0).
536-
',email_attachments='.db_input(isset($var['email_attachments'])?1:0).
573+
',log_ticket_activity='.db_input(isset($var['log_ticket_activity'])?1:0).
537574
',ticket_autoresponder='.db_input($var['ticket_autoresponder']).
538575
',message_autoresponder='.db_input($var['message_autoresponder']).
576+
',ticket_notice_active='.db_input($var['ticket_notice_active']).
539577
',ticket_alert_active='.db_input($var['ticket_alert_active']).
540578
',ticket_alert_admin='.db_input(isset($var['ticket_alert_admin'])?1:0).
541579
',ticket_alert_dept_manager='.db_input(isset($var['ticket_alert_dept_manager'])?1:0).
@@ -562,7 +600,7 @@ function updatePref($var,&$errors) {
562600
',date_format='.db_input($var['date_format']).
563601
',datetime_format='.db_input($var['datetime_format']).
564602
',daydatetime_format='.db_input($var['daydatetime_format']).
565-
',reply_separator='.db_input($var['reply_separator']).
603+
',reply_separator='.db_input(trim($var['reply_separator'])).
566604
',admin_email='.db_input($var['admin_email']).
567605
',helpdesk_title='.db_input($var['helpdesk_title']).
568606
',helpdesk_url='.db_input($var['helpdesk_url']).

include/class.cron.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ class.cron.php
55
Nothing special...just a central location for all cron calls.
66
77
Peter Rotich <[email protected]>
8-
Copyright (c) 2006,2007,2008,2009 osTicket
8+
Copyright (c) 2006-2010 osTicket
99
http://www.osticket.com
1010
1111
Released under the GNU General Public License WITHOUT ANY WARRANTY.
@@ -35,7 +35,7 @@ function PurgeLogs() {
3535
Sys::purgeLogs();
3636
}
3737

38-
function run(){
38+
function run(){ //called by outside cron NOT autocron
3939
Cron::MailFetcher();
4040
Cron::TicketMonitor();
4141
cron::PurgeLogs();

include/class.dept.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ class.dept.php
55
Department class
66
77
Peter Rotich <[email protected]>
8-
Copyright (c) 2006,2007,2008,2009 osTicket
8+
Copyright (c) 2006-2010 osTicket
99
http://www.osticket.com
1010
1111
Released under the GNU General Public License WITHOUT ANY WARRANTY.
@@ -249,7 +249,7 @@ function save($id,$vars,&$errors) {
249249
if($id) {
250250
$sql='UPDATE '.DEPT_TABLE.' '.$sql.' WHERE dept_id='.db_input($id);
251251
if(!db_query($sql) || !db_affected_rows())
252-
$errors['err']='Unable to update '.Format::htmlchars($_POST['dept_name']).' Dept. Error occured';
252+
$errors['err']='Unable to update '.Format::input($_POST['dept_name']).' Dept. Error occured';
253253
}else{
254254
$sql='INSERT INTO '.DEPT_TABLE.' '.$sql.',created=NOW()';
255255
if(db_query($sql) && ($deptID=db_insert_id()))

0 commit comments

Comments
 (0)