Go to the documentation of this file.00001 <?php
00002 if(!defined('__PRAGYAN_CMS'))
00003 {
00004 header($_SERVER['SERVER_PROTOCOL'].' 403 Forbidden');
00005 echo "<h1>403 Forbidden<h1><h4>You are not authorized to access the page.</h4>";
00006 echo '<hr/>'.$_SERVER['SERVER_SIGNATURE'];
00007 exit(1);
00008 }
00015 class scrolltext implements module{
00016 private $userId;
00017 private $moduleComponentId;
00018 private $action;
00019 private $scrollarticle;
00020
00021 public function getHtml($gotuid, $gotmoduleComponentId, $gotaction) {
00022 $this->userId = $gotuid;
00023 $this->moduleComponentId = $gotmoduleComponentId;
00024 $this->action = $gotaction;
00025 include "article.lib.php";
00026 $this->scrollarticle = new article();
00027 if ($this->action == "view")
00028 return $this->actionView();
00029 if ($this->action == "scrollview")
00030 return $this->actionScrollview();
00031 if ($this->action == "edit")
00032 return $this->actionEdit();
00033 }
00034
00035 public function actionScrollview($text="") {
00036 if($text=="") {
00037 $query = "SELECT article_modulecomponentid FROM scrolltext WHERE page_modulecomponentid=". $this->moduleComponentId;
00038 $result = mysql_query($query);
00039 $row = mysql_fetch_assoc($result);
00040 $articleid=$row['article_modulecomponentid'];
00041 $query = "SELECT article_content,article_lastupdated FROM article_content WHERE page_modulecomponentid=" . $articleid;
00042 $result = mysql_query($query);
00043 if($row = mysql_fetch_assoc($result)) {
00044 $text = $row['article_content'];
00045 global $PAGELASTUPDATED;
00046 $PAGELASTUPDATED = $row['article_lastupdated'];
00047 }
00048 else return "Article not yet created.";
00049 }
00050 $content="<HEAD><META HTTP-EQUIV=REFRESH CONTENT=300></HEAD><body><div><div align=\"center\"><fieldset><marquee behavior=scroll scrollAmount=\"1\" scrolldelay=\"0\" onmouseover=\"this.stop()\" direction=\"up\" onmouseout=\"this.start()\" vspce=\"800px\"style=\"height:800px;width:800px;font-size:15px;color:#880000;\">".$text."</div></fieldset></marquee></body>";
00051 global $sourceFolder;
00052 global $moduleFolder;
00053 require_once($sourceFolder."/latexRender.class.php");
00054 if (get_magic_quotes_gpc())
00055 $content = stripslashes($content);
00056 $render = new latexrender();
00057 echo $render->transform($content);
00058 disconnect();
00059 exit();
00060 }
00061
00062 public function actionEdit(){
00063
00064 $query = "SELECT article_modulecomponentid FROM scrolltext WHERE page_modulecomponentid=". $this->moduleComponentId;
00065 $result = mysql_query($query);
00066 $row = mysql_fetch_assoc($result);
00067 $articleId=$row['article_modulecomponentid'];
00068 return $this->scrollarticle->getHtml($this->userId,$articleId,"edit");
00069 }
00070 public function actionView(){
00071
00072 $query = "SELECT article_modulecomponentid FROM scrolltext WHERE page_modulecomponentid=". $this->moduleComponentId;
00073 $result = mysql_query($query);
00074 $row = mysql_fetch_assoc($result);
00075 $articleId=$row['article_modulecomponentid'];
00076 return $this->scrollarticle->getHtml($this->userId,$articleId,"view");
00077 }
00078
00079 public function createModule(&$moduleComponentId) {
00080 include "article.lib.php";
00081 $article = new article();
00082 $newModuleComponentId=-1;
00083 $article->createModule($newModuleComponentId);
00084 if($newModuleComponentId==-1)
00085 displayerror("Unable to create a new page of type $moduleType");
00086 else {
00087 $articleId = $newModuleComponentId;
00088 $query = "SELECT MAX(page_modulecomponentid) as MAX FROM `scrolltext` ";
00089 $result = mysql_query($query) or die(mysql_error());
00090 $row = mysql_fetch_assoc($result);
00091 $scrollId = $row['MAX'] + 1;
00092
00093 $query= "INSERT INTO `scrolltext` (`page_modulecomponentid` ,`article_modulecomponentid`)VALUES ('$scrollId','$articleId')";
00094 $result = mysql_query($query) or die(mysql_error());
00095 if (mysql_affected_rows()) {
00096 $moduleComponentId = $scrollId;
00097 return true;
00098 } else
00099 return false;
00100 }
00101 }
00102
00103 public function deleteModule($moduleComponentId) {
00104 echo $this->moduleComponentId;
00105 $query = "SELECT article_modulecomponentid FROM scrolltext WHERE page_modulecomponentid=". $moduleComponentId;
00106 echo $query;
00107 $result = mysql_query($query);
00108 $row = mysql_fetch_assoc($result);
00109 $articleId=$row['article_modulecomponentid'];
00110
00111 $query = "DELETE FROM `article_content` WHERE `page_modulecomponentid`=$articleId";
00112 $result = mysql_query($query);
00113 if ((mysql_affected_rows()) >= 1)
00114 return true;
00115 else
00116 return false;
00117
00118 }
00119 public function copyModule($moduleComponentId) {
00120 $query = "SELECT article_modulecomponentid FROM scrolltext WHERE page_modulecomponentid=". $this->moduleComponentId;
00121 $result = mysql_query($query);
00122 $row = mysql_fetch_assoc($result);
00123 $articleId=$row['article_modulecomponentid'];
00124
00125 $query = "SELECT * FROM `article_content` WHERE `page_modulecomponentid`=$articleId";
00126 $result = mysql_query($query);
00127 $content = mysql_fetch_assoc($result);
00128
00129 $query = "SELECT MAX(page_modulecomponentid) as MAX FROM `article_content` ";
00130 $result = mysql_query($query) or displayerror(mysql_error() . "article.lib L:98");
00131 $row = mysql_fetch_assoc($result);
00132 $compId = $row['MAX'] + 1;
00133
00134 $query = "INSERT INTO `article_content` (`page_modulecomponentid` ,`article_content`)VALUES ('$compId', '".mysql_escape_string($content['article_content'])."')";
00135 mysql_query($query) or displayerror(mysql_error()."article.lib L:104");
00136
00137 $query = "SELECT MAX(page_modulecomponentid) as MAX FROM `scrolltext` ";
00138 $result = mysql_query($query) or displayerror(mysql_error());
00139 $row = mysql_fetch_assoc($result);
00140 $scrollId = $row['MAX'] + 1;
00141
00142 $query = "INSERT INTO `scrolltext` (`page_modulecomponentid` ,`article_modulecomponentid`)VALUES ('$scrollId', '$compId')";
00143 mysql_query($query) or displayerror(mysql_error());
00144
00145 if (mysql_affected_rows()) {
00146 return $scrollId;
00147 } else
00148 return false;
00149 }
00150
00151
00152
00153 }
00154