예제 #1
0
 public function execute()
 {
     PHPWS_Core::initModClass('hms', 'HMS_Util.php');
     $term = $this->term;
     $db = new PHPWS_DB('hms_checkin');
     // Join hall structure
     $db->addJoin('', 'hms_checkin', 'hms_hall_structure', 'bed_id', 'bedid');
     $db->addColumn('hms_checkin.banner_id');
     $db->addColumn('hms_checkin.checkin_date');
     $db->addColumn('hms_hall_structure.hall_name');
     $db->addColumn('hms_hall_structure.room_number');
     $db->addWhere('hms_checkin.term', $term);
     $db->addWhere('hms_checkin.checkout_date', null, 'IS NULL');
     // Sort by hall, then room number
     $db->addOrder(array('hms_hall_structure.hall_name ASC', 'hms_hall_structure.room_number ASC'));
     $results = $db->select();
     if (PHPWS_Error::isError($results)) {
         throw new DatabaseException($results->toString());
     }
     // Post-processing, cleanup, making it pretty
     foreach ($results as $row) {
         // Updates counts
         $this->total++;
         $row['checkin_date'] = HMS_Util::get_short_date_time($row['checkin_date']);
         // Copy the cleaned up row to the member var for data
         $this->data[] = $row;
     }
 }
예제 #2
0
 public function __construct($name = NULL, $data = NULL, $id = NULL, $type = NULL)
 {
     $editorList = $this->getEditorList();
     if (PHPWS_Error::isError($editorList)) {
         PHPWS_Error::log($editorList);
         $this->type = null;
         return;
     }
     if (empty($type)) {
         $type = $this->getUserType();
     }
     $this->editorList = $editorList;
     if (isset($type)) {
         $result = $this->setType($type);
         if (PHPWS_Error::isError($result)) {
             PHPWS_Error::log($result);
             $this->type = null;
             return;
         }
     }
     if (isset($id)) {
         $this->id = $id;
     }
     if (isset($name)) {
         $this->setName($name);
         if (empty($this->id)) {
             $this->id = $name;
         }
     }
     if (isset($data)) {
         $this->setData(trim($data));
     }
 }
예제 #3
0
파일: key.php 프로젝트: HaldunA/phpwebsite
/**
 * unregisters deleted keys from menu
 *
 * @author Matthew McNaney <mcnaney at gmail dot com>
 * @version $Id$
 */
function menu_unregister_key(Key $key)
{
    PHPWS_Core::initModClass('menu', 'Menu_Link.php');
    if (empty($key) || empty($key->id)) {
        return FALSE;
    }
    $db = new PHPWS_DB('menu_links');
    $db->addWhere('key_id', $key->id);
    $result = $db->delete();
    if (PHPWS_Error::isError($result)) {
        PHPWS_Error::log($result);
    }
    $db2 = new PHPWS_DB('menu_assoc');
    $db2->addWhere('key_id', $key->id);
    $result = $db2->delete();
    if (PHPWS_Error::isError($result)) {
        PHPWS_Error::log($result);
    }
    $db3 = new PHPWS_DB('menus');
    $db3->addWhere('assoc_key', $key->id);
    $db3->addValue('assoc_key', 0);
    $db3->addValue('assoc_url', null);
    $db3->update();
    return true;
}
예제 #4
0
 public function execute()
 {
     $this->checkinCounts = PHPWS_DB::getAssoc("select hall_name, count(*) from hms_checkin JOIN hms_hall_structure ON hms_checkin.bed_id = hms_hall_structure.bedid WHERE term = {$this->term} and checkout_date IS NULL GROUP BY hall_name ORDER BY hall_name");
     if (PHPWS_Error::isError($this->checkinCounts)) {
         throw new DatabaseException($this->checkinCounts->toString());
     }
 }
예제 #5
0
/**
 * @author Matthew McNaney <mcnaney at gmail dot com>
 * @version $Id$
 */
