Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

dennish

Members
  • Content count

    46
  • Joined

  • Last visited

Everything posted by dennish

  1. Hello, Is anyone succesfully using the E.U. VAT Intracom Number add-on (http://addons.oscommerce.com/info/1848) on osC 2.3.3 (or any other version of osC)? I get this error message when testing (adding new customer in create_account.php): Warning: file_get_contents(http://ec.europa.eu/taxation_customs/vies/viesquer.do?ms=NL&iso=NL&vat=008888012B0) [function.file-get-contents]: failed to open stream: HTTP request failed! HTTP/1.0 503 Service Unavailable The url http://ec.europa.eu/taxation_customs/vies/viesquer.do?ms=NL&iso=NL&vat=008888012B0 opens fine in my browser, so the service itself is running normally ... My validations.php file (in catalog/includes/functions) contains the following code: function tep_verif_tva($num_tva){ $prefix = substr($num_tva, 0, 2); if (array_search($prefix, tep_get_tva_intracom_array() ) === false) { return 'false'; } $tva = substr($num_tva, 2); $monfd = file_get_contents('http://ec.europa.eu/taxation_customs/vies/viesquer.do?ms=' . $prefix . '&iso='.$prefix.'&vat=' . $tva, r); if ( preg_match("/invalid VAT number/i", $monfd) ) { return 'false'; } elseif ( preg_match("/valid VAT number/i", $monfd) ){ return 'true'; } else { $myVerif = 'no_verif'; } return $myVerif; } Any help is much appreciated. Kind regards, Dennis
  2. dennish

    View Counter

    Hello Jack, Question #1: In the install file (instructions) I read: If your shop doesn't have the GeoIP.dat and geoip.inc files in admin/includes/, upload the ones in the Extra directory. On my website I already have those files in the directory admin/includes/GeoIP/. Where should I look for references to those files in the View Counter .php files (to subsequently adapt the links, reflecting my own file location)? Question #2: The suggested IP2Location™ DB24 Sample BIN database, expands to nearly 500MB when unzipped. Do you need all the detailed information involved or could I settle for a smaller DB? Which one would you suggest? Thanks in advance. Kind regards, Dennis
  3. dennish

    [CONTRIBUTION] PDF Customer Invoice

    Hello, I have implemented PDF Customer Invoice v1.2 (3/8/2008). My OsC version is 2.3.4 (and the server uses PHP 5.3.27). The hyperlink on account_history_info.php (to pdfinvoice.php in the main catalog/ folder) generates a PDF invoice as expected. No issues there. In addition, I want to sent a PDF invoice with the order confirmation email. To accomplish this, I've put a copy of the pdfinvoice.php file in the payment modules folder: catalog/includes/modules/payment/ (See below for a test version, with paths adjusted to reflect the new location), as described in the instructions by Chris23 (readme.txt in the _add ons and bufixes/pdf_invoice_email_attachment folder of the contribution package). All seems to work well, except for the extension of the FPDF class. Any call to a function defined in the PDF class (PDF extends FPDF) fails, which prevents a successful generation of the PDF file. If I exclude the functions depending the PDF class, the PDF gets generated (of course without the subparts relying on the PDF class). A simple example to explain: if I use $pdf=new PDF( PDF_INV_PORTRAIT_LANDSCAPE,'mm', 'A4' ); I get nothing. If instead I use the following $pdf = new FPDF('P', 'pt', array(500,233)); I get a (incomplete) PDF attachment with my confirmation mail. The full test version of pdfinvoice.php is <?php /* $Id: pdfinvoice.php FE invoice (customer) osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright (c) 2014 osCommerce Released under the GNU General Public License */ // Contributions added: // - E.U. VAT Intracom Number (090218) // - Independent invoice number (071031) define('FPDF_FONTPATH', DIR_FS_CATALOG . 'fpdf/font/'); require(DIR_FS_CATALOG . 'fpdf/fpdf.php'); // Add PDF security require(DIR_FS_CATALOG . 'fpdf/fpdf_protection.php'); // prevents reinclusion if called from checkout_process.php // require('includes/application_top.php'); require_once(DIR_FS_CATALOG . 'includes/application_top.php'); require(DIR_FS_CATALOG . DIR_WS_LANGUAGES . $language . '/' . FILENAME_ORDERS_INVOICE ); require(DIR_FS_CATALOG . DIR_WS_LANGUAGES . $language . '/' . FILENAME_ACCOUNT_HISTORY_INFO); // perform security check to prevent "get" tampering to view other customer's invoices /* if (!tep_session_is_registered('customer_id')) { $navigation->set_snapshot(); tep_redirect(tep_href_link(FILENAME_LOGIN, '', 'SSL')); } if (!isset($HTTP_GET_VARS['order_id']) || (isset($HTTP_GET_VARS['order_id']) && !is_numeric($HTTP_GET_VARS['order_id']))) { tep_redirect(tep_href_link(FILENAME_ACCOUNT_HISTORY, '', 'SSL')); } $customer_info_query = tep_db_query("select customers_id from " . TABLE_ORDERS . " where orders_id = '". (int)$HTTP_GET_VARS['order_id'] . "'"); $customer_info = tep_db_fetch_array($customer_info_query); if ($customer_info['customers_id'] != $customer_id) { tep_redirect(tep_href_link(FILENAME_ACCOUNT_HISTORY, '', 'SSL')); } */ $oID = tep_db_prepare_input($HTTP_GET_VARS['order_id']); $orders_query = tep_db_query("select orders_id from " . TABLE_ORDERS . " where orders_id = '" . (int)$oID . "'"); // prevents reinclusion if called from checkout_process.php // require(DIR_WS_CLASSES . 'order.php'); require_once(DIR_FS_CATALOG . DIR_WS_CLASSES . 'order.php'); // search order number $order = new order($oID); // Independent invoice number - Start $order->create_invoice((int)$oID); // Independent invoice number - End // function to return rgb value for fpdf from supplied hex (#abcdef) function html2rgb($color){ if ($color[0] == '#') $color = substr($color, 1); if (strlen($color) == 6) list($r, $g, $b) = array($color[0].$color[1], $color[2].$color[3], $color[4].$color[5]); elseif (strlen($color) == 3) list($r, $g, $b) = array($color[0], $color[1], $color[2]); else return false; $r = hexdec($r); $g = hexdec($g); $b = hexdec($b); return array($r,$g,$b); } // function to decode html entities function tep_html_entity_decode($text, $quote_style = ENT_QUOTES){ return html_entity_decode($text, $quote_style); } // find image type function findextension ($filename) { $filename = strtolower($filename); // PHP 5.3+ compliance - Start // $extension= split("\.", $filename); $extension= preg_split("[\.]", $filename); // PHP 5.3+ compliance - End $n = count($extension)-1; $extension = $extension[$n]; return $extension; } // $border_color = html2rgb(PDF_INV_BORDER_COLOR); // $cell_color = html2rgb(PDF_INV_CELL_COLOR); $invoice_line = html2rgb(PDF_INV_INVLINE_COLOR); $highlight_color = html2rgb(PDF_INV_HIGHLIGHT_COLOR); $standard_color = html2rgb(PDF_INV_STANDARD_COLOR); $watermark_color = html2rgb(PDF_INV_WATERMARK_COLOR); class PDF extends FPDF { // New code - Start function MultiCellLink($w,$h,$txt,$border=0,$align='J',$fill=0,$link='') // added #,$link=''# { //Output text with automatic or explicit line breaks $cw=&$this->CurrentFont['cw']; if($w==0) $w=$this->w-$this->rMargin-$this->x; $wmax=($w-2*$this->cMargin)*1000/$this->FontSize; $s=str_replace("\r",'',$txt); $nb=strlen($s); if($nb>0 && $s[$nb-1]=="\n") $nb--; $b=0; if($border) { if($border==1) { $border='LTRB'; $b='LRT'; $b2='LR'; } else { $b2=''; if(strpos($border,'L')!==false) $b2.='L'; if(strpos($border,'R')!==false) $b2.='R'; $b=(strpos($border,'T')!==false) ? $b2.'T' : $b2; } } $sep=-1; $i=0; $j=0; $l=0; $ns=0; $nl=1; while($i<$nb) { //Get next character $c=$s{$i}; if($c=="\n") { //Explicit line break if($this->ws>0) { $this->ws=0; $this->_out('0 Tw'); } $this->Cell($w,$h,substr($s,$j,$i-$j),$b,2,$align,$fill,$link); // added #,$link# $i++; $sep=-1; $j=$i; $l=0; $ns=0; $nl++; if($border && $nl==2) $b=$b2; continue; } if($c==' ') { $sep=$i; $ls=$l; $ns++; } $l+=$cw[$c]; if($l>$wmax) { //Automatic line break if($sep==-1) { if($i==$j) $i++; if($this->ws>0) { $this->ws=0; $this->_out('0 Tw'); } $this->Cell($w,$h,substr($s,$j,$i-$j),$b,2,$align,$fill,$link); // added #,$link# } else { if($align=='J') { $this->ws=($ns>1) ? ($wmax-$ls)/1000*$this->FontSize/($ns-1) : 0; $this->_out(sprintf('%.3f Tw',$this->ws*$this->k)); } $this->Cell($w,$h,substr($s,$j,$sep-$j),$b,2,$align,$fill,$link); // added #,$link# $i=$sep+1; } $sep=-1; $j=$i; $l=0; $ns=0; $nl++; if($border && $nl==2) $b=$b2; } else $i++; } //Last chunk if($this->ws>0) { $this->ws=0; $this->_out('0 Tw'); } if($border && strpos($border,'B')!==false) $b.='B'; $this->Cell($w,$h,substr($s,$j,$i-$j),$b,2,$align,$fill,$link); // added #,$link# $this->x=$this->lMargin; } // New code - End // New code - Start var $B; var $I; var $U; var $HREF; function PDF($orientation='P',$unit='mm',$format='A4') { //Call parent constructor $this->FPDF($orientation,$unit,$format); //Initialization $this->B=0; $this->I=0; $this->U=0; $this->HREF=''; } function WriteHTML($html) { //HTML parser $html=str_replace("\n",' ',$html); $a=preg_split('/<(.*)>/U',$html,-1,PREG_SPLIT_DELIM_CAPTURE); foreach($a as $i=>$e) { if($i%2==0) { //Text if($this->HREF) $this->PutLink($this->HREF,$e); else $this->Write(5,$e); } else { //Tag if($e[0]=='/') $this->CloseTag(strtoupper(substr($e,1))); else { //Extract attributes $a2=explode(' ',$e); $tag=strtoupper(array_shift($a2)); $attr=array(); foreach($a2 as $v) { if(preg_match('/([^=]*)=["\']?([^"\']*)/',$v,$a3)) $attr[strtoupper($a3[1])]=$a3[2]; } $this->OpenTag($tag,$attr); } } } } function OpenTag($tag,$attr) { //Opening tag if($tag=='B' || $tag=='I' || $tag=='U') $this->SetStyle($tag,true); if($tag=='A') $this->HREF=$attr['HREF']; if($tag=='BR') $this->Ln(5); } function CloseTag($tag) { //Closing tag if($tag=='B' || $tag=='I' || $tag=='U') $this->SetStyle($tag,false); if($tag=='A') $this->HREF=''; } function SetStyle($tag,$enable) { //Modify style and select corresponding font $this->$tag+=($enable ? 1 : -1); $style=''; foreach(array('B','I','U') as $s) { if($this->$s>0) $style.=$s; } $this->SetFont('',$style); } function PutLink($URL,$txt) { //Put a hyperlink $this->SetTextColor(0,0,255); $this->SetStyle('U',true); $this->Write(5,$txt,$URL); $this->SetStyle('U',false); $this->SetTextColor(0); } // New code - End // New code - Start function ImprovedTable($header,$data) { function is_odd($num) { if ($num % 2 == 0) { return false; } else { return true; } } //Column widths $w=array(33,33,33,33,33,33); //Header $this->Cell($w[0],7,$header[0],LTB,0,'L'); for($i=1;$i<count($header)-1;$i++){ if (is_odd($i)) { $this->Cell($w[$i],7,$header[$i],RTB,0,'L'); } else { $this->Cell($w[$i],7,$header[$i],TB,0,'L'); } } $this->Cell($w[count($header)-1],7,$header[count($header)-1],RTB,0,'L'); $this->Ln(); //Data foreach($data as $row) { $this->Cell($w[0],6,$row[0],'L'); $this->Cell($w[1],6,$row[1],'R'); $this->Cell($w[2],6,$row[2],'L',0,'L'); $this->Cell($w[3],6,$row[3],'R',0,'L'); $this->Cell($w[4],6,$row[4],'L',0,'L'); $this->Cell($w[5],6,$row[5],'R',0,'L'); $this->Ln(); } //Closure line $this->Cell(array_sum($w),0,'','T'); } // New code - End // New code - Start //Colored table function FancyTable($header2,$data2,$data3,$attribute_line,$data4) { // Column width $w=array(15,60,48,25,25,25); // Header // Colors, font and line width $this->SetFont( PDF_INV_TABLEHEADING_TEXT_FONT, PDF_INV_TABLEHEADING_TEXT_EFFECT, PDF_INV_TABLEHEADING_TEXT_HEIGHT); $text_color=html2rgb(PDF_INV_TABLEHEADING_TEXT_COLOR); $this->SetTextColor($text_color[0], $text_color[1], $text_color[2]); $cell_color=html2rgb(PDF_INV_TABLEHEADING_FILL_COLOR); $this->SetFillColor($cell_color[0], $cell_color[1], $cell_color[2]); $border_color=html2rgb(PDF_INV_TABLEHEADING_LINE_COLOR); $this->SetDrawColor($border_color[0], $border_color[1], $border_color[2]); $this->SetLineWidth(.3); // Header content $this->Cell($w[0],7,$header2[0],B,0,'C',true); $this->Cell($w[1],7,$header2[1],B,0,'L',true); $this->Cell($w[2],7,$header2[2],B,0,'L',true); $this->Cell($w[3],7,$header2[3],B,0,'C',true); $this->Cell($w[4],7,$header2[4],B,0,'C',true); $this->Cell($w[5],7,$header2[5],B,0,'C',true); $this->Ln(); // Data // Colors, font and line width $this->SetFont( PDF_INV_PRODUCTS_TEXT_FONT, PDF_INV_PRODUCTS_TEXT_EFFECT, PDF_INV_PRODUCTS_TEXT_HEIGHT); $text_color=html2rgb(PDF_INV_PRODUCTS_TEXT_COLOR ); $this->SetTextColor($text_color[0], $text_color[1], $text_color[2]); $cell_color=html2rgb(PDF_INV_PRODUCTS_FILL_COLOR ); $this->SetFillColor( $cell_color[0], $cell_color[1], $cell_color[2]); $border_color=html2rgb(PDF_INV_PRODUCTS_LINE_COLOR ); $this->SetDrawColor( $border_color[0], $border_color[1], $border_color[2]); // Data content $fill=false; ksort($data2); foreach($data2 as $key => $row) { $this->Cell($w[0],6,$row[0],'LR',0,'C',$fill); $this->Cell($w[1],6,$row[1],'LR',0,'L',$fill); $this->Cell($w[2],6,$row[2],'LR',0,'L',$fill); $this->Cell($w[3],6,$row[3],'LR',0,'R',$fill); $this->Cell($w[4],6,$row[4],'LR',0,'R',$fill); $this->Cell($w[5],6,$row[5],'LR',0,'R',$fill); $this->Ln(); if (array_key_exists($key, $data3)) { $data3a = $data3[$key]; foreach($data3a as $row2) { $this->Cell($w[0],6,$row2[0],'LR',0,'C',$fill); $this->Cell($w[1],6,$row2[1],'LR',0,'L',$fill); $this->Cell($w[2],6,$row2[2],'LR',0,'L',$fill); $this->Cell($w[3],6,$row2[3],'LR',0,'C',$fill); $this->Cell($w[4],6,$row2[4],'LR',0,'C',$fill); $this->Cell($w[5],6,$row2[5],'LR',0,'C',$fill); $this->Ln(); } } $fill=!$fill; } // Closure line $this->Cell(array_sum($w),0,'','T'); // Totals // Colors, font and line width $this->SetFont( PDF_INV_ORDERTOTAL1_TEXT_FONT, PDF_INV_ORDERTOTAL1_TEXT_EFFECT, PDF_INV_ORDERTOTAL1_TEXT_HEIGHT); $text_color=html2rgb(PDF_INV_ORDERTOTAL1_TEXT_COLOR ); $this->SetTextColor($text_color[0], $text_color[1], $text_color[2]); $cell_color=html2rgb(PDF_INV_ORDERTOTAL1_FILL_COLOR ); $this->SetFillColor( $cell_color[0], $cell_color[1], $cell_color[2] ); $border_color=html2rgb(PDF_INV_ORDERTOTAL1_LINE_COLOR ); $this->SetDrawColor( $border_color[0], $border_color[1], $border_color[2] ); // Totals content ksort($data4); end($data4); $last = key($data4); $this->Ln(); foreach($data4 as $key => $row3) { if ($key === $last) { $this->SetFont( PDF_INV_ORDERTOTAL2_TEXT_FONT, PDF_INV_ORDERTOTAL2_TEXT_EFFECT, PDF_INV_ORDERTOTAL2_TEXT_HEIGHT); $text_color=html2rgb(PDF_INV_ORDERTOTAL2_TEXT_COLOR); $this->SetTextColor($text_color[0], $text_color[1], $text_color[2]); $cell_color=html2rgb(PDF_INV_ORDERTOTAL2_FILL_COLOR ); $this->SetFillColor($cell_color[0], $cell_color[1], $cell_color[2]); $border_color=html2rgb(PDF_INV_ORDERTOTAL2_LINE_COLOR ); $this->SetDrawColor($border_color[0], $border_color[1], $border_color[2]); $this->Cell($w[0],6,$row3[0],'' ,0,'C'); $this->Cell($w[1],6,$row3[1],'' ,0,'L'); $this->Cell($w[2],6,$row3[2],'' ,0,'L'); $this->Cell($w[3],6,$row3[3],'' ,0,'L'); $this->Cell($w[4],6,$row3[4],'',0,'R'); $this->Cell($w[5],6,$row3[5],LRTB,0,'R'); $this->Ln(); } else { $this->Cell($w[0],6,$row3[0],'' ,0,'C'); $this->Cell($w[1],6,$row3[1],'' ,0,'L'); $this->Cell($w[2],6,$row3[2],'' ,0,'L'); $this->Cell($w[3],6,$row3[3],'' ,0,'L'); $this->Cell($w[4],6,$row3[4],'',0,'R'); $this->Cell($w[5],6,$row3[5],LRTB,0,'R'); $this->Ln(); } } } // New code - End //Page header function RoundedRect($x, $y, $w, $h,$r, $style = '') { $k = $this->k; $hp = $this->h; if($style=='F') $op='f'; elseif($style=='FD' or $style=='DF') $op='B'; else $op='S'; $MyArc = 4/3 * (sqrt(2) - 1); $this->_out(sprintf('%.2f %.2f m',($x+$r)*$k,($hp-$y)*$k )); $xc = $x+$w-$r ; $yc = $y+$r; $this->_out(sprintf('%.2f %.2f l', $xc*$k,($hp-$y)*$k )); $this->_Arc($xc + $r*$MyArc, $yc - $r, $xc + $r, $yc - $r*$MyArc, $xc + $r, $yc); $xc = $x+$w-$r ; $yc = $y+$h-$r; $this->_out(sprintf('%.2f %.2f l',($x+$w)*$k,($hp-$yc)*$k)); $this->_Arc($xc + $r, $yc + $r*$MyArc, $xc + $r*$MyArc, $yc + $r, $xc, $yc + $r); $xc = $x+$r ; $yc = $y+$h-$r; $this->_out(sprintf('%.2f %.2f l',$xc*$k,($hp-($y+$h))*$k)); $this->_Arc($xc - $r*$MyArc, $yc + $r, $xc - $r, $yc + $r*$MyArc, $xc - $r, $yc); $xc = $x+$r ; $yc = $y+$r; $this->_out(sprintf('%.2f %.2f l',($x)*$k,($hp-$yc)*$k )); $this->_Arc($xc - $r, $yc - $r*$MyArc, $xc - $r*$MyArc, $yc - $r, $xc, $yc - $r); $this->_out($op); } function _Arc($x1, $y1, $x2, $y2, $x3, $y3) { $h = $this->h; $this->_out(sprintf('%.2f %.2f %.2f %.2f %.2f %.2f c ', $x1*$this->k, ($h-$y1)*$this->k, $x2*$this->k, ($h-$y2)*$this->k, $x3*$this->k, ($h-$y3)*$this->k)); } function Header() { // FE - Start global $highlight_color, $image_function, $html; // FE - End $bg_color=html2rgb(PDF_INV_PAGE_FILL_COLOR ); $this->SetFillColor($bg_color[0], $bg_color[1], $bg_color[2]); $this->Rect($this->lMargin,0,$this->w-$this->rMargin,$this->h,'F'); //Logo if ( PDF_INV_SHOW_LOGO == 'true' ) { // $this->Image(DIR_FS_CATALOG . DIR_WS_IMAGES . STORE_LOGO , 10,10,30,10); $size =getimagesize(DIR_FS_CATALOG . DIR_WS_IMAGES . PDF_INVOICE_IMAGE); $this->$image_function(DIR_FS_CATALOG . DIR_WS_IMAGES . PDF_INVOICE_IMAGE,7,10,($size[0]*PDF_INV_IMG_CORRECTION),($size[1]*PDF_INV_IMG_CORRECTION),'', FILENAME_DEFAULT); } // Company name $this->SetX(0); $this->SetY(10); $this->SetFont( PDF_INV_HEADER_TEXT_FONT, PDF_INV_HEADER_TEXT_EFFECT, PDF_INV_HEADER_TEXT_HEIGHT); $this->SetTextColor($highlight_color[0],$highlight_color[1],$highlight_color[2]); $cell_color=html2rgb(PDF_INV_HEADER_FILL_COLOR); $this->SetFillColor($cell_color[0],$cell_color[1],$cell_color[2]); $border_color=html2rgb(PDF_INV_HEADER_LINE_COLOR); $this->SetDrawColor($border_color[0],$border_color[1],$border_color[2]); $this->Ln(0); $this->Cell(30); $this->MultiCell(50, 3.5, tep_html_entity_decode(STORE_NAME),0,'L','1'); // Company Address $this->SetX(0); $this->SetY(13.5); $this->SetFont( PDF_INV_HEADER_TEXT_FONT, PDF_INV_HEADER_TEXT_EFFECT, PDF_INV_HEADER_TEXT_HEIGHT); $text_color=html2rgb(PDF_INV_HEADER_TEXT_COLOR); $this->SetTextColor($text_color[0], $text_color[1], $text_color[2]); $cell_color=html2rgb(PDF_INV_HEADER_FILL_COLOR); $this->SetFillColor($cell_color[0],$cell_color[1],$cell_color[2]); $border_color=html2rgb(PDF_INV_HEADER_LINE_COLOR); $this->SetDrawColor($border_color[0],$border_color[1],$border_color[2]); $this->Ln(0); $this->Cell(30); if ( PDF_INV_SHOW_ADRESSSHOP == 'true' ) { $this->MultiCell(50, 3.5, tep_html_entity_decode(STORE_NAME_ADDRESS),0,'L','1'); } // Telephone $this->SetX(0); $this->SetY(10); $this->SetFont( PDF_INV_HEADER_TEXT_FONT, PDF_INV_HEADER_TEXT_EFFECT, PDF_INV_HEADER_TEXT_HEIGHT); $text_color=html2rgb(PDF_INV_HEADER_TEXT_COLOR); $this->SetTextColor($text_color[0], $text_color[1], $text_color[2]); $cell_color=html2rgb(PDF_INV_HEADER_FILL_COLOR); $this->SetFillColor($cell_color[0],$cell_color[1],$cell_color[2]); $border_color=html2rgb(PDF_INV_HEADER_LINE_COLOR); $this->SetDrawColor($border_color[0],$border_color[1],$border_color[2]); $this->Ln(0); $this->Cell(90); $this->MultiCell(60, 3.5, tep_html_entity_decode(STORE_TELEPHONE),0,'L','1'); /* // Fax $this->SetX(0); $this->SetY(13.5); $this->SetFont( PDF_INV_HEADER_TEXT_FONT, PDF_INV_HEADER_TEXT_EFFECT, PDF_INV_HEADER_TEXT_HEIGHT); $text_color=html2rgb(PDF_INV_HEADER_TEXT_COLOR); $this->SetTextColor($text_color[0], $text_color[1], $text_color[2]); $cell_color=html2rgb(PDF_INV_HEADER_FILL_COLOR); $this->SetFillColor($cell_color[0],$cell_color[1],$cell_color[2]); $border_color=html2rgb(PDF_INV_HEADER_LINE_COLOR); $this->SetDrawColor($border_color[0],$border_color[1],$border_color[2]); $this->Ln(0); $this->Cell(90); $this->MultiCell(60, 3.5, tep_html_entity_decode(STORE_FAX),0,'L','1'); */ // Email $this->SetX(0); // $this->SetY(13.5); $this->SetY(17); $this->SetFont( PDF_INV_HEADER_TEXT_FONT, PDF_INV_HEADER_TEXT_EFFECT, PDF_INV_HEADER_TEXT_HEIGHT); $text_color=html2rgb(PDF_INV_HEADER_TEXT_COLOR ); $this->SetTextColor($text_color[0], $text_color[1], $text_color[2]); $cell_color=html2rgb(PDF_INV_HEADER_FILL_COLOR ); $this->SetFillColor($cell_color[0],$cell_color[1],$cell_color[2]); $border_color=html2rgb(PDF_INV_HEADER_LINE_COLOR ); $this->SetDrawColor($border_color[0],$border_color[1],$border_color[2]); $this->Ln(0); $this->Cell(90); if ( PDF_INV_SHOW_MAILWEB == 'true' ) { // $this->MultiCell(100, 6, tep_html_entity_decode(PDF_INV_EMAIL) . STORE_OWNER_EMAIL_ADDRESS,0,'R'); // $this->MultiCell(60, 3.5, STORE_OWNER_EMAIL_ADDRESS,0,'L','1'); // $html='<a href="mailto:' . STORE_OWNER_EMAIL_ADDRESS . '">' . STORE_OWNER_EMAIL_ADDRESS . '</a>'; // $link=$this->WriteHTML($html); // $this->MultiCell(60, 3.5, $link,0,'L','1'); $this->Cell(60, 3.5, STORE_OWNER_EMAIL_ADDRESS,0,1,'L','1','mailto:' . STORE_OWNER_EMAIL_ADDRESS); // $this->MultiCellLink(60, 3.5,STORE_OWNER_EMAIL_ADDRESS,0,'L','1','mailto:' . STORE_OWNER_EMAIL_ADDRESS); } //Website $this->SetX(0); // $this->SetY(17); $this->SetY(20.5); $this->SetFont( PDF_INV_HEADER_TEXT_FONT, PDF_INV_HEADER_TEXT_EFFECT, PDF_INV_HEADER_TEXT_HEIGHT); $text_color=html2rgb(PDF_INV_HEADER_TEXT_COLOR ); $this->SetTextColor($text_color[0], $text_color[1], $text_color[2]); $cell_color=html2rgb(PDF_INV_HEADER_FILL_COLOR ); $this->SetFillColor($cell_color[0],$cell_color[1],$cell_color[2]); $border_color=html2rgb(PDF_INV_HEADER_LINE_COLOR ); $this->SetDrawColor($border_color[0],$border_color[1],$border_color[2]); $this->Ln(0); $this->Cell(90); if ( PDF_INV_SHOW_MAILWEB == 'true' ) { // $this->MultiCell(100, 6, tep_html_entity_decode(PDF_INV_WEB) . HTTP_SERVER,0,'R'); // $this->MultiCell(60, 3.5, HTTP_SERVER,0,'L','1'); // $html='<a href="' . HTTP_SERVER . '">' . STORE_WEBSITE . '</a>'; // $link=$this->WriteHTML($html); // $this->MultiCell(60, 3.5, $link,0,'L','1'); $this->Cell(60, 3.5, STORE_WEBSITE,0,1,'L','1',HTTP_SERVER); // $this->MultiCellLink(60, 3.5, STORE_WEBSITE,0,'L','1',HTTP_SERVER); } //Draw the top line with invoice text $this->SetX(0); $this->SetY(10); $this->SetFont( PDF_INV_HEADINVOICE_TEXT_FONT, PDF_INV_HEADINVOICE_TEXT_EFFECT, PDF_INV_HEADINVOICE_TEXT_HEIGHT); $text_color=html2rgb(PDF_INV_HEADINVOICE_TEXT_COLOR ); $this->SetTextColor($text_color[0], $text_color[1], $text_color[2]); $cell_color=html2rgb(PDF_INV_HEADINVOICE_FILL_COLOR ); $this->SetFillColor($cell_color[0],$cell_color[1],$cell_color[2]); $border_color=html2rgb(PDF_INV_HEADINVOICE_LINE_COLOR ); $this->SetDrawColor($border_color[0],$border_color[1],$border_color[2]); $this->Ln(0); $this->Cell(150); $this->MultiCell(48, 16, PRINT_INVOICE,1,'C','0'); } // function taken and modified from $Id: pdf_datasheet_functions v1.40 2005/06/16 13:46:29 ip chilipepper.it Exp $ function RotatedText($x,$y,$txt,$angle) { //Text rotated around its origin $this->Rotate($angle,$x,$y); $this->Text($x,$y,$txt); $this->Rotate(0); } function Watermark() { global $watermark_color; $this->SetFont(PDF_INV_CORE_FONT,'B',60); $this->SetTextColor($watermark_color[0], $watermark_color[1], $watermark_color[2]); $ang=30; $cos=cos(deg2rad($ang)); // $wwm=($this->GetStringWidth(tep_html_entity_decode(PDF_INV_WATERMARK_TEXT))*$cos); $wwm=($this->GetStringWidth(tep_html_entity_decode(PRINT_INV_WATERMARK_TEXT))*$cos); // $this->RotatedText(($this->w-$wwm)/2,$this->w,PDF_INV_WATERMARK_TEXT,$ang); $this->RotatedText(($this->w-$wwm)/2,$this->w,PRINT_INV_WATERMARK_TEXT,$ang); } function Footer() { global $highlight_color, $invoice_line; // General terms (if enabled) if (DISPLAY_PDF_TERMS == 'true'){ $this->SetY(-27); $this->SetX(0); $this->SetFont( PDF_INV_FOOTER_TEXT_FONT, PDF_INV_FOOTER_TEXT_EFFECT, PDF_INV_FOOTER_TEXT_HEIGHT); $text_color=html2rgb(PDF_INV_FOOTER_TEXT_COLOR ); $this->SetTextColor($text_color[0], $text_color[1], $text_color[2]); $this->Ln(0); // New code - Start $this->MultiCell(0, 6, PRINT_TERMS,0,'C','0'); // New code - End } // insert horiz line $this->SetY(-21); $this->SetDrawColor($invoice_line[0],$invoice_line[1],$invoice_line[2]); $this->Cell(198,.1,'',1,1,'L',1); //Position at 1.5 cm from bottom $this->SetY(-19); // VAT / Tax number (if enabled) if (DISPLAY_PDF_TAX_NUMBER == 'true'){ $this->SetX(0); $this->SetFont( PDF_INV_FOOTER_TEXT_FONT, PDF_INV_FOOTER_TEXT_EFFECT, PDF_INV_FOOTER_TEXT_HEIGHT); $text_color=html2rgb(PDF_INV_FOOTER_TEXT_COLOR ); $this->SetTextColor($text_color[0], $text_color[1], $text_color[2]); $this->Ln(0); // BOF for VAT INTRACOM_v3.3 $this->MultiCell(0, 6, tep_html_entity_decode(ENTRY_TVA_INTRACOM) . " " . TVA_SHOP_INTRACOM,0,'C','0'); // EOF for TVA_INTRACOM_v3.3 } // Chambre of Commerce number (if enabled) if (DISPLAY_PDF_COC_NUMBER == 'true'){ $this->SetX(0); $this->SetFont( PDF_INV_FOOTER_TEXT_FONT, PDF_INV_FOOTER_TEXT_EFFECT, PDF_INV_FOOTER_TEXT_HEIGHT); $text_color=html2rgb(PDF_INV_FOOTER_TEXT_COLOR ); $this->SetTextColor($text_color[0], $text_color[1], $text_color[2]); $this->Ln(0); // New code - Start $this->MultiCell(0, 6, tep_html_entity_decode(ENTRY_STORE_COC) . " " . STORE_COC,0,'C','0'); // New code - End } // Bank details (if enabled) if (DISPLAY_PDF_BANK_NUMBER == 'true'){ $this->SetX(0); $this->SetFont( PDF_INV_FOOTER_TEXT_FONT, PDF_INV_FOOTER_TEXT_EFFECT, PDF_INV_FOOTER_TEXT_HEIGHT); $text_color=html2rgb(PDF_INV_FOOTER_TEXT_COLOR ); $this->SetTextColor($text_color[0], $text_color[1], $text_color[2]); $this->Ln(0); // New code - Start $this->MultiCell(0, 6, STORE_BANK_ACCOUNT . ', ' . STORE_BANK_IBAN . ' ' . STORE_BANK_BIC,0,'C','0'); // New code - End } $this->SetFont( PDF_INV_FOOTER_TEXT_FONT, PDF_INV_FOOTER_TEXT_EFFECT, PDF_INV_FOOTER_TEXT_HEIGHT); $text_color=html2rgb(PDF_INV_FOOTER_TEXT_COLOR ); $this->SetTextColor($text_color[0], $text_color[1], $text_color[2]); //$cell_color=html2rgb(PDF_INV_FOOTER_FILL_COLOR ); //$this->SetFillColor( $cell_color[0], $cell_color[1], $cell_color[2] ); } } /*************************** * Software: FPDF_EPS * Version: 1.3 * Date: 2006-07-28 * Author: Valentin Schmidt ****************************/ class PDF_EPS extends PDF{ function PDF_EPS($orientation='P',$unit='mm',$format='A4'){ parent::FPDF($orientation,$unit,$format); } function ImageEps ($file, $x, $y, $w=0, $h=0, $link='', $useBoundingBox=true){ $data = file_get_contents($file); if ($data===false) $this->Error('EPS file not found: '.$file); # strip binary bytes in front of PS-header $start = strpos($data, '%!PS-Adobe'); if ($start>0) $data = substr($data, $start); # find BoundingBox params ereg ("%%BoundingBox:([^\r\n]+)", $data, $regs); if (count($regs)>1){ list($x1,$y1,$x2,$y2) = explode(' ', trim($regs[1])); } else $this->Error('No BoundingBox found in EPS file: '.$file); $start = strpos($data, '%%EndSetup'); if ($start===false) $start = strpos($data, '%%EndProlog'); if ($start===false) $start = strpos($data, '%%BoundingBox'); $data = substr($data, $start); $end = strpos($data, '%%PageTrailer'); if ($end===false) $end = strpos($data, 'showpage'); if ($end) $data = substr($data, 0, $end); # save the current graphic state $this->_out('q'); $k = $this->k; if ($useBoundingBox){ $dx = $x*$k-$x1; $dy = $y*$k-$y1; }else{ $dx = $x*$k; $dy = $y*$k; } # translate $this->_out(sprintf('%.3f %.3f %.3f %.3f %.3f %.3f cm', 1,0,0,1,$dx,$dy+($this->hPt - 2*$y*$k - ($y2-$y1)))); if ($w>0){ $scale_x = $w/(($x2-$x1)/$k); if ($h>0){ $scale_y = $h/(($y2-$y1)/$k); }else{ $scale_y = $scale_x; $h = ($y2-$y1)/$k * $scale_y; } }else{ if ($h>0){ $scale_y = $h/(($y2-$y1)/$k); $scale_x = $scale_y; $w = ($x2-$x1)/$k * $scale_x; }else{ $w = ($x2-$x1)/$k; $h = ($y2-$y1)/$k; } } # scale if (isset($scale_x)) $this->_out(sprintf('%.3f %.3f %.3f %.3f %.3f %.3f cm', $scale_x,0,0,$scale_y, $x1*(1-$scale_x), $y2*(1-$scale_y))); # handle pc/unix/mac line endings $lines = split ("\r\n|[\r\n]", $data); $u=0; $cnt = count($lines); for ($i=0;$i<$cnt;$i++){ $line = $lines[$i]; if ($line=='' || $line{0}=='%') continue; $len = strlen($line); if ($len>2 && $line{$len-2}!=' ') continue; $cmd = $line{$len-1}; switch ($cmd){ case 'm': case 'l': case 'v': case 'y': case 'c': case 'k': case 'K': case 'g': case 'G': case 's': case 'S': case 'J': case 'j': case 'w': case 'M': case 'd' : case 'n' : case 'v' : $this->_out($line); break; case 'x': # custom colors list($c,$m,$y,$k) = explode(' ', $line); $this->_out("$c $m $y $k k"); break; case 'Y': $line{$len-1}='y'; $this->_out($line); break; case 'N': $line{$len-1}='n'; $this->_out($line); break; case 'V': $line{$len-1}='v'; $this->_out($line); break; case 'L': $line{$len-1}='l'; $this->_out($line); break; case 'C': $line{$len-1}='c'; $this->_out($line); break; case 'b': case 'B': $this->_out($cmd . '*'); break; case 'f': case 'F': if ($u>0){ $isU = false; $max = min($i+5,$cnt); for ($j=$i+1;$j<$max;$j++) $isU = ($isU || ($lines[$j]=='U' || $lines[$j]=='*U')); if ($isU) $this->_out("f*"); }else $this->_out("f*"); break; case 'u': if ($line{0}=='*') $u++; break; case 'U': if ($line{0}=='*') $u--; break; #default: echo "$cmd<br>"; #just for debugging } } # restore previous graphic state $this->_out('Q'); if ($link) $this->Link($x,$y,$w,$h,$link); } }# END CLASS # for backward compatibility if (!function_exists('file_get_contents')){ function file_get_contents($filename, $use_include_path = 0){ $file = @fopen($filename, 'rb', $use_include_path); if ($file){ if ($fsize = @filesize($filename)) $data = fread($file, $fsize); else { $data = ''; while (!feof($file)) $data .= fread($file, 1024); } fclose($file); return $data; }else return false; } } /* // Add PDF security $pdf=new FPDF_Protection(); $pdf->SetProtection(array('copy', 'print', 'annot-forms')); */ // Instanciation of inherited class - choose according to logo supplied, vector or raster if(findextension(PDF_INVOICE_IMAGE) == 'ai' || findextension(PDF_INVOICE_IMAGE) == 'eps'){ $pdf=new PDF_EPS(); $image_function = "ImageEps"; } else{ // $pdf=new PDF( PDF_INV_PORTRAIT_LANDSCAPE,'mm',array(PDF_INV_PAPER_WIDTH, PDF_INV_PAPER_HEIGHT ) ) ; $pdf=new PDF( PDF_INV_PORTRAIT_LANDSCAPE,'mm', 'A4' ); $image_function = "Image"; } $pdf = new FPDF('P', 'pt', array(500,233)); // $pdf=new PDF( PDF_INV_PORTRAIT_LANDSCAPE,'mm', 'A4' ); // Define an alias for the total number of pages. It will be substituted as the document is closed. $pdf->AliasNbPages(); // Set the Page Margins $pdf->SetMargins(6,2,6); // Add the first page $pdf->AddPage(); // Check if customer resides in store home country (also a EU member!) or another EU country (relevant for VAT) $home_country_query_raw = "SELECT c.countries_id FROM " . TABLE_COUNTRIES . " c WHERE c.countries_name = '" . htmlspecialchars_decode($order->billing['country']['title']) . "' AND countries_id = '" . STORE_COUNTRY . "'"; $home_country_query = tep_db_query($home_country_query_raw); $eu_country_query_raw = "SELECT c.countries_id FROM " . TABLE_COUNTRIES . " c RIGHT JOIN " . TABLE_ZONES_TO_GEO_ZONES . " a ON c.countries_id = a.zone_country_id WHERE c.countries_name = '" . htmlspecialchars_decode($order->billing['country']['title']) . "' AND a.geo_zone_id = '2'"; $eu_country_query = tep_db_query($eu_country_query_raw); if (tep_db_num_rows($home_country_query) < 1 && tep_db_num_rows($eu_country_query) < 1) { $customer_country = 'non eu country'; // $pdf->Cell(50,10, 'buiten EU', 0,0,'L'); } elseif (tep_db_num_rows($home_country_query) < 1 && tep_db_num_rows($eu_country_query) >= 1) { $customer_country = 'eu country'; // $pdf->Cell(50,10, 'in EU', 0,0,'L'); } else { $customer_country = 'home country'; // $pdf->Cell(50,10, 'in NL', 0,0,'L'); } /* // Add watermark if required if(PDF_SHOW_WATERMARK_FE == 'true'){ $pdf->Watermark(); } */ // Set standard font $pdf->SetFont( PDF_INV_CORE_FONT, '', 10); //Draw Box for Invoice Address if ( PDF_INV_SHOW_SOLDTO == 'true' ) { // $text_color=html2rgb(PDF_INV_SOLDTO_LINE_COLOR ); // $pdf->SetDrawColor($border_color[0],$border_color[1],$border_color[2]); // $pdf->SetLineWidth(0.2); // $cell_color=html2rgb(PDF_INV_SOLDTO_FILL_COLOR ); // $pdf->SetFillColor($cell_color[0],$cell_color[1],$cell_color[2]); // $pdf->RoundedRect(6, 67, 90, 35, 2, 'DF'); // Draw the invoice address text $text_color=html2rgb(PDF_INV_SOLDTO_TEXT_COLOR ); $pdf->SetTextColor($text_color[0], $text_color[1], $text_color[2]); $pdf->Text(7,40, tep_html_entity_decode(ENTRY_SOLD_TO)); $pdf->SetX(0); $pdf->SetY(45); // Inspringen // $pdf->Cell(10); $pdf->SetFont( PDF_INV_SOLDTO_TEXT_FONT, PDF_INV_SOLDTO_TEXT_EFFECT, PDF_INV_SOLDTO_TEXT_HEIGHT ); // Ancien code pour TVA_INTRACOM_v3.0 // $pdf->MultiCell(70, 3.3, tep_html_entity_decode(tep_address_format($order->customer['format_id'], $order->customer, '', '', "\n")),0,'L'); // Fin ancien code pour TVA_INTRACOM_v3.0 // BOF for VAT INTRACOM_v3.3 $pdf->MultiCell(70, 3.3, tep_html_entity_decode(tep_address_format($order->billing['format_id'], $order->billing, '', '', "\n")),0,'L'); // EOF for TVA_INTRACOM_v3.3 } // Return to standard font $pdf->SetFont( PDF_INV_CORE_FONT, '', 10); // Draw Box for Delivery Address // Geen afleveradres bij download if (($order_type_check == 'physical or mixed')) { if ( PDF_INV_SHOW_SENDTO == 'true' ) { // $text_color=html2rgb(PDF_INV_SENDTO_LINE_COLOR ); // $pdf->SetDrawColor($border_color[0],$border_color[1],$border_color[2]); // $pdf->SetLineWidth(0.2); // $cell_color=html2rgb(PDF_INV_SENDTO_FILL_COLOR ); // $pdf->SetFillColor($cell_color[0],$cell_color[1],$cell_color[2]); // $pdf->RoundedRect(108, 67, 90, 35, 2, 'DF'); //Draw the invoice delivery address text $text_color=html2rgb(PDF_INV_SENDTO_TEXT_COLOR ); $pdf->SetTextColor($text_color[0], $text_color[1], $text_color[2]); $pdf->Text(100,40,tep_html_entity_decode(ENTRY_SHIP_TO)); $pdf->SetX(100); $pdf->SetY(45); // Inspringen // $pdf->Cell(111); $pdf->SetFont( PDF_INV_SENDTO_TEXT_FONT, PDF_INV_SENDTO_TEXT_EFFECT, PDF_INV_SENDTO_TEXT_HEIGHT ); $pdf->MultiCell(70, 3.3, tep_html_entity_decode(tep_address_format($order->delivery['format_id'], $order->delivery, '', '', "\n")),0,'L'); } } // Return to standard font $pdf->SetFont( PDF_INV_CORE_FONT, '', 9); // Thank you message to the customer $pdf->SetX(0); $pdf->SetY(80); $pdf->Cell(100,10, tep_html_entity_decode(PRINT_INVOICE_TEXT), 0,0,'L'); // In case of more than one page: pagenumber if ($pdf->PageNo() > 1) { // $pdf->Cell(100); //Page number $pdf->Cell(100,10,PRINT_INVOICE_PAGE_NUMBER . ' ' . $this->PageNo().' / {nb}',0,0,'R' ); } // Table containing invoice number, date and customer reference $pdf->SetX(0); $pdf->SetY(90); //Draw Payment Method Text $temp = substr ($order->info['payment_method'] , 0, 23); // Independent invoice number - Start // $header=array(PRINT_INVOICE_TITLE,(int)$HTTP_GET_VARS['order_id'],PRINT_ORDER_NUMBER,(int)$HTTP_GET_VARS['order_id'],'Betaling:',STORE_PAY_WITHIN); $header=array(PRINT_INVOICE_TITLE,$order->billing['invoice_serial'].$order->billing['invoice_number'],PRINT_ORDER_NUMBER, (int)$oID ,ENTRY_PAYMENT_METHOD, tep_html_entity_decode($temp)); $invoice_date_query = tep_db_query("select invoice_date as invoice_date from " . TABLE_ORDERS . " where orders_id = '" . (int)$HTTP_GET_VARS['order_id'] . "'"); $invoice_date = tep_db_fetch_array($invoice_date_query); // Independent invoice number - End function tep_unix_date($raw_date) { if ( ($raw_date == '0000-00-00 00:00:00') || ($raw_date == '') ) return false; $year = substr($raw_date, 0, 4); $month = (int)substr($raw_date, 5, 2); $day = (int)substr($raw_date, 8, 2); $hour = (int)substr($raw_date, 11, 2); $minute = (int)substr($raw_date, 14, 2); $second = (int)substr($raw_date, 17, 2); if (@[member=date]('Y', mktime($hour, $minute, $second, $month, $day, $year)) == $year) { return mktime($hour, $minute, $second, $month, $day, $year); } else { return ereg_replace('2037' . '$', $year, mktime($hour, $minute, $second, $month, $day, 2037)); } } $interval = '+' . STORE_PAY_WITHIN . ' days'; $d = tep_unix_date($invoice_date['invoice_date']); $end_date = date(DATE_FORMAT,strtotime($interval,$d)); $data=array(); $data[0][0] = PRINT_INVOICE_DATE ; $data[0][1] = tep_date_short($invoice_date['invoice_date']); $data[0][2] = PRINT_ORDER_DATE ; $data[0][3] = tep_date_short($order->info['date_purchased']); $data[0][4] = PRINT_STATUS_PAYMENT ; if ($order->info['orders_status_id'] >= VAT_REPORT_ORDER_STATUS_PAYMENT) { $data[0][5] = PRINT_STATUS_ORDER_PAID ; } else { $data[0][5] = PRINT_STATUS_ORDER_UNPAID ; } $data[1][0] = PRINT_PAY_WITHIN_DATE ; $data[1][1] = $end_date; $data[1][2] = PRINT_CUSTOMER_NUMBER ; $data[1][3] = $order->customer['id']; $data[1][4] = PRINT_PAY_WITHIN ; if ($order->info['orders_status_id'] >= VAT_REPORT_ORDER_STATUS_PAYMENT) { $data[1][5] = PRINT_PAY_WITHIN_NA ; } else { $data[1][5] = STORE_PAY_WITHIN . PRINT_PAY_WITHIN_DAYS ; } /* $pdf->ImprovedTable($header,$data); */ // Table containing order details $pdf->SetFont( PDF_INV_ORDERDETAILS_TEXT_FONT, PDF_INV_ORDERDETAILS_TEXT_EFFECT, PDF_INV_ORDERDETAILS_TEXT_HEIGHT); $text_color=html2rgb(PDF_INV_ORDERDETAILS_TEXT_COLOR ); $pdf->SetTextColor($text_color[0], $text_color[1], $text_color[2]); // Draw Order Number Text // $pdf->Text(10,113, tep_html_entity_decode(PRINT_INVOICE_ORDER) . (int)$HTTP_GET_VARS['order_id']); // $pdf->Cell(15,6,TABLE_HEADING_TAX,1,0,'C',1); // $pdf->Cell(20,6,tep_html_entity_decode(TABLE_HEADING_PRICE_INCLUDING_TAX),1,0,'C',1); // $pdf->Cell(20,6,tep_html_entity_decode(TABLE_HEADING_TOTAL_INCLUDING_TAX),1,0,'C',1); $header2=array(TABLE_HEADING_QUANTITY, TABLE_HEADING_PRODUCTS, TABLE_HEADING_PRODUCTS_MODEL, TABLE_HEADING_PRICE_EXCLUDING_TAX, TABLE_HEADING_TAX, TABLE_HEADING_TOTAL_EXCLUDING_TAX); // Add to $header2 if needed: // TABLE_HEADING_TAX // TABLE_HEADING_PRICE_INCLUDING_TAX // TABLE_HEADING_TOTAL_INCLUDING_TAX $data2=array(); //Show the products information line by line $item_count = 0 ; for ($i = 0, $n = sizeof($order->products); $i < $n; $i++) { $data2[$i][0] = $order->products[$i]['qty'] ; // New code - Start if (strlen($order->products[$i]['name']) > 40 && strlen($order->products[$i]['name']) < 50){ $data2[$i][1] = $order->products[$i]['name']; } else if (strlen($order->products[$i]['name']) > 50){ $data2[$i][1] = substr($order->products[$i]['name'],0,50); } else{ $data2[$i][1] = $order->products[$i]['name']; } $data2[$i][2] = $order->products[$i]['model']; $data2[$i][3] = str_replace(' ', ' ',$currencies->format($order->products[$i]['final_price'], true, $order->info['currency'], $order->info['currency_value'])); // Add to $data2 if needed (adjust/renumber subsequent array keys!): // For VAT purposes: // Check if product is an 'electronic service'. If so, determine the customer's country. if (isset($order->products[$i]['attributes']) && (($k = sizeof($order->products[$i]['attributes'])) > 0)) { for ($j = 0; $j < $k; $j++) { $virtual_check_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS_ATTRIBUTES . " pa, " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD . " pad, " . TABLE_PRODUCTS_OPTIONS_VALUES . " pov where pa.products_id = '" . $order->products[$i]['id'] . "' and pov.products_options_values_name = '" . $order->products[$i]['attributes'][$j]['value'] . "' and pa.products_attributes_id = pad.products_attributes_id"); $virtual_check = tep_db_fetch_array($virtual_check_query); if ($virtual_check['total'] > 0) { $product_type_check = 'virtual'; $order_type_check = 'virtual or mixed'; break; } } } if ($product_type_check == 'virtual') { if ($customer_country == 'home country') { $data2[$i][4] = str_replace(' ', ' ',tep_display_tax_value($order->products[$i]['tax']) . '%'); } elseif ($customer_country == 'eu country') { $data2[$i][4] = '***'; } else { $data2[$i][4] = str_replace(' ', ' ',tep_display_tax_value($order->products[$i]['tax']) . '%'); } } else { $data2[$i][4] = str_replace(' ', ' ',tep_display_tax_value($order->products[$i]['tax']) . '%'); } unset($product_type_check); // New code - End // $data2[$i][3] = str_replace(' ', ' ',$currencies->format($order->products[$i]['final_price'], true, $order->info['currency'], $order->info['currency_value'])); // Add to $data2 if needed (adjust/renumber subsequent array keys!): // $data2[$i][5] = str_replace(' ', ' ',$currencies->format(tep_add_tax($order->products[$i]['final_price'], $order->products[$i]['tax']), true, $order->info['currency'], $order->info['currency_value'])); $data2[$i][5] = str_replace(' ', ' ',$currencies->format($order->products[$i]['final_price'] * $order->products[$i]['qty'], true, $order->info['currency'], $order->info['currency_value'])) ; // Add to $data2 if needed (adjust/renumber subsequent array keys!): // $data2[$i][5] = str_replace(' ', ' ',$currencies->format(tep_add_tax($order->products[$i]['final_price'], $order->products[$i]['tax']) * $order->products[$i]['qty'], true, $order->info['currency'], $order->info['currency_value'])); // Show the products attributes $data3 = array(); //get attribs if (isset($order->products[$i]['attributes']) && (($k = sizeof($order->products[$i]['attributes'])) > 0)) { $attribute_line = 'true'; for ($j = 0; $j < $k; $j++) { // New code - Start // Display product option only if option is not part of excluded list $dps = explode(',' , DISPLAY_PRODUCT_OPTIONS); if (!in_array($order->products[$i]['attributes'][$j]['option'], $dps)) { // New code - End if ($order->products[$i]['attributes'][$j]['price'] != '0') { $data3[$i][$j][1] = '- ' . $order->products[$i]['attributes'][$j]['option'] . ': ' . $order->products[$i]['attributes'][$j]['value'] . ' (' . $order->products[$i]['attributes'][$j]['prefix'] . $currencies->format($order->products[$i]['attributes'][$j]['price'] * $order->products[$i]['qty'], true, $order->info['currency'], $order->info['currency_value']) . ')' ; } else { $data3[$i][$j][1] = '- ' . $order->products[$i]['attributes'][$j]['option'] . ': ' . $order->products[$i]['attributes'][$j]['value']; } // New code - Start } // New code - End } //Check for product line overflow $item_count++; if ( $item_count > 20 ) { $pdf->AddPage(); //Fields Name position // $Y_Fields_Name_position = 125; //Table position, under Fields Name // $Y_Table_Position = 70; output_table_heading($Y_Table_Position-6); $item_count = 1; } } // New code - End //Check for product line overflow $item_count++; // if ((is_long($item_count / 32) && $i >= 20) || ($i == 20)){ if ( $item_count > 20 ) { $pdf->AddPage(); //Fields Name position // $Y_Fields_Name_position = 125; //Table position, under Fields Name // $Y_Table_Position = 70; output_table_heading($Y_Table_Position-6); //if ($i == 20) $item_count = 1; } } // Add totals to product table $data4=array(); $data4[0][4] = ENTRY_SUB_TOTAL; // $data4[1][4] = ENTRY_TAX; $data4[2][4] = ENTRY_TOTAL; for ($i = 0, $n = sizeof($order->totals); $i < $n; $i++) { $temp = substr ($order->totals[$i]['text'],0 ,3); if ($temp == '<b>') { $temp2 = substr($order->totals[$i]['text'], 3); $order->totals[$i]['text'] = substr($temp2, 0, strlen($temp2)-4); } $data4[$i][0] = ''; $data4[$i][1] = ''; $data4[$i][2] = ''; $data4[$i][3] = ''; $data4[$i][4] = str_replace(' ', ' ',$order->totals[$i]['title']); $data4[$i][5] = str_replace(' ', ' ',$order->totals[$i]['text']); //Check for product line overflow $item_count++; if ( $item_count > 20 ) { $pdf->AddPage(); //Fields Name position // $Y_Fields_Name_position = 125; //Table position, under Fields Name // $Y_Table_Position = 70; // output_table_heading($Y_Table_Position-6); $item_count = 1; } } $pdf->Ln(); $pdf->SetY(120); /* $pdf->FancyTable($header2,$data2,$data3,$attribute_line,$data4); */ // For VAT purposes: // Check if one of the products is an 'electronic service'. If so, determine the customer's country. // $pdf->Cell(50,10, '* ' . $order->billing['country'], 0,0,'L'); // $pdf->Cell(50,10, '* ' . $order->delivery['country'], 0,0,'L'); if (($order_type_check == 'virtual or mixed') and ($order->billing['company'] != '' && $order->billing['tva_intracom'] != '' && $customer_country == 'eu country')) { $pdf->SetFont( PDF_INV_CORE_FONT, '', 10); // $highlight_color = html2rgb(PDF_INV_HIGHLIGHT_COLOR); $pdf->SetTextColor($highlight_color[0],$highlight_color[1],$highlight_color[2]); // $text_color=html2rgb(PDF_INV_HEADER_TEXT_COLOR ); // $pdf->SetTextColor($text_color[0], $text_color[1], $text_color[2]); $pdf->SetX(0); $pdf->SetY(180); $pdf->Cell(100,10, '*** ' . tep_html_entity_decode(VAT_SHIFTED_TEXT), 0,0,'L'); } // Set PDF metadata // Independent invoice number - Start // $pdf->SetTitle(PDF_META_TITLE); $pdf->SetTitle(TEXT_INVOICE.' '.$order->billing['invoice_serial'].$order->billing['invoice_number']); // $pdf->SetSubject(PDF_META_SUBJECT . $HTTP_GET_VARS['order_id']); $pdf->SetSubject(TEXT_INVOICE . ' ' . $order->billing['invoice_serial'] . $order->billing['invoice_number']); // Independent invoice number - End $pdf->SetAuthor(STORE_OWNER); // PDF created function safe_filename ($filename) { $search = array( '/ß/', '/ä/','/Ä/', '/ö/','/Ö/', '/ü/','/Ü/', '([^[:alnum:]._])' ); $replace = array( 'ss', 'ae','Ae', 'oe','Oe', 'ue','Ue', '_' ); // return a safe filename, lowercased and suffixed with invoice number. return strtolower(preg_replace($search,$replace,$filename)); } // $file_name = safe_filename(STORE_NAME); // Independent invoice number - Start // $file_name .= "_invoice_" . $HTTP_GET_VARS['order_id'] . ".pdf"; // $file_name .= "_" . TEXT_INVOICE . "_" . $order->billing['invoice_serial'].$order->billing['invoice_number']; $file_name = $order->billing['invoice_serial'].$order->billing['invoice_number']; // Independent invoice number - End // Save the pdf to a folder with setting `F` // $pdf->Output(DIR_FS_CATALOG . 'invoices/' . $file_name . '.pdf', 'F'); // PDF is created, now output the file // are we streaming for email attachment or outputting to browser? if($stream){ // return $pdf->Output( "", "S" ); $pdf_data = $pdf->Output('' , 'S'); } else { $mode = (FORCE_PDF_INVOICE_DOWNLOAD == 'true') ? 'D' : 'I'; // what do we do? display inline or force download $pdf->Output($file_name , $mode); } ?> Can anyone explain to me why the extended class PDF fails in my payment folder, but works perfectly in the setting of the main catalog/ folder (and how to fix it)? Kind regards, Dennis
  4. dennish

    [contribution] Super Download Store

    Hello, I found a pretty straightforward solution to the "blank page" issue (the question related to updating the remaining number of allowed downloads after each download click is still open: any suggestions to solve this are very much appreciated!). My solution involves the following changes: 1. In catalog/checkout_succes.php: After require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_CHECKOUT_SUCCESS); Insert // New code - Start $navigation->set_snapshot(); // New code - End 2. In catalog/account_history_info.php: After if (!tep_session_is_registered('customer_id')) { $navigation->set_snapshot(); tep_redirect(tep_href_link(FILENAME_LOGIN, '', 'SSL')); } Insert // New code - Start $navigation->set_snapshot(); // New code - End 3. In calatog/download.php: Replace if ($downloads['download_count'] <= 0) die; By // if ($downloads['download_count'] <= 0) die; // New code - Start if ($downloads['download_count'] <= 0) { // Return to the last page visited if (sizeof($navigation->snapshot) > 0) { $origin_href = tep_href_link($navigation->snapshot['page'], tep_array_to_string($navigation->snapshot['get'], array(tep_session_name())), $navigation->snapshot['mode']); $navigation->clear_snapshot(); } else { $origin_href = tep_href_link(FILENAME_DEFAULT); } tep_redirect($origin_href); } // New code - End Done! Another thing I came accross is the message displayed at catalog/checkout_succes.php refering the customer to the catalog/account.php page (in case he/she wishes to download at a later moment). This message is shown even if there are no downloads left. In this case I would rather leave that message out. In catalog/includes/modules/downloads.php: Replace <?php if (!strstr($PHP_SELF, FILENAME_ACCOUNT_HISTORY_INFO)) { ?> <p><?php printf(FOOTER_DOWNLOAD, '<a href="' . tep_href_link(FILENAME_ACCOUNT, '', 'SSL') . '">' . HEADER_TITLE_MY_ACCOUNT . '</a>'); ?></p> <?php } ?> By <?php if (!strstr($PHP_SELF, FILENAME_ACCOUNT_HISTORY_INFO)) { // New code - Start // Don't refer customer to My account for downloads if no remaining downloads are left $downloads_query = tep_db_query("select o.orders_status, date_format(o.last_modified, '%Y-%m-%d') as date_purchased_day, opd.download_maxdays, op.products_name, opd.orders_products_download_id, opd.orders_products_filename, opd.download_count, opd.download_maxdays from " . TABLE_ORDERS . " o, " . TABLE_ORDERS_PRODUCTS . " op, " . TABLE_ORDERS_PRODUCTS_DOWNLOAD . " opd where o.customers_id = '" . (int)$customer_id . "' and o.orders_status >= " . DOWNLOADS_CONTROLLER_ORDERS_STATUS . " and o.orders_id = '" . (int)$last_order . "' and o.orders_id = op.orders_id and op.orders_products_id = opd.orders_products_id and opd.orders_products_filename != ''"); $downloads = tep_db_fetch_array($downloads_query); if ( ($downloads['download_count'] > 0) && ( ($downloads['download_maxdays'] == 0) || ($download_timestamp > time())) ) { // New code - End ?> <p><?php printf(FOOTER_DOWNLOAD, '<a href="' . tep_href_link(FILENAME_ACCOUNT, '', 'SSL') . '">' . HEADER_TITLE_MY_ACCOUNT . '</a>'); ?></p> <?php // New code - Start } // New code - End } ?> Kind regards. Dennis
  5. dennish

    Official PayPal IPN Support Thread

    Hello, In the standard setup PayPal IPN deletes the (so-called temporary) order (and thereby also the order-ID) when a customer decides to interrupt (and thereby effectively cancel) his payment at the Paypal website. Obviously this approach saves space in the database (by clearing uncompleted orders), but also has an important drawback from an accounting/control viewpoint: it creates gaps in the subsequent numbering of orders. An solution would be to change the code in includes/functions/general.php: // START DELETE TEMP PAYPAL IPN ORDER // This is used in shopping_cart.php when a temporary order needs to be deleted // after it was cancelled by customer on paypal site. function tep_remove_order($order_id, $restock = false) { if ($restock == 'on') { $order_query = tep_db_query("select products_id, products_quantity from " . TABLE_ORDERS_PRODUCTS . " where orders_id = '" . (int)$order_id . "'"); while ($order = tep_db_fetch_array($order_query)) { tep_db_query("update " . TABLE_PRODUCTS . " set products_quantity = products_quantity + " . $order['products_quantity'] . ", products_ordered = products_ordered - " . $order['products_quantity'] . " where products_id = '" . (int)$order['products_id'] . "'"); } } tep_db_query("delete from " . TABLE_ORDERS . " where orders_id = '" . (int)$order_id . "'"); tep_db_query("delete from " . TABLE_ORDERS_PRODUCTS . " where orders_id = '" . (int)$order_id . "'"); tep_db_query("delete from " . TABLE_ORDERS_PRODUCTS_ATTRIBUTES . " where orders_id = '" . (int)$order_id . "'"); tep_db_query("delete from " . TABLE_ORDERS_STATUS_HISTORY . " where orders_id = '" . (int)$order_id . "'"); tep_db_query("delete from " . TABLE_ORDERS_TOTAL . " where orders_id = '" . (int)$order_id . "'"); } // END DELETE TEMP PAYPAL IPN ORDER Instead of deleting the order in the orders table, the order could be emptied (meaning all entries other than the order_id) and the orders_status set to a new status, reflecting that payment of the order was cancelled during the Paypal process. Can anyone point out possible problems with this approach (other than additional database size)? Kind regards, Dennis
  6. dennish

    [contribution] Super Download Store

    Hello, I am struggling with an issue already raised some time ago (See post #569 and the provided answer post#570): how to get the pages displaying the remaining downloads (checkout_success.php and account_history_info.php) to refresh and show the actual number of downloads still allowed after clicking the download button. (Hopefully this should also take care of the blank page emerging after the customer has exceeded the maximum number of downloads). As suggested in post #570, the pages should be reloaded (from the server) when the download button is clicked to acheive the desired result. I found some suggestions on how to accomplish this with javascript here: http://www.mediacollege.com/internet/javascript/page/reload.html http://stackoverflow.com/questions/5404839/how-can-i-refresh-a-page-with-jquery?rq=1 I added the following code to the download button links in catalog/includes/modules/downloads.php: onClick="window.location.reload(true);" The full code for the link now looks like this: echo ' <td class="main" align="left" width="70%"><div><a href="' . tep_href_link(FILENAME_DOWNLOAD, 'order=' . $last_order . '&id=' . $downloads['orders_products_download_id']) . '" onClick="window.location.reload(true);">' . tep_image_button('button_download.gif', 'Download', 'style="vertical-align:middle;padding-top:5px;padding-bottom:5px;"') . '</a><span style=""> ' . $downloads['products_name'] . ' - '. $file_array['download_group_file_description'] . '</span></div></td>' . "\n"; The resulting output is: <td class="main" align="left" width="25%"><a href="http://www.mydomain.com/catalog/download.php?order=67&id=72" onClick="window.location.reload(true);"><img src="includes/languages/english/images/buttons/button_download.gif" alt="Download" title="Download" width="120" height="20" style="vertical-align:middle;padding-top:5px;padding-bottom:5px;" /></a></td> However, the page is still not updated after the download button is clicked. If I refresh the page manually using the browser (in my case Firefox), the remaining number of downloads is set to 0 (as would be expected when the allowed 2 downloads in my case are fully used). Can anyone offer an explantion (and possibly a solution) for this issue? Thanks in advance. Kind regards, Dennis
  7. Hello, I've installed a payment module, which displays a drop down menu (on checkout_payment.php), from which the customer should select the name of his/her bank. The HTML code: <td><select name="sisow_bank" enabled>\n<option value="">Select your bank</option>\n<option value="99">Sisow Bank (Test)</option>\n</select></td> The module (1) uses javascript validation, and (2) allows the customer to proceed to checkout_conformation.php despite the fact no bank was selected (after which the customer is redirected again to checkout_payment.php, where an error is displayed). Instead, I would like to (1) use the regular messageStack for error messages, and (2) let the customer stay on checkout_payment.php, until a bank is selected as required. To accomplish this, I've added two pieces of code to checkout_payment.php: 1. First, to produce an error when the customer fails to select a bank, I inserted: if ($payment == 'sisowideal') { if ($sisow_bank == '') { $error = true; $messageStack->add('checkout_payment', ENTRY_SISOWIDEAL_ERROR); } } before: require(DIR_WS_INCLUDES . 'template_top.php'); ?> 2. Secondly, to display the error message I added: <?php if ($messageStack->size('checkout_payment') > 0) { echo $messageStack->output('checkout_payment'); } ?> after: <?php if (isset($HTTP_GET_VARS['payment_error']) && is_object(${$HTTP_GET_VARS['payment_error']}) && ($error = ${$HTTP_GET_VARS['payment_error']}->get_error())) { ?> <div class="contentText"> <?php echo '<strong>' . tep_output_string_protected($error['title']) . '</strong>'; ?> <p class="messageStackError"><?php echo tep_output_string_protected($error['error']); ?></p> </div> <?php } ?> What do I need to change in addition, to: let the customer stay on checkout_pament.php as long as errors remain (no selection made in drop down menu) let the customer move on to chechout_confirmation.php as soon as errors have cleared (bank was selected) I took a look at both: <?php echo tep_draw_form('checkout_payment', tep_href_link(FILENAME_CHECKOUT_CONFIRMATION, '', 'SSL'), 'post', 'onsubmit="return check_form();"', true); ?> and create_account.php (similar approach) but couldn't figure out how to get it right. Any help is much appreciated. Kind regards, Dennis
  8. dennish

    Display error message on checkout_payment

    @@Bob I found a solution here: http://coredogs.com/lesson/form-and-php-validation-one-page (with a full explanation of the method used). My code for checkout_payment.php now looks like this: <?php /* $Id$ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright (c) 2010 osCommerce Released under the GNU General Public License */ require('includes/application_top.php'); // if the customer is not logged on, redirect them to the login page if (!tep_session_is_registered('customer_id')) { $navigation->set_snapshot(); tep_redirect(tep_href_link(FILENAME_LOGIN, '', 'SSL')); } // if there is nothing in the customers cart, redirect them to the shopping cart page if ($cart->count_contents() < 1) { tep_redirect(tep_href_link(FILENAME_SHOPPING_CART)); } // if no shipping method has been selected, redirect the customer to the shipping method selection page if (!tep_session_is_registered('shipping')) { tep_redirect(tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL')); } // avoid hack attempts during the checkout procedure by checking the internal cartID if (isset($cart->cartID) && tep_session_is_registered('cartID')) { if ($cart->cartID != $cartID) { tep_redirect(tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL')); } } // Stock Check if ( (STOCK_CHECK == 'true') && (STOCK_ALLOW_CHECKOUT != 'true') ) { $products = $cart->get_products(); for ($i=0, $n=sizeof($products); $i<$n; $i++) { if (tep_check_stock($products[$i]['id'], $products[$i]['quantity'])) { tep_redirect(tep_href_link(FILENAME_SHOPPING_CART)); break; } } } // if no billing destination address was selected, use the customers own address as default if (!tep_session_is_registered('billto')) { tep_session_register('billto'); $billto = $customer_default_address_id; } else { // verify the selected billing address if ( (is_array($billto) && empty($billto)) || is_numeric($billto) ) { $check_address_query = tep_db_query("select count(*) as total from " . TABLE_ADDRESS_BOOK . " where customers_id = '" . (int)$customer_id . "' and address_book_id = '" . (int)$billto . "'"); $check_address = tep_db_fetch_array($check_address_query); if ($check_address['total'] != '1') { $billto = $customer_default_address_id; if (tep_session_is_registered('payment')) tep_session_unregister('payment'); } } } // New code - Start $process = false; if (isset($HTTP_POST_VARS['action']) && ($HTTP_POST_VARS['action'] == 'process') && isset($HTTP_POST_VARS['formid']) && ($HTTP_POST_VARS['formid'] == $sessiontoken)) { $process = true; $payment = tep_db_prepare_input($HTTP_POST_VARS['payment']); $sisow_bank = tep_db_prepare_input($HTTP_POST_VARS['sisow_bank']); $agree = tep_db_prepare_input($HTTP_POST_VARS['agree']); $error = false; if ($HTTP_POST_VARS['sisow_bank'] == '') { $error = true; $messageStack->add('checkout_payment', ENTRY_SISOWIDEAL_ERROR); } // New code - End require(DIR_WS_CLASSES . 'order.php'); $order = new order; if (!tep_session_is_registered('comments')) tep_session_register('comments'); if (isset($HTTP_POST_VARS['comments']) && tep_not_null($HTTP_POST_VARS['comments'])) { $comments = tep_db_prepare_input($HTTP_POST_VARS['comments']); } $total_weight = $cart->show_weight(); $total_count = $cart->count_contents(); // load all enabled payment modules require(DIR_WS_CLASSES . 'payment.php'); $payment_modules = new payment; require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_CHECKOUT_PAYMENT); // New code - Start if ($error == false) { if ($HTTP_POST_VARS['sisow_bank'] != '') { tep_redirect(tep_href_link(FILENAME_CHECKOUT_CONFIRMATION, 'sisow_bank=' . $sisow_bank . '&agree=' . $agree, 'SSL')); } else { tep_redirect(tep_href_link(FILENAME_CHECKOUT_CONFIRMATION, 'agree=' . $agree, 'SSL')); } } } // New code - End $breadcrumb->add(NAVBAR_TITLE_1, tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL')); $breadcrumb->add(NAVBAR_TITLE_2, tep_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL')); require(DIR_WS_INCLUDES . 'template_top.php'); ?> <script type="text/javascript"><!-- var selected; function selectRowEffect(object, buttonselect) { if (!selected) { if (document.getElementById) { selected = document.getElementById('defaultSelected'); } else { selected = document.all['defaultSelected']; } } if (selected) selected.className = 'moduleRow'; object.className = 'moduleRowSelected'; selected = object; // one button is not an array if (document.checkout_payment.payment[0]) { document.checkout_payment.payment[buttonselect].checked=true; } else { document.checkout_payment.payment.checked=true; } } function rowOverEffect(object) { if (object.className == 'moduleRow') object.className = 'moduleRowOver'; } function rowOutEffect(object) { if (object.className == 'moduleRowOver') object.className = 'moduleRow'; } //--></script> <?php // echo $payment_modules->javascript_validation(); ?> <h1><?php echo HEADING_TITLE; ?></h1> <!-- New code - Start //--> <?php // echo tep_draw_form('checkout_payment', tep_href_link(FILENAME_CHECKOUT_CONFIRMATION, '', 'SSL'), 'post', 'onsubmit="return check_form();"', true); ?> <?php echo tep_draw_form('checkout_payment', tep_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL'), 'post', 'onsubmit="return check_form();"', true) . tep_draw_hidden_field('action', 'process'); ?> <!-- New code - End //--> <div class="contentContainer"> <?php if (isset($HTTP_GET_VARS['payment_error']) && is_object(${$HTTP_GET_VARS['payment_error']}) && ($error = ${$HTTP_GET_VARS['payment_error']}->get_error())) { ?> <div class="contentText"> <?php echo '<strong>' . tep_output_string_protected($error['title']) . '</strong>'; ?> <p class="messageStackError"><?php echo tep_output_string_protected($error['error']); ?></p> </div> <?php } ?> <!-- New code - Start //--> <?php if ($messageStack->size('checkout_payment') > 0) { echo $messageStack->output('checkout_payment'); } ?> <!-- New code - End //--> <!-- New code - Start //--> <!-- Only for testing purposes! Outputs $HTTP_POST_VARS / $_POST //--> <?php foreach ($_POST as $key => $value) { echo $key ." => ". $value . '<br>'; } ?> <!-- New code - End //--> <h2><?php echo TABLE_HEADING_BILLING_ADDRESS; ?></h2> <div class="contentText"> <div class="ui-widget infoBoxContainer" style="float: right;"> <div class="ui-widget-header infoBoxHeading"><?php echo TITLE_BILLING_ADDRESS; ?></div> <div class="ui-widget-content infoBoxContents"> <?php echo tep_address_label($customer_id, $billto, true, ' ', '<br />'); ?> </div> </div> <?php echo TEXT_SELECTED_BILLING_DESTINATION; ?><br /><br /><?php echo tep_draw_button(IMAGE_BUTTON_CHANGE_ADDRESS, 'home', tep_href_link(FILENAME_CHECKOUT_PAYMENT_ADDRESS, '', 'SSL')); ?> </div> <div style="clear: both;"></div> <h2><?php echo TABLE_HEADING_PAYMENT_METHOD; ?></h2> <?php $selection = $payment_modules->selection(); if (sizeof($selection) > 1) { ?> <div class="contentText"> <div style="float: right;"> <?php echo '<strong>' . TITLE_PLEASE_SELECT . '</strong>'; ?> </div> <?php echo TEXT_SELECT_PAYMENT_METHOD; ?> </div> <?php } elseif ($free_shipping == false) { ?> <div class="contentText"> <?php echo TEXT_ENTER_PAYMENT_INFORMATION; ?> </div> <?php } ?> <div class="contentText"> <?php $radio_buttons = 0; for ($i=0, $n=sizeof($selection); $i<$n; $i++) { ?> <table border="0" width="100%" cellspacing="0" cellpadding="2"> <?php if ( ($selection[$i]['id'] == $payment) || ($n == 1) ) { echo ' <tr id="defaultSelected" class="moduleRowSelected" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="selectRowEffect(this, ' . $radio_buttons . ')">' . "\n"; } else { echo ' <tr class="moduleRow" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="selectRowEffect(this, ' . $radio_buttons . ')">' . "\n"; } ?> <td><strong><?php echo $selection[$i]['module']; ?></strong></td> <td align="right"> <?php if (sizeof($selection) > 1) { echo tep_draw_radio_field('payment', $selection[$i]['id'], ($selection[$i]['id'] == $payment)); } else { echo tep_draw_hidden_field('payment', $selection[$i]['id']); } ?> </td> </tr> <?php if (isset($selection[$i]['error'])) { ?> <tr> <td colspan="2"><?php echo $selection[$i]['error']; ?></td> </tr> <?php } elseif (isset($selection[$i]['fields']) && is_array($selection[$i]['fields'])) { ?> <tr> <td colspan="2"><table border="0" cellspacing="0" cellpadding="2"> <?php for ($j=0, $n2=sizeof($selection[$i]['fields']); $j<$n2; $j++) { ?> <tr> <td><?php echo $selection[$i]['fields'][$j]['title']; ?></td> <td><?php echo $selection[$i]['fields'][$j]['field']; ?></td> </tr> <?php } ?> </table></td> </tr> <?php } ?> </table> <?php $radio_buttons++; } ?> </div> <h2><?php echo TABLE_HEADING_COMMENTS; ?></h2> <div class="contentText"> <?php echo tep_draw_textarea_field('comments', 'soft', '60', '5', $comments); ?> </div> <!-- Must agree to terms - Start //--> <div class="subHeader"> <h2><?php echo TITLE_CONDITION_AGREEMENT; ?></h2> </div> <?php if ($order->content_type == 'virtual' or $order->content_type == 'mixed') { ?> <?php echo TEXT_LICENSE_AGREEMENT; ?> <?php } else { ?> <?php echo TEXT_CONDITION_AGREEMENT; ?> <?php } ?> <?php echo tep_draw_checkbox_field('agree','true'); ?> <!-- Must agree to terms - End //--> <div class="contentText"> <div style="float: left; width: 60%; padding-top: 5px; padding-left: 15%;"> <div id="coProgressBar" style="height: 5px;"></div> <table border="0" width="100%" cellspacing="0" cellpadding="2"> <tr> <td align="center" width="33%" class="checkoutBarFrom"><?php echo '<a href="' . tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL') . '" class="checkoutBarFrom">' . CHECKOUT_BAR_DELIVERY . '</a>'; ?></td> <td align="center" width="33%" class="checkoutBarCurrent"><?php echo CHECKOUT_BAR_PAYMENT; ?></td> <td align="center" width="33%" class="checkoutBarTo"><?php echo CHECKOUT_BAR_CONFIRMATION; ?></td> </tr> </table> </div> <div style="float: right;"><?php echo tep_draw_button(IMAGE_BUTTON_CONTINUE, 'triangle-1-e', null, 'primary'); ?></div> </div> </div> <script type="text/javascript"> $('#coProgressBar').progressbar({ value: 66 }); </script> </form> <?php require(DIR_WS_INCLUDES . 'template_bottom.php'); require(DIR_WS_INCLUDES . 'application_bottom.php'); ?> Notice the adapted redirect with parameters (line 101): // New code - Start if ($error == false) { if ($HTTP_POST_VARS['sisow_bank'] != '') { tep_redirect(tep_href_link(FILENAME_CHECKOUT_CONFIRMATION, 'sisow_bank=' . $sisow_bank . '&agree=' . $agree, 'SSL')); } else { tep_redirect(tep_href_link(FILENAME_CHECKOUT_CONFIRMATION, 'agree=' . $agree, 'SSL')); } } } // New code - End The variables used are defined as (line 71): $payment = tep_db_prepare_input($HTTP_POST_VARS['payment']); $sisow_bank = tep_db_prepare_input($HTTP_POST_VARS['sisow_bank']); $agree = tep_db_prepare_input($HTTP_POST_VARS['agree']); I omitted the first variable $payment in my previous code (see post #3), but this needs to be included for the script to function correctly. Finally, I changed the code for checkout_confirmation.php to: // Must agree to terms - Start // if ($HTTP_POST_VARS['agree'] != 'true') { if ($_GET['agree'] != 'true') { tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, tep_redirect(tep_href_link(FILENAME_CHECKOUT_FAIL)), 'SSL')); } // Must agree to terms - End Thanks for putting me on the right track. Kind regards, Dennis
  9. dennish

    Display error message on checkout_payment

    @@Bob Thanks for your suggestion. I decided to continue on the "create_account" path and came up with the following code (Look for New code markers. Original checkout_payment.php file was taken from the osC 2.3.3.4 package): <?php /* $Id$ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright (c) 2010 osCommerce Released under the GNU General Public License */ require('includes/application_top.php'); // if the customer is not logged on, redirect them to the login page if (!tep_session_is_registered('customer_id')) { $navigation->set_snapshot(); tep_redirect(tep_href_link(FILENAME_LOGIN, '', 'SSL')); } // if there is nothing in the customers cart, redirect them to the shopping cart page if ($cart->count_contents() < 1) { tep_redirect(tep_href_link(FILENAME_SHOPPING_CART)); } // if no shipping method has been selected, redirect the customer to the shipping method selection page if (!tep_session_is_registered('shipping')) { tep_redirect(tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL')); } // avoid hack attempts during the checkout procedure by checking the internal cartID if (isset($cart->cartID) && tep_session_is_registered('cartID')) { if ($cart->cartID != $cartID) { tep_redirect(tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL')); } } // Stock Check if ( (STOCK_CHECK == 'true') && (STOCK_ALLOW_CHECKOUT != 'true') ) { $products = $cart->get_products(); for ($i=0, $n=sizeof($products); $i<$n; $i++) { if (tep_check_stock($products[$i]['id'], $products[$i]['quantity'])) { tep_redirect(tep_href_link(FILENAME_SHOPPING_CART)); break; } } } // if no billing destination address was selected, use the customers own address as default if (!tep_session_is_registered('billto')) { tep_session_register('billto'); $billto = $customer_default_address_id; } else { // verify the selected billing address if ( (is_array($billto) && empty($billto)) || is_numeric($billto) ) { $check_address_query = tep_db_query("select count(*) as total from " . TABLE_ADDRESS_BOOK . " where customers_id = '" . (int)$customer_id . "' and address_book_id = '" . (int)$billto . "'"); $check_address = tep_db_fetch_array($check_address_query); if ($check_address['total'] != '1') { $billto = $customer_default_address_id; if (tep_session_is_registered('payment')) tep_session_unregister('payment'); } } } // New code - Start $process = false; if (isset($HTTP_POST_VARS['action']) && ($HTTP_POST_VARS['action'] == 'process') && isset($HTTP_POST_VARS['formid']) && ($HTTP_POST_VARS['formid'] == $sessiontoken)) { $process = true; $error = false; if ($HTTP_POST_VARS['sisow_bank'] == '') { $error = true; $messageStack->add('checkout_payment', ENTRY_SISOWIDEAL_ERROR); } // New code - End require(DIR_WS_CLASSES . 'order.php'); $order = new order; if (!tep_session_is_registered('comments')) tep_session_register('comments'); if (isset($HTTP_POST_VARS['comments']) && tep_not_null($HTTP_POST_VARS['comments'])) { $comments = tep_db_prepare_input($HTTP_POST_VARS['comments']); } $total_weight = $cart->show_weight(); $total_count = $cart->count_contents(); // load all enabled payment modules require(DIR_WS_CLASSES . 'payment.php'); $payment_modules = new payment; require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_CHECKOUT_PAYMENT); // New code - Start if ($error == false) { tep_redirect(tep_href_link(FILENAME_CHECKOUT_CONFIRMATION, '', 'SSL')); } } // New code - End $breadcrumb->add(NAVBAR_TITLE_1, tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL')); $breadcrumb->add(NAVBAR_TITLE_2, tep_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL')); require(DIR_WS_INCLUDES . 'template_top.php'); ?> <script type="text/javascript"><!-- var selected; function selectRowEffect(object, buttonselect) { if (!selected) { if (document.getElementById) { selected = document.getElementById('defaultSelected'); } else { selected = document.all['defaultSelected']; } } if (selected) selected.className = 'moduleRow'; object.className = 'moduleRowSelected'; selected = object; // one button is not an array if (document.checkout_payment.payment[0]) { document.checkout_payment.payment[buttonselect].checked=true; } else { document.checkout_payment.payment.checked=true; } } function rowOverEffect(object) { if (object.className == 'moduleRow') object.className = 'moduleRowOver'; } function rowOutEffect(object) { if (object.className == 'moduleRowOver') object.className = 'moduleRow'; } //--></script> <?php echo $payment_modules->javascript_validation(); ?> <h1><?php echo HEADING_TITLE; ?></h1> <!-- New code - Start //--> <?php // echo tep_draw_form('checkout_payment', tep_href_link(FILENAME_CHECKOUT_CONFIRMATION, '', 'SSL'), 'post', 'onsubmit="return check_form();"', true); ?> <?php echo tep_draw_form('checkout_payment', tep_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL'), 'post', 'onsubmit="return check_form();"', true) . tep_draw_hidden_field('action', 'process'); ?> <!-- New code - End //--> <div class="contentContainer"> <?php if (isset($HTTP_GET_VARS['payment_error']) && is_object(${$HTTP_GET_VARS['payment_error']}) && ($error = ${$HTTP_GET_VARS['payment_error']}->get_error())) { ?> <div class="contentText"> <?php echo '<strong>' . tep_output_string_protected($error['title']) . '</strong>'; ?> <p class="messageStackError"><?php echo tep_output_string_protected($error['error']); ?></p> </div> <?php } ?> <!-- New code - Start //--> <?php if ($messageStack->size('checkout_payment') > 0) { echo $messageStack->output('checkout_payment'); } ?> <!-- New code - End //--> <!-- New code - Start //--> <!-- Only for testing purposes! Outputs $HTTP_POST_VARS / $_POST //--> <?php foreach ($_POST as $key => $value) { echo $key ." => ". $value . '<br>'; } ?> <!-- New code - End //--> <h2><?php echo TABLE_HEADING_BILLING_ADDRESS; ?></h2> <div class="contentText"> <div class="ui-widget infoBoxContainer" style="float: right;"> <div class="ui-widget-header infoBoxHeading"><?php echo TITLE_BILLING_ADDRESS; ?></div> <div class="ui-widget-content infoBoxContents"> <?php echo tep_address_label($customer_id, $billto, true, ' ', '<br />'); ?> </div> </div> <?php echo TEXT_SELECTED_BILLING_DESTINATION; ?><br /><br /><?php echo tep_draw_button(IMAGE_BUTTON_CHANGE_ADDRESS, 'home', tep_href_link(FILENAME_CHECKOUT_PAYMENT_ADDRESS, '', 'SSL')); ?> </div> <div style="clear: both;"></div> <h2><?php echo TABLE_HEADING_PAYMENT_METHOD; ?></h2> <?php $selection = $payment_modules->selection(); if (sizeof($selection) > 1) { ?> <div class="contentText"> <div style="float: right;"> <?php echo '<strong>' . TITLE_PLEASE_SELECT . '</strong>'; ?> </div> <?php echo TEXT_SELECT_PAYMENT_METHOD; ?> </div> <?php } elseif ($free_shipping == false) { ?> <div class="contentText"> <?php echo TEXT_ENTER_PAYMENT_INFORMATION; ?> </div> <?php } ?> <div class="contentText"> <?php $radio_buttons = 0; for ($i=0, $n=sizeof($selection); $i<$n; $i++) { ?> <table border="0" width="100%" cellspacing="0" cellpadding="2"> <?php if ( ($selection[$i]['id'] == $payment) || ($n == 1) ) { echo ' <tr id="defaultSelected" class="moduleRowSelected" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="selectRowEffect(this, ' . $radio_buttons . ')">' . "\n"; } else { echo ' <tr class="moduleRow" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="selectRowEffect(this, ' . $radio_buttons . ')">' . "\n"; } ?> <td><strong><?php echo $selection[$i]['module']; ?></strong></td> <td align="right"> <?php if (sizeof($selection) > 1) { echo tep_draw_radio_field('payment', $selection[$i]['id'], ($selection[$i]['id'] == $payment)); } else { echo tep_draw_hidden_field('payment', $selection[$i]['id']); } ?> </td> </tr> <?php if (isset($selection[$i]['error'])) { ?> <tr> <td colspan="2"><?php echo $selection[$i]['error']; ?></td> </tr> <?php } elseif (isset($selection[$i]['fields']) && is_array($selection[$i]['fields'])) { ?> <tr> <td colspan="2"><table border="0" cellspacing="0" cellpadding="2"> <?php for ($j=0, $n2=sizeof($selection[$i]['fields']); $j<$n2; $j++) { ?> <tr> <td><?php echo $selection[$i]['fields'][$j]['title']; ?></td> <td><?php echo $selection[$i]['fields'][$j]['field']; ?></td> </tr> <?php } ?> </table></td> </tr> <?php } ?> </table> <?php $radio_buttons++; } ?> </div> <h2><?php echo TABLE_HEADING_COMMENTS; ?></h2> <div class="contentText"> <?php echo tep_draw_textarea_field('comments', 'soft', '60', '5', $comments); ?> </div> <!-- Must agree to terms - Start //--> <div class="subHeader"> <h2><?php echo TITLE_CONDITION_AGREEMENT; ?></h2> </div> <?php if ($order->content_type == 'virtual' or $order->content_type == 'mixed') { ?> <?php echo TEXT_LICENSE_AGREEMENT; ?> <?php } else { ?> <?php echo TEXT_CONDITION_AGREEMENT; ?> <?php } ?> <?php echo tep_draw_checkbox_field('agree','true'); ?> <!-- Must agree to terms - End //--> <div class="contentText"> <div style="float: left; width: 60%; padding-top: 5px; padding-left: 15%;"> <div id="coProgressBar" style="height: 5px;"></div> <table border="0" width="100%" cellspacing="0" cellpadding="2"> <tr> <td align="center" width="33%" class="checkoutBarFrom"><?php echo '<a href="' . tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL') . '" class="checkoutBarFrom">' . CHECKOUT_BAR_DELIVERY . '</a>'; ?></td> <td align="center" width="33%" class="checkoutBarCurrent"><?php echo CHECKOUT_BAR_PAYMENT; ?></td> <td align="center" width="33%" class="checkoutBarTo"><?php echo CHECKOUT_BAR_CONFIRMATION; ?></td> </tr> </table> </div> <div style="float: right;"><?php echo tep_draw_button(IMAGE_BUTTON_CONTINUE, 'triangle-1-e', null, 'primary'); ?></div> </div> </div> <script type="text/javascript"> $('#coProgressBar').progressbar({ value: 66 }); </script> </form> <?php require(DIR_WS_INCLUDES . 'template_bottom.php'); require(DIR_WS_INCLUDES . 'application_bottom.php'); ?> This works fine, in line with my requirements (see post #1). However, a new issue emerged related to some (not all) $HTTP_POST_VARS (or $_POST) data. For the Must agree to terms contribution (http://addons.oscommerce.com/info/574) I use in my shop, the customer is required to fill in: <?php echo tep_draw_checkbox_field('agree','true'); ?> At the start of checkout_confirmation.php the value of the field agree (true/false) is needed to perform a check to (dis)allow the customer to continue: // Must agree to terms - Start if ($HTTP_POST_VARS['agree'] != 'true') { tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, tep_redirect(tep_href_link(FILENAME_CHECKOUT_FAIL)), 'SSL')); } // Must agree to terms - End However, in checkout_confirmation.php $HTTP_POST_VARS['agree'] (or $_POST['agree']) turns up empty! On the contrary, in checkout_payment.php $HTTP_POST_VARS['agree'] renders true, as expected (see my testing code). The same goes for the new drop down menu rendered by my payment module (field sisow_bank). Any ideas why these (new) fields drop their values when I go from checkout_payment.php to checkout_confirmation.php? Kind regards, Dennis
  10. dennish

    Contribution Tracker

    To comply with osC 2.3.3.2 and higher in catalog/contrib_tracker.php (around line 209) replace: if (mysql_affected_rows()) { By: if (mysqli_affected_rows(tep_db_connect())) {
  11. dennish

    Country-State Selector

    Some further digging into ajax.js.php revealed where I made my 2 mistakes. I omitted (assuming it was "extra"): <div id="indicator"><?php echo tep_image(DIR_WS_IMAGES . 'indicator.gif'); ?></div> I also stripped the following <div> tags from: <div id="states"> <?php // +Country-State Selector echo ajax_get_zones_html($country,'',false); // -Country-State Selector ?> </div> Both were in retrospect essential for the script to function. After I put them back into my code the script updated the dropdown list just fine. Kind regards, Dennis
  12. dennish

    Country-State Selector

    Hello, I've implemented the contribution from v1.5.6 (NimaP, 13/06/2013). My osC version is 2.3.3.4. My state dropdown list doesn't update when I select another country (which of course does have states). The Firefox browser indicates a javascript error: TypeError: getObject(...) is null Unfortunately, I can only trace that back to ajax.js.php Can anyone give me a clue what's causing this problem (or even suggest a solution)? Kind regards, Dennis
  13. dennish

    Contribution: Auto Backup Database

    Hello, I switched from Auto mysql backup (http://addons.oscommerce.com/info/3100) to Auto Backup Database to benefit from the automated e-mail function. Now I have two questions: Can I use the automated e-mails if I don't have a cron job installed to generate database backups (unfortunately, my hosting provider doesn't offer cron jobs)? Do I need an e-mail account from my own hosting provider or can I use any account to send these e-mails (again, my hosting provider doesn't offer SMTP for the accounts related to my domain)? Kind regards, Dennis
  14. dennish

    Contribution Tracker

    Just a small correction on post #258: The replacement code in catalog/admin/magpierss/rss_parse.inc for PHP 5.3 or higher compliance should be: // PHP 5.3 compliance - Start // list($ns, $el) = split( ':', $element, 2); list($ns, $el) = preg_split ( '/:/', $element, 2); // PHP 5.3 compliance - End This should take care of any Warning: preg_split() [function.preg-split]: No ending delimiter ':' found
  15. dennish

    E.U. VAT Intracom Number

    Hello Heather, The server my osC runs on has trouble to process the file_get_contents request (which might be due to the API of the VIES service not being fully functional with IPv6. Same holds for the SOAP version). My hosting provider suggested a workaround with curl (which I tested and works perfectly): function tep_verif_tva($num_tva){ $prefix = substr($num_tva, 0, 2); if (array_search($prefix, tep_get_tva_intracom_array() ) === false) { return 'false'; } $tva = substr($num_tva, 2); // $monfd = file_get_contents('http://ec.europa.eu/taxation_customs/vies/viesquer.do?ms=' . $prefix . '&iso='.$prefix.'&vat=' . $tva, r); $url = 'http://ec.europa.eu/taxation_customs/vies/viesquer.do?ms=' . $prefix . '&iso='.$prefix.'&vat=' . $tva; $ch = curl_init(); $timeout = 5; curl_setopt($ch, CURLOPT_URL,$url); curl_setopt($ch,CURLOPT_RETURNTRANSFER,1); curl_setopt($ch,CURLOPT_IPRESOLVE,CURL_IPRESOLVE_V4); curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,$timeout); $monfd = curl_exec($ch); // PHP 5.3+ compliance - Start // if ( eregi("invalid VAT number", $monfd) ) { // return 'false'; // } elseif ( eregi("valid VAT number", $monfd) ){ if ( preg_match("/invalid VAT number/i", $monfd) ) { return 'false'; } elseif ( preg_match("/valid VAT number/i", $monfd) ){ // PHP 5.3+ compliance - End return 'true'; } else { $myVerif = 'no_verif'; } return $myVerif; curl_close($ch); } Hope this helps you too. Kind regards, Dennis
  16. dennish

    Contribution Tracker

    Happy to report back to the list with a solution to the issue raised in post # 257 To solve the issue with the BE menu and the parse_xml function I searched the web and found another solution to turn the RSS feed into an array the Contribution Tracker can work with: MagpieRSS: RSS for PHP. You can download the necessary scripts at http://magpierss.sourceforge.net/ (just look for download. I used version 0.72). Copy the included 4 files (rss_fetch.inc, rss_parser.inc, rss_cache.inc, and rss_utils.inc) and the directory extlib into a new directory called magpierss in your osC admin directory. Add a new directory cache to the magpierss directory and set the permissions to 744 (you can do all this with your FTP software for uploading files). As a final step replace the file catalog/admin/contrib_tracker.php by the code listed below. <?php /* $Id: contrib_tracker.php,v 1.7.17 2009/09/05 15:57:07 stevedallas Exp $ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com 05 Sep 2009 GCH 1.7.17 Complete rewrite of RDF file handling. No longer requires or creates a cache file Complete rewrite of XML parsing - no longer uses rdf_class.php 28 Nov 2008 GCH 1.7.14 Several bug fixes in insert routine for correct processing of non-osCommerce support site contributions date added can now be edited clears sID on page change 26 Nov 2008 lildog 1.7.13 When adding a new contrib date added and last official update were getting mixed up changed a couple of variables so they are more obvious 08 Nov 2008 GCH 1.7.12 Quick Add now searches for a support topic and inserts it into the database Insert now adds support topic if user didn't provide one and one exists in the contribution description Quick Add and Insert no longer add duplicate records toggleDivBlock() now uses the code from osC 2.2RC2a Extensive use of tep_get_all_get_params() to preserve parameters - no longer loses sort order on updates Fixed two minor HTML errors that occurred with empty searches and an empty contrib_tracker table Clicking anywhere on a row in the table of contributions will select it Fixed the operation of the manual check button (manualcheckall worked; manualcheck didn't) 08 Nov 2008 lildog 1.7.11 realigned buttons in insert contribution page 07 Nov 2008 lildog 1.7.10 My sql needed quotes around 'LAST_CONFIG_CHECK' from version 1.7.8. 07 Nov 2008 lildog 1.7.9 Fixed Insert so it works with contributions with apostrophes in their titles 28 Oct 2008 GCH 1.7.8 Changed config update to use key LAST_CONFIG_CHECK instead of raw configuration_id, which is installation dependent Rebuilt all tables to ensure correct HTML structure Re-created missing Javascript function toggleDivBlock() to make "info" links work in editor Modified logic to suppress search, quick add, and last update boxes in edit and preview modes Escaped a ton of ampersands to "&" for HTML 4.01 Transitional DTD conformance (Note that some modes still generate non-conforming HTML due to minor bugs in osC functions tep_draw_form() and tep_draw_textarea_field() ) Simplified status icon display code Copyright (c) 2003 osCommerce Released under the GNU General Public License _________________________________________________________________ Contribution Tracker MODULE for osC Admin By Admin of www.silvermoon-jewelry.com Based on: Admin_notes: Original Code By: Robert Hellemans of www.RuddlesMills.com RSS News for OSC These are LIVE SHOPS - So please, no TEST accounts etc... We will report you to your ISP if you abuse our websites! ##### make a function to display month's english and vise versa. #### */ require('includes/application_top.php'); require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_CONTRIB_TRACKER); require(DIR_WS_FUNCTIONS . 'contrib_tracker.php'); $xmlURL='http://feedproxy.feedburner.com/osCommerce_Contributions'; $addonsURL='http://addons.oscommerce.com/'; $contribsURL='http://addons.oscommerce.com/info/'; $contrib_supportURL='http://www.oscommerce.com/forums/index.php?showtopic='; $addonsRDFURL='http://www.oscommerce.com/oscommerce_contributions.rdf'; $format = '%Y-%m-%d %H:%M:%S'; //rss file path // THIS GETS THE FEED AND PARSES IT require_once('magpierss/rss_fetch.inc'); $url = $xmlURL; $rss = fetch_rss($url); foreach ($rss->items as $item) { $thelink = $item['link']; $thetitle = $item['title']; $osc_rss_pubdate_raw = $item['pubdate']; $osc_rss_pubdate = strtotime($osc_rss_pubdate_raw); $osc_rss_pubdate = strftime ($format, $osc_rss_pubdate); // add backslashes to characters that need escaping $thetitle=addslashes($thetitle); // UPDATE THE CONTRIBUTIONS THAT ARE IN THE RSS FILE tep_db_query("UPDATE " . TABLE_CONTRIB_TRACKER . " SET status ='0', contr_last_modified = '" . $osc_rss_pubdate . "' where contrib_name = '" . $thetitle . "' and last_update < '" . $osc_rss_pubdate . "'"); } switch ($HTTP_GET_VARS['action']) { case 'setflag': tep_set_contrib_query_status($HTTP_GET_VARS['id'], $HTTP_GET_VARS['flag'], $HTTP_GET_VARS['contr_last_modified']); tep_redirect(tep_href_link(FILENAME_CONTRIB_TRACKER, tep_get_all_get_params(array('flag', 'action', 'id', 'contr_last_modified')))); break; case 'updatecheck': $contrib_query = "update " . TABLE_CONFIGURATION . " set configuration_value = '" . $HTTP_POST_VARS['lastcheck'] . "', last_modified = now() where configuration_key = 'LAST_CONFIG_CHECK'"; if (tep_db_query($contrib_query)){ $messageStack->add_session(MESSAGE_UPDATECHECK_SUCCESS, 'success'); }else{ $messageStack->add_session(MESSAGE_UPDATECHECK_ERROR, 'error'); } tep_redirect(tep_href_link(FILENAME_CONTRIB_TRACKER, (array('action')))); break; case 'insert': if ($HTTP_POST_VARS['today_date']){ $date_updated =date("Y-m-d H:M:S"); }else{ $date_updated=strtotime($HTTP_POST_VARS['last_update']); $date_updated=strftime ($format, $date_updated); } if ($HTTP_POST_VARS['today_date2']){ $date_added =date("Y-m-d H:M:S"); }else{ $date_added=strtotime($HTTP_POST_VARS['note_created']); $date_added=strftime ($format, $date_added); } $new_contrib_id=$HTTP_POST_VARS['contrib_id_new']; $contrib_name=stripslashes($HTTP_POST_VARS['contrib_name_new']); $contrib_link=old_to_new_url($HTTP_POST_VARS['contrib_link_new']); if ($contrib_link == '') { $contrib_link = $contribsURL . $new_contrib_id; } //check whether contrib is already in database if ($HTTP_POST_VARS['contrib_id_new'] !=='') { $contrib_raw = "select contrib_osc_id from " . TABLE_CONTRIB_TRACKER . " where contrib_osc_id = " . $HTTP_POST_VARS['contrib_id_new']; $contrib_query = tep_db_query($contrib_raw); $record_found = (tep_db_num_rows($contrib_query) !== 0); } else { $record_found = false; } if (!$record_found){ //if the id is empty get it $new_contrib_id=get_contrib_id($contrib_link,$new_contrib_id); //get contribs info from it's URL if(!empty($new_contrib_id)){ contrib_check($new_contrib_id); } //set flag to red if need be if (strtotime($date_updated) < strtotime($last_osc_update)){ $status='0'; } else { $status='1'; } //Add support link if user didn't provide one and one exists in the contrib info if ($HTTP_POST_VARS['contrib_link_support'] !='') { $contrib_support_link = $HTTP_POST_VARS['contrib_link_support']; } elseif ($contrib_support_topic) { $contrib_support_link = $contrib_supportURL . $contrib_support_topic; } else { $contrib_support_link = ''; } $contrib_query = "insert into " . TABLE_CONTRIB_TRACKER . " (contr_id, contrib_osc_id, contrib_name, contrib_link, contrib_support, config_comments, note_created, contr_last_modified, status, last_update, contrib_vers) values ('','" . $HTTP_POST_VARS['contrib_id_new'] . "','" . addslashes($contrib_name) . "','" . $contrib_link . "','" . $contrib_support_link . "','" . $HTTP_POST_VARS['config_comments'] . "', '" . $date_added . "', '" . $last_osc_update . "', '" . $status . "', '" . $date_updated . "', '" . $HTTP_POST_VARS['contrib_vers'] . "' )"; if ( tep_db_query($contrib_query) ){ $messageStack->add_session(MESSAGE_INSERT_SUCCESS, 'success'); } else { $messageStack->add_session(MESSAGE_INSERT_ERROR, 'error'); } } else { $messageStack->add_session(MESSAGE_INSERT_DUPLICATE, 'error'); } tep_redirect(tep_href_link(FILENAME_CONTRIB_TRACKER, tep_get_all_get_params(array('action')))); break; case 'update': if (($old_status!=='1' && $status=='1') || ($HTTP_POST_VARS['today_date'])){ $last_update=date("Y-m-d H:M:S"); }else{ $last_update=$HTTP_POST_VARS['last_update']; } //Get the creation date $note_created=$HTTP_POST_VARS['note_created']; //convert old links to new ones $link=old_to_new_url($HTTP_POST_VARS['contrib_link_new']); $new_contrib_id=$HTTP_POST_VARS['contrib_id_new']; $contrib_name=$HTTP_POST_VARS['contrib_name_new']; //if the id is empty get it $new_contrib_id=get_contrib_id($link,$new_contrib_id); //if the name is empty get it if (empty($contrib_name) && !empty($new_contrib_id)){ contrib_check($new_contrib_id); }else{ $contrib_name=$HTTP_POST_VARS['contrib_name_new']; } //tep_db_query("update " .TABLE_CONTRIB_TRACKER . " set contr_last_modified = now(), status = '" . $HTTP_POST_VARS['status'] . "', contrib_osc_id = '" . $new_contrib_id . "',contrib_name = '" . $contrib_name . "', contrib_link = '" . $HTTP_POST_VARS['contrib_link_new'] . "', config_comments = '" . $HTTP_POST_VARS['config_comments'] . "', last_update = '" .$last_update. "', contrib_vers= '" . $HTTP_POST_VARS['contrib_vers'] . "' where contr_id = '" . $HTTP_POST_VARS['contr_id'] . "'"); $contrib_query = "update " .TABLE_CONTRIB_TRACKER . " set contr_last_modified = now(), status = '" . $HTTP_POST_VARS['status'] . "', contrib_osc_id = '" . $new_contrib_id . "',contrib_name = '" . $contrib_name . "', contrib_link = '" . $link . "', contrib_support = '" . $HTTP_POST_VARS['contrib_link_support'] . "', config_comments = '" . $HTTP_POST_VARS['config_comments'] . "', last_update = '" . $last_update . "', note_created = '" . $note_created . "', contrib_vers= '" . $HTTP_POST_VARS['contrib_vers'] . "' where contr_id = '" . $HTTP_POST_VARS['contr_id'] . "'"; if ( tep_db_query($contrib_query) ){ $messageStack->add_session(MESSAGE_UPDATE_SUCCESS, 'success'); }else{ $messageStack->add_session(MESSAGE_UPDATE_SUCCESS, 'error'); } tep_redirect(tep_href_link(FILENAME_CONTRIB_TRACKER, tep_get_all_get_params(array('action', 'sID')) . 'sID=' . $contr_id)); break; case 'deleteconfirm': $contr_id = tep_db_prepare_input($HTTP_GET_VARS['sID']); // tep_db_query("delete from " . TABLE_CONTRIB_TRACKER. " where contr_id = '" . tep_db_input($contr_id) . "'"); $contrib_query = "delete from " . TABLE_CONTRIB_TRACKER. " where contr_id = '" . tep_db_input($contr_id) . "'"; if ( tep_db_query($contrib_query) ){ $messageStack->add_session(MESSAGE_DELETE_SUCCESS, 'success'); }else{ $messageStack->add_session(MESSAGE_DELETE_ERROR, 'error'); } tep_redirect(tep_href_link(FILENAME_CONTRIB_TRACKER, tep_get_all_get_params(array('action', 'sID')))); break; case 'manualcheck': contrib_check($HTTP_GET_VARS['oscID']); //if the date is newer then update the contrib database entry $update_query="UPDATE " . TABLE_CONTRIB_TRACKER . " SET status ='0', contr_last_modified = '" . $last_osc_update . "' WHERE contrib_osc_id = '" . $HTTP_GET_VARS['oscID'] . "' and last_update < '" . $last_osc_update . "'"; if ( tep_db_query($update_query) ){ $messageStack->add_session(MESSAGE_UPDATE_SUCCESS, 'success'); }else{ $messageStack->add_session(MESSAGE_UPDATE_ERROR, 'error'); } tep_redirect(tep_href_link(FILENAME_CONTRIB_TRACKER, tep_get_all_get_params(array('action', 'oscID', 'contr_last_modified', 'lastupdate')))); break; case 'quick_insert': if (is_numeric($HTTP_POST_VARS['contrib_quick_insert'])){ $date_updated =date("Y-m-d H:M:S"); $date_added =date("Y-m-d H:M:S"); $new_contrib_id=$HTTP_POST_VARS['contrib_quick_insert']; $new_contrib_id = substr($HTTP_POST_VARS['contrib_quick_insert'] , strrpos($HTTP_POST_VARS['contrib_link_new'] , '/') +1); //check whether contrib is already in database $contrib_raw = "select contrib_osc_id from " . TABLE_CONTRIB_TRACKER . " where contrib_osc_id = " . $HTTP_POST_VARS['contrib_quick_insert']; $contrib_query = tep_db_query($contrib_raw); if (tep_db_num_rows($contrib_query) == 0){ //the get contrib info contrib_check($HTTP_POST_VARS['contrib_quick_insert']); $newvers=''; //set flag to green $status='1'; if ($contrib_support_topic) { $contrib_support_link = $contrib_supportURL . $contrib_support_topic; } else { $contrib_support_link = ''; } $contrib_query = "insert into " . TABLE_CONTRIB_TRACKER . " (contr_id, contrib_osc_id, contrib_name, contrib_link, contrib_support, config_comments, note_created, contr_last_modified, status, last_update, contrib_vers) values ('','" . $HTTP_POST_VARS['contrib_quick_insert'] . "','" . addslashes($contrib_name) . "','" . $contribsURL . $HTTP_POST_VARS['contrib_quick_insert'] . "','" . $contrib_support_link . "','" . '' . "', '" . $date_added . "', '".$last_osc_update."', '".$status."', '" . $date_updated . "', '" . $newvers . "' )"; if ( tep_db_query($contrib_query) ){ $messageStack->add_session(MESSAGE_INSERT_SUCCESS, 'success'); } else { $messageStack->add_session(MESSAGE_INSERT_ERROR, 'error'); } } else { $messageStack->add_session(MESSAGE_INSERT_DUPLICATE, 'error'); } tep_redirect(tep_href_link(FILENAME_CONTRIB_TRACKER, tep_get_all_get_params(array('action')))); } break; case 'manualcheckall': //$admin_query_query_raw = "select contr_id, contrib_osc_id, contrib_name, contrib_link, contrib_support, status, note_created , contr_last_modified, last_update,config_comments, contrib_vers from " . TABLE_CONTRIB_TRACKER . " order by contrib_name "; $manualcheckall_raw = "select contr_id, contrib_osc_id, contrib_name, status, note_created , contr_last_modified, last_update from " . TABLE_CONTRIB_TRACKER . " order by contrib_name "; $manualcheckall_query = tep_db_query($manualcheckall_raw); if (tep_db_num_rows($manualcheckall_query) == 0){ $messageStack->add_session(MESSAGE_MANUALALL_NONE_ERROR, 'error'); }else{ while ($admin_quer = tep_db_fetch_array($manualcheckall_query)) { $sInfo_array = array_merge($admin_quer); /*print_r($sInfo_array[contrib_osc_id]); echo '<br />';*/ $contrib_osc_id=$sInfo_array[contrib_osc_id]; contrib_check($contrib_osc_id); //if the date is newer then update the contrib database entry $update_query="UPDATE " . TABLE_CONTRIB_TRACKER . " SET status ='0', contr_last_modified = '" . $last_osc_update . "' WHERE contrib_osc_id = '" . $contrib_osc_id . "' and last_update < '" . $last_osc_update . "'"; if ( !tep_db_query($update_query) ){ //$messageStack->add_session(MESSAGE_MANUALALL_SUCCESS, 'success'); //}else{ $messageStack->add_session(MESSAGE_MANUALALL_ERROR.$sInfo_array[contrib_name], 'error'); } } } tep_redirect(tep_href_link(FILENAME_CONTRIB_TRACKER, tep_get_all_get_params(array('action')))); break; } require(DIR_WS_INCLUDES . 'template_top.php'); ?> <!-- <script language="javascript" type="text/javascript"> function toggleDivBlock(id) { if (document.getElementById) { itm = document.getElementById(id); } else if (document.all){ itm = document.all[id]; } else if (document.layers){ itm = document.layers[id]; } if (itm) { if (itm.style.display != "none") { itm.style.display = "none"; } else { itm.style.display = "block"; } } } </script> --> <?php // set sub title if ( $HTTP_GET_VARS['action'] == 'readonly') $HEADING_SUB_TITLE = HEADING_SUB_TITLE_READONLY; if ( $HTTP_GET_VARS['action'] == 'delete') $HEADING_SUB_TITLE = HEADING_SUB_TITLE_DELETE; if ( $HTTP_GET_VARS['action'] == 'update') $HEADING_SUB_TITLE = HEADING_SUB_TITLE_EDIT; if ( $HTTP_GET_VARS['action'] == 'edit') $HEADING_SUB_TITLE = HEADING_SUB_TITLE_EDIT; if ( $HTTP_GET_VARS['action'] == 'new') $HEADING_SUB_TITLE = HEADING_SUB_TITLE_INSERT; if ( $HTTP_GET_VARS['action'] == 'setflag') $HEADING_SUB_TITLE = HEADING_SUB_TITLE_SETFLAG; if ( $HTTP_GET_VARS['action'] == '') $HEADING_SUB_TITLE = HEADING_SUB_TITLE; ?> <table border="0" width="100%" cellspacing="0" cellpadding="2"> <td width="100%" valign="top"> <table border="0" width="100%" cellspacing="0" cellpadding="0"> <tr> <td class="pageHeading"><?php echo HEADING_TITLE; ?> <?php echo '<a href="'.$addonsURL.'" target="_blank">' . tep_image(DIR_WS_IMAGES . 'html_badge.gif', HEADING_CONTRIB_HTML_SUPPORT_SITE, '80', '15') . '</a> <a href="'. $addonsURL .'" target="_blank">' . tep_image(DIR_WS_IMAGES . 'rss_badge.gif', HEADING_CONTRIB_RSS_SUPPORT_SITE, '80', '15') . '</a>'; ?> <br /><font class="smallText"><?php echo $HEADING_SUB_TITLE; ?></font> </td> <td class="pageHeading" align="right"><?php echo tep_draw_separator('pixel_trans.gif', 10, 1); ?></td> <?php if ($HTTP_GET_VARS['action'] != 'new' && $HTTP_GET_VARS['action'] != 'edit' && $HTTP_GET_VARS['action'] != 'readonly') { if (htmlspecialchars(StripSlashes(@$HTTP_GET_VARS["search"])) == ''){ $searchquery = ''; } else { $searchquery = htmlspecialchars(StripSlashes(@$HTTP_GET_VARS["search"])) ; } ?> <td align="right"> <table border="0" width="100%" cellspacing="0" cellpadding="1"> <tr> <td class="smallText" align="right"> <?php echo tep_draw_form('search', FILENAME_CONTRIB_TRACKER, tep_get_all_get_params(array('action')), 'get'); echo HEADING_TITLE_CONTRIBSEARCH . ' ' . tep_draw_input_field('search', $searchquery, "onFocus=\"if (this.value == 'enter search query') { this.value='' }\""); ?> </form> </td> </tr> <tr> <td class="smallText" align="right"> <?php echo tep_draw_form('quick_insert', FILENAME_CONTRIB_TRACKER, 'action=quick_insert', 'post'); echo TEXT_QUICKOSC_ID .' '. TEXT_ID_QUICK_NEW . ' ' . tep_draw_input_field('contrib_quick_insert', '', "onFocus=\"if (this.value == 'enter contrib ID') { this.value='' }\""); ?> </form> </td> </tr> <tr> <?php if ($HTTP_GET_VARS['action']== 'editlastcheck') { ?> <!-- SHOW THE TITLE AND A FIELD TO ENTER A NEW DATE --> <td class="smallText" align="right"> <?php echo tep_draw_form('lastcheck', FILENAME_CONTRIB_TRACKER,'action=updatecheck&id=' . $admin_quer['contr_id'] . '&page=' . $HTTP_GET_VARS['page'] . '&sID=' . $HTTP_GET_VARS['sID'], 'post'); echo HEADING_LAST_CHECK . ' ' . tep_draw_input_field('lastcheck', LAST_CONFIG_CHECK); ?> </form> </td> <?php } else { ?> <!-- // JUST SHOW THE TITLE AND DATE FOR LAST MANUAL UPDATE AS A LINK --> <td class="smallText" align="right"> <?php echo ' <a href="' . tep_href_link(FILENAME_CONTRIB_TRACKER, tep_get_all_get_params(array('action', 'id')) . 'action=editlastcheck&id=' . $admin_quer['contr_id'], 'NONSSL') . '">'.HEADING_LAST_CHECK.' '.LAST_CONFIG_CHECK .'</a>'; ?> </td> <?php } ?> </tr> </table> </td> <?php } ?> </tr> <?php if ( ($HTTP_GET_VARS['action'] == 'new') || ($HTTP_GET_VARS['action'] == 'edit') ) { if ($HTTP_GET_VARS['action'] == 'new'){ $form_action = 'insert'; }else if ($HTTP_GET_VARS['action'] == 'edit'){ $form_action = 'update'; } // UPDATE A CONTRIBUTION ENTRY if ( ($HTTP_GET_VARS['action'] == 'edit') && ($HTTP_GET_VARS['sID']) ) { $product_query = tep_db_query("select contr_id, contrib_osc_id, contrib_name, contrib_link, contrib_support, status, config_comments, last_update, note_created,contrib_vers from " . TABLE_CONTRIB_TRACKER . " where contr_id = '" . $HTTP_GET_VARS['sID'] . "'"); $product = tep_db_fetch_array($product_query); $sInfo = new objectInfo($product); } else { $sInfo = new objectInfo(array()); $contr_array = array(); } ?> <tr> <td> <form name="new_contr" <?php echo 'action="' . tep_href_link(FILENAME_CONTRIB_TRACKER, tep_get_all_get_params(array('action', 'info', 'sID')) . 'action=' . $form_action, 'NONSSL') . '"'; ?> method="post"><?php if ($form_action == 'update') echo tep_draw_hidden_field('contr_id', $HTTP_GET_VARS['sID']) ; ?> <br /> <table border="0" cellspacing="0" cellpadding="2"> <?php if ($HTTP_GET_VARS['action'] == 'new'){ ?> <tr class="dataTableRow"> <td class="dataTableContent"><?php echo TEXT_OSC_ID; ?></td> <td class="dataTableContent"><?php echo tep_draw_input_field('contrib_id_new', $sInfo-> contrib_osc_id, 'size=10 maxlength=10').' '. TEXT_ID_NOTE_NEW; ?></td> </tr> <?php }else if ($HTTP_GET_VARS['action'] == 'edit'){ ?> <tr class="dataTableRow"> <td class="dataTableContent"><?php echo TEXT_OSC_ID; ?> <?php echo tep_draw_hidden_field('contrib_id_new', $sInfo-> contrib_osc_id);?></td> <td class="dataTableContent"><?php echo $sInfo-> contrib_osc_id; ?></td> </tr> <?php } ?> <tr class="dataTableRow"> <td class="dataTableContent"><?php echo TEXT_NAME_VERSION; ?></td> <td class="dataTableContent"><?php echo tep_draw_input_field('contrib_name_new', $sInfo-> contrib_name, 'size=50 maxlength=255').' '. TEXT_NAME_NOTE_NEW; ?></td> </tr> <tr class="dataTableRow"> <td class="dataTableContent"><?php echo TEXT_INFO_HTML; ?></td> <td class="dataTableContent"><?php echo tep_draw_input_field('contrib_link_new', $sInfo-> contrib_link, 'size=50 maxlength=255').' '.TEXT_OSC_URL; ?></td> </tr> <tr class="dataTableRow"> <td class="dataTableContent"><?php echo TEXT_INFO_SUPPORT; ?></td> <td class="dataTableContent"><?php echo tep_draw_input_field('contrib_link_support', $sInfo-> contrib_support, 'size=50 maxlength=255').' '.TEXT_OSC_SUPPORT; ?></td> </tr> <!-- // insert version number field --> <tr class="dataTableRow"> <td class="dataTableContent"><?php echo TEXT_VERSION_NUMBER; ?> </td> <td class="dataTableContent"><?php echo tep_draw_input_field('contrib_vers', $sInfo->contrib_vers, 'size=50 maxlength=30').' '. TEXT_VERSION_NOTE_NEW; ?></td> </tr> <tr class="dataTableRow"> <td class="dataTableContent"><?php echo TEXT_INFO_TO_REMEMBER; ?> </td> <td class="dataTableContent"><?php echo tep_draw_input_field('last_update',$sInfo->last_update, 'size=50 maxlength=30'). ' '. tep_draw_checkbox_field('today_date', $today_date,'',''). ' '. TEXT_TODAY_DATE.' '. TEXT_INT_DATE_NEW; ?></td> </tr> <tr class="dataTableRow"> <td class="dataTableContent"><?php echo TEXT_INFO_DATE_ADDED; ?> </td> <td class="dataTableContent"><?php echo tep_draw_input_field('note_created',$sInfo->note_created, 'size=50 maxlength=30'). ' '. tep_draw_checkbox_field('today_date2', $today_date,'',''). ' '. TEXT_TODAY_DATE.' '. TEXT_ADD_DATE_NEW; ?></td> </tr> <tr class="dataTableRow"> <td valign="top" class="dataTableContent"><?php echo TEXT_CONFIG_COMMENTS; ?> </TD> <td class="dataTableContent"><?php echo tep_draw_textarea_field('config_comments', 'soft', '70', '15', ($sInfo->config_comments)) ; ?></td> </tr> <?php if ( $HTTP_GET_VARS['action'] == 'edit') { ?> <tr class="dataTableRow"> <td class="dataTableContent"><?php echo TEXT_CONFIG_STATUS; ?> </td> <td class="dataTableContent"><?php echo tep_draw_input_field('status', $sInfo->status, 'size=2 maxlength=1'); ?> 0 = <?php echo tep_image(DIR_WS_IMAGES . 'icon_status_red.gif', TEXT_NEW_UPDATE_EXISTS , 10, 10); ?> <?php echo TEXT_NEW_UPDATE_EXISTS; ?> 1 = <?php echo tep_image(DIR_WS_IMAGES . 'icon_status_green.gif', TEXT_NO_NEW_UPDATE , 10, 10); ?> <?php echo TEXT_NO_NEW_UPDATE; ?> 2 = <?php echo TEXT_NO_STATUS; ?> <td><?php echo tep_draw_hidden_field('old_status', $sInfo->status);?></td> </tr> <?php } ?> </table> <table border="0" width="100%" cellspacing="0" cellpadding="2"> <tr> <td class="main" colspan=2 align="right" valign="top"><br /><?php echo (($form_action == 'insert') ? tep_image_submit('button_insert.gif', IMAGE_INSERT) : tep_image_submit('button_update.gif', IMAGE_UPDATE)) . ' <a href="' . tep_href_link(FILENAME_CONTRIB_TRACKER, tep_get_all_get_params(array('action'))). '">' . tep_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a> <a href="' . tep_href_link(FILENAME_CONTRIB_TRACKER, tep_get_all_get_params()) . '" onclick="reset();">' . tep_image_button('button_reset.gif', IMAGE_RESET) . '</a>'; ?></td> </table> </form> </td> </tr> <?php } elseif ($HTTP_GET_VARS['action'] != 'readonly') { ?> <tr> <td colspan=3> <table border="0" width="100%" cellspacing="0" cellpadding="0"> <tr> <!-- TABLE HEADINGS AND SORT ICONS--> <td valign="top"> <table border="0" width="100%" cellspacing="0" cellpadding="2"> <tr class="dataTableHeadingRow"> <td class="dataTableHeadingContent"> <a href="<?php echo "$PHP_SELF?sort=2a" . "&page=" . $HTTP_GET_VARS['page'] . "&sID=" . $HTTP_GET_VARS['sID']; ?>"><?php echo tep_image(DIR_WS_IMAGES . 'icon_up.gif', IMAGE_BUTTON_UPSORT); ?></a><a href="<?php echo "$PHP_SELF?sort=2d" . "&page=" . $HTTP_GET_VARS['page'] . "&sID=" . $HTTP_GET_VARS['sID']; ?>"><?php echo tep_image(DIR_WS_IMAGES . 'icon_down.gif', IMAGE_BUTTON_DOWNSORT); ?></a><br /><?php echo TABLE_HEADING_NAME; ?></td> <td class="dataTableHeadingContent" align="center"><br /><?php echo TABLE_HEADING_VERSION; ?> </td><td class="dataTableHeadingContent" align="center"><a href="<?php echo "$PHP_SELF?sort=4a" . "&page=" . $HTTP_GET_VARS['page'] . "&sID=" . $HTTP_GET_VARS['sID']; ?>"><?php echo tep_image(DIR_WS_IMAGES . 'icon_up.gif', IMAGE_BUTTON_UPSORT); ?></a><a href="<?php echo "$PHP_SELF?sort=4d" . "&page=" . $HTTP_GET_VARS['page'] . "&sID=" . $HTTP_GET_VARS['sID']; ?>"><?php echo tep_image(DIR_WS_IMAGES . 'icon_down.gif', IMAGE_BUTTON_DOWNSORT); ?></a> <br /><?php echo TABLE_HEADING_STATUS; ?></td> <td class="dataTableHeadingContent" align="right"><br /><?php echo TABLE_HEADING_ACTION; ?> </td> </tr> <?php switch ($sort) { case "2a": $order_it_by = "contrib_name, status "; break; case "2d": $order_it_by = "contrib_name DESC, status "; break; case "4a": $order_it_by = "status, contrib_name"; break; case "4d": $order_it_by = "status DESC, contrib_name"; break; case "5a": $order_it_by = "last_update, contrib_name"; break; case "5d": $order_it_by = "last_update DESC, contrib_name"; break; default: $order_it_by = "status, contrib_name"; } // IF THIS IS A SEARCH GET THE SEARCH RESULTS FROM THE DB if ($HTTP_GET_VARS['search']) { //contrib_support->'" . $HTTP_POST_VARS['contrib_link_support'] . "', $admin_query_query_raw = "select contr_id, contrib_osc_id, contrib_name, contrib_link, contrib_support, status, note_created , contr_last_modified, last_update,config_comments, contrib_vers from " . TABLE_CONTRIB_TRACKER . " where contrib_name like '%" . $HTTP_GET_VARS['search'] . "%' order by " . $order_it_by . " "; $admin_query_split = new splitPageResults($HTTP_GET_VARS['page'], MAX_DISPLAY_SEARCH_RESULTS, $admin_query_query_raw, $admin_query_query_numrows); $admin_query_query = tep_db_query($admin_query_query_raw); if (tep_db_num_rows($admin_query_query) == 0) echo '<tr><td class="dataTableContent" align="left">' . TEXT_NO_DATA . "</td></tr>\n"; } else { // IF THIS IS NOT A SEARCH SO GET ALL THE DATABASE ENTRIES $admin_query_query_raw = "select contr_id, contrib_osc_id, contrib_name, contrib_link, contrib_support, status, note_created , contr_last_modified, last_update,config_comments, contrib_vers from " . TABLE_CONTRIB_TRACKER . " order by " . $order_it_by . " "; $admin_query_split = new splitPageResults($HTTP_GET_VARS['page'], MAX_DISPLAY_SEARCH_RESULTS, $admin_query_query_raw, $admin_query_query_numrows); $admin_query_query = tep_db_query($admin_query_query_raw); if (tep_db_num_rows($admin_query_query) == 0) echo '<tr><td class="dataTableContent" align="right">' . TEXT_EMPTY_DATABASE . "</td></tr>\n"; } while ($admin_quer = tep_db_fetch_array($admin_query_query)) { if ( ((!$HTTP_GET_VARS['sID']) || ($HTTP_GET_VARS['sID'] == $admin_quer['contr_id'])) && (!$sInfo) ) { $sInfo_array = array_merge($admin_quer); $sInfo = new objectInfo($sInfo_array); } if ($HTTP_GET_VARS['search'] == '') { if ( (is_object($sInfo)) && ($admin_quer['contr_id'] == $sInfo->contr_id)) { echo ' <tr id="defaultSelected" class="dataTableRowSelected" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="document.location.href=\'' . tep_href_link(FILENAME_CONTRIB_TRACKER, tep_get_all_get_params(array('sID')) . 'sID=' . $admin_quer['contr_id']) . '\'">' . "\n"; } else { echo ' <tr class="dataTableRow" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="document.location.href=\'' . tep_href_link(FILENAME_CONTRIB_TRACKER, tep_get_all_get_params(array('sID')) . 'sID=' . $admin_quer['contr_id']) . '\'">' . "\n"; } } else { $searchresult_query_query_raw = "select contr_id from " . TABLE_CONTRIB_TRACKER . " order by " . $order_it_by . " "; $searchresult_query_query = tep_db_query($searchresult_query_query_raw); $searchresult_page= round($searchresult_query_query_numrows / MAX_DISPLAY_SEARCH_RESULTS)-1; // INSERT CONTRIB NAMES INTO PAGE if ( (is_object($sInfo)) && ($admin_quer['contr_id'] == $sInfo->contr_id)) { echo ' <tr id="defaultSelected" class="dataTableRowSelected" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="document.location.href=\'' . tep_href_link(FILENAME_CONTRIB_TRACKER, tep_get_all_get_params(array('sID')) . 'sID=' . $admin_quer['contr_id']) . '\'">' . "\n"; } else { echo ' <tr class="dataTableRow" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="document.location.href=\'' . tep_href_link(FILENAME_CONTRIB_TRACKER, tep_get_all_get_params(array('sID')) . 'sID=' . $admin_quer['contr_id']) . '\'">' . "\n"; } } ?> <td class="dataTableContent"> <?php if ($admin_quer['contrib_link']){ echo '<a target="_blank" href="' . $admin_quer['contrib_link'] . '" name="' . $admin_quer['contrib_name'] . '">' . $admin_quer['contrib_name'].'</a>'; }else{ echo $admin_quer['contrib_name']; } ?> </td> <td class="dataTableContent" align="center"><?php echo $admin_quer['contrib_vers'];?></td> <td class="dataTableContent" align="center"> <?php // SHOW THE STATUS ICONS // contr_last_modified if ($admin_quer['status'] == '0') { echo tep_image(DIR_WS_IMAGES . 'icon_status_red.gif', TEXT_NEW_UPDATE_EXISTS, 10, 10) . ' '; } else { echo '<a href="' . tep_href_link(FILENAME_CONTRIB_TRACKER, tep_get_all_get_params(array('action')) . 'action=setflag&flag=0&id=' . $admin_quer['contr_id'] . '&contr_last_modified=' . $admin_quer['contr_last_modified'], 'NONSSL') . '">' . tep_image(DIR_WS_IMAGES . 'icon_status_red_light.gif', TEXT_SET_NEW_UPDATE_EXISTS, 10, 10) . '</a> '; } if ($admin_quer['status'] == '1') { echo tep_image(DIR_WS_IMAGES . 'icon_status_green.gif', TEXT_NO_NEW_UPDATE, 10, 10); } else { echo '<a href="' . tep_href_link(FILENAME_CONTRIB_TRACKER, tep_get_all_get_params(array('action')) . 'action=setflag&flag=1&id=' . $admin_quer['contr_id'] . '&contr_last_modified=' . $admin_quer['contr_last_modified'] , 'NONSSL') . '">' . tep_image(DIR_WS_IMAGES . 'icon_status_green_light.gif', TEXT_SET_NO_NEW_UPDATE, 10, 10) . '</a>'; } ?> </td> <td class="dataTableContent" align="right"> <?php // INSERT THE ACTION ICONS if ($admin_quer['contrib_support']) { echo '<a target="_blank" href="' . $admin_quer['contrib_support'] . '">' .tep_image(DIR_WS_IMAGES . 'icon_help.gif', TEXT_OSC_SUPPORT_THREAD) . '</a> '; } if ($admin_quer['contrib_osc_id']){ echo '<a href="' . tep_href_link(FILENAME_CONTRIB_TRACKER, tep_get_all_get_params(array('action')) . 'action=manualcheck&oscID=' . $admin_quer['contrib_osc_id'].'&sID=' . $admin_quer['contr_id']) . '">' .tep_image(DIR_WS_IMAGES . 'icon_manual_check.jpg', TEXT_MANUAL_CHECK) . '</a> '; } if (htmlspecialchars(StripSlashes(@$HTTP_GET_VARS["search"])) == '') { $reference = 'page'; } else { $reference = 'search'; } if ( (is_object($sInfo)) && ($admin_quer['contr_id'] == $sInfo->contr_id) ) { echo tep_image(DIR_WS_IMAGES . 'icon_arrow_right.gif', ''); } else { echo '<a href="' . tep_href_link(FILENAME_CONTRIB_TRACKER, tep_get_all_get_params(array('action', 'sID')) . 'sID=' . $admin_quer['contr_id']) . '">' .tep_image(DIR_WS_IMAGES . 'icon_info.gif', TEXT_INFO) . '</a>'; } ?> </td> </tr> <?php } ?> <tr> <td colspan="5"> <table border="0" width="100%" cellpadding="0"cellspacing="2"> <tr> <td class="smallText" valign="top"><?php echo $admin_query_split->display_count($admin_query_query_numrows, MAX_DISPLAY_SEARCH_RESULTS, $HTTP_GET_VARS['page'], TEXT_DISPLAY_NUMBER_OF_RECORDS); ?></td> <td class="smallText" align="right"><?php echo $admin_query_split->display_links($admin_query_query_numrows, MAX_DISPLAY_SEARCH_RESULTS, MAX_DISPLAY_PAGE_LINKS, $HTTP_GET_VARS['page'], 'sort=' . $HTTP_GET_VARS['sort']); ?></td> </tr> <?php if (!$HTTP_GET_VARS['action']) { ?> <tr> <td class="smallText" colspan="2" align="right"> <?php echo '<a href="' . tep_href_link(FILENAME_CONTRIB_TRACKER, tep_get_all_get_params(array('action')) . 'action=manualcheckall') . '">' . tep_image_button('button_check_all.gif', IMAGE_CHECKALL) . '</a>'; ?> <?php echo '<a href="' . tep_href_link(FILENAME_CONTRIB_TRACKER, 'action=new') . '">' . tep_image_button('button_insert.gif', IMAGE_INSERT) . '</a>'; ?> </td> </tr> <!-- // INSERT THE HELP NOTES --> <tr> <td class="smallText" colspan="2" align="left"> <?php echo '<strong>'. TEXT_HELP_NOTES_HEADER . '</strong><br /><ul>' . TEXT_HELP_NOTES . '</ul><br /><br />'; ?> </td> </tr> <tr> <!-- // INSERT NEWEST CONTRIBS FROM RSS --> <td class="smallText" colspan="2" align="left"> <strong><?php echo TEXT_CONTRIB_HEADER; ?></strong> <br /> <?php if (is_array($rss->items)) { echo "<ol>\n"; foreach ($rss->items as $item ) { $thelink = $item['link']; $thetitle = $item['title']; echo "<li><a href=\"" . $thelink . "\" target=\"_blank\">" . $thetitle . "</a></li>\n"; } echo "</ol>\n"; } else { echo "ERROR: Could not open RDF feed\n"; } ?> </td> </tr> <?php } ?> </table> </td> </tr> </table> </td> <?php $heading = array(); $contents = array(); // RIGHT COLUMN STUFF switch ($HTTP_GET_VARS['action']) { case 'delete': $heading[] = array('text' => '<center><strong>' . TEXT_INFO_HEADING_DELETE . '</strong></center>'); $contents = array('form' => tep_draw_form('install_contr_del', FILENAME_CONTRIB_TRACKER, tep_get_all_get_params(array('action')) . 'action=deleteconfirm')); $contents[] = array('text' => TEXT_INFO_DELETE_INTRO); $contents[] = array('text' => '<br /><strong>' . $sInfo-> contrib_name . '</strong>'); $contents[] = array('align' => 'center', 'text' => '<br />' . tep_image_submit('button_delete.gif', IMAGE_DELETE) . ' <a href="' . tep_href_link(FILENAME_CONTRIB_TRACKER, tep_get_all_get_params(array('action')) . 'sID=' . $sInfo->contr_id) . '">' . tep_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>'); break; default: if (is_object($sInfo)) { $heading[] = array('text' => '<center><strong>' . $sInfo->contrib_name . '</strong></center>'); $contents[] = array('align' => 'center', 'text' => '<strong>'.TEXT_VERSION_NUMBER .'</strong> '.$sInfo-> contrib_vers); // HBS - Start // $contents[] = array('text' => '<strong>' . TEXT_INFO_TO_REMEMBER . '</strong><br /> ' . $sInfo->last_update); $contents[] = array('text' => '<strong>' . TEXT_INFO_TO_REMEMBER . '</strong><br /> ' . tep_date_short($sInfo->last_update)); // $contents[] = array('text' => '<br /> <strong>' . TEXT_INFO_DATE_ADDED . '</strong><br /> ' . $sInfo->note_created); $contents[] = array('text' => '<br /> <strong>' . TEXT_INFO_DATE_ADDED . '</strong><br /> ' . tep_date_short($sInfo->note_created)); // $contents[] = array('text' => '<strong>' . TEXT_INFO_LAST_MODIFIED . '</strong><br /> ' . $sInfo->contr_last_modified . '<br /><br />'); $contents[] = array('text' => '<strong>' . TEXT_INFO_LAST_MODIFIED . '</strong><br /> ' . tep_date_short($sInfo->contr_last_modified) . '<br /><br />'); // HBS - End $contents[] = array('text' => '<strong>' .TEXT_CONFIG_COMMENTS .'</strong> '. $sInfo->config_comments); $contents[] = array('align' => 'center', 'text' => '<a href="' . tep_href_link(FILENAME_CONTRIB_TRACKER, tep_get_all_get_params(array('action', 'sID')) . 'sID=' . $sInfo->contr_id . '&action=edit') . '">' . tep_image_button('button_edit.gif', IMAGE_EDIT) . '</a> <a href="' . tep_href_link(FILENAME_CONTRIB_TRACKER, tep_get_all_get_params(array('action', 'sID')) . 'sID=' . $sInfo->contr_id . '&action=delete') . '">' . tep_image_button('button_delete.gif', IMAGE_DELETE) . '</a><br /><br /> <a href="' . tep_href_link(FILENAME_CONTRIB_TRACKER, tep_get_all_get_params(array('action', 'sID')) . 'sID=' . $sInfo->contr_id . '&action=readonly') . '">' . tep_image_button('button_preview.gif', IMAGE_PREVIEW) . '</a>' ); } break; } if ( (tep_not_null($heading)) && (tep_not_null($contents)) ) { echo ' <td width="25%" valign="top">' . "\n"; $box = new box; echo $box->infoBox($heading, $contents); echo ' </td>' . "\n"; } ?> </tr> </table> </td> </tr> <?php } elseif ($HTTP_GET_VARS['action'] == 'readonly') { // BOF READONLY/PREVIEW $product_query = tep_db_query("select contr_id, contrib_osc_id, contrib_name,contrib_link, status, config_comments, note_created, contr_last_modified, last_update from " . TABLE_CONTRIB_TRACKER . " where contr_id = '" . $HTTP_GET_VARS['sID'] . "'"); $product = tep_db_fetch_array($product_query); $sInfo = new objectInfo($product); if ($sInfo->status == '0') $status_desc = IMAGE_ICON_STATUS_GREEN; if ($sInfo->status == '1') $status_desc = IMAGE_ICON_STATUS_RED; if ($sInfo->status == '2') $status_desc = IMAGE_ICON_STATUS_NONE; ?> <tr> <td colspan=3> <br /> <table border="0" cellspacing="0" cellpadding="2" class="formArea" align="center"> <tr class="dataTableRow"> <td class="dataTableContent" NOWRAP><strong><?php echo TEXT_OSC_ID; ?> </strong></td> <td class="formAreaTitle"><strong><font color=blue><?php echo $sInfo-> contrib_osc_id; ?></font></strong></td> </tr> <tr class="dataTableRow"> <td class="dataTableContent" NOWRAP><strong><?php echo TEXT_NAME_VERSION; ?> </strong></td> <td class="formAreaTitle"><strong><font color=blue><?php echo $sInfo-> contrib_name; ?></font></strong></td> </tr> <tr class="dataTableRow"> <td class="dataTableContent" NOWRAP><strong><?php echo TEXT_INFO_SUPPORT; ?> </strong></td> <td class="formAreaTitle"><strong><font color=blue><?php echo $sInfo->contrib_support; ?></font></strong></td> </tr> <tr class="dataTableRowOver"> <td VALIGN="top" class="dataTableContent" NOWRAP><strong><?php echo TEXT_CONFIG_COMMENTS; ?> </strong></td> <td class="dataTableContent"><?php echo nl2br($sInfo->config_comments); ?></td> </tr> <tr class="dataTableRowOver"> <td class="dataTableContent" NOWRAP><strong><?php echo TEXT_INFO_TO_REMEMBER; ?> </strong></td> <td class="dataTableContent"><?php echo $sInfo->last_update; ?></td> </tr> <tr class="dataTableRow"> <td class="dataTableContent" NOWRAP><strong><?php echo TEXT_INFO_DATE_ADDED; ?> </strong></td> <td class="dataTableContent"><?php echo $sInfo->note_created; ?></td> </tr> <tr class="dataTableRowOver"> <td class="dataTableContent" NOWRAP><strong><?php echo TEXT_INFO_LAST_MODIFIED; ?> </strong></td> <td class="dataTableContent"><?php if ($sInfo->contr_last_modified != '0000-00-00 00:00:00') echo $sInfo->contr_last_modified; ?></td> </tr> <tr class="dataTableRow"> <td class="dataTableContent" NOWRAP><strong><?php echo TEXT_INFO_STATUS; ?> </strong></td> <td class="dataTableContent"><?php echo $sInfo->status . ': ' . $status_desc; ?></td> </tr> </table> </td> </tr> <tr> <td colspan=3 align="center" class="main"> <br /> <?php echo '<a href="' . tep_href_link(FILENAME_CONTRIB_TRACKER, tep_get_all_get_params(array('action', 'sID')) . 'sID=' . $sInfo->contr_id, 'NONSSL') . '">' . tep_image_button('button_back.gif', IMAGE_BUTTON_BACK) . '</a>'; ?> </td> </tr> <?php } // EOF readonly ?> </table> <?php require(DIR_WS_INCLUDES . 'template_bottom.php'); require(DIR_WS_INCLUDES . 'application_bottom.php'); ?> Done! Now you can enjoy Contribtion Tracker on osC 2.3.1 like you used to. NOTE: If your website is running on PHP 5.3 or higher you need to make an additional adjustment to the new catalog/admin/magpierss/rss_parse.inc file. Replace on line 153: list($ns, $el) = split( ':', $element, 2); By: // PHP 5.3 compliance - Start // list($ns, $el) = split( ':', $element, 2); list($ns, $el) = preg_split ( ':', $element, 2); // PHP 5.3 compliance - End For documentation see http://www.php.net/manual/en/function.preg-split.php
  17. dennish

    Auto mysql backup errors

    Hello Mark, You should check the paths as defined on line 34 (to configure.php) and 47 (to compatibility.php). The .php warnings indicate they are incorrect and as a result both files can't be found. I would suspect your settings in configure.php are not correct. Kind regards, Dennis
  18. Hello, I've integrated the auto mysql backup add-on (http://addons.oscommerce.com/info/3100) to my store (I used the version of 17-1-2011 by cleiton.maia). When called the mysqlcron.php file generates an email with a .zip file as an attachment. However I am unable to unzip it as it is declared "invalid" by my Windows Explorer. Any suggestions what might go wrong here? Thanks in advance. Dennis
  19. dennish

    Contribution Tracker

    Hello, At the moment I am migrating my shop to osC 2.3.1. Unfortunately the update of Contribution Tracker by amaische (9/9/2011) contains some errors (among which the use of double HTML <head> and <body> tags). In an effort to adapt admin/contrib_tracker.php I came up with this code: <?php /* $Id: contrib_tracker.php,v 1.7.17 2009/09/05 15:57:07 stevedallas Exp $ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com 05 Sep 2009 GCH 1.7.17 Complete rewrite of RDF file handling. No longer requires or creates a cache file Complete rewrite of XML parsing - no longer uses rdf_class.php 28 Nov 2008 GCH 1.7.14 Several bug fixes in insert routine for correct processing of non-osCommerce support site contributions date added can now be edited clears sID on page change 26 Nov 2008 lildog 1.7.13 When adding a new contrib date added and last official update were getting mixed up changed a couple of variables so they are more obvious 08 Nov 2008 GCH 1.7.12 Quick Add now searches for a support topic and inserts it into the database Insert now adds support topic if user didn't provide one and one exists in the contribution description Quick Add and Insert no longer add duplicate records toggleDivBlock() now uses the code from osC 2.2RC2a Extensive use of tep_get_all_get_params() to preserve parameters - no longer loses sort order on updates Fixed two minor HTML errors that occurred with empty searches and an empty contrib_tracker table Clicking anywhere on a row in the table of contributions will select it Fixed the operation of the manual check button (manualcheckall worked; manualcheck didn't) 08 Nov 2008 lildog 1.7.11 realigned buttons in insert contribution page 07 Nov 2008 lildog 1.7.10 My sql needed quotes around 'LAST_CONFIG_CHECK' from version 1.7.8. 07 Nov 2008 lildog 1.7.9 Fixed Insert so it works with contributions with apostrophes in their titles 28 Oct 2008 GCH 1.7.8 Changed config update to use key LAST_CONFIG_CHECK instead of raw configuration_id, which is installation dependent Rebuilt all tables to ensure correct HTML structure Re-created missing Javascript function toggleDivBlock() to make "info" links work in editor Modified logic to suppress search, quick add, and last update boxes in edit and preview modes Escaped a ton of ampersands to "&" for HTML 4.01 Transitional DTD conformance (Note that some modes still generate non-conforming HTML due to minor bugs in osC functions tep_draw_form() and tep_draw_textarea_field() ) Simplified status icon display code Copyright (c) 2003 osCommerce Released under the GNU General Public License _________________________________________________________________ Contribution Tracker MODULE for osC Admin By Admin of www.silvermoon-jewelry.com Based on: Admin_notes: Original Code By: Robert Hellemans of www.RuddlesMills.com RSS News for OSC These are LIVE SHOPS - So please, no TEST accounts etc... We will report you to your ISP if you abuse our websites! ##### make a function to display month's english and vise versa. #### */ // Contributions added by HBS: // - HBS: lines 777 require('includes/application_top.php'); require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_CONTRIB_TRACKER); require(DIR_WS_FUNCTIONS . 'contrib_tracker.php'); $xmlURL='http://feedproxy.feedburner.com/osCommerce_Contributions'; $addonsURL='http://addons.oscommerce.com/'; $contribsURL='http://addons.oscommerce.com/info/'; $contrib_supportURL='http://www.oscommerce.com/forums/index.php?showtopic='; $addonsRDFURL='http://www.oscommerce.com/oscommerce_contributions.rdf'; $format = '%Y-%m-%d %H:%M:%S'; // Causes problem with BE menu - Start /* //Function to parse the RDF feed //Does not rely on PHP XML parser due to issues. function parse_xml($text) { $reg_exp = '/<(\w+)[^>]*>(.*?)<\/\\1>/s'; preg_match_all($reg_exp, $text, $match); foreach ($match[1] as $key=>$val) { if ( preg_match($reg_exp, $match[2][$key]) ) { $array[$val][] = parse_xml($match[2][$key]); } else { if ( preg_match('/<!\[CDATA\[(.*?)\]\]>/s',$match[2][$key], $string) ) { $array[$val] = $string[1]; } else { $array[$val] = $match[2][$key]; } } } return $array; } //rss file path // THIS GETS THE FEED AND PARSES IT $data = @file_get_contents($xmlURL); if (!$data && (extension_loaded('curl') == 1)) { $data = curl_get_osc_contents($xmlURL); } if ($data) { $response = parse_xml($data); $articlelist = $response['rss'][0]['channel'][0]; foreach ($articlelist['item'] as $article ) { $thelink = $article['link']; $thetitle = $article['title']; $osc_rss_pubdate_raw = $article['pubDate']; $osc_rss_pubdate = strtotime($osc_rss_pubdate_raw); $osc_rss_pubdate = strftime ($format, $osc_rss_pubdate); // add backslashes to characters that need escaping $thetitle=addslashes($thetitle); // UPDATE THE CONTRIBUTIONS THAT ARE IN THE RSS FILE tep_db_query("UPDATE " . TABLE_CONTRIB_TRACKER . " SET status ='0', contr_last_modified = '" . $osc_rss_pubdate . "' where contrib_name = '" . $thetitle . "' and last_update < '" . $osc_rss_pubdate . "'"); } } */ // Causes problem with BE menu - End switch ($HTTP_GET_VARS['action']) { case 'setflag': tep_set_contrib_query_status($HTTP_GET_VARS['id'], $HTTP_GET_VARS['flag'], $HTTP_GET_VARS['contr_last_modified']); tep_redirect(tep_href_link(FILENAME_CONTRIB_TRACKER, tep_get_all_get_params(array('flag', 'action', 'id', 'contr_last_modified')))); break; case 'updatecheck': $contrib_query = "update " . TABLE_CONFIGURATION . " set configuration_value = '" . $HTTP_POST_VARS['lastcheck'] . "', last_modified = now() where configuration_key = 'LAST_CONFIG_CHECK'"; if (tep_db_query($contrib_query)){ $messageStack->add_session(MESSAGE_UPDATECHECK_SUCCESS, 'success'); }else{ $messageStack->add_session(MESSAGE_UPDATECHECK_ERROR, 'error'); } tep_redirect(tep_href_link(FILENAME_CONTRIB_TRACKER, (array('action')))); break; case 'insert': if ($HTTP_POST_VARS['today_date']){ $date_updated =date("Y-m-d H:M:S"); }else{ $date_updated=strtotime($HTTP_POST_VARS['last_update']); $date_updated=strftime ($format, $date_updated); } if ($HTTP_POST_VARS['today_date2']){ $date_added =date("Y-m-d H:M:S"); }else{ $date_added=strtotime($HTTP_POST_VARS['note_created']); $date_added=strftime ($format, $date_added); } $new_contrib_id=$HTTP_POST_VARS['contrib_id_new']; $contrib_name=stripslashes($HTTP_POST_VARS['contrib_name_new']); $contrib_link=old_to_new_url($HTTP_POST_VARS['contrib_link_new']); if ($contrib_link == '') { $contrib_link = $contribsURL . $new_contrib_id; } //check whether contrib is already in database if ($HTTP_POST_VARS['contrib_id_new'] !=='') { $contrib_raw = "select contrib_osc_id from " . TABLE_CONTRIB_TRACKER . " where contrib_osc_id = " . $HTTP_POST_VARS['contrib_id_new']; $contrib_query = tep_db_query($contrib_raw); $record_found = (tep_db_num_rows($contrib_query) !== 0); } else { $record_found = false; } if (!$record_found){ //if the id is empty get it $new_contrib_id=get_contrib_id($contrib_link,$new_contrib_id); //get contribs info from it's URL if(!empty($new_contrib_id)){ contrib_check($new_contrib_id); } //set flag to red if need be if (strtotime($date_updated) < strtotime($last_osc_update)){ $status='0'; } else { $status='1'; } //Add support link if user didn't provide one and one exists in the contrib info if ($HTTP_POST_VARS['contrib_link_support'] !='') { $contrib_support_link = $HTTP_POST_VARS['contrib_link_support']; } elseif ($contrib_support_topic) { $contrib_support_link = $contrib_supportURL . $contrib_support_topic; } else { $contrib_support_link = ''; } $contrib_query = "insert into " . TABLE_CONTRIB_TRACKER . " (contr_id, contrib_osc_id, contrib_name, contrib_link, contrib_support, config_comments, note_created, contr_last_modified, status, last_update, contrib_vers) values ('','" . $HTTP_POST_VARS['contrib_id_new'] . "','" . addslashes($contrib_name) . "','" . $contrib_link . "','" . $contrib_support_link . "','" . $HTTP_POST_VARS['config_comments'] . "', '" . $date_added . "', '" . $last_osc_update . "', '" . $status . "', '" . $date_updated . "', '" . $HTTP_POST_VARS['contrib_vers'] . "' )"; if ( tep_db_query($contrib_query) ){ $messageStack->add_session(MESSAGE_INSERT_SUCCESS, 'success'); } else { $messageStack->add_session(MESSAGE_INSERT_ERROR, 'error'); } } else { $messageStack->add_session(MESSAGE_INSERT_DUPLICATE, 'error'); } tep_redirect(tep_href_link(FILENAME_CONTRIB_TRACKER, tep_get_all_get_params(array('action')))); break; case 'update': if (($old_status!=='1' && $status=='1') || ($HTTP_POST_VARS['today_date'])){ $last_update=date("Y-m-d H:M:S"); }else{ $last_update=$HTTP_POST_VARS['last_update']; } //Get the creation date $note_created=$HTTP_POST_VARS['note_created']; //convert old links to new ones $link=old_to_new_url($HTTP_POST_VARS['contrib_link_new']); $new_contrib_id=$HTTP_POST_VARS['contrib_id_new']; $contrib_name=$HTTP_POST_VARS['contrib_name_new']; //if the id is empty get it $new_contrib_id=get_contrib_id($link,$new_contrib_id); //if the name is empty get it if (empty($contrib_name) && !empty($new_contrib_id)){ contrib_check($new_contrib_id); }else{ $contrib_name=$HTTP_POST_VARS['contrib_name_new']; } //tep_db_query("update " .TABLE_CONTRIB_TRACKER . " set contr_last_modified = now(), status = '" . $HTTP_POST_VARS['status'] . "', contrib_osc_id = '" . $new_contrib_id . "',contrib_name = '" . $contrib_name . "', contrib_link = '" . $HTTP_POST_VARS['contrib_link_new'] . "', config_comments = '" . $HTTP_POST_VARS['config_comments'] . "', last_update = '" .$last_update. "', contrib_vers= '" . $HTTP_POST_VARS['contrib_vers'] . "' where contr_id = '" . $HTTP_POST_VARS['contr_id'] . "'"); $contrib_query = "update " .TABLE_CONTRIB_TRACKER . " set contr_last_modified = now(), status = '" . $HTTP_POST_VARS['status'] . "', contrib_osc_id = '" . $new_contrib_id . "',contrib_name = '" . $contrib_name . "', contrib_link = '" . $link . "', contrib_support = '" . $HTTP_POST_VARS['contrib_link_support'] . "', config_comments = '" . $HTTP_POST_VARS['config_comments'] . "', last_update = '" . $last_update . "', note_created = '" . $note_created . "', contrib_vers= '" . $HTTP_POST_VARS['contrib_vers'] . "' where contr_id = '" . $HTTP_POST_VARS['contr_id'] . "'"; if ( tep_db_query($contrib_query) ){ $messageStack->add_session(MESSAGE_UPDATE_SUCCESS, 'success'); }else{ $messageStack->add_session(MESSAGE_UPDATE_SUCCESS, 'error'); } tep_redirect(tep_href_link(FILENAME_CONTRIB_TRACKER, tep_get_all_get_params(array('action', 'sID')) . 'sID=' . $contr_id)); break; case 'deleteconfirm': $contr_id = tep_db_prepare_input($HTTP_GET_VARS['sID']); // tep_db_query("delete from " . TABLE_CONTRIB_TRACKER. " where contr_id = '" . tep_db_input($contr_id) . "'"); $contrib_query = "delete from " . TABLE_CONTRIB_TRACKER. " where contr_id = '" . tep_db_input($contr_id) . "'"; if ( tep_db_query($contrib_query) ){ $messageStack->add_session(MESSAGE_DELETE_SUCCESS, 'success'); }else{ $messageStack->add_session(MESSAGE_DELETE_ERROR, 'error'); } tep_redirect(tep_href_link(FILENAME_CONTRIB_TRACKER, tep_get_all_get_params(array('action', 'sID')))); break; case 'manualcheck': contrib_check($HTTP_GET_VARS['oscID']); //if the date is newer then update the contrib database entry $update_query="UPDATE " . TABLE_CONTRIB_TRACKER . " SET status ='0', contr_last_modified = '" . $last_osc_update . "' WHERE contrib_osc_id = '" . $HTTP_GET_VARS['oscID'] . "' and last_update < '" . $last_osc_update . "'"; if ( tep_db_query($update_query) ){ $messageStack->add_session(MESSAGE_UPDATE_SUCCESS, 'success'); }else{ $messageStack->add_session(MESSAGE_UPDATE_ERROR, 'error'); } tep_redirect(tep_href_link(FILENAME_CONTRIB_TRACKER, tep_get_all_get_params(array('action', 'oscID', 'contr_last_modified', 'lastupdate')))); break; case 'quick_insert': if (is_numeric($HTTP_POST_VARS['contrib_quick_insert'])){ $date_updated =date("Y-m-d H:M:S"); $date_added =date("Y-m-d H:M:S"); $new_contrib_id=$HTTP_POST_VARS['contrib_quick_insert']; $new_contrib_id = substr($HTTP_POST_VARS['contrib_quick_insert'] , strrpos($HTTP_POST_VARS['contrib_link_new'] , '/') +1); //check whether contrib is already in database $contrib_raw = "select contrib_osc_id from " . TABLE_CONTRIB_TRACKER . " where contrib_osc_id = " . $HTTP_POST_VARS['contrib_quick_insert']; $contrib_query = tep_db_query($contrib_raw); if (tep_db_num_rows($contrib_query) == 0){ //the get contrib info contrib_check($HTTP_POST_VARS['contrib_quick_insert']); $newvers=''; //set flag to green $status='1'; if ($contrib_support_topic) { $contrib_support_link = $contrib_supportURL . $contrib_support_topic; } else { $contrib_support_link = ''; } $contrib_query = "insert into " . TABLE_CONTRIB_TRACKER . " (contr_id, contrib_osc_id, contrib_name, contrib_link, contrib_support, config_comments, note_created, contr_last_modified, status, last_update, contrib_vers) values ('','" . $HTTP_POST_VARS['contrib_quick_insert'] . "','" . addslashes($contrib_name) . "','" . $contribsURL . $HTTP_POST_VARS['contrib_quick_insert'] . "','" . $contrib_support_link . "','" . '' . "', '" . $date_added . "', '".$last_osc_update."', '".$status."', '" . $date_updated . "', '" . $newvers . "' )"; if ( tep_db_query($contrib_query) ){ $messageStack->add_session(MESSAGE_INSERT_SUCCESS, 'success'); } else { $messageStack->add_session(MESSAGE_INSERT_ERROR, 'error'); } } else { $messageStack->add_session(MESSAGE_INSERT_DUPLICATE, 'error'); } tep_redirect(tep_href_link(FILENAME_CONTRIB_TRACKER, tep_get_all_get_params(array('action')))); } break; case 'manualcheckall': //$admin_query_query_raw = "select contr_id, contrib_osc_id, contrib_name, contrib_link, contrib_support, status, note_created , contr_last_modified, last_update,config_comments, contrib_vers from " . TABLE_CONTRIB_TRACKER . " order by contrib_name "; $manualcheckall_raw = "select contr_id, contrib_osc_id, contrib_name, status, note_created , contr_last_modified, last_update from " . TABLE_CONTRIB_TRACKER . " order by contrib_name "; $manualcheckall_query = tep_db_query($manualcheckall_raw); if (tep_db_num_rows($manualcheckall_query) == 0){ $messageStack->add_session(MESSAGE_MANUALALL_NONE_ERROR, 'error'); }else{ while ($admin_quer = tep_db_fetch_array($manualcheckall_query)) { $sInfo_array = array_merge($admin_quer); /*print_r($sInfo_array[contrib_osc_id]); echo '<br>';*/ $contrib_osc_id=$sInfo_array[contrib_osc_id]; contrib_check($contrib_osc_id); //if the date is newer then update the contrib database entry $update_query="UPDATE " . TABLE_CONTRIB_TRACKER . " SET status ='0', contr_last_modified = '" . $last_osc_update . "' WHERE contrib_osc_id = '" . $contrib_osc_id . "' and last_update < '" . $last_osc_update . "'"; if ( !tep_db_query($update_query) ){ //$messageStack->add_session(MESSAGE_MANUALALL_SUCCESS, 'success'); //}else{ $messageStack->add_session(MESSAGE_MANUALALL_ERROR.$sInfo_array[contrib_name], 'error'); } } } tep_redirect(tep_href_link(FILENAME_CONTRIB_TRACKER, tep_get_all_get_params(array('action')))); break; } require(DIR_WS_INCLUDES . 'template_top.php'); ?> <!-- <script language="javascript" type="text/javascript"> function toggleDivBlock(id) { if (document.getElementById) { itm = document.getElementById(id); } else if (document.all){ itm = document.all[id]; } else if (document.layers){ itm = document.layers[id]; } if (itm) { if (itm.style.display != "none") { itm.style.display = "none"; } else { itm.style.display = "block"; } } } </script> --> <?php // set sub title if ( $HTTP_GET_VARS['action'] == 'readonly') $HEADING_SUB_TITLE = HEADING_SUB_TITLE_READONLY; if ( $HTTP_GET_VARS['action'] == 'delete') $HEADING_SUB_TITLE = HEADING_SUB_TITLE_DELETE; if ( $HTTP_GET_VARS['action'] == 'update') $HEADING_SUB_TITLE = HEADING_SUB_TITLE_EDIT; if ( $HTTP_GET_VARS['action'] == 'edit') $HEADING_SUB_TITLE = HEADING_SUB_TITLE_EDIT; if ( $HTTP_GET_VARS['action'] == 'new') $HEADING_SUB_TITLE = HEADING_SUB_TITLE_INSERT; if ( $HTTP_GET_VARS['action'] == 'setflag') $HEADING_SUB_TITLE = HEADING_SUB_TITLE_SETFLAG; if ( $HTTP_GET_VARS['action'] == '') $HEADING_SUB_TITLE = HEADING_SUB_TITLE; ?> <table border="0" width="100%" cellspacing="0" cellpadding="2"> <td width="100%" valign="top"> <table border="0" width="100%" cellspacing="0" cellpadding="0"> <tr> <td class="pageHeading"><?php echo HEADING_TITLE; ?> <?php echo '<a href="'.$addonsURL.'" target="_blank">' . tep_image(DIR_WS_IMAGES . 'html_badge.gif', HEADING_CONTRIB_HTML_SUPPORT_SITE, '80', '15') . '</a> <a href="'. $addonsURL .'" target="_blank">' . tep_image(DIR_WS_IMAGES . 'rss_badge.gif', HEADING_CONTRIB_RSS_SUPPORT_SITE, '80', '15') . '</a>'; ?> <br><font class="smallText"><?php echo $HEADING_SUB_TITLE; ?></font> </td> <td class="pageHeading" align="right"><?php echo tep_draw_separator('pixel_trans.gif', 10, 1); ?></td> <?php if ($HTTP_GET_VARS['action'] != 'new' && $HTTP_GET_VARS['action'] != 'edit' && $HTTP_GET_VARS['action'] != 'readonly') { if (htmlspecialchars(StripSlashes(@$HTTP_GET_VARS["search"])) == ''){ $searchquery = ''; } else { $searchquery = htmlspecialchars(StripSlashes(@$HTTP_GET_VARS["search"])) ; } ?> <td align="right"> <table border="0" width="100%" cellspacing="0" cellpadding="1"> <tr> <td class="smallText" align="right"> <?php echo tep_draw_form('search', FILENAME_CONTRIB_TRACKER, tep_get_all_get_params(array('action')), 'get'); echo HEADING_TITLE_CONTRIBSEARCH . ' ' . tep_draw_input_field('search', $searchquery, "onFocus=\"if (this.value == 'enter search query') { this.value='' }\""); ?> </form> </td> </tr> <tr> <td class="smallText" align="right"> <?php echo tep_draw_form('quick_insert', FILENAME_CONTRIB_TRACKER, 'action=quick_insert', 'post'); echo TEXT_QUICKOSC_ID .' '. TEXT_ID_QUICK_NEW . ' ' . tep_draw_input_field('contrib_quick_insert', '', "onFocus=\"if (this.value == 'enter contrib ID') { this.value='' }\""); ?> </form> </td> </tr> <tr> <?php if ($HTTP_GET_VARS['action']== 'editlastcheck') { ?> <!-- SHOW THE TITLE AND A FIELD TO ENTER A NEW DATE --> <td class="smallText" align="right"> <?php echo tep_draw_form('lastcheck', FILENAME_CONTRIB_TRACKER,'action=updatecheck&id=' . $admin_quer['contr_id'] . '&page=' . $HTTP_GET_VARS['page'] . '&sID=' . $HTTP_GET_VARS['sID'], 'post'); echo HEADING_LAST_CHECK . ' ' . tep_draw_input_field('lastcheck', LAST_CONFIG_CHECK); ?> </form> </td> <?php } else { ?> <!-- // JUST SHOW THE TITLE AND DATE FOR LAST MANUAL UPDATE AS A LINK --> <td class="smallText" align="right"> <?php echo ' <a href="' . tep_href_link(FILENAME_CONTRIB_TRACKER, tep_get_all_get_params(array('action', 'id')) . 'action=editlastcheck&id=' . $admin_quer['contr_id'], 'NONSSL') . '">'.HEADING_LAST_CHECK.' '.LAST_CONFIG_CHECK .'</a>'; ?> </td> <?php } ?> </tr> </table> </td> <?php } ?> </tr> <?php if ( ($HTTP_GET_VARS['action'] == 'new') || ($HTTP_GET_VARS['action'] == 'edit') ) { if ($HTTP_GET_VARS['action'] == 'new'){ $form_action = 'insert'; }else if ($HTTP_GET_VARS['action'] == 'edit'){ $form_action = 'update'; } // UPDATE A CONTRIBUTION ENTRY if ( ($HTTP_GET_VARS['action'] == 'edit') && ($HTTP_GET_VARS['sID']) ) { $product_query = tep_db_query("select contr_id, contrib_osc_id, contrib_name, contrib_link, contrib_support, status, config_comments, last_update, note_created,contrib_vers from " . TABLE_CONTRIB_TRACKER . " where contr_id = '" . $HTTP_GET_VARS['sID'] . "'"); $product = tep_db_fetch_array($product_query); $sInfo = new objectInfo($product); } else { $sInfo = new objectInfo(array()); $contr_array = array(); } ?> <tr> <td> <form name="new_contr" <?php echo 'action="' . tep_href_link(FILENAME_CONTRIB_TRACKER, tep_get_all_get_params(array('action', 'info', 'sID')) . 'action=' . $form_action, 'NONSSL') . '"'; ?> method="post"><?php if ($form_action == 'update') echo tep_draw_hidden_field('contr_id', $HTTP_GET_VARS['sID']) ; ?> <br> <table border="0" cellspacing="0" cellpadding="2"> <?php if ($HTTP_GET_VARS['action'] == 'new'){ ?> <tr class="dataTableRow"> <td class="dataTableContent"><?php echo TEXT_OSC_ID; ?></td> <td class="dataTableContent"><?php echo tep_draw_input_field('contrib_id_new', $sInfo-> contrib_osc_id, 'size=10 maxlength=10').' '. TEXT_ID_NOTE_NEW; ?></td> </tr> <?php }else if ($HTTP_GET_VARS['action'] == 'edit'){ ?> <tr class="dataTableRow"> <td class="dataTableContent"><?php echo TEXT_OSC_ID; ?> <?php echo tep_draw_hidden_field('contrib_id_new', $sInfo-> contrib_osc_id);?></td> <td class="dataTableContent"><?php echo $sInfo-> contrib_osc_id; ?></td> </tr> <?php } ?> <tr class="dataTableRow"> <td class="dataTableContent"><?php echo TEXT_NAME_VERSION; ?></td> <td class="dataTableContent"><?php echo tep_draw_input_field('contrib_name_new', $sInfo-> contrib_name, 'size=50 maxlength=255').' '. TEXT_NAME_NOTE_NEW; ?></td> </tr> <tr class="dataTableRow"> <td class="dataTableContent"><?php echo TEXT_INFO_HTML; ?></td> <td class="dataTableContent"><?php echo tep_draw_input_field('contrib_link_new', $sInfo-> contrib_link, 'size=50 maxlength=255').' '.TEXT_OSC_URL; ?></td> </tr> <tr class="dataTableRow"> <td class="dataTableContent"><?php echo TEXT_INFO_SUPPORT; ?></td> <td class="dataTableContent"><?php echo tep_draw_input_field('contrib_link_support', $sInfo-> contrib_support, 'size=50 maxlength=255').' '.TEXT_OSC_SUPPORT; ?></td> </tr> <!-- // insert version number field --> <tr class="dataTableRow"> <td class="dataTableContent"><?php echo TEXT_VERSION_NUMBER; ?> </td> <td class="dataTableContent"><?php echo tep_draw_input_field('contrib_vers', $sInfo->contrib_vers, 'size=50 maxlength=30').' '. TEXT_VERSION_NOTE_NEW; ?></td> </tr> <tr class="dataTableRow"> <td class="dataTableContent"><?php echo TEXT_INFO_TO_REMEMBER; ?> </td> <td class="dataTableContent"><?php echo tep_draw_input_field('last_update',$sInfo->last_update, 'size=50 maxlength=30'). ' '. tep_draw_checkbox_field('today_date', $today_date,'',''). ' '. TEXT_TODAY_DATE.' '. TEXT_INT_DATE_NEW; ?></td> </tr> <tr class="dataTableRow"> <td class="dataTableContent"><?php echo TEXT_INFO_DATE_ADDED; ?> </td> <td class="dataTableContent"><?php echo tep_draw_input_field('note_created',$sInfo->note_created, 'size=50 maxlength=30'). ' '. tep_draw_checkbox_field('today_date2', $today_date,'',''). ' '. TEXT_TODAY_DATE.' '. TEXT_ADD_DATE_NEW; ?></td> </tr> <tr class="dataTableRow"> <td valign="top" class="dataTableContent"><?php echo TEXT_CONFIG_COMMENTS; ?> </TD> <td class="dataTableContent"><?php echo tep_draw_textarea_field('config_comments', 'soft', '70', '15', ($sInfo->config_comments)) ; ?></td> </tr> <?php if ( $HTTP_GET_VARS['action'] == 'edit') { ?> <tr class="dataTableRow"> <td class="dataTableContent"><?php echo TEXT_CONFIG_STATUS; ?> </td> <td class="dataTableContent"><?php echo tep_draw_input_field('status', $sInfo->status, 'size=2 maxlength=1'); ?> 0 = <?php echo tep_image(DIR_WS_IMAGES . 'icon_status_red.gif', TEXT_NEW_UPDATE_EXISTS , 10, 10); ?> <?php echo TEXT_NEW_UPDATE_EXISTS; ?> 1 = <?php echo tep_image(DIR_WS_IMAGES . 'icon_status_green.gif', TEXT_NO_NEW_UPDATE , 10, 10); ?> <?php echo TEXT_NO_NEW_UPDATE; ?> 2 = <?php echo TEXT_NO_STATUS; ?> <td><?php echo tep_draw_hidden_field('old_status', $sInfo->status);?></td> </tr> <?php } ?> </table> <table border="0" width="100%" cellspacing="0" cellpadding="2"> <tr> <td class="main" colspan=2 align="right" valign="top"><br><?php echo (($form_action == 'insert') ? tep_image_submit('button_insert.gif', IMAGE_INSERT) : tep_image_submit('button_update.gif', IMAGE_UPDATE)) . ' <a href="' . tep_href_link(FILENAME_CONTRIB_TRACKER, tep_get_all_get_params(array('action'))). '">' . tep_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a> <a href="' . tep_href_link(FILENAME_CONTRIB_TRACKER, tep_get_all_get_params()) . '" onclick="reset();">' . tep_image_button('button_reset.gif', IMAGE_RESET) . '</a>'; ?></td> </table> </form> </td> </tr> <?php } elseif ($HTTP_GET_VARS['action'] != 'readonly') { ?> <tr> <td colspan=3> <table border="0" width="100%" cellspacing="0" cellpadding="0"> <tr> <!-- TABLE HEADINGS AND SORT ICONS--> <td valign="top"> <table border="0" width="100%" cellspacing="0" cellpadding="2"> <tr class="dataTableHeadingRow"> <td class="dataTableHeadingContent"> <a href="<?php echo "$PHP_SELF?sort=2a" . "&page=" . $HTTP_GET_VARS['page'] . "&sID=" . $HTTP_GET_VARS['sID']; ?>"><?php echo tep_image(DIR_WS_IMAGES . 'icon_up.gif', IMAGE_BUTTON_UPSORT); ?></a><a href="<?php echo "$PHP_SELF?sort=2d" . "&page=" . $HTTP_GET_VARS['page'] . "&sID=" . $HTTP_GET_VARS['sID']; ?>"><?php echo tep_image(DIR_WS_IMAGES . 'icon_down.gif', IMAGE_BUTTON_DOWNSORT); ?></a><br><?php echo TABLE_HEADING_NAME; ?></td> <td class="dataTableHeadingContent" align="center"><br><?php echo TABLE_HEADING_VERSION; ?> </td><td class="dataTableHeadingContent" align="center"><a href="<?php echo "$PHP_SELF?sort=4a" . "&page=" . $HTTP_GET_VARS['page'] . "&sID=" . $HTTP_GET_VARS['sID']; ?>"><?php echo tep_image(DIR_WS_IMAGES . 'icon_up.gif', IMAGE_BUTTON_UPSORT); ?></a><a href="<?php echo "$PHP_SELF?sort=4d" . "&page=" . $HTTP_GET_VARS['page'] . "&sID=" . $HTTP_GET_VARS['sID']; ?>"><?php echo tep_image(DIR_WS_IMAGES . 'icon_down.gif', IMAGE_BUTTON_DOWNSORT); ?></a> <br><?php echo TABLE_HEADING_STATUS; ?></td> <td class="dataTableHeadingContent" align="right"><br><?php echo TABLE_HEADING_ACTION; ?> </td> </tr> <?php switch ($sort) { case "2a": $order_it_by = "contrib_name, status "; break; case "2d": $order_it_by = "contrib_name DESC, status "; break; case "4a": $order_it_by = "status, contrib_name"; break; case "4d": $order_it_by = "status DESC, contrib_name"; break; case "5a": $order_it_by = "last_update, contrib_name"; break; case "5d": $order_it_by = "last_update DESC, contrib_name"; break; default: $order_it_by = "status, contrib_name"; } // IF THIS IS A SEARCH GET THE SEARCH RESULTS FROM THE DB if ($HTTP_GET_VARS['search']) { //contrib_support->'" . $HTTP_POST_VARS['contrib_link_support'] . "', $admin_query_query_raw = "select contr_id, contrib_osc_id, contrib_name, contrib_link, contrib_support, status, note_created , contr_last_modified, last_update,config_comments, contrib_vers from " . TABLE_CONTRIB_TRACKER . " where contrib_name like '%" . $HTTP_GET_VARS['search'] . "%' order by " . $order_it_by . " "; $admin_query_split = new splitPageResults($HTTP_GET_VARS['page'], MAX_DISPLAY_SEARCH_RESULTS, $admin_query_query_raw, $admin_query_query_numrows); $admin_query_query = tep_db_query($admin_query_query_raw); if (tep_db_num_rows($admin_query_query) == 0) echo '<tr><td class="dataTableContent" align="left">' . TEXT_NO_DATA . "</td></tr>\n"; } else { // IF THIS IS NOT A SEARCH SO GET ALL THE DATABASE ENTRIES $admin_query_query_raw = "select contr_id, contrib_osc_id, contrib_name, contrib_link, contrib_support, status, note_created , contr_last_modified, last_update,config_comments, contrib_vers from " . TABLE_CONTRIB_TRACKER . " order by " . $order_it_by . " "; $admin_query_split = new splitPageResults($HTTP_GET_VARS['page'], MAX_DISPLAY_SEARCH_RESULTS, $admin_query_query_raw, $admin_query_query_numrows); $admin_query_query = tep_db_query($admin_query_query_raw); if (tep_db_num_rows($admin_query_query) == 0) echo '<tr><td class="dataTableContent" align="right">' . TEXT_EMPTY_DATABASE . "</td></tr>\n"; } while ($admin_quer = tep_db_fetch_array($admin_query_query)) { if ( ((!$HTTP_GET_VARS['sID']) || ($HTTP_GET_VARS['sID'] == $admin_quer['contr_id'])) && (!$sInfo) ) { $sInfo_array = array_merge($admin_quer); $sInfo = new objectInfo($sInfo_array); } if ($HTTP_GET_VARS['search'] == '') { if ( (is_object($sInfo)) && ($admin_quer['contr_id'] == $sInfo->contr_id)) { echo ' <tr id="defaultSelected" class="dataTableRowSelected" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="document.location.href=\'' . tep_href_link(FILENAME_CONTRIB_TRACKER, tep_get_all_get_params(array('sID')) . 'sID=' . $admin_quer['contr_id']) . '\'">' . "\n"; } else { echo ' <tr class="dataTableRow" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="document.location.href=\'' . tep_href_link(FILENAME_CONTRIB_TRACKER, tep_get_all_get_params(array('sID')) . 'sID=' . $admin_quer['contr_id']) . '\'">' . "\n"; } } else { $searchresult_query_query_raw = "select contr_id from " . TABLE_CONTRIB_TRACKER . " order by " . $order_it_by . " "; $searchresult_query_query = tep_db_query($searchresult_query_query_raw); $searchresult_page= round($searchresult_query_query_numrows / MAX_DISPLAY_SEARCH_RESULTS)-1; // INSERT CONTRIB NAMES INTO PAGE if ( (is_object($sInfo)) && ($admin_quer['contr_id'] == $sInfo->contr_id)) { echo ' <tr id="defaultSelected" class="dataTableRowSelected" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="document.location.href=\'' . tep_href_link(FILENAME_CONTRIB_TRACKER, tep_get_all_get_params(array('sID')) . 'sID=' . $admin_quer['contr_id']) . '\'">' . "\n"; } else { echo ' <tr class="dataTableRow" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="document.location.href=\'' . tep_href_link(FILENAME_CONTRIB_TRACKER, tep_get_all_get_params(array('sID')) . 'sID=' . $admin_quer['contr_id']) . '\'">' . "\n"; } } ?> <td class="dataTableContent"> <?php if ($admin_quer['contrib_link']){ echo '<a target="_blank" href="' . $admin_quer['contrib_link'] . '" name="' . $admin_quer['contrib_name'] . '">' . $admin_quer['contrib_name'].'</a>'; }else{ echo $admin_quer['contrib_name']; } ?> </td> <td class="dataTableContent" align="center"><?php echo $admin_quer['contrib_vers'];?></td> <td class="dataTableContent" align="center"> <?php // SHOW THE STATUS ICONS // contr_last_modified if ($admin_quer['status'] == '0') { echo tep_image(DIR_WS_IMAGES . 'icon_status_red.gif', TEXT_NEW_UPDATE_EXISTS, 10, 10) . ' '; } else { echo '<a href="' . tep_href_link(FILENAME_CONTRIB_TRACKER, tep_get_all_get_params(array('action')) . 'action=setflag&flag=0&id=' . $admin_quer['contr_id'] . '&contr_last_modified=' . $admin_quer['contr_last_modified'], 'NONSSL') . '">' . tep_image(DIR_WS_IMAGES . 'icon_status_red_light.gif', TEXT_SET_NEW_UPDATE_EXISTS, 10, 10) . '</a> '; } if ($admin_quer['status'] == '1') { echo tep_image(DIR_WS_IMAGES . 'icon_status_green.gif', TEXT_NO_NEW_UPDATE, 10, 10); } else { echo '<a href="' . tep_href_link(FILENAME_CONTRIB_TRACKER, tep_get_all_get_params(array('action')) . 'action=setflag&flag=1&id=' . $admin_quer['contr_id'] . '&contr_last_modified=' . $admin_quer['contr_last_modified'] , 'NONSSL') . '">' . tep_image(DIR_WS_IMAGES . 'icon_status_green_light.gif', TEXT_SET_NO_NEW_UPDATE, 10, 10) . '</a>'; } ?> </td> <td class="dataTableContent" align="right"> <?php // INSERT THE ACTION ICONS if ($admin_quer['contrib_support']) { echo '<a target="_blank" href="' . $admin_quer['contrib_support'] . '">' .tep_image(DIR_WS_IMAGES . 'icon_help.gif', TEXT_OSC_SUPPORT_THREAD) . '</a> '; } if ($admin_quer['contrib_osc_id']){ echo '<a href="' . tep_href_link(FILENAME_CONTRIB_TRACKER, tep_get_all_get_params(array('action')) . 'action=manualcheck&oscID=' . $admin_quer['contrib_osc_id'].'&sID=' . $admin_quer['contr_id']) . '">' .tep_image(DIR_WS_IMAGES . 'icon_manual_check.jpg', TEXT_MANUAL_CHECK) . '</a> '; } if (htmlspecialchars(StripSlashes(@$HTTP_GET_VARS["search"])) == '') { $reference = 'page'; } else { $reference = 'search'; } if ( (is_object($sInfo)) && ($admin_quer['contr_id'] == $sInfo->contr_id) ) { echo tep_image(DIR_WS_IMAGES . 'icon_arrow_right.gif', ''); } else { echo '<a href="' . tep_href_link(FILENAME_CONTRIB_TRACKER, tep_get_all_get_params(array('action', 'sID')) . 'sID=' . $admin_quer['contr_id']) . '">' .tep_image(DIR_WS_IMAGES . 'icon_info.gif', TEXT_INFO) . '</a>'; } ?> </td> </tr> <?php } ?> <tr> <td colspan="5"> <table border="0" width="100%" cellpadding="0"cellspacing="2"> <tr> <td class="smallText" valign="top"><?php echo $admin_query_split->display_count($admin_query_query_numrows, MAX_DISPLAY_SEARCH_RESULTS, $HTTP_GET_VARS['page'], TEXT_DISPLAY_NUMBER_OF_RECORDS); ?></td> <td class="smallText" align="right"><?php echo $admin_query_split->display_links($admin_query_query_numrows, MAX_DISPLAY_SEARCH_RESULTS, MAX_DISPLAY_PAGE_LINKS, $HTTP_GET_VARS['page'], 'sort=' . $HTTP_GET_VARS['sort']); ?></td> </tr> <?php if (!$HTTP_GET_VARS['action']) { ?> <tr> <td class="smallText" colspan="2" align="right"> <?php echo '<a href="' . tep_href_link(FILENAME_CONTRIB_TRACKER, tep_get_all_get_params(array('action')) . 'action=manualcheckall') . '">' . tep_image_button('button_check_all.gif', IMAGE_CHECKALL) . '</a>'; ?> <?php echo '<a href="' . tep_href_link(FILENAME_CONTRIB_TRACKER, 'action=new') . '">' . tep_image_button('button_insert.gif', IMAGE_INSERT) . '</a>'; ?> </td> </tr> <!-- // INSERT THE HELP NOTES --> <tr> <td class="smallText" colspan="2" align="left"> <?php echo '<B>'. TEXT_HELP_NOTES_HEADER . '</B><br><ul>' . TEXT_HELP_NOTES . '</ul><br><BR>'; ?> </td> </tr> <tr> <!-- // INSERT NEWEST CONTRIBS FROM RSS --> <td class="smallText" colspan="2" align="left"> <B><?php echo TEXT_CONTRIB_HEADER; ?></B> <br> <?php if (is_array($articlelist)) { echo "<ol>\n"; foreach ($articlelist['item'] as $article ) { $thelink = $article['link']; $thetitle = $article['title']; echo "<li><a href=\"" . $thelink . "\" target=\"_blank\">" . $thetitle . "</a></li>\n"; } echo "</ol>\n"; } else { echo "ERROR: Could not open RDF feed\n"; } ?> </td> </tr> <?php } ?> </table> </td> </tr> </table> </td> <?php $heading = array(); $contents = array(); // RIGHT COLUMN STUFF switch ($HTTP_GET_VARS['action']) { case 'delete': $heading[] = array('text' => '<center><b>' . TEXT_INFO_HEADING_DELETE . '</b></center>'); $contents = array('form' => tep_draw_form('install_contr_del', FILENAME_CONTRIB_TRACKER, tep_get_all_get_params(array('action')) . 'action=deleteconfirm')); $contents[] = array('text' => TEXT_INFO_DELETE_INTRO); $contents[] = array('text' => '<br><b>' . $sInfo-> contrib_name . '</b>'); $contents[] = array('align' => 'center', 'text' => '<br>' . tep_image_submit('button_delete.gif', IMAGE_DELETE) . ' <a href="' . tep_href_link(FILENAME_CONTRIB_TRACKER, tep_get_all_get_params(array('action')) . 'sID=' . $sInfo->contr_id) . '">' . tep_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>'); break; default: if (is_object($sInfo)) { $heading[] = array('text' => '<center><b>' . $sInfo->contrib_name . '</b></center>'); $contents[] = array('align' => 'center', 'text' => '<b>'.TEXT_VERSION_NUMBER .'</b> '.$sInfo-> contrib_vers); // HBS - Start // $contents[] = array('text' => '<b>' . TEXT_INFO_TO_REMEMBER . '</b><BR> ' . $sInfo->last_update); $contents[] = array('text' => '<b>' . TEXT_INFO_TO_REMEMBER . '</b><BR> ' . tep_date_short($sInfo->last_update)); // $contents[] = array('text' => '<br> <b>' . TEXT_INFO_DATE_ADDED . '</b><BR> ' . $sInfo->note_created); $contents[] = array('text' => '<br> <b>' . TEXT_INFO_DATE_ADDED . '</b><BR> ' . tep_date_short($sInfo->note_created)); // $contents[] = array('text' => '<b>' . TEXT_INFO_LAST_MODIFIED . '</b><BR> ' . $sInfo->contr_last_modified . '<BR><BR>'); $contents[] = array('text' => '<b>' . TEXT_INFO_LAST_MODIFIED . '</b><BR> ' . tep_date_short($sInfo->contr_last_modified) . '<BR><BR>'); // HBS - End $contents[] = array('text' => '<b>' .TEXT_CONFIG_COMMENTS .'</b> '. $sInfo->config_comments); $contents[] = array('align' => 'center', 'text' => '<a href="' . tep_href_link(FILENAME_CONTRIB_TRACKER, tep_get_all_get_params(array('action', 'sID')) . 'sID=' . $sInfo->contr_id . '&action=edit') . '">' . tep_image_button('button_edit.gif', IMAGE_EDIT) . '</a> <a href="' . tep_href_link(FILENAME_CONTRIB_TRACKER, tep_get_all_get_params(array('action', 'sID')) . 'sID=' . $sInfo->contr_id . '&action=delete') . '">' . tep_image_button('button_delete.gif', IMAGE_DELETE) . '</a><br><br> <a href="' . tep_href_link(FILENAME_CONTRIB_TRACKER, tep_get_all_get_params(array('action', 'sID')) . 'sID=' . $sInfo->contr_id . '&action=readonly') . '">' . tep_image_button('button_preview.gif', IMAGE_PREVIEW) . '</a>' ); } break; } if ( (tep_not_null($heading)) && (tep_not_null($contents)) ) { echo ' <td width="25%" valign="top">' . "\n"; $box = new box; echo $box->infoBox($heading, $contents); echo ' </td>' . "\n"; } ?> </tr> </table> </td> </tr> <?php } elseif ($HTTP_GET_VARS['action'] == 'readonly') { // BOF READONLY/PREVIEW $product_query = tep_db_query("select contr_id, contrib_osc_id, contrib_name,contrib_link, status, config_comments, note_created, contr_last_modified, last_update from " . TABLE_CONTRIB_TRACKER . " where contr_id = '" . $HTTP_GET_VARS['sID'] . "'"); $product = tep_db_fetch_array($product_query); $sInfo = new objectInfo($product); if ($sInfo->status == '0') $status_desc = IMAGE_ICON_STATUS_GREEN; if ($sInfo->status == '1') $status_desc = IMAGE_ICON_STATUS_RED; if ($sInfo->status == '2') $status_desc = IMAGE_ICON_STATUS_NONE; ?> <tr> <td colspan=3> <br> <table border="0" cellspacing="0" cellpadding="2" class="formArea" align="center"> <tr class="dataTableRow"> <td class="dataTableContent" NOWRAP><b><?php echo TEXT_OSC_ID; ?> </b></td> <td class="formAreaTitle"><b><font color=blue><?php echo $sInfo-> contrib_osc_id; ?></font></b></td> </tr> <tr class="dataTableRow"> <td class="dataTableContent" NOWRAP><b><?php echo TEXT_NAME_VERSION; ?> </b></td> <td class="formAreaTitle"><b><font color=blue><?php echo $sInfo-> contrib_name; ?></font></b></td> </tr> <tr class="dataTableRow"> <td class="dataTableContent" NOWRAP><b><?php echo TEXT_INFO_SUPPORT; ?> </b></td> <td class="formAreaTitle"><b><font color=blue><?php echo $sInfo->contrib_support; ?></font></b></td> </tr> <tr class="dataTableRowOver"> <td VALIGN="top" class="dataTableContent" NOWRAP><b><?php echo TEXT_CONFIG_COMMENTS; ?> </b></td> <td class="dataTableContent"><?php echo nl2br($sInfo->config_comments); ?></td> </tr> <tr class="dataTableRowOver"> <td class="dataTableContent" NOWRAP><b><?php echo TEXT_INFO_TO_REMEMBER; ?> </b></td> <td class="dataTableContent"><?php echo $sInfo->last_update; ?></td> </tr> <tr class="dataTableRow"> <td class="dataTableContent" NOWRAP><b><?php echo TEXT_INFO_DATE_ADDED; ?> </b></td> <td class="dataTableContent"><?php echo $sInfo->note_created; ?></td> </tr> <tr class="dataTableRowOver"> <td class="dataTableContent" NOWRAP><b><?php echo TEXT_INFO_LAST_MODIFIED; ?> </b></td> <td class="dataTableContent"><?php if ($sInfo->contr_last_modified != '0000-00-00 00:00:00') echo $sInfo->contr_last_modified; ?></td> </tr> <tr class="dataTableRow"> <td class="dataTableContent" NOWRAP><b><?php echo TEXT_INFO_STATUS; ?> </b></td> <td class="dataTableContent"><?php echo $sInfo->status . ': ' . $status_desc; ?></td> </tr> </table> </td> </tr> <tr> <td colspan=3 align="center" class="main"> <br> <?php echo '<a href="' . tep_href_link(FILENAME_CONTRIB_TRACKER, tep_get_all_get_params(array('action', 'sID')) . 'sID=' . $sInfo->contr_id, 'NONSSL') . '">' . tep_image_button('button_back.gif', IMAGE_BUTTON_BACK) . '</a>'; ?> </td> </tr> <?php } // EOF readonly ?> </table> <?php require(DIR_WS_INCLUDES . 'template_bottom.php'); require(DIR_WS_INCLUDES . 'application_bottom.php'); ?> However the call to the function parse_xml (or rather the function itself) interferes with the proper functioning of the BE menu on the left side in osC 2.3.1 (I simply narrowed the problem down by eliminating different sections of the code and subsequent testing). However, I am no professional programmer and any help with fixing the parse_xml / BE menu issue is very welcome. Thanks in advance. Kind regards, Dennis
  20. dennish

    Contribution Tracker

    Just to add some information to my previous post (13/2): I also get e-mail (title: Contrib Tracker Error) with the following contents: Array ( [title] => osCommerce Contributions [language] => en [link] => http://www.oscommerce.com [description] => osCommerce, Sell With Emotion [copyright] => Copyright (c) 2010 osCommerce [managingEditor] => hpdl@[member='oscommerce'].com [image] => Array ( [0] => Array ( [title] => osCommerce [url] => http://www.oscommerce.com/images/oscommerce_88x31.gif [link] => http://www.oscommerce.com ) ) ) In the last couple of days (18/2) I received one normal alert regarding http://addons.oscommerce.com/info/1435, which was updated on 11/2.
  21. dennish

    Contribution Tracker

    Hello Glen, I have used your contribution for some time, which proved to be a great help. Recently I upgraded to version 1.7.18 (my osC is still 2.2rc2a). Now, I am getting this warning in the BE: Warning: Invalid argument supplied for foreach() in oscommerce-2.2rc2a/catalog/admin/contrib_tracker.php on line 119 I assumed this issue was already fixed (See your post of 24 September 2009, 16:07)? Any thoughts? Thanks in advance. Kind regards, Dennis
  22. Hello Jack, I am not familiar with corn jobs te periodically check the status of a website, but this contribution (ContributionTracker: http://addons.oscommerce.com/info/4815) offers an alternative: a site monitoring service, for example Uptime (http://uptime.openacs.org/uptime/). Is it possible to use a site monitoring service for SiteMonitor as well? If not, what changes should I implement to make it work? Best regards, Dennis
  23. I am building a download shop using both the Super Download Shop and Paypal IPN contributions. Dutch (and I assume many other European) tax regulations require subsequent numbering of invoices. I am therefore looking for a contribution that will: 1. Automatically/instantly adjust the invoice number for completed orders (= succesfully paid for by Paypal IPN); 2. Ignore uncompleted/pending orders; Can anyone suggest a suitable contribution for this issue? (Ideally, this contribution should also be able to handle orders created in the admin section as well, without disrupting the subsequent invoice numbering) Thank in advance for any help. Regards, Dennis
  24. dennish

    Download shop - invoice numbers

    Each invoice that the store issues should have a number one higher than the previous one (regardless of who the customer was), and that no invoice numbers should be issued for uncompleted orders.
  25. Dear List, I have implemented the contribution Secure Admin Login - Logout. However I can still go directly to the admin area by typing catalog/admin/ (or catalog/admin/index.php) in my browser, thereby bypassing the login. In my (humble) opinion the index.php file should contain some code to prevent this (redirect to login). Can anyone help? Thanks in advance. Dennis
×