function master_params($fb, $qd, $aqb, $subd) { $filname = $fb . '_config.txt'; if (is_file($filname)) { $prms = explode('#', read_file($filname)); } //else restore_mprm($filname); if (!$qd) { if (!$prms[0]) { $qd = 'pub'; } else { $qd = $prms[0]; } } //master_of_puppets if ($_GET['qd']) { $qdb = $_GET['qd']; $bqd = rse('id', $qdb . '_user', ' LIMIT 1'); //master_node if (!$bqd && !$_POST['create_hub'] && !$_POST['create_node']) { $qd = $prms[0]; } else { $qd = $qdb; } } $_SESSION['qd'] = $qd; $_SESSION['qds'] = '_sys'; $r = array('qda' => 'art', 'qdm' => 'txt', 'qdd' => 'data', 'qdu' => 'user', 'qdi' => 'tracks', 'qdp' => 'ips', 'qdv' => 'live', 'qdv2' => 'live2', 'qds' => 'stat', 'qdt' => 'meta', 'qdta' => 'meta_art', 'qdpl' => 'poll'); foreach ($r as $k => $v) { $_SESSION[$k] = $qd . '_' . $v; } $_SESSION['htacc'] = $prms[1] == 'yes' ? 1 : ''; sesr('prms', 'create_hub', $prms[2] == 'yes' ? 'on' : 'off'); sesr('prms', 'default_hub', $aqb ? $aqb : ($prms[3] ? $prms[3] : '')); //1 $_SESSION['sbdm'] = $prms[4] == 'yes' && !$subd ? 1 : ''; sesr('prms', 'upservr', $prms[5]); sesr('prms', 'nogdf', $prms[6] == 'no' ? 1 : ''); sesr('prms', 'goog', $prms[7]); sesr('prms', 'timez', $prms[8] ? $prms[8] : 'Europe/Paris'); sesr('prms', 'error', $prms[9] ? $prms[9] : 'NULL'); $_SESSION['jbuffer'] = $prms[10] ? $prms[10] : '2000'; $_SESSION['enc'] = $prms[11] == 1 ? 'utf-8' : 'iso-8859-1'; sesr('prms', 'uplimit', $prms[12] ? $prms[12] : '250'); sesr('prms', 'aupdate', $prms[13]); }
function adduser($qb, $user, $pasw, $mail) { $dayx = $_SESSION['dayx']; $qdu = $_SESSION['qdu']; $mbrs = "7::admin,"; $open = ''; $ip = hostname(); if (prmb(11) >= 6 or $_POST['create_hub']) { $open = 1; $menus = $dayx; $hub = $user; list($rstr, $config) = ndprms_defaults(); if (!$_SESSION['line']) { $mbrs .= '7::' . $qb . ','; } else { $mbrs .= '6::' . $qb . ','; } } elseif (prmb(11) >= 1) { add_member($qb, $user, prmb(11)); } $ex = rse("id", $_SESSION['qdu'] . ' WHERE id=1'); if (!$ex) { echo plugin('install', 'pub'); } return insert('qdu', "('','{$user}',PASSWORD('{$pasw}'),'{$mail}','" . $dayx . "','{$clr}','{$ip}','{$rstr}','{$mbrs}','{$hub}','','{$config}','{$strct}','{$dscrpt}','{$menus}','{$open}')"); }
function tracks_read($id, $page = '', $n = '') { $USE = $_SESSION['USE']; $qb = $_SESSION['qb']; $read = $_SESSION['read']; $ip = hostname(); $panout['css'] = 'track'; $panout['sty'] = 'margin:8px 0;'; if ($id) { $panout['id'] = $id; list($ib, $name, $mail, $day, $nod, $frm, $suj, $msg, $re, $lu, $img, $thm, $host) = sql('ib,name,mail,day,nod,frm,suj,msg,re,lu,img,thm,host', 'qdi', 'r', 'id=' . $id); } $panout['date'] = mkday($day, 'y/m/d H:i'); //time_ago($day); $panout['edit'] .= lj('', 'popup_track___' . $read . '_[' . $id . ':track]', picto('get')) . ' '; if ($re == "0" && $host == $ip) { $panout['sty'] .= 'opacity:0.5;'; $panout['edit'] .= btn('txtsmall', helps('trackbacks')) . ' '; } if ($_GET['admin']) { $purl = '/?admin=' . $_GET['admin']; } if ($_GET['read']) { $purl = '/?read=' . $_GET['read']; } if ($host == $ip && $_SESSION['dayx'] - $day < 600 or auth(6)) { //redit $panout['edit'] .= lj('', 'popup_trkedit___' . $id, picto('edit')) . ' '; } $sender = rse("id", $_SESSION['qdu'] . ' WHERE name="' . $name . '"'); if ($sender) { $panout['author'] = lj('', 'popup_track___' . $name, $name); } elseif ($mail != 'mail') { $panout['author'] = lj('', 'popup_plupin___mail_' . $mail, $name); } else { $panout['author'] = $name; } if (substr($suj, 0, 4) != "hide" or $_GET['idy_show'] == $id) { $state = "hide"; $f = 'imgb/avatar_' . $name . '.gif'; //avat if (is_file($f)) { $panout['avatar'] .= image($f, 48, 48, ats('vertical-align:bottom;')); } if ($re != "0" or auth(3) or $host == $ip) { //$msg=format_txt($msg,'',''); $msg = correct_br($msg); $msg = miniconn($msg); $msg = correct_txt($msg, '', 'sconn'); $msg = embed_p($msg); $msg = nl2br($msg); } else { $msg = divc('txtalert', helps('trackbacks')); } } else { $state = 'show'; $msg = ''; } if (auth(4) && $frm != $qb) { $j = 'trk' . $id . '_plug___tracks_trk*publish_' . $id; if ($re != 1) { $panout['edit'] .= lj('txtyl', $j . '_on', nms(29)) . ' '; } else { $panout['edit'] .= lj('', $j . '_off', offon(0)) . ' '; } } if ((auth(4) or $USE == $name) && ($re == 0 or auth(6))) { $panout['edit'] .= lj('" title="' . nms(43), 'trk' . $id . '_call___sav_edit*tracks__' . $id . '', picto('trash')) . ' '; } $panout['msg'] = stripslashes($msg); if (substr($n, 0, 2) == "nl") { $http = host() . '/'; } $panout['url'] = $http . htacc('read'); return template($panout, 'tracks'); }
function dayslenght($qb, $limit) { $r = array(1, 7, 10, 90, 365, 720, 1440, 2920, 5840); //16y for ($i = 0; $i < 9; $i++) { $nbj = $r[$i]; $nb = rse('count(id)', $_SESSION['qda'] . ' WHERE day>"' . calc_date($nbj) . '"'); if ($nb > $limit) { $i = 9; } } return $nbj; }
function plug_codeview($dr, $f, $fc = '') { if ($dr == 'param') { $dr = $f = ''; } require_once 'params/_connectx.php'; if (!$f && $fc) { $f = sql_b('select page from _sys where name="' . $fc . '"', 'v'); } if (strpos($f, '.') === false && $f) { $f .= '.php'; } if ($fc == 'all') { $fc = ''; } $ret .= lj('', 'codeview_plugin___codeview_' . $dr . '_' . $f . '_' . ajx($fc), picto('reload')) . ' '; if ($dr == 'save') { $_GET['sav'] = 1; $dr = $_SESSION['dr']; $dr == 'plug' ? savefunc_plug() : savefunc(); } else { $_GET['sav'] = 0; } //if($dr=='all')$dr=''; $dr = $dr ? $dr : 'progb'; $_SESSION['dr'] = $dr; $_SESSION['file'] = $f; $_SESSION['func'] = $fc; if ($dr != 'params') { list($rep, $res) = functions_list($dr, $f); } if (auth(6)) { $ret .= btn('nbp', cv_btn('progb', $dr) . cv_btn('plug', $dr) . (auth(5) ? cv_btn('save', $dr) : '')) . ' '; } //cv_btn('all',$dr). $nbfunc = count($_SESSION['rec']); if (!$nbfunc) { $nbfunc = rse('COUNT(id)', '_sys'); } $ret .= bal('small', $nbfunc . ' functions') . ' '; $jp = ajx(substrpos($f, '.')); //list if ($rep) { ksort($rep); array_unshift($rep, '...'); } else { $rep[] = '...'; } $ret .= slct_sj($rep, $f, 'codeview_plugin__15_codeview_' . ajx($dr) . '_'); //page if ($f && auth(6)) { $ret .= lj('', 'popup_plupin___codev_' . $dr . '_' . $jp, picto('editxt')) . ' '; if ($dr == 'plug') { $ret .= lj('', 'popup_plupin___' . $jp, picto('window')) . ' '; } } //list $rec = array_values($_SESSION['rec']); array_unshift($rec, 'all'); //if($rec)ksort($rec); if ($f) { $ret .= slct_sj($rec, $fc, 'codeview_plugin__15_codeview_' . ajx($dr) . '_' . ajx($f) . '_'); } //func if ($fc && auth(6)) { $ret .= lj('', 'popup_plupin___codev_' . $dr . '_' . $jp . '_' . ajx($fc), picto('editxt')) . ' '; if ($dr == 'plug') { $ret .= lj('', 'popup_plup___' . $jp . '_' . ajx($fc), picto('window')) . ' '; } } //search $ret .= input1('funcsrch', $fc, 8) . ' ' . lj('popbt', 'popup_plup___codeview_findfunc___funcsrch', 'find') . ' ' . lj('popbt', 'popup_plup___coremap_coremap___funcsrch', 'map'); if ($dr != 'save_all') { return divd('codeview', $rea . $ret . $res); } }
function edit_day($d, $id) { if ($id && auth(5)) { $r = explode('-', $d); $day = mktime($r[3], $r[4], 0, $r[1], $r[2], $r[0]); update("qda", "day", $day, "id", $id); return lj('popw', 'chday' . $id . '_chday___' . $id, 'date'); } else { $day = date('Y-m-d-H-i', rse("day", $_SESSION['qda'] . ' WHERE id="' . $d . '"')); return input(1, 'chd' . $d, $day, '') . lj('popw', 'chday' . $d . '_chday_chd' . $d . '__' . $d, 'ok'); } }
function usited_words($p) { $p = $p ? $p : ses('read'); $msg = rse("msg", $_SESSION['qdm'] . ' WHERE id="' . $p . '"'); $r = explode(' ', $msg); foreach ($r as $k => $v) { $ret[$v] += 1; } arsort($ret); return $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 art_gallery($id) { if (!$d) { $d = rse("img", $_SESSION['qda'] . ' WHERE id=' . $id); } $r = explode("/", $d); if ($r) { foreach ($r as $v) { if ($v) { $ret .= popim(goodroot($v), make_thumb($v, $id), $id); } } } return $ret; }
function is_arts($frm, $daya, $dayb) { if ($frm) { $fr = 'AND frm="' . $frm . '" '; } if ($dayb) { $df = 'AND day > "' . $dayb . '" '; } $n = rse("id", $_SESSION['qda'] . ' WHERE nod="' . ses('qb') . '" ' . $fr . ' AND day < "' . $daya . '" ' . $df . ' ORDER BY day DESC LIMIT 1'); if ($n) { return true; } }