function users_register($module, &$content)
{
    PHPWS_Core::initModClass('users', 'Permission.php');
    PHPWS_Core::initModClass('users', 'My_Page.php');
    $no_permissions = $no_my_page = FALSE;
    $result = Users_Permission::createPermissions($module);
    if (is_null($result)) {
        PHPWS_Boost::addLog('users', dgettext('users', 'Permissions file not implemented.'));
        $content[] = dgettext('users', 'Permissions file not implemented.');
        $no_permissions = TRUE;
    } elseif (PHPWS_Error::isError($result)) {
        $content[] = dgettext('users', 'Permissions table not created successfully.');
        PHPWS_Error::log($result);
        return FALSE;
    } else {
        $content[] = dgettext('users', 'Permissions table created successfully.');
    }
    $result = My_Page::registerMyPage($module);
    if (PHPWS_Error::isError($result)) {
        PHPWS_Boost::addLog('users', dgettext('users', 'A problem occurred when trying to register this module to My Page.'));
        $content[] = dgettext('users', 'A problem occurred when trying to register this module to My Page.');
        return FALSE;
    } elseif ($result != FALSE) {
        $content[] = dgettext('users', 'My Page registered to Users module.');
    } else {
        $no_my_page = TRUE;
    }
    // If the module doesn't have permissions or a My Page
    // then don't register the module
    if ($no_permissions && $no_my_page) {
        return FALSE;
    } else {
        return TRUE;
    }
}
예제 #6
0
 public function dropSequence($table)
 {
     $table = PHPWS_DB::addPrefix($table);
     $result = $GLOBALS['PHPWS_DB']['connection']->query("DROP TABLE {$table}");
     if (PHPWS_Error::isError($result)) {
         return $result;
     }
     return TRUE;
 }
예제 #7
0
/**
 * @author Matthew McNaney <mcnaney at gmail dot com>
 * @version $Id$
 */
function calendar_uninstall(&$content)
{
    PHPWS_Core::initModClass('calendar', 'Schedule.php');
    // Need functions to remove old event tables
    $db = new PHPWS_DB('calendar_schedule');
    $schedules = $db->getObjects('Calendar_Schedule');
    if (PHPWS_Error::isError($schedules)) {
        return $schedules;
    } elseif (empty($schedules)) {
        $result = PHPWS_DB::dropTable('calendar_schedule');
        if (PHPWS_Error::isError($result)) {
            return $result;
        }
        $result = PHPWS_DB::dropTable('calendar_notice');
        if (PHPWS_Error::isError($result)) {
            return $result;
        }
        $result = PHPWS_DB::dropTable('calendar_suggestions');
        if (PHPWS_Error::isError($result)) {
            return $result;
        }
        return true;
    }
    $error = false;
    foreach ($schedules as $sch) {
        $result = $sch->delete();
        if (PHPWS_Error::isError($result)) {
            PHPWS_Error::log($result);
            $error = true;
        }
    }
    $result = PHPWS_DB::dropTable('calendar_schedule');
    if (PHPWS_Error::isError($result)) {
        return $result;
    }
    $result = PHPWS_DB::dropTable('calendar_notice');
    if (PHPWS_Error::isError($result)) {
        return $result;
    }
    $result = PHPWS_DB::dropTable('calendar_suggestions');
    if (PHPWS_Error::isError($result)) {
        return $result;
    }
    if (PHPWS_DB::isTable('converted')) {
        $db2 = new PHPWS_DB('converted');
        $db2->addWhere('convert_name', array('schedule', 'calendar'));
        $db2->delete();
        $content[] = dgettext('calendar', 'Removed convert flag.');
    }
    if (!$error) {
        $content[] = dgettext('calendar', 'Calendar tables removed.');
    } else {
        $content[] = dgettext('calendar', 'Some errors occurred when uninstalling Calendar.');
    }
    return true;
}
예제 #8
0
 public function init()
 {
     $db = new PHPWS_DB('search');
     $db->addWhere('key_id', $this->key_id);
     $result = $db->loadObject($this);
     if (PHPWS_Error::isError($result)) {
         $this->_error = $result;
     }
     $this->loadKeywords();
 }
예제 #9
0
 public function init()
 {
     $db = new PHPWS_DB('signup_peeps');
     $result = $db->loadObject($this);
     if (PHPWS_Error::isError($result)) {
         $this->_error = $result;
     } elseif (!$result) {
         $this->id = 0;
     }
 }
예제 #10
0
 public function save($key_id)
 {
     $db = new PHPWS_DB('ps_text');
     $result = $db->saveObject($this);
     if (PHPWS_Error::isError($result)) {
         return $result;
     }
     $search = new Search($key_id);
     $search->addKeywords($this->content);
     return $search->save();
 }
