Exemplo n.º 1
0
function config_mod($mnb, $option)
{
    $rm = msql_read('users', $_SESSION['modsnod'], $mnb);
    //module
    $mod = $rm['module'];
    $bloc = $rm['block'];
    $param = $rm['param'];
    if (strpos($param, ',')) {
        $param = str_replace(', ', ",\n", $param);
        $param = ereg_replace("[\n]{2,}", "\n", $param);
    }
    $arb = msql_read('system', 'admin_modules', $mod);
    //props
    $type = $arb['category'];
    $prm = $arb['param'];
    $opt = $arb['option'];
    $com = $arb['command'];
    $com = str_replace('scroll', 'scroll scrold', $com);
    $arc = msql_read('lang', 'admin_modules', $mod);
    $fhlp = $arc['description'];
    if (strpos(prma('blocks'), $mod) !== false && $mod) {
        $type = "div";
        $fhlp = $fhlp ? $fhlp : nms(90);
        $prm = 3;
        $arb["title"] = 1;
    } elseif (!$type && $mod != 'system') {
        $type = 'user_mod';
        $fhlp = 'obsolete';
    } elseif ($mod == 'Page_titles') {
        $fhlp .= ' ' . hlpbt('breadcrumb');
    }
    if ($bloc == 'menus') {
        $type = 'menu_link';
        $fhlp = 'menu link';
    }
    if ($arc['help']) {
        $phlp = admhlp('grey', ajx($mod), 'help') . ' ';
    }
    if ($arc['option']) {
        $ohlp = admhlp('grey', ajx($mod), 'option') . ' ';
    }
    if ($arc['command']) {
        $dhlp = admhlp('grey', ajx($mod), 'command') . ' ';
    }
    //usage
    $rc = array('module' => bal('strong', $mod) . ' (' . $type . ') ' . $mnb, 'usage' => divc('small', $fhlp));
    if ($_SESSION['line'][$param]) {
        $rc["article"] = lkt('', htac('section') . $param, $param);
    } elseif ($prm == 2) {
        //wait_ID
        if (!is_numeric($param)) {
            $id = find_id($param);
        } else {
            $id = $param;
        }
        if (is_numeric($id) && $param > 3) {
            list($dy, $frm, $suj, $amg) = pecho_arts($id);
            //art
            $rc["article"] = lkt('', '/?read=' . $id, $suj);
        }
    }
    $l = 'modules_' . $bloc . '_' . $mnb;
    $rid = randid();
    $rds = array('mb', 'mm', 'mp', 'mt', 'mc', 'md', 'mo', 'mh', 'mv', 'me', 'mr', 'mi', 'mj');
    foreach ($rds as $k => $v) {
        $rvs[$v] = $v . $rid;
        $dvs .= $v . $rid . '|';
    }
    //$dvs.=;
    $sty = '" onkeypress="checkEnter(event,\'savmod\')';
    $form .= hidden('', $rvs['mm'], $mod);
    //edit
    if ($mod == "submenus") {
        require_once 'spe.php';
        $rc["edit"] = menus_h($mnb);
        if ($option) {
            $param = menu_h_g($option);
        }
    }
    if ($mod == "Banner") {
        $rc["edit"] = lkc("popbt", '/admin/banner', 'edit_banner');
    } elseif ($mod == "user_menu") {
        $rc["edit"] = jump_btns($rvs['mp'], spelinks(), ' ');
    } elseif ($mod == "app_menu") {
        $rc["edit"] = btn('console', 'button/type/process/param/option/condition/root/icon/hide/private§display[,]');
    } elseif ($mod == 'link' or $mod == "url") {
        $arr = explode('|', spelinks());
        if ($_SESSION['line']) {
            $arr += array_flip($_SESSION['line']);
        }
        $rc["edit"] = select(array('id' => 'mps', 'onchange' => 'jumpslct(\'' . $rvs['mp'] . '\',this)', 'style' => "width:90px;"), $arr, 'vv');
    } elseif ($mod == 'template') {
        $ra = msql_read('', ses('qb') . '_template', '', 1);
        if ($ra) {
            $rb = array_keys_r($ra, 1, 'k');
            $rc["edit"] = jump_btns($rvs['mp'], $rb, '');
        }
    } elseif ($mod == 'msql_links') {
        $rc["edit"] = jump_btns($rvs['mp'], 'links|rssurl|deploy', '');
    } elseif ($mod == 'connector') {
        req('art');
        $rc["edit"] = conn_edit();
        $rc["edit"] .= txarea('txtarea', $param, 50, 5, 'txtnoir" onkeyup="transvalue(\'' . $rvs['mp'] . '\')" onclick="transvalue(\'' . $rvs['mp'] . '\')"; onblur="transvalue(\'' . $rvs['mp'] . '\');');
    } elseif ($mod == 'desktop') {
        $rc["edit"] = hlpbt('desklr');
    } elseif ($mod == 'cssfonts') {
        $rc["edit"] = jump_btns($rvs['mp'], 'fontphilum|fontmicrosys|', ' ');
    } elseif ($mod == 'columns') {
        $rc["edit"] = mod_edit('', 1, $rvs['mp']);
    } elseif ($mod == 'articles') {
        $rc["edit"] = divd('amc', artmod_edit_l($rvs['mp'], '', ''));
    } elseif ($mod == "design" && prmb(5)) {
        $rc["edit"] = picto(alert) . helps('prmb5');
    }
    //param
    if ($mod == 'tab_mods' or $mod == 'MenusJ' or $mod == 'art_mod') {
        $rc["param"] = comline($param, $rvs['mp']);
    } elseif ($mod == 'app_menu') {
        $rc["param"] = appmenu($param, $rvs['mp']);
    } elseif ($mod == "submenus") {
        $rc["param"] = txarea($rvs['mp'], $param, 42, 4);
    } elseif ($prm != '0') {
        $rc["param"] = goodarea($param, $rvs['mp'], '', $j, 42);
    } else {
        $form .= hidden('', $rvs['mp'], '');
    }
    if ($mod == 'desktop') {
        $rc["edit"] = $phlp;
        $rc["param"] .= ' ' . hlpbt('desklr');
    } elseif ($rc["param"] && $mod != 'apps' && $phlp) {
        $rc["param"] .= ' ' . $phlp;
    }
    //title
    if ($prm != '1' && !$arb["title"]) {
        $rc["title"] = input(1, $rvs['mt'] . '" size="42' . $sty, $rm['title'], "");
    } else {
        $form .= hidden('', $rvs['mt'], '');
    }
    //bloc
    if ($bloc != 'system' && $bloc != 'newsletter' && $bloc != 'gsm') {
        $rc["bloc"] = select_j($rvs['mb'], 'system ' . prma('blocks'), $bloc, 1, $bloc, 0);
    } else {
        $form .= hidden('', $rvs['mb'], $bloc);
    }
    //condition
    if ($bloc != 'newsletter') {
        $rc["condition"] = select_j($rvs['mc'], '- home cat art', $rm['condition'], 3, $rm['condition'], 0) . ' ' . hlpbt('mod_cond');
    } else {
        $form .= hidden('', $rvs['mc'], '');
    }
    //command
    if ($com) {
        $rc["command"] = select_j($rvs['md'], '- ' . ajx($com), $rm['command'], 1, $rm['command'], 0) . ' ' . $dhlp;
    } else {
        $form .= hidden('', $rvs['md'], '');
    }
    //option
    if ($opt != '0') {
        $rc["option"] = select_j($rvs['mo'], '-|' . $opt, $rm['option'], 3, $rm['option'], 0) . ' ';
        if ($mod == 'LOAD') {
            $rc["option"] .= hlpbt('art_render');
        } else {
            $rc['option'] .= $ohlp;
        }
    } else {
        $form .= hidden('', $rvs['mo'], '');
    }
    //template
    if ($arb["template"]) {
        $ara = msql_read('', ses('qb') . '_template', '', 1);
        if ($ara) {
            $tmp = implode(' ', array_keys($ara));
        }
        $rc["template"] = select_j($rvs['me'], '- ' . ajx($tmp), $rm['template'], 1, $rm['template'], 0);
    } else {
        $form .= hidden('', $rvs['me'], '');
    }
    //cache
    if ($arb["cacheable"]) {
        $rc["cache"] = checkbox_j($rvs['mh'], $rm['cache'], '');
    } else {
        $form .= hidden('', $rvs['mh'], '');
    }
    $rc["hide"] = checkbox_j($rvs['mv'], $rm['hide'], '');
    //hide
    if ($arb["nobr"] != '0') {
        $rc["nobr"] = checkbox_j($rvs['mr'], $rm['nobr'], '');
    } else {
        $form .= hidden('', $rvs['mr'], '');
    }
    if ($arb["div"] != '0') {
        $rc["div"] = checkbox_j($rvs['mi'], $rm['div'], '');
    } else {
        $form .= hidden('', $rvs['mi'], '');
    }
    if ($arb["ajax button"] != '0') {
        $rc["ajax button"] = checkbox_j($rvs['mj'], $rm['js'], '');
    } else {
        $form .= hidden('', $rvs['mj'], '');
    }
    //script
    if ($type != 'system') {
        $oks = lj('popbt', 'popup_modsee__3_' . $mnb . '_1', 'script') . hlpbt('comline') . ' ';
        $oks .= lj('popbt', 'popup_modsee__3_' . $mnb, nms(65)) . ' ';
    }
    //if($mod=='LOAD')$rc["edit"]=fast_sets('load');
    //render
    $bt .= ljb("popdel", "SaveR", $l . '_del\',\'' . $dvs, nms(43)) . ' ';
    $bt .= ljb('popbt', "SaveR", $l . '_new\',\'' . $dvs, nms(44)) . ' ';
    $bt .= ljb('popbt', "SaveR", $l . '_savb\',\'' . $dvs, nms(66)) . ' ';
    $bt .= ljb('popsav', "SaveR", $l . '_sav\',\'' . $dvs, nms(57)) . ' ';
    //master_config
    $ret .= '<form id="savmod" action="javascript:SaveR(\'' . $l . '_sav\',\'' . $dvs . '\')">' . $form;
    $ret .= on2cols($rc, 470, 5);
    $ret .= '</form>';
    $ret .= divs('', $bt . $oks);
    return $ret;
}
Exemplo n.º 2
-1
function plug_editor($reset = '')
{
    secure_inputs();
    if ($_SESSION["dev"] == "dev" or $_SESSION["dev"] == "lab") {
        $g = "b";
    }
    req('pop,spe,art,tri');
    Head::add('csscode', '.tabc{border:1px dotted grey;padding:10px;min-height:25px;width:550px;}');
    Head::add('jscode', '
function SaveIcpb(){//convert
	var opt=document.getElementById("txtareb").innerHTML;
	document.getElementById("txt").value=opt;
	SaveJ("txtarea_convhtml_txtareb_4");
	toggle_tab(\'tab-1\',2);}
function editab(p){
	var act=document.getElementById("edt").className;
	if(act=="txtx" || p==1){var arr=[true,"on","txtred",""];}
	else{var arr=[false,"off","txtx","none"];}
	document.getElementById("txtareb").contentEditable=arr[0];
	document.getElementById("txtareb").designMode="arr[1]"; void 0;
	document.getElementById("txtareb").focus;
	document.getElementById("edt").className=arr[2];
	document.getElementById("edtc").style.display=arr[3];}
');
    //Head::add('rel',array('shortcut icon',uicon('copy_16','edit2','/')));
    $out["head"] .= div(atd('popup') . ats('position:fixed;'), '');
    $out["head"] .= hidden('', 'socket', '');
    if ($_GET['switch_defcon']) {
        $_SESSION['rstr'][18] = $_SESSION['rstr'][18] == 0 ? 1 : 0;
    }
    $basedefs = $_SESSION['rstr'][18] == 0 ? 'public' : $_SESSION['qb'];
    if ($reset == 'reset_cache') {
        $_SESSION['vacuum'] = '';
    }
    ####
    if ($_GET["urlsrc"]) {
        $urlsrc = $_GET["urlsrc"];
        $_GET["urlsrc"] = $urlsrc = strdeb($urlsrc, '?utm_source');
        $urlsrc = str_replace("\$", "?", $urlsrc);
        foreach ($_GET as $k => $v) {
            if ($k == "rssurl") {
                $urlsrc = $v;
            } elseif ($k != 'urlsrc') {
                $urlsrc .= '&' . $k . '=' . $v;
            }
        }
    }
    if ($_POST["urlsrc"]) {
        $urlsrc = $_POST["urlsrc"];
        // && $_POST["txt"]==""
        $_POST["urlsrc"] = $urlsrc = strdeb($urlsrc, '?utm_source');
    }
    if ($_POST["suj"]) {
        $title = $_POST["suj"];
    }
    if (strpos($urlsrc, "http") === false && $urlsrc) {
        $urlsrc = 'http://' . $urlsrc;
    }
    if ($urlsrc && $_POST["txt"] == "") {
        list($title, $reb, $ret, $defid, $defs) = vacuum($urlsrc, "");
    }
    //echo txarea('',$ret,20,4);
    ####
    //see h-number in html(mnu)
    $tabnam = 'tbmdtab-1';
    if ($_POST["urlsrc"] or $_POST["txt"] or $_POST["txb"]) {
        $_SESSION[$tabnam] = '2';
        $npb = $_SESSION['npnb'];
    } elseif ($_POST["urlsrc"] && !$_POST["txt"]) {
        $_SESSION[$tabnam] = '1';
    }
    //else $_SESSION[$tabnam]='0';//current_tab
    if ($_POST["txt"]) {
        $ret = stripslashes($_POST['txt']);
    }
    //html
    if ($_POST["txb"]) {
        $reb = stripslashes($_POST['txb']);
    }
    //conn
    if ($_POST["title"]) {
        $title = stripslashes($_POST['title']);
    }
    if ($_POST["convent"]) {
        $ret = html_entity_decode($ret);
    }
    if ($_POST["convutf"]) {
        $ret = utf8_decode($ret);
    }
    if ($_POST["convurl"]) {
        $ret = urldecode($ret);
    }
    if ($_POST["urlencode"]) {
        $ret = urlencode($ret);
    }
    if ($_POST["table2array"]) {
        $reb = plugin_func('table2array', 'table2array_build', $reb);
    }
    if ($ret && !$reb) {
        //if(!strpos($ret,'<br />') && strpos($ret,"\r"))$ret=nl2br($ret);
        $reb = converthtml($ret);
        //htmlentities //htmlspecialchars
        $reb = html_entity_decode_b($reb);
        $reb = html_entity_decode($reb);
        $reb = convertmail($reb);
        $reb = embed_links($reb);
    } elseif (!$ret) {
        $ret = format_txt(stripslashes($reb), 0, "");
    }
    //if(!$ret)
    $ree = clean_br($ret);
    #edit
    //transformers
    if ($_POST['repla']) {
        if ($_POST['rec_prg']) {
            $reb = ereg_replace(stripslashes($_POST['repla']), stripslashes($_POST['replb']), $reb);
        } else {
            $reb = str_replace(stripslashes($_POST['repla']), stripslashes($_POST['replb']), $reb);
        }
    }
    if ($_POST['del_tab']) {
        $reb = del_tables($reb);
    }
    //if($_POST['conn_to_del']){$reb=correct_txt($reb,$_POST['conn_to_del'],'correct');
    //	$reb=str_replace(array("¬","|"),"",$reb); $reb=clean_br($reb);}
    if ($_POST['del_n'] == "ok") {
        $reb = del_n($reb);
    }
    if ($_POST['clean_mail']) {
        $reb = convertmail($reb);
    }
    if ($_POST["clean_punct"]) {
        $reb = clean_punct($reb);
    }
    if ($_POST["add_punct"] == "ok") {
        $reb = add_lines($reb);
    }
    if ($_POST['clean_br'] or $urlsrc) {
        $reb = clean_br($reb);
    }
    /*----------------------*/
    //import
    if ($_SESSION["dev"]) {
        $dv = ' ' . btn('txtsmall', $_SESSION["dev"]);
    }
    $out['head'] .= lkc("txtx", "/plug/editor", picto('editxt', 16) . $dv) . ' ';
    //'&#8362;'
    //defcons
    if (!$defid) {
        $defid = str_replace(array('http://', 'www.'), '', $urlsrc);
        $defid = substr($defid, 0, strpos($defid, '/'));
    }
    $defcon .= msqlink('users', $basedefs . '_defcons');
    if ($_SESSION['rstr'][18] == 1 && $_SESSION['auth'] > 4) {
        $defcon .= lkc("txtblc", '?switch_defcon==', "switch") . ' ';
        $defcon .= lkt("txtblc", '/msql/users/' . $basedefs . '_defcons&append=users/public_defcons', "herit_from_public") . ' ';
        $defcon .= lkt("txtblc", '/msql/users/public_defcons&append=users/' . $_SESSION["qb"] . '_defcons', "inform_public") . ' ';
    } else {
        $defcon .= btn('txtsmall', 'public_defcons') . ' ';
    }
    if ($defid) {
        $defcon .= lj("txtred", 'popup_editmsql___users/' . $basedefs . '*defcons_' . $defid, "edit");
    }
    $otab['html'] .= '<form id="form1" name="coded" method="post" action="/plug/editor">';
    $otab['html'] .= ljb('txtbox', 'document.coded.txt.select()', '', '::');
    $otab['html'] .= submitj('txtbox', 'codeb', 'convert') . ' ';
    $otab['html'] .= input2("text", "urlsrc", $urlsrc, '" size="36') . ' ';
    if ($urlsrc) {
        $otab['html'] .= lkt('txtx', $urlsrc, 'go') . ' ';
    }
    $otab['html'] .= br();
    $otab['html'] .= '<textarea name="txt" id="txt" class="console" rows="21" cols="61">' . $ret . '</textarea>' . br();
    //htmlentities
    $otab['html'] .= $defcon . ' ';
    $otab['html'] .= checkbox("objects", "ok", "objects", 0) . ' ';
    //$otab['html'].=checkbox("jump","ok","not_convert",0).br();
    $otab['html'] .= checkbox("nobr", "ok", "br", 0);
    $otab['html'] .= checkbox("convent", "ok", "entities", 0) . ' ';
    $otab['html'] .= checkbox("convutf", "ok", "utf8", 0) . ' ';
    $otab['html'] .= checkbox("convurl", "ok", "url", 0) . ' ';
    $otab['html'] .= checkbox("see", "ok", "show_work", 0) . br();
    $otab['html'] .= lkt("txtblc", "/plug/converts", "conversions") . ' ';
    $otab['html'] .= lkt("txtblc", "/plug/pad", "notepad") . ' ';
    $otab['html'] .= lkt("txtblc", "/plug/ifram", "iframe") . ' ';
    $otab['html'] .= lkc('txtblc', '/plug/editor/reset_cache', 'reset_cache') . ' ';
    $otab['html'] .= '</form>';
    //notepad
    if ($_SESSION['USE']) {
        $otab['connectors'] .= divs('position:absolute; right:0; top:0;', plugin('txt', $npb, 1));
    }
    $otab['connectors'] .= btn('txtit', $title);
    $otab['connectors'] .= '<form name="converted" method="post" action="">';
    $otab['connectors'] .= ljb('txtbox', 'document.converted.txb.select()', '', '::');
    $otab['connectors'] .= submitj('txtbox', 'converted', 'modif') . ' ';
    $otab["connectors"] .= div('', conn_correct($reb));
    //local_reparation
    $otab['connectors'] .= div(ats('width:630px;'), conn_edit(""));
    $otab['connectors'] .= input(0, 'title', $title, '');
    $otab['connectors'] .= '<textarea name="txb" id="txtarea" class="tab" rows="16" cols="68" wrap="VIRTUAL" onselect="storeCaret(this);" onclick="storeCaret(this);" onkeyup="storeCaret(this);" ondblclick="storeCaret(this);" onChange="clip.setText(this.value)">' . $reb . '</textarea><br>';
    $otab['connectors'] .= '<div class="txtsmall2">';
    $otab['connectors'] .= $defcon . ' ';
    $otab['connectors'] .= checkbox("clean_mail", "ok", "clean_mail", 0) . ' ';
    $otab['connectors'] .= checkbox("clean_br", "ok", "clean_br", 0) . ' ';
    $otab['connectors'] .= checkbox("del_n", "ok", "del_nl", 0) . ' ';
    $otab['connectors'] .= checkbox("add_punct", "ok", "add_nl", 0) . ' ';
    $otab['connectors'] .= checkbox("clean_punct", "ok", "typo_rules", 0) . ' ';
    $otab['connectors'] .= checkbox("del_tab", "ok", "del_tables", 0) . ' ';
    $otab['connectors'] .= checkbox("table2array", "ok", "table2array", 0) . ' ';
    //$otab['connectors'].='<label>delete:</label>'.balise("select",array(2=>"conn_to_del",5=>"txtblc"),batch_defil_kv(connectors_reference_lite(),"","vv")).' ';
    $otab['connectors'] .= '</div>';
    $otab['connectors'] .= divc('txtsmall2', 'replace by:') . '' . txarea("repla", $_POST['repla'], 15, 1) . ' ' . txarea("replb", $_POST['replb'], 15, 1) . ' ' . checkbox("rec_prg", "ok", "preg", 0);
    $otab['connectors'] .= '</form>';
    $otab['connectors'] .= lkt("txtblc", "/plug/converts", "converts") . ' ';
    $otab['connectors'] .= lkt("txtblc", "/plug/pad", "notepad") . ' ';
    $otab['connectors'] .= lkt("txtblc", "/plug/buildtable", "buildtable") . ' ';
    //wysiwyg
    //if($title)$otab["render"].=btn("txtit",$title).br();
    $otab['render'] .= btd('bts', ljb('txtbox', 'SaveIcpb()', '', 'convert')) . ' ';
    $otab['render'] .= ljb('txtx" id="edt', 'editab(0)', '', 'editable') . ' ';
    $otab['render'] .= txareacb($ree, 'tabc panel justy');
    $otab['render'] .= btd('bts', ljb('txtbox', 'SaveIcpb()', '', 'convert')) . ' ';
    $otab['render'] .= ljb('txtx" id="edt', 'editab(0)', '', 'editable') . ' ';
    $otab['render'] .= divd('popup', '') . "\n";
    $otab['render'] .= divd('popw', '') . "\n";
    $otab['render'] .= hidden('', 'socket', '');
    $out["end"] .= '</body>' . "\n" . '</html>';
    return implode("", $out) . make_tabs($otab);
}