Ejemplo n.º 1
0
function print_item_pdf($id)
{
    global $tp, $pref, $content_shortcodes;
    global $CONTENT_PRINT_IMAGES, $row, $content_image_path, $content_pref, $mainparent;
    //in this section you decide what to needs to be output to the pdf file
    $con = new convert();
    require_once e_PLUGIN . "content/content_shortcodes.php";
    require_once e_PLUGIN . "content/handlers/content_class.php";
    $aa = new content();
    if (!is_object($sql)) {
        $sql = new db();
    }
    $sql->db_Select($plugintable, "content_id, content_heading, content_subheading, content_text, content_image, content_author, content_parent, content_datestamp, content_class, content_pref", "content_id='" . intval($id) . "' ");
    $row = $sql->db_Fetch();
    if (!check_class($row['content_class'])) {
        header("location:" . e_PLUGIN . "content/content.php");
        exit;
    }
    $authordetails = $aa->getAuthor($row['content_author']);
    $row['content_datestamp'] = $con->convert_date($row['content_datestamp'], "long");
    $img = $tp->parseTemplate('{CONTENT_PRINT_IMAGES}', FALSE, $content_shortcodes);
    $mainparent = $aa->getMainParent(intval($id));
    $content_pref = $aa->getContentPref($mainparent);
    $content_icon_path = $tp->replaceConstants($content_pref["content_icon_path"]);
    $content_image_path = $tp->replaceConstants($content_pref["content_image_path"]);
    $img = $tp->parseTemplate('{CONTENT_PDF_IMAGES}', FALSE, $content_shortcodes);
    //add custom and preset tags if present
    $custom = e107::unserialize($row['content_pref']);
    //$custom						= $eArrayStorage->ReadxxxArray($row['content_pref']);
    $months = array(CONTENT_ADMIN_DATE_LAN_0, CONTENT_ADMIN_DATE_LAN_1, CONTENT_ADMIN_DATE_LAN_2, CONTENT_ADMIN_DATE_LAN_3, CONTENT_ADMIN_DATE_LAN_4, CONTENT_ADMIN_DATE_LAN_5, CONTENT_ADMIN_DATE_LAN_6, CONTENT_ADMIN_DATE_LAN_7, CONTENT_ADMIN_DATE_LAN_8, CONTENT_ADMIN_DATE_LAN_9, CONTENT_ADMIN_DATE_LAN_10, CONTENT_ADMIN_DATE_LAN_11);
    $CONTENT_CONTENT_TABLE_CUSTOM_TAGS = "";
    if (!empty($custom)) {
        foreach ($custom as $k => $v) {
            if ($k == "content_custom_presettags") {
                if (isset($content_pref["content_content_presettags"]) && $content_pref["content_content_presettags"]) {
                    foreach ($v as $ck => $cv) {
                        if (is_array($cv)) {
                            //date
                            if (!($cv['day'] == "" && $cv['month'] == "" && $cv['year'] == "")) {
                                $vv = $cv['day'] . " " . $months[$cv['month'] - 1] . " " . $cv['year'];
                            }
                        } else {
                            $vv = $cv;
                        }
                        if (isset($ck) && $ck != "" && isset($vv) && $vv != "") {
                            $CUSTOM_TAGS = TRUE;
                            $CONTENT_CONTENT_TABLE_CUSTOM_KEY = $tp->toHTML($ck, true);
                            $CONTENT_CONTENT_TABLE_CUSTOM_VALUE = $tp->toHTML($vv, true);
                            $CONTENT_CONTENT_TABLE_CUSTOM_TAGS .= $CONTENT_CONTENT_TABLE_CUSTOM_KEY . " : " . $CONTENT_CONTENT_TABLE_CUSTOM_VALUE . "<br />";
                        }
                    }
                }
            } else {
                if (isset($content_pref["content_content_customtags"]) && $content_pref["content_content_customtags"]) {
                    $key = substr($k, 15);
                    if (isset($key) && $key != "" && isset($v) && $v != "") {
                        $CUSTOM_TAGS = TRUE;
                        $CONTENT_CONTENT_TABLE_CUSTOM_KEY = $tp->toHTML($key, true);
                        $CONTENT_CONTENT_TABLE_CUSTOM_VALUE = $tp->toHTML($v, true);
                        $CONTENT_CONTENT_TABLE_CUSTOM_TAGS .= $CONTENT_CONTENT_TABLE_CUSTOM_KEY . " : " . $CONTENT_CONTENT_TABLE_CUSTOM_VALUE . "<br />";
                    }
                }
            }
        }
    }
    $text = "\n\t<b>" . $row['content_heading'] . "</b><br />\n\t" . $row['content_subheading'] . "<br />\n\t" . $authordetails[1] . ", " . $row['content_datestamp'] . "<br />\n\t<br />\n\t" . $row['content_text'] . "<br />\n\t" . ($CONTENT_CONTENT_TABLE_CUSTOM_TAGS ? $CONTENT_CONTENT_TABLE_CUSTOM_TAGS : "") . "\n\t<div style='float:left; padding-left:10px;'>" . $img . "</div>\n\t";
    //the following defines are processed in the document properties of the pdf file
    //Do NOT add parser function to the variables, leave them as raw data !
    //as the pdf methods will handle this !
    $text = $text;
    //define text
    $creator = SITENAME;
    //define creator
    $author = $authordetails[1];
    //define author
    $title = $row['content_heading'];
    //define title
    $subject = $row['content_subheading'];
    //define subject
    $keywords = "";
    //define keywords
    //define url to use in the header of the pdf file
    $url = SITEURLBASE . e_PLUGIN_ABS . "content/content.php?content." . $row['content_id'];
    //always return an array with the following data:
    return array($text, $creator, $author, $title, $subject, $keywords, $url);
}
Ejemplo n.º 2
0
if (!e_QUERY) {
    //show main categories
    $aform->show_manage_content("", "", "");
    require_once e_ADMIN . "footer.php";
    exit;
} else {
    $qs = explode(".", e_QUERY);
    //manage content items
    if ($qs[0] == "content" && is_numeric($qs[1])) {
        $aform->show_manage_content("", "", "");
        //edit content item
    } elseif ($qs[0] == "content" && $qs[1] == "edit" && is_numeric($qs[2])) {
        $newqs = array_reverse($qs);
        if ($newqs[0] == "cu") {
            //item; update redirect
            $mainparent = $aa->getMainParent($qs[2]);
            $message = CONTENT_ADMIN_ITEM_LAN_2 . "<br /><br />";
            $message .= CONTENT_ADMIN_ITEM_LAN_88 . " <a href='" . e_SELF . "?content.create." . $mainparent . "'>" . CONTENT_ADMIN_ITEM_LAN_90 . "</a><br />";
            $message .= CONTENT_ADMIN_ITEM_LAN_89 . " <a href='" . e_SELF . "?content." . $mainparent . "'>" . CONTENT_ADMIN_ITEM_LAN_90 . "</a><br />";
            $message .= CONTENT_ADMIN_ITEM_LAN_91 . " <a href='" . e_SELF . "?content.edit." . $qs[2] . "'>" . CONTENT_ADMIN_ITEM_LAN_90 . "</a><br />";
            $message .= CONTENT_ADMIN_ITEM_LAN_124 . " <a href='" . e_PLUGIN . "content/content.php?content." . $qs[2] . "'>" . CONTENT_ADMIN_ITEM_LAN_90 . "</a>";
            $ns->tablerender("", "<div style='text-align:center'><b>" . $message . "</b></div>");
            require_once e_ADMIN . "footer.php";
            exit;
        }
        $aform->show_create_content("admin", $userid = "", $username = "");
        //post submitted content item
    } elseif ($qs[0] == "content" && $qs[1] == "sa" && is_numeric($qs[2])) {
        $newqs = array_reverse($qs);
        if ($newqs[0] == "cu") {
            //item; submit post / update redirect
Ejemplo n.º 3
0
        $feed['url'] = 'content';
        //the identifier for the rss feed url
        $feed['topic_id'] = $k;
        //the topic_id, empty on default (to select a certain category)
        $feed['path'] = 'content';
        //this is the plugin path location
        $feed['text'] = 'this is the rss feed for content category : ' . $name;
        $feed['class'] = '0';
        $feed['limit'] = '9';
        $rss[] = $feed;
    }
    return $rss;
}
//##### ------------------------------------------------------------------------------------
//##### create rss data, return as array $eplug_rss_data -----------------------------------
$mainparent = $aa->getMainParent($this->topicid);
$content_pref = $aa->getContentPref($mainparent);
$array = $aa->getCategoryTree("", $mainparent, TRUE);
$datequery = " AND content_datestamp < " . time() . " AND (content_enddate=0 || content_enddate>" . time() . ") ";
$qry = " content_refer !='sa' " . $datequery . " AND content_class REGEXP '" . e_CLASS_REGEXP . "' AND content_parent = '" . $this->topicid . "' ORDER BY content_datestamp DESC LIMIT 0," . $this->limit;
$rss = array();
$sqlrss = new db();
if ($items = $sqlrss->db_Select('pcontent', "*", $qry)) {
    $i = 0;
    while ($rowrss = $sqlrss->db_Fetch()) {
        //$author = array($author_id, $author_name, $author_email, $content_author);
        $rowrss['url_content_id'] = $rowrss['content_parent'];
        $author = $aa->getAuthor($rowrss['content_author']);
        $rss[$i]['author'] = $author[1];
        $rss[$i]['author_email'] = $author[2];
        $rss[$i]['link'] = $e107->base_path . $PLUGINS_DIRECTORY . "content/content.php?content." . $rowrss['content_id'];
Ejemplo n.º 4
0
            $pid = "0";
            $rated = isset($_POST['rateindex']) ? $_POST['rateindex'] : "";
            $cobj->enter_comment($author, $_POST['comment'], $plugintable, $qs[1], $pid, $_POST['subject'], $rated);
            if ($qs[0] == "content" && is_numeric($qs[1])) {
                if (!isset($qs[2])) {
                    $cacheid = 1;
                } else {
                    $cacheid = $qs[2];
                }
                $e107cache->clear("comment.{$plugintable}.{$qs['1']}.{$cacheid}");
                $e107cache->clear("{$plugintable}.content.{$qs['1']}.{$cacheid}");
            }
            if ($qs[0] == "cat" && is_numeric($qs[1])) {
                $e107cache->clear("comment.{$plugintable}.{$qs['1']}");
            }
            $main = $aa->getMainParent(is_numeric($qs[1]) ? $qs[1] : $qs[2]);
            $e107cache->clear("{$plugintable}.recent.{$main}");
            $e107cache->clear("{$plugintable}.cat.list.{$main}");
            $e107cache->clear("{$plugintable}.cat.{$main}");
            $e107cache->clear("{$plugintable}.author.{$main}");
            $e107cache->clear("{$plugintable}.top.{$main}");
            $e107cache->clear("{$plugintable}.score.{$main}");
        }
    }
}
//check active keyword search
$resultmenu = FALSE;
$searchfieldname = "searchfield_page";
$searchfieldmenuname = "searchfieldmenu_menu";
if (isset($_POST['searchsubmit']) || isset($_POST[$searchfieldname]) || isset($_POST[$searchfieldmenuname])) {
    //if active keyword search