Time(date-year) is wrong in this code. please help
Code:
<?/*
* $Id: combomax.php
*/?><?php
defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' );
require_once( $mainframe->getPath( 'front_html' ) );
require_once( $mainframe->getPath( 'class' ) );
require_once("includes/patTemplate/patTemplate.php");
$mainframe->setPageTitle('Comment on article');
$tmpl = new patTemplate();
$tmpl->setBasedir("components/com_combomax/templates/");
$tmpl->setNameSpace('pxt');
$task = mosGetParam($_REQUEST,'task','');
$page = mosGetParam($_REQUEST,'page','');
switch ($task) {
case "save":
saveComment($database, $tmpl);
break;
case "preview":
PreviewComments($database, $tmpl);
break;
case "sendreport":
sendreport($database, $tmpl);
break;
default:
break;
}
switch ($page) {
case "reportComment":
reportComment($database);
break;
}
function PreviewComments($database, $tmpl) {
global $mosConfig_offset;
$tmpl->readTemplatesFromFile("previewcomments.tpl");
$name = mosGetParam($_POST,'name','');
$email = mosGetParam($_POST,'email','');
$url = mosGetParam($_POST,'url','');
// look for images in template if available
$starImageOn = mosAdminMenus::ImageCheck( 'rating_star.png', '/images/M_images/' );
$starImageOff = mosAdminMenus::ImageCheck( 'rating_star_blank.png', '/images/M_images/' );
$row->rating = mosGetParam($_POST,'user_rating','');
$img = "";
for ($i=0; $i < $row->rating; $i++) {
$img .= $starImageOn;
}
for ($i=$row->rating; $i < 5; $i++) {
$img .= $starImageOff;
}
$html = '<span class="content_rating">';
$html .= $img;
$html .= "</span>";
$tmpl->addVar("previewForm", 'ratingimage', $html);
$comment = mosGetParam($_POST,'comment','');
$comment = mosHTML::cleanText($comment);
$comment = smile::smileReplace($comment);
$comment = replace_linebreaks($comment);
$comment = stripslashes($comment);
$rawcomment = mosGetParam($_POST,'comment','');
$rawcomment = mosHTML::cleanText($rawcomment);
$rawcomment = replace_linebreaks($rawcomment);
$rawcomment = stripslashes(stripslashes($rawcomment));
$tmpl->addVar("previewForm", 'name', stripslashes(mosGetParam($_POST,'name','')));
$tmpl->addVar("previewForm", 'contentid', stripslashes(mosGetParam($_POST,'contentid','')));
$tmpl->addVar("previewForm", 'email', stripslashes(mosGetParam($_POST,'email','')));
$tmpl->addVar("previewForm", 'url', stripslashes(mosGetParam($_POST,'url','')));
$tmpl->addVar("previewForm", 'comment', $comment);
$tmpl->addVar("previewForm", 'rawcomment', ($rawcomment));
$tmpl->addVar("previewForm", 'ip', stripslashes(mosGetParam($_SERVER,'REMOTE_ADDR','')));
$tmpl->addVar("previewForm", 'browser', stripslashes(mosGetParam($_SERVER,'HTTP_USER_AGENT','')));
$tmpl->addVar("previewForm", 'user_rating', stripslashes(mosGetParam($_POST,'user_rating','')));
$tmpl->addVar("previewForm", 'vote'.$row->rating, " checked=\"checked\" ");
$d = date( "Y-m-d H:i:s" );
$d = mosFormatDate( $d, '%Y-%m-%d %H:%M:%S', -$mosConfig_offset * 60 * 60 );
$tmpl->addVar("previewForm", 'date', $d);
$tmpl->parseTemplate("previewForm");
$tmpl->displayParsedTemplate("previewForm") ;
}
function saveComment($database, $tmpl) {
global $my, $mosConfig_offset, $maxLanguage, $mosConfig_live_site, $mainframe;
$maxConfig = new maxConfig();
$row = new mosComment($database);
$_contentid = mosGetParam($_POST,'contentid','');
$row->bind($_POST);
$comment =$row->comment;
$comment = addslashes($comment);
$row->comment = $comment;
$row->myid = $my->id;
$row->state = $maxConfig->auto_publish;
$row->approved = $maxConfig->auto_approve;
$row->ip = mosGetParam($_SERVER,'REMOTE_ADDR','');
$row->browser = mosGetParam($_SERVER,'HTTP_USER_AGENT','');
$d = date( "Y-m-d H:i:s" );
$row->date = mosFormatDate( $d, '%Y-%m-%d %H:%M:%S', -$mosConfig_offset * 60 * 60 );
$row->store();
$subject = $maxLanguage->EMAIL_SUBJECT_ADMIN_ALERT;
$tmpl = new patTemplate();
$tmpl->setBasedir("components/com_combomax/templates/");
$tmpl->setNameSpace('pxt');
$tmpl->readTemplatesFromFile("showcomment.tpl");
$tmpl->addVar("emailcomment", "NAME", stripslashes(stripslashes($row->name)));
$tmpl->addVar("emailcomment", 'email', stripslashes($row->email));
$tmpl->addVar("emailcomment", 'url', stripslashes($row->url));
$tmpl->addVar("emailcomment", 'comment', smile::smileReplace(stripslashes(stripslashes($row->comment))));
$tmpl->addVar("emailcomment", 'ip', stripslashes($row->ip));
$tmpl->addVar("emailcomment", 'browser', stripslashes($row->browser));
$tmpl->addVar("emailcomment", 'date', stripslashes($row->date));
$tmpl->addVar("emailcomment", 'reporturl', 'index.php?option=com_combomax&page=reportComment&commentid='.$row->id.'');
$tmpl->addVar("emailcomment", 'livesite', $mosConfig_live_site);
$tmpl->addVar("emailcomment", 'template', $mainframe->getTemplate());
$tmpl->addVar("emailcomment", 'contenttitle', getContentTitle($row->contentid));
$tmpl->addVar("emailcomment", 'linktocontent', $mosConfig_live_site.'/index.php?option=com_content&task=view&Itemid=1&id='.$row->contentid);
$tmpl->parseTemplate("emailcomment");
$message = $tmpl->getParsedTemplate("emailcomment");
// SEND Email to admins
if ($maxConfig->alert_admin == 1) {
$database->setQuery( "SELECT name, email FROM #__users"
."\n WHERE LOWER(usertype)='superadministrator' OR LOWER(usertype)='super administrator'" );
$rows = $database->loadObjectList();
foreach ($rows as $row){
$adminName = $row->name;
$adminEmail = $row->email;
mosMail($adminEmail, $adminName, $adminEmail, $subject, $message,1);
}
}
// Send emails to subscribed Users
if ($maxConfig->alert_users == 1) {
$database->SetQuery("SELECT email from #__combomax WHERE subscribe = 1 AND contentid = ".$_contentid);
$rows = $database->loadobjectlist();
foreach ($rows as $row){
mosMail($adminEmail,$adminName,$row->email,$subject,$message,1);
}
}
//record vote
$user_rating = mosGetParam($_REQUEST,'user_rating',null);
if ($user_rating){
comment_recordVote($user_rating,$_contentid,$database);
}
mosRedirect(sefRelToAbs('index.php?option=com_content&task=view&id='.$_contentid.'#read-comments'),'Comment Saved');
}
function reportComment($database){
$commentid = mosGetParam($_REQUEST,'commentid','');
$tmpl = new patTemplate();
$tmpl->setBasedir("components/com_combomax/templates/");
$tmpl->setNameSpace('pxt');
$tmpl->readTemplatesFromFile("showcomment.tpl");
$database->SetQuery("SELECT * from #__combomax WHERE id ='".$commentid."'");
$rows = $database->loadObjectList();
$row = $rows[0];
$tmpl->addVar("showcomment", "NAME", stripslashes(stripslashes($row->name)));
$tmpl->addVar("showcomment", 'email', stripslashes($row->email));
$tmpl->addVar("showcomment", 'url', stripslashes($row->url));
$tmpl->addVar("showcomment", 'comment', smile::smileReplace(stripslashes(stripslashes($row->comment))));
$tmpl->addVar("showcomment", 'ip', stripslashes($row->ip));
$tmpl->addVar("showcomment", 'browser', stripslashes($row->browser));
$tmpl->addVar("showcomment", 'date', stripslashes($row->date));
$tmpl->addVar("showcomment", 'reporturl', 'index.php?option=com_combomax&page=reportComment&commentid='.$row->id.'');
$tmpl->parseTemplate("showcomment");
$commentHTML = $tmpl->getParsedTemplate("showcomment");
$tmpl->readTemplatesFromFile("reportcomment.tpl");
$tmpl->addVar("reportcomment", 'comment_to_report', $commentHTML);
$tmpl->addVar("reportcomment", 'commentid', $commentid);
$tmpl->displayParsedTemplate("reportcomment");
}
function sendreport($database, $tmpl){
global $maxLanguage, $mosConfig_live_site, $mainframe;
$subject = $maxLanguage->EMAIL_SUBJECT_REPORTED_COMMENT;
$commentid = mosGetParam($_REQUEST,'commentid','');
$row = new mosComment($database);
$row->load($commentid);
$tmpl = new patTemplate();
$tmpl->setBasedir("components/com_combomax/templates/");
$tmpl->setNameSpace('pxt');
$tmpl->readTemplatesFromFile("reportcomment.tpl");
$tmpl->addVar("reportcommentemail", "NAME", stripslashes(stripslashes($row->name)));
$tmpl->addVar("reportcommentemail", 'email', stripslashes($row->email));
$tmpl->addVar("reportcommentemail", 'url', stripslashes($row->url));
$tmpl->addVar("reportcommentemail", 'comment', smile::smileReplace(stripslashes(stripslashes($row->comment))));
$tmpl->addVar("reportcommentemail", 'ip', stripslashes($row->ip));
$tmpl->addVar("reportcommentemail", 'browser', stripslashes($row->browser));
$tmpl->addVar("reportcommentemail", 'date', stripslashes($row->date));
$tmpl->addVar("reportcommentemail", 'reporturl', 'index.php?option=com_combomax&page=reportComment&commentid='.$row->id.'');
$tmpl->addVar("reportcommentemail", 'livesite', $mosConfig_live_site);
$tmpl->addVar("reportcommentemail", 'template', $mainframe->getTemplate());
$tmpl->addVar("reportcommentemail", 'contenttitle', getContentTitle($row->contentid));
$tmpl->addVar("reportcommentemail", 'linktocontent', $mosConfig_live_site.'/index.php?option=com_content&task=view&Itemid=1&id='.$row->contentid);
$tmpl->addVar("reportcommentemail", 'reportersname', mosGetParam($_REQUEST,'name',''));
$tmpl->addVar("reportcommentemail", 'reportersemail', mosGetParam($_REQUEST,'email',''));
$tmpl->addVar("reportcommentemail", 'reportersreason', mosGetParam($_REQUEST,'reason',''));
$tmpl->parseTemplate("reportcommentemail");
$message = $tmpl->getParsedTemplate("reportcommentemail");
// SEND Email to admins
$database->setQuery( "SELECT name, email FROM #__users"
."\n WHERE usertype='superadministrator' OR usertype='Super
}
?>
this code says 2003-04-05 07:34
how to solve this problem.
how to year-date-time get server in this code.
please help me