예제 #11
0
 public function delete()
 {
     $db = new \PHPWS_DB('prop_roommate');
     $db->addWhere('id', $this->id);
     $result = $db->delete();
     if (\PHPWS_Error::isError($result)) {
         \PHPWS_Error::log($result);
         return false;
     } else {
         return true;
     }
 }
예제 #12
0
 public function __construct($xml_file, $die_on_error = true)
 {
     $this->filename = $xml_file;
     $this->xml = xml_parser_create();
     xml_parser_set_option($this->xml, XML_OPTION_TARGET_ENCODING, 'UTF-8');
     xml_set_object($this->xml, $this);
     xml_set_element_handler($this->xml, 'startHandler', 'endHandler');
     xml_set_character_data_handler($this->xml, 'dataHandler');
     $result = $this->parse($xml_file, $die_on_error);
     if (PHPWS_Error::isError($result)) {
         $this->error = $result;
     }
 }
예제 #13
0
 public function init()
 {
     $db = new PHPWS_DB('menu_links');
     $result = $db->loadObject($this);
     if (PHPWS_Error::isError($result)) {
         return $result;
     }
     if (!$result) {
         $this->id = 0;
         return false;
     }
     $this->loadChildren();
 }
예제 #14
0
 public function delete()
 {
     $result = parent::delete();
     if (PHPWS_Error::isError($result)) {
         return $result;
     }
     $db = new PHPWS_DB('analytics_tracker_piwik');
     $db->addWhere('id', $this->id);
     $result = $db->delete();
     if (PHPWS_Error::logIfError($result)) {
         return $result;
     }
 }
예제 #15
0
/**
 * @author Matthew McNaney <mcnaney at gmail dot com>
 * @version $Id$
 */
function rss_unregister($module, &$content)
{
    $db = new PHPWS_DB('rssfeeds');
    $db->addWhere('module', $module);
    $result = $db->delete();
    if (PHPWS_Error::isError($result)) {
        PHPWS_Error::log($result);
        $content[] = dgettext('rss', 'An error occurred trying to unregister this module from RSSFeeds.');
        return FALSE;
    } else {
        $content[] = dgettext('rss', 'Module unregistered from RSSFeeds.');
        return TRUE;
    }
}
예제 #16
0
/**
 * @author Matthew McNaney <mcnaney at gmail dot com>
 * @version $Id$
 */
function menu_install(&$content)
{
    PHPWS_Core::initModClass('menu', 'Menu_Item.php');
    $menu = new Menu_Item();
    $menu->title = dgettext('menu', 'Main menu');
    $menu->template = 'basic';
    $menu->pin_all = 1;
    $result = $menu->save();
    if (PHPWS_Error::isError($result)) {
        PHPWS_Error::log($result);
        return false;
    } else {
        $content[] = dgettext('menu', 'Default menu created successfully.');
        return true;
    }
}
예제 #17
0
 public function __construct($id = 0)
 {
     if (empty($id)) {
         $this->start_time = PHPWS_Time::getUserTime();
         $this->end_time = PHPWS_Time::getUserTime();
         return;
     } else {
         $this->id = (int) $id;
         $result = $this->init();
         if (PHPWS_Error::isError($result)) {
             PHPWS_Error::log($result);
             $this->id = 0;
         } elseif (!$result) {
             $this->id = 0;
         }
     }
 }
예제 #18
0
 public function init()
 {
     PHPWS_Core::initCoreClass('Module.php');
     $db = new PHPWS_DB('users_my_page_mods');
     $db->addColumn('mod_title');
     $result = $db->select('col');
     if (PHPWS_Error::isError($result)) {
         return $result;
     }
     if ($result) {
         foreach ($result as $mod_title) {
             $this->modules[$mod_title] = new PHPWS_Module($mod_title);
         }
     } else {
         return FALSE;
     }
     return TRUE;
 }
