Example #1
0
 $i++;
 if ($i > 20) {
     break;
 }
 //printc("<table><tr><td>";
 if ($o->canview()) {
     //get type of content
     $oType = preg_replace('/[^a-z0-9_-]/i', '', $o->getField("type"));
     $incfile = "output_modules/rss/" . $oType . ".inc.php";
     ob_start();
     include $incfile;
     $description = ob_get_contents();
     ob_end_clean();
     $description = str_replace("\n", "", $description);
     $description = str_replace("\r", "", $description);
     $tags = get_record_tags($o->getField("id"));
     print "\t\t<item>\n";
     if ($o->getField("title")) {
         $title = $o->getField("title");
     } else {
         $title = strip_tags($description);
         if (strlen($title) > 25) {
             $title = substr($title, 0, 25) . "...";
         }
     }
     print "\t\t\t<title>" . htmlspecialchars($title, ENT_QUOTES) . "</title>\n";
     $storylink = "&amp;story=" . $o->getField("id") . "&amp;detail=" . $o->getField("id");
     print "\t\t\t<link>" . $link . $sectionlink . $pagelink . $storylink . "</link>\n";
     print "\t\t\t<guid isPermaLink=\"true\">" . $link . $sectionlink . $pagelink . $storylink . "</guid>\n";
     print "\t\t\t<pubDate>";
     print date("D, j M Y G:i:s O", strtotime(timestamp2usdate($o->getField("addedtimestamp"))));
Example #2
0
 function copyObj(&$newParent, $removeOrigional = 1, $keepaddedby = 0, $copyDiscussions = TRUE)
 {
     $_a = array("site" => 3, "section" => 2, "page" => 1, "story" => 0);
     // check that the newParent can be a parent
     $thisClass = get_class($this);
     $parentClass = get_class($newParent);
     /* 		print $this->id."$thisClass - $parentClass<br />"; */
     if (!($_a[$parentClass] - 1 == $_a[$thisClass])) {
         return 0;
     }
     $this->fetchDown(1);
     /* 		print "<br /><br />Copying $thisClass ".$this->getField("title")." <br />"; */
     if ($thisClass == 'section') {
         $owning_site = $newParent->name;
         $this->id = 0;
         // createSQLArray uses this to tell if we are inserting or updating
         $this->insertDB(1, $owning_site, $removeOrigional, $keepaddedby, $copyDiscussions);
     }
     if ($thisClass == 'page') {
         $owning_site = $newParent->owning_site;
         $owning_section = $newParent->id;
         $this->id = 0;
         // createSQLArray uses this to tell if we are inserting or updating
         $this->insertDB(1, $owning_site, $owning_section, $removeOrigional, $keepaddedby, $copyDiscussions);
     }
     if ($thisClass == 'story') {
         $record_tags = get_record_tags($this->id);
         $owning_site = $newParent->owning_site;
         $owning_section = $newParent->owning_section;
         $owning_page = $newParent->id;
         $this->id = 0;
         // createSQLArray uses this to tell if we are inserting or updating
         /* 			print "insertDB: 1,$owning_site,$owning_section,$owning_page,$keepaddedby<br />"; */
         $this->insertDB(1, $owning_site, $owning_section, $owning_page, $removeOrigional, $keepaddedby, $copyDiscussions, $record_tags);
     }
     /* 		print_r($newParent); */
     return 1;
 }
Example #3
0
 //if ($_SESSION[settings][step] == 3 && !$_REQUEST[link]) $_SESSION[settings][story_categories] = $_REQUEST[all_tags];
 /******************************************************************************
  * save changes to tags array
  ******************************************************************************/
 //printpre($_REQUEST);
 if (isset($_REQUEST[story_tags])) {
     $tags_array = array();
     $oldtags = array();
     $tags = trim($_REQUEST[story_tags]);
     if ($_REQUEST[story_tags] != " ") {
         $tags_array = explode(" ", $tags);
     } else {
         $tags_array = array();
     }
     // get original record tags
     $record_tags = get_record_tags($_SESSION[storyObj]->id);
     if (is_array($record_tags)) {
         foreach ($record_tags as $tag) {
             $oldtags[] = urldecode($tag);
         }
     }
     // compare original tags with new tags and create array of tags to delete
     $_SESSION[settings][story_categories_delete] = array();
     foreach ($oldtags as $oldtag) {
         if (!in_array($oldtag, $tags_array)) {
             $tag = urlencode($oldtag);
             $_SESSION[settings][story_categories_delete][] = $tag;
         }
     }
     //create array of tags to add
     $_SESSION[settings][story_categories] = array();
Example #4
0
     printc("<div class='contentinfo' align='left'>\n");
     if (!nulldate($o->getField("activatedate"))) {
         printc("Active dates: <strong><a href='index.php?{$sid}&amp;action=edit_story&amp;edit_story=" . $o->id . "&amp;comingFrom=viewsite&amp;step=3&amp;site={$site}&amp;section={$section}&amp;page={$page}&amp;'>" . $o->getField("activatedate") . "</a></strong>");
     }
     if (!nulldate($o->getField("deactivatedate"))) {
         printc(" to <strong><a href='index.php?{$sid}&amp;action=edit_story&amp;edit_story=" . $o->id . "&amp;comingFrom=viewsite&amp;step=3&amp;site={$site}&amp;section={$section}&amp;page={$page}&amp;'>" . $o->getField("deactivatedate") . "</strong>");
     }
     printc("</div>");
 }
 /******************************************************************************
  * Get story tags and display them
  ******************************************************************************/
 $record_id = $o->id;
 $user_id = $_SESSION[aid];
 $record_type = "story";
 $story_tags = get_record_tags($record_id);
 if ($story_tags) {
     printc("\n\t\t\t\t<div class='contentinfo' style='margin-top: 0px;'>");
     printc("Categories:");
     foreach ($story_tags as $tag) {
         $urltag = urlencode($tag);
         printc("<a href='index.php?{$sid}&amp;action=site&amp;site={$site}&amp;section={$section}&amp;page={$page}&amp;tag={$urltag}'>" . urldecode($tag) . "</a>\n");
     }
     if ($cfg['disable_edit_content'] != TRUE && $_SESSION['ltype'] != 'admin') {
         printc(" <a href='index.php?{$sid}&amp;action=edit_story&amp;edit_story=" . $o->id . "&amp;comingFrom=viewsite&amp;step=3&amp;site={$site}&amp;section={$section}&amp;page={$page}&amp;" . ($story_set ? "&amp;story_set=" . ($story_set + 1) : "") . "'>[edit]</a>");
     }
     printc("</div>\n");
 }
 $siteType = preg_replace('/[^a-z0-9_-]/i', '', $thisSite->getField("type"));
 $oType = preg_replace('/[^a-z0-9_-]/i', '', $o->getField("type"));
 $incfile = "output_modules/" . $siteType . "/" . $oType . ".inc.php";
Example #5
0
 function insertDB($down = 0, $newsite = null, $newsection = 0, $removeOrigional = 0, $keepaddedby = 0, $keepDiscussions = 0)
 {
     $origsite = $this->owning_site;
     $origid = $this->id;
     if ($newsite) {
         $this->owning_site = $newsite;
         unset($this->owningSiteObj);
     }
     if ($newsection) {
         $this->owning_section = $newsection;
         unset($this->owningSectionObj);
     }
     /* 		print "<pre>\n\nXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX\n"; */
     /* 		print "owning_site=".$this->owning_site."\nowning section=".$this->owning_section."\nOwningSiteObj: "; */
     /* //		print_r ($this->owningSiteObj); */
     /* 		print "\nOwningSectionObj: "; */
     /* 		print_r ($this->owningSectionObj); */
     /* 		print "\nXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX\n\n</pre>"; */
     $this->fetchUp(1);
     /*********************************************************
      * Re-Key the ordering of the rest of the pages in the
      * section to make sure that there are no holes
      *********************************************************/
     foreach ($this->owningSectionObj->getField("pages") as $order => $pageId) {
         $query = "UPDATE\n\t\t\t\t\tpage\n\t\t\t\tSET\n\t\t\t\t\tpage_order = '" . addslashes($order) . "'\n\t\t\t\tWHERE\n\t\t\t\t\tpage_id = '" . $pageId . "'";
         // 			printpre($query);
         db_query($query);
     }
     $a = $this->createSQLArray(1);
     if (!$keepaddedby) {
         $a[] = "FK_createdby='" . addslashes($_SESSION[aid]) . "'";
         $a[] = $this->_datafields[addedtimestamp][1][0] . "=NOW()";
         $a[] = "FK_updatedby='" . addslashes($_SESSION[aid]) . "'";
     } else {
         $a[] = "FK_createdby=" . db_get_value("user", "user_id", "user_uname='" . addslashes($this->getField("addedby")) . "'");
         $a[] = $this->_datafields[addedtimestamp][1][0] . "='" . addslashes($this->getField("addedtimestamp")) . "'";
         $a[] = "FK_updatedby=" . db_get_value("user", "user_id", "user_uname='" . addslashes($this->getField("editedby")) . "'");
         $a[] = $this->_datafields[editedtimestamp][1][0] . "='" . addslashes($this->getField("editedtimestamp")) . "'";
     }
     // insert media (url)
     if ($this->data[url]) {
         // first see, if media item already exists in media table
         $query = "\n\t\t\t\tSELECT\n\t\t\t\t\tmedia_id\n\t\t\t\tFROM\n\t\t\t\t\tmedia\n\t\t\t\tWHERE\n\t\t\t\t\tFK_site = '" . addslashes($this->owningSiteObj->id) . "' AND\n\t\t\t\t\tFK_createdby = '" . addslashes($_SESSION[aid]) . "' AND\n\t\t\t\t\tmedia_tag = '" . addslashes($this->data[url]) . "' AND\n\t\t\t\t\tmedia_location = 'remote'";
         $r = db_query($query);
         // if not in media table insert it
         if (!db_num_rows($r)) {
             $query = "\n\t\t\t\t\tINSERT\n\t\t\t\t\tINTO media\n\t\t\t\t\tSET\n\t\t\t\t\t\tFK_site = '" . addslashes($this->owningSiteObj->id) . "',\n\t\t\t\t\t\tFK_createdby = '" . addslashes($_SESSION[aid]) . "',\n\t\t\t\t\t\tmedia_tag = '" . addslashes($this->data[url]) . "',\n\t\t\t\t\t\tmedia_location = 'remote',\n\t\t\t\t\t\tFK_updatedby = '" . addslashes($_SESSION[aid]) . "'\n\t\t\t\t\t";
             db_query($query);
             $a[] = "FK_media=" . lastid();
         } else {
             $arr = db_fetch_assoc($r);
             $a[] = "FK_media= '" . addslashes($arr[media_id]) . "'";
         }
     }
     $query = "INSERT INTO page SET \n\t" . implode(",\n\t", $a);
     //printpre($query);
     db_query($query);
     $this->id = lastid();
     // See if there is a site hash (meaning that we are being copied).
     // If so, try to match our id with the hash entry for 'NEXT'.
     if ($GLOBALS['__site_hash']['pages'] && ($oldId = array_search('NEXT', $GLOBALS['__site_hash']['pages']))) {
         $GLOBALS['__site_hash']['pages'][$oldId] = $this->id;
     }
     $this->fetchUp();
     /* 		$this->owningSectionObj->addPage($this->id); */
     if ($removeOrigional) {
         $this->owningSectionObj->delPage($origid, 0);
     }
     $this->owningSectionObj->updateDB();
     // add new permissions entry.. force update
     //		$this->updatePermissionsDB(1);	// We shouldn't need this because new sections will just
     //inherit the permissions of their parent sites
     // add log entry
     /* 		log_entry("add_page",$this->owning_site,$this->owning_section,$this->id,"$_SESSION[auser] added page id ".$this->id." to site ".$this->owning_site); */
     // insert down
     if ($down && $this->fetcheddown && $this->stories) {
         foreach (array_keys($this->stories) as $i) {
             // Mark our Id as the next one to set
             if (is_array($GLOBALS['__site_hash']['stories'])) {
                 $GLOBALS['__site_hash']['stories'][$i] = 'NEXT';
             }
             $storyTags = get_record_tags($this->stories[$i]->id);
             // Get any tags for the story
             $this->stories[$i]->id = 0;
             // createSQLArray uses this to tell if we are inserting or updating
             $this->stories[$i]->insertDB(1, $this->owning_site, $this->owning_section, $this->id, 1, $keepaddedby, $keepDiscussions, $storyTags);
         }
     }
     return true;
 }