diff --git a/WHATSNEW.md b/WHATSNEW.md new file mode 100644 index 0000000000000000000000000000000000000000..d194837fe8d7c7444121a4ea6e7710402ca63abf --- /dev/null +++ b/WHATSNEW.md @@ -0,0 +1,14 @@ +osTicket v1.7 +============= + +New Features +============ +Version 1.7 includes several new features + +API +--- +Interface with osTicket via HTTP requests. Starting with version 1.7, +tickets are createable by submitting an HTTP POST request to either + + /api/tickets.xml + /api/tickets.json diff --git a/api/.htaccess b/api/.htaccess new file mode 100644 index 0000000000000000000000000000000000000000..e230ac6e186f66ada37cca3809396e32b98473e1 --- /dev/null +++ b/api/.htaccess @@ -0,0 +1,9 @@ +Options +FollowSymLinks +RewriteEngine On + +RewriteBase /api/ + +RewriteCond %{REQUEST_FILENAME} !-f +RewriteCond %{REQUEST_FILENAME} !-d + +RewriteRule ^(.*)$ http.php/$1 [L] diff --git a/include/class.format.php b/include/class.format.php index 0dbd9e1432215d57b92661e99acfe761fa96b522..45f4301913072fa49d93d7dc3a10019b82536563 100644 --- a/include/class.format.php +++ b/include/class.format.php @@ -117,10 +117,12 @@ class Format { function clickableurls($text) { //Not perfect but it works - please help improve it. - $text=preg_replace('/(((f|ht){1}tp(s?):\/\/)[-a-zA-Z0-9@:%_\+.~#?&;\/\/=]+)/','<a href="\\1" target="_blank">\\1</a>', $text); + $text=preg_replace('/(((f|ht){1}tp(s?):\/\/)[-a-zA-Z0-9@:%_\+.~#?&;\/\/=]+)/', + '<a href="l.php?url=\\1" target="_blank">\\1</a>', $text); $text=preg_replace("/(^|[ \\n\\r\\t])(www\.([a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]+)+)(\/[^\/ \\n\\r]*)*)/", - '\\1<a href="http://\\2" target="_blank">\\2</a>', $text); - $text=preg_replace("/(^|[ \\n\\r\\t])([_\.0-9a-z-]+@([0-9a-z][0-9a-z-]+\.)+[a-z]{2,4})/",'\\1<a href="mailto:\\2" target="_blank">\\2</a>', $text); + '\\1<a href="l.php?url=http://\\2" target="_blank">\\2</a>', $text); + $text=preg_replace("/(^|[ \\n\\r\\t])([_\.0-9a-z-]+@([0-9a-z][0-9a-z-]+\.)+[a-z]{2,4})/", + '\\1<a href="l.php?url=mailto:\\2" target="_blank">\\2</a>', $text); return $text; } diff --git a/include/class.misc.php b/include/class.misc.php index c9a5db034865db1ac621948aacd3a03b9a919b1b..d9f59f47858b23c9c47c2de6ea6c3cedfda61df1 100644 --- a/include/class.misc.php +++ b/include/class.misc.php @@ -139,6 +139,22 @@ class Misc { return $output; } - + function siteBaseUrl() { + # Detects Alias-ing + $paths = explode('/', $_SERVER['REQUEST_URI']); + # Drop the last item -- it will be the php page we're on + array_pop($paths); + $leading = array(); + while (count($paths)) { + if (in_array($paths[0], array('scp','client'))) + break; + $leading[] = array_shift($paths); + } + if (count($leading) > 1) + return implode('/', $leading); + else + return ''; + } + } ?> diff --git a/l.php b/l.php new file mode 100644 index 0000000000000000000000000000000000000000..657952e266f1498846db84c663e135997ecb242f --- /dev/null +++ b/l.php @@ -0,0 +1,29 @@ +<?php +/********************************************************************* + l.php + + Link redirection + + Jared Hancock <jared@osticket.com> + Copyright (c) 2006-2012 osTicket + http://www.osticket.com + + Released under the GNU General Public License WITHOUT ANY WARRANTY. + See LICENSE.TXT for details. + + vim: expandtab sw=4 ts=4 sts=4: +**********************************************************************/ +require 'secure.inc.php'; + +global $_GET; +$url = $_GET['url']; +if (!$url) exit(); +?> +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> + <meta http-equiv="content-type" content="text/html; charset=utf-8"/> + <meta http-equiv="refresh" content="0;<?php echo $url; ?>"/> +</head> +<body/> +</html> diff --git a/scp/l.php b/scp/l.php new file mode 100644 index 0000000000000000000000000000000000000000..2c66c2835eefcafb6711416228fa985878c43428 --- /dev/null +++ b/scp/l.php @@ -0,0 +1,29 @@ +<?php +/********************************************************************* + l.php + + Link redirection + + Jared Hancock <jared@osticket.com> + Copyright (c) 2006-2012 osTicket + http://www.osticket.com + + Released under the GNU General Public License WITHOUT ANY WARRANTY. + See LICENSE.TXT for details. + + vim: expandtab sw=4 ts=4 sts=4: +**********************************************************************/ +require_once 'staff.inc.php'; + +global $_GET; +$url = $_GET['url']; +if (!$url) exit(); +?> +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> + <meta http-equiv="content-type" content="text/html; charset=utf-8"/> + <meta http-equiv="refresh" content="0;<?php echo $url; ?>"/> +</head> +<body/> +</html>