Beispiel #1
0
 function unsubscribe()
 {
     $model_config = WYSIJA::get('config', 'model');
     // we need to call the translation otherwise it will not be loaded and translated
     $model_config->add_translated_default();
     $this->title = $model_config->getValue('unsubscribed_title');
     if (!isset($model_config->values['unsubscribed_title'])) {
         $this->title = __("You've unsubscribed!", WYSIJA);
     }
     $this->optional_subtitle = $model_config->getValue('unsubscribed_subtitle');
     if (!isset($model_config->values['unsubscribed_subtitle'])) {
         $this->optional_subtitle = __("Great, you'll never hear from us again!", WYSIJA);
     }
     $undo_paramsurl = array('wysija-page' => 1, 'controller' => 'confirm', 'action' => 'undounsubscribe', 'wysija-key' => $_REQUEST['wysija-key']);
     if (!isset($_REQUEST['demo'])) {
         if ($this->_testKeyuser()) {
             $statusint = (int) $this->userData['details']['status'];
             if ($model_config->getValue('confirm_dbleoptin') && $statusint > 0 || !$model_config->getValue('confirm_dbleoptin') && $statusint >= 0) {
                 $listids = $this->helperUser->unsubscribe($this->userData['details']['user_id']);
                 $this->helperUser->uid = $this->userData['details']['user_id'];
                 if ($model_config->getValue('emails_notified') && $model_config->getValue('emails_notified_when_unsub')) {
                     $this->helperUser->_notify($this->userData['details']['email'], false, $listids);
                 }
             } else {
                 $this->title = __('You are already unsubscribed.', WYSIJA);
                 return false;
             }
         }
     } else {
         $undo_paramsurl['demo'] = 1;
     }
     $link_undo = WYSIJA::get_permalink($model_config->getValue('unsubscribe_page'), $undo_paramsurl);
     $this->undo_unsubscribe = str_replace(array('[link]', '[/link]'), array('<a href="' . $link_undo . '">', '</a>'), '<p><b>' . __('You made a mistake? [link]Undo unsubscribe[/link].', WYSIJA)) . '</b></p>';
     return true;
 }
Beispiel #2
0
 function getVIB($dataEmail)
 {
     if (false && isset($dataEmail['params']['vib_id'])) {
         return WYSIJA::get_permalink($dataEmail['params']['vib_id'], false);
     } else {
         $paramsurl = array('wysija-page' => 1, 'controller' => "email", 'action' => "view", 'email_id' => $dataEmail["email_id"]);
         $modelConf =& WYSIJA::get("config", "model");
         return WYSIJA::get_permalink($modelConf->getValue("confirm_email_link"), $paramsurl);
     }
 }
Beispiel #3
0
 /**
  * return the online version link of a newsletter
  * @param int $email_id
  * @param string $text
  * @param string $urlOnly
  * @return string
  */
 function getPreviewLink($email_id, $text = false, $urlOnly = true)
 {
     if (!$text) {
         $text = __('View', WYSIJA);
     }
     $this->reset();
     $modelConf =& WYSIJA::get('config', 'model');
     $params = array('wysija-page' => 1, 'controller' => 'email', 'action' => 'view', 'email_id' => $email_id);
     $fullurl = WYSIJA::get_permalink($modelConf->getValue('confirm_email_link'), $params);
     if ($urlOnly) {
         return $fullurl;
     }
     return '<a href="' . $fullurl . '" target="_blank">' . $text . '</a>';
 }
