48) { return g1wallet_render_landing_with_error($access, 'Invalid address length (' . $len . ' characters). A Ğ1 address is 46–47 characters long.'); } if (strncmp($address, 'g1', 2) !== 0) { return g1wallet_render_landing_with_error($access, 'Invalid address: must begin with "g1".'); } if (!preg_match('/^[1-9A-HJ-NP-Za-km-z]+$/', $address)) { return g1wallet_render_landing_with_error($access, 'Invalid address: contains characters not valid in a Ğ1 address.'); } $channel_id = local_channel(); if (!$channel_id) { return g1wallet_render_landing_with_error($access, 'Not authenticated.'); } set_pconfig($channel_id, 'g1wallet', 'g1_address', $address); // Render landing with success notice. return g1wallet_render_landing_with_success($access, 'Ğ1 address saved. Your balance will appear below.'); } // ----------------------------------------------------------------------------- // LANDING VARIANTS WITH NOTICE // These wrap g1wallet_render_landing() with a prepended notice. // ----------------------------------------------------------------------------- function g1wallet_render_landing_with_error($access, $message) { $notice = '
' . g1wallet_h($message) . '
'; return $notice . g1wallet_render_landing($access); } function g1wallet_render_landing_with_success($access, $message) { $notice = '
' . g1wallet_h($message) . '
'; return $notice . g1wallet_render_landing($access); }