* * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ require_once 'geograph/global.inc.php'; init_session(); $smarty = new GeographPage(); $USER->mustHavePerm("basic"); $template = 'admin_mykey.tpl'; $cacheid = ''; function smarty_block_highlight($params, $content, &$smarty, &$repeat) { return highlight_string(str_replace("\r", '', $content), true); } $smarty->register_block('highlight', 'smarty_block_highlight'); $db = NewADOConnection($GLOBALS['DSN']); if (!$db) { die('Database connection failed'); } if (!empty($_GET['apikey'])) { //load the info for editing the record if ($_GET['apikey'] != '-new-') { $arr = $db->GetRow("select *,INET_NTOA(ip) as ip_text from apikeys where enabled = 1 and apikey = " . $db->Quote($_GET['apikey'])); $smarty->assign($arr); $token = new Token(); $token->setValue("i", $arr['id']); $smarty->assign('access', $token->getToken()); $smarty->assign('shared', md5($CONF['token_secret'] . $arr['apikey'])); } }