Skip to content

Commit

Permalink
#211 - fixed example links in the GenSecureQueryStringController, and…
Browse files Browse the repository at this point in the history
… fixed a bug in FeedController affecting the loading of the desired active record class
  • Loading branch information
alphadevx committed Sep 7, 2015
1 parent 9d62250 commit af4b1a5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
11 changes: 5 additions & 6 deletions Alpha/Controller/FeedController.php
Original file line number Diff line number Diff line change
Expand Up @@ -173,9 +173,8 @@ public function doGET($request)
throw new IllegalArguementException('No feed type specified to generate feed!');
}

$className = "Alpha\\Model\\$ActiveRecordType";
if (class_exists($className)) {
$this->ActiveRecordType = $className;
if (class_exists($ActiveRecordType)) {
$this->ActiveRecordType = $ActiveRecordType;
} else {
throw new IllegalArguementException('No ActiveRecord available to render!');
}
Expand All @@ -185,17 +184,17 @@ public function doGET($request)

switch ($type) {
case 'RSS2':
$feed = new RSS2($className, $this->title, str_replace('&', '&', $request->getURI()), $this->description);
$feed = new RSS2($this->ActiveRecordType, $this->title, str_replace('&', '&', $request->getURI()), $this->description);
$feed->setFieldMappings($this->fieldMappings[0], $this->fieldMappings[1], $this->fieldMappings[2], $this->fieldMappings[3]);
$response->setHeader('Content-Type', 'application/rss+xml');
break;
case 'RSS':
$feed = new RSS($className, $this->title, str_replace('&', '&', $request->getURI()), $this->description);
$feed = new RSS($this->ActiveRecordType, $this->title, str_replace('&', '&', $request->getURI()), $this->description);
$feed->setFieldMappings($this->fieldMappings[0], $this->fieldMappings[1], $this->fieldMappings[2], $this->fieldMappings[3]);
$response->setHeader('Content-Type', 'application/rss+xml');
break;
case 'Atom':
$feed = new Atom($className, $this->title, str_replace('&', '&', $request->getURI()), $this->description);
$feed = new Atom($this->ActiveRecordType, $this->title, str_replace('&', '&', $request->getURI()), $this->description);
$feed->setFieldMappings($this->fieldMappings[0], $this->fieldMappings[1], $this->fieldMappings[2], $this->fieldMappings[3],
$this->fieldMappings[4]);
if ($config->get('feeds.atom.author') != '') {
Expand Down
4 changes: 2 additions & 2 deletions Alpha/Controller/GenSecureQueryStringController.php
Original file line number Diff line number Diff line change
Expand Up @@ -158,9 +158,9 @@ private function renderForm()

$html = '<p>Use this form to generate secure (encrypted) URLs which make use of the Front Controller. Always be sure to specify an action controller'.
' (act) at a minimum.</p>';
$html .= '<p>Example 1: to generate a secure URL for viewing article object 00000000001, enter <em>act=ViewArticle&amp;oid=00000000001</em></p>';
$html .= '<p>Example 1: to generate a secure URL for viewing article object 00000000001, enter <em>act=Alpha\Controller\ArticleController&amp;ActiveRecordOID=00000000001</em></p>';
$html .= '<p>Example 2: to generate a secure URL for viewing an Atom news feed of the articles, enter'.
' <em>act=ViewFeed&amp;bo=ArticleObject&amp;type=Atom</em></p>';
' <em>act=Alpha\Controller\FeedController&amp;ActiveRecordType=Alpha\Model\Article&amp;type=Atom</em></p>';

$html .= '<form action="'.$this->request->getURI().'" method="post" accept-charset="UTF-8"><div class="form-group">';
$string = new StringBox(new String(''), 'Parameters', 'QS');
Expand Down

0 comments on commit af4b1a5

Please sign in to comment.