Esempio n. 1
0
         $filter = $_GET['filter'];
     } else {
         $filter = 'inside';
     }
     require_once PATH_FACEBOOK . '/classes/pages.class.php';
     $pagesObj = new pages($app, 0, false);
     require_once PATH_FACEBOOK . '/pages/pageLeaders.class.php';
     $leadersObj = new pageLeaders($pagesObj);
     $code = $leadersObj->fetchLeaders($view, $filter, true);
     break;
 case 'fetchVideoPreview':
     require_once PATH_CORE . '/classes/video.class.php';
     if (isset($_POST['videoURL'])) {
         $videoURL = videos::getVideoURLFromEmbedCodeOrURL(stripslashes($_POST['videoURL']));
     }
     $code = videos::buildPlayerFromLink($videoURL, 160, 120);
     break;
 case 'fetchFeed':
     if (isset($_GET['filter'])) {
         $filter = $_GET['filter'];
     } else {
         $filter = 'all';
     }
     if (isset($_GET['filter_userid'])) {
         $filter_userid = $_GET['filter_userid'];
     } else {
         $filter_userid = 0;
     }
     if (isset($_GET['filter_challengeid'])) {
         $filter_challengeid = $_GET['filter_challengeid'];
     } else {
 function buildIdeaDisplay($id = 0, $showShare = false)
 {
     $code = '';
     // display the idea
     $q = "SELECT Ideas.*,UserInfo.fbId,Tags.raw_tag as category FROM Ideas LEFT JOIN UserInfo ON Ideas.userid=UserInfo.userid LEFT JOIN Tags ON Ideas.tagid=Tags.id WHERE Ideas.id={$id};";
     $this->templateObj->db->result = $this->templateObj->db->query($q);
     $this->templateObj->db->setTemplateCallback('timeSince', array($this->utilObj, 'time_since'), 'dt');
     $this->templateObj->db->setTemplateCallback('category', array($this, 'cbIdeasTag'), 'tagid');
     $this->templateObj->db->setTemplateCallback('cmdLike', array($this, 'cbCommandLike'), 'id');
     //$this->templateObj->db->setTemplateCallback('showAnswer', array($this, 'cbShowAnswer'), 'id');
     $this->templateObj->db->setTemplateCallback('mbrLink', array($this->templateObj, 'buildLinkedProfileName'), array('fbId', 'false'));
     $this->templateObj->db->setTemplateCallback('mbrImage', array($this->templateObj, 'buildLinkedProfilePic'), array('fbId', 'normal'));
     $code .= $this->templateObj->mergeTemplate($this->templateObj->templates['ideaList'], $this->templateObj->templates['ideaItemDetail']);
     $code .= '<br />';
     $iTable = new ideasTable($this->db);
     $ir = $iTable->getRowObject();
     $ir->load($id);
     if ($ir->videoid != 0) {
         // display embedded video
         require_once PATH_CORE . '/classes/video.class.php';
         $videoTable = new VideoTable($this->db);
         $video = $videoTable->getRowObject();
         $video->load($ir->videoid);
         $code .= '<div id="readVideo">' . videos::buildPlayerFromLink($video->embedCode, 320, 240) . '<!-- end of readVideo --></div>';
     }
     $code .= '<div id="ideaShare" class="' . ($showShare ? '' : 'hidden') . '">';
     $temp = '<form requirelogin="******" id="idea_share_form" action="?p=ideas&o=view&id=' . $id . '" method="post"><p>To:<br /> <fb:multi-friend-input max="20" /></p><p class="bump10"><input class="btn_1" type="button" value="Send now" onclick="ideaShareSubmit(' . $id . ');return false;"></p></form>';
     $temp = '<div class="panelBar clearfix"><h2>Share this idea with your friends</h2></div><br />' . $temp;
     $temp = '<div class="panel_2 clearfix">' . $temp . '</div>';
     $code .= $temp . '</div><br />';
     // display the comments to this idea
     $comTemp = '<div id="ideaComments" >';
     $comTemp .= $this->buildCommentThread($id, false, $ir->numComments);
     $comTemp .= '</div><br />';
     $code .= '<div class="panel_2 clearfix"><div class="panelBar clearfix"><h2>Comments</h2><!-- end panelBar--></div><br />' . $comTemp . '<!-- end panel_2 --></div>';
     // display the link to this idea box
     $code .= $this->fetchLinkBox($ir);
     $code .= $this->fetchRelatedNews($ir);
     return $code;
 }
 function buildVideoPlayer($embedCode)
 {
     require_once PATH_CORE . '/classes/video.class.php';
     return videos::buildPlayerFromLink($embedCode, 160, 120);
 }
 function fetchVideoComment($videoURL, $width = 160, $height = 100)
 {
     require_once PATH_CORE . '/classes/video.class.php';
     $code = '<div style="text-align:center;">' . videos::buildPlayerFromLink($videoURL, $width, $height) . '</div>';
     return $code;
 }
 function buildPostBlogForm($fData = NULL)
 {
     if (is_null($fData)) {
         // initialize form data
         $fData = new stdClass();
         $fData->state = 'new';
         $fData->status = 'draft';
         $fData->entry = '';
         $fData->title = '';
         $fData->url = '';
         $fData->tags = '';
         $fData->mediatype = 'text';
         $fData->imageUrl = '';
         $fData->videoEmbed = '';
         $fData->isBookmarklet = false;
         $fData->showPreview = false;
         $fData->alert = '';
         $fData->blogid = 0;
         $this->fData =& $fData;
     } else {
         // on submit, remove second column
         $this->postTip = false;
     }
     $code .= $this->buildScriptInclude('top');
     $code .= '<h1>Write your own story</h1><h5>Compose a new blog entry below</h5><p>Guidelines: please only post your original ideas and content here. It\'s fine to expound on stories from another Web site. However, if you just have a short comment, please post it as a comment on another story. This is an experimental feature. Please <a href="' . URL_CANVAS . '?p=contact">tell us what you think</a> and how we can improve it.</p>';
     $code .= '<fb:editor action="?p=postStory&o=blog&submit' . ($this->fData->isBookmarklet ? '&popup' : '') . '" labelwidth="100">' . '<fb:editor-text label="Title (required)" name="title" id="title" value="' . stripslashes(htmlentities(strip_tags($this->fData->title), ENT_QUOTES)) . '"/>';
     $code .= '<fb:editor-custom label="Body (required)">';
     $code .= '<p>The body of your post must be at least ' . MIN_BLOG_LENGTH . ' characters long. Allowed HTML tags include &lt;a&gt;, &lt;p&gt;, &lt;br /&gt;, &lt;em&gt;, &lt;i&gt;, &lt;strong&gt; and &lt;img&gt;.</p>';
     $code .= '<textarea rows="25" name="entry" id="entry">' . stripslashes(htmlentities($this->fData->entry, ENT_QUOTES)) . '</textarea><br /><a href="#" onclick="previewBlog();return false;" >refresh preview</a></fb:editor-custom>';
     if ($this->fData->caption == '') {
         $code .= '<input type="hidden" name="caption" id="caption" value="">';
     } else {
         $code .= '<fb:editor-custom label="Summary (required)"><textarea rows="5" name="caption" id="caption">' . stripslashes(htmlentities($this->fData->caption, ENT_QUOTES)) . '</textarea></fb:editor-custom>';
     }
     $code .= '<fb:editor-custom><p><strong>Optional elements</strong></p></fb:editor-custom><fb:editor-divider />' . '<fb:editor-custom label="Related Story Web Address"><input type="hidden" name="blogid" id="blogid" value="' . $this->fData->blogid . '" /><input style="width:70%;" type="text" name="url" id="url" value="' . $this->fData->url . '">&nbsp;<a href="#" onclick="loadBlogData();return false;">lookup photos</a></fb:editor-custom>' . '<fb:editor-text label="Photo Web Address" id="imageUrl" name="imageUrl" value="' . $this->fData->imageUrl . '"/>';
     $code .= $this->buildImageSelector('blog');
     $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 . '">';
     if ($fData->videoEmbed == '') {
         $code .= '<div id="videoPreview" class="hidden"><div id="videoPreviewMsg">Video Preview</div></div><!-- end of nested videoPreview -->';
     } else {
         require_once PATH_CORE . '/classes/video.class.php';
         $videoURL = videos::getVideoURLFromEmbedCodeOrURL(stripslashes($fData->videoEmbed));
         $code .= '<div id="videoPreview"><div id="videoPreviewMsg">' . videos::buildPlayerFromLink($videoURL, 160, 120) . '</div></div><!-- end of nested videoPreview -->';
     }
     $code .= '</fb:editor-custom>';
     $code .= '<fb:editor-buttonset>  ' . '<fb:editor-button name="submit" value="Save as Draft"/>' . '<fb:editor-button name="submit" value="Publish"/>';
     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", loadBlogData, 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);';
     $code .= 'var entry= document.getElementById("entry");';
     $code .= 'title.addEventListener("blur", updateBlogEntry, false);';
     $code .= '</script>';
     return $code;
 }