Esempio n. 1
0
/**
 * Add a css file in the page head
 * @param string $name
 * @param string $platform
 * @param string $folder
 * @param string $add_start
 * @return nothing
 */
function addCss($name, $platform = FALSE, $folder = FALSE, $add_start = FALSE)
{
    if (!isset($GLOBALS["page"])) {
        return;
    }
    if ($platform === FALSE) {
        $platform = Get::cur_plat();
    }
    $clean_name = getCleanTitle($name);
    $clean_folder = $folder !== FALSE ? "_" . getCleanTitle($folder) : "";
    $css_id = $platform . $clean_folder . "_" . $clean_name;
    if (!isset($GLOBALS["_css_cache"])) {
        $GLOBALS["_css_cache"] = array();
    }
    if (!in_array($css_id, $GLOBALS["_css_cache"])) {
        $GLOBALS["_css_cache"][] = $css_id;
        $css = Get::tmpl_path($platform) . "style" . ($folder !== FALSE ? $folder : "") . "/" . $name . ".css";
        $code = "<link href=\"" . $css . "\" rel=\"stylesheet\" type=\"text/css\" />\n";
        if (isset($GLOBALS["page"])) {
            if (!$add_start) {
                $GLOBALS["page"]->add($code, "page_head");
            } else {
                $GLOBALS["page"]->addStart($code, "page_head");
            }
        }
    }
}
Esempio n. 2
0
function wikiPdfExport($wiki_id, $all)
{
    $cwp =& cwpSetup($wiki_id);
    $query = "SELECT title" . " FROM " . $GLOBALS['prefix_fw'] . "_wiki" . " WHERE wiki_id = '" . $wiki_id . "'";
    list($wiki_title) = sql_fetch_row(sql_query($query));
    $pages_selected = $_POST['page'];
    $page_code_array = array();
    $query = "SELECT page_code" . " FROM " . $GLOBALS['prefix_fw'] . "_wiki_page";
    if ($all) {
        $query .= " WHERE wiki_id = '" . $wiki_id . "'";
    } else {
        $query .= " WHERE page_id IN (" . implode(',', $pages_selected) . ")";
    }
    $result = sql_query($query);
    while (list($page_code) = sql_fetch_row($result)) {
        $page_code_array[] = $page_code;
    }
    $query = "SELECT p.page_id, p.page_code, i.title, r.content" . " FROM " . $GLOBALS['prefix_fw'] . "_wiki_page as p" . " JOIN " . $GLOBALS['prefix_fw'] . "_wiki_page_info as i ON p.page_id = i.page_id" . " JOIN " . $GLOBALS['prefix_fw'] . "_wiki_revision as r ON p.page_id = r.page_id";
    if ($all) {
        $query .= " WHERE p.wiki_id = '" . $wiki_id . "'";
    } else {
        $query .= " WHERE p.page_id IN (" . implode(',', $pages_selected) . ")";
    }
    $query .= " AND i.version = r.version" . " AND i.language = '" . $cwp->getWikiLanguage($wiki_id) . "'" . " AND r.language = '" . $cwp->getWikiLanguage($wiki_id) . "'" . " ORDER BY p.page_path";
    $html = '';
    $result = sql_query($query);
    while (list($page_id, $page_code, $title, $content) = sql_fetch_row($result)) {
        $content = str_replace('{site_base_url}', getSiteBaseUrl(), $content);
        $html .= '<div style="page-break-after:always">' . '<a name="' . $page_code . '"><h2>' . htmlentities($title, ENT_COMPAT, 'UTF-8') . '</h2></a>' . $cwp->parseWikiLinks($content, true, $page_code_array) . '</div>';
    }
    $html = '<html><head>' . '<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />' . '<style>' . 'body {font-family: helvetica;' . 'margin: 30px 30px 30px 30px;}' . '</style>' . '</hedad><body>' . $html . '</body></html>';
    require_once _base_ . '/lib/lib.download.php';
    sendStrAsFile($html, getCleanTitle($wiki_title, 60) . '.html', 'utf-8');
}
Esempio n. 3
0
 function createRootPage($wiki_id)
 {
     $res = FALSE;
     $info = $this->getWikiInfo($wiki_id);
     $title = $info["title"];
     $page_code = getCleanTitle($title, 255);
     $path = "/root";
     $lev = 0;
     $lang_info = $this->getWikiLangInfo($wiki_id);
     $language = $lang_info["main_language"];
     // Adding the page
     $field_list = "page_code, page_path, wiki_id";
     $field_val = "'" . $page_code . "', '" . $path . "', '" . (int) $wiki_id . "'";
     $qtxt = "INSERT INTO " . $this->getWikiPageTable() . " (" . $field_list . ") VALUES (" . $field_val . ")";
     $res = $this->_executeInsert($qtxt);
     if ($res > 0) {
         // Adding other page information
         $field_list = "page_id, language, title, last_update, wiki_id";
         $field_val = "'" . $res . "', '" . $language . "', '" . $title . "', NOW(), '" . (int) $wiki_id . "'";
         $qtxt = "INSERT INTO " . $this->getWikiPageInfoTable() . " (" . $field_list . ") VALUES (" . $field_val . ")";
         $q = $this->_executeInsert($qtxt);
     }
     return $res;
 }
Esempio n. 4
0
 /**
  *
  */
 function setModRewriteTitle($txt)
 {
     //require_once(_base_.'/lib/lib.utils.php');
     $this->mod_rewrite_title = getCleanTitle($txt);
 }