Ejemplo n.º 1
0
 /**
  * Declares an association between this object and a Feed object.
  *
  * @param      Feed $v
  * @return     Sitefeed The current object (for fluent API support)
  * @throws     PropelException
  */
 public function setFeed(Feed $v = null)
 {
     if ($v === null) {
         $this->setFeedId(NULL);
     } else {
         $this->setFeedId($v->getId());
     }
     $this->aFeed = $v;
     // Add binding for other direction of this n:n relationship.
     // If this object has already been added to the Feed object, it will not be re-added.
     if ($v !== null) {
         $v->addSitefeed($this);
     }
     return $this;
 }
Ejemplo n.º 2
0
 public function testDelete()
 {
     $feed = new Feed();
     $feed->setId(3);
     $sql = 'DELETE FROM `*PREFIX*news_feeds` WHERE `id` = ?';
     $arguments = [$feed->getId()];
     $sql2 = 'DELETE FROM `*PREFIX*news_items` WHERE `feed_id` = ?';
     $arguments2 = [$feed->getId()];
     $pdoResult = $this->getMock('Result', ['fetch']);
     $pdoResult->expects($this->any())->method('fetch');
     $this->setMapperResult($sql, $arguments);
     $this->setMapperResult($sql2, $arguments2);
     $this->mapper->delete($feed);
 }
Ejemplo n.º 3
0
 static function getItems(Feed &$feed)
 {
     $fid = $feed->getId();
     $text = $feed->getMessage();
     static::doParse($text);
     $assocs = static::$array;
     $result = array();
     foreach ($assocs as $index => $assoc) {
         $item = new Item();
         $item->setId($fid . '_' . $index);
         $item->setFeed($feed);
         if (isset($assoc['type'])) {
             $item->setType($assoc['type']);
         } else {
             $item->setType('GLOBAL');
         }
         if (isset($assoc['description'])) {
             $item->setDescription($assoc['description']);
         }
         if (isset($assoc['global'])) {
             $item->setGlobal($assoc['global']);
         }
         if (isset($assoc['name'])) {
             $item->setName($assoc['name']);
         }
         if (isset($assoc['note'])) {
             $item->setNote($assoc['note']);
         }
         if (isset($assoc['price_digit'])) {
             $item->setPrice($assoc['price_digit']);
         }
         if (isset($assoc['price'])) {
             $item->setPriceStr($assoc['price']);
         }
         if (isset($assoc['status'])) {
             $item->setStatus($assoc['status']);
         }
         $result[] = $item;
     }
     if (!$result) {
         $item = new Item();
         $item->setId($fid . '_0');
         $item->setFeed($feed);
         $item->setType('GLOBAL');
         $item->setGlobal($text);
         $result[] = $item;
     }
     return $result;
 }
Ejemplo n.º 4
0
 public function delete(Feed $feed)
 {
     $id = $feed->getId();
     return deleteById($id);
 }
