Пример #1
0
function dig_h($n)
{
    $r = define_digr();
    $nprev = time_prev($n);
    if (!$r[$n]) {
        $r[$n] = $n >= 365 ? round($n / 365, 2) : $n;
    }
    $cur = $r[$n];
    if ($n != 1 && $n != 7) {
        $r[$n] = $r[$nprev] . ' ' . nms(36) . ' ' . $r[$n];
    }
    //from
    $r[$n] .= ' ' . ($n < 365 ? plurial($cur, 3) : plurial($cur, 7));
    if ($n > 365) {
        $r[$n] = date('Y', calc_date($n));
    }
    //from
    return menuder_h($r, 'srdig', $n, 'Search2();');
}
Пример #2
0
Файл: spe.php Проект: philum/cms
function dig_it_j($n, $go)
{
    $r = define_digr();
    //most_read
    if (!$r[$n]) {
        $r[$n] = $n > 365 ? round($n / 365, 2) : $n;
    }
    $nprev = time_prev($n);
    $r[$n] .= ' ' . ($n < 365 ? plurial($r[$n], 3) : plurial($r[$n], 7));
    if ($n != 1 && $n != 7) {
        $r[$n] = $r[$nprev] . ' ' . nms(36) . ' ' . $r[$n];
    }
    //from
    if ($n > 365) {
        $r[$n] = date('Y', calc_date($n));
    }
    //from
    return divs('float:right;', slctmenus_sj($r, $go, $n));
}
Пример #3
0
function findfunc($p, $o, $res)
{
    list($p, $o) = ajxp($res, $p, $o);
    $sql = 'select name,page,func from _sys where name="' . $p . '"';
    $r = sql_b($sql, '');
    $rb[] = array('edit', 'page', 'function');
    if ($r) {
        $rb[] = ffunc_row($r[0]);
    }
    $sql = 'select name,page,func from _sys where func like "%=' . $p . '(%" or  func like "%.' . $p . '(%" or  func like "%(' . $p . '(%" or  func like "\\n' . $p . '(%"';
    $r = sql_b($sql, '');
    if (!$r) {
        return 'null';
    }
    foreach ($r as $k => $v) {
        $rb[] = ffunc_row($v);
    }
    $n = count($rb);
    return btn('txtcadr', 'function ' . $p . '() ' . $n . ' ' . plurial($n, 19) . '') . make_table($rb, 'txtblc');
}
Пример #4
0
function ud_search($p, $o, $res)
{
    list($p, $o) = ajxp($res, $p, $o);
    $p = strtolower(trim($p));
    $ps = soundex($p);
    $r = umv_r();
    if (!$p) {
        return;
    }
    if ($r) {
        foreach ($r as $k => $v) {
            $voc = strtolower($v[0]);
            $vcb = soundex($voc);
            if ($o) {
                if ($vcb == $ps) {
                    $ret[] = uds_btn($v);
                }
            } elseif ($voc == $p) {
                $ret[] = uds_btn($v);
            }
        }
    }
    $n = count($ret);
    $t1 = 'Recherche littérale';
    $t2 = 'Glossaire';
    $search = lj('', 'popup_search___' . ajx(strtoupper($p)), pictxt('search', $t1)) . ' ';
    $search .= lj('', 'popup_plup___umvoc_ud*glossary_' . $p . '_' . $o, pictxt('view', $t2)) . ' ';
    //$search.=togbub('plug','umvoc_ud*glossary_'.$p,picto('view')).' ';
    $glyphe = ud_glyphe($p) . br();
    if ($ret) {
        $ret = implode('', $ret) . br();
    }
    if (auth(6)) {
        $sav = umvcadd($p) . br();
    }
    if (!$ret) {
        return btn('txtcadr', nms(11) . ' ' . nms(16)) . ' ' . $search . $glyphe . br() . $sav;
    }
    return btn('txtcadr', $n . ' ' . plurial($n, 16)) . ' ' . $search . $glyphe . $ret . $sav;
}
Пример #5
0
Файл: mod.php Проект: philum/cms
function special_link($d, $o = '')
{
    list($m, $v) = split_one('§', $d, 0);
    $m = str_replace('*', ' ', $m);
    switch ($m) {
        case 'lang':
            $ra = explode(' ', prmb(26) . ' all');
            return slct_menus($ra, '/?lang=', $_SESSION['lang'], "active", "", "v");
            if ($_GET['lang']) {
                return lkc('txtx', '/?module=All&refresh==', nms(60));
            }
            break;
        case 'time':
            $ra = define_digr();
            $nbj = $_SESSION['nbj'];
            if ($_SESSION['dayx'] - $_SESSION['daya'] > 3600) {
                $goto = target_date($_SESSION['daya']);
            } else {
                $goto = htac('nbj');
            }
            foreach ($ra as $k => $v) {
                if ($k == $nbj) {
                    $nm = ' ' . ($k < 365 ? plurial($v, 3) : plurial($v, 7));
                } else {
                    $nm = '';
                }
                if ($v) {
                    return lkc($k == $nbj ? 'active' : '', $goto . $k, $v . $nm) . ' ';
                }
            }
            break;
        case 'br':
            return br();
            break;
    }
    $r = mod_link_r($m, $v);
    $t = $r[3];
    if ($o) {
        $sp = '';
    } else {
        $sp = $d == 'cols' ? br() : ' ';
    }
    if ($r[1] == 'j') {
        return lj($r[0], $r[2], $t);
    } elseif ($r[1] == 'SaveJc') {
        return ljb($r[0], $r[1], $r[2], $t);
    } else {
        return lkc($r[0], $r[1] . $r[2], $t) . $sp;
    }
}
Пример #6
0
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));
}
Пример #7
0
function dig_it($n, $send, $rid = '')
{
    $r = define_digr();
    $g = $_GET[$send];
    if (!$r[$n]) {
        $r[$n] = $n >= 365 ? round($n / 365, 2) : $n;
    }
    $cur = $r[$n];
    $nprev = time_prev($n);
    $r[$n] .= ' ' . ($n < 365 ? plurial($cur, 3) : plurial($cur, 7));
    if ($n != 1 && $n != 7) {
        $r[$n] = $r[$nprev] . ' ' . nms(36) . ' ' . $r[$n];
    }
    //from
    if ($n > 365) {
        $r[$n] = date('Y', calc_date($n));
    }
    //from
    //$dig=$_GET['dig']?$_GET['dig']:$_SESSION['nbj'];
    if ($_SESSION['rstr'][3] != '1') {
        if ($rid) {
            $ret = slctmenusja($r, 'load' . $rid . '_api___' . $send . ':' . ajx($g) . '_', $n);
        } else {
            $ret = slct_menus($r, htacb($send, $g, 'dig'), $n, "active", "", "");
        }
    }
    return btn('nb_pages', $ret);
}
Пример #8
0
Файл: api.php Проект: philum/cms
function api_dig($ra)
{
    $r = define_digr();
    $n = $ra['minday'];
    if (!$r[$n]) {
        $r[$n] = $n >= 365 ? round($n / 365, 2) : $n;
    }
    $cur = $r[$n];
    $nprev = time_prev($n);
    $r[$n] .= ' ' . ($n < 365 ? plurial($cur, 3) : plurial($cur, 7));
    if ($n != 1 && $n != 7) {
        $r[$n] = $r[$nprev] . ' ' . nms(36) . ' ' . $r[$n];
    }
    if ($n > 365) {
        $r[$n] = date('Y', calc_date($n));
    }
    $r['all'] = nms(100);
    $ret = slctmenusja($r, $ra['rid'] . '_api_hid' . $ra['rid'] . '_exs__', $n);
    return btn('nb_pages', $ret);
}