Beispiel #4
0
 function genIframe($instance, $externalsite = false)
 {
     $now = time();
     if (isset($instance['preview'])) {
         unset($instance['preview']);
     }
     $encodedForm = base64_encode(json_encode($instance));
     $paramsurl = array('wysija-page' => 1, 'controller' => 'subscribers', 'action' => 'wysija_outter');
     if (isset($this->number) && $this->number > 0) {
         $paramsurl['widgetnumber'] = $this->number;
         $idframe = $this->number;
     } else {
         $paramsurl['fullWysijaForm'] = $encodedForm;
         $idframe = rand(45000, 99999);
     }
     $modelConf =& WYSIJA::get('config', 'model');
     $onloadattr = '';
     if ($externalsite) {
         $paramsurl['external_site'] = 1;
     } else {
         $onloadattr = 'onload="jQuery.WYSIJA_iframeloadhandler(this);"';
     }
     /*if(WYSIJA::is_plugin_active('wp-super-cache/wp-cache.php')){
           global $cache_page_secret;
           $paramsurl['donotcachepage']=$cache_page_secret;
       }*/
     //the final tru allow for shorter url
     $fullurl = WYSIJA::get_permalink($modelConf->getValue('confirm_email_link'), $paramsurl, true);
     //return '<iframe width="100%" scrolling="no" frameborder="0" src="'.$fullurl.'" name="wysija-'.$now.'" class="iframe-wysija" id="wysija-'.$idframe.'" vspace="0" tabindex="0" style="position: static; top: 0pt; margin: 0px; border-style: none; height: 330px; left: 0pt; visibility: visible;" marginwidth="0" marginheight="0" hspace="0" allowtransparency="true" title="'.__('Subscription Wysija',WYSIJA).'"></iframe>';
     return '<iframe ' . $onloadattr . ' width="100%" scrolling="no" frameborder="0" src="' . $fullurl . '" name="wysija-' . $now . '" class="iframe-wysija" id="wysija-' . $idframe . '" vspace="0" tabindex="0" style="position: static; top: 0pt; margin: 0px; border-style: none; height: 330px; left: 0pt; visibility: visible;" marginwidth="0" marginheight="0" hspace="0" allowtransparency="true" title="' . __('Subscription Wysija', WYSIJA) . '"></iframe>';
     //$fieldHTML='<div class="widget-control-actions">';
 }
Beispiel #5
0
 /**
  * Get unique link to the module and hook. This link will be displayed as an independent page and actually it renders [wysijap] postype
  * @param string $module_name
  * @param string $hook_name
  * @param array $params (key => value, key => value)
  * @return type
  */
 public static function get_module_link($module_name, $hook_name, $extended_plugin = 'wysija-newsletters', array $params = array())
 {
     $model_config = WYSIJA::get('config', 'model');
     $params = array_merge($params, array('wysija-page' => 1, 'controller' => 'module', 'action' => 'init', 'module' => $module_name, 'extension' => $extended_plugin, 'hook' => $hook_name));
     return WYSIJA::get_permalink($model_config->getValue('confirm_email_link'), $params);
 }
Beispiel #6
0
 /**
  * function used to generate the links if they are not valid anymore,
  * will be needed for old version of the plugin still using old unsafe links
  * @param int $user_id
  * @param int $email_id
  * @return string
  */
 function old_get_new_link_for_expired_links($user_id, $email_id)
 {
     $params = array('wysija-page' => 1, 'controller' => 'confirm', 'action' => 'resend', 'user_id' => $user_id, 'email_id' => $email_id);
     $model_config = WYSIJA::get('config', 'model');
     return WYSIJA::get_permalink($model_config->getValue('confirm_email_link'), $params);
 }