Ejemplo n.º 5
0
 public static function import($strXml, $blnOverwrite = false, $blnKeepSettings = false)
 {
     global $objLiveAdmin, $intDefaultLanguage, $_CONF;
     $objReturn = NULL;
     $objSettings = NULL;
     $blnZip = false;
     //*** Init DOM object.
     $objDoc = new DOMDocument("1.0", "UTF-8");
     $objDoc->formatOutput = false;
     $objDoc->preserveWhiteSpace = true;
     if (is_file($strXml)) {
         $objZip = new dUnzip2($strXml);
         if (is_object($objZip)) {
             //*** Zip file.
             $strXml = $objZip->unzip('data.xml');
             if ($strXml !== false) {
                 //*** Fix a unicode bug. Replace forbidden characters (The first 8).
                 for ($intCount = 1; $intCount < 9; $intCount++) {
                     $strHex = str_pad(dechex($intCount), 4, "0", STR_PAD_LEFT);
                     $strXml = preg_replace('/\\x{' . $strHex . '}/u', "", $strXml);
                 }
                 $strXml = preg_replace('/\\x{001f}/u', "", $strXml);
                 $objDoc->loadXML($strXml);
                 $blnZip = true;
             }
         } else {
             //*** XML file.
             $objDoc->load($strXml);
         }
     } else {
         $objDoc->loadXML($strXml);
     }
     //*** Build data structure.
     foreach ($objDoc->childNodes as $rootNode) {
         if ($rootNode->nodeName == "Punch") {
             //*** Valid Punch XML.
             foreach ($rootNode->childNodes as $accountNode) {
                 if ($accountNode->nodeName == "account") {
                     //*** Account node.
                     if ($blnOverwrite) {
                         $objAccount = Account::getByPunchId($accountNode->getAttribute("punchId"));
                         if (is_object($objAccount) && $blnKeepSettings) {
                             //*** Save settings.
                             $objSettings = Settings::getByAccount($objAccount->getId());
                         }
                         //*** Remove account.
                         if (is_object($objAccount)) {
                             $objAccount->delete();
                         }
                     }
                     //*** Create account.
                     $objAccount = new Account();
                     $objAccount->setPunchId($accountNode->getAttribute("punchId"));
                     $objAccount->setName($accountNode->getAttribute("name"));
                     $objAccount->setUri($accountNode->getAttribute("uri"));
                     $objAccount->setTimeZoneId(42);
                     $objAccount->save();
                     //*** Create temporary account object.
                     $_CONF['app']['account'] = $objAccount;
                     foreach ($accountNode->childNodes as $childNode) {
                         $arrUserIds = array();
                         $arrGroupIds = array();
                         switch ($childNode->nodeName) {
                             case "acl":
                                 self::importAcl($childNode, $objAccount->getId(), $arrUserIds, $arrGroupIds);
                                 break;
                             case "products":
                                 //*** Add products to the account.
                                 foreach ($childNode->childNodes as $productNode) {
                                     switch ($productNode->nodeName) {
                                         case "pcms":
                                             //*** Add PunchCMS product to the account.
                                             $objAccountProduct = new AccountProduct();
                                             $objAccountProduct->setAccountId($objAccount->getId());
                                             $objAccountProduct->setProductId(PRODUCT_PCMS);
                                             $objAccountProduct->setExpires($productNode->getAttribute("expires"));
                                             $objAccountProduct->save();
                                             $arrStorageIds[0] = 0;
                                             $arrFeedIds[0] = 0;
                                             //*** Add PunchCMS data to the account.
                                             foreach ($productNode->childNodes as $pcmsNode) {
                                                 switch ($pcmsNode->nodeName) {
                                                     case "settings":
                                                         //*** Add settings to the account.
                                                         if ($blnKeepSettings && is_object($objSettings)) {
                                                             foreach ($objSettings as $objSetting) {
                                                                 $objSetting->setId(0);
                                                                 $objSetting->setAccountId($objAccount->getId());
                                                                 $objSetting->save();
                                                             }
                                                         } else {
                                                             foreach ($pcmsNode->childNodes as $settingNode) {
                                                                 $objSettingTemplate = SettingTemplate::selectByName($settingNode->getAttribute("name"));
                                                                 if (is_object($objSettingTemplate)) {
                                                                     $objSetting = new Setting();
                                                                     $objSetting->setAccountId($objAccount->getId());
                                                                     $objSetting->setSettingId($objSettingTemplate->getId());
                                                                     $objSetting->setValue($settingNode->getAttribute("value"));
                                                                     $objSetting->save();
                                                                 }
                                                             }
                                                         }
                                                         break;
                                                     case "languages":
                                                         //*** Add languages to the account.
                                                         $arrLanguageIds[0] = 0;
                                                         foreach ($pcmsNode->childNodes as $languageNode) {
                                                             $objLanguage = new ContentLanguage();
                                                             $objLanguage->setAccountId($objAccount->getId());
                                                             $objLanguage->setName($languageNode->getAttribute("name"));
                                                             $objLanguage->setAbbr($languageNode->getAttribute("abbr"));
                                                             $objLanguage->default = $languageNode->getAttribute("default");
                                                             $objLanguage->setActive($languageNode->getAttribute("active"));
                                                             $objLanguage->setSort($languageNode->getAttribute("sort"));
                                                             $objLanguage->setUsername($languageNode->getAttribute("username"));
                                                             $objLanguage->save();
                                                             $arrLanguageIds[$languageNode->getAttribute("id")] = $objLanguage->getId();
                                                             if ($languageNode->getAttribute("default") == 1) {
                                                                 $intDefaultLanguage = $objLanguage->getId();
                                                             }
                                                         }
                                                         break;
                                                     case "feeds":
                                                         //*** Add feeds to the account.
                                                         $arrFeedIds[0] = 0;
                                                         foreach ($pcmsNode->childNodes as $feedNode) {
                                                             $objFeed = new Feed();
                                                             $objFeed->setAccountId($objAccount->getId());
                                                             $objFeed->setName($feedNode->getAttribute("name"));
                                                             $objFeed->setFeed($feedNode->getAttribute("feed"));
                                                             $objFeed->setBasePath($feedNode->getAttribute("basepath"));
                                                             $objFeed->setRefresh($feedNode->getAttribute("refresh"));
                                                             $objFeed->setLastUpdate($feedNode->getAttribute("lastUpdate"));
                                                             $objFeed->setActive($feedNode->getAttribute("active"));
                                                             $objFeed->setSort($feedNode->getAttribute("sort"));
                                                             $objFeed->save();
                                                             $arrFeedIds[$feedNode->getAttribute("id")] = $objFeed->getId();
                                                         }
                                                         break;
                                                     case "storage":
                                                         //*** Add media items to the account.
                                                         self::importStorage($pcmsNode, $objAccount->getId(), $arrStorageIds);
                                                         break;
                                                     case "templates":
                                                         //*** Add templates to the account.
                                                         $arrTemplateIds[0] = 0;
                                                         $arrTemplateFieldIds[0] = 0;
                                                         $arrLinkFieldIds = array();
                                                         self::importTemplates($pcmsNode, $objAccount->getId(), $arrTemplateIds, $arrTemplateFieldIds, $arrLinkFieldIds);
                                                         break;
                                                     case "elements":
                                                         //*** Add elements to the account.
                                                         $arrElementIds[0] = 0;
                                                         $arrElementFieldIds["link"][0] = 0;
                                                         $arrElementFieldIds["largeText"][0] = 0;
                                                         self::importElements($pcmsNode, $objAccount->getId(), $arrTemplateIds, $arrTemplateFieldIds, $arrElementIds, $arrElementFieldIds, $arrLinkFieldIds, $arrLanguageIds, $arrUserIds, $arrGroupIds, $arrStorageIds, $arrFeedIds);
                                                         break;
                                                     case "aliases":
                                                         //*** Add aliases to the account.
                                                         foreach ($pcmsNode->childNodes as $aliasNode) {
                                                             $objAlias = new Alias();
                                                             $objAlias->setAccountId($objAccount->getId());
                                                             $objAlias->setAlias($aliasNode->getAttribute("alias"));
                                                             if (array_key_exists($aliasNode->getAttribute("url"), $arrElementIds)) {
                                                                 $objAlias->setUrl($arrElementIds[$aliasNode->getAttribute("url")]);
                                                             } else {
                                                                 $objAlias->setUrl(0);
                                                             }
                                                             if (array_key_exists($aliasNode->getAttribute("language"), $arrLanguageIds)) {
                                                                 $objAlias->setLanguageId($arrLanguageIds[$aliasNode->getAttribute("language")]);
                                                             } else {
                                                                 $objAlias->setLanguageId(0);
                                                             }
                                                             $objAlias->setCascade($aliasNode->getAttribute("cascade"));
                                                             $objAlias->setActive($aliasNode->getAttribute("active"));
                                                             $objAlias->setSort($aliasNode->getAttribute("sort"));
                                                             $objAlias->setCreated($aliasNode->getAttribute("created"));
                                                             $objAlias->setModified($aliasNode->getAttribute("modified"));
                                                             $objAlias->save();
                                                         }
                                                         break;
                                                 }
                                             }
                                             //*** Adjust the links for deeplink fields.
                                             self::adjustDeeplinks($arrElementFieldIds["link"], $arrElementIds, $arrLanguageIds);
                                             //*** Adjust the links in large text fields.
                                             self::adjustTextlinks($arrElementFieldIds["largeText"], $arrElementIds, $arrLanguageIds, $arrStorageIds);
                                             break;
                                     }
                                 }
                                 break;
                         }
                     }
                     //*** Destroy temporary account object.
                     unset($_CONF['app']['account']);
                     $objReturn = $objAccount;
                 }
             }
         }
     }
     //*** Files.
     if ($blnZip && is_object($objReturn)) {
         self::importFiles($objZip, $objReturn);
         if ($blnKeepSettings) {
             //*** Move files to remote server.
             self::moveImportedFiles($objReturn);
         }
     }
     return $objReturn;
 }
