$aErrors = array();
$filename=$oReq->get('vAlias').'/'.str_replace($_CONF['url_dot_replace'],'.',$oReq->get('fAlias'));
$bRssExport=$oReq->get('exportRss');
$aFile=$oExam->oDb->getRow("SELECT v.*, e.code AS code, e.alias AS exam_alias, e.name AS exam_name, e.vendor_id FROM vcefile v, exam e WHERE v.alias LIKE BINARY '".addslashes($filename)."' AND v.is_hidden=0 AND v.exam_id=e.exam_id AND e.is_hidden=0 AND e.is_deleted=0");
if (empty($aFile))
{
include('404.php');
return;
}
$aVendor = $oVendor->getVendor($aFile['vendor_id'], array('is_hidden'=>'=0', 'is_deleted'=>'=0'));
if (!$aVendor)
$oReq->forward301();
if (!empty($bVisitorUsa) && in_array($aFile['vendor_id'],$_CONF['vendor_block_usa']))
{
include('404.php');
return;
}
$sMeclabsPage=$oReq->get('path');
$aFields = array(
'c_name' => array('title'=>"Name", 'def'=>'required'),
'c_email' => array('title'=>'E-mail', 'def'=>'email'),
'c_text' => array('title'=>'Comment', 'def'=>'required'),
'c_code' => array('title'=>'Verification code', 'def'=>'required'),
);
$oValidator = new Validator($aFields);
$iPage = $oReq->get('page', 1);
$iPageSize = 100;
$start=($iPage-1)*$iPageSize;
$vote_result=0;
$vote_message='';
$aNewComment=array('c_name'=>'', 'c_email'=>'', 'c_text'=>'');
switch ($oReq->getAction())
{
case 'vote':
Conf::loadClass('Securimage');
$oImg = new Securimage('FCOMM'.$aFile['id']);//FVOTE
$code=$oReq->get('votecode');
$is_valid = $oImg->check($code);
if ($is_valid)
{
if (!empty($_SERVER['REMOTE_ADDR']))
{
$vote_cnt = $oExam->oDb->countRows("SELECT id FROM vcevote WHERE file_id='".$aFile['id']."' AND ip='".addslashes($_SERVER['REMOTE_ADDR'])."'");
if (empty($vote_cnt))
$oExam->oDb->query("INSERT INTO vcevote (file_id,vote_date,ip) VALUES ('".$aFile['id']."',NOW(),'".addslashes($_SERVER['REMOTE_ADDR'])."')");
}
$vote_result=1;
$vote_message='Your vote has been counted. Thank you.';
}
else
$vote_message='Verification code mismatch. Please try again.';
break;
case 'comment':
if ($oValidator->isValid($oReq->getAll()))
{
Conf::loadClass('Securimage');
$oImg = new Securimage('FCOMM'.$aFile['id']);
$code=$oReq->get('c_code');
$is_valid = $oImg->check($code);
$aNewComment['c_name']=trim($oReq->get('c_name'));
$aNewComment['c_email']=trim($oReq->get('c_email'));
$aNewComment['c_text']=trim($oReq->get('c_text'));
if ($is_valid)
{
empty($_SERVER['REMOTE_ADDR']) ? $temp_ip='' : $temp_ip=addslashes($_SERVER['REMOTE_ADDR']);
$c_id=0;
if (!empty($temp_ip))
{
$ip_no = Dot2LongIP($temp_ip);
$row=$oExam->oDb->getRow("SELECT * FROM ipcountry WHERE " . $ip_no . " <= ipTO LIMIT 1");
$c_id=$oExam->oDb->getField("SELECT id FROM country WHERE code='".$row['countrySHORT']."'");
}
$c_name=addslashes($aNewComment['c_name']);
$c_email=addslashes($aNewComment['c_email']);
$c_text=addslashes($aNewComment['c_text']);
$sql="INSERT INTO vcecomment (id, comment_time, commentator_email, commentator_name, comment_text, ip, country_id, hidden, real_id) VALUES ('', NOW(), '".$c_email."', '".$c_name."', '".$c_text."', '".$temp_ip."', '".$c_id."', '1', '".$aFile['id']."')";
$oExam->oDb->query($sql);
$aNewComment['c_name']='';
$aNewComment['c_email']='';
$aNewComment['c_text']='';
$oReq->forward(Conf::getUrl('member.public.vcefile', array('alias'=>$aFile['alias'])), 'Thank you for submitting comment. Website editor will review it and publish.');
}
else
$aErrors[]='Verification code mismatch. Please try again.';
}
else
{
$aErrors = $oValidator->getErrors();
}
break;
}
$aVendor['alias']=strtolower($aVendor['alias']);
$aFile['size']=$oExam->formatFileSize($aFile['size']);
if (!empty($bRssExport))
{
$aComment=$oExam->oDb->getRows("SELECT v.*, c.name AS country FROM vcecomment v LEFT JOIN country c ON v.country_id=c.id WHERE v.real_id='".$aFile['id']."' AND v.hidden=0 ORDER BY -v.comment_time LIMIT 0,100");
echo ''.$aFile['displayname'].' '.Conf::getUrl('member.public.vcefile',array('alias'=>$aFile['alias'])).''.$aFile['displayname'].' ';
reset($aComment);
foreach ($aComment as $key=>$val)
echo ''.$val['commentator_name'].' '.Conf::getUrl('member.public.vcefile',array('alias'=>$aFile['alias'])).'#comment-'.$val['id'].''.htmlspecialchars(nl2br($val['comment_text'])).' '.date('l, F d, Y g:i A',strtotime($val['comment_time'])).' UT ';
echo ' ';
exit;
}
else
{
$aComment=$oExam->oDb->getRows("SELECT v.*, c.name AS country FROM vcecomment v LEFT JOIN country c ON v.country_id=c.id WHERE v.real_id='".$aFile['id']."' AND v.hidden=0 ORDER BY -v.comment_time LIMIT $start,$iPageSize");
$comment_num=$oExam->oDb->getField("SELECT COUNT(v.id) FROM vcecomment v WHERE v.real_id='".$aFile['id']."' AND v.hidden=0 ORDER BY -v.comment_time");
Conf::loadClass('utils/Pager');
$oPager = new Pager($comment_num, $iPage, $iPageSize, 20);
}
Conf::loadClass('Product');
$oProduct= new Product();
list($aProducts) = $oProduct->getListByExam($aFile['exam_id'], array('in_stock'=>'!=0', 'prod_type'=>"='qa'", 'is_deleted'=>'=0'), 0,0, 'prod_type ASC');
foreach ($aProducts as $key=>$val)
{
$aProducts[$key]['exam_code']=$aFile['code'];
if (!empty($bVisitorUsa))
$aProducts[$key]['price']=$_CONF['usa.individual.price'];
}
$sTitle = Conf::format('title.file', array($aFile['displayname']));
$sDesc = Conf::format('description.file', array($aVendor['name'],$aFile['code'], $aFile['displayname']));
$aPaging=$oPager->getInfoVceFile($filename);
if ($iPage>1)
{
$sTitle.=" - Page $iPage of ".$aPaging['totalPages'];
$sDesc.=" Page $iPage of ".$aPaging['totalPages'];
}
if (!empty($_SERVER['HTTP_REFERER']) && !empty($_SESSION[$_SERVER['HTTP_REFERER']]['err']))
$bShowResult=true;// show result of 'add to cart' submit
else
$bShowResult=false;
$bPremiumA=false;
$bShowGaCode=false;
$oTpl->assign(array(
'aFile' => $aFile,
'aExam' => $aFile,
'aVendor' => $aVendor,
'aExamProducts' => $aProducts,
'bShowResult' => $bShowResult,
'nVoteResult' => $vote_result,
'sVoteMessage' => $vote_message,
'jsValidation' => $oValidator->makeJS(),
'aNewComment' => $aNewComment,
'aErrors' => $aErrors,
'sPageUrl' => Conf::getUrl('member.public.vcefile', array('alias'=>$filename)),
'aPaging' => $aPaging,
'sPageName' => 'vcefile',
'sShowB' => true,// this is the right popup
'bPremiumA' => $bPremiumA,
'bShowGaCode' => $bShowGaCode,
));
$oTpl->assignSrc(array('aComment' => $aComment,));
?>
Exam Collection :: Public
Free Download:
Exam:
Size:
Posted:
Votes:
Download:
Type the characters from the picture.