Subversion Repositories oidplus

Rev

Rev 1143 | Rev 1156 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1143 Rev 1148
Line 44... Line 44...
44
         * @param bool $getId
44
         * @param bool $getId
45
         * @return bool|null
45
         * @return bool|null
46
         * @throws OIDplusException
46
         * @throws OIDplusException
47
         */
47
         */
48
        public static function alreadyHasFreeOid(string $email, bool $getId = false)/*: ?bool*/ {
48
        public static function alreadyHasFreeOid(string $email, bool $getId = false)/*: ?bool*/ {
49
                $res = OIDplus::db()->query("select id from ###objects where ra_email = ? and id like ? order by ".OIDplus::db()->natOrder('id'), array($email, self::getFreeRootOid(true).'.%'));
49
                $res = OIDplus::db()->query("select id from ###objects where ra_email = ? and id like ?", array($email, self::getFreeRootOid(true).'.%'));
-
 
50
                $res = new OIDplusNaturalSortedQueryResult($res, 'id');
50
                if ($row = $res->fetch_array()) {
51
                if ($row = $res->fetch_array()) {
51
                        return $getId ? $row['id'] : true;
52
                        return $getId ? $row['id'] : true;
52
                }
53
                }
53
                return $getId ? null : false;
54
                return $getId ? null : false;
54
        }
55
        }
Line 367... Line 368...
367
        /**
368
        /**
368
         * @return int
369
         * @return int
369
         * @throws OIDplusException
370
         * @throws OIDplusException
370
         */
371
         */
371
        protected static function freeoid_max_id(): int {
372
        protected static function freeoid_max_id(): int {
372
                $res = OIDplus::db()->query("select id from ###objects where id like ? order by ".OIDplus::db()->natOrder('id'), array(self::getFreeRootOid(true).'.%'));
373
                $res = OIDplus::db()->query("select id from ###objects where id like ?", array(self::getFreeRootOid(true).'.%'));
-
 
374
                $res = new OIDplusNaturalSortedQueryResult($res, 'id');
373
                $highest_id = 0;
375
                $highest_id = 0;
374
                while ($row = $res->fetch_array()) {
376
                while ($row = $res->fetch_array()) {
375
                        $arc = substr_count(self::getFreeRootOid(false), '.')+1;
377
                        $arc = substr_count(self::getFreeRootOid(false), '.')+1;
376
                        $highest_id = explode('.',$row['id'])[$arc];
378
                        $highest_id = explode('.',$row['id'])[$arc];
377
                }
379
                }