예제 #19
0
파일: RSS.php 프로젝트: HaldunA/phpwebsite
 public static function registerModule($module, &$content)
 {
     if (is_file(PHPWS_SOURCE_DIR . 'mod/' . $module . '/conf/rss.php')) {
         $reg_file = PHPWS_Core::getConfigFile($module, 'rss.php');
     } else {
         $reg_file = false;
     }
     if ($reg_file == FALSE) {
         PHPWS_Boost::addLog($module, dgettext('rss', 'No RSS file found.'));
         return FALSE;
     }
     PHPWS_Core::initModClass('rss', 'Channel.php');
     include $reg_file;
     $oChannel = new RSS_Channel();
     $oChannel->module = $module;
     if (!isset($channel) || !is_array($channel)) {
         $content[] = dgettext('rss', 'RSS file found but no channel information.');
         PHPWS_Boost::addLog($module, dgettext('rss', 'RSS file found but no channel information.'));
     }
     $oModule = new PHPWS_Module($module);
     if (!empty($channel['title'])) {
         $oChannel->title = strip_tags($channel['title']);
     } else {
         $oChannel->title = $oModule->proper_name;
     }
     if (!empty($channel['description'])) {
         $oChannel->description = strip_tags($channel['description']);
     }
     if (!empty($channel['link'])) {
         $oChannel->link = strip_tags($channel['link']);
     } else {
         $oChannel->link = PHPWS_Core::getHomeHttp();
     }
     $result = $oChannel->save();
     if (PHPWS_Error::isError($result)) {
         PHPWS_Error::log($result);
         PHPWS_Boost::addLog($module, dgettext('rss', 'An error occurred registering to RSS module.'));
         $content[] = dgettext('rss', 'An error occurred registering to RSS module.');
         return NULL;
     } else {
         $content[] = sprintf(dgettext('rss', 'RSS registration to %s module successful.'), $oModule->proper_name);
         return TRUE;
     }
 }
예제 #20
0
 public function execute()
 {
     PHPWS_Core::initModClass('hms', 'HMS_Residence_Hall.php');
     foreach ($this->getHalls() as $hall) {
         $hallCount = PHPWS_DB::getAssoc("select reason, count(*) from hms_assignment JOIN hms_bed ON hms_assignment.bed_id = hms_bed.id JOIN hms_room ON hms_bed.room_id = hms_room.id JOIN hms_floor ON hms_room.floor_id = hms_floor.id JOIN hms_residence_hall ON hms_floor.residence_hall_id = hms_residence_hall.id where hms_residence_hall.id = {$hall->getId()} AND hms_assignment.term = {$this->getTerm()} group by reason order by reason");
         if (PHPWS_Error::isError($hallCount)) {
             throw new DatabaseException($hallCount->toString());
         }
         $this->hallCounts[$hall->getId()] = $hallCount;
         $floors = $hall->get_floors();
         foreach ($floors as $floor) {
             $floorCount = PHPWS_DB::getAssoc("select reason, count(*) from hms_assignment JOIN hms_bed ON hms_assignment.bed_id = hms_bed.id JOIN hms_room ON hms_bed.room_id = hms_room.id JOIN hms_floor ON hms_room.floor_id = hms_floor.id where hms_floor.id = {$floor->getId()} AND hms_assignment.term = {$this->getTerm()} group by reason order by reason");
             if (PHPWS_Error::isError($floorCount)) {
                 throw new DatabaseException($floorCount->toString());
             }
             $this->floorCounts[$floor->getId()] = $floorCount;
         }
     }
 }
예제 #21
0
 public function loadTemplate()
 {
     PHPWS_Core::initCoreClass('XMLParser.php');
     $xml = new XMLParser($this->file);
     $xml->setContentOnly(true);
     if (PHPWS_Error::isError($xml->error)) {
         return $xml->error;
     }
     $result = $xml->format();
     if (empty($result['TEMPLATE'])) {
         return;
     }
     $this->data = $result['TEMPLATE'];
     if (!isset($this->data['TITLE'])) {
         $this->error[] = PHPWS_Error::get(PS_TPL_NO_TITLE, 'pagesmith', 'PS_Template::loadTemplate', $this->name);
         return;
     }
     $this->title =& $this->data['TITLE'];
     if (isset($this->data['SUMMARY'])) {
         $this->summary =& $this->data['SUMMARY'];
     }
     if (empty($this->data['THUMBNAIL'])) {
         $this->error[] = PHPWS_Error::get(PS_TPL_NO_TN, 'pagesmith', 'PS_Template::loadTemplate', $this->name);
         return;
     }
     $this->thumbnail =& $this->data['THUMBNAIL'];
     if (isset($this->data['STYLE'])) {
         $this->style =& $this->data['STYLE'];
     }
     if (empty($this->data['STRUCTURE']['SECTION'])) {
         $this->error[] = PHPWS_Error::get(PS_TPL_NO_SECTIONS, 'pagesmith', 'PS_Template::loadTemplate', $this->name);
         return;
     }
     $this->structure =& $this->data['STRUCTURE']['SECTION'];
     if (isset($this->data['FOLDERS'])) {
         if (is_array($this->data['FOLDERS']['NAME'])) {
             $this->folders =& $this->data['FOLDERS']['NAME'];
         } else {
             $this->folders = array($this->data['FOLDERS']['NAME']);
         }
     }
 }