Beispiel #7
0
 public function export($form_id, $type)
 {
     switch ($type) {
         case 'iframe':
             $url_params = array('wysija-page' => 1, 'controller' => 'subscribers', 'action' => 'wysija_outter', 'wysija_form' => $form_id);
             $url_params['external_site'] = 1;
             $model_config = WYSIJA::get('config', 'model');
             $source_url = WYSIJA::get_permalink($model_config->getValue('confirm_email_link'), $url_params, true);
             return '<iframe width="100%" scrolling="no" frameborder="0" src="' . $source_url . '" class="iframe-wysija" vspace="0" tabindex="0" style="position: static; top: 0pt; margin: 0px; border-style: none; height: 330px; left: 0pt; visibility: visible;" marginwidth="0" marginheight="0" hspace="0" allowtransparency="true" title="' . __('Subscription Wysija', WYSIJA) . '"></iframe>';
             break;
         case 'php':
             $output = array('$widgetNL = new WYSIJA_NL_Widget(true);', 'echo $widgetNL->widget(array(\'form\' => ' . (int) $form_id . ', \'form_type\' => \'php\'));');
             return join("\n", $output);
             break;
         case 'html':
             //need some language for the validation
             $helper_toolbox = WYSIJA::get('toolbox', 'helper');
             $wp_language_code = $helper_toolbox->get_language_code();
             $wysija_version = WYSIJA::get_version();
             $scripts_to_include = '<!--START Scripts : this is the script part you can add to the header of your theme-->' . "\n";
             $scripts_to_include .= '<script type="text/javascript" src="' . includes_url() . 'js/jquery/jquery.js' . '?ver=' . $wysija_version . '"></script>' . "\n";
             if (file_exists(WYSIJA_DIR . 'js' . DS . 'validate' . DS . 'languages' . DS . 'jquery.validationEngine-' . $wp_language_code . '.js')) {
                 $scripts_to_include .= '<script type="text/javascript" src="' . WYSIJA_URL . 'js/validate/languages/jquery.validationEngine-' . $wp_language_code . '.js' . '?ver=' . $wysija_version . '"></script>' . "\n";
             } else {
                 $scripts_to_include .= '<script type="text/javascript" src="' . WYSIJA_URL . 'js/validate/languages/jquery.validationEngine-en.js' . '?ver=' . $wysija_version . '"></script>' . "\n";
             }
             $scripts_to_include .= '<script type="text/javascript" src="' . WYSIJA_URL . 'js/validate/jquery.validationEngine.js' . '?ver=' . $wysija_version . '"></script>' . "\n";
             $scripts_to_include .= '<script type="text/javascript" src="' . WYSIJA_URL . 'js/front-subscribers.js' . '?ver=' . $wysija_version . '"></script>' . "\n";
             $scripts_to_include .= '<script type="text/javascript">
             /* <![CDATA[ */
             var wysijaAJAX = {"action":"wysija_ajax","controller":"subscribers","ajaxurl":"' . admin_url('admin-ajax.php', 'absolute') . '","loadingTrans":"' . __('Loading...', WYSIJA) . '"};
             /* ]]> */
             </script>';
             $scripts_to_include .= '<script type="text/javascript" src="' . WYSIJA_URL . 'js/front-subscribers.js?ver=' . $wysija_version . '"></script>' . "\n";
             $scripts_to_include .= '<!--END Scripts-->' . "\n" . "\n";
             //enqueue the scripts
             $html_result = $scripts_to_include;
             // add the html for the form
             $widget_NL = new WYSIJA_NL_Widget(true);
             $html_result .= $widget_NL->widget(array('form' => (int) $form_id, 'form_type' => 'html'));
             return $html_result;
             break;
         case 'shortcode':
             return '[wysija_form id="' . (int) $form_id . '"]';
             break;
     }
 }
