Beispiel #1
0
    public function getHTML()
    {
        global $urlRequestRoot, $cmsFolder;
        if ($this->globaldisable == '1' || $this->globaldisable == 'Yes') {
            return "";
        }
        $ran = '';
        if ($this->makeunique == '1' || $this->makeunique == 'Yes') {
            $ran = $this->widgetInstanceId;
        }
        $divid = $this->divid . $ran;
        $type = $this->type;
        $width = $this->width;
        $height = $this->height;
        $show_face = false;
        $color = $this->color;
        if ($this->show_face == "Yes") {
            $show_face = "true";
        }
        if ($type == "Facebook Page") {
            $url = urlencode($this->pageurl);
            $stream = $header = false;
            if ($this->stream == "Yes") {
                $stream = "true";
            }
            if ($this->header == "Yes") {
                $header = "true";
            }
            $like = <<<FBHTML
\t\t<iframe src="http://www.facebook.com/plugins/likebox.php?href={$url}&amp;width={$width}&amp;colorscheme={$color}&amp;show_faces={$show_face}&amp;stream={$stream}&amp;header={$header}&amp;height={$height}" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:{$width}; height:{$height};" allowTransparency="true"></iframe>
FBHTML;
        } else {
            $layout = $this->layout;
            if ($type == "Site") {
                $url = urlencode(hostURL());
                $like = <<<FBHTML
\t\t<iframe src="http://www.facebook.com/plugins/like.php?href={$url}&amp;layout={$layout}&amp;show_faces={$show_face}&amp;width={$width}&amp;action=like&amp;colorscheme={$color}&amp;height={$height}" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:{$width}; height:{$height};" allowTransparency="true"></iframe>
FBHTML;
            } else {
                if ($type == "Each Page") {
                    $url = urlencode(selfURI());
                    $like = <<<FBHTML
\t\t<iframe src="http://www.facebook.com/plugins/like.php?href={$url}&amp;layout={$layout}&amp;show_faces={$show_face}&amp;width={$width}&amp;action=like&amp;colorscheme={$color}&amp;height={$height}" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:{$width}; height:{$height};" allowTransparency="true"></iframe>
FBHTML;
                }
            }
        }
        $fbHTML = "<div class='{$this->divclass}' id='{$divid}'>" . $like . "</div>";
        return $fbHTML;
    }
