$category_nm",3,"center","75%");
echo "
| ".$catRow[1]." |
";
hTh("Title");
hTh("Characters");
hTh("Date Written");
echo "";
if ($result=mysql_query($sql)){
while ($row=mysql_fetch_row($result)) {
hRowColor();
//title
hTd("".$row[1]."");
hTd($row[3],"R");
$year=substr($row[2],0,4);
$month=substr($row[2],5,2);
$dt = ($month > 0)? $month."/".$year : $year;
hTd($dt,"C");
echo "\n";
echo "".$row[4]." |
\n";
}
}
echo "";
}
function tableOfContents() {
setTitle("Mystic Writings: Table of Contents");
//todo: change these
setMeta("keywords","enlightenment, zen, sufi, self awareness, zen stories, mystic christianity, mystic dance, mystic dance writings, dances of universal peace, dance book covers, going native, true nature, spiritual awakening, attachment to mind, feeling of separation, waking up, laughter of the gods, awakening, dance, sufism, mysticism, mystic poet, self knowledge, communion with god, sufi stories, zen, teachings of zen, pure awareness, zen stories, truth, god, conversations with god, sannyasin, bhagwan shree rajneesh, osho");
setMeta("description","Mystic dance Storys by Zareen");
displayHead();
$sql="SELECT category_id, category_nm, short_desc
FROM Story_Category
ORDER BY position_id";
echo "| Mystic Writings: Table of Contents |
\n";
echo "| ";
// define your edge cell
// echo "Filler";
echo " | \n";
// the main body of the work.
// About the Storys blurb.
echo " Welcome to the Mystic Stories. This is an archive of Stories written over
the past 15 years ";
echo "\n\n";
if ($result=mysql_query($sql)) {
while ($row=mysql_fetch_row($result)) {
// category name
if ($row[0] != "")
$StoryCnt=sqlValue("SELECT count(*) FROM Story WHERE category_id=".$row[0]);
echo " - ".$row[1]."\n";
echo " ($StoryCnt Storys)
".$row[2]." ";
}
}
echo " ";
// close the outer table.
echo " |
";
}
function listAll(){
setTitle("Mystic Storys");
setMeta("keywords","Pensees mystique");
setMeta("description","Mystic dance Storys by zareen");
displayHead();
$hold_id="";
$sql="SELECT Story_id,title_nm,Story_dt,category_id,Story_desc, length(html)
FROM Story ORDER BY category_id, title_nm";
hTable("Storys",2);
hTh("Title");
hTh("Date Written");
echo "";
if ($result=mysql_query($sql)){
while ($row=mysql_fetch_row($result)) {
//break on category name
if ($row[3] != $hold_id){
$hold_id=$row[3];
$category_nm=sqlValue("SELECT category_nm FROM Story_Category WHERE category_id=$hold_id");
echo "| $category_nm |
";
}
hRowColor();
//title
hTd("".$row[1]." (".$row[5]." bytes)");
hTd(dtFmt($row[2]));
echo "\n";
}
}
echo "";
}
function recentStorys(){
setTitle("Mystic Storys");
setMeta("keywords","Pensees mystique");
setMeta("description","New mystic dance storys by Zareen");
displayHead();
$hold_id="";
$sql="SELECT a.Story_id, a.title_nm, a.Story_dt, a.category_id, c.category_nm, a.Story_desc
FROM Story a, Story_Category c
WHERE a.category_id = c.category_id
ORDER BY Story_dt DESC LIMIT 20";
hTable("Storys",3,"center","75%");
hTh("Title");
hTh("Category");
hTh("Date Written");
echo "";
if ($result=mysql_query($sql)){
while ($row=mysql_fetch_row($result)) {
hRowColor();
//title
hTd("".$row[1]."");
// category goes to category page
hTd("".$row[4]."");
$year=substr($row[2],0,4);
$month=substr($row[2],5,2);
$dt = ($month > 0)? $month."/".$year : $year;
hTd($dt,"C");
echo "\n";
echo "".$row[5]." |
\n";
}
}
echo "";
}
function showStory($Story_id) {
// must supply an Story id.
$Story_id = nvl($Story_id,3);
$sql="SELECT a.Story_id, a.title_nm, a.Story_dt, a.category_id, c.category_nm,
a.Story_desc, a.html, c.background_img, c.cell_html,c.keywords
FROM Story a, Story_Category c
WHERE a.category_id = c.category_id
and Story_id=$Story_id";
$row=sqlRow($sql);
$Story_id = $row[0];
$title_nm = $row[1];
$category_id= $row[3];
$category_nm= $row[4];
$Story_desc=$row[5];
$html = $row[6];
if ($row[7]=="") $background=""; else $background=" background=".$row[7];
$cell_html = $row[8];
setTitle("Mystic Dance ".$category_nm." by Zareen");
setMeta("keywords",nvl($row[9],$title_nm));
setMeta("description",$Story_desc);
displayHead();
msgHTML();
$year=substr($row[2],0,4);
$month=substr($row[2],5,2);
$dt = ($month > 0)? $month."/".$year : $year;
$edLink="";
if (hasAccess())
$edLink="edit";
echo "| $title_nm |
| $cell_html |
$html
Go back to the $category_nm list.
Please Leave A Comment
";
$sql = "SELECT comment_id, comment_dt, reader, comment_subject, comment
FROM Story_Comment
WHERE Story_id = $Story_id
ORDER BY comment_id
LIMIT 10";
if ($result=mysql_query($sql)) {
while ($row=mysql_fetch_row($result)) {
if (hasAccess()) {
$delLink=" delete";
}
echo " Reader: ".$row[2]." on ".dtFmt($row[1]).$delLink." ";
echo "".$row[3]." ";
echo $row[4]." ";
}
}
echo " |
";
}
function deleteComment($comment_id) {
if (!hasAccess()) {
msgNoteError("You do not have access to this function.");
} elseif ($comment_id=="") {
msgNoteError("You must call this function with a comment.");
} else {
$Story_id=sqlValue("SELECT Story_id FROM Story_Comment WHERE comment_id=$comment_id");
if ($Story_id=="") {
msgNoteError("$comment_id is an invalid comment id.");
} else {
execSQL("DELETE FROM Story_Comment WHERE comment_id=$comment_id","Deleted Comment $comment_id.","deleting comment.");
}
}
return $Story_id;
}
function addComment($Story_id,$reader,$comment_subject,$comment) {
msgNotNull($Story_id,"Story ID");
$reader=htmlentities(substr(addslashes(nvl($reader,"Anonymous")),0,90));
$subject=htmlentities(substr(addslashes(nvl($reader,"My Comment")),0,90));
$comment=nl2br(htmlentities(substr(addslashes($comment),0,4000)));
if (!hasErrors()) {
$comment_id=execSQL("INSERT INTO Story_Comment (Story_id,comment_dt,reader,comment_subject,comment)
VALUES ('$Story_id',now(),'$reader','$comment_subject','$comment')","Added Comment","adding comment","Y");
}
}
function recentComments() {
displayHead();
$sql="SELECT concat('',a.title_nm,'') Story,
b.category_nm Category,
c.comment_subject Comment,
c.reader Reader,
date_format(c.comment_dt,'%m/%e/%y') Date
FROM Story a, Story_Comment c, Story_Category b
WHERE c.Story_id = a.Story_id
and a.category_id = b.category_id
ORDER BY comment_id DESC
LIMIT 100";
echo "| This report shows the recent
comments by users. We added this report to make it easier for us to read the Story comments. |
\n";
sqlTable("All User Comments","center",$sql);
}
// main program
if ($btn=="recent") {
recentStorys();
} elseif ($btn=="all") {
listAll();
} elseif ($btn=="cat") {
listCategory($category_id);
} elseif ($btn==LEAVE_COMMENT_BTN) {
$comment_id=addComment($Story_id,$reader,$comment_subject,$comment);
showStory($Story_id);
} elseif ($btn=="delc") {
$Story_id=deleteComment($comment_id);
if ($Story_id>0) {
showStory($Story_id);
} else {
listAll();
}
} elseif ($btn=="listcomments") {
recentComments();
} else {
if ($Story_id=="") {
tableOfContents();
} else {
showStory($Story_id);
}
}
echo "
Table of Contents
- - All
- - Recent Comments
- - New Storys
- - Mystic Dance
";
displayFoot();
echo "
";
?>