Beispiel #8
0
 /**
  * TODO should this method really be here?
  * It is used when rendering an email in the editor or before sending it
  * @param boolean $editor if the link is in the editor, then it will be a demo link
  * @return type
  */
 function view_in_browser_link($editor = false)
 {
     $data = array();
     if (!$this->getValue('viewinbrowser')) {
         return $data;
     }
     if (isset($this->values['viewinbrowser_linkname'])) {
         // Grab the value for the view in browser link
         $link = $this->values['viewinbrowser_linkname'];
     }
     // If we don't have the value from DB load a default
     if (!isset($link) || empty($link) || !$link) {
         $link = esc_attr__('Display problems? [link]View this newsletter in your browser.[/link]', WYSIJA);
     }
     // if we spot a link tag in the text we decompose the text in different parts pre rendering
     if (strpos($link, '[link]') !== false) {
         $linkpre = explode('[link]', $link);
         $data['pretext'] = $linkpre[0];
         $linkpost = explode('[/link]', $linkpre[1]);
         $data['posttext'] = $linkpost[1];
         $data['label'] = $linkpost[0];
         $data['link'] = '[view_in_browser_link]';
     } else {
         $data['pretext'] = $data['posttext'] = '';
         $data['label'] = $link;
         $data['link'] = '[view_in_browser_link]';
     }
     if ($editor) {
         $params_url = array('wysija-page' => 1, 'controller' => 'email', 'action' => 'view', 'email_id' => 0, 'user_id' => 0);
         if (!empty($_REQUEST['id'])) {
             $params_url['email_id'] = (int) $_REQUEST['id'];
         }
         $data['link'] = WYSIJA::get_permalink($this->getValue('confirm_email_link'), $params_url);
     }
     return $data;
 }
Beispiel #9
0
 /**
  * TODO should this method really be here?
  * It is used when rendering an email in the editor or before sending it
  * @param boolean $editor if the link is in the editor, then it will be a demo link
  * @return type
  */
 function viewInBrowserLink($editor = false)
 {
     $data = array();
     if ($this->getValue('viewinbrowser')) {
         $vib_link_text = '';
         // we us the user defined value or the predefined text
         if (!isset($this->values['viewinbrowser_linkname'])) {
             $vib_link_text = $this->cleanTrans(__('Display problems? [link]View this newsletter in your browser.[/link]', WYSIJA));
         } else {
             $vib_link_text = $this->getValue('viewinbrowser_linkname');
         }
         // if we spot a link tag in the text we decompose the text in different parts pre rendering
         if (strpos($vib_link_text, '[link]') !== false) {
             $linkpre = explode('[link]', $vib_link_text);
             $data['pretext'] = $linkpre[0];
             $linkpost = explode('[/link]', $linkpre[1]);
             $data['posttext'] = $linkpost[1];
             $data['label'] = $linkpost[0];
             $data['link'] = '[view_in_browser_link]';
         }
     }
     if ($editor) {
         $params_url = array('wysija-page' => 1, 'controller' => 'email', 'action' => 'view', 'email_id' => 0, 'user_id' => 0);
         if (!empty($_REQUEST['id'])) {
             $params_url['email_id'] = (int) $_REQUEST['id'];
         }
         $data['link'] = WYSIJA::get_permalink($this->getValue('confirm_email_link'), $params_url);
     }
     return $data;
 }
Beispiel #10
0
 /**
  * get view in browser link
  * @param array $dataEmail
  * @return string url
  */
 function getVIB($dataEmail)
 {
     if (false && isset($dataEmail['params']['vib_id'])) {
         return WYSIJA::get_permalink($dataEmail['params']['vib_id'], false);
     } else {
         $paramsurl = array('wysija-page' => 1, 'controller' => 'email', 'action' => 'view', 'email_id' => $dataEmail['email_id']);
         $modelConf = WYSIJA::get('config', 'model');
         return WYSIJA::get_permalink($modelConf->getValue('confirm_email_link'), $paramsurl);
     }
 }
Beispiel #11
0
    /**
     * TODO should this method really be here? It is used when rendering an email or when sending one
     * @param type $editor
     * @return type
     */
    function viewInBrowserLink($editor=false){
        $data=array();

        if($this->getValue('viewinbrowser')){
           $linkname='';
           if(!isset($this->values['viewinbrowser_linkname'])) $linkname=$this->cleanTrans(__('Display problems? [link]View this newsletter in your browser.[/link]',WYSIJA));
           else $linkname=$this->getValue('viewinbrowser_linkname');

            if(strpos($linkname, '[link]')!==false){
                $linkpre=explode('[link]', $linkname);
                $data['pretext']=$linkpre[0];
                $linkpost=explode('[/link]', $linkpre[1]);
                $data['posttext']=$linkpost[1];
                $data['label']=$linkpost[0];
                $data['link']='[view_in_browser_link]';
           }
        }
        $email_id=0;
        if($editor){
            $paramsurl=array(
                'wysija-page'=>1,
                'controller'=>"email",
                'action'=>"view",
                'email_id'=>$email_id,
                'user_id'=>0
                );
            if($email_id==0) $paramsurl['email_id']=$_REQUEST['id'];
            $data['link']=WYSIJA::get_permalink($this->getValue('confirm_email_link'),$paramsurl);
        }

        return $data;
    }
