Skip to content

Instantly share code, notes, and snippets.

View clonemeagain's full-sized avatar
💭
I may be slow to respond.

Aaron clonemeagain

💭
I may be slow to respond.
View GitHub Profile
@clonemeagain
clonemeagain / apache_php_errors.log
Created April 14, 2019 05:59
Osticket plugin test - archiver
This file has been truncated, but you can view the full file.
[Sun Apr 14 05:55:45.358231 2019] [php7:notice] [pid 24] [client 10.0.2.2:51644] STRICT error Non-static method Misc::currentURL() should not be called statically at /data/upload/bootstrap.php:388 n, referer: http://localhost:8080/scp/
[Sun Apr 14 05:55:45.358400 2019] [php7:notice] [pid 24] [client 10.0.2.2:51644] STRICT error Undefined index: HTTPS at /data/upload/include/class.misc.php:229 n, referer: http://localhost:8080/scp/
[Sun Apr 14 05:55:45.358479 2019] [php7:notice] [pid 24] [client 10.0.2.2:51644] STRICT error Non-static method Bootstrap::loadConfig() should not be called statically at /data/upload/main.inc.php:24 n, referer: http://localhost:8080/scp/
[Sun Apr 14 05:55:45.361491 2019] [php7:notice] [pid 24] [client 10.0.2.2:51644] STRICT error Non-static method Bootstrap::i18n_prep() should not be called statically at /data/upload/main.inc.php:26 n, referer: http://localhost:8080/scp/
[Sun Apr 14 05:55:45.361603 2019] [php7:notice] [pid 24] [client 10.0.2.2:51644] STRICT error iconv_set_encoding
@clonemeagain
clonemeagain / custom.php
Created July 5, 2018 05:16
Example of custom code for osTicket hacking.
<?php
// stored in /include/custom.php
// A private database connection to fetch data for the sales team:
class SalesDB
{
private $db;
public function __construct()
{
$this->db = new mysqli("server", 'username', 'pass', 'database_name'); //etc
$this->db->set_charset("utf8");
@clonemeagain
clonemeagain / rcron.php
Last active September 27, 2017 13:05
Example Remote osTicket Cron script, with instructions on how to call it remotely.
#!/usr/bin/php -q
<?php
/*********************************************************************
rcron.php
PHP script used for remote cron calls.
To make this work, setup an API key for localhost with ip: 127.0.0.1
Put this script in the root of your webserver, then call it
#!/bin/python3
import json
import urllib2
'''
Loads as many settings as makes sense for every domain in your account
Then stores those settings in a json file named for the domain.
'''
api_prefix = 'https://api.cloudflare.com/client/v4/zones/'
@clonemeagain
clonemeagain / osTicket 1.7 class.file.php modification.php
Last active June 29, 2017 14:39
Patch to prevent deleting osTicket tickets from being too brutal.. especially when large number of database attachments exist.
Example crontab, every Friday night etc:
#m h dom mon dow command
0 23 * * 5 /path/to/support/prune_files.php
@clonemeagain
clonemeagain / gist:846abb02c9507bdc62d4440ac37a2103
Created June 13, 2016 23:11
Monitoring osTicket unassigned and open ticket count with Nagios3
An example service definition for nagios that assumes you have the following information:
$DATABASE_{HOST,NAME,USER,PASS} for connecting to the database
$DOMAIN = to create a Nagios link
$PREFIX = what you used to prefix your db in osTicket (commonly ost)
Ensure check_mysql_query is installed and working, create a read-only db-user from your nagios host to your database,
tweak the open and unassigned ticket count to your liking, in this example 100 = warning, 250 = critical
define service {
host_name $DATABASE_HOST
service_description OsTickets Open Tickets
@clonemeagain
clonemeagain / remote_shutdown_lifesize.py
Created July 28, 2015 06:55
LifeSize support said we should write a python mechanize script to shutdown the server via script.. this is an implementation of that! https://community.lifesize.com/thread/2249
import mechanize
import cookielib
import urllib2
# Configure the server IP, Username & Password (defaults provided)
server='10.0.0.1:8181'
username='administrator'
password='admin123'
# Using mechanize: http://wwwsearch.sourceforge.net/mechanize/
@clonemeagain
clonemeagain / Custom Scripted Filters for osTicket
Last active January 4, 2016 13:08
Create custom PHP Actions for osTicket filter rules.
From 49c17afdb035cf825288613cc1011aeb86ebdb01 Mon Sep 17 00:00:00 2001
From: Grizly <clonemeagain@gmail.com>
Date: Sun, 26 Jan 2014 10:44:36 +1100
Subject: [PATCH 1/1] Actual changes to osTicket to implement Custom PHP file
actions for Ticket Filters.
---
include/class.filter.php | 7 +++++++
include/staff/filter.inc.php | 20 ++++++++++++++++++++
2 files changed, 27 insertions(+), 0 deletions(-)
@clonemeagain
clonemeagain / List of changes.php
Last active August 15, 2022 01:18
Adds onClose notification template functionality to osTicket 1.8
I've just trawled the code (including latest dev), and no, there is no part of it which will do that..
Shouldn't be too hard to implement though, just a few modifications, and a single db entry!
First, Run this query to create the template:
<?php
INSERT INTO `tickets`.`ost_email_template` (`id`, `tpl_id`, `code_name`, `subject`, `body`, `created`, `updated`) VALUES (NULL, 1, 'ticket.close', '[#%{ticket.number}] %{ticket.subject}', '%{ticket.name},
Our customer care team has closed the ticket, #%{ticket.number} on your behalf.
@clonemeagain
clonemeagain / testParsePriority.php
Last active January 1, 2016 00:19
Test file to analyze the best algorithm for parsePriority.. ;-) Modified to include "Importance" header and string based values.
<?php
define ( 'HIGH_PRIORITY', 1 );
define ( 'NORMAL_PRIORITY', 2 );
define ( 'LOW_PRIORITY', 3 );
define ( 'NO_PRIORITY', 0 );
echo "Time to beat: 0.027ms\n";
test ( 'StrPos', 'strposversion' );
test ( 'PregMatch', 'pregmatchversion' );