function getUserApp($uid) { static $_user_app = array(); if (!empty($_user_app)) { return $_user_app; } // 默认应用 + 用户安装的可选应用 $prefix = getDbPrefix(); $sql = "SELECT a.* FROM {$prefix}app AS a LEFT JOIN {$prefix}user_app AS u ON a.app_id = u.app_id " . "WHERE a.status = '1' OR ( a.status = '2' AND u.uid = '{$uid}' ) GROUP BY `app_id` " . "ORDER BY a.status ASC,u.display_order ASC,a.display_order ASC,a.app_id ASC"; $res = doQuery($sql); $user_app = array(); foreach ($res as $k => $v) { $v['app_entry'] = U($v['app_name'] . '/' . $v['app_entry']); $v['admin_entry'] = U($v['app_name'] . '/' . $v['admin_entry']); $v['sidebar_entry'] = U($v['app_name'] . '/' . $v['sidebar_entry']); if ($v['status'] == 1) { $user_app['local_default_app'][] = $v; } else { $user_app['local_app'][] = $v; } } // 漫游应用 global $_SITE_CONFIG; if ($_SITE_CONFIG['my_status']) { $default = getDefaultApp(); $myopapp = getInstalledByUser($_SITE_CONFIG['uid']); $ids = array(); foreach ($myopapp as $v) { if (in_array($v['appid'], $ids)) { continue; } $ids[] = $v['appid']; $user_app['myop_app'][] = array('app_id' => $v['appid'], 'app_alias' => $v['appname'], 'display_order' => $v['displayorder']); } foreach ($default as $v) { if (in_array($v['appid'], $ids)) { continue; } $ids[] = $v['appid']; $user_app['myop_default_app'][] = array('app_id' => $v['appid'], 'app_alias' => $v['appname'], 'display_order' => $v['displayorder']); } } $_user_app = $user_app; return $_user_app; }
$my_suffix = $_GET['my_suffix']; } $my_extra = isset($_GET['my_extra']) ? $_GET['my_extra'] : ''; $delimiter = strrpos($my_suffix, '?') ? '&' : '?'; $myUrl = $my_prefix . urldecode($my_suffix . $delimiter . 'my_extra=' . $my_extra); // 本地列表 if ($my_suffix == '/userapp/list') { // 由home统一管理应用 redirect(U('home/Index/editapp')); // 管理应用 $_GET['op'] = 'menu'; //模板 $max_order = 0; $myop_default = getDefaultApp(); $myop_default_id = getSubByKey($myop_default['data'], 'appid'); $myop_userapp = getInstalledByUser($_SITE_CONFIG['uid']); foreach ($myop_userapp['data'] as $k => $v) { // 默认应用不再出现在个人应用中 if (in_array($v['appid'], $myop_default_id)) { unset($myop_userapp['data'][$k]); } } } $hash = $_SITE_CONFIG['my_site_id'] . '|' . $_SITE_CONFIG['uid'] . '|' . $_SITE_CONFIG['my_site_key'] . '|' . $_MY_GLOBAL['timestamp']; $hash = md5($hash); $delimiter = strrpos($myUrl, '?') ? '&' : '?'; $url = $myUrl . $delimiter . 's_id=' . $_SITE_CONFIG['my_site_id'] . '&uch_id=' . $_SITE_CONFIG['uid'] . '&uch_url=' . urlencode($uchUrl) . '&my_suffix=' . urlencode($my_suffix) . '×tamp=' . $_MY_GLOBAL['timestamp'] . '&my_sign=' . $hash; if ($_GET['op'] == 'deleteapp') { include MYOP_THEME_PATH . '/body.html'; } else { include MYOP_THEME_PATH . '/header.html';