Beispiel #12
0
 function analyse()
 {
     if (isset($_REQUEST['debug'])) {
         if (version_compare(phpversion(), '5.4') >= 0) {
             error_reporting(E_ALL ^ E_STRICT);
         } else {
             error_reporting(E_ALL);
         }
         ini_set('display_errors', '1');
     }
     if (isset($_REQUEST['email_id']) && isset($_REQUEST['user_id'])) {
         $email_id = (int) $_REQUEST['email_id'];
         $user_id = (int) $_REQUEST['user_id'];
         if (isset($_REQUEST['debug'])) {
             echo '<h2>isset email_id and user_id</h2>';
         }
         $requesturlencoded = false;
         if (isset($_REQUEST['urlencoded'])) {
             $requesturlencoded = $_REQUEST['urlencoded'];
         } elseif (isset($_REQUEST['urlpassed'])) {
             $requesturlencoded = $_REQUEST['urlpassed'];
         }
         if ($requesturlencoded) {
             /* clicked stats */
             if (isset($_REQUEST['no64'])) {
                 $recordedUrl = $decodedUrl = $requesturlencoded;
             } else {
                 $recordedUrl = $decodedUrl = base64_decode($requesturlencoded);
             }
             if (strpos($recordedUrl, 'utm_source') !== false) {
                 $recordedUrl = $this->rm_url_param(array('utm_source', 'utm_campaign', 'utm_medium'), $recordedUrl);
             }
             if (isset($_REQUEST['debug'])) {
                 echo '<h2>isset urlencoded ' . $decodedUrl . '</h2>';
             }
             if ($email_id) {
                 //if not email_id that means it is an email preview
                 /* look for url entry and insert if not exists*/
                 $modelUrl =& WYSIJA::get('url', 'model');
                 $urlObj = $modelUrl->getOne(false, array('url' => $recordedUrl));
                 if (!$urlObj) {
                     /* we need to insert in url */
                     $modelUrl->insert(array('url' => $recordedUrl));
                     $urlObj = $modelUrl->getOne(false, array('url' => $recordedUrl));
                 }
                 $modelUrl = null;
                 /* look for email_user_url entry and insert if not exists*/
                 $modelEmailUserUrl = WYSIJA::get('email_user_url', 'model');
                 $dataEmailUserUrl = array('email_id' => $email_id, 'user_id' => $user_id, 'url_id' => $urlObj['url_id']);
                 $emailUserUrlObj = $modelEmailUserUrl->getOne(false, $dataEmailUserUrl);
                 $uniqueclick = false;
                 if (!$emailUserUrlObj) {
                     /* we need to insert in email_user_url */
                     $modelEmailUserUrl->reset();
                     $modelEmailUserUrl->insert($dataEmailUserUrl);
                     $uniqueclick = true;
                 }
                 /* increment stats counter on email_user_url clicked */
                 $modelEmailUserUrl = WYSIJA::get('email_user_url', 'model');
                 $modelEmailUserUrl->update(array('clicked_at' => time(), 'number_clicked' => '[increment]'), $dataEmailUserUrl);
                 $modelEmailUserUrl = null;
                 /* look for url_mail entry and insert if not exists*/
                 $modelUrlMail =& WYSIJA::get('url_mail', 'model');
                 $dataUrlEmail = array('email_id' => $email_id, 'url_id' => $urlObj['url_id']);
                 $urlMailObj = $modelUrlMail->getOne(false, $dataUrlEmail);
                 if (!$urlMailObj) {
                     /* we need to insert in url_mail */
                     $modelUrlMail->reset();
                     $modelUrlMail->insert($dataUrlEmail);
                 }
                 $dataUpdate = array('total_clicked' => '[increment]');
                 if (!$uniqueclick) {
                     $dataUpdate['unique_clicked'] = '[increment]';
                 }
                 /* increment stats counter on url_mail clicked */
                 $modelUrlMail->update($dataUpdate, $dataUrlEmail);
                 $modelUrlMail = null;
                 /* increment email_stat  clicked */
                 //$modelEmail=&WYSIJA::get("email","model");
                 //$modelEmail->update(array('number_clicked'=>"[increment]"),array("email_id"=>$email_id));
                 $statusEmailUserStat = 2;
                 if (in_array($recordedUrl, array('[unsubscribe_link]', '[subscriptions_link]', '[view_in_browser_link]'))) {
                     $this->subscriberClass =& WYSIJA::get('user', 'model');
                     $this->subscriberClass->getFormat = OBJECT;
                     $receiver = $this->subscriberClass->getOne($user_id);
                     switch ($recordedUrl) {
                         case '[unsubscribe_link]':
                             $link = $this->subscriberClass->getUnsubLink($receiver, true);
                             $statusEmailUserStat = 3;
                             break;
                         case '[subscriptions_link]':
                             $link = $this->subscriberClass->getEditsubLink($receiver, true);
                             break;
                         case '[view_in_browser_link]':
                             $modelEmail =& WYSIJA::get('email', 'model');
                             $dataEmail = $modelEmail->getOne(false, array('email_id' => $email_id));
                             $emailH =& WYSIJA::get('email', 'helper');
                             $link = $emailH->getVIB($dataEmail);
                             break;
                     }
                     $decodedUrl = $link;
                 } else {
                     if (strpos($decodedUrl, 'http://') === false && strpos($decodedUrl, 'https://') === false) {
                         $decodedUrl = 'http://' . $decodedUrl;
                     }
                     /*check that there is no broken unsubscribe link such as http://[unsubscribe_link] */
                     if (strpos($decodedUrl, '[unsubscribe_link]') !== false) {
                         $this->subscriberClass =& WYSIJA::get('user', 'model');
                         $this->subscriberClass->getFormat = OBJECT;
                         $receiver = $this->subscriberClass->getOne($user_id);
                         $decodedUrl = $this->subscriberClass->getUnsubLink($receiver, true);
                     }
                     if (strpos($decodedUrl, '[view_in_browser_link]') !== false) {
                         $paramsurl = array('wysija-page' => 1, 'controller' => 'email', 'action' => 'view', 'email_id' => $email_id, 'user_id' => 0);
                         $config =& WYSIJA::get('config', 'model');
                         $link = WYSIJA::get_permalink($config->getValue('confirm_email_link'), $paramsurl);
                         $decodedUrl = $link;
                     }
                 }
                 if (isset($_REQUEST['debug'])) {
                     echo '<h2>isset decoded url ' . $decodedUrl . '</h2>';
                 }
                 $modelEmailUS =& WYSIJA::get('email_user_stat', 'model');
                 $exists = $modelEmailUS->getOne(false, array('equal' => array('email_id' => $email_id, 'user_id' => $user_id), 'less' => array('status' => $statusEmailUserStat)));
                 $dataupdate = array('status' => $statusEmailUserStat);
                 if ($exists && isset($exists['opened_at']) && !(int) $exists['opened_at']) {
                     $dataupdate['opened_at'] = time();
                 }
                 //,'opened_at'=>time()
                 $modelEmailUS->reset();
                 $modelEmailUS->colCheck = false;
                 $modelEmailUS->update($dataupdate, array('equal' => array('email_id' => $email_id, 'user_id' => $user_id), 'less' => array('status' => $statusEmailUserStat)));
             } else {
                 if (in_array($recordedUrl, array('[unsubscribe_link]', '[subscriptions_link]', '[view_in_browser_link]'))) {
                     $modelU =& WYSIJA::get('user', 'model');
                     $modelU->getFormat = OBJECT;
                     $objUser = $modelU->getOne(false, array('wpuser_id' => get_current_user_id()));
                     switch ($recordedUrl) {
                         case '[unsubscribe_link]':
                             $link = $modelU->getConfirmLink($objUser, 'unsubscribe', false, true) . '&demo=1';
                             break;
                         case '[subscriptions_link]':
                             $link = $modelU->getConfirmLink($objUser, 'subscriptions', false, true) . '&demo=1';
                             //$link=$this->subscriberClass->getEditsubLink($receiver,true);
                             break;
                         case 'view_in_browser_link':
                             if (!$email_id) {
                                 $email_id = $_REQUEST['id'];
                             }
                             $paramsurl = array('wysija-page' => 1, 'controller' => 'email', 'action' => 'view', 'email_id' => $email_id, 'user_id' => 0, 'demo' => 1);
                             $config =& WYSIJA::get('config', 'model');
                             $link = WYSIJA::get_permalink($config->getValue('confirm_email_link'), $paramsurl);
                             break;
                     }
                     $decodedUrl = $link;
                 } else {
                     if (strpos($decodedUrl, 'http://') === false && strpos($decodedUrl, 'https://') === false) {
                         $decodedUrl = 'http://' . $decodedUrl;
                     }
                 }
                 if (isset($_REQUEST['debug'])) {
                     echo '<h2>not email_id </h2>';
                 }
             }
             /*sometimes this will be a life saver :)*/
             $decodedUrl = str_replace('&amp;', '&', $decodedUrl);
             if (isset($_REQUEST['debug'])) {
                 echo '<h2>final decoded url ' . $decodedUrl . '</h2>';
                 exit;
             }
             $this->redirect($decodedUrl);
         } else {
             /* opened stat */
             //$modelEmail=&WYSIJA::get("email","model");
             //$modelEmail->update(array('number_opened'=>"[increment]"),array("email_id"=>$email_id));
             $modelEmailUS =& WYSIJA::get('email_user_stat', 'model');
             $modelEmailUS->reset();
             $modelEmailUS->update(array('status' => 1, 'opened_at' => time()), array('email_id' => $email_id, 'user_id' => $user_id, 'status' => 0));
             header('Cache-Control: no-store, no-cache, must-revalidate');
             header('Cache-Control: post-check=0, pre-check=0', false);
             header('Pragma: no-cache');
             if (empty($picture)) {
                 $picture = WYSIJA_DIR_IMG . 'statpicture.png';
             }
             $handle = fopen($picture, 'r');
             if (!$handle) {
                 exit;
             }
             header('Content-type: image/png');
             $contents = fread($handle, filesize($picture));
             fclose($handle);
             echo $contents;
             exit;
         }
     }
     return true;
 }
