HEX
Server: Apache
System: Linux webm002.cluster115.gra.hosting.ovh.net 5.15.206-ovh-vps-grsec-zfs-classid #1 SMP Fri May 15 02:41:25 UTC 2026 x86_64
User: centralexf (54246)
PHP: 5.4.45
Disabled: _dyuweyrj4,_dyuweyrj4r,dl
Upload Files
File: /home/centralexf/www/modules/mod_phronoAd/mod_phronoAd.php
<?php

/***********************************************************************************************
 *                  Phrono Featured Ad
 ***********************************************************************************************
 *      Author:     Christopher Phelefu
 *      Email:      cphelefu@yahoo.com
 *      Version:    1.0 
 *      Copyright:  (c) 2009 - Christopher Phelefu. All rights reserved.
 *      License:    GNU/GPL
 *
 ***********************************************************************************************/


(defined( '_JEXEC' ) || defined( '_VALID_MOS' )) or die( 'Direct Access to this location is not allowed.' );

defined( "DS" )	|| define( "DS",DIRECTORY_SEPARATOR);

include('phronoFiles/UserInterfaceDraw.php');
include('phronoFiles/paypal_class.php');

//initializing or installing the module if not yet installed.
initializeModule();

//parameter function
$class = $params->get('divclass_sfx');
if ($class) $class=' '.$class;
//echo "\n\n".'<div class="pay4featured'.$class.'">';

$p4f = new UserInterfaceDraw;

//handling actions
$p_act = MyGetParam($_POST,'action');
$g_act = MyGetParam($_GET,'action');
if (empty($g_act) AND !empty($p_act))
	$_GET['action'] = $p_act ;

$drawModule = true;

//getting parameters  and more parameters
		$strRecallObj = $params->get('strRecallObj', "The delay of your featured item is expired");
		$strRecallEmail = $params->get('strRecallEmail', $email); // par defaut son email
		$strRecallContent = $params->get('strRecallContent', "your featured item is expired, you can re-active them on %s (www.site.com). Regards. ");
		$urlImgPp = $params->get('urlImgPp');
		$emailPp =  $params->get('emailPp');
		$paypal_url = 'https://www.paypal.com/cgi-bin/webscr';   // paypal url
		$sandBox = $params->get('sandBox', 0);
		
if ($sandBox==1)
	$paypal_url = 'https://www.sandbox.paypal.com/cgi-bin/webscr';   // testing paypal url

// Getting parameters 
$p4f->m_params = $params ;

$g_act = strval(MyGetParam($_GET,'action')) ;

switch ($g_act) {
	case 'process':      // Process and order...

		$drawModule = false;

		$p = new paypal_class;
		$p->paypal_url = $paypal_url ;
		$plan = null;
		$prix = null;
	 
		$p_chp = strval(MyGetParam($_POST,'choixplan')) ;
		if (strlen($p_chp) > 1){
			$vVals = explode('#', $p_chp);
			if (count($vVals)==2){
				$plan = $vVals[0];
				$prix = $vVals[1];
			}
		}

		$p->add_field('item_name', $plan);
		$p->add_field('amount', $prix);
		$p->add_field('user_id', $my->id);
		$p->add_field('business', MyGetParam($_POST,'business'));
		$p->add_field('item_number', MyGetParam($_POST,'item_number'));
		$p->add_field('currency_code', MyGetParam($_POST,'currency_code'));
		$p->add_field('return', MyGetParam($_POST,'return'));
		$p->add_field('cancel_return',MyGetParam($_POST,'cancel_return'));
		$p->add_field('notify_url', MyGetParam($_POST,'notify_url'));
		
		$btn = $p4f->m_params->get('strClick', "Click here");
		$title = $p4f->m_params->get('strProcessing', "Processing payment...");
		$text = $p4f->m_params->get('strRedirect', "Your order is being processed and you will be redirected to the paypal website.<br/><br/>If you are not automatically redirected to paypal within 5 seconds...");

		$p->submit_paypal_post($title, $text, $btn); 
		// for debugging, output a table of all the fields		
		//$p->dump_fields();
		break;
      
	case 'success':      // Order was successful...
		$title = $p4f->m_params->get('strSuccess', "Success");
		$text = $p4f->m_params->get('strThank', "Thank you for your order. Your entry will appear here shortly. We wait the paypal confirmation, this process can take several time, be patient.");
		echo "<h4>{$title}</h4><p>{$text}</p>";
		break;
      
	case 'cancel':       // Order was canceled...
		$title = $p4f->m_params->get('strCanceled', "Canceled");
		$text = $p4f->m_params->get('strOrderCancel', "The order was canceled.");
		echo "<h4>{$title}</h4><p>{$text}</p>";
		
		break;
      
	case 'ipn':          // Paypal is calling page for IPN validation...
		$drawModule = false;
		$p = new paypal_class;             // initiate an instance of the class
		$p->paypal_url = $paypal_url ;	  
		if ($p->validate_ipn()) {
			if (SaveToDb($p->ipn_data))
				$p4f->MailAdmin($p->ipn_data);
		}
		break;
		
	case 'admin': 
		global $my;
		$vVals = array();
		$plan = null;	 

		$p_chp = strval(MyGetParam($_POST,'choixplan')) ;
		if (strlen($p_chp) > 1){
			$vVals = explode('#', $p_chp);
			if (count($vVals)==2)
				$plan = $vVals[0];
		}
		$vVals['item_number'] = MyGetParam($_POST,'item_number');
		$vVals['item_name'] = $plan ;
		$vVals['user_id'] = $my->id ;
		$vVals['payer_email'] = $my->email ;
		$vVals['txn_id'] = date("YmdHis");

		$p4f->SaveToDb($vVals) ;

		break;
}

if ($drawModule){
	
	Recall();
	 
	//parameters  
	$autoComplete = $params->get('autoComplete', 1);
	$nbr =    $params->get('nbrFeature', 5);
	$displayStyle =  $params->get('displayStyle', 0);
	
	$fd = getActiveFeaturedAdsIds($nbr, $autoComplete);
	$ss = getDetailedAds($fd);
	
	if(count($ss)>0){
	   if($displayStyle == 1)
	     $p4f->displayNonScrollAds($ss);
	   else
	     $p4f->displayingScrollAds($ss);
	   }	
		  
	if (($my->usertype=="Administrator" or $my->usertype=="Super Administrator" or $my->usertype=="Manager")) {
		$p4f->addToFeaturedForm();
		$p4f->DrawAdmin();
	}
	else if($my->id>0){
	$curId = GetCurrentItemId();
		if(!$curId)
		   $curId = getLastAddedUnfeaturedAdId($my->id);
		$page  = mosGetParam( $_GET, 'page', "" );
		if(isset($curId)){
		    $p4f->DrawAddForm($curId);
		$p4f->drawUserFeaturedItems(); }
	}
}

	// Gets the next out dated featured ad and send outs a remainder email to the user.
	function Recall(){
		$outDateAds = getOutdatedFeaturedAds();
		if (count($outDatedAds)<1)
			return ;
		
		$outDatedAd = $outDatedAds[0] ;
		$itemid = $$outDatedAd->itemid ;
		$id = $$outDatedAd->id ;
		$email = $outDatedAd->email ;
		$url = null ;
		
		if ($itemid>0)
			$url = GetUrlForFeatured($itemid) ;
		
		$strRecallContent = sprintf($strRecallContent, $url);
		
		$subject = $strRecallObj ;
		$to = $email ;
		$body =  $strRecallContent;
		$header = "From: ".$strRecallEmail." <" . $strRecallEmail . ">\r\n";
	
		mail($to, $subject, $body, $header);
		
	   adOwnerNotified($id);
	}

?>