예제 #22
0
/**
 * @author Matthew McNaney <mcnaney at gmail dot com>
 * @version $Id$
 */
function layout_unregister($module, &$content)
{
    PHPWS_Core::initModClass('layout', 'Box.php');
    $content[] = dgettext('layout', 'Removing old layout components.');
    $db = new PHPWS_DB('layout_box');
    $db->addWhere('module', $module);
    $moduleBoxes = $db->getObjects('Layout_Box');
    if (empty($moduleBoxes)) {
        return;
    }
    if (PHPWS_Error::isError($moduleBoxes)) {
        return $moduleBoxes;
    }
    foreach ($moduleBoxes as $box) {
        $box->kill();
    }
    // below makes sure box doesn't get echoed
    unset($GLOBALS['Layout'][$module]);
    unset($_SESSION['Layout_Settings']->_boxes[$module]);
}
예제 #23
0
 public static function showBlocks($key)
 {
     $db = new PHPWS_DB('block');
     $db->addWhere('block_pinned.key_id', $key->id);
     $db->addWhere('id', 'block_pinned.block_id');
     Key::restrictView($db, 'block');
     $result = $db->getObjects('Block_Item');
     if (PHPWS_Error::isError($result)) {
         PHPWS_Error::log($result);
         return NULL;
     }
     if (empty($result)) {
         return NULL;
     }
     foreach ($result as $block) {
         $block->setPinKey($key);
         Layout::add($block->view(), 'block', $block->getContentVar());
         $GLOBALS['Current_Blocks'][$block->id] = TRUE;
     }
 }
예제 #24
0
/**
 * @author Matthew McNaney <mcnaney at gmail dot com>
 * @version $Id$
 */
function users_unregister($module, &$content)
{
    PHPWS_Core::initModClass('users', 'Permission.php');
    PHPWS_Core::initModClass('users', 'My_Page.php');
    $result = Users_Permission::removePermissions($module);
    if (PHPWS_Error::isError($result)) {
        $content[] = dgettext('users', 'Permissions table not removed successfully.');
        return FALSE;
    } elseif ($result) {
        $content[] = dgettext('users', 'Permissions table removed successfully.');
    }
    $result = My_Page::unregisterMyPage($module);
    if (PHPWS_Error::isError($result)) {
        PHPWS_Boost::addLog('users', dgettext('users', 'A problem occurred when trying to unregister this module from My Page.'));
        $content[] = dgettext('users', 'A problem occurred when trying to unregister this module from My Page.');
        return FALSE;
    } elseif ($result != FALSE) {
        $content[] = dgettext('users', 'My Page unregistered from Users module.');
    }
    return TRUE;
}
예제 #25
0
 public function save()
 {
     if (!$this->sheet_id) {
         return PHPWS_Error::get(SU_NO_SHEET_ID, 'signup', 'Signup_Slot::save');
     }
     $db = new PHPWS_DB('signup_slots');
     if (!$this->id) {
         $db->addWhere('sheet_id', $this->sheet_id);
         $db->addColumn('s_order', 'max');
         $max = $db->select('one');
         if (PHPWS_Error::isError($max)) {
             return $max;
         }
         if ($max >= 1) {
             $this->s_order = $max + 1;
         } else {
             $this->s_order = 1;
         }
         $db->reset();
     }
     return $db->saveObject($this);
 }
 /**
  * Returns a Department object based on the given department ID.
  * @param unknown $id
  * @return Department
  */
 public static function getDepartmentById($id)
 {
     // Sanity checking
     if (!isset($id) || $id === '') {
         throw new \InvalidArgumentException('Missing department ID.');
     }
     // Query
     $query = "SELECT * FROM intern_department WHERE id = {$id}";
     $result = \PHPWS_DB::getRow($query);
     if (\PHPWS_Error::isError($result)) {
         throw new DatabaseException($result->toString());
     }
     if (sizeof($result) == 0) {
         return null;
     }
     // Create the object and set member variables
     $department = new DepartmentDB();
     $department->setId($result['id']);
     $department->setName($result['name']);
     $department->setHidden($result['hidden']);
     $department->setCorequisite($result['corequisite']);
     return $department;
 }
