Subversion Repositories oidplus

Rev

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

Rev 702 Rev 800
Line 193... Line 193...
193
 
193
 
194
                if (explode('$',$id)[0] == 'oidplus:com.viathinksoft.freeoid') {
194
                if (explode('$',$id)[0] == 'oidplus:com.viathinksoft.freeoid') {
195
                        $handled = true;
195
                        $handled = true;
196
 
196
 
197
                        $out['title'] = _L('Register a free OID');
197
                        $out['title'] = _L('Register a free OID');
198
                        $out['icon'] = file_exists(__DIR__.'/icon_big.png') ? OIDplus::webpath(__DIR__).'icon_big.png' : '';
198
                        $out['icon'] = file_exists(__DIR__.'/img/main_icon.png') ? OIDplus::webpath(__DIR__,true).'img/main_icon.png' : '';
199
 
199
 
200
                        // Note: We are using the highest OID instead of the rowcount, because there might be OIDs which could have been deleted in between
200
                        // Note: We are using the highest OID instead of the rowcount, because there might be OIDs which could have been deleted in between
201
                        $highest_id = $this->freeoid_max_id();
201
                        $highest_id = $this->freeoid_max_id();
202
 
202
 
203
                        $out['text'] .= '<p>'._L('Currently <a %1>%2 free OIDs have been</a> registered. Please enter your email below to receive a free OID.',OIDplus::gui()->link(self::getFreeRootOid(true)),$highest_id).'</p>';
203
                        $out['text'] .= '<p>'._L('Currently <a %1>%2 free OIDs have been</a> registered. Please enter your email below to receive a free OID.',OIDplus::gui()->link(self::getFreeRootOid(true)),$highest_id).'</p>';
Line 241... Line 241...
241
                        $email = explode('$',$id)[1];
241
                        $email = explode('$',$id)[1];
242
                        $timestamp = explode('$',$id)[2];
242
                        $timestamp = explode('$',$id)[2];
243
                        $auth = explode('$',$id)[3];
243
                        $auth = explode('$',$id)[3];
244
 
244
 
245
                        $out['title'] = _L('Activate Free OID');
245
                        $out['title'] = _L('Activate Free OID');
246
                        $out['icon'] = file_exists(__DIR__.'/icon_big.png') ? OIDplus::webpath(__DIR__).'icon_big.png' : '';
246
                        $out['icon'] = file_exists(__DIR__.'/img/main_icon.png') ? OIDplus::webpath(__DIR__,true).'img/main_icon.png' : '';
247
 
247
 
248
                        if ($already_registered_oid = $this->alreadyHasFreeOid($email, true)) {
248
                        if ($already_registered_oid = $this->alreadyHasFreeOid($email, true)) {
249
                                throw new OIDplusException(_L('This email address already has a FreeOID registered (%1)', $already_registered_oid));
249
                                throw new OIDplusException(_L('This email address already has a FreeOID registered (%1)', $already_registered_oid));
250
                        } else {
250
                        } else {
251
                                if (!OIDplus::authUtils()->validateAuthKey('com.viathinksoft.freeoid.activate_freeoid;'.$email.';'.$timestamp, $auth)) {
251
                                if (!OIDplus::authUtils()->validateAuthKey('com.viathinksoft.freeoid.activate_freeoid;'.$email.';'.$timestamp, $auth)) {
252
                                        $out['icon'] = 'img/error_big.png';
252
                                        $out['icon'] = 'img/error.png';
253
                                        $out['text'] = _L('Invalid authorization. Is the URL OK?');
253
                                        $out['text'] = _L('Invalid authorization. Is the URL OK?');
254
                                } else {
254
                                } else {
255
                                        $ra = new OIDplusRA($email);
255
                                        $ra = new OIDplusRA($email);
256
                                        $ra_existing = $ra->existing();
256
                                        $ra_existing = $ra->existing();
257
 
257
 
Line 287... Line 287...
287
        }
287
        }
288
 
288
 
289
        public function tree(&$json, $ra_email=null, $nonjs=false, $req_goto='') {
289
        public function tree(&$json, $ra_email=null, $nonjs=false, $req_goto='') {
290
                if (empty(self::getFreeRootOid(false))) return false;
290
                if (empty(self::getFreeRootOid(false))) return false;
291
 
291
 
292
                if (file_exists(__DIR__.'/treeicon.png')) {
292
                if (file_exists(__DIR__.'/img/main_icon16.png')) {
293
                        $tree_icon = OIDplus::webpath(__DIR__).'treeicon.png';
293
                        $tree_icon = OIDplus::webpath(__DIR__,true).'img/main_icon16.png';
294
                } else {
294
                } else {
295
                        $tree_icon = null; // default icon (folder)
295
                        $tree_icon = null; // default icon (folder)
296
                }
296
                }
297
 
297
 
298
                $json[] = array(
298
                $json[] = array(