function editad() { $model = $this->getModel('adsummary'); //$itemid = & $this->get( 'SocialadsItemid'); $socialadshelper = new socialadshelper(); $itemid = $socialadshelper->getSocialadsItemid('buildad'); //$this->setRedirect("index.php?option=com_socialads&view=buildad&Itemid=$itemid&frm=editad"); $link = JRoute::_("index.php?option=com_socialads&view=buildad&Itemid={$itemid}&frm=editad", false); $this->setRedirect($link, $msg); }
function altadupdate() { $input = JFactory::getApplication()->input; $model = $this->getModel('managead'); $ad_id = $input->get('adid', 0, 'INT'); if ($model->altUpdate()) { $sacontroller = new socialadsController(); $sacontroller->execute('delimages'); $msg = JText::_('UPDATE'); } else { $msg = JText::_('ERROR'); } $itemid = socialadshelper::getSocialadsItemid('managead'); $link = JRoute::_("index.php?option=com_socialads&view=managead&Itemid={$itemid}", false); $this->setRedirect($link, $msg); }
function adminAdApprovalEmail($ad_id) { $db = JFactory::getDBO(); $query = 'SELECT a.`ad_id`,a.`ad_image`,a.`ad_title`,a.`ad_body`,a.`ad_url2` FROM `#__ad_data` as a WHERE a.ad_id=' . $ad_id; //. ' AND a.ad_approved=1'; $db->setQuery($query); $oldAd = $db->loadObject(); jimport('joomla.utilities.utility'); $user = JFactory::getUser(); global $mainframe; $mainframe = JFactory::getApplication(); $sitelink = JUri::root(); $socialadshelper = new socialadshelper(); $manageAdLink = "<a href='" . $sitelink . "administrator" . DS . "index.php?option=com_socialads&view=approveads' targe='_blank'>" . JText::_("COM_SOCIALADS_EMAIL_THIS_LINK") . "</a>"; // GET config details $frommail = $mainframe->getCfg('mailfrom'); $fromname = $mainframe->getCfg('fromname'); $adUserName = $user->username; $adTitle = $oldAd->ad_title; $siteName = $mainframe->getCfg('sitename'); $today = date('Y-m-d H:i:s'); //DEFINE SEARCH $find = array('[SEND_TO_NAME]', '[ADVERTISER_NAME]', '[SITENAME]', '[SITELINK]', '[ADTITLE]', '[CONTENT]', '[TIMESTAMP]'); // SEND ADMIN MAIL $recipient = $frommail; $subject = JText::_("COM_SOCIALADS_APPRVE_MAIL_TO_ADMIN_SUBJECT"); $adminEmailBody = JText::sprintf("COM_SOCIALADS_EMAIL_HELLO") . JText::sprintf('COM_SOCIALADS_APPRVE_MAIL_TO_ADMIN_CONTENT', $manageAdLink) . JText::sprintf("COM_SOCIALADS_EMAIL_SITENAME_TEAM"); // NOW REPLACE TAG $replace = array($fromname, $adUserName, $siteName, $sitelink, $adTitle, $content, $today); $adminEmailBody = str_replace($find, $replace, $adminEmailBody); $status = $socialadshelper->sendmail($recipient, $subject, $adminEmailBody, $bcc_string = '', $singlemail = 0, $attachmentPath = ""); // SEND TO ADVERTISER MAIL $advertiserEmail = $user->email; $subject = JText::_("COM_SOCIALADS_APPRVE_MAIL_TO_ADVERTISER_SUBJECT"); $advertiserEmailBody = JText::sprintf("COM_SOCIALADS_EMAIL_HELLO") . JText::sprintf('COM_SOCIALADS_APPRVE_MAIL_TO_ADVERTISR_CONTENT') . JText::sprintf("COM_SOCIALADS_EMAIL_SITENAME_TEAM"); // NOW REPLACE TAG $replace = array($adUserName, $adUserName, $siteName, $sitelink, $adTitle, $content, $today); $advertiserEmailBody = str_replace($find, $replace, $advertiserEmailBody); $status = $socialadshelper->sendmail($advertiserEmail, $subject, $advertiserEmailBody, $bcc_string = '', $singlemail = 0, $attachmentPath = ""); }
<?php /** * @package Social Ads * @copyright Copyright (c) 2009-2013 TechJoomla. All rights reserved. * @license GNU General Public License version 2, or later */ defined('_JEXEC') or die('Restricted access'); // show show ad review view $ads_calledFromCkout = 1; // used in showad view $socialadshelper = new socialadshelper(); $billpath = $socialadshelper->getViewpath('showad', 'default'); ob_start(); include $billpath; $html = ob_get_contents(); ob_end_clean(); echo $html; // show payment gateway $default = ""; $lable = JText::_('ADS_SEL_GATEWAY'); $gateway_div_style = 1; if (!empty($this->gateways)) { $default = $this->gateways[0]->id; // id and value is same } if (!empty($this->gateways) && count($this->gateways) == 1) { $default = $this->gateways[0]->id; // id and value is same $lable = JText::_('QTC_GATEWAY_IS'); $gateway_div_style = 0;
<?php // No direct access to this file defined('_JEXEC') or die('Restricted access'); JHtml::_('behavior.formvalidation'); $input = JFactory::getApplication()->input; //$post=$input->post; $document = JFactory::getDocument(); //$document->addScript(JUri::root().'media://techjoomla_strapper/js/akeebajq.js'); //$document->addScript(JUri::root().'components/com_socialads/css/socialads.css'); $document->addStyleSheet(JUri::root() . 'components/com_socialads/css/campaign.css'); require JPATH_SITE . DS . "administrator" . DS . "components" . DS . "com_socialads" . DS . "config" . DS . "config.php"; require_once JPATH_COMPONENT . DS . 'helper.php'; $socialadshelper = new socialadshelper(); $init_balance = $socialadshelper->getbalance(); if ($init_balance != NULL && $init_balance != 1.0) { $itemid = $socialadshelper->getSocialadsItemid('payment'); $not_msg = JText::_('MIM_BALANCE'); $not_msg = str_replace('{clk_pay_link}', '<a href="' . JRoute::_('index.php?option=com_socialads&view=payment&Itemid=' . $itemid) . '">' . JText::_('SA_CLKHERE') . '</a>', $not_msg); JError::raiseNotice(100, $not_msg); } $user = JFactory::getUser(); ?> <div class="techjoomla-bootstrap"> <?php if (!$user->id) { ?> <div class="alert alert-block"> <?php echo JText::_('BUILD_LOGIN'); ?>
require JPATH_SITE . DS . "administrator" . DS . "components" . DS . "com_socialads" . DS . "config" . DS . "config.php"; // fetch ad detail if (empty($order_id)) { ?> <div class="well" > <div class="alert alert-error"> <span ><?php echo JText::_('SA_UNABLE_TO_TRACK_ORDER_ID'); ?> </span> </div> </div> <?php return false; } $socialadshelper = new socialadshelper(); $adDetail = $socialadshelper->getOrderAndAdDetail($order_id, 1); $this->chargeoption = $adDetail['ad_payment_type']; //$this->ad_totaldisplay = $adDetail['ad_credits']; // no of clicks or impression $this->ad_totaldisplay = $adDetail['ad_credits_qty']; // no of clicks or impression // VM:: hv to add and code for jomsical points ( we are looking later for jomscial points) $gatwayName = 'bycheck'; $plugin = JPluginHelper::getPlugin('payment', $gatwayName); if (0 && $socialads_config['select_campaign'] == 0) { $pluginParams = json_decode($plugin->params); $this->assignRef('ad_gateway', $pluginParams->plugin_name); //added by sagar// $arb_enforce = ''; $this->assignRef('arb_enforce', $pluginParams->arb_enforce); $arb_enforce = '';
function onEmail_jma_socialads($id, $date, $userparam, $fetch_only_latest) { $areturn = array(); $areturn[0] = $this->_name; $check = $this->_chkextension(); if (!$check) { $areturn[1] = ''; $areturn[2] = ''; return $areturn; } $userparam['alt_ad'] = 1; $userparam['ad_rotation'] = 0; //$id = 54; $input = JFactory::getApplication()->input; require_once JPATH_ROOT . DS . 'components' . DS . 'com_socialads' . DS . 'adshelper.php'; require_once JPATH_ROOT . DS . 'components' . DS . 'com_socialads' . DS . 'helper.php'; $html = '<span>'; $cssdata = ''; $simulate = ''; $sim_flag = $input->get('flag', 0, 'INT'); if ($sim_flag == 1) { // to check if called from simulate in admin $simulate = '&simulate=1'; } if ($id == '' || !$id || !isset($id)) { $adRetriever = new adRetriever(-1, 1); } else { $adRetriever = new adRetriever($id, 1); } $socialadshelper = new socialadshelper(); $adsdata = array(); $adsdata = $adRetriever->fillslots($userparam, $adRetriever); //echo '<br>data';//print_r($adsdata); if (!empty($adsdata)) { //$random_ads = $adRetriever->getRandomId($adsdata,$userparam); $itemid = $socialadshelper->getSocialadsItemid('buildad'); foreach ($adsdata as $key => $random_ad) { if ($random_ad->ad_id != -999) { $addata = $adRetriever->getAdDetails($random_ad); } else { $addata = null; } if ($addata) { $html .= '<div>'; $html .= $adRetriever->getAdHTML($addata); $html .= '<img alt="" src="' . JUri::root() . 'index.php?option=com_socialads&task=getimprimage&adid=' . $random_ad->ad_id . $simulate . '" border="0" width="1" height="1"/>'; $html .= '</div>'; if (JVERSION >= '1.6.0') { $cssfile = JPATH_SITE . DS . 'plugins' . DS . 'socialadslayout' . DS . 'plug_' . $addata->layout . DS . 'plug_' . $addata->layout . DS . 'layout.css'; } else { $cssfile = JPATH_SITE . DS . 'plugins' . DS . 'socialadslayout' . DS . 'plug_' . $addata->layout . DS . 'layout.css'; } $cssdata .= file_get_contents($cssfile); } } if ($userparam['create'] == 1) { $html .= '<div style="clear:both;"></div><a class ="create" target="_blank" href="' . JRoute::_(JUri::root() . 'index.php?option=com_socialads&view=buildad&Itemid=' . $itemid) . '">' . $userparam['create_text'] . '</a>'; } } $html .= '</span>'; if (empty($adsdata)) { $areturn[1] = ''; $areturn[2] = ''; } else { $areturn[1] = $html; $areturn[2] = $cssdata; } // print_r($areturn); return $areturn; }
function saveOrder($data, $orderid, $pg_nm) { $db = JFactory::getDBO(); $paymentdata = new stdClass(); $paymentdata->id = $orderid; $paymentdata->transaction_id = $data['transaction_id']; if ($data['status'] == 'C') { $paymentdata->status = 'C'; if (!empty($data['payment_type'])) { if ($data['payment_type'] == 'recurring') { $paymentdata->subscription_id = $data['subscription_id']; if (empty($data['payment_number'])) { $paymentdata->status = 'P'; } } } $query = "SELECT subscription_id,ad_credits_qty,ad_id FROM #__ad_payment_info WHERE id =" . $orderid; $db->setQuery($query); $result = $db->loadObject(); if (!$result->ad_credits_qty) { $result->ad_credits_qty = 0; } //added for date type ads $adid = $result->ad_id; $query = "SELECT ad_payment_type FROM #__ad_data WHERE ad_id =" . $adid; $db->setQuery($query); $ad_payment_type = $db->loadResult(); if ($ad_payment_type == 2) { socialadshelper::adddays($adid, $result->ad_credits_qty); } else { $query = "UPDATE #__ad_data SET ad_credits = ad_credits + {$result->ad_credits_qty}, ad_credits_balance = ad_credits_balance + {$result->ad_credits_qty} WHERE ad_id=" . $result->ad_id; $db->setQuery($query); $db->execute(); } } $paymentdata->extras = $data['raw_data']; if (!$db->updateObject('#__ad_payment_info', $paymentdata, 'id')) { echo $db->stderr(); return false; } if ($paymentdata->status == 'C') { // added by VM: $socialadsModelShowad = new socialadsModelShowad(); $sendmail = $socialadsModelShowad->SendOrderMAil($orderid, $pg_nm, 1); // end Vm return true; } else { return false; } }
function makemorepayment() { require JPATH_SITE . DS . "administrator" . DS . "components" . DS . "com_socialads" . DS . "config" . DS . "config.php"; $model = $this->getModel('showad'); $buildadsession = JFactory::getSession(); $input = JFactory::getApplication()->input; $data = JRequest::get('post'); $adid = $data['adid']; $buildadsession->set('adid', $data['adid']); $buildadsession->set('ad_totalamount', $data['totalamount']); $buildadsession->set('ad_totaldisplay', $data['totaldisplay']); $buildadsession->set('ad_gateway', $data['gateway']); //interchange amt and cop_amt $cop = $input->get('cop', '', 'STRING') ? $input->get('cop', '', 'STRING') : ''; $arb_flag = $input->get('arb_flag') ? $input->get('arb_flag') : 0; $amt = $data['totalamount']; //interchange amt and cop_amt $cop_dis_opn_hide = $input->get('cop_dis_opn_hide', '', 'INT'); JRequest::setVar('coupon_code', $data['cop']); $model = $this->getModel('showad'); $adcop = ''; if ($cop_dis_opn_hide == 0) { $adcop = $model->getcoupon(); if ($adcop) { if ($adcop[0]->val_type == 1) { //discount rate $val = $adcop[0]->value / 100 * $data['totalamount']; } else { $val = $adcop[0]->value; } } else { $val = 0; } $amt = round($data['totalamount'] - $val, 2); } if ($amt <= 0) { $amt = 0; } $temp = $data['totalamount']; $buildadsession->set('ad_totalamount', $amt); $buildadsession->set('orgi_totalamount', $temp); $ad_chargeoption = $buildadsession->get('ad_chargeoption'); if ($ad_chargeoption >= 2) { if (!isset($data['ad_chargeoption_day']) || !$data['ad_chargeoption_day']) { // code to put start date in ad data table $db = JFactory::getDBO(); $addata = new stdClass(); $addata->ad_id = $adid; $addata->ad_startdate = $data['datefrom']; $db->updateObject('#__ad_data', $addata, 'ad_id'); } $credits = $data['ad_totaldays']; } else { $credits = $data['totaldisplay']; } $user = JFactory::getUser(); $option = $data['gateway']; $success_msg = ''; $totalamt = $buildadsession->get('ad_totalamount'); if ($option == 'jomsocialpoints' or $option == 'alphauserpoints') { $plugin = JPluginHelper::getPlugin('payment', $buildadsession->get('ad_gateway')); $pluginParams = json_decode($plugin->params); $totalamt = $buildadsession->get('ad_totalamount') / $pluginParams->conversion; $success_msg = JText::sprintf('TOTAL_POINTS_DEDUCTED_MESSAGE', $buildadsession->get('ad_totalamount')); } JPluginHelper::importPlugin('payment', $option); $dispatcher = JDispatcher::getInstance(); if ($amt <= 0 && $adcop) { $db = JFactory::getDBO(); //added for date type ads $query = "SELECT ad_payment_type FROM #__ad_data WHERE ad_id =" . $adid; $db->setQuery($query); $ad_payment_type = $db->loadResult(); if ($ad_payment_type != 2) { $query = "UPDATE #__ad_data SET ad_credits = ad_credits + {$result->ad_credits_qty}, ad_credits_balance = ad_credits_balance + {$result->ad_credits_qty} WHERE ad_id=" . $result->ad_id; $db->setQuery($query); $db->execute(); } else { if ($ad_payment_type >= 2) { socialadshelper::adddays($adid, $result->ad_credits_qty); } } $paymentdata = new stdClass(); $paymentdata->id = ''; $paymentdata->ad_id = $adid; $paymentdata->cdate = date('Y-m-d H:i:s'); $paymentdata->processor = $buildadsession->get('ad_gateway'); $paymentdata->ad_credits_qty = $credits; $paymentdata->ad_amount = $buildadsession->get('orgi_totalamount'); $paymentdata->ad_original_amt = $buildadsession->get('orgi_totalamount'); $paymentdata->status = 'C'; $paymentdata->ad_coupon = $data['cop']; $paymentdata->payee_id = $user->id; $paymentdata->ip_address = $_SERVER["REMOTE_ADDR"]; if (!$db->insertObject('#__ad_payment_info', $paymentdata, 'id')) { echo $db->stderr(); return false; } global $mainframe; $mainframe = JFactory::getApplication(); $mainframe->redirect('index.php?option=com_socialads&view=managead&Itemid=' . $input->get('Itemid', 0, 'INT')); } else { $orderdata = array('order_id' => '', 'pg_plugin' => $option, 'user' => $user, 'adid' => $adid, 'amount' => $totalamt, 'original_amount' => $buildadsession->get('orgi_totalamount'), 'coupon' => $cop, 'credits' => $credits, 'success_message' => $success_msg); //Here orderid is id in payment_info table $orderid = $model->createorder($orderdata); if (!$orderid) { echo $msg = JText::_('ERROR_SAVE'); } $orderdata['order_id'] = $orderid; $html = $this->getHTML($orderdata); if (!empty($html)) { echo $html; } } }
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=payment&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=payment&task=processpayment&pg_nm={$pg_plugin}&pg_action=onTP_Processpayment&order_id=" . $orderdata['order_id'] . "&original_amt=" . $orderdata['original_amount']); $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']; } $dispatcher = JDispatcher::getInstance(); JPluginHelper::importPlugin('payment', $pg_plugin); $html = $dispatcher->trigger('onTP_GetHTML', array($vars)); return $html[0]; jexit(); }
function SendOrderMAil($order_id, $pg_nm, $payPerAd = 0) { require_once JPATH_SITE . DS . "components" . DS . "com_socialads" . DS . "helper.php"; // require when we call from backend /*$db = JFactory::getDBO(); $query = "SELECT p.ad_amount, p.processor,p.comment,p.status,p.extras FROM #__ad_payment_info as p WHERE p.id=".$order_id; $db->setQuery($query); $details = $db->loadobjectlist();*/ // vm: start $socialadshelper = new socialadshelper(); $sendInvoice = 1; if ($sendInvoice == 1) { //$status = $socialadshelper->sendInvoice($order_id,$pg_nm); $details = $socialadshelper->getInvoiceDetail($order_id, $pg_nm, $payPerAd); } // vm: end //for payment details send through email //$details = socialadshelper::paymentdetails($adid); /* if($details) { $details[0]->payment_method=$pg_nm; $mail = $socialadshelper->new_pay_mail($order_id, $details); //for send mail to admin approval when payment is done }*/ }
function store() { $data = JRequest::get('post'); $id = $data['id']; $status = $data['status']; //require_once(JPATH_SITE.DS."components".DS."com_socialads".DS."helper.php"); // require when we call from backend $socialadshelper = new socialadshelper(); if ($status == 'RF') { $query = "UPDATE #__ad_payment_info SET status ='RF' WHERE id =" . $id; $this->_db->setQuery($query); if (!$this->_db->execute()) { return 2; } $socialadshelper->new_pay_mail($id); return 3; } elseif ($status == 'E') { $query = "UPDATE #__ad_payment_info SET status ='E' WHERE id =" . $id; $this->_db->setQuery($query); if (!$this->_db->execute()) { return 2; } $socialadshelper->new_pay_mail($id); return 3; } elseif ($status == 'C') { $query = "SELECT * FROM #__ad_payment_info WHERE id =" . $id; $this->_db->setQuery($query); $result = $this->_db->loadObject(); $query = "UPDATE #__ad_payment_info SET status ='C' WHERE id =" . $id; $this->_db->setQuery($query); if (!$this->_db->execute()) { return 2; } //entry for transaction table $query = "SELECT ad_id FROM #__ad_payment_info WHERE id = " . $id; $this->_db->setQuery($query); $ad = $this->_db->loadresult(); JLoader::import('payment', JPATH_SITE . DS . 'components' . DS . 'com_socialads' . DS . 'models'); $socialadsModelpayment = new socialadsModelpayment(); if (empty($ad)) { // add wallet $comment = 'ADS_PAYMENT'; $transc = $socialadsModelpayment->add_transc($result->ad_original_amt, $id, $comment); $sendmail = $socialadsModelpayment->SendOrderMAil($id, $data['search_gateway'], $payPerAd = 0); } else { // pay per ad $sendmail = $socialadsModelpayment->SendOrderMAil($id, $data['search_gateway'], $payPerAd = 1); } require_once JPATH_SITE . '/components/com_socialads/helper.php'; $adid = $result->ad_id; $qryad = "SELECT ad_payment_type FROM #__ad_data WHERE ad_id =" . $adid; $this->_db->setQuery($qryad); $ad_payment_type = $this->_db->loadResult(); if ($ad_payment_type != 2) { $query = "UPDATE #__ad_data SET ad_credits = ad_credits + {$result->ad_credits_qty}, ad_credits_balance = ad_credits_balance + {$result->ad_credits_qty} WHERE ad_id=" . $result->ad_id; $this->_db->setQuery($query); $this->_db->execute(); } //added by sagar for date type ads if (empty($subscriptiondata[0]->subscription_id) and $ad_payment_type == 2) { socialadshelper::adddays($adid, $result->ad_credits_qty); } //added by sagar for date type ads } else { $query = "UPDATE #__ad_payment_info SET status ='P' WHERE id =" . $id; $this->_db->setQuery($query); if (!$this->_db->execute()) { return 2; } } return 1; }
/** * ManageAd view ManageAddisplay method * @return void **/ function display($tpl = null) { require_once JPATH_COMPONENT . DS . 'helper.php'; $user = JFactory::getUser(); if ($user->id) { //User authorized to view chat history if (!JFactory::getUser($user->id)->authorise('core.manage_ad', 'com_socialads')) { $app = JFactory::getApplication(); $app->enqueueMessage(JText::_('COM_SOCIALADS_AUTH_ERROR'), 'warning'); return false; } } global $mainframe, $option; $mainframe = JFactory::getApplication(); $input = JFactory::getApplication()->input; // parameter is set than show default msg $saDefMsg = $input->get('saDefMsg', 0, 'INT'); if ($saDefMsg) { JFactory::getApplication()->enqueueMessage(JText::_("COM_SA_CREATE_AD")); } //Clear session $session = JFactory::getSession(); $session->clear('ad_id'); //$post=$input->post; //$input->get $option = $input->get('option', '', 'STRING'); //get fields from model query $model = $this->getModel('managead'); //$itemid = $this->get( 'SocialadsItemid' ); $itemid = socialadshelper::getSocialadsItemid('managead'); //$itemid = socialadshelper::getSocialadsItemid('buildad'); $this->assignRef('itemid', $itemid); //check guest-ad $guestad = $this->get('CheckGuestad'); $this->assignRef('guestad', $guestad); if ($input->get('adid', 0, 'INT') != null) { /*check valid ad*/ $adcheck = $this->get('adcheck'); $this->assignRef('adcheck', $adcheck); //get fields from model query $fields = $this->get('Fields'); $this->assignRef('fields', $fields); // url select list $url1 = array(); $url1[] = JHtml::_('select.option', 'http', 'http'); $url1[] = JHtml::_('select.option', 'https', 'https'); $this->assignRef('url1', $url1); //get plugin fields from model query $plgfields = $this->get('Plgfields'); $this->assignRef('plgfields', $plgfields); //fetching all inserted details from DB $addata = $this->get('Data'); $this->assignRef('ad_socialtarget', $addata[0]); $this->assignRef('addata', $addata[1]); $this->assignRef('geo_target', $this->get('Data_geo')); $Data_context_target = $this->get('Data_context_target'); $this->assignRef('context_target', $Data_context_target['keywords']); $this->assignRef('context_target_data_keywordtargeting', $Data_context_target['keywords']); $zone = $this->get('zone'); $this->assignRef('zone', $zone[0]); $this->setLayout('default'); } else { //-----------For Zone Filter---------// $Itemid = $input->get('ad_camp_id', 0, 'INT'); if ($Itemid) { $model = $this->getModel('managead'); $statsforbar = $model->statsforbar($Itemid); } else { $statsforbar = $model->statsforbar(); } $this->assignRef('statsforbar', $statsforbar); /*if($statsforbar[2]) //commented in 2.7.5 beta3 { if($statsforbar[2][0]->fromdate); $fromdate=$statsforbar[2][0]->fromdate; }*/ $this->assignRef('fromdate', $fromdate); $search_zone = $mainframe->getUserStateFromRequest($option . 'search_zone', 'search_zone', '', 'string'); $search_zone = JString::strtolower($search_zone); $status_zone = array(); $zonelist = $model->adzonelist(); $status_zone[] = JHtml::_('select.option', '0', JText::_('SA_SELONE_ZONE')); foreach ($zonelist as $key => $zone) { $zone_id = $zone->id; $zone_nm = $zone->zone_name; $status_zone[] = JHtml::_('select.option', $zone_id, $zone_nm); } $this->assignRef('status_zone', $status_zone); //-----------End For Zone Filter---------// //---------CAMPAIGN FILTER-----------// $search_camp = $mainframe->getUserStateFromRequest($option . 'search_camp', 'search_camp', '', 'string'); $search_camp = JString::strtolower($search_camp); $campselect = array(); $camp_dd = $this->get('campaign_dd'); $campselect[] = JHtml::_('select.option', '0', JText::_('SA_CAMP_SELECT')); foreach ($camp_dd as $key => $camp) { $camp_id = $camp->camp_id; $campname = $camp->campaign; $campselect[] = JHtml::_('select.option', $camp_id, $campname); } $this->assignRef('camp_dd', $campselect); /* Call the state object */ $state = $this->get('state'); /* Get the values from the state object that were inserted in the model's construct function */ $lists['order_Dir'] = $state->get('filter_order_Dir'); $lists['order'] = $state->get('filter_order'); $lists['search_zone'] = $search_zone; $lists['search_camp'] = $search_camp; $this->assignRef('lists', $lists); //show myads list if ($Itemid) { $model = $this->getModel('managead'); $myads = $model->getAds($Itemid); } else { $myads = $this->get('Ads'); } $this->assignRef('myads', $myads); $this->setLayout('list'); } //pagination starts here global $mainframe, $option; $mainframe = JFactory::getApplication(); $option = $input->get('option', '', 'STRING'); //Put Your JToolBarHelpers here $filter_state = $mainframe->getUserStateFromRequest($option . 'filter_state', 'filter_state', '', 'string'); // search filter //$lists['search']= $search; // Get data from the model $items = $this->get('Managead'); $this->assignRef('items', $items); $total = $this->get('Total'); $this->assignRef('total', $total); $pagination = $this->get('Pagination'); $this->assignRef('pagination', $pagination); //check for paypal log if (isset($_POST['payment_status']) == 'C') { //get session for adid $paypalsession = JFactory::getSession(); $adid = $paypalsession->get('adid'); $file = JPATH_COMPONENT . DS . "log" . DS . 'paypal.txt'; $log['Adid'] = $adid; $log['IPN'] = $_POST['test_ipn']; $log['Status'] = $_POST['payment_status']; $log['Transaction Id'] = $_POST['txn_id']; $log['newln'] = "----------------------------------- \n"; foreach ($log as $k => $v) { $opt[] = "{$k} - " . addslashes($v) . ""; } $text = implode("\n", $opt); $fh = fopen($file, 'a'); fwrite($fh, $text); fclose($fh); //clear session adid $paypalsession->clear('adid'); } parent::display($tpl); }
function getAdHTMLByMedia($upload_area, $ad_image, $ad_body, $ad_link, $ad_layout, $track = 0, $adzone, $ad_id = '') { $adHtmlTyped = ''; if ($ad_layout == 'layout2' || $ad_layout == 'layout4' || $ad_layout == 'layout6') { $ad_type = 'text'; $adHtmlTyped .= $ad_body; } else { require_once JPATH_SITE . DS . 'components' . DS . 'com_socialads' . DS . 'helpers' . DS . 'media.php'; require JPATH_SITE . DS . "administrator" . DS . "components" . DS . "com_socialads" . DS . "config" . DS . "config.php"; $media = new sa_mediaHelper(); $fpath = JUri::root() . $ad_image; $fextension = JFile::getExt($fpath); $ad_type = $media->get_ad_type($fextension); $socialadshelper = new socialadshelper(); /* //@TODO use image/zone dimensions here? $media_d=$media->check_media_resizing_needed($zone_d,$fpath); $opti_d=$media->get_new_dimensions($zone_d->img_width, $zone_d->img_height, 'auto'); */ switch ($ad_type) { case "image": //@TODO use resized image dimensions here $adHtmlTyped = '<img class="' . $ad_layout . '_ad_prev_img" alt="" src="' . JUri::root() . $ad_image . '" style="border:0px;" />'; break; case "flash": if ($track) { $zone_d = $media->get_adzone_media_dimensions($adzone); //include flowplayer javascript $socialadshelper->loadScriptOnce(JUri::root() . 'components' . DS . 'com_socialads' . DS . 'js' . DS . 'flowplayer-3.2.9.min.js'); $adHtmlTyped = ''; //@TODO use image?zone dimensions here? //$ht_wd='width:'.$media_d['width_img'].'px;height:'.$media_d['height_img'].'px'; //$ht_wd='width:'.$opti_d['new_calculated_width'].'px;height:'.$opti_d['new_calculated_height'].'px'; $ht_wd = 'width:' . $zone_d->img_width . 'px;height:' . $zone_d->img_height . 'px'; //create uniquq tag for each ad for video ads $adHtmlTyped .= '<div href="' . JUri::root() . $ad_image . '" style="display:block;' . $ht_wd . '" id="vid_player_' . $ad_id . '"> </div>'; //flow player js, configured as required $adHtmlTyped .= ' <script> flowplayer("vid_player_' . $ad_id . '", { src:"' . JUri::root() . 'components' . DS . 'com_socialads' . DS . 'js' . DS . 'flowplayer-3.2.10.swf", wmode:"opaque" }, { /* canvas: { backgroundColor:"#000000", width:' . $zone_d->img_width . ', height:' . $zone_d->img_height . ' }, */ clip : { scaling: "scale", autoPlay: true }, //default settings for the play button play: { opacity: 0.0, label: null, replayLabel: null, fadeSpeed: 500, rotateSpeed: 50 }, plugins:{ controls: null, content: { url:"' . JUri::root() . 'components' . DS . 'com_socialads' . DS . 'js' . DS . 'flowplayer.content-3.2.8.swf", width:' . $zone_d->img_width . ', height:' . $zone_d->img_height . ', backgroundColor: "#112233", opacity: 0.0, onClick: function() { window.open("' . $ad_link . '","_blank");/*opens in new tab*/ } } } }); </script>'; } else { //FLOWPLAYER $zone_d = $media->get_adzone_media_dimensions($adzone); $adHtmlTyped = ''; $adHtmlTyped .= ' <div class="vid_ad_preview" href="' . JUri::root() . $ad_image . '" style="background:url(' . JUri::root() . '/components/com_socialads/images/black.png);width:' . $zone_d->img_width . 'px;height:' . $zone_d->img_height . 'px; "> </div> '; //this is needed for ad preview from backend $adHtmlTyped .= '<script type="text/javascript"> flowplayer("div.vid_ad_preview", { src:"' . JUri::root() . 'components' . DS . 'com_socialads' . DS . 'js' . DS . 'flowplayer-3.2.10.swf", wmode:"opaque" }, { canvas: { backgroundColor:"#000000", width:' . $zone_d->img_width . ', height:' . $zone_d->img_height . ' }, //default settings for the play button play: { opacity: 0.0, label: null, replayLabel: null, fadeSpeed: 500, rotateSpeed: 50 }, plugins:{ controls: null } }); </script>'; } break; case "video": if ($track) { $zone_d = $media->get_adzone_media_dimensions($adzone); //include flowplayer javascript $socialadshelper->loadScriptOnce(JUri::root() . 'components' . DS . 'com_socialads' . DS . 'js' . DS . 'flowplayer-3.2.9.min.js'); $adHtmlTyped = ''; /* //@TODO use image?zone dimensions here? $ht_wd='width:'.$media_d['width_img'].'px;height:'.$media_d['height_img'].'px'; $ht_wd='width:'.$opti_d['new_calculated_width'].'px;height:'.$opti_d['new_calculated_height'].'px'; */ $ht_wd = 'width:' . $zone_d->img_width . 'px;height:' . $zone_d->img_height . 'px'; //calculate top margin for play button icon $top_margin = $zone_d->img_height / 2 - 48; //calculate overlay div height $div_height = $zone_d->img_height - 25; //create uniquq tag for each ad for video ads $adHtmlTyped .= '<div href="' . JUri::root() . $ad_image . '" style="display:block;' . $ht_wd . '" id="vid_player_' . $ad_id . '"> </div>'; //flow player js, configured as required $adHtmlTyped .= ' <script> flowplayer("vid_player_' . $ad_id . '", { src:"' . JUri::root() . 'components' . DS . 'com_socialads' . DS . 'js' . DS . 'flowplayer-3.2.10.swf", wmode:"opaque" }, { canvas: { backgroundColor:"#000000", width:' . $zone_d->img_width . ', height:' . $zone_d->img_height . ' }, //default settings for the play button play: { opacity: 0.0, label: null, replayLabel: null, fadeSpeed: 500, rotateSpeed: 50 }, '; if ($socialads_config["allow_vid_ads_autoplay"] == 0) { //added by aniket for stop auto play $adHtmlTyped .= ' clip: { // these two settings will make the first frame visible autoPlay: false, autoBuffering: true, duration: 0, // locate a good looking first frame with the start parameter start: 62, }, '; } $adHtmlTyped .= ' plugins:{ controls: { url:"' . JUri::root() . 'components' . DS . 'com_socialads' . DS . 'js' . DS . 'flowplayer.controls-3.2.10.swf", height:25, timeColor: "#980118", all: false, play: true, scrubber: true, volume: true, time: false, mute: true, progressColor: "#FF0000", bufferColor: "#669900", volumeColor: "#FF0000" }, content: { url:"' . JUri::root() . 'components' . DS . 'com_socialads' . DS . 'js' . DS . 'flowplayer.content-3.2.8.swf", width:' . $zone_d->img_width . ', height:' . $div_height . ', backgroundColor: "#112233", opacity: 0.0, onClick: function() { window.open("' . $ad_link . '","_blank");/*opens in new tab*/ } } } }); </script>'; } else { //FLOWPLAYER $zone_d = $media->get_adzone_media_dimensions($adzone); $adHtmlTyped = ''; $adHtmlTyped .= ' <div class="vid_ad_preview" href="' . JUri::root() . $ad_image . '" style="background:url(' . JUri::root() . '/components/com_socialads/images/black.png);width:' . $zone_d->img_width . 'px;height:' . $zone_d->img_height . 'px; "> </div> '; //this is needed for ad preview from backend $adHtmlTyped .= '<script type="text/javascript"> flowplayer("div.vid_ad_preview", { src:"' . JUri::root() . 'components' . DS . 'com_socialads' . DS . 'js' . DS . 'flowplayer-3.2.10.swf", wmode:"opaque" }, { canvas: { backgroundColor:"#000000", width:' . $zone_d->img_width . ', height:' . $zone_d->img_height . ' }, //default settings for the play button play: { opacity: 0.0, label: null, replayLabel: null, fadeSpeed: 500, rotateSpeed: 50 }, plugins:{ controls: { url:"' . JUri::root() . 'components' . DS . 'com_socialads' . DS . 'js' . DS . 'flowplayer.controls-3.2.10.swf", height:25, timeColor: "#980118", all: false, play: true, scrubber: true, volume: true, time: false, mute: true, progressColor: "#FF0000", bufferColor: "#669900", volumeColor: "#FF0000" } } }); </script>'; } break; } //end switch case } //end else (media ads) $adHtmlTypedwithad_type = "<div class='adtype' adtype='" . $ad_type . "'>" . $adHtmlTyped . "</div>"; return $adHtmlTypedwithad_type; }
$ad_chargeoption = $buildadsession->get('ad_chargeoption'); $ad_chargeoption_day = $buildadsession->get('ad_chargeoption_day'); } } $u_points = $buildadsession->get('user_points'); //Extra code for zone pricing if (!$socialads_config['clicks_price']) { $socialads_config['clicks_price'] = 0; } if (!$socialads_config['date_price']) { $socialads_config['date_price'] = 0; } if (!$socialads_config['impr_price']) { $socialads_config['impr_price'] = 0; } $recurring_gateway = socialadshelper::getRecurringGateways(); if (!$recurring_gateway) { $recurring_gateway = ''; } if (!isset($u_points)) { $u_points = 0; } $js = "\n\n\t\tvar jpoints={$u_points};\n\t\tvar amt1=0;\n\t\tvar jconver;\n\t\tvar gt=0;\n\n\tfunction caltotal()\n\t{\n\n\n\t\tvar chargeoptionsel=document.getElementById('chargeoption').value;\n\t\tvar click_price=0;\n\t\tvar click_date=0;\n\t\tvar click_imp=0;\n\n\t\tif(" . $socialads_config['zone_pricing'] . "!=0)\n\t\t{\n\t\t\tclick_price\t= document.getElementById('pric_click').value;\n\t\t\tclick_date\t\t= document.getElementById('pric_day').value;\n\t\t\tclick_imp\t\t= document.getElementById('pric_imp').value;\n\t\t}\n\t\telse if(" . $socialads_config['zone_pricing'] . "==0)\n\t\t{\n\t\t\tclick_price\t= " . $socialads_config['clicks_price'] . ";\n\t\t\tclick_date\t\t= " . $socialads_config['date_price'] . ";\n\t\t\tclick_imp\t\t= " . $socialads_config['impr_price'] . ";\n\t\t}\n\t\tvar totaldisplay=document.getElementById('totaldisplay').value;\n\t\tvar gateway = document.getElementById('gateway').value;\n\t\tvar recurring_gateway = '" . $recurring_gateway . "';\n\t\tvar re_jsondata = '" . $re_selectbox_json . "';\n\t\tvar re_select = jQuery.parseJSON(re_jsondata);\n\n\t\tif (jQuery('#sa_recuring').is(':checked'))\n\t\t{\n\t\t\tdocument.getElementById('total_days_label').innerHTML = '" . JText::_("SA_RENEW_RECURR") . "'+' '+jQuery('#chargeoption option:selected').text();\n\t\t}\n\t\telse\n\t\t{\n\t\t\tdocument.getElementById('total_days_label').innerHTML = '" . JText::_("SA_RENEW_NO_RECURR") . "'+' '+jQuery('#chargeoption option:selected').text();\n\t\t}\n\t\tif(recurring_gateway.search(gateway)==-1)\n\t\t{\n\n\t\t\tif(document.getElementById('sa_recuring').checked==true)\n\t\t\t{\n\t\t\t\tdocument.getElementById('sa_recuring').checked=false;\n\t\t\t}\n\n\t\t}\n\t\telse\n\t\t{\n\t\t\t if(" . $socialads_config['recure_enforce'] . "==1)\n\t\t\t document.getElementById('sa_recuring').checked=true;\n\t\t}\n\n\n\n\t\tif(!gateway)\n\t\t\treturn;\n\n\n\t \tif(document.getElementById('chargeoption').value == '1')\n\t \t{\n\t\t\tdocument.getElementById('total_days').style.display = 'none';\n\t\t\tdocument.getElementById('priceperdate').style.display = 'none';\n\t\t\tdocument.getElementById('priceperclick').style.display = 'block';\n\n\t\t\tif(totaldisplay=='')\n\t\t\t{\n \t\t\t\tdocument.getElementById('ad_totalamount').innerHTML = '';\n \t\t\t\tdocument.getElementById('currency').innerHTML='';\n \t\t }\n \t\t else{\n\t\t\t\tamt1=round(totaldisplay * click_price);\n\n\t \t\t\tif(jpoints<0){\n\t\t\t\t\tdocument.getElementById('ad_totalamount').innerHTML= amt1;\n\t\t\t\t\tdocument.getElementById('totalamount').value = amt1;\n\t\t\t\t\tdocument.getElementById('currency').innerHTML='" . $socialads_config['currency'] . "';\n\t\t \t\t\tdocument.getElementById('hcurrency').value= '" . $socialads_config['currency'] . "';\n\t\t\t\t\tdocument.getElementById('hrate').value='';\n\t\t\t\t}\n\t\t\t}\n\t \t}\n\t \telse if(document.getElementById('chargeoption').value == '0')\n\t \t{\n\t\t\tdocument.getElementById('total_days').style.display = 'none';\n\t\t\tdocument.getElementById('priceperdate').style.display = 'none';\n\t\t\tdocument.getElementById('priceperclick').style.display = 'block';\n\n\t \t\tif(totaldisplay=='')\n\t \t\t{\n\t \t\t\tdocument.getElementById('ad_totalamount').innerHTML='';\n\t \t\t\tdocument.getElementById('currency').innerHTML='';\n\t \t\t}\n\t \t\telse {\n\t \t\t\tamt1=round(totaldisplay * click_imp);\n\t \t\t\tif(jpoints<0){\n\t\t \t\t\tdocument.getElementById('ad_totalamount').innerHTML = amt1;\n\t\t \t\t\tdocument.getElementById('totalamount').value = amt1;\n\t\t \t\t\tdocument.getElementById('currency').innerHTML='" . $socialads_config['currency'] . "';\n\t\t \t\t\tdocument.getElementById('hcurrency').value= '" . $socialads_config['currency'] . "';\n\t\t\t\t\tdocument.getElementById('hrate').value='';\n\t\t\t\t}\n\t \t\t}\n\t \t}\n\t \telse if(document.getElementById('chargeoption').value == '2')\n\t \t{\n\t\t\tdocument.getElementById('total_days').style.display = '';\n\t\t\tdocument.getElementById('priceperclick').style.display = 'none';\n\t\t\t/*added by sagar feb9*/\n\n\t\t\tdocument.getElementById('total_days_label').innerHTML = '" . JText::_("TOTAL_DAYS_FOR_RENEWAL") . "';\n\t\t\tdocument.getElementById('sa_recuring_div').style.display = 'none';\n\n\t\t\tvar ad_chargeoption_day = 0;\n\t\t\tif(document.getElementById('ad_chargeoption_day') )\n\t\t\t\tad_chargeoption_day = document.getElementById('ad_chargeoption_day').value;\n\n\t\t\tif(ad_chargeoption_day)\n\t\t\t{\n\t\t\t\tif(document.getElementById('totaldays').value==' ' )\n\t\t\t\t{\n\t\t\t\t\tdocument.getElementById('ad_totalamount').innerHTML='';\n\t\t\t\t\tdocument.getElementById('currency').innerHTML='';\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tvar daycount=document.getElementById('totaldays').value;\n\n\t\t\t\t\tdocument.getElementById('ad_totaldays').value = daycount;\n\t\t\t\t\tamt1=round(daycount * click_date);\n\t\t\t\t\tif(jpoints<0){\n\t\t\t\t \t\tdocument.getElementById('ad_totalamount').innerHTML = amt1;\n\t\t\t\t \t\tdocument.getElementById('totalamount').value = amt1;\n\t\t\t\t \t\tdocument.getElementById('currency').innerHTML='" . $socialads_config['currency'] . "';\n\t\t\t\t \t\tdocument.getElementById('hcurrency').value= '" . $socialads_config['currency'] . "';\n\t\t\t\t\t\tdocument.getElementById('hrate').value='';\n\t\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\t else\n\t\t\t{\n\t\t\t\tdocument.getElementById('priceperdate').style.display = '';\n\t\t\t\tvar daterangefrom = document.getElementById('datefrom').value;\n\n\t\t\t\tif(daterangefrom==' ' || document.getElementById('totaldays').value == '')\n\t\t\t\t{\n\t\t\t\t\tdocument.getElementById('ad_totalamount').innerHTML='';\n\t\t\t\t\tdocument.getElementById('currency').innerHTML='';\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\t\tvar daycount;\n\t\t\t\t \t\tdaycount=document.getElementById('totaldays').value;\n\n\t\t\t\t\t\tdocument.getElementById('ad_totaldays').value = daycount;\n\t\t\t\t \t amt1=round(daycount * click_date);\n\t\t\t\t \t\tdocument.getElementById('ad_totaldays').value = daycount;\n\t\t\t\t \t\tdocument.getElementById('totaldays').innerHTML = daycount;\n\t\t\t\t \t\tif(jpoints<0){\n\t\t\t\t\t \t\tdocument.getElementById('ad_totalamount').innerHTML = amt1;\n\t\t\t\t\t \t\tdocument.getElementById('totalamount').value = amt1;\n\t\t\t\t\t \t\tdocument.getElementById('currency').innerHTML='" . $socialads_config['currency'] . "';\n\t\t\t\t\t \t\tdocument.getElementById('hcurrency').value= '" . $socialads_config['currency'] . "';\n\t\t\t\t\t\t\tdocument.getElementById('hrate').value='';\n\t\t\t\t\t\t}\n\t\t\t\t}\n\t\t \t}\n\t }\n\t else\n\t {\n\t\t\tdocument.getElementById('priceperdate').style.display = '';\n\n\t\t\tdocument.getElementById('total_days').style.display = '';\n\t\t\tdocument.getElementById('priceperclick').style.display = 'none';\n\t\t\t/*added by sagar feb9*/\n\n\t\t\tif(" . $socialads_config['recure_enforce'] . "==0)\n\t\t\t{\n\t\t\t\tif(recurring_gateway.search(gateway)==-1)\n \t\t{\n\n \t\t\tdocument.getElementById('sa_recuring_div').style.display=\t'none'\n }\n else\n\t\t\t\tdocument.getElementById('sa_recuring_div').style.display = '';\n\t\t\t}\n\t\t\telse\tif(recurring_gateway.search(gateway)==-1)\n \t\t{\n\n \t\t\tdocument.getElementById('sa_recuring_div').style.display=\t'none'\n }\n\n\n\t\t\tvar daterangefrom = document.getElementById('datefrom').value;\n\t\t\tif(daterangefrom==' ' || document.getElementById('totaldays').value == '')\n\t \t\t{\n\t \t\t\tdocument.getElementById('ad_totalamount').innerHTML='';\n\t \t\t\tdocument.getElementById('currency').innerHTML='';\n\t \t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t\tvar jsondata = '" . $slabs_json . "';\n\t\t\t\t\tvar slab = jQuery.parseJSON(jsondata);\n\t\t \t\t\tfor (i=0;i<slab.length;i++)\n\t\t\t\t\t{\n\t\t\t\t\t\tif(parseInt(slab[i].duration)==parseInt(chargeoptionsel))\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tamt1=slab[i].price;\n\t\t\t\t\t\t\tdaycount=slab[i].duration;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\tdaycount=document.getElementById('totaldays').value;\n\n\t\t\t\tif(document.getElementById('sa_recuring').checked==false){\n\t\t\t\t\tamt1=round(daycount * amt1);\n\t\t\t\t}\n\n\t\t\t\tdocument.getElementById('totalamtspan').innerHTML = '" . JText::_("TOTAL") . "'\n\t\t\t\tif(document.getElementById('sa_recuring').checked==true)\n \t\t\t{\n \t\t\t\tchargeselected=document.getElementById('chargeoption').value;\n \t\t\t\tif(parseInt(chargeselected)>2)\n \t\t\t\t\tdocument.getElementById('totalamtspan').innerHTML = '" . JText::_("TOTAL_SLAB") . "'+' '+jQuery('#chargeoption option:selected').text();\n\n \t\t\t}\n\n\n\t\t\t \t\tdocument.getElementById('ad_totaldays').value = daycount;\n\n\t\t\t \t\tif(jpoints<0){\n\t\t\t\t \t\tdocument.getElementById('ad_totalamount').innerHTML = amt1;\n\t\t\t\t \t\tdocument.getElementById('totalamount').value = amt1;\n\t\t\t\t \t\tdocument.getElementById('currency').innerHTML='" . $socialads_config['currency'] . "';\n\t\t\t\t \t\tdocument.getElementById('hcurrency').value= '" . $socialads_config['currency'] . "';\n\t\t\t\t\t\tdocument.getElementById('hrate').value='';\n\t\t\t\t\t}\n\t\t \t}\n\t }\n\t \tif( (!(jpoints<0)) && (gateway!= '') ){\n\t \t\tcalpoints();\n\t \t}\n\n\t \t// check for coupon\n\t \tsa_applycoupon(0);\n\n\t}\n\n\n\tfunction removeoption(select_opt){\n\t\tfor (i=0;i<select_opt.length;i++)\n\t\t{\n\t\t\tjQuery('#gateway option[value=\"'+select_opt[i].value+'\"]').remove();\n\t\t}\n\t}\n\n\tfunction addoption(select_opt){\n\t\tfor (i=0;i<select_opt.length;i++)\n\t\t{\n\t\talert(valuecurrentgatewayliststr);\n\t\tvar\tresult=valuecurrentgatewayliststr.search(select_opt[i].value);\n\t\t\tif(result==-1)\n\t\t\t{\n\t\t\t\tjQuery('#gateway').append(jQuery('<option/>', {\n\t\t\t\tvalue: select_opt[i].value,\n\t\t\t\ttext: select_opt[i].name\n\t\t\t\t}));\n\t\t\t}\n\t\t}\n\n\t}\n\n\tfunction round(n) {\n\t\treturn Math.round(n*100+((n*1000)%10>4?1:0))/100;\n\t}\n\n\tfunction calpoints()\n\t{\n\t\tvar amt=document.getElementById('totalamount').value;\n\t \tvar totaldisplay=document.getElementById('totaldisplay').value;\n\t\tif(!document.getElementById('gateway').value)\n\t\t\treturn;\n\t \tvar chargeoption=document.getElementById('chargeoption').value;\n\t\tjQuery.ajax({\n\t\t\t\turl: root_url+'?option=com_socialads&task=getpoints&plugin_name='+document.getElementById('gateway').value,\n\t\t\t\tsuccess: function(data) {\n\t\t\t\t\tvar data1 = data.split('|');\n\t\t\t\t\tjpoints=data1[0];\n\t\t\t\t\tjconver=data1[1];\n\t\t\t\t\tdocument.getElementById('jpoints').value =jpoints;\n\n\t\t\t\t\tif(totaldisplay=='' && chargeoption != '2') {\n\t\t\t\t\t\tif(parseInt(chargeoption)<='2')\n\t\t\t\t\t\t{\n\t\t\t \t\t\t\tdocument.getElementById('ad_totalamount').innerHTML='';\n\t\t\t \t\t\t\tdocument.getElementById('currency').innerHTML='';\n\t\t \t\t\t\t}\n\t\t \t\t }\n\t\t\t\t\telse if(!(jpoints<0)){\n\t\t\t\t \t\tdocument.getElementById('ad_totalamount').innerHTML= '<big>'+ Math.round(amt1 * jconver) + '</big>';\n\t\t\t\t \t\tdocument.getElementById('totalamount').value = Math.round(amt1 * jconver);\n\t\t\t\t \tvar points = document.getElementById('jpoints').value;\n\t\t\t\t \tif(points == ''){\n\t\t\t\t\t \tpoints = 0;\n\t\t\t\t \t}\n\t\t\t\t \t document.getElementById('currency').innerHTML='<big>" . JText::_('POINT') . "</big>' + '<small><i>" . JText::_('POINTS_AVAILABLE') . "'+ ' ' + points + ' '+' " . JText::_('POINT') . "</i></small>';\n\t\t\t\t\t\tdocument.getElementById('hcurrency').value='<big>" . JText::_('POINT') . "</big>' + '<small><i>" . JText::_('POINTS_AVAILABLE') . "'+ ' ' + points + ' '+' " . JText::_('POINT') . "</i></small>';\n\t\t\t\t\t\tdocument.getElementById('rate').innerHTML=jconver+' " . JText::_('POINT') . ' = 1 ' . $socialads_config['currency'] . "';\n\t\t\t\t\t\tdocument.getElementById('hrate').value=jconver +' " . JText::_('POINT') . " = 1 " . $socialads_config['currency'] . "';\n\t\t\t\t\t}\n\t\t\t\t \telse{\n\t\t\t\t \t\tdocument.getElementById('rate').innerHTML='';\n\t\t\t\t \t\tcaltotal();\n\t\t\t\t \t}\n\t\t\t\t}\n\t\t\t});\n\t}\n\n\t\tjQuery(function() {\n\t\tvar totaldisplay=document.getElementById('totaldisplay').value;\n\n\t\tjQuery('#sa_recuring').change(function(){\n\t\t\tvar re_jsondata = '" . $re_selectbox_json . "';\n\t\t\tvar re_select = jQuery.parseJSON(re_jsondata);\n\t\t\tchargeselected=document.getElementById('chargeoption').value;\n\t\t\tif(document.getElementById('chargeoption').value > '2'){\n\t\t\t\tif (jQuery('#sa_recuring').is(':checked'))\n\t\t\t\t{\n\t\t\t\t\tdocument.getElementById('total_days_label').innerHTML = '" . JText::_("SA_RENEW_RECURR") . "'+' '+jQuery('#chargeoption option:selected').text();\n\n \t\t\t\tif(parseInt(chargeselected)>2)\n \t\t\t\t\tdocument.getElementById('totalamtspan').innerHTML = '" . JText::_("TOTAL_SLAB") . "'+' '+jQuery('#chargeoption option:selected').text();\n\t\t\t\t\t//removeoption(re_select);\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tdocument.getElementById('total_days_label').innerHTML = '" . JText::_("SA_RENEW_NO_RECURR") . "'+' '+jQuery('#chargeoption option:selected').text();\n \t\t\t\t\tdocument.getElementById('totalamtspan').innerHTML = '" . JText::_("TOTAL") . "'\n\t\t\t\t\t//addoption(re_select);\n\t\t\t\t}\n\t\t\t}\n\t });\n\t jQuery('#sa_recuring').change();\n\t\tif(document.getElementById('editview').value=='1'){\n\t\t\tcalpoints();\n\t\t}\n\t});\n\t"; $document->addScriptDeclaration($js); // Load the calendar behavior //JHtml::_('behavior.calendar'); $articlelink = JRoute::_('index.php?option=com_content&tmpl=component&view=article&id=' . $socialads_config['tnc']); //bottom div starts here ?> <div id="bottomdiv" style="display:block;">
function saveTargetingData($post) { require JPATH_SITE . DS . "administrator" . DS . "components" . DS . "com_socialads" . DS . "config" . DS . "config.php"; $session = JFactory::getSession(); $app = JFactory::getApplication(); //.. do Back End Stuff if ($app->isAdmin()) { $ad_creator_id = $post->get('ad_creator_id'); $user = JFactory::getUser($ad_creator_id); $userid = $user->id; } else { $user = JFactory::getUser(); $userid = $user->id; } if (!$userid) { $userid = 0; return false; } $adData = new stdClass(); $adData->ad_id = ''; $ad_id = $session->get('ad_id'); $tagetId = ''; //Get primary key of table if ($ad_id) { $adData->ad_id = $ad_id; //Get order id // @params $value,$field_name,$tableName $targetAdId = $this->getIdFromAnyFieldValue($adData->ad_id, 'ad_id', '#__ad_geo_target'); if ($targetAdId) { $tagetId = $targetAdId; } } else { $app = JFactory::getApplication(); $app->enqueueMessage('Session Expire', 'error'); return false; } //Added for geo targeting $geo_type = $post->get('geo_type', '', 'STRING'); $geo_fields = $post->get('geo', '', 'Array'); $geo_target = $post->get('geo_targett', '', 'INT'); $social_target = $post->get('social_targett', '', 'INT'); $context_target = $post->get('context_targett', '', 'INT'); //Set geoflag $geoflag = 0; if (isset($geo_fields) || !empty($geo_fields)) { foreach ($geo_fields as $geo) { if (!empty($geo)) { $geoflag = 1; break; } } } $context_target_data = $post->get('context_target_data', '', 'Array'); $context_target_data_keywordtargeting = $context_target_data['keywordtargeting']; //check to decide if ad is non targeted ie guest ad /*if( $geo_target=="1" && !$geoflag && !($social_target=="1") || !($geo_target=="1") && !($social_target=="1") ) { if(($context_target!="1") || ($context_target=="1" &&!($context_target_data_keywordtargeting))) { $adData->ad_guest = 1; } else { $adData->ad_guest = 0; } }*/ //IF any one targeting set then ad is not a guest ad if ($geo_target || $social_target || $context_target) { $adData->ad_guest = 0; } else { $adData->ad_guest = 1; } //Start of geo if ($socialads_config['geo_target'] && $geo_target == "1") { $geo_adfields = $geo_fields; //form field name="geo[country]" name="geo[region]" name="geo[city]" if ($geoflag) { $first_key = array_keys($geo_fields); $type = str_replace("by", "", $geo_type); //name="geo_type" everywhere || city || region $fielddata = new stdClass(); $fielddata->id = ''; //Get tagert table id if ($tagetId) { $fielddata->id = $tagetId; } $fielddata->ad_id = $ad_id; foreach ($geo_fields as $key => $value) { if ($first_key[0] == $key) { // for country $fielddata->{$key} = $value; } else { if ($type == $key) { // for region & city $fielddata->{$key} = $value; } else { if ($geo_type == "everywhere") { break; } } } } if ($fielddata->id) { if (!$this->_db->updateObject('#__ad_geo_target', $fielddata, 'id')) { echo $this->_db->stderr(); return false; } } else { if (!$this->_db->insertObject('#__ad_geo_target', $fielddata, 'id')) { echo $this->_db->stderr(); return false; } } } } else { $query = "DELETE FROM #__ad_geo_target WHERE ad_id=" . $ad_id; $this->_db->setQuery($query); if (!$this->_db->execute()) { echo $this->_db->stderr(); return false; } } /*end of geo*/ /*Start of context*/ //Get primary key of table if (!empty($ad_id)) { //Get order id // @params $value,$field_name,$tableName $id = $this->getIdFromAnyFieldValue($ad_id, 'ad_id', '#__ad_contextual_target'); if ($id) { $context_targetId = $id; } } else { $app = JFactory::getApplication(); $app->enqueueMessage('Session Expire', 'error'); return false; } if ($socialads_config['context_target'] && $context_target == "1") { if ($context_target_data_keywordtargeting) { $context_target = new stdClass(); $context_target->id = ''; $context_target->ad_id = $ad_id; if ($context_targetId) { $context_target->id = $context_targetId; } $context_target->keywords = trim(strtolower($context_target_data_keywordtargeting)); if ($context_target->id) { if (!$this->_db->updateObject('#__ad_contextual_target', $context_target, 'id')) { echo $this->_db->stderr(); return false; } } else { if (!$this->_db->insertObject('#__ad_contextual_target', $context_target, 'id')) { echo $this->_db->stderr(); return false; } } } } else { if ($context_targetId) { $query = "DELETE FROM #__ad_contextual_target WHERE id=" . $context_targetId; $this->_db->setQuery($query); if (!$this->_db->execute()) { echo $this->_db->stderr(); } } } //START Save --Social Targeting data-- //$buildadsession->set('ad_fields',$data['mapdata']); //$session_adfields = $buildadsession->get('ad_fields'); //$profile=$buildadsession->get('plg_fields'); $ad_fields = $post->get('mapdata', '', 'Array'); $profile = $post->get('plgdata', '', 'Array'); //Get social target ID // @params $value,$field_name,$tableName if ($ad_id) { $db = JFactory::getDBO(); if ($social_target == "1") { $db = JFactory::getDBO(); $app = JFactory::getApplication(); $dbprefix = $app->getCfg('dbprefix'); $tbexist_query = "SHOW TABLES LIKE '" . $dbprefix . "ad_fields'"; $db->setQuery($tbexist_query); $isTableExist = $db->loadResult(); if ($isTableExist) { $query = "SELECT adfield_id FROM #__ad_fields\n\t\t\t\t\tWHERE adfield_ad_id = " . $ad_id; $db->setQuery($query); $adfield_id = $db->loadResult(); } } } if ((!empty($ad_fields) || !empty($profile)) && $social_target == "1") { //For saving demographic details $fielddata = new stdClass(); $fielddata->adfield_id = ''; if ($adfield_id) { $fielddata->adfield_id = $adfield_id; } $fielddata->adfield_ad_id = $ad_id; $date_low = date('Y-m-d 00:00:00', mktime(0, 0, 0, 01, 1, 1910)); $date_high = date('Y-m-d 00:00:00', mktime(0, 0, 0, 01, 1, 2030)); $grad_low = 0; $grad_high = 2030; if (!empty($ad_fields)) { foreach ($ad_fields as $mapdata) { foreach ($mapdata as $m => $map) { if ($m) { if (strstr($m, ',')) { $selcheck = explode(',', $m); $var = isset($fielddata->{$selcheck}[0]); } else { $var = isset($fielddata->{$m}); } if (!$var) { if (strstr($m, '|')) { $rangecheck = explode('|', $m); if ($rangecheck[2] == 0) { if ($map) { if ($rangecheck[1] == 'daterange') { $date_low = $map; } elseif ($rangecheck[1] == 'numericrange') { $grad_low = $map; } } if ($rangecheck[1] == 'daterange') { $fielddata->{$rangecheck}[0] = $date_low; } elseif ($rangecheck[1] == 'numericrange') { $fielddata->{$rangecheck}[0] = $grad_low; } //0 } elseif ($rangecheck[2] == 1) { if ($map) { if ($rangecheck[1] == 'daterange') { $date_high = $map; } elseif ($rangecheck[1] == 'numericrange') { $grad_high = $map; } } if ($rangecheck[1] == 'daterange') { $fielddata->{$rangecheck}[0] = $date_high; } elseif ($rangecheck[1] == 'numericrange') { $fielddata->{$rangecheck}[0] = $grad_high; } //2030 } } elseif (strstr($m, ',')) { $selcheck = explode(',', $m); if ($selcheck[1] == 'select') { if ($map) { $fielddata->{$selcheck}[0] = '|' . $map . '|'; } else { $fielddata->{$selcheck}[0] = $map; } } } else { $fielddata->{$m} = $map; } } else { if (strstr($m, ',')) { $selcheck = explode(',', $m); if ($selcheck[1] == 'select') { $fielddata->{$selcheck}[0] .= '|' . $map . '|'; } } else { $fielddata->{$m} .= '|' . $map . '|'; } //$fielddata->$m .= ','.$map; } } } } } $socialadshelper = new socialadshelper(); $tableColumns = $socialadshelper->getTableColumns('ad_fields'); JPluginHelper::importPlugin('socialadstargeting'); $dispatcher = JDispatcher::getInstance(); $results = $dispatcher->trigger('onFrontendTargetingSave', array($profile, $tableColumns)); for ($i = 0; $i < count($results); $i++) { if ($results[$i] != "") { foreach ($results[$i] as $key => $value) { $fielddata->{$key} = $value; } } } //insert fields $db = JFactory::getDBO(); $app = JFactory::getApplication(); $dbprefix = $app->getCfg('dbprefix'); $tbexist_query = "SHOW TABLES LIKE '" . $dbprefix . "ad_fields'"; $db->setQuery($tbexist_query); $isTableExist = $db->loadResult(); if ($isTableExist) { if ($fielddata->adfield_id) { if (!$this->_db->updateObject('#__ad_fields', $fielddata, 'adfield_id')) { echo $this->_db->stderr(); return false; } } else { if (!$this->_db->insertObject('#__ad_fields', $fielddata, 'adfield_id')) { echo $this->_db->stderr(); return false; } } } } else { if ($adfield_id) { $this->deleteData('ad_fields', 'adfield_id', $adfield_id); } } //Update ad data table if (!$this->_db->updateObject('#__ad_data', $adData, 'ad_id')) { echo $this->_db->stderr(); return false; } //empty condition checkin ends //END Save --Social Targeting data-- return true; }
$jlikehtml = $adRetriever->DisplayjlikeButton($ad_url, $addata->ad_id, $addata->ad_title); if ($jlikehtml) { ?> <div style="clear:both;"></div> <div class="sa_ad_after_display"> <?php echo $jlikehtml; ?> </div> <?php } //Integration with Jlike $ad_url = JUri::root() . substr(JRoute::_($ad_url), strlen(JUri::base(true)) + 1); $add_this_share = ''; if ($socialads_config['se_addthis']) { $socialadshelper = new socialadshelper(); $add_this_share = ' <!-- AddThis Button BEGIN --> <div class="addthis_toolbox addthis_default_style "> <a href="https://www.addthis.com/bookmark.php" class="addthis_button" addthis:url="' . $ad_url . '" ></a> </div> <!-- AddThis Button END --> '; $pid = ''; if ($socialads_config['sa_addthis_pub'] != '') { $pid = '#pubid=' . $socialads_config['sa_addthis_pub']; } $add_this_js = 'https://s7.addthis.com/js/250/addthis_widget.js' . $pid;
function sa_processFreeOrder() { $socialadshelper = new socialadshelper(); $socialadshelper->processFreeOrder(1); }
function store() { require JPATH_SITE . DS . "administrator" . DS . "components" . DS . "com_socialads" . DS . "config" . DS . "config.php"; global $mainframe; $mainframe = JFactory::getApplication(); $input = JFactory::getApplication()->input; //for getting adfield_id from DB $db = JFactory::getDBO(); $user = JFactory::getUser(); $data = JRequest::get('post'); $data = $this->dataSanitize($data); $user = JFactory::getUser(); $build = new stdClass(); $ad_id = $input->get('adid', 0, 'INT'); $build->ad_id = $ad_id; $imgname = str_replace(JUri::base(), '', $data['upimg']); foreach ($data['addata'] as $addata) { foreach ($addata as $k => $ad) { $build->{$k} = $ad; } } //code for guest $geoflag = 0; if (isset($data['geo']) || !empty($data['geo'])) { foreach ($data['geo'] as $geo) { if (!empty($geo)) { $geoflag = 1; break; } } } if (isset($data['geo_target']) && !$geoflag && !isset($data['social_target']) || !isset($data['geo_target']) && !isset($data['social_target'])) { if ($data['context_target'] == "on" && !$data['context_target_data_keywordtargeting'] || $data['context_target'] != "on") { $build->ad_guest = 1; } else { $build->ad_guest = 0; } } else { $build->ad_guest = 0; } //code for guest $build->ad_image = $imgname; $build->layout = $data['layout']; //update fields if (!$this->_db->updateObject('#__ad_data', $build, 'ad_id')) { echo $this->_db->stderr(); return false; } //For saving demographic details /*start of geo*/ $fielddata = new stdClass(); $fielddata->ad_id = $build->ad_id; if ($socialads_config['geo_target'] && !empty($data['geo_target'])) { $geo_adfields = $data['geo']; if ($geoflag) { $first_key = array_keys($data['geo']); $type = str_replace("by", "", $data['geo_type']); foreach ($data['geo'] as $key => $value) { if ($first_key[0] == $key) { $fielddata->{$key} = $value; } else { if ($data['geo_type'] == "everywhere") { $fielddata->{$key} = ""; } else { if ($type == $key) { $fielddata->{$key} = $value; } } } } $query = "SELECT a.id FROM #__ad_geo_target AS a, #__ad_data AS b WHERE a.ad_id=" . $ad_id . " AND a.ad_id=b.ad_id AND b.ad_creator=" . $user->id . ""; $db->setQuery($query); $adfieldid = $db->loadResult(); $query = "DELETE FROM #__ad_geo_target WHERE ad_id=" . $ad_id; $this->_db->setQuery($query); if (!$db->execute()) { echo $this->_db->stderr(); } $fielddata->id = ''; if (!$this->_db->insertObject('#__ad_geo_target', $fielddata, 'id')) { echo $this->_db->stderr(); //return false; } } } else { $query = "DELETE FROM #__ad_geo_target WHERE ad_id=" . $ad_id; $this->_db->setQuery($query); if (!$db->execute()) { echo $this->_db->stderr(); } } /*end of geo*/ /*start of context*/ $fielddata = new stdClass(); $fielddata->id = ''; $fielddata->ad_id = $build->ad_id; $fielddata->keywords = strtolower(trim($context_adfields)); $query = "SELECT id FROM #__ad_contextual_target AS a, #__ad_data AS b WHERE a.ad_id=" . $ad_id . " AND a.ad_id=b.ad_id "; $db->setQuery($query); $adfieldid = $db->loadResult(); if ($socialads_config['context_target']) { if ($data['context_target'] == "on") { $context_adfields = trim($data['context_target_data_keywordtargeting']); if ($context_adfields) { $fielddata->keywords = strtolower(trim($context_adfields)); if ($adfieldid) { $fielddata->id = $adfieldid; if (!$this->_db->updateObject('#__ad_contextual_target', $fielddata, 'id')) { } } else { if (!$this->_db->insertObject('#__ad_contextual_target', $fielddata, 'id')) { echo $this->_db->stderr(); return false; } } } } else { if ($adfieldid) { $fielddata->id = $adfieldid; $query = 'DELETE FROM #__ad_contextual_target' . ' WHERE id= ' . $fielddata->id; $db->setQuery($query); if (!$db->execute()) { } } } } else { if ($adfieldid) { //echo "HERE4"; $fielddata->id = $adfieldid; $query = 'DELETE FROM #__ad_contextual_target' . ' WHERE id= ' . $fielddata->id; $db->setQuery($query); if (!$db->execute()) { } } } /*end of context*/ $fielddata = new stdClass(); $ad_id = $input->get('adid', 0, 'INT'); $socialadshelper = new socialadshelper(); $adfields = $socialadshelper->chkadfields(); if (!empty($adfields)) { $query = "SELECT distinct adfield_id\n\t\t\tFROM #__ad_fields AS a, #__ad_data AS b\n\t\t\tWHERE a.adfield_ad_id=" . $ad_id . " AND b.ad_creator=" . $user->id . ""; $db->setQuery($query); $adfieldid = $db->loadResult(); $fieldsas = $db->getTableColumns("#__ad_fields"); if ($data['social_target'] == "on" && !empty($fieldsas)) { //chk empty $query = "SELECT COUNT(*) FROM #__ad_fields AS f WHERE f.adfield_ad_id=" . $build->ad_id; $db->setQuery($query); $count = $db->loadResult(); $fielddata->adfield_id = $adfieldid; $fielddata->adfield_ad_id = $build->ad_id; $date_low = date('Y-m-d 00:00:00', mktime(0, 0, 0, 01, 1, 1910)); $date_high = date('Y-m-d 00:00:00', mktime(0, 0, 0, 01, 1, 2030)); $grad_low = 0; $grad_high = 2030; foreach ($data['mapdata'] as $mapdata) { foreach ($mapdata as $m => $map) { if ($m) { if (strstr($m, ',')) { $selcheck = explode(',', $m); $var = isset($fielddata->{$selcheck}[0]); } else { $var = isset($fielddata->{$m}); } if (!$var) { if (strstr($m, '|')) { $rangecheck = explode('|', $m); if ($rangecheck[2] == 0) { if ($map) { if ($rangecheck[1] == 'daterange') { $date_low = $map; } elseif ($rangecheck[1] == 'numericrange') { $grad_low = $map; } } if ($rangecheck[1] == 'daterange') { $fielddata->{$rangecheck}[0] = $date_low; } elseif ($rangecheck[1] == 'numericrange') { $fielddata->{$rangecheck}[0] = $grad_low; } //0 } elseif ($rangecheck[2] == 1) { if ($map) { if ($rangecheck[1] == 'daterange') { $date_high = $map; } elseif ($rangecheck[1] == 'numericrange') { $grad_high = $map; } } if ($rangecheck[1] == 'daterange') { $fielddata->{$rangecheck}[0] = $date_high; } elseif ($rangecheck[1] == 'numericrange') { $fielddata->{$rangecheck}[0] = $grad_high; } //2030 } } elseif (strstr($m, ',')) { $selcheck = explode(',', $m); if ($selcheck[1] == 'select') { if ($map) { $fielddata->{$selcheck}[0] = '|' . $map . '|'; } else { $fielddata->{$selcheck}[0] = $map; } } } else { $fielddata->{$m} = $map; } } else { if (strstr($m, ',')) { $selcheck = explode(',', $m); if ($selcheck[1] == 'select') { $fielddata->{$selcheck}[0] .= '|' . $map . '|'; } } else { $fielddata->{$m} .= '|' . $map . '|'; } //$fielddata->$m .= ','.$map; } } } } JPluginHelper::importPlugin('socialadstargeting'); $dispatcher = JDispatcher::getInstance(); $results = $dispatcher->trigger('onFrontendTargetingSave', array($data['plgdata'])); // $res = new stdClass(); for ($j = 0; $j < count($results); $j++) { if ($results[$j] != "") { foreach ($results[$j] as $key => $value) { $fielddata->{$key} = $value; } } } if ($count > 0) { //if multiselect box is empty then field name should be post blank value $db = JFactory::getDBO(); $query = "SELECT mapping_fieldname FROM #__ad_fields_mapping WHERE mapping_fieldtype='multiselect'"; $db->setQuery($query); $mulfields = $db->loadResultarray(); foreach ($fielddata as $k => $v) { $fields[] = $k; } for ($i = 0; $i < count($mulfields); $i++) { if (!in_array($mulfields[$i], $fields)) { $fielddata->{$mulfields}[$i] = ''; } } //update fields if (!$this->_db->updateObject('#__ad_fields', $fielddata, 'adfield_id')) { echo $this->_db->stderr(); return false; } } else { $fielddata->adfield_id = null; //insert fields if (!$this->_db->insertObject('#__ad_fields', $fielddata, 'adfield_id')) { echo $this->_db->stderr(); return false; } } } else { if ($data['social_target'] != "on" && $adfieldid) { //echo "HERE4"; $fielddata->id = $adfieldid; $query = 'DELETE FROM #__ad_fields' . ' WHERE adfield_id= ' . $adfieldid; $db->setQuery($query); if (!$db->execute()) { } } } } //chk empty if ($socialads_config['all_approval'] == 1 && $socialads_config['approval'] == 1) { $build = new stdClass(); $build->ad_id = $ad_id; $build->ad_approved = '0'; //update fields if (!$this->_db->updateObject('#__ad_data', $build, 'ad_id')) { echo $this->_db->stderr(); return false; } } //mail function after upadting an Ad $query = "SELECT a.ad_title, u.username FROM #__ad_data as a, #__users as u\n\t\t\t\t\t\tWHERE a.ad_creator=u.id\n\t\t\t\t\t\tAND a.ad_id=" . $ad_id; $this->_db->setQuery($query); $result = $this->_db->loadObject(); //print_r($result); $body = JText::_('UPDATE_MAIL_BODY'); $body = str_replace('{username}', $result->username, $body); $ad_title = $result->ad_title != '' ? JText::_("PERIDIC_STATS_ADTIT") . ' <b>"' . $result->ad_title . '"</b>' : JText::_("PERIDIC_STATS_ADID") . ' : <b>' . $ad_id . '</b>'; $body = str_replace('{title}', $ad_title, $body); $body = str_replace('{link}', JUri::base() . 'administrator/index.php?option=com_socialads&view=approveads', $body); $from = $mainframe->getCfg('mailfrom'); $fromname = $mainframe->getCfg('fromname'); $recipient = $mainframe->getCfg('mailfrom'); $user = JFactory::getUser(); $subject = JText::_('MAIL_UPDATE_SUB'); $body = nl2br($body); $mode = 1; $cc = null; $bcc = null; $bcc = null; $attachment = null; $replyto = null; $replytoname = null; JFactory::getMailer()->sendMail($from, $fromname, $recipient, $subject, $body, $mode, $cc, $bcc, $attachment, $replyto, $replytoname); return true; }
<div class="tab-pane step-pane active" id="adsstep1"> <?php $socialadshelper = new socialadshelper(); $billpath = $socialadshelper->getViewpath('checkout', 'billing'); ob_start(); include $billpath; $html = ob_get_contents(); ob_end_clean(); echo $html; ?> <br> </div> <div class="tab-pane step-pane" id="adsstep2"> <h2>adsstep 2]</h2> <?php $socialadshelper = new socialadshelper(); $billpath = $socialadshelper->getViewpath('checkout', 'adsummary'); ob_start(); include $billpath; $html = ob_get_contents(); ob_end_clean(); echo $html; ?> <br> </div> <div class="tab-pane step-pane" id="adsstep3"> <h2>Okay</h2> Now you are at the 3rd step of this wizard example.<br> </div> </div>
* @license GNU General Public License version 2, or later */ defined('_JEXEC') or die('Restricted access'); //JHtml::_('behavior.formvalidation'); //jimport( 'joomla.form.formvalidator' ); JHtml::_('behavior.tooltip'); JHtmlBehavior::framework(); //$params = JComponentHelper::getParams( 'com_socialads' ); $baseurl = JRoute::_(JUri::root() . 'index.php'); ?> <fieldset class="sa_fieldset"> <legend class="hidden-desktop"><?php echo JText::_('COM_SOCIALADS_CKOUT_BILL_DETAILS'); ?> </legend> <div id="ads_mainwrapper" class="row-fluid form-horizontal"> <?php $socialadshelper = new socialadshelper(); $buildformPath = $socialadshelper->getViewpath('buildad', 'billform'); ob_start(); include $buildformPath; $billhtml = ob_get_contents(); ob_end_clean(); echo $billhtml; ?> </div> </fieldset>
/** * Buildad view display method * @return void **/ function display($tpl = null) { $input = JFactory::getApplication()->input; $layout = $input->get('layout', 'default'); $user = JFactory::getUser(); if ($user->id) { //User authorized to view chat history if (!JFactory::getUser($user->id)->authorise('core.create_ad', 'com_socialads')) { $app = JFactory::getApplication(); $app->enqueueMessage(JText::_('COM_SOCIALADS_AUTH_ERROR'), 'warning'); return false; } } $model = $this->getModel('buildad'); //$post=$input->post; if ($input->get('frm', '', 'STRING') != 'editad' && $input->get('frm', '', 'STRING') != 'directad') { $buildadsession = JFactory::getSession(); $buildadsession->clear('ad_data'); $buildadsession->clear('ad_image'); $buildadsession->clear('upimgcopy'); $buildadsession->clear('ad_fields'); $buildadsession->clear('plg_fields'); $buildadsession->clear('upimg'); $buildadsession->clear('datefrom'); $buildadsession->clear('dateto'); $buildadsession->clear('ad_totaldays'); $buildadsession->clear('ad_totaldisplay'); $buildadsession->clear('totalamount'); $buildadsession->clear('ad_chargeoption'); $buildadsession->clear('ad_gateway'); $buildadsession->clear('ad_currency'); $buildadsession->clear('ad_rate'); $buildadsession->clear('guestbutton'); $buildadsession->clear('addatapluginlist'); $buildadsession->clear('pluginimg'); $buildadsession->clear('user_points'); //Added by sagar $buildadsession->clear('arb_flag'); $buildadsession->clear('order_id'); //Added by sagar //added for geo targeting $buildadsession->clear('geo_type'); $buildadsession->clear('geo_fields'); $buildadsession->clear('geo_target'); $buildadsession->clear('social_target'); //added for geo targeting $buildadsession->clear('context_target_data_keywordtargeting'); //$buildadsession->clear('ad_id'); $buildadsession->clear('camp'); $buildadsession->clear('value'); $buildadsession->clear('pricing_opt'); } $model = $this->getModel('buildad'); $fields = $this->get('Fields'); $this->fields = $fields; // url select list $url1 = array(); $url1[] = JHtml::_('select.option', 'http', JText::_("HTTP")); $url1[] = JHtml::_('select.option', 'https', JText::_("HTTPS")); $this->assignRef('url1', $url1); //for payment-info. view $result = $this->get('Payment'); $this->paypal = $result; //session variable for ad-data $buildadsession = JFactory::getSession(); $this->managead_adid = $ad_id = $input->get('adid', 0, 'INT'); $session = JFactory::getSession(); if (!$ad_id) { $ad_id = $session->get('ad_id'); } $session->set('ad_id', $ad_id); $this->ad_id = $ad_id; $this->allowWholeAdEdit = 1; $socialadshelper = new socialadshelper(); $this->Itemid = $socialadshelper->getSocialadsItemid('managead'); if ($ad_id) { $builadModel = $this->getModel(); $this->checkItIsuserAd = $builadModel->checkItIsuserAd($ad_id); if (!$this->checkItIsuserAd) { $session->clear('ad_id'); return false; } require_once JPATH_SITE . DS . 'components' . DS . 'com_socialads' . DS . 'models' . DS . 'managead.php'; $managead_model = new socialadsModelManageAd(); //var_dump($managead_model); die('adasdasd'); $addata_for_adsumary_edit = $managead_model->getData($ad_id); //$this->assignRef( 'ad_socialtarget',$addata[0] ); $this->assignRef('addata_for_adsumary_edit', $addata_for_adsumary_edit[1]); $this->assignRef('social_target', $addata_for_adsumary_edit[0]); $zone = $managead_model->getzone($ad_id); $this->assignRef('zone', $zone[0]); $this->geo_target = $managead_model->getData_geo($ad_id); //$this->assignRef( 'geo_target', $managead_model->getData_geo()); $Data_context_target = $managead_model->getData_context_target($ad_id); $this->assignRef('context_target', $Data_context_target['keywords']); $this->assignRef('context_target_data_keywordtargeting', $Data_context_target['keywords']); $this->pricingData = $builadModel->getpricingData($ad_id); $sa_addCredit = $input->get('sa_addCredit', 0); $this->sa_addCredit = $sa_addCredit; // called from add more credit $this->editableSteps = array(); if (!empty($sa_addCredit)) { $socialadshelper = new socialadshelper(); $user = JFactory::getUser(); $sa_addCredit = $input->get('sa_addCredit'); $this->editableSteps = $socialadshelper->adStateForAddMoreCredit($ad_id, $user->id); } else { $this->allowWholeAdEdit = $builadModel->allowWholeAdEdit($ad_id); } // print_r($this->editableSteps); die; } else { $ad_data = $buildadsession->get('ad_data'); $this->ad_data = $ad_data; //added for geo targeting //session variable for geo_fields $this->geo_target = $buildadsession->get('geo_target'); $this->geo_type = $buildadsession->get('geo_type'); $this->geo_fields = $buildadsession->get('geo_fields'); $this->context_target_data_keywordtargeting = $buildadsession->get('context_target_data_keywordtargeting'); $this->social_target = $buildadsession->get('social_target'); } //for camp edit //$this->assignRef( 'bid_value',$buildadsession->get('bid_value' )); //print_r($this->bid_value); die("im view buildad"); //$this->assignRef( 'ad_data',$ad_data ); //Extra code for zone $defaultzone_show = 1; $Check_default_zone = $this->get('defaultzone'); if (count($Check_default_zone) == 1) { $defaultzone_show = $model->checkdefaultzone($Check_default_zone); } $this->assignRef('Check_default_zone', $Check_default_zone); $this->assignRef('defaultzone_show', $defaultzone_show); //Extra code for zone $camp_dd = $this->get('campaign'); $this->assignRef('camp_dd', $camp_dd); if ($campid = $input->get('campid', 0, 'INT')) { $model = $this->getModel('buildad'); $cname = $model->getcampname($campid); $this->assignRef('cname', $cname); } $this->setLayout($layout); //die('asdasdasdasdasdasd'); // vm: started -------------------------------------- $this->country = $this->get("Country"); // load social ads config params require JPATH_SITE . DS . "administrator" . DS . "components" . DS . "com_socialads" . DS . "config" . DS . "config.php"; $selected_gateways = $socialads_config['gateways']; //getting GETWAYS $dispatcher = JDispatcher::getInstance(); JPluginHelper::importPlugin('payment'); //$params->get( 'gateways' ) = array('0' => 'paypal','1'=>'Payu'); if (!is_array($selected_gateways)) { $gateway_param[] = $selected_gateways; } else { $gateway_param = $selected_gateways; } if (!empty($gateway_param)) { $gateways = $dispatcher->trigger('onTP_GetInfo', array($gateway_param)); } $this->ad_gateways = $gateways; $this->userbill = array(); if (!empty($user->id)) { $this->userbill = $model->getbillDetails($user->id); } //Amol: $socialadshelper = new socialadshelper(); $this->adfieldsTableColumn = $socialadshelper->getTableColumns('ad_fields'); // vm: code end parent::display($tpl); }
// no direct access defined('_JEXEC') or die(';)'); //return; if (empty($this->ads)) { return; } $doc = JFactory::getDocument(); $ads = $this->ads; $moduleid = $this->moduleid; $zone_id = $this->zone; $params = $this->adRetriever; $adRetriever = $this->adRetriever; $lang = JFactory::getLanguage(); $lang->load('mod_socialads', JPATH_ROOT); require JPATH_SITE . DS . "administrator" . DS . "components" . DS . "com_socialads" . DS . "config" . DS . "config.php"; $socialadshelper = new socialadshelper(); $doc = JFactory::getDocument(); $doc->addStyleSheet(JUri::base() . 'modules/mod_socialads/css/style.css'); if ($params->get('ad_rotation', 0) == 1) { $socialadshelper->loadScriptOnce(JUri::root() . 'components' . DS . 'com_socialads' . DS . 'js' . DS . 'flowplayer-3.2.9.min.js'); $socialadshelper->loadScriptOnce(JUri::root() . 'components' . DS . 'com_socialads' . DS . 'js' . DS . 'adrotation.js'); $ad_rotationdelay = $params->get('ad_rotation_delay', 10); ?> <script> var site_link=""; var user_id=""; techjoomla.jQuery(document).ready(function() { var countdown; var module_id = '<?php
?> <!--step5--> <div class="tab-pane step-pane" id="step<?php echo $sa_stpeNo; ?> "> <!-- bill msg --> <div class="row-fluid "> <?php if (empty($showBilltab)) { ?> <div class="span12" id="sa_reomveMargin"> <?php JHTML::_('behavior.modal'); $catid = 0; $socialadshelper = new socialadshelper(); $itemid = $socialadshelper->getSocialadsItemid('buildad'); $terms_link = JURI::root() . substr(JRoute::_('index.php?option=com_socialads&view=buildad&layout=updatebill&tmpl=component&itemid=' . $itemid), strlen(JURI::base(true)) + 1); ?> <div class="alert alert-success " id=""> <?php echo JText::_('COM_SOCIALADS_BILL_INFO_ALREADY_STORED'); ?> <a rel="{handler: 'iframe', size: {x: 600, y: 600}}" href="<?php echo $terms_link; ?> " class="modal"> <strong><?php echo JText::_('COM_SOCIALADS_BILL_CLICK_HERE'); ?> </strong>
public function windowLocation() { require JPATH_SITE . DS . "administrator" . DS . "components" . DS . "com_socialads" . DS . "config" . DS . "config.php"; //Clear ad ID session $session = JFactory::getSession(); $session->clear('ad_id'); $socialadshelper = new socialadshelper(); $Itemid = $socialadshelper->getSocialadsItemid('managead'); $input = JFactory::getApplication()->input; $sa_special_access = $input->get('sa_special_access', '', 'STRING'); if ($sa_special_access) { $msg = JText::_('COM_SA_AD_SAVED'); } else { if ($socialads_config['approval']) { $msg = JText::_('SA_UPDATED_BILL_INFO') . ' ' . JText::_('COM_SA_ADMIN_APPROVAL_NOTICE'); } else { $msg = JText::_('SA_UPDATED_BILL_INFO'); } } $this->setRedirect('index.php?option=com_socialads&view=managead&Itemid=' . $Itemid, $msg); }
function _getCBFields() { //TODO: Use plugin id field list from defines $socialadshelper = new socialadshelper(); $cbchk = $socialadshelper->cbchk(); if (!empty($cbchk)) { $qry = "SELECT m.*, f.title AS field_label, f.name AS mapping_fieldname, f.type, f.fieldid AS id\n\t\t\t\t\t\tFROM #__comprofiler_fields AS f\n\t\t\t\t\t\tLEFT JOIN #__ad_fields_mapping AS m ON f.fieldid = m.mapping_fieldid\n\t\t\t\t\t\tWHERE f.published = 1 AND f.sys <> 1\t"; $this->_db->setQuery($qry); return $this->_db->loadobjectList(); } //empty check }
function processFreeOrder($adminCall = 0) { $jinput = JFactory::getApplication()->input; $order_id = $jinput->get('order_id', '', 'STRING'); $socialadshelper = new socialadshelper(); $adDetail = $socialadshelper->syncOrderDetail($order_id); // if order amount is 0 due to coupon if ($adDetail->ad_amount == 0 && !empty($adDetail->ad_coupon)) { $db = JFactory::getDBO(); $row = new stdClass(); $row->status = 'C'; $row->id = $order_id; if (!$db->updateObject('#__ad_payment_info', $row, 'id')) { echo $this->_db->stderr(); } $modelPath = JPATH_SITE . DS . 'components' . DS . 'com_socialads' . DS . 'models' . DS . 'showad.php'; if (!class_exists('socialadsModelShowad')) { //require_once $path; JLoader::register('socialadsModelShowad', $modelPath); JLoader::load('socialadsModelShowad'); } $data = array(); $data['status'] = 'C'; $data['payment_type'] = ''; $data['raw_data'] = ''; $pg_nm = ''; $socialadsModelShowad = new socialadsModelShowad(); $socialadsModelShowad->saveOrder($data, $order_id, $pg_nm); } $mainframe = JFactory::getApplication(); $response['msg'] = JText::_('DETAILS_SAVE'); if ($adminCall == 1) { $link = 'index.php?option=com_socialads&view=approveads'; } else { $Itemid = $socialadshelper->getSocialadsItemid('managead'); $link = JUri::base() . substr(JRoute::_('index.php?option=com_socialads&view=managead&layout=list&Itemid=' . $Itemid, false), strlen(JUri::base(true)) + 1); } $mainframe->redirect($link, $response['msg']); }
$order_id = 1; //var_dump($order_id); die("asdfasdf"); if (empty($order_id)) { ?> <div class="well" > <div class="alert alert-error"> <span ><?php echo JText::_('SA_UNABLE_TO_TRACK_ORDER_ID'); ?> </span> </div> </div> <?php return false; } $socialadshelper = new socialadshelper(); $adDetail = $socialadshelper->getOrderAndAdDetail($order_id); //var_dump($adDetail); die; $this->chargeoption = $adDetail['ad_payment_type']; $this->ad_totaldisplay = $adDetail['ad_credits']; // no of clicks or impression //print"<pre>"; print_r($adDetail); print"</pre>"; //die; // VM:: hv to add and code for jomsical points ( we are looking later for jomscial points) $gatwayName = 'bycheck'; $plugin = JPluginHelper::getPlugin('payment', $gatwayName); if (0 && $socialads_config['select_campaign'] == 0) { $pluginParams = json_decode($plugin->params); $this->assignRef('ad_gateway', $pluginParams->plugin_name); //added by sagar// $arb_enforce = ''; $this->assignRef('arb_enforce', $pluginParams->arb_enforce);
function add() { require_once JPATH_ROOT . DS . 'components' . DS . 'com_socialads' . DS . 'adshelper.php'; require_once JPATH_ROOT . DS . 'components' . DS . 'com_socialads' . DS . 'helper.php'; $itemid = socialadshelper::getSocialadsItemid('buildad'); global $mainframe; $mainframe = JFactory::getApplication(); $mainframe->redirect('index.php?option=com_socialads&view=buildad&Itemid=' . $itemid); }