Exemplo n.º 1
0
Arquivo: mod.php Projeto: philum/cms
function build_mods($r)
{
    //p($r);
    $ptit_css = 'txtcadr';
    $pbdy_css = 'panel';
    $smcss = 'small';
    //mod,param,title,condition,command,option,(bloc),hide,template,nobr,div,ajxbtn
    list($m, $p, $t, $c, $d, $o, $ch, $hd, $tp, $nbr, $dv, $jbt) = $r;
    $t = stripslashes($t);
    switch ($m) {
        //main
        case 'LOAD':
            if ($_SESSION['read']) {
                $ret = art_read($tp);
            } else {
                $ret = api_arts($_SESSION['frm'], $o, $tp);
            }
            break;
        case 'Page_titles':
            $ret = page_titles($o);
            break;
        case 'All':
            $api = api_arts_rq($p, $o);
            $api['t'] = $t ? $t : nms(100);
            break;
        case 'category':
            if ($p == 1 && $_SESSION['frm'] == 'Home') {
                $p = 'All';
            }
            $ret = api_arts($p, $o, $tp);
            break;
        case 'Board':
            $ret = collect_board($p);
            break;
        case 'plan':
            $ret = arts_plan($m, $p);
            break;
        case 'Hubs':
            $ret = arts_plan($m, $p);
            break;
        case 'gallery':
            $ret = arts_plan($m, $p);
            break;
        case 'tracks':
            $ret = trkarts($p, $t);
            break;
            //api_tracks($t)
        //api_tracks($t)
        case 'MenusJ':
            $ret = ajxlink($p, 'mjx', $o, $d);
            break;
            //case('Wall'): $ret=wall_arts($t,$p); break;
        //case('Wall'): $ret=wall_arts($t,$p); break;
        case 'api':
            $ret = plugin('apicom', str_replace(';', ',', $p), $o);
            break;
        case 'api_mod':
            $api = api_defaults_rq(explode_k(str_replace(';', ',', $p), ',', ':'));
            break;
            //:,
        //:,
        case 'api_arts':
            $api = api_mod_arts($p, $t, $tp);
            if ($d == 'panel') {
                $api['cmd'] = $d;
            }
            $api['cols'] = $o;
            break;
            //&=
        //&=
        case 'articles':
            $load = api_mod_arts_row($p);
            $obj = 1;
            break;
            //&=
            //case('articles'): $api=api_mod_rq($p.'&t=x'); break;//&=
        //&=
        //case('articles'): $api=api_mod_rq($p.'&t=x'); break;//&=
        case 'tab_mods':
            $ret = tab_mods($p);
            break;
        case 'last':
            $ret = art_read_b('last', $n, 3, '');
            break;
        case 'player':
            $ret = flash_prep('', $p);
            break;
        case 'friend_art':
            $ret = friend_art($o);
            break;
        case 'friend_rub':
            $ret = friend_rub($o);
            break;
        case 'related_arts':
            $load = related_art();
            break;
        case 'related_by':
            $load = related_art_by();
            break;
        case 'prev_next':
            $ret = prevnext_art($d, $p, $o);
            break;
        case 'cat_arts':
            $p = $p != 1 ? $p : $_SESSION['frm'];
            $t = $t != $m ? $t : $p;
            $load = tri_rqt($p, 1, $_SESSION['dayx']);
            break;
        case 'priority_arts':
            $load = tri_rqt($p, 11);
            $t = $t != $m ? $t : $p;
            break;
        case 'recents':
            $load = recents_arts($p, $o);
            $obj = 1;
            break;
        case 'read':
            $ret = divc($o, read_msg($p, 3));
            break;
        case 'popart':
            $ret = pop_art($p);
            break;
        case 'pub_art':
            $ret = pub_art_b($p, $o);
            break;
        case 'pub_arts':
            $load = array_flip(explode(' ', $p));
            break;
        case 'pub_img':
            $ret = pub_img($p);
            break;
        case 'taxo_arts':
            $load = taxo_arts($p);
            if ($t > 1) {
                $t = suj_of_id($t);
            }
            break;
        case 'taxo_nav':
            $ret = plugin('taxonav', $p, $o);
            break;
        case 'read_art':
            $ret = read_art($p, $t);
            $t = '';
            break;
        case 'short_arts':
            $load = short_arts($p);
            if ($o <= 3) {
                $prw = $o;
            }
            break;
        case 'most_read':
            $ret = most_read_mod($p, $t, $d, $o, $m, $tp);
            $t = '';
            break;
        case 'same_title':
            $load = same_title();
            break;
        case 'deja_vu':
            if ($_SESSION['mem']) {
                $load = $_SESSION['mem'];
            }
            break;
            //com
        //com
        case 'rss_input':
            if ($p) {
                $ret = rssin(ajx($p, 1));
            }
            break;
        case 'disk':
            require_once 'ajxf.php';
            $_SESSION['dlmod'] = $p;
            if ($p && $p != '/') {
                $pb = '/' . $p;
            }
            $ret = divd('dsnavds', ds_nav('dl', 'users/' . ses('qb') . $pb));
            break;
        case 'finder':
            $ra = array('|', '-');
            $p = str_replace($ra, '/', $p);
            $o = str_replace($ra, '/', $o);
            req('finder');
            $ret = finder($p, $o, $d);
            break;
        case 'channel':
            $ret = plugin('channel', $p, $t, $d, $o);
            $t = '';
            break;
        case 'hour':
            setlocale(LC_TIME, "fr_FR");
            //%A%d%B%G%T
            if ($p) {
                $dat = strftime($p ? $p : '%y%m%d:%H%M', $_SESSION['dayx']);
            } else {
                $dat = mkday('', 1);
            }
            if (!$d) {
                $ret = btn($o, $dat);
            } else {
                $ret = divc($o, $dat);
            }
            break;
        case 'cart':
            $ret = lkc("txtcadr", "/?plug=cart", $p != 1 ? $p : "Cart");
            $ret = divd('cart', m_pubart($_SESSION['cart'], 'scroll', 7));
            break;
        case 'video':
            $ret = video_auto($p, '', '', 3);
            break;
        case 'video_playlist':
            $load = videoplaylist($p);
            $obj = 1;
            $prw = 'vd';
            break;
        case 'video_viewer':
            $ret = videoboard($p, $c, $o);
            break;
            //txt
        //txt
        case 'text':
            $ret = stripslashes(urldecode($p));
            if ($o) {
                $ret = divc($o, $ret);
            }
            break;
        case 'connector':
            if (substr($p, 0, 1) != "[" && substr($p, -1, 1) != "]") {
                $p = '[' . $p . ']';
            }
            $ret = nl2br(format_txt_r($p, '', ''));
            if ($o == 'article') {
                $ret = balc('article', 'justy', format_txt($p, '', ''));
            }
            break;
        case 'codeline':
            if ($p) {
                $ret = correct_txt($p, "", 'codeline');
            }
            break;
        case 'clear':
            $ret = divc("clear", "");
            break;
        case 'hr':
            $ret = '<hr' . atc($p) . ' />';
            break;
        case 'br':
            $ret = br();
            break;
            //menus
            //case('ajax'): $ret=lj('',$p,$t); break;
        //menus
        //case('ajax'): $ret=lj('',$p,$t); break;
        case 'conn':
            $ret = connectors($p, $o, '');
            break;
        case 'link':
            if ($d == 'noli') {
                $ret = special_link($p, $o);
            } else {
                if (strpos($p, '§')) {
                    list($p, $t) = split_one('§', $p, 0);
                }
                $lin[] = mod_link_r($p, $t);
            }
            break;
        case 'user_menu':
            $ret = user_menu($p);
            break;
            //mod_link
        //mod_link
        case 'app_link':
            $ret = read_apps_link($p, $d, $o);
            break;
        case 'app_menu':
            $r = build_apps($p, $d);
            $ra = m_apps($r, 'menu', '');
            if ($o == 'icons') {
                $ret = desktop_build_ico($ra, 'icones');
            } else {
                $ret = app_list($ra, '', $o);
            }
            $ret .= divc('clear', '');
            break;
        case 'app_popup':
            Head::add('jscode', sj(read_apps(explode(',', $p))));
            break;
        case 'categories':
            $line = $_SESSION['line'];
            if ($line) {
                ksort($line);
                $d = $d ? $d : 'lines';
                if ($d == 'cols' && !$o) {
                    $o = 4;
                }
                if ($o == 'home') {
                    $lin[] = array($_GET['module'], 'module', 'Home', 'Home');
                }
                foreach ($line as $k => $va) {
                    if ($o == 'nb') {
                        $ka = $k . ' (' . $va . ')';
                    } else {
                        $ka = $k;
                    }
                    $lin[] = array($_SESSION['frm'], 'cat', $k, $ka);
                }
            }
            break;
        case 'overcats':
            req('bubs');
            return mkbub(bub_root('overcat', 'zero'), 'inline', '1');
            break;
        case 'MenuBub':
            req('bubs');
            return mkbub(bub_root('menubub', 'zero'), 'inline', '1');
            break;
        case 'timetravel':
            return timetravel($p, $o);
            break;
        case 'submenus':
            return bubble_menus($p, $o);
            break;
        case 'taxonomy':
            $ret = taxonomy($p, $o);
            break;
        case 'rub_taxo':
            $ret = rub_taxo($p, $t);
            $t = '';
            break;
        case 'folders':
            $load = supertriad_ask();
            $prw = $o;
            $obj = 63;
            break;
        case 'desk':
            $ret = deskmod($p);
            break;
        case 'desktop_arts':
            $ret = title($t) . desktop_arts($p, $o, 'arts');
            break;
        case 'desktop_varts':
            $ret = title($t) . desktop_arts($p, $o, 'varts');
            break;
        case 'desktop_files':
            $ret = title($t) . desktop_arts($p, $o, 'files');
            break;
        case 'hierarchics':
            $in = m_suj_hierarchic('active', '');
            $ret = balc("ul", $pbdy_css, $in);
            break;
            //cacheable
        //cacheable
        case 'hubs':
            $mn = $_SESSION['mn'];
            if (count($mn) >= 2) {
                $t = $p != 1 ? $p : $t;
                if ($t) {
                    $t = lkc('', htac('module') . 'hubs', $t);
                }
                $in = m_nodes_b($mn, $o);
                $ret = balc("ul", $pbdy_css, $in);
            }
            break;
        case 'tags':
            if ($t) {
                $t = lkc('', '/plugin/tags/' . $p . '/1', $t);
            }
            $lin = tag_mod($p, $o, $d);
            break;
        case 'tags_cloud':
            $p = $p ? $p : 'tag';
            $ret = btn($ptit_css, lkc('', "/plug/tags", $p));
            $line = tags_list($p, ses('nbj'));
            $in = tags_cloud($line, 10, 22, ' ', $p);
            $ret .= divc($pbdy_css, $in);
            break;
        case 'tag_arts':
            list($p, $o) = split_one(':', $p);
            $load = tag_arts($p, $o);
            break;
        case 'last_tags':
            $lin = last_tags($p, $o, $d);
            break;
        case 'classtag_arts':
            $load = classtag_arts($p);
            break;
            //class find id//$o=$p;
        //class find id//$o=$p;
        case 'see_also-tags':
            $r = see_also_tags($p ? $p : 'tag');
            if ($r) {
                $ret = see_also($r, $p, $d, $o, $tp);
            }
            break;
        case 'see_also-rub':
            $t = $p != 1 ? $p : $_SESSION['frm'];
            if ($_GET['read']) {
                $load = see_also_rub($p);
            }
            break;
        case 'see_also-source':
            list($load, $t) = see_also_source($o);
            break;
        case 'siteclics':
            $ret = siteclics($p);
            break;
        case 'rub_tags':
            $ret = rub_tags($p);
            break;
        case 'sources':
            if ($t) {
                $t = lkc('', '/module/source', $t);
            }
            $lin = art_sources($p);
            break;
        case 'msql_links':
            if ($o == 'rss') {
                $l = '/?plug=rssin&rssurl=';
            } elseif ($o == 'mail') {
                $l = 'mailto:';
            } else {
                $l = '';
            }
            $ret = msql_links($p, $o, $l, $d, $t);
            $t = '';
            break;
        case 'rss':
            $ret .= balc('ul', 'panel', divd('rssj', rssj($p ? $p : 'rssurl', $o)));
            break;
        case 'rssin':
            $ret .= rssj_m($p, $o);
            break;
        case 'chat':
            if ($t) {
                $t = ljb('', 'SaveD', 'cht' . $p . '_chat_' . $p, $t);
            }
            $p = $p != 1 ? $p : 'pub';
            $in = plugin('chat', $p, $o ? $o : 10);
            if ($in) {
                $ret = divc($pbdy_css, $in);
            }
            break;
        case 'stats':
            $ret = plugin('stats', '', '');
            break;
        case 'archives':
            if ($p == 1) {
                $p = $m;
            }
            if ($p) {
                $ret = btn($ptit_css, $p);
            }
            $in = divd("archives", m_archives(""));
            $ret .= balc('ul', $pbdy_css, $in);
            break;
        case 'agenda':
            $load = sql('ib,msg', 'qdd', 'kv', 'val="agenda"');
            $tim = time();
            if ($load) {
                foreach ($load as $k => $v) {
                    if (strtotime($v) < $tim) {
                        unset($load[$k]);
                    }
                }
            }
            break;
        case 'folders_varts':
            $load = mod_varts($p);
            break;
        case 'panel_arts':
            $ret = plugin_func('panart', 'panart_build', $p);
            break;
        case 'calendar':
            $in = calendar(ses('daya'));
            if ($p == 1) {
                $p = $m;
            }
            if ($p) {
                $ret = btn($ptit_css, $p);
            }
            $ret .= divc($pbdy_css, $in);
            break;
        case 'newsletter':
            if ($o) {
                $ret = call_plug($ptit_css, 'popup', 'mailist', $p, $p) . ' ';
            } else {
                $ret = plugin('mailist', '', $p);
            }
            break;
        case 'bridge':
            $_GET['urlsrc'] = $p = 'http://' . $p . '/' . ajx($t, 1);
            $rea = vacuum($p, '');
            $po['suj'] = $rea[0];
            $po['msg'] = format_txt($rea[1], 3, $id);
            $po['source'] = picto('link') . ' ' . pub_link($p);
            $ret = template($po, '');
            break;
        case 'columns':
            $ret = mod_columns($p, $o);
            break;
            //users
        //users
        case 'login':
            $ret = login_btn($p, $o);
            break;
        case 'login_popup':
            $ret = login_btn_p($p, $o);
            break;
        case 'log-out':
            if (ses('USE')) {
                $ret .= lkc($smcss, '/logout', picto('logout')) . ' ';
            }
            break;
        case 'search_form':
            $ret = search_btn($p, $o, '', $d);
            break;
        case 'search':
            $load = plugin_func('search', 'rech', $p, $o);
            break;
        case 'social':
            $ret = plugin('social', $p, $o);
            break;
            //banner
        //banner
        case 'Banner':
            $ret = make_ban($p, $t, $o);
            break;
        case 'ban_art':
            if ($p != 1) {
                $ret .= lka(subdom(ses('qb')), read_msg($p, ''));
            }
            break;
            //footer
        //footer
        case 'credits':
            $ret = lj('bevel', 'popup_about', picto('phi2'));
            break;
        case 'admin':
            $ret = lkc($smcss, '/admin/log/open', $t ? $t : picto('admin')) . ' ';
            $t = '';
            break;
        case 'chrono':
            $ret = btn('txtsmall2', round(mtime() - $_SESSION['stime'], 2) . 's') . ' ';
            break;
        case 'contact':
            $ret = contact($p, $o ? $o : $smcss) . ' ';
            break;
            //plugs
        //plugs
        case 'taxonav':
            return plugin('taxonav', $p, $t);
            $t = '';
            break;
        case 'iframe':
            $ret = plugin('ifram', '', '');
            break;
        case 'suggest':
            $ret = pluginside(nms(126), 'suggest', $p, $o);
            break;
        case 'create_art':
            $ret = f_inp('', '');
            break;
        case 'twitter':
            if ($p) {
                $ret = plugin('twitter', $p, $o);
            }
            break;
        case 'profil':
            $ret = plugin_func('profil', $p, $o);
            break;
            //special
        //special
        case 'BLOCK':
            $ret = build_modules($p, '');
            break;
        case 'module':
            $ret = build_mod_r($p);
            break;
        case 'command':
            $ret = com_mod($p);
            break;
        case 'plug':
            list($pp, $po) = split('-', $o);
            $ret = plugin($p, $pp, $po);
            break;
        case 'pluf':
            list($pp, $po) = split('-', $p);
            list($op, $oo) = split('-', $o);
            $ret = plugin_func($pp, $po, $op, $oo);
            break;
        case 'plup':
            return lj('', 'popup_plupin___' . $p . '_' . $o . '_', $t ? $t : $p);
            break;
        case 'close':
            $ret = '';
        default:
            if ($p && $m) {
                $reb = connectors($p . ($o ? '§' . $o : '') . ':' . $m, "", "");
            }
            if ($reb && $reb != '[' . $p . ':' . $m . ']') {
                $ret = $reb;
            } else {
                $reb = plugin($m, $p, $o);
                if ($reb) {
                    $ret = build_titl('', $t ? $t : $m, '') . $reb;
                }
            }
            break;
    }
    //menus
    if ($lin) {
        $ret = mod_lin($lin, $t, $d, $o);
    }
    //arts
    if ($load) {
        $ret = mod_load($load, $ret, $t, $d, $o, $obj, $prw, $tp, $id);
    }
    //api
    if ($api) {
        $ret = api_load($api);
    }
    //umods
    if (!$ret && !$lin && !$load && $p && $m) {
        //user_mods
        $func = msql_read('', $_SESSION['qb'] . '_modules', $m);
        if ($func && !is_array($func)) {
            $ret = cbasic($func, $p);
        }
    }
    if (!$nbr) {
        $br = br();
    }
    if ($ret) {
        if ($dv) {
            return divc('mod', $ret) . $br;
        } else {
            return $ret . $br;
        }
    }
}
function types()
{
    $t = taxonomy('mith_research_type');
    $t[] = array("name" => "Other", "slug" => "other", "broader" => [], "narrower" => []);
    return $t;
}