Beispiel #13
0
 function getConfirmLink($userObj = false, $action = "subscribe", $text = false, $urlOnly = false)
 {
     if (!$text) {
         $text = __("Click here to subscribe", WYSIJA);
     }
     $userspreview = false;
     //if($action=='subscriptions')dbg($userObj);
     if (!$userObj) {
         //preview mode
         $userObj = $this->getCurrentSubscriber();
         $userspreview = true;
     }
     $params = array('wysija-page' => 1, 'controller' => "confirm");
     if ($userObj && isset($userObj->keyuser)) {
         if (!$userObj->keyuser) {
             $this->getKeyUser($userObj);
         }
         $this->reset();
         $params['wysija-key'] = $userObj->keyuser;
     }
     $params['action'] = $action;
     $modelConf =& WYSIJA::get("config", "model");
     if ($userspreview) {
         $params['demo'] = 1;
     }
     $fullurl = WYSIJA::get_permalink($modelConf->getValue("confirm_email_link"), $params);
     if ($urlOnly) {
         return $fullurl;
     }
     return '<a href="' . $fullurl . '" target="_blank">' . $text . '</a>';
 }
Beispiel #14
0
        function openrate_replaceusertags($email,$user){
                //$typemails=array('news','autonews','followup')

                $typemails=array(1,2,3);
		if(empty($email->type) OR !in_array($email->type,$typemails) OR strpos($email->body,'[nostatpicture]')){
			$email->body = str_replace(array('[statpicture]','[nostatpicture]'),'',$email->body);
			return;
		}
                $widths = range(1, 50);
                shuffle($widths);
                $heights = range(1, 3);
                shuffle($heights);
                /*$altTxt=array(__('Footer image',WYSIJA),__('Footer',WYSIJA),__('My footer image',WYSIJA));
                shuffle($altTxt);*/

		$widthsize = $widths[0];
		$heightsize = $heights[0];
		$width = empty($widthsize) ? '' : ' width="'.$widthsize.'" ';
		$height = empty($heightsize) ? '' : ' height="'.$heightsize.'" ';

                $modelConf=WYSIJA::get('config','model');

                $args = array();
                $args['email_id'] = $email->email_id;
                $args['user_id'] = $user->user_id;

                $args['controller'] = 'stats';

                $forbiddenparams=$modelConf->getValue('params_forbidden');
                if(isset($forbiddenparams['controller']['stats'])) $args['controller'] = $forbiddenparams['controller']['stats'];


                $args['action'] = 'analyse';
                $args['wysija-page'] = 1;
                $args['render'] = 1;

                $mytracker=WYSIJA::get_permalink($modelConf->getValue("confirm_email_link"),$args);
		$statPicture = '<img alt="" src="'.$mytracker.'"  border="0" '.$height.$width.'/>';

                if(strpos($email->body,'[statpicture]')) $email->body = str_replace('[statpicture]',$statPicture,$email->body);
		elseif(strpos($email->body,'</body>')) $email->body = str_replace('</body>',$statPicture.'</body>',$email->body);
		else $email->body .= $statPicture;

	 }
