foreach($_REQUEST as $k => $v) ${$k} = $v;
$months = array('01'=>'كانون2','02'=>'شباط','03'=>'آذار','04'=>'نيسان','05'=>'أيار','06'=>'حزيران',
'07'=>'تموز','08'=>'آب','09'=>'أيلول','10'=>'تشرين1','11'=>'تشرين2','12'=>'كانون1');
include("admin/config.php");
mysql_connect($DBHost,$DBUser,$DBPass) or die(mysql_error());
mysql_select_db($DBName) or die(mysql_error());
mysql_query("UPDATE Courses SET Hits=Hits+1 WHERE CrsID='$CrsID'") or die(mysql_error());
$result = mysql_query("SELECT * FROM Courses WHERE CrsID='$CrsID'") or die(mysql_error());
$row = mysql_fetch_row($result);
$CatID = stripslashes($row[0]);
$Type = stripslashes($row[1]);
$Title = stripslashes($row[2]);
$Details = stripslashes($row[3]);
$UID = intval($row[4]);
$SDate = stripslashes($row[5]);
$EDate = stripslashes($row[6]);
$AllowCmnts = stripslashes($row[7]);
$ShowCmnts = stripslashes($row[8]);
$PublicCmnts = stripslashes($row[9]);
$Hits = intval($row[10]);
$Rating = stripslashes($row[11]);
$Votes = stripslashes($row[12]);
$Accepted = stripslashes($row[13]);
$CrsID = stripslashes($row[14]);
$subCatID = stripslashes($row[15]);
$result1 = mysql_query("SELECT CUID FROM CoursesUsers WHERE CrsID='$CrsID' AND UID='$LUID' AND Inst='N'") or die(mysql_error());
$row1 = mysql_fetch_row($result1);
$CrsStd = intval($row1[0]);
$result1 = mysql_query("SELECT CUID FROM CoursesUsers WHERE CrsID='$CrsID' AND UID='$LUID' AND Inst='Y'") or die(mysql_error());
$row1 = mysql_fetch_row($result1);
$CrsInst = intval($row1[0]);
$result1 = mysql_query("SELECT Value FROM Configs WHERE Name='OLMinutes'") or die(mysql_error());
$row1 = mysql_fetch_row($result1);
$OLMinutes = stripslashes($row1[0]);
$OLMinutes = $OLMinutes * 60;
$result1 = mysql_query("SELECT COUNT(DISTINCT UID) FROM Chat WHERE CatID='$CrsID' AND TIME_TO_SEC(TIMEDIFF(NOW(),Sent))<='$OLMinutes'") or die(mysql_error());
$row1 = mysql_fetch_row($result1);
$LoggedHere = intval($row1[0]);
$NowDate = date("Y-m-d",time());
if ($NowDate >= $SDate )
$Started = 1;
else
$Started = 0;
$DateArr = explode(" ", $SDate);
list($Y,$M,$D)= explode("-",$DateArr[0]);
$SFinalDate = $D.'-'.$months[$M].'-'.$Y;
if ( !@checkdate($M,$D,$Y) )
$SFinalDate = "(يتم تحديده لاحقاً)";
$DateArr = explode(" ", $EDate);
list($Y,$M,$D)= explode("-",$DateArr[0]);
$EFinalDate = $D.'-'.$months[$M].'-'.$Y;
if ( !@checkdate($M,$D,$Y) )
$EFinalDate = "(يتم تحديده لاحقاً)";
$result = mysql_query("SELECT * FROM CoursesCats WHERE CatID='$CatID'") or die(mysql_error());
$row = mysql_fetch_row($result);
$Category = stripslashes($row[0]);
$CatDetails = stripslashes($row[1]);
$ReqLogin = stripslashes($row[2]);
$ReqAdmin = stripslashes($row[3]);
$CatID = intval($row[4]);
if ( $qq == 'N' )
$GoBack="courses4v.php?CatID=$CatID&pg=$opg";
elseif ($subCatID <= '3' )
$GoBack="courses.php?CatID=$CatID&subCatID=$subCatID&Y=$Year&Or=$Or&pg=$opg";
else
$GoBack="coursesy.php?CatID=$CatID&subCatID=$subCatID&Y=$Year";
//if ( $ReqLogin=='Y' || $LUID )
// include("uauth.php");
//$result = mysql_query("SELECT CAID FROM CrssCatsAdmins WHERE CatID='$CatID' AND UID='$LUID'") or die(mysql_error());
//$row = mysql_fetch_row($result);
//$AdminHere = intval($row[0]);
$query = "SELECT Value FROM Configs WHERE Name='CmntPerPage'";
$result = mysql_query($query) or die(mysql_error());
$row = mysql_fetch_row($result);
$CmntPerPage = $row[0];
if ( $Action=="AddComments" )
{
if ( !$CmntTitle )
$err_msg .= "
يرجى إضافة عنوان التعليق";
if ( !$CmntDetails )
$err_msg .= "يرجى إضافة تفاصيل التعليق";
if ( !$CmntName && !$LUID && $PublicCmnts=='Y' )
$err_msg .= "يرجى إضافة الاسم";
if ( !$CmntEMail && !$LUID && $PublicCmnts=='Y' )
$err_msg .= "يرجى إضافة عنوان البريد الالكتروني";
if ( !$err_msg )
{
$CmntTitle = addslashes($CmntTitle);
$CmntDetails = addslashes($CmntDetails);
if ( !$LUID && $PublicCmnts=='Y' )
{
$CmntName = addslashes($CmntName);
$CmntEMail = addslashes($CmntEMail);
}
$CmntAccepted = 'N';
if ($AdminHere || ($LUID && $LCrsCmnt=='Y') )
$CmntAccepted = 'Y';
//ArtID,Title,Details,UID,Name,EMail,Date,CmntID
mysql_query("INSERT INTO CoursesCmnts VALUES('$CrsID','$CmntTitle','$CmntDetails','$LUID','$CmntName','$CmntEMail',now(),'$CmntAccepted','')") or die(mysql_error());
Header("Location: coursedtls.php?CrsID=$CrsID&opg=$opg#cmnts");
}
}
include("head.php");
//$CrsID = intval($row[12]);
if (!$UID)
$Submitter="مدير الموقع";
else
{
$result1 = mysql_query("SELECT Username,FirstName,LastName FROM Users WHERE UID='$UID'") or die(mysql_error());
$row1 = mysql_fetch_row($result1);
//$Submitter= " ".stripslashes($row1[0])." (".stripslashes($row1[1])." ".stripslashes($row1[2]).")";
$Submitter= stripslashes($row1[0]);
}
$resultimg = mysql_query("SELECT PID FROM CoursesImgs WHERE CrsID='$CrsID'") or die(mysql_error());
$rowimg = mysql_fetch_row($resultimg);
$PID = intval($rowimg[0]);
if ($AdminHere)
$What2Show = "";
else
$What2Show = "AND Accepted='Y'";
$result = mysql_query("SELECT COUNT(*) FROM CoursesCmnts WHERE CrsID='$CrsID' $What2Show") or die(mysql_error());
$row = mysql_fetch_row($result);
$Cmnts = intval($row[0]);
$result = mysql_query("SELECT subCategory FROM CoursessubCats WHERE subCatID='$subCatID'") or die(mysql_error());
$row = mysql_fetch_row($result);
$subCategory = stripslashes($row[0]);
?>
|
|
( قراءة)
من إلى
|
if (!$CrsStd && !$CrsInst && !$Started)
// echo " سجل في هذه الدورة ";
if ($CrsStd || $CrsInst || $AdminHere)
{
echo "| دردشة ";
echo "($LoggedHere) ";
echo "| ملفات الدورة";
}
echo "";
if ($AdminHere || $ShowCmnts=='Y')
echo "التعليقات ($Cmnts) | ";
if ($AdminHere || ($AllowCmnts=='Y' && ($LUID || $PublicCmnts=='Y')) )
echo "إضافة تعليق | ";
?>
عـودة
|
|
|
$brcnt=0;
do
{
if ( $PID )
{
$brcnt++;
if ($brcnt%3==1)
echo "";
$PID = intval($rowimg[0]);
echo "";
echo " | ";
if ($brcnt%3==0)
echo " ";
}
}while ($rowimg = mysql_fetch_row($resultimg))
?>
|
|
|
$pgs = ceil($Cmnts/$CmntPerPage);
if ($pg>$pgs) $pg--;
if ( !$pg ) $pg = 1;
$nextpg = $pg+1;
$prevpg = $pg-1;
$end = $pg * $CmntPerPage;
$start = $end - $CmntPerPage +1;
if ( $end > $Cmnts ) $end = $Cmnts;
if ($AdminHere || $ShowCmnts=='Y')
{
?>
التعليقات
(- من أصل }?> تعليق)
السابق }?>
التالي }?>
}
if($AdminHere)
echo " التعليقات للمراجعة ذات خلفية وردية";
?>
|
|
|
$SQLSTART = $start-1;
//ArtID,Title,Details,UID,Name,EMail,Date,CmntID
$result = mysql_query("SELECT Title,Details,UID,Name,EMail,Date,CmntID,Accepted FROM CoursesCmnts WHERE CrsID='$CrsID' $What2Show Order By Date LIMIT $SQLSTART,$CmntPerPage") or die(mysql_error());
while ($row = mysql_fetch_row($result))
{
$Title = stripslashes($row[0]);
$Details = stripslashes($row[1]);
$UID = intval($row[2]);
$Name = stripslashes($row[3]);
$EMail = stripslashes($row[4]);
$Date = stripslashes($row[5]);
$CmntID = intval($row[6]);
$Accepted = stripslashes($row[7]);
$Details = nl2br($Details);
if ($UID)
{
$result1 = mysql_query("SELECT Username,FirstName,LastName FROM Users WHERE UID='$UID'") or die(mysql_error());
$row1 = mysql_fetch_row($result1);
$Submitter= stripslashes($row1[0]);
}
elseif ($Name)
$Submitter= "زائر: ".$Name;
else
$Submitter="مدير الموقع";
$DateArr = explode(" ", $Date);
list($Y,$M,$D)= explode("-",$DateArr[0]);
$FinalDate = $D.'-'.$months[$M].'-'.$Y;
?>
">
(أضيف في من قبل ) | |
|
if($AdminHere)
{
echo "";
if($Accepted=='N')
{
echo "قبول | ";
echo "رفض |";
}
?>
تعديل | حذف
|
}?>
|
|
}
?>
|
}
if ( $AdminHere || ($AllowCmnts=='Y' && ($LUID || $PublicCmnts=='Y')) )
{
?>
|
}
?>
|
include("tail.php")
?>