|
@@ -136,6 +136,9 @@ class Controller
|
|
|
case 'jsonld':
|
|
case 'jsonld':
|
|
|
$this->_jsonld($this->_request->getParam('jsonld'));
|
|
$this->_jsonld($this->_request->getParam('jsonld'));
|
|
|
return;
|
|
return;
|
|
|
|
|
+ case 'yourlsproxy':
|
|
|
|
|
+ $this->_yourlsproxy($this->_request->getParam('link'));
|
|
|
|
|
+ break;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// output JSON or HTML
|
|
// output JSON or HTML
|
|
@@ -378,9 +381,15 @@ class Controller
|
|
|
);
|
|
);
|
|
|
|
|
|
|
|
$page = new View;
|
|
$page = new View;
|
|
|
|
|
+ $page->assign('CSPHEADER', $metacspheader);
|
|
|
|
|
+ $page->assign('ERROR', I18n::_($this->_error));
|
|
|
|
|
+ if ($this->_request->getOperation() === 'yourlsproxy') {
|
|
|
|
|
+ $page->assign('SHORTURL', $this->_status);
|
|
|
|
|
+ $page->draw('yourlsproxy');
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
$page->assign('NAME', $this->_conf->getKey('name'));
|
|
$page->assign('NAME', $this->_conf->getKey('name'));
|
|
|
$page->assign('BASEPATH', I18n::_($this->_conf->getKey('basepath')));
|
|
$page->assign('BASEPATH', I18n::_($this->_conf->getKey('basepath')));
|
|
|
- $page->assign('ERROR', I18n::_($this->_error));
|
|
|
|
|
$page->assign('STATUS', I18n::_($this->_status));
|
|
$page->assign('STATUS', I18n::_($this->_status));
|
|
|
$page->assign('VERSION', self::VERSION);
|
|
$page->assign('VERSION', self::VERSION);
|
|
|
$page->assign('DISCUSSION', $this->_conf->getKey('discussion'));
|
|
$page->assign('DISCUSSION', $this->_conf->getKey('discussion'));
|
|
@@ -405,7 +414,6 @@ class Controller
|
|
|
$page->assign('HTTPWARNING', $this->_conf->getKey('httpwarning'));
|
|
$page->assign('HTTPWARNING', $this->_conf->getKey('httpwarning'));
|
|
|
$page->assign('HTTPSLINK', 'https://' . $this->_request->getHost() . $this->_request->getRequestUri());
|
|
$page->assign('HTTPSLINK', 'https://' . $this->_request->getHost() . $this->_request->getRequestUri());
|
|
|
$page->assign('COMPRESSION', $this->_conf->getKey('compression'));
|
|
$page->assign('COMPRESSION', $this->_conf->getKey('compression'));
|
|
|
- $page->assign('CSPHEADER', $metacspheader);
|
|
|
|
|
$page->draw($this->_conf->getKey('template'));
|
|
$page->draw($this->_conf->getKey('template'));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -439,6 +447,22 @@ class Controller
|
|
|
echo $content;
|
|
echo $content;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * proxies link to YOURLS, updates status or error with response
|
|
|
|
|
+ *
|
|
|
|
|
+ * @access private
|
|
|
|
|
+ * @param string $link
|
|
|
|
|
+ */
|
|
|
|
|
+ private function _yourlsproxy($link)
|
|
|
|
|
+ {
|
|
|
|
|
+ $yourls = new YourlsProxy($this->_conf, $link);
|
|
|
|
|
+ if ($yourls->isError()) {
|
|
|
|
|
+ $this->_error = $yourls->getError();
|
|
|
|
|
+ } else {
|
|
|
|
|
+ $this->_status = $yourls->getUrl();
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* prepares JSON encoded status message
|
|
* prepares JSON encoded status message
|
|
|
*
|
|
*
|