xaizek / rocketgit (License: AGPLv3+) (since 2018-12-09)
Light and fast Git hosting solution suitable to serve both as a hub or as a personal code storage with its tickets, pull requests, API and much more.
Commit 84bfd35c59c1e8458be7250aff6c1059afb1f204

apikeys: we need to init some vars
Author: Catalin(ux) M. BOIE
Author date (UTC): 2016-08-28 05:25
Committer name: Catalin(ux) M. BOIE
Committer date (UTC): 2016-08-28 05:25
Parent(s): 1e41a427ee47b128cd9385c3ed27565c67d27029
Signing key:
Tree: d1f57ac36a2fd9f87235dadd0530cdb04959164f
File Lines added Lines deleted
inc/apikeys.inc.php 6 3
File inc/apikeys.inc.php changed (mode: 100644) (index c0b0038..35f78f7)
... ... function rg_ak_add($db, $ui, $key, $name)
165 165 'key' => $key, 'key' => $key,
166 166 'name' => $name, 'name' => $name,
167 167 'count' => 0, 'count' => 0,
168 'first_use' => 0);
168 'first_use' => 0,
169 'last_use' => 0,
170 'last_ip' => '',
171 'last_cmd' => '');
169 172 $sql = 'INSERT INTO apikeys (itime, uid, key, name)' $sql = 'INSERT INTO apikeys (itime, uid, key, name)'
170 173 . ' VALUES (@@itime@@, @@uid@@, @@key@@, @@name@@)' . ' VALUES (@@itime@@, @@uid@@, @@key@@, @@name@@)'
171 174 . ' RETURNING key_id'; . ' RETURNING key_id';
 
... ... function rg_ak_update_use($db, $uid, $key_id, $ip, $cmd)
251 254 $params = array( $params = array(
252 255 'now' => $now, 'now' => $now,
253 256 'key_id' => $key_id, 'key_id' => $key_id,
254 'ip' => $ip,
257 'last_ip' => $ip,
255 258 'last_cmd' => $cmd); 'last_cmd' => $cmd);
256 259
257 260 if ($update_first_use) { if ($update_first_use) {
 
... ... function rg_ak_update_use($db, $uid, $key_id, $ip, $cmd)
271 274
272 275 if ($update_last_use) { if ($update_last_use) {
273 276 $sql = 'UPDATE apikeys SET last_use = @@now@@' $sql = 'UPDATE apikeys SET last_use = @@now@@'
274 . ', last_ip = @@ip@@'
277 . ', last_ip = @@last_ip@@'
275 278 . ', last_cmd = @@last_cmd@@' . ', last_cmd = @@last_cmd@@'
276 279 . ', count = count + 1' . ', count = count + 1'
277 280 . ' WHERE key_id = @@key_id@@'; . ' WHERE key_id = @@key_id@@';
Hints

Before first commit, do not forget to setup your git environment:
git config --global user.name "your_name_here"
git config --global user.email "your@email_here"

Clone this repository using HTTP(S):
git clone https://code.reversed.top/user/xaizek/rocketgit

Clone this repository using ssh (do not forget to upload a key first):
git clone ssh://rocketgit@code.reversed.top/user/xaizek/rocketgit

You are allowed to anonymously push to this repository.
This means that your pushed commits will automatically be transformed into a pull request:
... clone the repository ...
... make some changes and some commits ...
git push origin master