Exemple #1
0
function pane_base($url, $suj, $frm, $day, $img, $msg, $alx)
{
    static $id;
    $id++;
    //$msg=ereg_replace('width='."^[_a-zA-Z0-9.]+$","",$msg);//([[:digit:]]*)
    $ara = array("<![CDATA[", "]]>");
    $suj = str_replace($ara, " ", $suj);
    $url = str_replace($ara, " ", $url);
    $msg = str_replace($ara, " ", $msg);
    if ($img != "") {
        $gmi = '<img src="' . $img . '" class="imgl" border="0" height="72">';
    }
    $id_art = recognize_article($url, clean_title($suj), $alx);
    //already_exists
    if ($id_art) {
        $opt .= popart($id_art);
    } elseif ($_SESSION["USE"] == $_SESSION["qb"] or $_SESSION["auth"] > 3) {
        $purl = ajx($url, '');
        $opt .= ljb('txtx', 'SaveJ', 'popup_addArt___' . $purl . '_1', "save") . ' ';
        //$opt.=ljb('txtbox','SaveIf',$purl,'save').' ';
        $opt .= btd('btc' . $id, lj('txtx', 'btc' . $id . '_batch__xd_' . $purl . '_p', '+')) . ' ';
        $opt .= ljb('txtx', 'Close', 'art' . $id, 'x');
    }
    $panout = array('sty' => 'tab', 'id' => $id, 'suj' => $suj, 'date' => $day, 'tag' => " ", 'opt' => $opt, 'thumb' => $gmi, 'msg' => $msg, 'url' => $url);
    $ret = template_build(template_rss(), $panout);
    return divd('article', $ret);
}
Exemple #2
0
function action_rss()
{
    global $days, $min, $page, $pagestore;
    $itemdesc = '';
    if ($min == 0) {
        $min = 10;
    }
    if ($days == 0) {
        $days = 2;
    }
    if (!isset($_GET['page'])) {
        $page = 'RecentChanges';
    }
    if ($page == 'RecentChanges') {
        $pages = $pagestore->allpages();
    } else {
        $pages = $pagestore->givenpages(array($page));
    }
    usort($pages, 'catSort');
    $now = time();
    for ($i = 0; $i < count($pages); $i++) {
        if ($page == 'RecentChanges') {
            if ($days >= 0 && $now - $pages[$i][0] > $days * 24 * 60 * 60 && $i >= $min) {
                break;
            }
        }
        // Gets the diff as it shows by default on History page.
        // See diff_get_history_versions in lib/diff.php.
        $history = $pagestore->history($pages[$i][1]);
        $versions = diff_get_history_versions($history);
        $latest_ver = $versions['latest_ver'];
        $previous_ver = $versions['previous_ver'];
        $p1 = $pagestore->page($pages[$i][1]);
        $p1->version = $previous_ver;
        $p2 = $pagestore->page($pages[$i][1]);
        $p2->version = $latest_ver;
        if ($previous_ver == $latest_ver) {
            $diff = $p1->read();
            $diff = explode("\n", $diff);
            foreach ($diff as $key => $value) {
                $diff[$key] = "+{$value}";
            }
            $diff = implode("\n", $diff);
        } else {
            $diff = diff_compute($p1->read(), $p2->read());
        }
        $diff = diff_parse($diff);
        $diff = str_replace('<td class="diff-added">', '<td style="background-color:#ccffcc;color:#000000;">', $diff);
        $diff = str_replace('<td class="diff-removed">', '<td style="background-color:#ffaaaa;color:#000000;">', $diff);
        #$diff = preg_replace('/\n/', chr(13) . chr(10), $diff);
        #$diff = preg_replace('/\n/', "<br>\n", $diff);
        $itemdesc = $itemdesc . '<item>' . "\n" . '<title>' . $pages[$i][1] . '</title>' . "\n" . '<pubDate>' . date('r', $pages[$i][0]) . '</pubDate>' . "\n" . '<link>' . viewFullURL($pages[$i][1]) . '&amp;' . $pages[$i][7] . '</link>' . "\n" . '<description>' . htmlspecialchars(($pages[$i][5] ? $pages[$i][5] . "<br>\n<br>\n" : '') . $diff) . '</description>' . "\n" . '</item>' . "\n\n";
    }
    template_rss(array('itemdesc' => $itemdesc, 'page' => $page));
}
Exemple #3
0
function action_rss()
{
    global $pagestore, $min, $days;
    $itemseq = '';
    $itemdesc = '';
    if ($min == 0) {
        $min = 10;
    }
    if ($days == 0) {
        $days = 2;
    }
    $pages = $pagestore->allpages();
    usort($pages, 'catSort');
    $now = time();
    for ($i = 0; $i < count($pages); $i++) {
        $editTime = mktime(substr($pages[$i][0], 8, 2), substr($pages[$i][0], 10, 2), substr($pages[$i][0], 12, 2), substr($pages[$i][0], 4, 2), substr($pages[$i][0], 6, 2), substr($pages[$i][0], 0, 4));
        if ($days >= 0 && $now - $editTime > $days * 24 * 60 * 60 && $i >= $min) {
            break;
        }
        $itemseq = $itemseq . '                <rdf:li rdf:resource="' . viewURL($pages[$i][1], $pages[$i][7]) . '" />' . "\n";
        $itemdesc = $itemdesc . '    <item rdf:about="' . viewURL($pages[$i][1], $pages[$i][7]) . '">' . "\n" . '        <title>' . $pages[$i][1] . '</title>' . "\n" . '        <link>' . viewURL($pages[$i][1]) . '</link>' . "\n" . '        <description>' . $pages[$i][5] . '</description>' . "\n" . '        <dc:date>' . html_gmtime($pages[$i][0]) . '</dc:date>' . "\n" . '        <dc:contributor>' . "\n" . '            <rdf:Description wiki:host="' . $pages[$i][2] . '"' . ($pages[$i][3] == '' ? '' : ' link="' . viewURL($pages[$i][3]) . '"') . '>' . "\n" . ($pages[$i][3] == '' ? '' : '                <rdf:value>' . $pages[$i][3] . '</rdf:value>' . "\n") . '            </rdf:Description>' . "\n" . '        </dc:contributor>' . "\n" . '        <wiki:status>updated</wiki:status>' . "\n" . '        <wiki:importance>major</wiki:importance>' . "\n" . '        <wiki:diff>' . historyURL($pages[$i][1]) . '</wiki:diff>' . "\n" . '        <wiki:version>' . $pages[$i][7] . '</wiki:version>' . "\n" . '        <wiki:history>' . historyURL($pages[$i][1]) . '</wiki:history>' . "\n" . '    </item>' . "\n";
    }
    template_rss(array('itemseq' => $itemseq, 'itemdesc' => $itemdesc));
}
Exemple #4
0
function data_brain($type)
{
    $slct = $_GET['slct'];
    if ($_POST['titl']) {
        $slct = $_POST['titl'];
    }
    $goto = '/?admin=' . ($type == 'template' ? 'templates' : $type);
    if ($type == 'template') {
        $lisb = array('articles', 'tracks', 'titles', 'pubart', 'book');
        $ret .= hlpbt('templates') . ' ';
    } else {
        $ret .= hlpbt('clbasic') . ' ';
    }
    $ret .= btn_switch('pubase', 1, $goto . '&slct=' . $slct, 'public') . ' ';
    $bs = $_SESSION['pubase'] ? 'public' : ses('qb');
    $nod = $bs . '_' . $type;
    $ret .= msqlink('', $bs . '_' . $type) . ' ';
    $ra = msql_read('', $nod, '', 1);
    if ($ra) {
        $list = array_keys($ra);
    }
    $csa = $_GET['local'] ? 'popdel' : 'popsav';
    if ($lisb) {
        $ret .= slct_menus($lisb, $goto . '&local=1&slct=', $slct, $csa, 'popbt', 'v') . ' ';
    }
    $ret .= lkc('txtx', $goto . '&slct=new', picto('add')) . br();
    $csa = !$_GET['local'] ? 'txtyl' : 'txtred';
    if ($ra) {
        $ret .= slct_menus($list, $goto . '&slct=', $slct, $csa, 'txtx', 'v') . ' ';
    }
    if ($type != 'template') {
        $forbid = data_forbidden_names($slct, $nod);
    }
    $ret .= $forbid . br();
    if ($_GET['erase'] && $slct) {
        modif_vars('users', $nod, $slct, 'del');
        relod($goto);
    }
    if ($_GET['erase'] && $type == 'template') {
        $_SESSION['template'][$slct] = '';
    }
    if ($slct) {
        //save
        $msg = $ra[$slct];
        $rmsg = array(addslashes($msg));
        if ($slct == 'pubart' && !rstr(55)) {
            $ret .= pictxt('alert', 'rstr(55)');
        }
        if ($slct == 'tracks' && !rstr(65)) {
            $ret .= pictxt('alert', 'rstr(65)');
        }
        if ($slct == 'titles' && !rstr(66)) {
            $ret .= pictxt('alert', 'rstr(66)');
        }
        if ($slct == 'book' && !rstr(67)) {
            $ret .= pictxt('alert', 'rstr(67)');
        }
        if ($_GET['mkpub']) {
            modif_vars('users', 'public_' . $type, $rmsg, $slct);
        }
        if ($_GET['mkpriv']) {
            modif_vars('users', ses('qb') . '_' . $type, $rmsg, $slct);
        }
        if ($type == 'template' && $_GET['local']) {
            if ($slct == 'articles') {
                $msg = template_art();
            } elseif ($slct == 'meta') {
                $msg = template_meta();
            } elseif ($slct == 'rssin') {
                $msg = template_rss();
            } elseif ($slct == 'pubart') {
                $msg = template_pubart();
            } elseif ($slct == 'tracks') {
                $msg = template_tracks();
            } elseif ($slct == 'titles') {
                $msg = template_titles();
            } elseif ($slct == 'book') {
                $msg = template_book();
            } elseif ($slct == 'products') {
                $msg = template_product();
            }
        }
        $ret .= codeline_editor($msg, $type, $slct);
        if (!$_SESSION['pubase'] && !$_GET['mkpub']) {
            $ret .= br() . lkc('txtx', $goto . '&slct=' . $slct . '&mkpub==', 'make public') . ' ';
        } elseif ($_SESSION['pubase'] && !$_GET['mkpriv']) {
            $ret .= br() . lkc('txtx', $goto . '&slct=' . $slct . '&mkpriv==', 'make private') . ' ';
        }
        $ret .= input(1, 'titl', $slct) . ' ';
        $ret .= lj('popsav', 'dtb_call__xd_admin_data*brain*sav_' . $bs . '_' . $type . '_titl|txarea', nms(57)) . ' ' . btd('dtb', '') . ' ';
        //sav
        if ($slct != 'default') {
            $ret .= lkc('txtyl', $goto . '&slct=' . $slct . '&erase==', 'x') . br();
        }
        $ret .= jmp_btn_cb() . br();
        $sj = sj('clva_call___admin,pop,tri,mod,spe,art_clview*basic*j_' . $type . '_' . $slct . '_clvb|txarea');
        $ret .= txarea($type . '" class="console" id="txarea" onkeyup="' . $sj . '" onclick="' . $sj, stripslashes($msg), 44, 14);
    }
    return divd('', $ret);
}