Saturday, 22 September 2018

Redirect to a landing page after adding a new listing in Osclass

This code tested on Osclass 3.7.4
If you want to redirect to a static page after adding a new listing. You can get that result using the posted_item hook. Example:
    function redirect_to_landing($item) {
        osc_get_static_page('example_page');
        header('Location: ' . osc_static_page_url()); exit;
    }
    osc_add_hook('posted_item', 'redirect_to_landing');
    // add this code in the functions.php of your theme
The code from above would redirect to a static page that has example_page ( This is internal page name ) as a slug. So, remember that you will have to create first that static page.

If you want to redirect to a specific theme page after adding a new listing. You can get that result using the posted_item hook. Example:
The next example will redirect to the listing page:
    function redirect_to_landing($item) {
        View::newInstance()->_exportVariableToView('item', $item);
        header('Location: ' . osc_item_url()); exit;
    }
    osc_add_hook('posted_item', 'redirect_to_landing');
    // add this code in the functions.php of your theme
The hook posted_item it’s available since the version 2.0.

Saturday, 1 September 2018

Boxbilling Licence.php

Go to /bb-library/Box/License.php and edit

<?php
/**
 * BoxBilling
 *
 * @copyright BoxBilling, Inc (http://www.boxbilling.com)
 * @license   Apache-2.0
 *
 * Copyright BoxBilling, Inc
 * This source file is subject to the Apache-2.0 License that is bundled
 * with this source code in the file LICENSE
 */


class Box_License implements \Box\InjectionAwareInterface
{
    protected $di;

    public function setDi($di)
    {
        $this->di = $di;
    }

    public function getDi()
    {
        return $this->di;
    }

    /**
     * @return string
     */
    public function getKey()
    {
        return true;
    }

    public function check()
    {
        return ture;
    }

    public function isValid()
    {
        return true;
    }

    public function isPro()
    {
        return true;
    }

    private function getBBType()
    {
        return true;
    }

    public function getDetails($from_server = false)
    {
        return $data;
    }

    public function _getLicenseDetailsFromServer(array $servers)
    {
        $params = array();
        $params['license']  = $this->di['config']['license'];
        $params['host']     = BB_URL;
        $params['path']     = BB_PATH_ROOT;
        $params['version']  = \Box_Version::VERSION;
        $params['os']       = PHP_OS;
        $params['format']   = 2;

        return array();
    }

    private function _tryLicensingServer($url, $params)
    {
        $ch = curl_init();
        curl_setopt($ch, CURLOPT_URL, $url);
        curl_setopt($ch, CURLOPT_VERBOSE, 0);
        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
        curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 20);
        curl_setopt($ch, CURLOPT_TIMEOUT, 20);
        curl_setopt($ch, CURLOPT_POST, true);
        curl_setopt($ch, CURLOPT_POSTFIELDS, $params);
        $result = curl_exec($ch);

        curl_close($ch);
        return $result;
    }
}