function createTempContent($userinfo = NULL, $wireid = 0)
 {
     require_once PATH_CORE . '/classes/content.class.php';
     $cObj = new content($this->db);
     $info = $this->getWireStory($wireid);
     require_once PATH_CORE . '/classes/parseStory.class.php';
     $psObj = new parseStory();
     require_once PATH_CORE . '/classes/utilities.class.php';
     $this->utilObj = new utilities($this->db);
     $info->title = stripslashes($info->title);
     $info->caption = stripslashes($this->utilObj->shorten($info->caption));
     // to do - replace proxy feed urls with final redirect
     $info->title = $psObj->cleanTitle($info->title);
     // create permalink
     $info->permalink = $cObj->buildPermalink($info->title);
     // serialize the content
     $info->title = mysql_real_escape_string($info->title);
     $info->caption = mysql_real_escape_string($info->caption);
     $story = $cObj->serialize(0, $info->title, $info->caption, $info->source, $info->url, $info->permalink, $userinfo->ncUid, $userinfo->name, $userinfo->userid, '', $userinfo->votePower, 0, 0);
     // post wire story to content
     $siteContentId = $cObj->add($story);
     return $siteContentId;
 }
     break;
 case 'fetchPublisherPage':
     setupAppFramework();
     require_once PATH_FACEBOOK . '/classes/publisher.class.php';
     //$pubObj=new publisher($db,$session);
     $pubObj = new publisher($db, $session, &$app);
     $code = $pubObj->fetchPublisherContent($_GET['tab']);
     break;
 case 'parseStory':
     if (isset($_POST['url']) && $_POST['url'] != '') {
         $url = $_POST['url'];
     } else {
         return false;
     }
     require_once PATH_CORE . '/classes/parseStory.class.php';
     $psObj = new parseStory($url);
     $code = $psObj->parse();
     break;
 case 'emailAttach':
     $app = setupAppFramework();
     require_once PATH_FACEBOOK . '/classes/publisher.class.php';
     $pubObj = new publisher($db, $session, &$app);
     $code = $pubObj->fetch('email', 'emailAttach');
     break;
 case 'appTab':
     if (isset($_POST['fb_sig_profile_user'])) {
         $fbUserPageId = $_POST['fb_sig_profile_user'];
     } else {
         exit('<h2>Invalid facebook user</h2>');
     }
     $app = setupAppFramework();
    function buildPostStoryForm($fData = NULL)
    {
        if (is_null($fData)) {
            // initialize form data
            $fData = new stdClass();
            $fData->state = 'new';
            $fData->body = '';
            $fData->tags = '';
            $fData->imageUrl = '';
            $fData->videoEmbed = '';
            $fData->mediatype = 'text';
            if (isset($_GET['u'])) {
                $fData->isBookmarklet = true;
                $fData->url = urldecode($_GET['u']);
                require_once PATH_CORE . '/classes/parseStory.class.php';
                $psObj = new parseStory($fData->url);
                if (isset($_GET['t'])) {
                    $title = strip_tags(stripslashes(urldecode($_GET['t'])));
                    $fData->title = $psObj->cleanTitle($title);
                } else {
                    $fData->title = '';
                }
                if (isset($_GET['c']) and $_GET['c'] != '') {
                    $fData->caption = strip_tags(stripslashes(urldecode($_GET['c'])));
                } else {
                    require_once PATH_CORE . '/classes/remotefile.class.php';
                    $rfObj = new remotePageProperty($psObj->url);
                    $temp = $rfObj->getPageParagraphs();
                    if (strlen($temp) > LENGTH_LONG_CAPTION) {
                        require_once PATH_CORE . '/classes/utilities.class.php';
                        $utilObj = new utilities($this->db);
                        $temp = $utilObj->shorten($temp, LENGTH_LONG_CAPTION);
                    }
                    $fData->caption = $temp;
                    //$psObj->log('Caption from gPP: '.$temp);
                }
            } else {
                $fData->isBookmarklet = false;
                $fData->url = '';
                $fData->title = '';
                $fData->caption = '';
            }
            $fData->isFeatureCandidate = 0;
            $fData->showPreview = false;
            $fData->alert = '';
            $this->fData =& $fData;
        } else {
            // on submit, remove second column
            $this->postTip = false;
        }
        // bookmarklet javascript has to be embedded in an iframe
        // bookmarklet code is in templates directory for now
        // to do: allow user to hide this in the future
        $code .= $this->buildScriptInclude('top');
        // not embed style below is req to override fb editor style
        $code .= '<h1>Submit a story from another news site</h1><h5>Add links to ' . strtolower(SITE_TOPIC) . ' related stories you\'ve found from around the Web</h5>';
        $code .= '<fb:editor action="?p=postStory&o=link&submit' . ($fData->isBookmarklet ? '&popup' : '') . '" labelwidth="100">
		<fb:editor-custom label="Story Web Address (required)"><input style="width:80%;" type="text" name="url" id="url" value="' . $this->fData->url . '">&nbsp;<a href="#" onclick="loadStoryData();return false;">refresh</a></fb:editor-custom>' . '<fb:editor-text label="Story Headline (required)" name="title" id="title" value="' . stripslashes(htmlentities(strip_tags($this->fData->title), ENT_QUOTES)) . '"/>
	   		<fb:editor-custom label="Summary (required)"><textarea rows="7" name="caption" id="caption">' . $this->fData->caption . '</textarea></fb:editor-custom>';
        $code .= '<fb:editor-custom><p><strong>Optional elements</strong></p></fb:editor-custom><fb:editor-divider />' . '<fb:editor-text label="Photo Web Address" id="imageUrl" name="imageUrl" value=""/>';
        $code .= $this->buildImageSelector();
        $code .= '<fb:editor-custom label="Video"><h3>Please paste the URL or embed code for a Facebook or YouTube Video. No other services are currently supported.</h3><input type="text" name="videoEmbed" id="videoEmbed" onChange="videoURLChanged();return false;" value="' . $this->fData->videoEmbed . '"><div id="videoPreview" class="hidden"><div id="videoPreviewMsg">Video Preview</div></div></fb:editor-custom>';
        if ($this->session->u->isAdmin) {
            $code .= '<fb:editor-custom label="Feature Candidate?"><input type="checkbox" name="isFeatureCandidate" ' . ($this->fData->isFeatureCandidate == 1 ? 'CHECKED' : '') . '></fb:editor-custom>';
        } else {
            $code .= '<input type="hidden" name="isFeatureCandidate" value="off">';
        }
        // Button area
        $code .= '<fb:editor-buttonset>  ' . '<fb:editor-button name="submit" value="Submit"/>';
        // <fb:editor-text label="Tags" name="tags" value=""/>
        if (!$this->fData->isBookmarklet) {
            $code .= '<fb:editor-cancel href="' . URL_CANVAS . '"/>';
        } else {
            // to do: link that javascript close window
            $code .= '<fb:editor-cancel value="Cancel" href="' . URL_CANVAS . '?p=home" />';
        }
        $code .= '</fb:editor-buttonset>';
        $code .= '</fb:editor>';
        // Manage scripts
        $code .= '<script type="text/javascript">';
        $code .= 'var url = document.getElementById("url");';
        $code .= 'url.addEventListener("blur", loadStoryData, false);';
        $code .= 'var title = document.getElementById("title");';
        $code .= 'title.addEventListener("blur", updateTitle, false);';
        $code .= 'var caption = document.getElementById("caption");';
        $code .= 'caption.addEventListener("blur", updateCaption, false);';
        if ($fData->isBookmarklet and $fData->url != '') {
            // fbjs onload requires array push
            $code .= 'var onload = [];onload.push(function() {loadStoryData();});for(var a = 0;a < onload.length;a++) {onload[a]();}';
        }
        $code .= '</script>';
        return $code;
    }