function module_entries($name, $types = array(), $rid = 0, $args = null) { global $_W; $ts = array('rule', 'cover', 'menu', 'home', 'profile', 'shortcut', 'function'); if (empty($types)) { $types = $ts; } else { $types = array_intersect($types, $ts); } $fields = implode("','", $types); $sql = 'SELECT * FROM ' . tablename('modules_bindings') . " WHERE `module`=:module AND `entry` IN ('{$fields}') ORDER BY eid ASC"; $pars = array(); $pars[':module'] = $name; $bindings = pdo_fetchall($sql, $pars); $entries = array(); foreach ($bindings as $bind) { if (!empty($bind['call'])) { load()->func('communication'); $response = ihttp_request($_W['siteroot'] . 'web/' . url('utility/bindcall', array('modulename' => $bind['module'], 'callname' => $bind['call'], 'args' => $args, 'uniacid' => $_W['uniacid'])), array('W' => base64_encode(iserializer($_W)))); if (is_error($response)) { continue; } $response = json_decode($response['content'], true); $ret = $response['message']; if (is_array($ret)) { foreach ($ret as $et) { $et['url'] .= '&__title=' . urlencode($et['title']); $entries[$bind['entry']][] = array('title' => $et['title'], 'url' => $et['url'], 'from' => 'call'); } } } else { if ($bind['entry'] == 'cover') { $url = wurl("platform/cover", array('eid' => $bind['eid'])); } if ($bind['entry'] == 'menu') { $url = wurl("site/entry", array('eid' => $bind['eid'])); } if ($bind['entry'] == 'rule') { $par = array('eid' => $bind['eid']); if (!empty($rid)) { $par['id'] = $rid; } $url = wurl("site/entry", $par); } if ($bind['entry'] == 'home') { $url = murl("entry", array('eid' => $bind['eid'])); } if ($bind['entry'] == 'profile') { $url = murl("entry", array('eid' => $bind['eid'])); } if ($bind['entry'] == 'shortcut') { $url = murl("entry", array('eid' => $bind['eid'])); } $entries[$bind['entry']][] = array('title' => $bind['title'], 'url' => $url, 'from' => 'define'); } } return $entries; }
function module_entries($name, $types = array(), $args = null) { $ts = array('rule', 'cover', 'menu', 'home', 'profile', 'shortcut', 'function'); if (empty($types)) { $types = $ts; } else { $types = array_intersect($types, $ts); } $fields = implode("','", $types); $sql = 'SELECT * FROM ' . tablename('modules_bindings') . " WHERE `module`=:module AND `entry` IN ('{$fields}') ORDER BY eid ASC"; $pars = array(); $pars[':module'] = $name; $bindings = pdo_fetchall($sql, $pars); $entries = array(); foreach ($bindings as $bind) { if (!empty($bind['call'])) { $site = WeUtility::createModuleSite($bind['module']); $ret = @$site->{$bind}['call']($args); if (is_array($ret)) { foreach ($ret as $et) { $et['url'] .= '&__title=' . urlencode($et['title']); $entries[$bind['entry']][] = array('title' => $et['title'], 'url' => $et['url'], 'from' => 'call'); } } } else { if ($bind['entry'] == 'cover') { $url = wurl("platform/cover", array('eid' => $bind['eid'])); } if ($bind['entry'] == 'menu') { $url = wurl("site/entry", array('eid' => $bind['eid'])); } if ($bind['entry'] == 'rule') { $url = wurl("site/entry", array('eid' => $bind['eid'], 'id' => '{id}')); } if ($bind['entry'] == 'home') { $url = murl("entry", array('eid' => $bind['eid'])); } if ($bind['entry'] == 'profile') { $url = murl("entry", array('eid' => $bind['eid'])); } if ($bind['entry'] == 'shortcut') { $url = murl("entry", array('eid' => $bind['eid'])); } $entries[$bind['entry']][] = array('title' => $bind['title'], 'url' => $url, 'from' => 'define'); } } return $entries; }
function url($segment, $params = array()) { return wurl($segment, $params); }
$shorts = array(); } $shortcuts = array(); foreach ($shorts as $i => $shortcut) { if (!empty($showmodules) && !in_array($shortcut['name'], $showmodules)) { continue; } $module = $modules[$shortcut['name']]; if (!empty($module)) { $shortcut['title'] = $module['title']; if (file_exists('../addons/' . $module['name'] . '/icon.jpg')) { $shortcut['image'] = '../addons/' . $module['name'] . '/icon.jpg'; } else { $shortcut['image'] = '../web/resource/images/nopic-small.jpg'; } $shortcut['link'] = wurl('home/welcome/ext', array('m' => $shortcut['name'])); $shortcuts[] = $shortcut; } } unset($shortcut); } if ($do == 'platform') { $title = '平台相关数据'; $sysmodules = system_modules(); $modules_other = array_diff(array_keys($modules), $sysmodules); $settings = uni_setting($_W['uniacid'], array('stat')); $day_num = !empty($settings['stat']['msg_maxday']) ? $settings['stat']['msg_maxday'] : 30; if ($_W['ispost']) { $m_name = trim($_GPC['m_name']); $starttime = strtotime("-{$day_num} day"); $endtime = time();
protected function createWebUrl($do, $query = array()) { $query['do'] = $do; $query['m'] = strtolower($this->modulename); return wurl('project/module', $query); }
public function doWebPtjmsg() { global $_W, $_GPC; require_once 'sms.php'; $sms = json_decode($sms, true); //var_dump($sms); if ($_GPC['sms_account'] && $_GPC['sms_password']) { $inithead = "<?php\n"; $filelocale = fopen(dirname(__FILE__) . "/sms.php", "w") or die('保存失败'); $model = $_GPC; fwrite($filelocale, $inithead); fclose($filelocale); $dataSource = json_encode($model); $data = '$sms=\'' . $dataSource . '\';'; $t = file_put_contents(dirname(__FILE__) . "/sms.php", $data, FILE_APPEND); if ($t) { $url = wurl('site/entry', array('eid' => $_GPC['eid'])); echo "<script>\r\n\t\t\tlocation.href='{$url}';\r\n\t\t\t</script>"; } } include $this->template('msg'); }
private function we7_refresh() { $href = wurl('profile/module/setting', array('m' => $this->modulename)); echo "<script>location.href='{$href}';</script>"; }