Beispiel #15
0
 function getResendLink($userid, $email_id)
 {
     $params = array('wysija-page' => 1, 'controller' => 'confirm', 'action' => 'resend', 'user_id' => $userid, 'email_id' => $email_id);
     $modelConf =& WYSIJA::get('config', 'model');
     return WYSIJA::get_permalink($modelConf->getValue('confirm_email_link'), $params);
 }
Beispiel #16
0
 function _get_browser_link($email_id){
     $paramsurl=array(
         'wysija-page'=>1,
         'controller'=>'email',
         'action'=>'view',
         'email_id'=>$email_id,
         'user_id'=>0
         );
     $config=WYSIJA::get('config','model');
     return WYSIJA::get_permalink($config->getValue('confirm_email_link'),$paramsurl);
 }
Beispiel #17
0
 function viewInBrowserLink($editor = false)
 {
     $data = array();
     if ($this->getValue('viewinbrowser')) {
         $linkname = $this->getValue('viewinbrowser_linkname');
         if (strpos($linkname, '[link]') !== false) {
             $linkpre = explode('[link]', $linkname);
             $data['pretext'] = $linkpre[0];
             $linkpost = explode('[/link]', $linkpre[1]);
             $data['posttext'] = $linkpost[1];
             $data['label'] = $linkpost[0];
             $data['link'] = '[view_in_browser_link]';
         }
     }
     $email_id = 0;
     if ($editor) {
         $paramsurl = array('wysija-page' => 1, 'controller' => "email", 'action' => "view", 'email_id' => $email_id, 'user_id' => 0);
         if ($email_id == 0) {
             $paramsurl['email_id'] = $_REQUEST['id'];
         }
         $data['link'] = WYSIJA::get_permalink($this->getValue("confirm_email_link"), $paramsurl);
     }
     return $data;
 }