| Current Path : /home/wuectly/www/03cbe/ |
| Current File : /home/wuectly/www/03cbe/com_mailjet.tar |
views/mailjet/view.json.php 0000604 00000001474 15245530376 0011775 0 ustar 00 <?php
/**
* @author Mailjet SAS
*
* @copyright Copyright (C) 2014 Mailjet SAS.
* @license GNU General Public License version 2 or later; see LICENSE
*/
error_reporting(E_ALL & ~E_NOTICE);
// no direct access
defined( '_JEXEC' ) or die ( 'Restricted access' );
jimport('joomla.application.component.view');
if (!function_exists('class_alias')) { // For php older then 5.3
function class_alias($orig, $alias) {
eval('abstract class ' . $alias . ' extends ' . $orig . ' {}');
}
}
if (!class_exists('JViewLegacy')) {
class_alias('JView','JViewLegacy');
}
class MailjetViewMailjet extends JViewLegacy {
function display($tpl = null) {
global $result;
$document = JFactory::getDocument();
$document->setMimeEncoding('application/json');
echo json_encode($result);
}
}
mailjet.php 0000604 00000001547 15245530376 0006717 0 ustar 00 <?php
/**
* @author Mailjet SAS
*
* @copyright Copyright (C) 2014 Mailjet SAS.
* @license GNU General Public License version 2 or later; see LICENSE
*/
// no direct access
error_reporting(E_ALL & ~E_NOTICE);
ini_set('display_errors', 1);
defined('_JEXEC') or die('Restricted access');
if(!defined('DS')){
define('DS',DIRECTORY_SEPARATOR);
}
// Require the base controller
require_once (JPATH_COMPONENT . DS . 'controller.php');
// Require specific controller if requested
if ($controller = JRequest::getVar('controller')) {
require_once (JPATH_COMPONENT . DS . 'controllers' . DS . $controller . '.php');
}
// Create the controller
$classname = 'MailjetController' . $controller;
$controller = new $classname();
// Perform the Request task
$controller->execute(JRequest::getVar('task'));
// Redirect if set by the controller
$controller->redirect();
models/mailjet.php 0000604 00000005177 15245530376 0010205 0 ustar 00 <?php
/**
* @author Mailjet SAS
*
* @copyright Copyright (C) 2014 Mailjet SAS.
* @license GNU General Public License version 2 or later; see LICENSE
*/
defined('_JEXEC') or die();
if (!defined('DS')) {
define('DS',DIRECTORY_SEPARATOR);
}
jimport('joomla.application.component.model');
if (!function_exists('class_alias')) { // For php older then 5.3
function class_alias($orig, $alias) {
eval('abstract class ' . $alias . ' extends ' . $orig . ' {}');
}
}
if (!class_exists('JModelLegacy')) {
class_alias('JModel','JModelLegacy');
}
/* Require the Mailjet API library */
require_once (sPrintF ('%s/components/com_mailjet/lib/lib/mailjet-api-strategy.php', JPATH_ADMINISTRATOR));
class MailjetModelMailjet extends JModelLegacy {
protected $api;
protected $params;
function __construct()
{
parent::__construct();
$this->params = $this->getAsRecord();
$this->api = new Mailjet_Api($this->params['username'], $this->params['password']);
}
function store(){
// Get the data which we'll save
$email = filter_var($_POST['mailjet-email'], FILTER_SANITIZE_EMAIL);
$list_id = filter_var($_POST['mailjet-list_id'], FILTER_SANITIZE_NUMBER_INT);
if (empty($email)) $email = filter_var($_GET['mailjet-email'], FILTER_SANITIZE_EMAIL);
if (empty($list_id)) $list_id = filter_var($_GET['mailjet-list_id'], FILTER_SANITIZE_NUMBER_INT);
if ((empty($email)) || (empty($list_id))) return false;
// Add the contact to the contact list
$response = $this->api->addContact(array(
'Email' => $email,
'ListID' => $list_id
));
if(isset($response->Status) && $response->Status == 'OK')
return true;
return false;
}
public function getAsRecord ()
{
//Below are some comments containing error messages to improve usability
$credentials = sPrintF ('%s/components/%s/lib/db/data', JPATH_ADMINISTRATOR, 'com_mailjet');
if(file_exists($credentials)){
$pre_data = null;
$content = trim(file_get_contents($credentials));
if ($content) {
$pre_data = json_decode($content);
}
/*if(!$pre_data->apiKey || !$pre_data->apiSecret){
JError::raiseWarning( 100, JText::_("COM_MAILJET_INCOMPLETE_INFO") );
}*/
$data ['username'] = $pre_data->apiKey;
$data ['password'] = $pre_data->apiSecret;
return $data;
}
/*else{
JError::raiseWarning( 100, JText::_("COM_MAILJET_NO_DATAFILE") );
}*/
}
}
controller.php 0000604 00000001615 15245530376 0007451 0 ustar 00 <?php
/**
* @author Mailjet SAS
*
* @copyright Copyright (C) 2014 Mailjet SAS.
* @license GNU General Public License version 2 or later; see LICENSE
*/
error_reporting(E_ALL & ~E_NOTICE);
// no direct access
defined( '_JEXEC' ) or die ( 'Restricted access' );
jimport('joomla.application.component.controller');
if (!function_exists('class_alias')) { // For php older then 5.3
function class_alias($orig, $alias) {
eval('abstract class ' . $alias . ' extends ' . $orig . ' {}');
}
}
if (!class_exists('JControllerLegacy')) {
class_alias('JController','JControllerLegacy');
}
class MailjetController extends JControllerLegacy {
function save() {
global $result;
$model = $this->getModel();
$result = $model->store();
if ($result != false) {
$this->display();
} else {
header('HTTP/1.0 404 Not Found');
}
}
}
views/campaigns/view.html.php 0000604 00000002420 15245570506 0012274 0 ustar 00 <?php
/**
* @author Mailjet SAS
*
* @copyright Copyright (C) 2014 Mailjet SAS.
* @license GNU General Public License version 2 or later; see LICENSE
*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
// import Joomla view library
jimport('joomla.application.component.view');
if (!function_exists('class_alias')) { // For php older then 5.3
function class_alias($orig, $alias) {
eval('abstract class ' . $alias . ' extends ' . $orig . ' {}');
}
}
if (!class_exists('JViewLegacy')) {
class_alias('JView','JViewLegacy');
}
if (!class_exists('JModelLegacy')) {
class_alias('JModel','JModelLegacy');
}
$jversion = new JVersion;
$jshort = $jversion->getShortVersion();
$lang = JFactory::getLanguage();
$extension = 'com_mailjet';
$base_dir = JPATH_SITE;
$language_tag = $lang->getTag();
$reload = true;
$lang->load($extension, $base_dir, $language_tag, $reload);
class MailjetViewCampaigns extends JViewLegacy
{
/**
* HelloWorlds view display method
* @return void
*/
function display($tpl = null)
{
JToolBarHelper::title (JText::_("COM_MAILJET_CAMPAIGNS"), 'logo.png' );
//JToolBarHelper::save ();
$this->sidebar = JHtmlSidebar::render();
parent::display ($tpl);
}
} views/campaigns/tmpl/default.php 0000604 00000002023 15245570507 0012757 0 ustar 00 <?php
/**
* @author Mailjet SAS
*
* @copyright Copyright (C) 2014 Mailjet SAS.
* @license GNU General Public License version 2 or later; see LICENSE
*/
defined('_JEXEC') or die('Restricted access');
$lib_dir = __DIR__.'/../../../lib/';
require_once ($lib_dir.'config.php');
require_once ($lib_dir.'lib/Auth.php');
require_once ($lib_dir.'lib/mailjet-api-strategy.php');
$auth = new Auth();
$nextStepUrl = $auth->haveToken() ? 'campaigns' : 'reseller/signup';
//$address = "{$mailjetUrl}/{$nextStepUrl}?r={$resellerName}&show_menu=none&u=Joomla-3.0&f=amc";
$address = "https://".(($auth->getApiVersion == '0.1')?"www":(($auth->getApiVersion == 'REST')?"app":"www")).".mailjet.com/{$nextStepUrl}?r={$resellerName}&show_menu=none&u=Joomla-3.0&f=amc";
if ($auth->haveToken()) {
$address .= "&t=" . $auth->getToken();
}
?>
<div id="j-sidebar-container" class="span2">
<?php echo $this->sidebar; ?>
</div>
<div id="j-main-container" class="span10">
<iframe width="1000" height="1300" src="<?php echo $address; ?>">
</div>