dersam / rtphplib Goto Github PK
View Code? Open in Web Editor NEWPHP wrapper for the Request Tracker API
License: Other
PHP wrapper for the Request Tracker API
License: Other
The function "createTicket" should have similar logic to "doTicketReply", where newlines are replaced with "\n ".
Applications on shared hosting may not have access to pecl_http- a curl wrapper or another HTTP class should be integrated with the library to accommodate these situations.
Set up automated test suites and CI service.
Test harness should test multiple versions of RT.
Making an api request requires that the user look up all possible field names, and has no validation.
An api request should do the following:
Provide a way to add attachments to the content array when creating tickets.
Update documentation (code, wiki, and readme) for v2.
Add support for user creation via the api.
Hello,
RT version : 4.0.4
Just discovered RTPHPLIB I am having some problem using this lib.
I tried using example.php(doTicketReply and getTicketProperties) but none is working.
Url, user and pass is OK.
Even if a put a wrong password, I get only a blank page.
Is there a specific config to do or requirements in RT for RTPHPLib to work?
I can't find any usage information on google.
curl is installed on the server hosting RTPHPLib but RTPHPLIB is not installed on the same server as RT.
Hi, thank you for your great LIB, in my case I have some fields with multiline and your actual code doesn't work with them. So i modified your code to return all needed lines. And we can use this function with search format.
I hope that can help someone else :)
private function parseResponseBody(array $response, $delimiter = ':')
{
$responseArray = array();
$lastkey = null;
foreach ($response as $line) {
//RT will always preface a multiline with the length of the last key + length of $delimiter + one space)
if(! is_null($lastkey) && preg_match('/^\s{' . ( strlen($lastkey) + strlen($delimiter) + 1 ) . '}(.*)$/', $line, $matches)) {
$responseArray[$lastkey] .= "\n" . $matches[1];
}
elseif(! is_null($lastkey) && strlen($line) == 0) {
$lastkey = null;
}
elseif(preg_match('/^#/', $line, $matches)) {
$responseArray[$line] = '';
}
elseif(preg_match('~^([a-zA-Z0-9]+|CF\.{[^}]*})' . $delimiter . '\s+(.*)~', $line, $matches)) {
$responseArray[$lastkey = $matches[1]] = $matches[2];
}
elseif ((bool) $line) {
if (preg_match('/\s{4}/i', $line))
$line = preg_replace('/\s{4}/i', '', $line);
$responseArray[$lastkey] .= PHP_EOL . $line;
}
elseif(is_null($lastkey) && preg_match('/\t/', $line)) {
foreach ($response as $line) {
if (preg_match('/\t/', $line)) {
if (is_null($lastkey)) {
$lastkey ++;
$fields = explode("\t", $line);
}
elseif (! is_null($lastkey)) {
$result = explode("\t", $line);
foreach($fields as $key => $val) {
$combined[$val] = $result[$key];
}
$responseArray[] = $combined;
}
}
}
}
}
return $responseArray;
}
Hi,
I'm trying to attach an image in comment/reply using the method doTicketComment
for example and in the body of the ticket there is this message :
Message body is not shown because sender requested not to inline it
I understand that it is necessary to add the following option to CURLFIle Content-Disposition: attachment
.
Has anyone ever had the same problem ? Otherwise could you help me please ?
This is probably due to phpunit updates. Might be as simple as changing the phpunit version.
If the service fails to authenticate when not using a session cookie, there is no AuthenticationException thrown, as there is with the session cookie login. We should detect this failure and throw the necessary exception.
calling $rt->getTicketProperties($int)
after $rt->editTicket($int, $array)
will always response with "Ticket updated."
The reason is that $this->postFields
is still filled with data from $rt->editTicket($int, $array)
. Every method that doesn't need to submit 'content' should call $this->setPostFields('')
with an empty string to clear $this->postFields
.
issue with the multi-line custom field getting wrong values
used getTicketProperties to get details
$response = $rt->getTicketProperties(31);
Actual Result :
[CF.{Location}] => sdsfs fsd fsdf s
[ f sfs sdf fsd sdf ] =>
[ sdf sdf fsdf sdfsdfs] =>
[ fsdfsd fsdfsd fsfsd fsdf] =>
[ sd fsdf sfsdf s] =>
Expected result
CF.{Location}] => sdsfs fsd fsdf s
f sfs sdf fsd sdf
sdf sdf fsdf sdfsdfs
fsdfsd fsdfsd fsfsd fsdf
sd fsdf sfsdf s
Currently, the response body is returned as is. The library should provide a way to parse this into an easily manageable array structure.
Provide a loader script to include when not using composer.
After line 364 for file RequestTracker.php you add the following 2 lines to make SSL work
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
Is there a way to create, write or update a comment / response with a html formatted message ?
Every time i send a message it seems to just dump it as plain text.
5.3 is EOL and no longer supported, and we would like to use CurlObjects to manage attachment files, which is only available in 5.5+.
Version 2 will drop support for PHP 5.3 to allow use of this directly in the library.
See #44
getAttachment()
has a Content
-key. Unfortunately, the content of the corresponding value is crippled somewhere within RTPHPLib's code.
My tickets may contain an image. If getAttachment()
is used, the content of $response["Content"]
can't be displayed by any image viewer. Probably because RTPHPLib isn't binary-safe somewhere in it's logic.
As a work-around, I now use getAttachmentContent()
, which does work as needed.
parseArray and parseResponse are kind of hacked together. We can improve this parsing:
Provide a way to specify either attachment content directly, or to point to a file. Once created, the attachment reference should be stored in the current request and serialized at the point of dispatch.
Hello,
By the user interface of RT it is possible to add params for pagintation with:
&Page=1
&Rows=20
&RowsPerPage=20
but it looks like the search function in RTPHPLib doesn't provide a way for you to specify additional parameters. Do you know if is possible to do that?
Thanks a lot in advance
Iโm trying to send a comment in multi-lines to make it easier to read but it doesn't interpret the carriage return code \n
we tried with \r , \r\n and urlencode but none work
example text
"this is a test\nthis will not show or will crash"
ok not an issue, sorry for the post. Foud out that i need to leave a space after a carriage return to make it work.
PSR4. Backwards compatibility break.
I'm interested in specifying fields to return from, e.g., a ticket search (not just ticket id/title). I think it could be done pretty easily by just adding a parameter to the search function. I notice that there's already an open issue about that but it seems specifically to be about pagination, which might be more complicated. Thanks!
Having to specify username & password all the time is bad if you want to use rt's users and not have a global username/password for every request.
Probably needs the v2.0 tag
Calling $rt->doTicketReply($id, $content)
with a multiline Text it will only send the first line. The replace that adds the space after linebreak is missing in that method.
Hey,
I just wanted to let you know that the wiki is no longer up. Any ideas when it will be?
At line 250, in your getTicketHistory method, you have the following:
$url = $this->url."ticket/$ticketId/history?format=1";
This will actually return the short history for the ticket, as the format is not recognized. It should be:
$url = $this->url."ticket/$ticketId/history?format=l";
There is currently no test coverage for what happens when authentication fails.
Update PHPdoc, and generate docs site
Hi,
thanks for this great class, saved me a lot of work.
Search method contains assignment operators in stead of comparison operators.
if($format='s'){
$responseArray = static::parseResponse($response);
}
else if($format='i'){
return $response['body'];
}
else if($format='l'){
return $response['body'];
}
If the Subject field contains something like Request for user id: 123
, the parsing in parseLongFormatSearchResponse()
goes wrong. This is caused by the fact that the subjectline contains id:
.
Please cherry-pick petski@a60db5f to resolve this issue
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.