function umwords_dicos($v) { $n = sql_b('select id from dicofr where mot like "' . $v . '";', 'v'); if (!$n) { $n = sql_b('select id from dicoen where mot like "' . $v . '";', 'v'); } return $n; }
function req_arts_y($p) { $qda = $_SESSION['qda']; $qdm = $_SESSION['qdm']; $qdt = $_SESSION['qdt']; $qdta = $_SESSION['qdta']; $wh = $qda . '.frm="' . implode('" or ' . $qda . '.frm="', explode(',', $p)) . '"'; $sql = 'select distinct ' . $qda . '.id,' . $qda . '.suj,' . $qdm . '.msg,' . $qda . '.frm,' . $qda . '.thm,' . $qda . '.mail from ' . $qda . ' inner join ' . $qdm . ' on ' . $qdm . '.id=' . $qda . '.id where ' . $wh . ' order by day DESC'; return sql_b($sql, ''); }
function mq_cols($p, $o, $res = '') { list($p, $o) = ajxp($res, $p, $o); //echo $p."-".$o; $r = sql_b('select column_name,data_type,character_maximum_length from information_schema.columns where table_name="' . $p . '" and table_schema="' . $o . '";', ''); //p($r); if ($r) { foreach ($r as $v) { //p($v); $ret[] = array(lj('txtx', 'popup_plup___mysqm_mq*edit_' . $v[0], $v[0]), $v[1], $v[2]); } } return make_table($ret); }
function coremap($p = '', $o = '', $res = '') { list($p, $o) = ajxp($res, $p, $o); $r = sql_b('select name from _sys', 'rv'); //p($r); if (!$r or !$p) { return; } $ra = core_map($r, $p); //pr($ra); $rb = cm_parents_r($p); //pr($rb); //$rc=cm_orph($r,$p); p($rc); $n = count($ra); $ret .= divc('txtcadr', $p . ': ' . $n . ' dependencie' . ($n > 1 ? 's' : '')); $ret .= make_div_r($ra) . br(); $n = count($rb); $ret .= divc('txtcadr', $p . ': ' . $n . ' parent' . ($n > 1 ? 's' : '')); $ret .= make_div_r($rb); return $ret; }
function stat_solid($day_max_known) { $sql = stats_sql('nbuv', $day_max_known); $r = sql_b($sql, '', 0); $n = 0; $mnd = array_flip($_SESSION['mnd']); if ($r) { foreach ($r as $k => $v) { if (!$v[0]) { $qbd = ses('qbd'); } else { $qbd = $mnd[$v[0]]; } $sql = '("","' . $mnd[$v[0]] . '","' . $v['1'] . '","' . $v['2'] . '","' . $v['3'] . '")'; $ex = sql('id', 'qds', 'v', 'qb="' . $qbd . '" and day="' . $v['1'] . '"'); if (!$ex) { insert('qds', $sql); $n += 1; } } } return $n; }
function artags($slct, $wh, $how, $z = '') { $qdt = ses('qdt'); $qdta = ses('qdta'); $qda = ses('qda'); $sql = 'select ' . $slct . ' from ' . $qdt . ' inner join ' . $qdta . ' on ' . $qdt . '.id=' . $qdta . '.idtag inner join ' . $qda . ' on ' . $qda . '.id=' . $qdta . '.idart where nod="' . ses('qb') . '" ' . $wh . ''; return sql_b($sql, $how, $z); }
function rech_catag($cat, $tag, $utg, $n) { $wh = 'select ' . ses('qda') . '.id from ' . ses('qda') . ''; if ($tag) { $idtag = sql('id', 'qdt', 'v', 'tag="' . $tag . '"'); $wh .= ' inner join ' . ses('qdta') . ' on ' . ses('qdta') . '.idart=' . ses('qda') . '.id and ' . ses('qdta') . '.idtag="' . $idtag . '"'; } $wh .= ' where nod="' . ses('qb') . '" and re>0 and day>"' . calc_date($n) . '"'; if ($n > 7) { $wh .= ' and day<"' . calc_date(time_prev($n)) . '"'; } if ($cat) { $wh .= ' and frm="' . $cat . '"'; } if ($cat or $tag) { $rb = sql_b($wh . ' order by ' . ses('qda') . '.id desc', 'k'); } return $rb; }
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 define_interm3() { $sql = 'select cat,tag,idart from ' . ses('qdt') . ' inner join ' . ses('qdta') . ' on ' . ses('qdt') . '.id=' . ses('qdta') . '.idtag inner join ' . ses('qda') . ' on ' . ses('qda') . '.id=' . ses('qdta') . '.idart where day>' . calc_date(7) . ''; $r = sql_b($sql, 'kkk'); // foreach ($r as $k => $v) { $rb[$v[0]][$v[1]][] = $v[2]; //interm $rc[$v[2]][$v[0]][] = $v[1]; //meta } return $r; }
function tagsbynb_1($cat) { $rb = sql_b('select idtag,idart from ' . ses('qdta') . ' inner join ' . ses('qdt') . ' on ' . ses('qdta') . '.idart=' . ses('qdt') . '.id inner join ' . ses('qda') . ' on ' . ses('qdta') . '.idart=' . ses('qda') . '.id where cat="' . $cat . '" and nod="' . ses('qb') . '"', '', 1); p($rb); return $rb; }
function ud_glossary($p, $o) { $ps = soundex($p); //search likes $r = sql_b('select voc from pub_umvoc where SOUNDEX(voc)="' . $ps . '";', 'rv'); $r = ud_levenstein($p, $r); if ($r) { foreach ($r as $k => $v) { $ret .= lj('', 'popup_plup___umvoc_ud*segments_' . $v, $v); } } return divc('list', $ret); }
function videoplaylist($p = 7) { $qda = ses('qda'); $qdm = ses('qdm'); //$ra=$_SESSION['rqt']; return sql_b('select ' . $qda . '.id from ' . $qda . ' inner join ' . $qdm . ' on ' . $qda . '.id=' . $qdm . '.id where nod="' . ses('qb') . '" and re>="1" and day>' . calc_date($p ? $p : ses('nbj')) . ' and (msg like "%:video%" or msg like "%:popvideo%") order by id desc', 'k'); }
function api_query_nb($ra) { $ra['count'] = 1; $ra['group'] = ''; $sql = api_sql($ra); return sql_b($sql, 'v'); }