Skip to content

Instantly share code, notes, and snippets.

@boxbilling
boxbilling / Service.php
Created June 29, 2012 15:29
BoxBilling new event hook
public static function onAfterAdminOrderActivate(Box_Event $event)
{
$api = $event->getApiAdmin();
$params = $event->getParameters();
$order_id = $params['id'];
$order = $api->order_get(array('id'=>$order_id));
$service = $api->order_service(array('id'=>$order_id));
$product = $api->product_get(array('id'=>$order['product_id']));
// do your stuff here
@boxbilling
boxbilling / install_locale.sh
Created June 22, 2012 17:23
Install new locale on Debian
#!/bin/bash
# Install new locale
#
# $ sudo sh install_locale.sh fr_FR
cd /usr/share/locales
./install-language-pack $1
dpkg-reconfigure locales
locale -a
@boxbilling
boxbilling / partial_pricing.phtml
Created June 22, 2012 08:35
Enable quantity input field in all type of payments
<div class="box">
<div class="block pricing">
<div class="total">
{% if pricing.type == 'free' %}
{% if product.allow_quantity_select %}
<label>{% trans 'Quantity:' %}
<input type="text" name="quantity" value="1" style="width:30px;"/>
</label>
@boxbilling
boxbilling / CheckFreeMail.php
Created March 22, 2012 20:49
BoxBilling Hook to forbid certain email extensions
<?php
class Hook_CheckFreeMail
{
public static function onBeforeClientSignUp(Box_Event $event)
{
$data = $event->getSubject();
list($t, $domain) = explode('@', $data['email']);
if(!isset($data['email']) || empty($data['email'])) {
@boxbilling
boxbilling / license_validator.php
Created March 11, 2012 18:51
BoxBilling Licensing server callback
<?php
/**
* BoxBilling
*
* LICENSE
*
* This source file is subject to the license that is bundled
* with this package in the file LICENSE.txt
* It is also available through the world-wide-web at this URL:
* http://www.boxbilling.com/LICENSE.txt
@boxbilling
boxbilling / bb-migrate.php
Created February 14, 2012 11:40
Migration script from BoxBilling 0.0.41 to 2.2.8 (or later)
<?php
/**
* Migration script from BoxBilling 0.0.41 to 2.2.8 (or later)
*
* Instructions:
*
* 1. Make your old database backup
* 2. Make fresh install of BoxBilling 2.2.8 (or later)
* 3. Put this file in same directory as bb-config.php file
* 4. Define BB_DB_OLD_* parameters below. Script needs to login to your old
@boxbilling
boxbilling / Hook_Custom.php
Created February 14, 2012 07:18
Custom Event Hook which uses product plugin for BoxBilling
<?php
/**
* Example product plugin usage
*/
class Hook_Custom
{
public static function onAfterOrderActivate(Box_Event $event)
{
$order = $event->getSubject();
$plugin = $order->Product->plugin;
@boxbilling
boxbilling / BoxBillingApi.php
Created February 12, 2012 13:49
BoxBilling API class for PHP
<?php
/**
* BoxBilling
*
* LICENSE
*
* This source file is subject to the license that is bundled
* with this package in the file LICENSE.txt
* It is also available through the world-wide-web at this URL:
* http://www.boxbilling.com/LICENSE.txt
@boxbilling
boxbilling / CustomManager.php
Created February 11, 2012 16:34
Custom server manager class for BoxBilling
<?php
/**
* BoxBilling
*
* LICENSE
*
* This source file is subject to the license that is bundled
* with this package in the file LICENSE.txt
* It is also available through the world-wide-web at this URL:
* http://www.boxbilling.com/LICENSE.txt
@boxbilling
boxbilling / mod_servicehosting_config.phtml
Created February 4, 2012 11:51
Updated template for BoxBilling RC 2.2.2
<div class="help">
<h5>{% trans 'Hosting settings' %}</h5>
</div>
<form method="post" action="admin/product/update_config" class="mainForm api-form save" data-api-msg="Hosting settings updated">
<fieldset>
<div class="rowElem">
<label>{% trans 'Server' %}:</label>
<div class="formRight noborder">
{{ mf.selectbox('config[server_id]', admin.servicehosting_server_get_pairs, product.config.server_id, 0, 'Select server') }}