function svg_com($d) { if (!function_exists('correct_txt')) { req('tri'); } $d = deln($d); $d = str_replace(" ", ' ', $d); //eco($d,1); return correct_txt($d, '', 'svg'); }
function plug_travel($d, $id) { req('pop'); //http://w41k.info/plug/rss1.php?read=74453&preview=full $ret = rss_read($d); return $ret; }
function plug_rssin($u) { req('pop,art,tri,spe'); Head::add('jslink', '/prog/utils.js'); if ($_GET['rssurl']) { foreach ($_GET as $k => $v) { if ($k == "rssurl") { $u = $v; } else { $u .= '&' . $k . '=' . $v; } } } $u = str_replace('http://', '', $u); if ($u) { $alx = alx(); $rss = load_xml('http://' . $u, 1); $ret .= bal('h1', lkt('', 'http://' . $u, preplink($u))); $ret .= lkt("", '/?plug=rssin&rssurl=' . $u, picto('url')); foreach ($rss as $k => $v) { if ($v[1]) { $ret .= pane_base($v[1], $v[0], "", rss_date($v[2]), "", $v[3], $alx); } } } return $ret; }
function ummoay_build($p, $o) { req('art,tri,pop,spe'); reqp('msqarts'); $tmp = ummoay_template(); $r = req_arts_y($p); $rtg = list_tags(); if ($r) { foreach ($r as $k => $v) { list($id, $day, $msg, $cat, $tag, $lk) = $v; $day = clean_day_tw($day); $msg = format_txt($msg, '', ''); $lnk = lka(urlread($id)); $pop = lj('', 'popup_trckpop___' . $id, picto('forum', 16)); $rb[$day] = array('suj' => $cat, 'day' => mkday($day, 'Y/m/d'), 'msg' => $msg, 'url' => $lk, 'open' => popart($id, 'articles') . ' ' . $pop, 'tag' => $rc = $rtg[$id]); } } krsort($rb); foreach ($rb as $k => $v) { $rd[nms(100)] .= template_build($tmp, $v); $rc = $v['tag']; if ($rc) { foreach ($rc as $kb => $vb) { $rd[$kb] .= template_build($tmp, $v); } } } return make_tabs($rd); }
function msqt_build_from_template($nod, $tmp) { req('pop,tri'); list($dr, $nod) = split_right('/', $nod, 0); if (!$dr) { $dr = 'users'; } $r = read_vars('msql/' . $dr . '/', $nod, ''); $mnu = $r['_menus_']; unset($r['_menus_']); //$rb=array_keys_r($r,0); asort($rb); $r=conform_order($r,$rb); if ($r) { foreach ($r as $k => $v) { $tpl = $tmp; if (is_array($v)) { $n = count($v) - 1; for ($i = $n; $i >= 0; $i--) { if ($v[$i]) { $tpl = str_replace(array('_' . $i, '_' . $mnu[$i]), $v[$i], $tpl); } else { $tpl = str_replace(array('_' . $i, '_' . $mnu[$i]), '', $tpl); } } } else { $tpl = str_replace(array('_0', '_' . $mnu), $v, $tpl); } $tpl = str_replace('_key', $k, $tpl); $ret .= correct_txt($tpl, "", 'codeline'); } } return format_txt_r($ret, '', ''); }
function plug_microform($p, $id) { $rid = 'mfr' . randid(); //echo $p.'-'.$id; $nod = ses('mform', ses('qb') . '_microform_' . $id); req('pop'); ses('mformj', $rid . '_plug___microform_plug*microform_' . ajx($p) . '_' . $id); reqp('msql'); $msq = new msql('', $nod); //table list($p, $tp) = explode('§', $p); $rb = mform_mr($p); //p($rb); $msq->create($rb); $ret .= make_form($p, 'mfr' . $id, '_plug___microform_mform*j_' . ajx($p, '') . '_' . $id . '_') . br(); if (auth(4)) { $ret .= msqlink('users', ses('mform')) . ' ' . btn('txtsmall2', $nod) . ' '; } if ($tp == 1) { $ret .= mform_read($id); } elseif ($tp) { $ret .= plugin('msqtemplate', $nod, $tp); } return divd($rid, $ret . $bt); }
function plug_cubes($d) { req('pop'); $w = currentwidth(); $r = $_SESSION['rqt']; $cols = 4; $c = $cols * 3; $n = count($r); $nl = ceil($n / $c); $l = $w / $c; $cats = array_keys_r($r, 1, 'k'); $clr = cub_clr($cats); foreach ($r as $k => $v) { if ($v[11] > 1 && $v[3]) { $lx = $l * ($v[11] - 1); //$pub=minimg($v[3],"h").lka(htac($k),$v[2]); //$pub=make_thumb_d($v[3],round($lx).'/'.round($lx));// $pub = image('/imgc/' . $v[3], round($lx), round($lx)); $pub = lka(htac($k) . '" title="' . $v[2], $pub); $ret .= divs(cub_sz($lx, $clr[$v[1]]), $pub); } } //for($ic=0;$ic<$c;$ic++){} //for($ib=0;$ib<$nl;$ib++){$i++;} return $ret; }
function sugg_j($v1, $v2, $res) { req('spe'); $nod = nod('suggest'); $ra = ajxr($res); $dfb['_menus_'] = array('day', 'ok', 'url', 'mail', 'msg', 'iq'); $r = read_vars('msql/users/', $nod, $dfb); $lnk = trim($ra[0]); $alx = sugg_alx($r, $lnk); $rap = 'popup_plup___suggest_sugg*rapport_' . ajx($ra[1]); if ($lnk && $alx) { return lj('txtyl', $rap, nms(56)); } $ret = sugg_import($lnk); $r[] = array(date('ymdHi'), '', $lnk, $ra[1], '', ses('iq')); if ($r[0]) { $r = msq_reorder($r); } if ($lnk && !$alx) { msql_save('', $nod, $r); if ($ra[1]) { sugg_mail($ra[1], $lnk); } return lj('txtyl', 'popup_call__3__batch*preview_' . ajx($lnk), nms(56)) . ' ' . $ret; } else { return lj('txtyl', $rap, '404 not found'); } }
function plug_tags($p, $o) { req('mod,spe'); if ($_GET['sources']) { $r = sql('mail', 'qda', 'k', ''); $go = 'source'; //source foreach ($r as $k => $v) { if ($k != 'mail' && trim($k)) { $reb[preplink($k)] += 1; } } } else { $cat = $p ? $p : 'tag'; //$reb=tags_list($cat); $ra = sql('idtag,idart', 'qdta', 'k', ''); arsort($ra); $rb = sql('id,tag', 'qdt', 'kv', 'cat="' . $cat . '"'); arsort($ra); foreach ($ra as $k => $v) { if ($rb[$k]) { $reb[$rb[$k]] = $v; } } } if ($o) { $ret = tags_cloud($reb, 12, 27, ' ', $cat); } else { $ret = tg_list($reb, $go); } return divc('txtcadr', count($reb) . ' ' . ($p ? $p : 'Tags')) . $ret; }
function api_j($p, $o = '', $res = '') { req('api,pop,art,spe,tri,mod'); list($p, $o) = ajxp($res, $p, $o); $ret = api_call($p, $o); return $ret; }
public static function setMap(array $_map, array $_arg) { $_val = req()->getMap(); unset($_val["context"]); foreach ($_val as $k => $v) { $type = $minl = $maxl = $minv = $maxv = STR_EMPTY; if (isset($_arg[$k])) { if (isset($_arg[$k]["type"])) { $type = strtoupper($_arg[$k]["type"]); } if (isset($_arg[$k]["minl"])) { $minl = _2nf($_arg[$k]["minl"]); } if (isset($_arg[$k]["maxl"])) { $maxl = _2nf($_arg[$k]["maxl"]); } if (isset($_arg[$k]["minv"])) { $minv = _2nf($_arg[$k]["minv"]); } if (isset($_arg[$k]["maxv"])) { $maxv = _2nf($_arg[$k]["maxv"]); } } $checked = isset($_map[$k]); array_push(self::$_map, array(array("value" => $checked ? "Y" : "N", "align" => "center"), $k, $checked ? $_map[$k] : $v, array("value" => isset($_arg[$k]["req"]) && $_arg[$k]["req"] ? "Y" : "N", "align" => "center"), array("value" => $type, "align" => "center"), array("value" => $minl, "align" => "right"), array("value" => $maxl, "align" => "right"), array("value" => $minv, "align" => "right"), array("value" => $maxv, "align" => "right"))); } }
function environ_build($id, $o) { req('spe,art'); //,mod,pop,tri $ret = environ_art($id); $ib = ib_of_id($id); if ($ib) { $ret .= divc('', divc('txtcadr', 'parent') . environ_art($ib)); } $r = art_tags($id); //pr($r); if ($r) { foreach ($r as $k => $v) { foreach ($v as $ka => $va) { $ret .= divc('txtcadr', $ka); $rb = tag_arts($ka, $k, 7); if ($rb) { foreach ($rb as $kb => $vb) { $ret .= environ_art($kb); } } } } } $r = art_opts($id); //pr($r); foreach ($r as $k => $v) { if (is_numeric($v)) { $t = divc('txtcadr', $k); $d = environ_art($v); $ret .= divc('', $t . $d); } } return $ret; }
/** * Display the exception html */ public function getHtml() { if (req()->isAjax() || PHP_SAPI == "cli") { echo $this->getMessage() . "\n\n" . $this->getTraceAsString(); return; } ?> <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>Error</title> </head> <body> <h1>Well, something is going wrong!</h1> <h3 style="color:red;"><?php echo nl2br(s($this->getMessage())); ?> </h3> <pre><?php echo $this->getTraceAsString(); ?> </pre> </body> </html> <?php }
function plug_negcss($p, $o) { if ($n = $_SESSION['prmb'][5]) { $nod = ses(qb) . '_auto'; } else { $nod = ses(qb) . '_design_' . $_SESSION['prmd']; } $f = 'css/' . $nod . '_neg.css'; $tima = ftime('css/' . $nod . '.css', 'ymdhi'); $timb = ftime($f, 'ymdhi'); if ($tima > $timb) { req('styl'); if ($n = $_SESSION['prmb'][5]) { if ($n < 4) { $r = msql_read('system', 'default_css_' . $n); } elseif (is_numeric($n)) { $r = msql_read('design', 'public_design_' . $n); } } else { $r = msql_read('design', $nod); } $clr = $_SESSION['clrs'][$_SESSION['prmd']]; foreach ($clr as $k => $v) { if ($v) { $klr[$k] = invert_color($v, 0); } } $_SESSION['clrs'][$_SESSION['prmd']] = $klr; build_css($f, $r); } }
public function get_filter() { global $CONFIG; #each filter remembered in session linking to controller.action $session_key = '_filter_' . $this->fw->G['controller.action']; $sfilter = $_SESSION[$session_key]; if (!is_array($sfilter)) { $sfilter = array(); } $f = req('f'); if (!is_array($f)) { $f = array(); } #if not forced filter if (!reqs('dofilter')) { $f = array_merge($sfilter, $f); } #paging if (!preg_match("/^\\d+\$/", $f['pagenum'])) { $f['pagenum'] = 0; } if (!preg_match("/^\\d+\$/", $f['pagesize'])) { $f['pagesize'] = $CONFIG['MAX_PAGE_ITEMS']; } #save in session for later use $_SESSION[$session_key] = $f; $this->list_filter = $f; return $f; }
public function signIn(&$response) { if (Zend_Registry::isRegistered('currentUser')) { return 400; } $currentUser = Zend_Registry::isRegistered('currentUser'); if (!empty($currentUser)) { return 400; } $email = req('email'); $password = req('password'); if (empty($email) || empty($password)) { return 400; } include_once 'Zend/Db/Table.php'; $userTable = new Zend_Db_Table('User'); $select = $userTable->select()->from($userTable, array('id', 'email', 'fullname', 'isSupporter'))->where('email = ?', $email)->where('pwd = ?', sha1($password)); $currentUser = $userTable->fetchRow($select); if (empty($currentUser)) { return 400; } $_SESSION['userId'] = $currentUser->id; $response = array('id' => (int) $currentUser->id, 'fullname' => $currentUser->fullname, 'email' => $currentUser->email, 'isSupporter' => $currentUser->isSupporter == 1); return 200; }
function showzx() { $zid = req('zid'); $start = req('start', 0); $perpage = req('perpage', 0); if ($start < 0) { $start = 0; } if (empty($perpage)) { $perpage = 30; } if (empty($zid)) { showjson('zid_not_exist'); } $db = MysqliDb::getInstance(); $data = $db->rawQueryOne("SELECT z.*, u.username FROM zixun z LEFT JOIN users u ON z.uid=u.uid WHERE z.zid='{$zid}'"); if ($db->count > 0) { $db->where("zid", $zid); $stats = $db->getOne("comment", "count(*) as cnt"); $data['total'] = $stats['cnt']; //if($start>=$data['total']) $start=0; $comment = $db->rawQuery("SELECT c.*,s.username FROM comment c LEFT JOIN users s ON c.uid=s.uid WHERE c.zid='{$zid}' ORDER BY c.cid LIMIT {$start},{$perpage}"); $data['count'] = $db->count; $data['comment'] = $comment; showjson('do_success', 0, array("zixun" => $data)); } showjson('show_error'); }
public function post() { if ($user = User::login(post('email'), post('passwd'))) { $next = get('ref') ?: '/user'; return app()->redirect($next); } return app()->redirect(req()->referer() ?: '/login'); }
function assignment_defaults() { $defaults = array("action" => req("default_action"), "round" => $_REQUEST["rev_roundtag"]); if (req("requestreview_notify") && req("requestreview_body")) { $defaults["extrev_notify"] = ["subject" => req("requestreview_subject"), "body" => req("requestreview_body")]; } return $defaults; }
public function parse($orig_name) { global $CORE; ob_start(); if (is_action()) { try { $name = post('name'); if (!$name) { throw new FieldInputError('name', l('Please provide a map name.')); } if (!preg_match(MATCH_MAP_NAME, $name)) { throw new FieldInputError('name', l('This is not a valid map name (need to match [M])', array('M' => MATCH_MAP_NAME))); } if (count($CORE->getAvailableMaps('/^' . $name . '$/')) > 0) { throw new FieldInputError('name', l('A map with this name already exists.')); } // Read the old config $MAPCFG = new GlobalMapCfg($orig_name); $MAPCFG->readMapConfig(); // Create a new map config $NEW = new GlobalMapCfg($name); $NEW->createMapConfig(); foreach ($MAPCFG->getMapObjects() as $object_id => $cfg) { $NEW->addElement($cfg['type'], $cfg, $perm = true, $object_id); } success(l('The map has been created.')); reload(cfg('paths', 'htmlbase') . '/frontend/nagvis-js/index.php?mod=Map&show=' . $name, 1); } catch (FieldInputError $e) { form_error($e->field, $e->msg); } catch (NagVisException $e) { form_error(null, $e->message()); } catch (Exception $e) { if (isset($e->msg)) { form_error(null, $e->msg); } else { throw $e; } } } echo $this->error; echo '<div class="simple_form">' . N; js_form_start('to_new_map'); input('name'); submit(l('Save')); focus('name'); // Keep the view parameters the users has set $params = ltrim(req('view_params'), '&'); if ($params) { $parts = explode('&', $params); foreach ($parts as $part) { list($key, $val) = explode('=', $part); hidden($key, $val); } } form_end(); echo '</div>' . N; return ob_get_clean(); }
/** * 插件内容设置 * @param $name 对应标记参数 */ function sitemap_content($name) { if ($name == 'sitemap') { if (req()->is_post()) { sitemap_create(true); } include __DIR__ . "/page.php"; } return $name; }
function robots_content($name) { if ($name == 'robots') { if (req()->is_post()) { file_put_contents(_BasePath_ . "/robots.txt", req()->_plain()->post('robots')); } include __DIR__ . "/page.php"; } return $name; }
function msqdt_build($p, $o) { req('msql'); $ra['_menus_'] = explode(',', $o); $r = msql_read_b('', ses('msqdt'), '', '', $ra); $murl = sesm('murl', murl('users', '', ses('qb'), $p, '')); if ($r) { return draw_table($r, $murl, ''); } }
function arts_j($p, $o, $res = '') { list($p, $o) = ajxp($res, $p, $o); req('api,pop,art,tri,spe,mod'); $r = array('articles', $p, 'Articles', '', 'multi', ''); sesone('nl', $o); $ret = build_mods($r); sesone('nl', ''); return $ret; }
function plug_read($p) { if (!$p) { return; } req('art,pop,tri,spe'); sesone('nl', 'nl'); $ret = art_read_b($p, '', '3', ''); sesone('nl', ''); return $ret; }
function readerurl($a, $b, $f) { $f = ajxg($f); req('tri,pop'); if ($f) { list($suj, $ret, $rec, $defid, $defs) = vacuum($f, ''); } $ret = format_txt_r($ret, '3', ''); $ret = nl2br(embed_p($ret)); return bal('h2', $suj) . $ret; }
function reqArray($key, $default = array()) { $value = req($key); if (is_null($value)) { return $default; } if (!is_array($value)) { return array($value); } return $value; }
public function login() { if (req()->is_ajax()) { $this->__view("Home/login.php", ['account' => req()->_plain()->get('account')]); return; } $this->theme->setTitle("用户登录"); $this->__view("Home/header.php"); $this->__view("Home/login.php", ['account' => req()->_plain()->get('account')]); $this->__view("Home/footer.php"); }
/** * @conn vfs */ public function classes($conn) { $ds = array("" => "PILIH"); if (empty(req()->PKG) || empty(req()->GRP)) { return $ds; } $rs = $conn->executeQuery("SELECT * FROM vfs_packages_classes WHERE PKG='%s' AND PKC NOT IN (SELECT PKC FROM vfs_groups_classes WHERE GRP='%s' AND PKG='%s')", req()->PKG, req()->GRP, req()->PKG); while ($rs->next()) { $ds[$rs->get("PKC")] = sprintf("%s. %s", $rs->get("PKC"), $rs->get("NAME")); } return $ds; }
public function save() { $id = req('id/d'); $dat = req('post.'); $dat['name'] = trim($dat['name']); $dat['key'] = trim($dat['key']); $mod = D(CONTROLLER_NAME); if (!($dat = $mod->create($dat))) { $this->ret['ret'] = 1; $this->ret['msg'] = $mod->getError(); } else { $isadd = $id < 1; // add if ($isadd) { var_dump($dat); die($this->ret['msg']); //$id = (int)$mod->add($dat); } else { $num = $dat['key'] === '' ? 0 : (int) $mod->where(array('key' => $dat['key']))->count('id'); $map = array('id' => $id); if (!($old = $mod->where($map)->find())) { $this->ret['ret'] = 1; $this->ret['msg'] = '对象不存在'; } elseif ($dat['key'] != $old['key'] && $num > 0) { $this->ret['ret'] = 1; $this->ret['msg'] = 'key已存在'; } elseif ($mod->where($map)->save($dat) === false) { $this->ret['ret'] = 1; $this->ret['msg'] = '保存失败'; } } if ($this->ret['ret'] == 0) { if ($id < 1) { $this->ret['ret'] = 1; $this->ret['msg'] = '操作失败'; } else { $dat['id'] = $id; $sort = $mod->auto_sort_set($id); //自动排序 if ($sort !== false) { $dat['sort'] = $sort; } $dat = $this->attr2array_arr($dat); $dat = array('item' => $dat); $dat['item']['choices'] = $mod->get_choices_data($dat['item']['attrs']['choices']); $this->data = $dat; $this->ret['msg'] = '操作成功'; } } } $this->display(); }