예제 #27
0
 function goToStep()
 {
     switch ($this->step) {
         case '0':
             $this->welcome();
             break;
         case '1':
             $this->createConfig();
             break;
         case '2':
             if (!$this->postConfig()) {
                 // create config file and database
                 $this->createConfig();
             } else {
                 if ($this->writeConfigFile()) {
                     // config written, need to reload page for new defines
                     header('location: index.php?step=3');
                     exit;
                 } else {
                     echo implode('<br />', $this->messages);
                 }
                 exit;
             }
             break;
         case '3':
             if ($this->createCore()) {
                 if ($this->installCoreModules()) {
                     $this->content[] = dgettext('core', 'Core modules installed successfully.');
                     $this->content[] = sprintf('<a href="index.php?step=4">%s</a>', dgettext('core', 'Click to continue'));
                 }
             }
             break;
         case '4':
             $this->createUser();
             break;
         case '5':
             if ($this->postUser()) {
                 $db = new PHPWS_DB('users');
                 $result = $db->select();
                 if (empty($result)) {
                     $_SESSION['User']->setDisplayName('Administrator');
                     $_SESSION['User']->save();
                     $this->content[] = dgettext('core', 'New user created successfully.');
                     $this->step = 6;
                     $this->goToStep();
                     break;
                 } elseif (PHPWS_Error::isError($result)) {
                     PHPWS_Error::log($result);
                     $this->content[] = dgettext('core', 'Sorry an error occurred. Please check your logs.');
                 } else {
                     $this->content[] = dgettext('core', 'Cannot create a new user. Initial user already exists.');
                     $this->display();
                 }
             } else {
                 $this->createUser();
             }
             break;
         case '6':
             if ($this->installContentModules()) {
                 $this->content[] = dgettext('core', 'Starting modules installed.');
                 $this->content[] = dgettext('core', 'The site should be ready for you to use.');
                 //                    $this->content[] = sprintf('<a href="%s">%s</a>', PHPWS_SOURCE_HTTP, dgettext('core', 'Continue to your new site...'));
                 $this->content[] = sprintf('<a href="../">%s</a>', dgettext('core', 'Continue to your new site...'));
                 unset($_SESSION['configSettings']);
                 unset($_SESSION['User']);
                 unset($_SESSION['session_check']);
                 $this->display();
             }
         case '7':
             $dsn = $this->getDSN(2);
             $this->setConfigSet('dsn', $dsn);
             $_SESSION['configSettings']['database'] = true;
             if ($this->writeConfigFile()) {
                 // config written, need to reload page for new defines
                 header('location: index.php?step=3');
                 exit;
             } else {
                 $this->step = 2;
                 $this->createConfig();
             }
     }
     $this->display();
 }
예제 #28
0
파일: Box.php 프로젝트: HaldunA/phpwebsite
 public function kill()
 {
     $theme_var = $this->getThemeVar();
     $theme = $this->getTheme();
     $db = new PHPWS_DB('layout_box');
     $db->addWhere('id', $this->getId());
     $result = $db->delete();
     if (PHPWS_Error::isError($result)) {
         return $result;
     }
     Layout_Box::reorderBoxes($theme, $theme_var);
 }
예제 #29
0
 /**
  * Deletes a branch from the hub's database
  */
 public function delete()
 {
     $db = new PHPWS_DB('branch_sites');
     $db->addWhere('id', $this->id);
     $result = $db->delete();
     if (PHPWS_Error::isError($result)) {
         PHPWS_Error::log($result);
         return false;
     }
     return true;
 }
예제 #30
0
 public function loadFeeds()
 {
     $db = new PHPWS_DB('phpws_key');
     $db->addWhere('module', $this->module);
     $db->addWhere('active', 1);
     $db->addWhere('restricted', 0);
     $db->addWhere('show_after', time(), '<');
     $db->addWhere('hide_after', time(), '>');
     $db->addOrder('create_date desc');
     // rss limit is 15
     $db->setLimit('15');
     $result = $db->getObjects('Key');
     if (PHPWS_Error::isError($result)) {
         $this->_feeds = NULL;
         $this->_error = $result;
         return $result;
     } else {
         $this->_feeds = $result;
         return TRUE;
     }
 }