Code Duplication    Length = 18-21 lines in 2 locations

code/control/LinkedinCallback.php 1 location

@@ 461-478 (lines=18) @@
458
    }
459
460
461
    public function FinishLinkedin($request)
462
    {
463
        $token = SecurityToken::inst();
464
        if (!$token->checkRequest($request)) {
465
            return $this->httpError(400);
466
        }
467
        if ($this->CurrentMember()->LinkedinID) {
468
            return '<script type="text/javascript">//<![CDATA[
469
			opener.LinkedinResponse(' . \Convert::raw2json(array(
470
                'name' => $this->CurrentMember()->LinkedinName,
471
                'removeLink' => $token->addToUrl($this->Link('RemoveLinkedin')),
472
            )) . ');
473
			window.close();
474
			//]]></script>';
475
        } else {
476
            return '<script type="text/javascript">window.close();</script>';
477
        }
478
    }
479
480
481

code/control/TwitterCallback.php 1 location

@@ 509-529 (lines=21) @@
506
     * cleans up the twitter connection
507
     * Do we really need this?
508
     */
509
    public function FinishTwitter($request)
510
    {
511
        $token = SecurityToken::inst();
512
        if (!$token->checkRequest($request)) {
513
            return $this->httpError(400);
514
        }
515
        //end security check
516
        if ($this->CurrentMember()->TwitterID) {
517
            $array = array(
518
                'handle' => $this->CurrentMember()->TwitterHandle,
519
                'removeLink' => $token->addToUrl($this->Link('RemoveTwitter')),
520
            );
521
            return '
522
				<script type="text/javascript">//<![CDATA[
523
					opener.TwitterResponse(' . Convert::raw2json($array) . ');
524
					window.close();
525
				//]]></script>';
526
        } else {
527
            return '<script type="text/javascript">window.close();</script>';
528
        }
529
    }
530
531
532
//======================================= LOGIN USER ===============================================