Beispiel #2
0
    public function actionEdit()
    {
        global $sourceFolder, $ICONS;
        //require_once("$sourceFolder/diff.lib.php");
        require_once $sourceFolder . "/upload.lib.php";
        if (isset($_GET['deldraft'])) {
            $dno = escape($_GET['dno']);
            $query = "DELETE FROM `article_draft` WHERE `page_modulecomponentid`='" . $this->moduleComponentId . "' AND `draft_number`=" . $dno;
            $result = mysql_query($query) or die(mysql_error());
        }
        global $ICONS;
        $header = <<<HEADER
\t\t<fieldset><legend><a name='topquicklinks'>Quicklinks</a></legend>
\t\t<table class='iconspanel'>
\t\t<tr>
\t\t<td><a href='#editor'><div>{$ICONS['Edit Page']['large']}<br/>Edit Page</div></a></td>
\t\t<td><a href='#files'><div>{$ICONS['Uploaded Files']['large']}<br/>Manage Uploaded Files</div></a></td>
\t\t<td><a href='#drafts'><div>{$ICONS['Drafts']['large']}<br/>Saved Drafts</div></a></td>
\t\t<td><a href='#revisions'><div>{$ICONS['Page Revisions']['large']}<br/>Page Revisions</div></a></td>
\t\t<td><a href='#comments'><div>{$ICONS['Page Comments']['large']}<br/>Page Comments</div></a></td>
\t\t</tr>
\t\t</table>
\t
        
\t\t</fieldset><br/><br/>
HEADER;
        submitFileUploadForm($this->moduleComponentId, "article", $this->userId, UPLOAD_SIZE_LIMIT);
        if (isset($_GET['delComment']) && $this->userId == 1) {
            mysql_query("DELETE FROM `article_comments` WHERE `comment_id` = '" . escape($_GET['delComment']) . "'");
            if (mysql_affected_rows()) {
                displayinfo("Comment deleted!");
            } else {
                displayerror("Error in deleting comment");
            }
        }
        if (isset($_GET['preview']) && isset($_POST['CKEditor1'])) {
            return "<div id=\"preview\" class=\"warning\"><a name=\"preview\">Preview</a></div>" . $this->actionView(stripslashes($_POST[CKEditor1])) . $this->getCkBody(stripslashes($_POST[CKEditor1]));
        }
        if (isset($_GET['version'])) {
            $revision = $this->getRevision($_GET['version']);
            return "<div id=\"preview\" class=\"warning\"><a name=\"preview\">Previewing Revision Number " . $_GET['version'] . "</a></div>" . $this->actionView($revision) . $this->getCkBody($revision);
        }
        if (isset($_GET['dversion'])) {
            $draft = $this->getDraft($_GET['dversion']);
            displayinfo("Viewing Draft number " . $_GET['dversion']);
            return $header . $this->getCkBody($draft);
        }
        if (isset($_POST['CKEditor1'])) {
            /*Save the diff :-*/
            $query = "SELECT article_content FROM article_content WHERE page_modulecomponentid='" . $this->moduleComponentId . "'";
            $result = mysql_query($query);
            $row = mysql_fetch_assoc($result);
            $diff = mysql_escape_string($this->diff($_POST['CKEditor1'], $row['article_content']));
            $query = "SELECT MAX(article_revision) AS MAX FROM `article_contentbak` WHERE page_modulecomponentid ='" . $this->moduleComponentId . "'";
            $result = mysql_query($query);
            if (!$result) {
                displayerror(mysql_error() . "article.lib L:44");
                return;
            }
            if (mysql_num_rows($result)) {
                $row = mysql_fetch_assoc($result);
                $revId = $row['MAX'] + 1;
            } else {
                $revId = 1;
            }
            $query = "INSERT INTO `article_contentbak` (`page_modulecomponentid` ,`article_revision` ,`article_diff`,`user_id`)\nVALUES ('{$this->moduleComponentId}', '{$revId}','{$diff}','{$this->userId}')";
            $result = mysql_query($query);
            if (!$result) {
                displayerror(mysql_error() . "article.lib L:44");
                return;
            }
            /*Save the diff end.*/
            $query = "UPDATE `article_content` SET `article_content` = '" . escape($_POST["CKEditor1"]) . "' WHERE `page_modulecomponentid` ='{$this->moduleComponentId}' ";
            $result = mysql_query($query);
            if (mysql_affected_rows() < 0) {
                displayerror("Unable to update the article content");
            } else {
                /* Index the page by sphider */
                $page = replaceAction(selfURI(), "edit", "view");
                global $sourceFolder, $moduleFolder;
                require_once "{$sourceFolder}/{$moduleFolder}/search/admin/spider.php";
                index_url($page, 0, 0, '', 0, 0, 1);
            }
            /* Update the choice of editor*/
            if (isset($_POST['editor'])) {
                $editor = escape($_POST['editor']);
                $query = "UPDATE `article_content` SET `default_editor` = '" . $editor . "' WHERE `page_modulecomponentid` ='{$this->moduleComponentId}' ";
                $result = mysql_query($query);
                if (mysql_affected_rows() < 0) {
                    displayerror("Unable to update the article Editor");
                }
            }
            return $this->actionView();
        }
        $fulleditpage = $this->getCkBody();
        $commentsedit = "<fieldset><legend><a name='comments'>{$ICONS['Page Comments']['small']}Comments</a></legend>";
        if ($this->isCommentsEnabled()) {
            $comments = mysql_query("SELECT `comment_id`,`user`,`timestamp`,`comment` FROM `article_comments` WHERE `page_modulecomponentid` = '{$this->moduleComponentId}' ORDER BY `timestamp`");
            if (mysql_num_rows($comments) == 0) {
                $commentsedit .= "No comments have been posted !";
            }
            while ($row = mysql_fetch_array($comments)) {
                $commentsedit .= $this->renderComment($row['comment_id'], $row['user'], $row['timestamp'], $row['comment'], 1);
            }
        } else {
            $commentsedit .= "Comments are disabled for this page! You can allow comments from <a href='./+settings'>pagesettings</a>.";
        }
        $commentsedit .= "</fieldset>";
        $top = "<a href='#topquicklinks'>Top</a>";
        $fulleditpage .= $commentsedit . $top;
        return $header . $fulleditpage;
    }
