From: <wen...@us...> - 2003-09-26 22:35:14
|
Update of /cvsroot/phpwebsite-comm/modules/rssfeeds/class In directory sc8-pr-cvs1:/tmp/cvs-serv8030/class Modified Files: RSS.php RSSManager.php Log Message: Initial release update Index: RSS.php =================================================================== RCS file: /cvsroot/phpwebsite-comm/modules/rssfeeds/class/RSS.php,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** RSS.php 25 Aug 2003 23:29:29 -0000 1.2 --- RSS.php 26 Sep 2003 21:07:47 -0000 1.3 *************** *** 166,192 **** $form->setTab("FOOTER", 3); ! $form->add("_EXPIRE", "text", htmlspecialchars($this->_expire)); ! $form->setSize("_EXPIRE", 30); ! $form->setMaxSize("_EXPIRE", 255); ! $form->setTab("_EXPIRE", 4); ! ! $form->add("_show_title", "radio", array(1, 0)); ! ! $form->add("_show_image", "radio", array(1, 0)); ! ! $form->add("_show_url", "radio", array(1, 0)); ! ! $form->add("_show_desc", "radio", array(1, 0)); ! ! $form->add("_home", "checkbox"); ! $form->add("_block", "checkbox"); ! $options = array("_blank"=>"_blank","_self"=>"_self"); ! $form->add("_target", "select", $options); $form->add("SUBMIT_BUTTON", "submit", $this->getId() ? $_SESSION["translate"]->it("Update") : $_SESSION["translate"]->it("Save")); $form->add("module", "hidden", "rssfeeds"); ! $form->add("_cached", "hidden", date("Ymd G:i:s")); $form->add("RSS_op", "hidden", "save"); --- 166,206 ---- $form->setTab("FOOTER", 3); ! $form->add("EXPIRE", "text", htmlspecialchars($this->_expire)); ! $form->setSize("EXPIRE", 30); ! $form->setMaxSize("EXPIRE", 255); ! $form->setTab("EXPIRE", 4); ! ! $options = array("_blank"=>"_blank","_self"=>"_self"); ! $form->add("TARGET", "select", $options); ! $form->setMatch("TARGET", $this->_target); ! $form->setTab("TARGET", 5); ! ! $form->add("SHOW_TITLE", "radio", array(1, 0)); ! $form->setMatch("SHOW_TITLE", $this->_show_title); ! $form->setTab("SHOW_TITLE", 6); ! ! $form->add("SHOW_IMAGE", "radio", array(1, 0)); ! $form->setMatch("SHOW_IMAGE", $this->_show_image); ! $form->setTab("SHOW_IMAGE", 7); ! ! $form->add("SHOW_URL", "radio", array(1, 0)); ! $form->setMatch("SHOW_URL", $this->_show_url); ! $form->setTab("SHOW_URL", 8); ! ! $form->add("SHOW_DESC", "radio", array(1, 0)); ! $form->setMatch("SHOW_DESC", $this->_show_desc); ! $form->setTab("SHOW_DESC", 9); ! $form->add("HOME", "checkbox"); ! $form->setMatch("HOME", $this->_home); ! $form->setTab("HOME", 10); ! $form->add("BLOCK", "checkbox"); ! $form->setMatch("BLOCK", $this->_block); ! $form->setTab("BLOCK", 11); $form->add("SUBMIT_BUTTON", "submit", $this->getId() ? $_SESSION["translate"]->it("Update") : $_SESSION["translate"]->it("Save")); $form->add("module", "hidden", "rssfeeds"); ! $form->add("CACHED", "hidden", date("Y-m-d G:i:s")); $form->add("RSS_op", "hidden", "save"); *************** *** 212,231 **** $tags["FOOTER_LABEL"] = $_SESSION['translate']->it("Footer"); $tags["FOOTER_HELP"] = $_SESSION["OBJ_help"]->show_link("rssfeeds", "rssFooter"); ! $tags["_EXPIRE_LABEL"] = $_SESSION['translate']->it("Expiration"); ! $tags["_EXPIRE_HELP"] = $_SESSION["OBJ_help"]->show_link("rssfeeds", "rssExpire"); ! $tags["_SHOW_TITLE_LABEL"] = $_SESSION['translate']->it("Show Channel Title"); ! $tags["_SHOW_TITLE_HELP"] = $_SESSION["OBJ_help"]->show_link("rssfeeds", "showTitle"); ! $tags["_SHOW_IMAGE_LABEL"] = $_SESSION['translate']->it("Show Channel Image"); ! $tags["_SHOW_IMAGE_HELP"] = $_SESSION["OBJ_help"]->show_link("rssfeeds", "showImage"); ! $tags["_SHOW_URL_LABEL"] = $_SESSION['translate']->it("Show Channel Title as Link"); ! $tags["_SHOW_URL_HELP"] = $_SESSION["OBJ_help"]->show_link("rssfeeds", "showURL"); ! $tags["_SHOW_DESC_LABEL"] = $_SESSION['translate']->it("Show Channel Description"); ! $tags["_SHOW_DESC_HELP"] = $_SESSION["OBJ_help"]->show_link("rssfeeds", "showDesc"); ! $tags["_HOME_LABEL"] = $_SESSION['translate']->it("Show on Home Page"); ! $tags["_HOME_HELP"] = $_SESSION["OBJ_help"]->show_link("rssfeeds", "showHome"); ! $tags["_BLOCK_LABEL"] = $_SESSION['translate']->it("Show in Block"); ! $tags["_BLOCK_HELP"] = $_SESSION["OBJ_help"]->show_link("rssfeeds", "showBlock"); ! $tags["_TARGET_LABEL"] = $_SESSION['translate']->it("Target Window"); ! $tags["_TARGET_HELP"] = $_SESSION["OBJ_help"]->show_link("rssfeeds", "rssTarget"); $tags['YES'] = $_SESSION["translate"]->it("Yes"); $tags['NO'] = $_SESSION["translate"]->it("No"); --- 226,245 ---- $tags["FOOTER_LABEL"] = $_SESSION['translate']->it("Footer"); $tags["FOOTER_HELP"] = $_SESSION["OBJ_help"]->show_link("rssfeeds", "rssFooter"); ! $tags["EXPIRE_LABEL"] = $_SESSION['translate']->it("Expiration"); ! $tags["EXPIRE_HELP"] = $_SESSION["OBJ_help"]->show_link("rssfeeds", "rssExpire"); ! $tags["SHOW_TITLE_LABEL"] = $_SESSION['translate']->it("Show Channel Title"); ! $tags["SHOW_TITLE_HELP"] = $_SESSION["OBJ_help"]->show_link("rssfeeds", "showTitle"); ! $tags["SHOW_IMAGE_LABEL"] = $_SESSION['translate']->it("Show Channel Image"); ! $tags["SHOW_IMAGE_HELP"] = $_SESSION["OBJ_help"]->show_link("rssfeeds", "showImage"); ! $tags["SHOW_URL_LABEL"] = $_SESSION['translate']->it("Show Channel Title as Link"); ! $tags["SHOW_URL_HELP"] = $_SESSION["OBJ_help"]->show_link("rssfeeds", "showURL"); ! $tags["SHOW_DESC_LABEL"] = $_SESSION['translate']->it("Show Channel Description"); ! $tags["SHOW_DESC_HELP"] = $_SESSION["OBJ_help"]->show_link("rssfeeds", "showDesc"); ! $tags["HOME_LABEL"] = $_SESSION['translate']->it("Show on Home Page"); ! $tags["HOME_HELP"] = $_SESSION["OBJ_help"]->show_link("rssfeeds", "showHome"); ! $tags["BLOCK_LABEL"] = $_SESSION['translate']->it("Show in Block"); ! $tags["BLOCK_HELP"] = $_SESSION["OBJ_help"]->show_link("rssfeeds", "showBlock"); ! $tags["TARGET_LABEL"] = $_SESSION['translate']->it("Target Window"); ! $tags["TARGET_HELP"] = $_SESSION["OBJ_help"]->show_link("rssfeeds", "rssTarget"); $tags['YES'] = $_SESSION["translate"]->it("Yes"); $tags['NO'] = $_SESSION["translate"]->it("No"); *************** *** 298,302 **** */ function view() { ! print_r($this->_content); $form = new EZform("RSS_VIEW"); $form->add("CONTINUE_BUTTON", "submit", $_SESSION["translate"]->it("More Feeds")); --- 312,324 ---- */ function view() { ! //debug info ! //print_r($this->_content); ! ! // Check to see if cache is expired...if so, update feed ! $dateDiff = date_time(date("Y-m-d G:i:s")) - date_time($this->_cached); ! if ($dateDiff/60 >= $this->_expire){ ! $this->getContent(); ! echo "Content Expired"; ! } $form = new EZform("RSS_VIEW"); $form->add("CONTINUE_BUTTON", "submit", $_SESSION["translate"]->it("More Feeds")); *************** *** 356,367 **** $this->_content = $this->getContent(); $this->_footer = PHPWS_Text::parseInput($_REQUEST["FOOTER"]); ! $this->_show_title = PHPWS_Text::parseInput($_REQUEST["_SHOW_TITLE"]); ! $this->_show_image = PHPWS_Text::parseInput($_REQUEST["_SHOW_IMAGE"]); ! $this->_show_url = PHPWS_Text::parseInput($_REQUEST["_SHOW_URL"]); ! $this->_show_desc = PHPWS_Text::parseInput($_REQUEST["_SHOW_DESC"]); ! $this->_home = PHPWS_Text::parseInput($_REQUEST["_HOME"]); ! $this->_block = PHPWS_Text::parseInput($_REQUEST["_BLOCK"]); ! $this->_block = PHPWS_Text::parseInput($_REQUEST["_TARGET"]); ! $this->_block = PHPWS_Text::parseInput($_REQUEST["_EXPIRE"]); if(is_null($this->_content)){ --- 378,390 ---- $this->_content = $this->getContent(); $this->_footer = PHPWS_Text::parseInput($_REQUEST["FOOTER"]); ! $this->_show_title = PHPWS_Text::parseInput($_REQUEST["SHOW_TITLE"]); ! $this->_show_image = PHPWS_Text::parseInput($_REQUEST["SHOW_IMAGE"]); ! $this->_show_url = PHPWS_Text::parseInput($_REQUEST["SHOW_URL"]); ! $this->_show_desc = PHPWS_Text::parseInput($_REQUEST["SHOW_DESC"]); ! $this->_home = PHPWS_Text::parseInput($_REQUEST["HOME"]); ! $this->_block = PHPWS_Text::parseInput($_REQUEST["BLOCK"]); ! $this->_target = PHPWS_Text::parseInput($_REQUEST["TARGET"]); ! $this->_expire = PHPWS_Text::parseInput($_REQUEST["EXPIRE"]); ! $this->_cached = PHPWS_Text::parseInput($_REQUEST["CACHED"]); if(is_null($this->_content)){ *************** *** 504,506 **** --- 527,546 ---- } //END function _update } + + /** + * Returns mktime for date/time comparison. + * + * @author Wendall Cada <wen...@NO...> + */ + function date_time($timestamp) { + //parse time stamp from format date(Y-m-d G:i:s) 2003-08-26 11:41:33 + $month = substr($timestamp,5,2); + $day = substr($timestamp,8,2); + $year = substr($timestamp,0,4); + $hour = substr($timestamp,11,2); + $min = substr($timestamp,14,2); + $sec = substr($timestamp,17,2); + $date_time = mktime($hour,$min,$sec,$month,$day,$year); + return $date_time; + } ?> Index: RSSManager.php =================================================================== RCS file: /cvsroot/phpwebsite-comm/modules/rssfeeds/class/RSSManager.php,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** RSSManager.php 8 Jul 2003 19:34:48 -0000 1.1.1.1 --- RSSManager.php 26 Sep 2003 21:07:47 -0000 1.2 *************** *** 1,197 **** ! <?php ! ! /** ! * RSSManager.php ! * Defines the RSS_ListManager class, which manages the list of individual jobs ! * ! * This class is an extension of the PHPWS_Manager class defined in core/Manager.php. ! * Its function is to display a sortable list of items, and to provide an interface ! * to the editing, viewing and deleting of individual items as specified in an ! * extenison of the PHPWS_Item class defined in core/Item.php. It does so by ! * over-riding the standard functions _list(), _edit(), _view(), and _delete() defined in ! * Manager.php, and adding an action() function to handle additional procedures, in ! * this case the addition of a new RSS Feed to the list, and the creation of a menu ! * item to display the list. ! * ! * @version $Id$ ! * @author Wendall Cada <wen...@us...> ! * ! */ ! ! class RSS_ListManager extends PHPWS_Manager { ! /** ! * Current RSS listing ! * ! * @var rss object ! * @access private ! */ ! var $rss; ! ! /** ! * Constructor for RSS list manager object ! * ! * @author Wendall Cada <wen...@us...> ! */ ! function RSS_ListManager() { ! $this->setModule("rssfeeds"); /* tells PHPWS_Manager where the files are */ ! $this->setRequest("RSS_MAN_op"); /* tells PHPWS_Manager the list manager opcode name */ ! $this->setTable("mod_rssfeeds_feeds"); /* tells PHPWS_Manager the table containing items to list */ ! $this->init(); /* initializes the list manager object */ ! } // END function JOB_ListManager ! ! ! /** ! * Provides standard list function: list all items in form appropriate for user ! * If function is named _list(), is called directly by managerAction() via index.php ! * ! * @author Wendall Cada <wen...@us...> ! */ ! function _list() { ! ! /* if user has admin privileges, display menu with "Add" button and admin format list */ ! if ($_SESSION["OBJ_user"]->isDeity() || $_SESSION["OBJ_user"]->allow_access("rssfeeds")) { ! ! /* set tags for the template */ ! $tags["ADD_RSS_LABEL"] = $_SESSION["translate"]->it("Add RSS Feed"); ! /* add help for this button using mod/help -- see conf/help.php */ ! $tags["ADD_RSS_HELP"] = $_SESSION["OBJ_help"]->show_link("rssfeeds", "rssAddFeed"); ! $tags["CREATE_MENU_LINK_LABEL"] = $_SESSION["translate"]->it("Create Menu Link"); ! $tags["CREATE_MENU_LINK_HELP"] = $_SESSION["OBJ_help"]->show_link("rssfeeds", "rssAddMenuLink"); ! /* and process the template templates/menu.tpl to produce the menu */ ! $content = $GLOBALS["core"]->processTemplate($tags, "rssfeeds", "menu.tpl"); ! /* add admin form of list */ ! $content .= $this->getList("admin", $_SESSION['translate']->it("RSS Feeds")); ! ! } else { /* otherwise, display user format list */ ! ! $content = $this->getList("user", $_SESSION['translate']->it("RSS Feeds")); ! } ! ! /* set display variables */ ! $GLOBALS["CNT_rssfeeds"]["title"] = $_SESSION['translate']->it("RSS Feeds"); ! $GLOBALS["CNT_rssfeeds"]["content"] = $content; ! ! } //END function _list ! ! /** ! * Provides standard edit function: edits a list item ! * If called _edit, is called directly by managerAction() via index.php ! * Note that managerAction only calls this function if there is an item to edit ! * ! * @author Wendall Cada <wen...@us...> ! */ ! function _edit() { ! ! $this->rss = new RSS($_REQUEST["PHPWS_MAN_ITEMS"][0]); /* PHPWS_MAN_ITEMS[0] contains the jobid */ ! $content = $this->rss->edit(); ! ! /* set display variables */ ! $GLOBALS["CNT_rssfeeds"]["title"] = $_SESSION['translate']->it("RSS Feeds"); ! $GLOBALS["CNT_rssfeeds"]["content"] = $content; ! ! } //END function edit ! ! /** ! * Provides standard delete function: deletes a list item ! * If called _delete, is called directly by managerAction() via index.php ! * Note that managerAction only calls this function if there is an item to delete ! * ! * @author Wendall Cada <wen...@us...> ! */ ! function _delete() { ! ! $this->rss = new RSS($_REQUEST["PHPWS_MAN_ITEMS"][0]); /* PHPWS_MAN_ITEMS[0] contains the jobid */ ! $content = $this->rss->delete(); ! ! /* set display variables */ ! $GLOBALS["CNT_rssfeeds"]["content"] = $this->rss->delete(); ! $GLOBALS["CNT_rssfeeds"]["title"] = $_SESSION['translate']->it("RSS Feeds"); ! ! } //END function _delete ! ! /** ! * Provides standard view function: displays a list item ! * If called _view, is called directly by managerAction() via index.php ! * Note that managerAction only calls this function if there is an item to view ! * ! * @author Wendall Cada <wen...@us...> ! */ ! function _view() { ! ! $this->rss = new RSS($_REQUEST["PHPWS_MAN_ITEMS"][0]); /* PHPWS_MAN_ITEMS[0] contains the jobid */ ! $content = $this->rss->view(); ! ! /* set display variables */ ! $GLOBALS["CNT_rssfeeds"]["content"] = $content; ! $GLOBALS["CNT_rssfeeds"]["title"] = $_SESSION['translate']->it("RSS Feeds"); ! ! } //END function _view ! ! ! /** ! * Perform non-standard list manager actions ! * ! * @author Wendall Cada <wen...@us...> ! */ ! function action() { ! switch($_REQUEST["RSS_MAN_op"]) { ! case "Add": ! $this->rss = new RSS(); /* create an 'empty' rss object (ref RSS.php) */ ! $content = $this->rss->edit(); /* and edit it */ ! $GLOBALS["CNT_rssfeeds"]["title"] = $_SESSION['translate']->it("RSS Feeds"); ! $GLOBALS["CNT_rssfeeds"]["content"] = $content; ! break; ! ! case "sView": /* view an item chosen from search results */ ! $this->rss = new RSS($_REQUEST["RSS_id"]); ! $content = $this->rss->view(); ! ! /* set display variables */ ! $GLOBALS["CNT_rssfeeds"]["content"] = $content; ! $GLOBALS["CNT_rssfeeds"]["title"] = $_SESSION['translate']->it("RSS Feeds"); ! break; ! ! case "Menu": ! /* allow admin to add a menu item pointing to RSS Feeds list */ ! if ($_SESSION["OBJ_user"]->isDeity() || $_SESSION["OBJ_user"]->allow_access("rssfeeds")) { ! if($GLOBALS['core']->moduleExists("menuman")) { ! $_SESSION['OBJ_menuman']->add_module_item("rssfeeds", "&RSS_MAN_op=list", "./index.php?module=rssfeeds&RSS_MAN_op=list", 1); ! } ! } ! break; ! } ! ! } //END function action ! ! ! /** ! * Searches the list of positions using the mod/search module ! * Configuration for the search appears in boost/install.php, where ! * this module is registered with the search module. ! * This function is called by the search module itself, from an accessory block. ! * ! * @param $where is a SELECT WHERE clause, passed from search module as ! * specified by user's search terms ! * @author Wendall Cada <wen...@us...> ! */ ! ! function search($where) { ! /* set up database query using input from search module */ ! $sql = "SELECT id, label FROM " . $GLOBALS['core']->tbl_prefix . "mod_rssfeeds_feeds " . $where . " AND hidden='0'"; ! $linkResult = $GLOBALS['core']->query($sql); /* perform the selection from the database */ ! ! /* if select returns any database rows */ ! if($linkResult->numrows()) { ! /* create an array of the results */ ! while($link = $linkResult->fetchrow(DB_FETCHMODE_ASSOC)) { ! $results[$link['id']] = $link['label']; ! } ! return $results; /* return results */ ! } else { ! return FALSE; /* indicate no results */ ! } ! } //END function search ! ! ! } //END class RSS_ListManager ! ?> --- 1,197 ---- ! <?php ! ! /** ! * RSSManager.php ! * Defines the RSS_ListManager class, which manages the list of individual jobs ! * ! * This class is an extension of the PHPWS_Manager class defined in core/Manager.php. ! * Its function is to display a sortable list of items, and to provide an interface ! * to the editing, viewing and deleting of individual items as specified in an ! * extenison of the PHPWS_Item class defined in core/Item.php. It does so by ! * over-riding the standard functions _list(), _edit(), _view(), and _delete() defined in ! * Manager.php, and adding an action() function to handle additional procedures, in ! * this case the addition of a new RSS Feed to the list, and the creation of a menu ! * item to display the list. ! * ! * @version $Id$ ! * @author Wendall Cada <wen...@us...> ! * ! */ ! ! class RSS_ListManager extends PHPWS_Manager { ! /** ! * Current RSS listing ! * ! * @var rss object ! * @access private ! */ ! var $rss; ! ! /** ! * Constructor for RSS list manager object ! * ! * @author Wendall Cada <wen...@us...> ! */ ! function RSS_ListManager() { ! $this->setModule("rssfeeds"); /* tells PHPWS_Manager where the files are */ ! $this->setRequest("RSS_MAN_op"); /* tells PHPWS_Manager the list manager opcode name */ ! $this->setTable("mod_rssfeeds_feeds"); /* tells PHPWS_Manager the table containing items to list */ ! $this->init(); /* initializes the list manager object */ ! } // END function JOB_ListManager ! ! ! /** ! * Provides standard list function: list all items in form appropriate for user ! * If function is named _list(), is called directly by managerAction() via index.php ! * ! * @author Wendall Cada <wen...@us...> ! */ ! function _list() { ! ! /* if user has admin privileges, display menu with "Add" button and admin format list */ ! if ($_SESSION["OBJ_user"]->isDeity() || $_SESSION["OBJ_user"]->allow_access("rssfeeds")) { ! ! /* set tags for the template */ ! $tags["ADD_RSS_LABEL"] = $_SESSION["translate"]->it("Add RSS Feed"); ! /* add help for this button using mod/help -- see conf/help.php */ ! $tags["ADD_RSS_HELP"] = $_SESSION["OBJ_help"]->show_link("rssfeeds", "rssAddFeed"); ! $tags["CREATE_MENU_LINK_LABEL"] = $_SESSION["translate"]->it("Create Menu Link"); ! $tags["CREATE_MENU_LINK_HELP"] = $_SESSION["OBJ_help"]->show_link("rssfeeds", "rssAddMenuLink"); ! /* and process the template templates/menu.tpl to produce the menu */ ! $content = $GLOBALS["core"]->processTemplate($tags, "rssfeeds", "menu.tpl"); ! /* add admin form of list */ ! $content .= $this->getList("admin", $_SESSION['translate']->it("RSS Feeds")); ! ! } else { /* otherwise, display user format list */ ! ! $content = $this->getList("user", $_SESSION['translate']->it("RSS Feeds")); ! } ! ! /* set display variables */ ! $GLOBALS["CNT_rssfeeds"]["title"] = $_SESSION['translate']->it("RSS Feeds"); ! $GLOBALS["CNT_rssfeeds"]["content"] = $content; ! ! } //END function _list ! ! /** ! * Provides standard edit function: edits a list item ! * If called _edit, is called directly by managerAction() via index.php ! * Note that managerAction only calls this function if there is an item to edit ! * ! * @author Wendall Cada <wen...@us...> ! */ ! function _edit() { ! ! $this->rss = new RSS($_REQUEST["PHPWS_MAN_ITEMS"][0]); /* PHPWS_MAN_ITEMS[0] contains the jobid */ ! $content = $this->rss->edit(); ! ! /* set display variables */ ! $GLOBALS["CNT_rssfeeds"]["title"] = $_SESSION['translate']->it("RSS Feeds"); ! $GLOBALS["CNT_rssfeeds"]["content"] = $content; ! ! } //END function edit ! ! /** ! * Provides standard delete function: deletes a list item ! * If called _delete, is called directly by managerAction() via index.php ! * Note that managerAction only calls this function if there is an item to delete ! * ! * @author Wendall Cada <wen...@us...> ! */ ! function _delete() { ! ! $this->rss = new RSS($_REQUEST["PHPWS_MAN_ITEMS"][0]); /* PHPWS_MAN_ITEMS[0] contains the jobid */ ! $content = $this->rss->delete(); ! ! /* set display variables */ ! $GLOBALS["CNT_rssfeeds"]["content"] = $this->rss->delete(); ! $GLOBALS["CNT_rssfeeds"]["title"] = $_SESSION['translate']->it("RSS Feeds"); ! ! } //END function _delete ! ! /** ! * Provides standard view function: displays a list item ! * If called _view, is called directly by managerAction() via index.php ! * Note that managerAction only calls this function if there is an item to view ! * ! * @author Wendall Cada <wen...@us...> ! */ ! function _view() { ! ! $this->rss = new RSS($_REQUEST["PHPWS_MAN_ITEMS"][0]); /* PHPWS_MAN_ITEMS[0] contains the jobid */ ! $content = $this->rss->view(); ! ! /* set display variables */ ! $GLOBALS["CNT_rssfeeds"]["content"] = $content; ! $GLOBALS["CNT_rssfeeds"]["title"] = $_SESSION['translate']->it("RSS Feeds"); ! ! } //END function _view ! ! ! /** ! * Perform non-standard list manager actions ! * ! * @author Wendall Cada <wen...@us...> ! */ ! function action() { ! switch($_REQUEST["RSS_MAN_op"]) { ! case "Add": ! $this->rss = new RSS(); /* create an 'empty' rss object (ref RSS.php) */ ! $content = $this->rss->edit(); /* and edit it */ ! $GLOBALS["CNT_rssfeeds"]["title"] = $_SESSION['translate']->it("RSS Feeds"); ! $GLOBALS["CNT_rssfeeds"]["content"] = $content; ! break; ! ! case "sView": /* view an item chosen from search results */ ! $this->rss = new RSS($_REQUEST["RSS_id"]); ! $content = $this->rss->view(); ! ! /* set display variables */ ! $GLOBALS["CNT_rssfeeds"]["content"] = $content; ! $GLOBALS["CNT_rssfeeds"]["title"] = $_SESSION['translate']->it("RSS Feeds"); ! break; ! ! case "Menu": ! /* allow admin to add a menu item pointing to RSS Feeds list */ ! if ($_SESSION["OBJ_user"]->isDeity() || $_SESSION["OBJ_user"]->allow_access("rssfeeds")) { ! if($GLOBALS['core']->moduleExists("menuman")) { ! $_SESSION['OBJ_menuman']->add_module_item("rssfeeds", "&RSS_MAN_op=list", "./index.php?module=rssfeeds&RSS_MAN_op=list", 1); ! } ! } ! break; ! } ! ! } //END function action ! ! ! /** ! * Searches the list of positions using the mod/search module ! * Configuration for the search appears in boost/install.php, where ! * this module is registered with the search module. ! * This function is called by the search module itself, from an accessory block. ! * ! * @param $where is a SELECT WHERE clause, passed from search module as ! * specified by user's search terms ! * @author Wendall Cada <wen...@us...> ! */ ! ! function search($where) { ! /* set up database query using input from search module */ ! $sql = "SELECT id, label FROM " . $GLOBALS['core']->tbl_prefix . "mod_rssfeeds_feeds " . $where . " AND hidden='0'"; ! $linkResult = $GLOBALS['core']->query($sql); /* perform the selection from the database */ ! ! /* if select returns any database rows */ ! if($linkResult->numrows()) { ! /* create an array of the results */ ! while($link = $linkResult->fetchrow(DB_FETCHMODE_ASSOC)) { ! $results[$link['id']] = $link['label']; ! } ! return $results; /* return results */ ! } else { ! return FALSE; /* indicate no results */ ! } ! } //END function search ! ! ! } //END class RSS_ListManager ! ?> |