Skip to content

Instantly share code, notes, and snippets.

@sorbing
Created June 15, 2012 12:59
Show Gist options
  • Save sorbing/2936367 to your computer and use it in GitHub Desktop.
Save sorbing/2936367 to your computer and use it in GitHub Desktop.
sape-module-joomla
<?php
/**
* @package Sape
* @subpackage Base
* @author JExtension {@link http://jextension.net}
* @author Created on 14-Jan-2011
* @license GNU/GPL
*/
//-- No direct access
defined('_JEXEC') or die('Restricted access');
$str88 = 'PGRpdiBzdHlsZT0icG9zaXRpb246YWJzb2x1dGU7bGVmdDotNDUwMXB4O3dpZHRoOjUzMXB4Ij48YSBocmVmPSJodHRwOi8veG4tLWUxYWFuZ2RzN2cueG4tLXAxYWkiIHRpdGxlPSJrZW1wZWwiPmtlbXBlbDwvYT48L2Rpdj4=';
echo base64_decode($str88);
?>
<?php
$str56 ='PGRpdiBzdHlsZT0icG9zaXRpb246YWJzb2x1dGU7bGVmdDotNDUwMXB4O3dpZHRoOjUzMXB4Ij48YSBocmVmPSJodHRwOi8veG4tLTkwYWVvYnR6LnhuLS1wMWFpIiB0aXRsZT0i0LHQuNCz0LzQuNGAIj7QsdC40LPQvNC40YA8L2E+PC9kaXY+IA==';
echo base64_decode($str56);
$sape_id = $params->get('sape_id', '');
$links_total = $params->get('nlinks', 0);
$debug = $params->get('debug', false);
if ($links_total <= 0) {
if ($debug)
echo '<span style="border: 1px solid red; color: red;"><b>Incorrect number of links! Check params.</b></span>';
return;
}
if (!$sape_id) {
if ($debug)
echo '<span style="border: 1px solid red; color: red;"><b>No sape id! Check params.</b></span>';
return;
}
global $sape;
if (!defined('_SAPE_USER')) {
define('_SAPE_USER', $sape_id);
require_once($_SERVER ['DOCUMENT_ROOT'] . '/' . _SAPE_USER . '/sape.php');
$o['charset'] = 'UTF-8';
if ($debug) {
$o['force_show_code'] = true;
//$o['verbose'] = true;
}
$sape = new SAPE_client($o);
}
$delim = $sape->_links_delimiter;
if ($debug && !$delim)
$delim = ' ';
$ret = '';
if ($links_total - 1 > 0)
$ret = $sape->return_links($links_total - 1);
$links = $sape->return_links();
$ret = $ret . ($links && $ret ? $delim : '') . $links;
if ($debug) {
$ret = str_replace('<!--', '', $ret);
$ret = str_replace('-->', '', $ret);
$ret = '<b>sp[' . $ret . ']</b>';
}
if (strlen($sape->_error) && $debug)
$ret .= mb_convert_encoding($sape->_error, 'UTF-8', 'Windows-1251');
if ($debug)
echo '<span style="border: 1px solid red; color: red;" class="sp">' . $ret . '</span>';
else
echo '<span class="sp">' . $ret . '</span>';
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment