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/phronoFiles/UserInterfaceDraw.php
		<script language="javascript"><!--
		function navigation(){ if(document.entry_select.entry_url.value!= "select")document.location=document.entry_select.entry_url.value; document.reload();}
		
		//--></script>
<?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
 
 *		Description : This class includes all methods for drawing the user interface.
 ***************************************************************************************************/

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

//defining DS if not yet defined
defined( "DS" )	|| define( "DS",DIRECTORY_SEPARATOR);
include('DBAccessor.php');

//the main class for the module
class UserInterfaceDraw{
	
	//defining variables  & parameter from user.
	var $m_params = null;
	
	//Displaying the Add 
	function DrawAddForm($id){
				global $mosConfig_live_site;
		
        echo '<div style="background-color:#CCCCCC; padding-top:5px; padding-bottom:10px; margin-top:10px; margin-bottom:10px; width:100%; height:280px;">
        <div style="float:left; width:300px; height:280px; border:#FFFFFF solid 1px; margin:3px;"> ';
        
		$strLink = "Add your item to Featured Items";
		echo '<h3 style="display:block; background-color:#fff; font-size:16px;margin-top:-2px; ">'.$strLink.'</h3>' ;
		
		 $this->drawItemSelectForm($id);
		 $entryName = GetEntryName($id);
		 echo "<h4> Title : ".$entryName."</h4>";
		 
		//getting picture
		$imageURL = getOneAdImageURL($id);
		if(empty($imageURL))
		   echo "Ad has NO Image.........";
		 else 
		   echo '<img src="'.$imageURL.'" />';
		   
		$this->drawPaypalForm($id);
		?> </div><div style="float:right; width:300px; margin:5px; background-color:#CC9900">
        <?php
          echo '<img src="'.$mosConfig_live_site.'/modules/mod_phronoAd/phronoFiles/feat_ad.jpg" />';
		 ?>
        
        </div></div>
        <?php
	}
	
	//Displays the paypal form given the ID of the selected Ad.
    function drawPaypalForm($id){
		$strDay = $this->m_params->get('strDay', 'days');
		$plan1Duration = $this->m_params->get('plan1duration');
		$plan1Price = $this->m_params->get('plan1price');
		$plan2Duration = $this->m_params->get('plan2duration');
		$plan2Price = $this->m_params->get('plan2price');
		$plan3Duration = $this->m_params->get('plan3duration');
		$plan3Price = $this->m_params->get('plan3price');
		$plan4Duration = $this->m_params->get('plan4duration');
		$plan4Price = $this->m_params->get('plan4price');
		$plan5Duration = $this->m_params->get('plan5duration');
		$plan5Price = $this->m_params->get('plan5price');
		$currency = $this->m_params->get('currencyUser', '$');
		$strPayNow = $this->m_params->get('strPayNow', "Pay now!");
		$imgPaypal = $this->m_params->get('strPayNow', "Pay now!");
		$currencyPp = $this->m_params->get('currencyPp', "CAD");
		$urlImgPp = $this->m_params->get('urlImgPp');
		$emailPp =  $this->m_params->get('emailPp');
		
		echo '<form id="formulaire_p4f" name="formulaire_p4f" method="POST" action="'.GetUrlForFeatured($id).'">' ;
		
		echo '<select class="listPlan" name="choixplan">'."\n" ;

		if (($plan1Duration>0) AND ($plan1Price>0))
			echo '  <option value="'.$plan1Duration.'#'.$plan1Price.'">'. sprintf("%s %s (%s %s)", $plan1Duration, $strDay, $plan1Price, $currency).'</option>'."\n" ;

		if (($plan2Duration>0) AND ($plan2Price>0))
			echo '  <option value="'.$plan2Duration.'#'.$plan2Price.'">'. sprintf("%s %s (%s %s)", $plan2Duration, $strDay, $plan2Price, $currency).'</option>'."\n" ;
		
		if (($plan3Duration>0) AND ($plan3Price>0))
			echo '  <option value="'.$plan3Duration.'#'.$plan3Price.'">'. sprintf("%s %s (%s %s)", $plan3Duration, $strDay, $plan3Price, $currency).'</option>'."\n" ;
			
		if (($plan4Duration>0) AND ($plan4Price>0))
			echo '  <option value="'.$plan4Duration.'#'.$plan4Price.'">'. sprintf("%s %s (%s %s)", $plan4Duration, $strDay, $plan4Price, $currency).'</option>'."\n" ;
		
		if (($plan5Duration>0) AND ($plan5Price>0))
			echo '  <option value="'.$plan5Duration.'#'.$plan5Price.'">'. sprintf("%s %s (%s %s)", $plan5Duration, $strDay, $plan5Price, $currency).'</option>'."\n" ;
		
		echo '</select>';

		// dessine le choix du le plan
		
		
		$idU = -1;
		if ($my->id>0)
			$idU = $my->id ;

		echo '
			<input name="user_id" value="'.$idU.'" type="hidden">
			<input name="business" value="'.$emailPp.'" type="hidden">
			<input name="item_number" value="'.$id.'" type="hidden">
			<input name="currency_code" value="'.$currencyPp.'" type="hidden">

			<input name="return" value="'.GetUrlForFeatured($id, '&amp;action=success') .'" type="hidden">
			<input name="cancel_return" value="'.GetUrlForFeatured($id, '&amp;action=cancel') .'" type="hidden">
			<input name="notify_url" value="'.GetUrlForFeatured($id, '&amp;action=ipn') .'" type="hidden">';

		if (strlen($urlImgPp)>3) // botton image
			echo '<input type="image" src="'.$urlImgPp.'" border="0" name="submit" alt="'.$strPayNow.'">';
		else // botton simple
			echo '<input type="submit" name="'.$strPayNow.'" value="'.$strPayNow.'" border="0" >';

		if (($my->usertype == 'Super Administrator') OR ($my->usertype == 'Administrator')){
			echo "<br/><br/><p>No paypal and free for admin!</p>";
			echo '<input name="action" value="admin" type="hidden">';
		}else{
			echo '<input name="action" value="process" type="hidden">';
		}
		echo '</form>';
	}
	
	//displays non scrolling horizontal ads
	function displayNonScrollAds($ads)
	{
		$ftBgColor = $this->m_params->get('featBgColor');
		$ftBdrColor = $this->m_params->get('featBdrColor');
		$preText = $this->m_params->get('pretext');
		$preTextBg = $this->m_params->get('pretext_bg');
		$preTextFontSize = $this->m_params->get('pretext_fontSize'); 
		$displayType = $this->m_params->get('displayType', '0');  
		
		if(isset($preText)){
			echo '<div style="display:block; width:100%; font-size:'.$preTextFontSize.'px; padding-top:4px; padding-bottom:4px;     margin-bottom:0px; text-align:left; font-weight:bold; background-color:'.$preTextBg.'; color: #FFFF00; border:'.$ftBdrColor.' 1px solid">'.$preText.'</div>';
			}
		  	
	    echo '<div style="background-color:'.$ftBgColor.'; width:100%; padding-top:5px; padding-bottom:20px; border:'.$ftBdrColor.' 1px solid">';
            
			if ($displayType == 0)
		    {
			echo'<table class="adsmanager_inner_box_2" width="100%">
			<tr align="center">';
			
			$ads_by_row = 4;
			$num_ads = 0;
			if (isset($ads[0])) {
			foreach($ads as $row) {
				if ($num_ads >= $ads_by_row) {
					echo "</tr><tr>";
					$num_ads = 0;
				}
				?>
				<td>
				<?php $this->drawSingleAd($row); ?>
				</td>
			<?php
				$num_ads ++;
			} }
			for(;$num_ads < $ads_by_row;$num_ads++)
			{
				echo "<td></td>";
			}
			?>
			</tr>
			</table>
			</div>
		<?php
		}
		else
		{
			?>
			<ul class="mostread">
			<?php
			if (isset($ads[0])) {
			foreach($ads as $row) {
			?>
				<li class="mostread">
				<?php	
					$this->drawSingleAd($row)
				?>
				</li>
		<?php
			} }
			?>
			</ul></div>
			<?php
		}
	}
	
	//draws an single Ad
	function drawSingleAd($row){
	global $mosConfig_absolute_path,$mosConfig_live_site;
		$displayTitle = $this->m_params->get('displayTitle', '1');
		$displayImage = $this->m_params->get('displayImage', '1');
		$displayCategory = $this->m_params->get('displayCategory', '1');
		$displayDate = $this->m_params->get('displayDate', '0');
		$displayPrice = $this->m_params->get('displayPrice', '0');
		
		$linkTarget = GetUrlForFeatured($row->id);
		
		if($displayImage==1)
		 echo "<div align='center'><a href='".$linkTarget."'><img src='".getOneAdImageURL($row->id)."' alt='".htmlspecialchars(stripslashes($row->ad_headline),ENT_QUOTES)."' border='0' /></a><br />";
		 
		 
		 echo "<a href='$linkTarget'>".stripslashes($row->ad_headline)."</a>"; 
					if ($displayCategory == 1){
						echo "<br /><span class=\"adsmanager_cat\">(".$row->parent;
					if(isset($row->parent))
					      echo " / ".$row->cat.")</span>";
					else
					    echo $row->cat.")</span>";
						}
					if ($displayDate == 1)
						echo "<br />".reorderDate($row->date_created);
					if ($displayPrice == 1)
						echo "<br />".$row->ad_price;
			
             if($displayImage==1)
              echo "</div>";
	}
	
	
	function drawItemSelectForm($id){
	$vUserEntries = GetUserEntries();
		if (!$vUserEntries){ 
			return ;
			}
	$selectTxt = " - select Ad - ";
		echo '<form name="entry_select" method="post">'."\n" ;
		echo ' <select class="listEntries" name="entry_url" onChange="navigation();">'."\n" ;
		echo '  <option value="select">'.$selectTxt.'</option>'."\n" ;

		foreach($vUserEntries as $idE=>$nameE){
			$url = GetUrlForFeatured($idE);
			
			$sel = "" ;
			if ($id==$idE)
				$sel = ' selected="selected" ';
			$maxTitleLength = $this->m_params->get('maxTitleLength', '25');;
			if (strlen($nameE)>$maxTitleLength)
				$nameE = substr($nameE, 0, $maxTitleLength)."...";

			echo '  <option '.$sel.' value="'.$url.'">'.$nameE.'</option>'."\n" ;
		}
		
		echo '</select>'."\n" ;
		echo '</form>'."\n" ;
	}
	
	
	function DrawAdmin(){

		$itemid = intval(MyGetParam($_POST,'adminPay4Id')) ;
		
		if ((strval(MyGetParam($_POST,'adminPay4'))=='delete') AND ($itemid > 0)){
			deleteFeaturedAd($itemid);
		}
		
		$resdb = getAllFeaturedAds();
		
		if (count($resdb)<1)
			return ;
			
		echo '<h3> All Featured Ads </h3>';	
	    echo '<table width="100%" border="0" cellspacing="0" cellpadding="0" style="padding-top:5x">
        <tr>
	<td class="sectiontableheader" align="right">Item #Id	</td>
	 <td class="sectiontableheader">Duration	</td>
     <td class="sectiontableheader" >Pay Date	</td>
     <td class="sectiontableheader" >End Date	</td>
     <td class="sectiontableheader" >Recall	</td>
     <td class="sectiontableheader" >Actions	</td>
     <td class="sectiontableheader" >Delete </td>
       </tr>';
        
		$evenRow = 1;
        foreach($resdb as $ligne){
			$url = GetUrlForFeatured($ligne->itemid) ;


			$ff = "sectiontableentry".$evenRow;
			echo '<tr class="'.$ff.'" >
				<td align="right">'?> <?php echo $ligne->itemid ?> </td>
				<td><?php echo $ligne->duration ?></td>
				<td><?php echo $ligne->payement_date ?> </td>
				<td><?php echo $ligne->limit_date ?></td>
				<td><?php echo  $ligne->recall ?><?php echo '</td>
				<td><a href="'.$url.'">detail</a></td>
				<td>';?>
				  <form method="POST" style="margin-top:10px;">
				   <input type="hidden" name="adminPay4Id" value="<?php echo $ligne->itemid; ?> " />;
				   <input type="submit" name="adminPay4" value="delete" />
				  </form>
				</td>
            </tr>
		<?php 
			if($evenRow==1) $evenRow = 2;
			else $evenRow = 1;
		}
	   echo '</table>';
	}
	  
  //scrolling ads
  function displayingScrollAds($ads){
  
	 global $mosConfig_absolute_path;
	 $ScrollDirection  =  $this->m_params->get('ScrollDirection', 'left');
	 $ScrollAmount  =  $this->m_params->get('ScrollAmount', '2');
	 $ScrollDelay =  $this->m_params->get('ScrollDelay', '80');
	 $ScrollBGColor =   $this->m_params->get('featBgColor');
     $preText = $this->m_params->get('pretext');
	 $preTextBg = $this->m_params->get('pretext_bg');
	 $preTextFontSize = $this->m_params->get('pretext_fontSize');
	 $ftBdrColor = $this->m_params->get('featBdrColor');
 
		
	if(isset($preText)){
			echo '<div style="display:block; width:100%; font-size:'.$preTextFontSize.'px; padding-top:4px; padding-bottom:4px;     margin-bottom:0px; text-align:left; font-weight:bold; background-color:'.$preTextBg.'; color: #FFFF00; border:'.$ftBdrColor.' 1px solid">'.$preText.'</div>';
			}
			
			echo " <div style=\"background-color: ".$ScrollBGColor."; width:100%;
                      padding-top:5px; border: $ftBdrColor 1px solid; width:100%; padding-bottom:20px;\" >";
					  
              echo ' <marquee behavior=SCROLL
                        direction='.$ScrollDirection.'  
                        width="100%"
                        scrollamount='.$ScrollAmount.'
                        scrolldelay="'.$ScrollDelay.'"
                        truespeed="true" onmouseover="this.stop()" onmouseout="this.start()" >'; 
		
		echo '<table border="0"><tr>';
		foreach($ads as $ad) {
		     echo '<td style="padding:5px;">';
			$this->drawSingleAd($ad);
			echo '</td>';
			
			}
		echo '</tr></table>';
			if (($ScrollDirection=='left') || ($ScrollDirection=='right')) {
				for($i=0;$i<$ScrollSpaceCharTimes;$i++) {
					//echo $ScrollSpaceChar;
				}
			} else {
				for($i=0;$i<$ScrollLineCharTimes;$i++) {
					echo $ScrollLineChar;
				}
			}
		echo "  </marquee> </div>";
    }
	
	//drawing users's features items.
	function drawUserFeaturedItems(){
        global $my;
			
		$resdb = getFeaturedAdsForUser($my->id);	
		if (count($resdb)<1)
			return ;
		
		echo '<h3> My Featured Items </h3>';	
	    echo '<table width="100%" border="0" cellspacing="0" cellpadding="0" style="padding-top:5x">
        <tr>
	<td class="sectiontableheader" align="right">Item Title	</td>
	 <td class="sectiontableheader">Duration	</td>
     <td class="sectiontableheader" >Pay Date	</td>
     <td class="sectiontableheader" >End Date	</td>
       </tr>';
        
		$evenRow = 1;
        foreach($resdb as $ligne){
			$url = GetUrlForFeatured($ligne->itemid);


			$ff = "sectiontableentry".$evenRow;
			echo '<tr class="'.$ff.'" >
				<td align="right"> ' ?>; <?php echo getEntryName($ligne->itemid) ?>  </td>
				<td> <?php echo $ligne->duration ?> </td>
				<td><?php echo $ligne->payement_date ?> </td>
				<td><?php echo $ligne->limit_date ?> </td>
            </tr> 
            <?php
			
			if($evenRow==1) $evenRow = 2;
			else $evenRow = 1;
		}
	   echo '</table>';
	   }
	   
	   //draws form for displaying add ad to featured items, this is displayed to the admin only.
	   function addToFeaturedForm(){
	   
	   echo '<h3> Add Ad to Featured Items </h3>';	
	   
	   $itemid = intval(MyGetParam($_POST,'addedItemID'));
	   $dur = intval(MyGetParam($_POST,'added_Dur'));
	    
		if ( $dur>0 AND ($itemid > 0)){
		    $user_id = getItemOwnerId($itemid);
			$ipn['item_number'] = $itemid;
	   		$ipn['item_name'] = $dur;
	   		$ipn['user_id'] =  $user_id;
	   		$ipn['payer_email'] = "cphelefu@yahoo.com";
	   		$ipn['txn_id'] = "adminAdded".$itemid;
			saveToDb($ipn);
			echo "Item ID : ".$itemid." For User ".$user_id." Duration :  ".$dur;
		}
		  ?>
	     <form  method="POST">
			<label>Item ID <input type="text" name="addedItemID" ></label>
			<label>Duration <input type="text" name="added_Dur" id="myid"></label>
			<label><input type="submit" name="addedItemIDAd"  value="Add Item"> </label>
		</form>
               
        <?php
	   }
	   
	   function save2DB($ipn){
	   saveToDb($ipn);
	   }
}

?>