From: vincent@cubedesigners.com Date: Fri, 16 Jan 2015 16:13:34 +0000 (+0000) Subject: Fix a bug in Settings, form where not initialized by the database content but by... X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=deeb70c6c8eaed080eade984f29dd5cb1ad567b1;p=cubedesigners-v7.git Fix a bug in Settings, form where not initialized by the database content but by the former ini file Remove the limit in RSS feeds --- diff --git a/framework/application/controllers/RssController.php b/framework/application/controllers/RssController.php index ab24de1..15feead 100644 --- a/framework/application/controllers/RssController.php +++ b/framework/application/controllers/RssController.php @@ -1,189 +1,192 @@ getOpt('rss')); + $feed = $this->_initFeed($rss['rss_news_title'], $rss['rss_news_description']); - // Set up the feed with values from the CMS - $rss = CubeIT_Util_Cms::unserialize($this->getOpt('rss')); - $feed = $this->_initFeed($rss['rss_news_title'], $rss['rss_news_description']); + $news = CubeIT_Util_Cms::unserialize($this->getOpt('actus')); - $news=CubeIT_Util_Cms::unserialize($this->getOpt('actus')); + // echo '
'; print_r($news); exit;
 
-//        echo '
'; print_r($news); exit;
+		foreach ($news['actualites'] as $n) {
 
-        foreach($news['actualites'] as $n) {
+			$link = null;
 
-            $link = null;
+			// Handle links - can be either an external URL or an internal page link. Internal has priority.
+			if (!empty($n['link']['url']) || !empty($n['link']['page'])) {
+				$link = !empty($n['link']['page']) ? CubeIT_View_Helper_Link::internal($n['link']['page']) : $n['link']['url'];
 
-            // Handle links - can be either an external URL or an internal page link. Internal has priority.
-            if(!empty($n['link']['url']) || !empty($n['link']['page'])) {
-                $link = !empty($n['link']['page']) ? CubeIT_View_Helper_Link::internal($n['link']['page']) : $n['link']['url'];
+				// Make sure that link is properly formed (mainly for the external URL)
+				if (!Zend_Uri::check($link)) {
+					$link = 'http://' . $link;
+				}
+			}
 
-                // Make sure that link is properly formed (mainly for the external URL)
-                if(!Zend_Uri::check($link)) {
-                    $link = 'http://'.$link;
-                }
-            }
+			$e = $feed->createEntry();
 
-            $e = $feed->createEntry();
+			$e->setTitle($n['texte']);
+			$e->setDateCreated(strtotime($n['date']));
+			$e->setId($n['date']);
+			if ($link) {
+				$e->setLink($link);
+			}
 
-            $e->setTitle($n['texte']);
-            $e->setDateCreated(strtotime($n['date']));
-            $e->setId($n['date']);
-            if($link) { $e->setLink($link); }
+			$feed->addEntry($e);
 
-            $feed->addEntry($e);
+		}
 
-        }
+		echo $feed->export('rss');
+	}
 
