public function getByUsername($username) { global $mysql; $return = $mysql->getRow("\n\t\t\tSELECT *\n\t\t\tFROM `users`\n\t\t\tWHERE `username` = '" . sql_quote($username) . "'\n\t\t"); if (!is_array($return)) { return false; } $buff = unserialize($return['license']); unset($return['license']); $return['license'] = $buff; unset($buff); $buff = unserialize($return['social']); unset($return['social']); $return['social'] = $buff; unset($buff); $groups = unserialize($return['groups']); unset($return['groups']); if (is_array($groups) && !empty($groups)) { $groupsWhere = ''; foreach ($groups as $k => $v) { $return['groups'][$k] = $v; if ($groupsWhere != '') { $groupsWhere .= " OR "; } $groupsWhere .= " `ug_id` = '" . intval($k) . "' "; } $mysql->query("\n\t\t\t\tSELECT *\n\t\t\t\tFROM `user_groups`\n\t\t\t\tWHERE {$groupsWhere}\n\t\t\t", __FUNCTION__); if ($mysql->num_rows() > 0) { $return['is_admin'] = true; while ($d = $mysql->fetch_array()) { $modules = unserialize($d['rights']); foreach ($modules as $k => $v) { if (!isset($return['modules'][$k])) { $return['modules'][$k] = true; } } } } else { $return['modules'] = ''; } } else { $return['groups'] = ''; } #加载国家或地区 if ($return['country_id'] != '0') { require_once ROOT_PATH . '/apps/countries/models/countries.class.php'; $countriesClass = new countries(); $return['country'] = $countriesClass->get($return['country_id']); } #加载状态 $mysql->query("\n\t\t\tSELECT *\n\t\t\tFROM `users_status`\n\t\t\tWHERE `user_id` = '" . intval($return['user_id']) . "'\n\t\t"); if ($mysql->num_rows() > 0) { while ($d = $mysql->fetch_array()) { $return['statuses'][$d['status']] = $d; } } return $return; }
<?php // +---------------------------------------------------------------------- // | Demila [ Beautiful Digital Content Trading System ] // +---------------------------------------------------------------------- // | Copyright (c) 2015 http://demila.org All rights reserved. // +---------------------------------------------------------------------- // | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 ) // +---------------------------------------------------------------------- // | Email author@demila.org // +---------------------------------------------------------------------- _setView(ROOT_PATH . "/apps/" . $_GET['m'] . "/admin/add.php"); _setTitle($langArray['edit'] . ' ' . $langArray['country']); if (!isset($_GET['fid']) || !is_numeric($_GET['fid'])) { refresh('?m=' . $_GET['m'] . '&c=files&id=' . $_GET['id'], 'INVALID ID', 'error'); } $cms = new countries(); if (isset($_POST['edit'])) { $status = $cms->edit($_GET['fid']); if ($status !== true) { abr('error', $status); } else { refresh("?m=" . $_GET['m'] . "&c=list", $langArray['edit_complete']); } } else { $_POST = $cms->get($_GET['fid']); } require_once ROOT_PATH . '/apps/lists/leftlist_admin.php';