function draft($activate = '') { require JPATH_SITE . DS . "administrator" . DS . "components" . DS . "com_socialads" . DS . "config" . DS . "config.php"; $input = JFactory::getApplication()->input; $model = $this->getModel('showad'); $ad_id = $input->get('adid', 0, 'INT'); $socialadshelper = new socialadshelper(); $itemid = $socialadshelper->getSocialadsItemid('managead'); $buildadsession = JFactory::getSession(); if (!$buildadsession->get('ad_id')) { if ($activate) { $adid = $model->store('save'); } else { $adid = $model->store('1'); } } else { $adid = $buildadsession->get('ad_id'); } if ($adid) { $sacontroller = new socialadsController(); $sacontroller->execute('delimages'); $msg = JText::_('DETAILS_SAVE'); if ($socialads_config['approval'] == 1) { $msg .= '<br>' . JText::_('AD_REVIEW'); } $link = JRoute::_("index.php?option=com_socialads&Itemid={$itemid}&view=managead", false); $this->setRedirect($link, $msg); } else { $msg = JText::_('ERROR_SAVE'); } }
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); }
// 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'); ?> </div>
<!--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> </a>
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; }
/** * 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); }
function draftAd() { $model = $this->getModel('buildad'); $model->draftAd(); $app = JFactory::getApplication(); if ($app->isAdmin()) { $redirectUrl = 'index.php?option=com_socialads&view=approveads'; } else { $socialadshelper = new socialadshelper(); $Itemid = $socialadshelper->getSocialadsItemid('managead'); $redirectUrl = 'index.php?option=com_socialads&view=managead&Itemid=' . $Itemid; } $this->setRedirect($redirectUrl, $msg); }
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']); }
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 processpayment($post, $pg_nm, $pg_action, $order_id, $org_amt) { $return_resp = array(); require JPATH_SITE . DS . "administrator" . DS . "components" . DS . "com_socialads" . DS . "config" . DS . "config.php"; $db = JFactory::getDBO(); //Authorise Post Data if ($post['plugin_payment_method'] == 'onsite') { $plugin_payment_method = $post['plugin_payment_method']; } //get VARS $vars = $this->getPaymentVars($pg_nm, $order_id); //END vars $dispatcher = JDispatcher::getInstance(); JPluginHelper::importPlugin('payment', $pg_nm); $data = $dispatcher->trigger($pg_action, array($post, $vars)); $data = $data[0]; $socialadshelper = new socialadshelper(); $buildad_itemid = $socialadshelper->getSocialadsItemid('managead'); $billing_itemid = $socialadshelper->getSocialadsItemid('billing'); //get order id if (empty($order_id)) { $order_id = $data['order_id']; } $return_resp['return'] = $data['return']; $processed = 0; $res = $this->storelog($pg_nm, $data); $processed = $this->Dataprocessed($data['transaction_id'], $order_id); $query = "SELECT o.ad_amount\n\t\t\t\tFROM #__ad_payment_info as o\n\t\t\t\twhere o.id=" . $order_id; $this->_db->setQuery($query); $order_amount = $this->_db->loadResult(); $return_resp['status'] = '0'; if ($data['status'] == 'C' && $order_amount == $data['total_paid_amt']) { if ($processed == 0) { $this->saveOrder($data, $order_id, $pg_nm); //$return_resp['return']=JRoute::_(JUri::root().'index.php?option=com_socialads&view=payment&layout=success'); $return_resp['return'] = JUri::root() . substr(JRoute::_('index.php?option=com_socialads&view=billing&itemid=' . $billing_itemid, false), strlen(JUri::base(true)) + 1); } $return_resp['msg'] = $data['success']; $return_resp['status'] = '1'; } else { if (!empty($data['status'])) { if ($plugin_payment_method and $data['status'] == 'P') { //to do for comfirm // $transc = $this->add_transc($org_amt,$order_id); $return_resp['return'] = JUri::root() . substr(JRoute::_('index.php?option=com_socialads&view=billing&itemid=' . $billing_itemid, false), strlen(JUri::base(true)) + 1); } else { if ($plugin_payment_method and $data['status'] != 'P') { $return_resp['return'] = JRoute::_(JUri::root() . 'index.php?option=com_socialads&view=showad&layout=cancelorder'); } } if ($order_amount != $data['total_paid_amt']) { $data['status'] = 'E'; $this->cancelOrder($data, $order_id, $pg_nm); } else { if ($data['status'] != 'C') { $data['status'] = 'P'; $this->cancelOrder($data, $order_id, $pg_nm); } else { if ($data['status'] != 'C' and $processed == 0) { $data['status'] = 'P'; $this->updateOrderStatus($data, $order_id, $pg_nm); } } } $return_resp['status'] = '0'; $res->processor = $data['processor']; $return_resp['msg'] = $data['error']['code'] . $data['error']['desc']; } } //$this->SendOrderMAil($order_id,$pg_nm); //as we have not going to send any mail till order confirm return $return_resp; }
/** * 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 mailExpir($adid, $mode) { global $mainframe; $mainframe = JFactory::getApplication(); $socialadshelper = new socialadshelper(); if ($mode == 0) { $itemid = $socialadshelper->getSocialadsItemid('buildad'); } $db = JFactory::getDBO(); $sql = "UPDATE #__ad_data\n\t\t\t\tSET ad_published = 0\n\t\t\t\tWHERE ad_id='" . $adid . "'\n\t\t\t\tAND ad_alternative <> 1\n\t\t\t\tAND ad_noexpiry <> 1"; $db->setQuery($sql); $db->execute(); if ($mode == 0) { $body = JText::_('EXPIRED'); $subject = JText::_('SUB_EXPR'); } else { $subject = JText::_('COM_SOCIALADS_WALEXPRI_SUBJ'); $body = JText::_('COM_SOCIALADS_WALEXPRI_BODY'); } $query = "SELECT a.ad_creator, a.ad_title, a.ad_url2, u.name, u.email\n\t\t\t\tFROM #__ad_data AS a, #__users AS u\n\t\t\t\tWHERE a.ad_id=" . $adid . "\n\t\t\t\tAND a.ad_creator=u.id"; $db->setQuery($query); $result = $db->loadObject(); $body = str_replace('[SEND_TO_NAME]', $result->name, $body); if ($mode == 0) { $ad_title = $result->ad_title != '' ? JText::_("PERIDIC_STATS_ADTIT") . ' <b>"' . $result->ad_title . '"</b>' : JText::_("PERIDIC_STATS_ADID") . ' : <b>' . $adid . '</b>'; $body = str_replace('[ADTITLE]', $ad_title, $body); } $sitename = $mainframe->getCfg('sitename'); $body = str_replace('[SITENAME]', $sitename, $body); $body = str_replace('[SITE]', JUri::base(), $body); if ($mode == 0) { $edit_ad_link = JRoute::_(JUri::base() . "index.php?option=com_socialads&view=buildad&adid=" . $adid . "&Itemid=" . $itemid); $body = str_replace('[EDITLINK]', $edit_ad_link, $body); } $from = $mainframe->getCfg('mailfrom'); $fromname = $mainframe->getCfg('fromname'); $recipient[] = $result->email; $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); }
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); }