Beispiel #3
0
function htmlMenuRenderer($menuArray, $currentIndex = -1, $linkPrefix = '')
{
    $menuHtml = '';
    $hostURL = strstr(selfURI(), '+', true);
    for ($i = 0; $i < count($menuArray); ++$i) {
        $query = "SELECT `page_openinnewtab` FROM `" . MYSQL_DATABASE_PREFIX . "pages` WHERE `page_id` = '{$menuArray[$i][0]}'";
        $result = mysql_query($query);
        $result = mysql_fetch_assoc($result);
        if ($result['page_openinnewtab'] == '1') {
            $menuHtml .= "<a href=\"" . $hostURL . "{$linkPrefix}{$menuArray[$i][1]}/\" target=\"_blank\"";
        } else {
            $menuHtml .= "<a href=\"" . $hostURL . "{$linkPrefix}{$menuArray[$i][1]}/\"";
        }
        if ($i == $currentIndex) {
            $menuHtml .= ' class="currentpage"';
        }
        $menuHtml .= '>';
        if ($menuArray[$i][4] && $menuArray[$i][3] != '') {
            $menuHtml .= "<img src=\"{$menuArray[$i][3]}\" width=32 height=32 />";
        }
        $menuHtml .= "<div class='cms-menuitem'> {$menuArray[$i][2]} </div></a>\n";
    }
    return $menuHtml;
}
function getCaptchaHtml()
{
    global $uploadFolder, $sourceFolder, $moduleFolder, $cmsFolder, $urlRequestRoot;
    $captcha_query = "SELECT * FROM `" . MYSQL_DATABASE_PREFIX . "global` WHERE `attribute` = 'recaptcha'";
    $captcha_res = mysql_fetch_assoc(mysql_query($captcha_query));
    $recaptcha = 0;
    if ($captcha_res['value']) {
        if (!fsockopen("www.google.com", 80)) {
            $recaptcha = 0;
        } else {
            $recaptcha = 1;
            $query = "SELECT `value` FROM `" . MYSQL_DATABASE_PREFIX . "global` WHERE `attribute`='recaptcha_public'";
            $res = mysql_fetch_assoc(mysql_query($query));
            $public_key = $res['value'];
            $query = "SELECT `value` FROM `" . MYSQL_DATABASE_PREFIX . "global` WHERE `attribute`='recaptcha_private'";
            $res = mysql_fetch_assoc(mysql_query($query));
            $private_key = $res['value'];
            if ($public_key == NULL || $private_key == NULL) {
                $recaptcha = 0;
            }
        }
        if (isset($_GET['recaptcha']) && $_GET['recaptcha'] == "off") {
            $recaptcha = 0;
        }
    }
    if ($recaptcha) {
        require_once "{$sourceFolder}/{$moduleFolder}/form/captcha/recaptcha/recaptchalib.php";
        $body = "<tr><td colspan=2><center>" . recaptcha_get_html($public_key) . "</center></td></tr>";
        $body .= "<tr><td colspan=2>Click <a href='" . selfURI() . "&recaptcha=off'>here</a> if you can't see the ReCAPTCHA</td></tr>";
        $body .= "<input type='hidden' name='captcha' value='1'>";
    } else {
        require_once "{$sourceFolder}/{$moduleFolder}/form/captcha/class/captcha.class.php";
        $captcha = new captcha($sourceFolder, $moduleFolder, $uploadFolder, $urlRequestRoot, $cmsFolder, 6);
        $_SESSION['CAPTCHAString'] = $captcha->getCaptchaString();
        $body = '<tr><td>Enter the text as shown in the image :</td><td>' . '<img style="border:1px solid;padding:0px" src="' . $captcha->getCaptchaUrl() . '" alt="CAPTCHA" border="1"/><br/>' . '<input type="text" class="required" name="txtCaptcha" /><td></tr>';
        $body .= "<input type='hidden' name='captcha' value='0'>";
    }
    return $body;
}