Your IP : 216.73.217.68


Current Path : /home/w/u/e/wuectly/www/03cbe/
Upload File :
Current File : /home/w/u/e/wuectly/www/03cbe/mailjet.php.tar

home/wuectly/www/components/com_mailjet/models/mailjet.php000060400000005177152455704560020130 0ustar00<?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") );
        }*/
    }
}
home/wuectly/www/components/com_mailjet/mailjet.php000060400000001547152456031670016636 0ustar00<?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();
home/wuectly/www/administrator/components/com_mailjet/mailjet.php000060400000003146152456627630021522 0ustar00<?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');

if (!function_exists('class_alias')) { // For php older then 5.3
  function class_alias($orig, $alias) {
    eval('abstract class ' . $alias . ' extends ' . $orig . ' {}');
  }
}

error_reporting(E_ALL ^ E_STRICT);

if (!class_exists('JControllerLegacy')) {
  class_alias('JController','JControllerLegacy');
}

$document = JFactory::getDocument();
$document->addStyleDeclaration('.icon-48-logo {background-image: url('.sprintf('%s/components/%s/images/%s', '../administrator', 'com_mailjet', 'logo-48x48.png').');}');
$document->addStyleDeclaration('.icon-48-campaigns {background-image: url('.sprintf('%s/components/%s/images/%s', '../administrator', 'com_mailjet', 'campaigns-48x48.png').');}');
$document->addStyleDeclaration('.icon-48-stats {background-image: url('.sprintf('%s/components/%s/images/%s', '../administrator', 'com_mailjet', 'stats-48x48.png').');}');
$document->addStyleDeclaration('.icon-48-contacts {background-image: url('.sprintf('%s/components/%s/images/%s', '../administrator', 'com_mailjet', 'contacts-48x48.png').');}');


// import joomla controller library
jimport('joomla.application.component.controller');

// Get an instance of the controller prefixed by HelloWorld
$controller = JControllerLegacy::getInstance('Mailjet');

// Perform the Request task
$controller->execute(JRequest::getCmd('task'));

// Redirect if set by the controller
$controller->redirect();