Esempio n. 1
0
 function getPaymentVars($pg_plugin, $order_id, $payPerAd = 0)
 {
     global $mainframe;
     $mainframe = JFactory::getApplication();
     require JPATH_SITE . DS . "administrator" . DS . "components" . DS . "com_socialads" . DS . "config" . DS . "config.php";
     $orderdata = $this->getdetails($order_id);
     $vars = new stdclass();
     $vars->order_id = $orderdata['order_id'];
     $socialadshelper = new socialadshelper();
     $orderdata['ad_title'] = $socialadshelper->getAdInfo($orderdata['adid'], 'ad_title');
     // ck if not require
     if (!empty($orderdata['payment_type'])) {
         $vars->payment_type = $orderdata['payment_type'];
     } else {
         $vars->payment_type = "";
     }
     $order_user = JFactory::getUser($orderdata['user']);
     $vars->user_id = $orderdata['user'];
     //JFactory::getUser()->id;
     $vars->user_name = $order_user->name;
     $vars->user_firstname = $order_user->name;
     $vars->user_email = $order_user->email;
     if ($socialads_config['select_campaign'] == 1) {
         $vars->item_name = JText::_('COM_SOCIALADS_ADWALLET_PAYMENT_DISC');
     } else {
         $vars->item_name = JText::_('COM_SOCIALADS_PER_AD_PAYMENT_DISC') . $orderdata['ad_title']['0']->ad_title;
     }
     $msg_fail = JText::_('ERROR_SAVE');
     $calledFrom = "&adminCall=0";
     if ($mainframe->isAdmin()) {
         $calledFrom = "&adminCall=1";
         $vars->return = JRoute::_(JUri::root() . "administrator/index.php?option=com_socialads&view=approveads" . $calledFrom, false);
     } else {
         $defaultMsg = '';
         if ($pg_plugin == 'paypal') {
             $defaultMsg = "&saDefMsg=1";
         }
         $vars->return = JRoute::_(JUri::root() . "index.php?option=com_socialads&view=managead&layout=list" . $defaultMsg, false);
     }
     if (empty($payPerAd)) {
         if ($mainframe->isAdmin()) {
             $vars->submiturl = JRoute::_(JUri::root() . "administrator/index.php?com_socialads&view=adorders", $msg_fail);
         } else {
             $vars->submiturl = JRoute::_("index.php?option=com_socialads&controller=payment&task=confirmpayment&processor={$pg_plugin}", false);
         }
     } else {
         if ($mainframe->isAdmin()) {
             $vars->submiturl = JRoute::_(JUri::root() . "administrator/index.php?com_socialads&view=adorders", $msg_fail);
         } else {
             $vars->submiturl = JRoute::_("index.php?option=com_socialads&controller=showad&task=confirmpayment&processor={$pg_plugin}", false);
         }
     }
     // CANCEL URL
     if ($mainframe->isAdmin()) {
         $vars->cancel_return = JRoute::_(JUri::root() . "administrator/index.php?com_socialads&view=adorders", $msg_fail);
     } else {
         $vars->cancel_return = JRoute::_(JUri::root() . "index.php?option=com_socialads&view=managead&layout=list&processor={$pg_plugin}", $msg_fail);
     }
     if (empty($payPerAd)) {
         $vars->url = $vars->notify_url = JRoute::_(JUri::root() . "?option=com_socialads&controller=payment&task=processpayment&pg_nm={$pg_plugin}&pg_action=onTP_Processpayment&order_id=" . $orderdata['order_id'] . "&original_amt=" . $orderdata['original_amount'] . $calledFrom, false);
     } else {
         $vars->url = $vars->notify_url = JRoute::_(JUri::root() . "?option=com_socialads&controller=showad&task=processpayment&pg_nm={$pg_plugin}&pg_action=onTP_Processpayment&order_id=" . $orderdata['order_id'] . "&original_amt=" . $orderdata['original_amount'] . $calledFrom, false);
     }
     $vars->currency_code = $socialads_config['currency'];
     $vars->amount = $orderdata['amount'];
     $vars->client = "socialads";
     $vars->success_message = $orderdata['success_message'];
     if ($vars->payment_type == 'recurring') {
         $vars->notify_url = $vars->url = $vars->url . "&payment_type=recurring";
         $vars->recurring_startdate = $orderdata['recurring_startdate'];
         $vars->recurring_payment_interval_unit = "days";
         $vars->recurring_payment_interval_totaloccurances = $orderdata['recurring_payment_interval_totaloccurances'];
         $vars->recurring_payment_interval_length = $orderdata['recurring_payment_interval_length'];
     }
     $vars->userInfo = $this->userInfo($order_id, $orderdata['user']);
     return $vars;
 }