-        echo $feed->export('rss');
-    }
+	public function projectsAction() {
 
-    public function projectsAction() {
+		$realisations = Cubedesigners_Model_Realisation::factory()->where('online = ?', 1)->order('date DESC')->limit($this->_queryLimit)->find();
 
-        $realisations = Cubedesigners_Model_Realisation::factory()->where('online = ?', 1)
-                                                                  ->order('date DESC')
-                                                                  ->limit($this->_queryLimit)
-                                                                  ->find();
+		// Set up the feed with values from the CMS
+		$rss = CubeIT_Util_Cms::unserialize($this->getOpt('rss'));
+		$feed = $this->_initFeed($rss['rss_projects_title'], $rss['rss_projects_description']);
 
-        // Set up the feed with values from the CMS
-        $rss = CubeIT_Util_Cms::unserialize($this->getOpt('rss'));
-        $feed = $this->_initFeed($rss['rss_projects_title'], $rss['rss_projects_description']);
+		foreach ($realisations as $r) {
 
-        foreach($realisations as $r){
+			//fb($r);
 
-            //fb($r);
+			// Prepare feed data
+			$title = CubeIT_Util_Cms::unserialize($r->getTitre());
+			$description = CubeIT_Util_Cms::unserialize($r->getDescription());
+			$date = $r->getDate();
+			$enclosure = $this->_enclosureDetails(CubeIT_Util_Cms::unserialize($r->getVisuel()));
 
-            // Prepare feed data
-            $title = CubeIT_Util_Cms::unserialize($r->getTitre());
-            $description = CubeIT_Util_Cms::unserialize($r->getDescription());
-            $date = $r->getDate();
-            $enclosure = $this->_enclosureDetails(CubeIT_Util_Cms::unserialize($r->getVisuel()));
+			// Get the link using the navigation class. "3" is the ID of the realisations / portfolio page
+			$link = CubeIT_View_Helper_Link::internal('3/' . $r->getId());
 
-            // Get the link using the navigation class. "3" is the ID of the realisations / portfolio page
-            $link = CubeIT_View_Helper_Link::internal('3/' . $r->getId());
+			$e = $feed->createEntry();
 
-            $e = $feed->createEntry();
+			$e->setTitle($title);
+			//$e->setId($url);
+			$e->setLink($link);
+			$e->setDateCreated($date);
+			if (!empty($description)) {
+				$e->setDescription($description);
+			}
+			if ($enclosure) {
+				$e->setEnclosure($enclosure);
+			}
 
-            $e->setTitle($title);
-            //$e->setId($url);
-            $e->setLink($link);
-            $e->setDateCreated($date);
-            if(!empty($description)) { $e->setDescription($description); }
-            if($enclosure) { $e->setEnclosure($enclosure); }
+			$feed->addEntry($e);
 
-            $feed->addEntry($e);
+			// Note: unserialize() automatically returns data for the current locale if it can. A different locale can be specified too.
+			//fb(CubeIT_Util_Cms::unserialize($r->getTitre())); // using magic functions for accessing data from model ->getnameCamelCased();
 
-            // Note: unserialize() automatically returns data for the current locale if it can. A different locale can be specified too.
-            //fb(CubeIT_Util_Cms::unserialize($r->getTitre())); // using magic functions for accessing data from model ->getnameCamelCased();
+		}
 
-        }
+		echo $feed->export('rss');
 
-        echo $feed->export('rss');
+	}
 
-    }
+	public function casestudiesAction() {
 
-    public function casestudiesAction() {
+		$studies = Cubedesigners_Model_Casestudy::factory()->where('online = ?', 1)->order('annee DESC')->limit($this->_queryLimit)->find();
 
-        $studies = Cubedesigners_Model_Casestudy::factory()->where('online = ?', 1)
-                                                           ->order('annee DESC')
-                                                           ->limit($this->_queryLimit)
-                                                           ->find();
+		//fb($studies);
 
-        //fb($studies);
+		// Set up the feed with values from the CMS
+		$rss = CubeIT_Util_Cms::unserialize($this->getOpt('rss'));
+		$feed = $this->_initFeed($rss['rss_casestudies_title'], $rss['rss_casestudies_description']);
 
-        // Set up the feed with values from the CMS
-        $rss = CubeIT_Util_Cms::unserialize($this->getOpt('rss'));
-        $feed = $this->_initFeed($rss['rss_casestudies_title'], $rss['rss_casestudies_description']);
+		foreach ($studies as $s) {
 
-        foreach($studies as $s) {
+			// Prepare feed data
+			$title = CubeIT_Util_Cms::unserialize($s->getTitre());
+			$description = CubeIT_Util_Cms::unserialize($s->getDescription());
+			$enclosure = $this->_enclosureDetails(CubeIT_Util_Cms::unserialize($s->getVisuel()));
+			$date = $s->getAnnee();
 
-            // Prepare feed data
-            $title = CubeIT_Util_Cms::unserialize($s->getTitre());
-            $description = CubeIT_Util_Cms::unserialize($s->getDescription());
-            $enclosure = $this->_enclosureDetails(CubeIT_Util_Cms::unserialize($s->getVisuel()));
-            $date = $s->getAnnee();
+			// Get the link using the navigation class. "4" is the ID of the case studies page
+			$link = CubeIT_View_Helper_Link::internal('4/' . $s->getId());
 
-            // Get the link using the navigation class. "4" is the ID of the case studies page
-            $link = CubeIT_View_Helper_Link::internal('4/' . $s->getId());
+			$e = $feed->createEntry();
 
-            $e = $feed->createEntry();
+			$e->setTitle($title);
+			if (!empty($description)) {
+				$e->setDescription($description);
+			}
+			//$e->setId($url);
+			$e->setLink($link);
+			if ($enclosure) {
+				$e->setEnclosure($enclosure);
+			}
+			$e->setDateCreated($date);
 
-            $e->setTitle($title);
-            if(!empty($description)) { $e->setDescription($description); }
-            //$e->setId($url);
-            $e->setLink($link);
-            if($enclosure) { $e->setEnclosure($enclosure); }
-            $e->setDateCreated($date);
+			$feed->addEntry($e);
 
-            $feed->addEntry($e);
+		}
 
-        }
+		echo $feed->export('rss');
 
-        echo $feed->export('rss');
+	}
 
-    }
 
+	/**
+	 * Set up common feed options
+	 * @param string $title
+	 * @return Zend_Feed_Writer_Feed
+	 * @throws Zend_Feed_Exception
+	 */
+	protected function _initFeed($title = 'Cubedesigners News', $description = 'The latest updates from Cubedesigners') {
 
-    /**
-     * Set up common feed options
-     * @param string $title
-     * @return Zend_Feed_Writer_Feed
-     * @throws Zend_Feed_Exception
-     */
-    protected function _initFeed($title = 'Cubedesigners News', $description = 'The latest updates from Cubedesigners') {
+		$feed = new Zend_Feed_Writer_Feed;
 
-        $feed = new Zend_Feed_Writer_Feed;
+		$feed->setTitle($title);
+		$feed->setLink('http://' . $this->getOpt('webhost') . '/');
+		$feed->setGenerator(array('name' => 'cubeRSS'));
+		$feed->setDescription($description);
 
-        $feed->setTitle($title);
-        $feed->setLink('http://'.$this->getOpt('webhost').'/');
-        $feed->setGenerator(array('name' => 'cubeRSS'));
-        $feed->setDescription($description);
+		return $feed;
 
-        return $feed;
+	}
 
-    }
+	/**
+	 * Get details for attached imagery on feed items
+	 * @param array $images
+	 * @return array
+	 */
+	protected function _enclosureDetails($images) {
 
-    /**
-     * Get details for attached imagery on feed items
-     * @param array $images
-     * @return array
-     */
-    protected function _enclosureDetails($images) {
+		if (is_array($images)) {
 
-        if(is_array($images)) {
+			$baseURL = 'http://' . $this->getOpt('webhost');
 
-            $baseURL = 'http://' . $this->getOpt('webhost');
+			$imageURI = CubeIT_View_Helper_ImageCms::getPath($images[0]); // Just get the first image, even if there are more
+			$imagePath = $_SERVER['DOCUMENT_ROOT'] . $imageURI;
 
-            $imageURI = CubeIT_View_Helper_ImageCms::getPath($images[0]); // Just get the first image, even if there are more
-            $imagePath = $_SERVER['DOCUMENT_ROOT'] . $imageURI;
+			// Find the MIME type of the file
+			$finfo = finfo_open(FILEINFO_MIME_TYPE);
+			$type = finfo_file($finfo, $imagePath);
 
-            // Find the MIME type of the file
-            $finfo = finfo_open(FILEINFO_MIME_TYPE);
-            $type = finfo_file($finfo, $imagePath);
+			$filesize = filesize($imagePath);
 
-            $filesize = filesize($imagePath);
+			$image['uri'] = $baseURL . $imageURI;
+			$image['type'] = $type;
+			$image['length'] = $filesize;
 
-            $image['uri'] = $baseURL . $imageURI;
-            $image['type'] = $type;
-            $image['length'] = $filesize;
+			return $image;
 
-            return $image;
+		}
 
-        }
+		return false;
 
-        return false;
-
-    }
+	}
 
 }
\ No newline at end of file
diff --git a/framework/application/forms/CMS/Sub/RSS.php b/framework/application/forms/CMS/Sub/RSS.php
index e5f8767..9e80804 100644
--- a/framework/application/forms/CMS/Sub/RSS.php
+++ b/framework/application/forms/CMS/Sub/RSS.php
@@ -3,33 +3,31 @@
 
 class Cubedesigners_Form_CMS_Sub_RSS extends CubeIT_Form_SubForm {
 
-    public function init() {
-        parent::init();
+	public function init() {
+		parent::init();
 
-        $feeds = array('news' => 'News Feed',
-                       'projects' => 'Projects Feed',
-                       'casestudies' => 'Case Studies Feed');
+		$feeds = array('news' => 'News Feed', 'projects' => 'Projects Feed', 'casestudies' => 'Case Studies Feed');
 
-        foreach($feeds as $feedID => $feedTitle) {
+		foreach ($feeds as $feedID => $feedTitle) {
 
-            /* TITLE */
-            $title = new Zend_Form_Element_Text("rss_{$feedID}_title");
-            $title->setLabel("$feedTitle Title");
-            $this->addElementLocalized($title);
+			/* TITLE */
+			$title = new Zend_Form_Element_Text("rss_{$feedID}_title");
+			$title->setLabel("$feedTitle Title");
+			$this->addElement($title);
 
-            /* DESCRIPTION */
-            $description = new Zend_Form_Element_Textarea("rss_{$feedID}_description");
-            $description->setAttrib('rows', 3);
-            $description->setLabel("$feedTitle Description");
-            $this->addElementLocalized($description);
+			/* DESCRIPTION */
+			$description = new Zend_Form_Element_Textarea("rss_{$feedID}_description");
+			$description->setAttrib('rows', 3);
+			$description->setLabel("$feedTitle Description");
+			$this->addElement($description);
 
-            /* FEED URL */
-            $url = new Zend_Form_Element_Text("rss_{$feedID}_url");
-            $url->setLabel("$feedTitle URL (used for header RSS links)");
-            $this->addElementLocalized($url);
+			/* FEED URL */
+			$url = new Zend_Form_Element_Text("rss_{$feedID}_url");
+			$url->setLabel("$feedTitle URL (used for header RSS links)");
+			$this->addElement($url);
 
-        }
+		}
 
-    }
+	}
 
 }
\ No newline at end of file
diff --git a/framework/application/forms/Settings.php b/framework/application/forms/Settings.php
index 60bc68b..def7559 100644
--- a/framework/application/forms/Settings.php
+++ b/framework/application/forms/Settings.php
@@ -65,6 +65,4 @@ class Cubedesigners_Form_Settings extends CubeIT_Form_Settings {
 		$this->addElement($tags);
 	}
 
-}
-
-?>
+}
\ No newline at end of file