Ejemplo n.º 6
0
function parseFeeds($intFeedId, $strCommand)
{
    global $_PATHS, $_CLEAN_POST, $_CONF, $objLang, $objLiveUser;
    $objTpl = new HTML_Template_IT($_PATHS['templates']);
    $objTpl->loadTemplatefile("feed.tpl.htm");
    $blnError = false;
    switch ($strCommand) {
        case CMD_LIST:
        case CMD_ADD:
        case CMD_EDIT:
            //*** Post the profile form if submitted.
            if (count($_CLEAN_POST) > 0 && !empty($_CLEAN_POST['dispatch']) && $_CLEAN_POST['dispatch'] == "editFeed") {
                //*** The element form has been posted.
                //*** Check sanitized input.
                if (is_null($_CLEAN_POST["frm_active"])) {
                    $blnError = true;
                }
                if (is_null($_CLEAN_POST["frm_name"])) {
                    $blnError = true;
                }
                if (is_null($_CLEAN_POST["frm_feed"])) {
                    $blnError = true;
                }
                if (is_null($_CLEAN_POST["frm_basepath"])) {
                    $blnError = true;
                }
                if (is_null($_CLEAN_POST["frm_refresh"])) {
                    $blnError = true;
                }
                if (is_null($_CLEAN_POST["dispatch"])) {
                    $blnError = true;
                }
                if ($blnError === true) {
                    //*** Display global error.
                    $objTpl->setVariable("FORM_ACTIVE_VALUE", $_POST["frm_active"] == "on" ? "checked=\"checked\"" : "");
                    $objTpl->setVariable("FORM_NAME_VALUE", $_POST["frm_name"]);
                    $objTpl->setVariable("FORM_FEED_VALUE", $_POST["frm_feed"]);
                    $objTpl->setVariable("FORM_BASEPATH_VALUE", $_POST["frm_basepath"]);
                    $objTpl->setVariable("FORM_REFRESH_VALUE", $_POST["frm_refresh"]);
                    $objTpl->setVariable("ERROR_FEED_MAIN", $objLang->get("main", "formerror"));
                } else {
                    //*** Input is valid. Save the feed.
                    if ($strCommand == CMD_EDIT) {
                        $objFeed = Feed::selectByPK($intFeedId);
                    } else {
                        $objFeed = new Feed();
                    }
                    $objFeed->setAccountId($_CONF['app']['account']->getId());
                    $objFeed->setActive($_POST["frm_active"] == "on" ? 1 : 0);
                    $objFeed->setName($_CLEAN_POST["frm_name"]);
                    $objFeed->setFeed($_CLEAN_POST["frm_feed"]);
                    $objFeed->setBasepath($_CLEAN_POST["frm_basepath"]);
                    $objFeed->setRefresh($_CLEAN_POST["frm_refresh"]);
                    $objFeed->setLastUpdate(Date::toMysql());
                    $objFeed->save();
                    //*** Cache feed.
                    $objFeed->cache();
                    header("Location: " . Request::getURI() . "/?cid=" . NAV_PCMS_FEEDS);
                    exit;
                }
            }
            //*** Initiate child element loop.
            $objFeeds = Feed::selectSorted();
            $listCount = 0;
            $intPosition = request("pos");
            $intPosition = !empty($intPosition) && is_numeric($intPosition) ? $intPosition : 0;
            $intPosition = floor($intPosition / $_SESSION["listCount"]) * $_SESSION["listCount"];
            $objFeeds->seek($intPosition);
            foreach ($objFeeds as $objFeed) {
                $objTpl->setCurrentBlock("multiview-item");
                $objTpl->setVariable("MULTIITEM_VALUE", $objFeed->getId());
                $objTpl->setVariable("BUTTON_REMOVE_HREF", "javascript:Feed.remove({$objFeed->getId()});");
                $objTpl->setVariable("BUTTON_REMOVE", $objLang->get("delete", "button"));
                $objTpl->setVariable("MULTIITEM_HREF", "?cid=" . NAV_PCMS_FEEDS . "&amp;eid={$objFeed->getId()}&amp;cmd=" . CMD_EDIT);
                $objTpl->setVariable("MULTIITEM_TYPE_CLASS", "feed");
                $objTpl->setVariable("MULTIITEM_NAME", $objFeed->getName());
                $objTpl->setVariable("MULTIITEM_POINTS_TO", $objLang->get("pointsTo", "label"));
                $objTpl->setVariable("MULTIITEM_FEED", $objFeed->getFeed());
                $objTpl->setVariable("MULTIITEM_FEED_HREF", $objFeed->getFeed());
                if (!$objFeed->getActive()) {
                    $objTpl->setVariable("MULTIITEM_ACTIVE", " class=\"inactive\"");
                }
                $objTpl->parseCurrentBlock();
                $listCount++;
                if ($listCount >= $_SESSION["listCount"]) {
                    break;
                }
            }
            //*** Render page navigation.
            $pageCount = ceil($objFeeds->count() / $_SESSION["listCount"]);
            if ($pageCount > 0) {
                $currentPage = ceil(($intPosition + 1) / $_SESSION["listCount"]);
                $previousPos = $intPosition - $_SESSION["listCount"] > 0 ? $intPosition - $_SESSION["listCount"] : 0;
                $nextPos = $intPosition + $_SESSION["listCount"] < $objFeeds->count() ? $intPosition + $_SESSION["listCount"] : $intPosition;
                $objTpl->setVariable("PAGENAV_PAGE", sprintf($objLang->get("pageNavigation", "label"), $currentPage, $pageCount));
                $objTpl->setVariable("PAGENAV_PREVIOUS", $objLang->get("previous", "button"));
                $objTpl->setVariable("PAGENAV_PREVIOUS_HREF", "?cid=" . NAV_PCMS_FEEDS . "&amp;pos={$previousPos}");
                $objTpl->setVariable("PAGENAV_NEXT", $objLang->get("next", "button"));
                $objTpl->setVariable("PAGENAV_NEXT_HREF", "?cid=" . NAV_PCMS_FEEDS . "&amp;pos={$nextPos}");
                //*** Top page navigation.
                for ($intCount = 0; $intCount < $pageCount; $intCount++) {
                    $objTpl->setCurrentBlock("multiview-pagenavitem-top");
                    $position = $intCount * $_SESSION["listCount"];
                    if ($intCount != $intPosition / $_SESSION["listCount"]) {
                        $objTpl->setVariable("PAGENAV_HREF", "href=\"?cid=" . NAV_PCMS_FEEDS . "&amp;pos={$position}\"");
                    }
                    $objTpl->setVariable("PAGENAV_VALUE", $intCount + 1);
                    $objTpl->parseCurrentBlock();
                }
                //*** Bottom page navigation.
                for ($intCount = 0; $intCount < $pageCount; $intCount++) {
                    $objTpl->setCurrentBlock("multiview-pagenavitem-bottom");
                    $position = $intCount * $_SESSION["listCount"];
                    if ($intCount != $intPosition / $_SESSION["listCount"]) {
                        $objTpl->setVariable("PAGENAV_HREF", "href=\"?cid=" . NAV_PCMS_FEEDS . "&amp;pos={$position}\"");
                    }
                    $objTpl->setVariable("PAGENAV_VALUE", $intCount + 1);
                    $objTpl->parseCurrentBlock();
                }
            }
            //*** Render list action pulldown.
            $arrActions[$objLang->get("choose", "button")] = 0;
            $arrActions[$objLang->get("delete", "button")] = "delete";
            foreach ($arrActions as $key => $value) {
                $objTpl->setCurrentBlock("multiview-listactionitem");
                $objTpl->setVariable("LIST_ACTION_TEXT", $key);
                $objTpl->setVariable("LIST_ACTION_VALUE", $value);
                $objTpl->parseCurrentBlock();
            }
            $objTpl->setCurrentBlock("multiview");
            $objTpl->setVariable("LIST_LENGTH_HREF_10", "href=\"?list=10&amp;cid=" . NAV_PCMS_FEEDS . "\"");
            $objTpl->setVariable("LIST_LENGTH_HREF_25", "href=\"?list=25&amp;cid=" . NAV_PCMS_FEEDS . "\"");
            $objTpl->setVariable("LIST_LENGTH_HREF_100", "href=\"?list=100&amp;cid=" . NAV_PCMS_FEEDS . "\"");
            switch ($_SESSION["listCount"]) {
                case 10:
                    $objTpl->setVariable("LIST_LENGTH_HREF_10", "");
                    break;
                case 25:
                    $objTpl->setVariable("LIST_LENGTH_HREF_25", "");
                    break;
                case 100:
                    $objTpl->setVariable("LIST_LENGTH_HREF_100", "");
                    break;
            }
            $objTpl->setVariable("LIST_LENGTH_HREF", "&amp;cid=" . NAV_PCMS_FEEDS);
            $objTpl->setVariable("LIST_WITH_SELECTED", $objLang->get("withSelected", "label"));
            $objTpl->setVariable("LIST_ACTION_ONCHANGE", "Feed.multiDo(this, this[this.selectedIndex].value)");
            $objTpl->setVariable("LIST_ITEMS_PER_PAGE", $objLang->get("itemsPerPage", "label"));
            $objTpl->setVariable("BUTTON_LIST_SELECT", $objLang->get("selectAll", "button"));
            $objTpl->setVariable("BUTTON_LIST_SELECT_HREF", "javascript:Feed.multiSelect()");
            $objTpl->parseCurrentBlock();
            $objTpl->setVariable("FEEDS", $objLang->get("feeds", "label"));
            $objTpl->setVariable("BUTTON_ADD", $objLang->get("feedAdd", "button"));
            //*** Form variables.
            if ($strCommand == CMD_EDIT) {
                $objFeed = Feed::selectByPK($intFeedId);
                $objTpl->setVariable("FORM_ACTIVE_VALUE", $objFeed->getActive() ? "checked=\"checked\"" : "");
                $objTpl->setVariable("FORM_NAME_VALUE", $objFeed->getName());
                $objTpl->setVariable("FORM_FEED_VALUE", $objFeed->getFeed());
                $objTpl->setVariable("FORM_BASEPATH_VALUE", $objFeed->getBasepath());
                $objTpl->setVariable("FORM_REFRESH_VALUE", $objFeed->getRefresh());
                $objTpl->setVariable("FRM_HEADER", $objLang->get("editFeed", "form"));
                $objTpl->setVariable("FRM_STYLE", "");
                $objTpl->setVariable("CMD", CMD_EDIT);
            } else {
                $objTpl->setVariable("FORM_ACTIVE_VALUE", "checked=\"checked\"");
                $objTpl->setVariable("FRM_HEADER", $objLang->get("addFeed", "form"));
                if (!$blnError) {
                    $objTpl->setVariable("FRM_STYLE", " style=\"display:none\"");
                }
                $objTpl->setVariable("CMD", CMD_ADD);
                $objElements = Elements::getFromParent(0);
                foreach ($objElements as $objElement) {
                    $objTpl->setCurrentBlock("elements.item");
                    $objTpl->setVariable("VALUE", $objElement->getId());
                    $objTpl->setVariable("LABEL", $objElement->getName());
                    $objTpl->parseCurrentBlock();
                }
            }
            $objTpl->setVariable("FRM_LABEL_ACTIVE", $objLang->get("active", "form"));
            $objTpl->setVariable("FRM_LABEL_FEED", $objLang->get("feed", "form"));
            $objTpl->setVariable("FRM_DESCR_FEED", $objLang->get("feed", "tip"));
            $objTpl->setVariable("FRM_LABEL_BASEPATH", $objLang->get("basepath", "form"));
            $objTpl->setVariable("FRM_DESCR_BASEPATH", $objLang->get("basepath", "tip"));
            $objTpl->setVariable("FRM_LABEL_NAME", $objLang->get("name", "form"));
            $objTpl->setVariable("FRM_DESCR_REFRESH", $objLang->get("refresh", "tip"));
            $objTpl->setVariable("FRM_LABEL_REFRESH", $objLang->get("refresh", "form"));
            $objTpl->setVariable("FRM_LABEL_SAVE", $objLang->get("save", "button"));
            $objTpl->setVariable("CID", NAV_PCMS_FEEDS);
            $objTpl->setVariable("EID", $intFeedId);
            $objTpl->parseCurrentBlock();
            $strReturn = $objTpl->get();
            break;
        case CMD_REMOVE:
            if (strpos($intFeedId, ',') !== false) {
                //*** Multiple elements submitted.
                $arrFeeds = explode(',', $intFeedId);
                $objFeeds = Feed::selectByPK($arrFeeds);
                foreach ($objFeeds as $objFeed) {
                    $objFeed->delete();
                }
            } else {
                //*** Single element submitted.
                $objFeed = Feed::selectByPK($intFeedId);
                $objFeed->delete();
            }
            //*** Redirect the page.
            $strReturnTo = request('returnTo');
            if (empty($strReturnTo)) {
                header("Location: " . Request::getUri() . "/?cid=" . request("cid") . "&cmd=" . CMD_LIST);
                exit;
            } else {
                header("Location: " . Request::getURI() . $strReturnTo);
                exit;
            }
            break;
    }
    return $strReturn;
}
Ejemplo n.º 7
0
 /**
  * Adds an object to the instance pool.
  *
  * Propel keeps cached copies of objects in an instance pool when they are retrieved
  * from the database.  In some cases -- especially when you override doSelect*()
  * methods in your stub classes -- you may need to explicitly add objects
  * to the cache in order to ensure that the same objects are always returned by doSelect*()
  * and retrieveByPK*() calls.
  *
  * @param      Feed $value A Feed object.
  * @param      string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
  */
 public static function addInstanceToPool(Feed $obj, $key = null)
 {
     if (Propel::isInstancePoolingEnabled()) {
         if ($key === null) {
             $key = (string) $obj->getId();
         }
         // if key === null
         self::$instances[$key] = $obj;
     }
 }