Esempio n. 2
0
 function getHTML($orderdata)
 {
     require JPATH_SITE . DS . "administrator" . DS . "components" . DS . "com_socialads" . DS . "config" . DS . "config.php";
     $pg_plugin = $orderdata['pg_plugin'];
     $dispatcher = JDispatcher::getInstance();
     JPluginHelper::importPlugin('payment', $pg_plugin);
     $session = JFactory::getSession();
     $vars = new stdclass();
     $vars->order_id = $orderdata['order_id'];
     $socialadshelper = new socialadshelper();
     $orderdata['ad_title'] = $socialadshelper->getAdInfo($orderdata['adid'], 'ad_title');
     if (!empty($orderdata['payment_type'])) {
         $vars->payment_type = $orderdata['payment_type'];
     } else {
         $vars->payment_type = "";
     }
     $vars->user_id = JFactory::getUser()->id;
     $vars->user_name = JFactory::getUser()->name;
     $vars->user_firstname = JFactory::getUser()->name;
     $vars->user_email = JFactory::getUser()->email;
     $vars->item_name = JText::_('ADVERTISEMENT') . $orderdata['ad_title']['0']->ad_title;
     $msg_fail = JText::_('ERROR_SAVE');
     $vars->return = JRoute::_(JUri::root() . "index.php?option=com_socialads&view=managead&layout=list");
     $vars->submiturl = JRoute::_("index.php?option=com_socialads&controller=showad&task=confirmpayment&processor={$pg_plugin}");
     $vars->cancel_return = JRoute::_(JUri::root() . "index.php?option=com_socialads&view=managead&layout=list&processor={$pg_plugin}", $msg_fail);
     $vars->url = $vars->notify_url = JRoute::_(JUri::root() . "?option=com_socialads&controller=showad&task=processpayment&pg_nm={$pg_plugin}&pg_action=onTP_Processpayment&order_id=" . $orderdata['order_id']);
     $vars->currency_code = $socialads_config['currency'];
     $vars->amount = $orderdata['amount'];
     $vars->client = "socialads";
     $vars->success_message = $orderdata['success_message'];
     if ($vars->payment_type == 'recurring') {
         $vars->notify_url = $vars->url = $vars->url . "&payment_type=recurring";
         $vars->recurring_startdate = $orderdata['recurring_startdate'];
         $vars->recurring_payment_interval_unit = "days";
         $vars->recurring_payment_interval_totaloccurances = $orderdata['recurring_payment_interval_totaloccurances'];
         $vars->recurring_payment_interval_length = $orderdata['recurring_payment_interval_length'];
     }
     $html = $dispatcher->trigger('onTP_GetHTML', array($vars));
     return $html[0];
     jexit();
 }
Esempio n. 3
0
 function sendStatsEmail_body($statsforpie, $userinfo)
 {
     global $mainframe;
     $socialadshelper = new socialadshelper();
     $email = $userinfo['email'];
     $adid = $statsforpie[2];
     $clicks_pie = $imprs_pie = $total_no_ads = 0;
     $mainframe = JFactory::getApplication();
     $ad_data = $socialadshelper->getAdInfo($adid, 'ad_title');
     $ad_title = $ad_data[0]->ad_title != '' ? JText::_("PERIDIC_STATS_ADTIT") . ' <b>"' . $ad_data[0]->ad_title . '"</b>' : JText::_("PERIDIC_STATS_ADID") . ' : <b>' . $adid . '</b>';
     $itemid = $socialadshelper->getSocialadsItemid('buildad');
     $edit_ad_link = JRoute::_(JUri::base() . "index.php?option=com_socialads&view=buildad&adid=" . $adid . "&Itemid=" . $itemid);
     if (isset($statsforpie[1][0]->value)) {
         $clicks_pie = $statsforpie[1][0]->value;
     }
     if (isset($statsforpie[0][0]->value)) {
         $imprs_pie = $statsforpie[0][0]->value;
     }
     if ($clicks_pie || $imprs_pie) {
         $cl_impr = $imprs_pie . ',' . $clicks_pie;
         $chco = '7777CC|76A4FB';
         $chdl = 'clicks|Impressions';
         $url = "http://0.chart.apis.google.com/chart?chs=300x150&cht=p3&chd=t:" . $cl_impr . "&chdl=Impressions|Clicks";
         //&amp;chco=".$chco;
         //socialadsController::getlinr
     }
     $CTR = 0.0;
     if ($clicks_pie and $imprs_pie) {
         $CTR = number_format($clicks_pie / $imprs_pie, 2);
     }
     $body = JText::_('PERIDIC_STATS_BODY');
     $timestamp = strtotime("-7 days");
     $find = array('[ADTITLE]', '[STARTDATE]', '[ENDDATE]', '[TOTAL_IMPRS]', '[TOTAL_CLICKS]', '[CLICK_TO_IMPRS]', '[STAT_CHART]', '[AD_EIDT_LINK]');
     $replace = array($ad_title, strftime("%d-%m-%Y", $timestamp), date('d-m-Y'), $imprs_pie, $clicks_pie, $CTR, $url, $edit_ad_link);
     $body = str_replace($find, $replace, $body);
     if (!$ad_title) {
         $body = str_replace('Ad Title', '', $body);
     }
     $body = nl2br($body);
     return $body;
     //die;
 }