function post() { $si = DB_DataObject::factory('Signup'); if (empty($_REQUEST['id']) || !$si->get($_REQUEST['id'])) { $this->jerr("invalid request"); } if ($si->person_id != 0) { $si->jerr("Account already processed"); } // rejected.. if ($_REQUEST['person_id'] < 0) { $si->setFrom($_REQUEST); $si->update(); $this->jok("OK"); } $p = DB_DataObject::factory("core_person"); $p->setFrom($_REQUEST); $p->insert(); $si->setFrom($_REQUEST); $si->person_id = $p->id; $si->update(); // generate a password // and send welcome message. $this->jok($p->toArray()); }
/** * Get a list of memberships for a person * @param Pman_Core_DataObjects_Person $person who * @param String column to fetch.. eg. group_id or 'name' * */ function listGroupMembership($person, $arrayof = 'group_id') { $this->inAdmin = false; $t = clone $this; //DB_DataObject::debugLevel(1); $grp = DB_DataObject::factory('core_group'); $t->joinAdd($grp, 'LEFT'); //$person->id = (int)$person->id; $t->whereAdd("\n user_id = {$person->id}\n "); $t->selectAdd(); $t->selectAdd("distinct(group_id), {$grp->tableName()}.name as name"); $t->whereAdd('group_id IS NOT NULL'); $t->find(); $ret = array(); // $ret = $arrayof == 'group_id' ? array(0) : array(); // default member of 'All groups'!! while ($t->fetch()) { $ret[] = $t->{$arrayof}; if ($t->name == 'Administrators') { /// mmh... bit risky? $this->inAdmin = true; } } if ($arrayof == 'group_id' && !count($ret)) { $ret = array(0); /// default if they are not a member of any group. } //var_dump($ret); return $ret; }
function makeEditForm($selfurl) { // nice names for each field $formNames = array('cfg_incoming_path' => 'Kannel Incoming Path: ', 'cfg_username' => 'Username:'******'cfg_password' => 'Password:'******'cfg_global_sender' => 'Global Sender:', 'cfg_bearerbox_host' => 'Bearerbox IP:', 'cfg_sendsms_port' => 'Send SMS Port:', 'cfg_playsms_web' => 'PlaySMS web url:', 'cfg_restart_frequency' => 'Restart Kannel Regularly?'); // infer the fields we're going to show // from the list of formNames $renderFields = array(); foreach ($formNames as $field => $name) { $renderFields[] = $field; } // find the first record in the config table $do = DB_DataObject::factory('playsms_gwmodKannel_config'); $do->get(1); // create the form with the user-showable names $fb = DB_DataObject_FormBuilder::create($do, array("fieldLabels" => $formNames, "fieldsToRender" => $renderFields)); // set up enums $fb->enumFields = array('cfg_restart_frequency'); $form = $fb->getForm("{$selfurl}"); if ($form->validate()) { $err = "Gateway module configurations has been saved"; print "<p><font color=red>{$err}</font><p>"; $form->process(array(&$fb, 'processForm'), false); } $form->display(); echo "<p/><hr/><p/>"; echo "<a href=\"plugin/gateway/kannel/kannel-monitor/\">[ Monitor Status ]</a> \n"; echo "<a href=\"{$selfurl}&op=manage_smsc\">[ Bind SMSC ]</a>"; }
public function delete() { $log = DB_DataObject::factory('log'); $log->id_users = $this->id; $this->user_log(e('log_cleanup', array($log->delete()))); redirect('log'); }
function init($pg) { $group = DB_DataObject::factory('core_group'); // group should be auto created - by update-database... if (!$group->get('name', 'core-person-signup-bcc')) { $group = DB_DataObject::factory('core_group'); $group->name = 'core-person-signup-bcc'; $group->insert(); } $p = DB_DataObject::factory('core_person'); if (!$p->count()) { return; // can not check people... } // got people... $member = DB_DataObject::factory('core_group_member'); $member->group_id = $group->id; if ($member->count()) { return; } // not got members.. // if we only have one member - then add it .... (it's the admin, and they can modify this later.. - after they get annoyed with it.. $p->find(true); $member = DB_DataObject::factory('core_group_member'); $member->group_id = $group->id; $member->user_id = $p->id; $member->insert(); // only display if we have members.. }
function makeEditForm($selfurl) { // nice names for each field $formNames = array('cfg_web_title' => 'Website title:', 'cfg_web_url' => 'Website URL:', 'cfg_email_service' => 'Website email', 'cfg_email_footer' => 'Forwarded email footer:', 'cfg_gateway_module' => 'Activated gateway module:', 'cfg_gateway_number' => 'Gateway number:', 'cfg_system_from' => 'System messages <br/> (e.g., balance updates) are sent from:', 'cfg_system_restart_frequency' => 'Restart the entire system regularly?'); // infer the fields we're going to show // from the list of formNames $renderFields = array(); foreach ($formNames as $field => $name) { $renderFields[] = $field; } // List of gateway plugins. // TODO: make this get listing of the gw plugin files // rather than be hard-coded $gw_mods = array("kannel" => "Kannel", "gnokii" => "Gnokii", "uplink" => "UpLink", "clickatell" => "ClickAtell"); // find the first record in the config table $do = DB_DataObject::factory(playsms_tblConfig_main); $do->find(); $do->fetch(); // create the form with the user-showable names $fb = DB_DataObject_FormBuilder::create($do, array("fieldLabels" => $formNames, "fieldsToRender" => $renderFields)); $fb->submitText = "Save"; // set up gw_mod enum $fb->enumFields = array('cfg_gateway_module', 'cfg_system_restart_frequency'); $fb->enumOptions = array('cfg_gateway_module' => $gw_mods); $form = $fb->getForm("{$selfurl}"); if ($form->validate()) { $err = "Main configuration has been saved"; print "<p><font color=red>{$err}</font><p>"; $form->process(array(&$fb, 'processForm'), false); } $form->display(); }
function execute(&$controller, &$request, &$user) { $member = $user->getAttribute('member', GLU_NS); // my feeds $source = DB_DataObject::factory('source'); $source->whereAdd('member_id = ' . $source->escape($member->id)); if ($request->hasParameter('id')) { $source->whereAdd('id = ' . $source->escape($request->getParameter('id'))); } $source->find(); $feeds = array(); while ($source->fetch()) { $rss = new FeedParser($source->uri); $rss->parse(); foreach ($rss->getItems() as $item) { $feed['id'] = $source->id; $feed['title'] = $item['title']; $feed['link'] = $item['link']; $feed['description'] = isset($item['description']) ? $item['description'] : ''; $feed['date'] = isset($item['dc:date']) ? $item['dc:date'] : (isset($item['date']) ? $item['date'] : ''); $feeds[] = $feed; } } $haj = new HTML_AJAX_JSON(); $output = $haj->encode($feeds); header('Content-Type: application/x-javascript; charset=utf-8'); echo $output; return VIEW_NONE; }
protected function populateCMS($action) { try { $content = Mreg::get('content'); } catch (Exception $e) { $content = DB_DataObject::factory($this->_dbtable); } if (!$this->_forceaccessible && !empty($this->_dbaccessibleaspage)) { $content->{$this->_dbaccessibleaspage} = 1; } if (key_exists('alias_id', $content->table())) { $content->whereAdd('alias_id is null'); } if (!$content->get($this->_dbstrip, $action)) { $this->handleNotFound($action); return; } if ($content->{$this->_dbisnode}) { $target = strtolower(str_replace('Module_', '', get_class($this))) . '/' . $content->getPlugin('tree')->getFirstChild($content)->{$this->_dbstrip}; $this->redirect301($target); } $this->assignRef('content', $content); $this->_content = $content; try { Mreg::set('content', $content); } catch (Exception $e) { } $this->assign($this->_tpltitle, $content->{$this->_dbtitle}); }
function del($params) { $json = new Services_JSON(); $subcategory = DB_DataObject::factory("subcategory"); $subcategory->id = $params["id"]; print $subcategory->delete() ? $json->encode(array("error" => false)) : $json->encode(array("error" => true)); }
public function update() { $id = $this->request['id_arc']; $this->check_permissons('arcanums', $id); $old_arc = DB_DataObject::factory('arcanums'); $old_arc->get($id); $portalid = $old_arc->id_portals; //!!! //olds to active = n $old_arcs = DB_DataObject::factory('arcanums'); $old_arcs->id_portals = $portalid; if ($old_arcs->find()) { while ($old_arcs->fetch()) { $n_enc = $this->arc_encrypt_input('n'); if ($old_arcs->active != $n_enc) { $old_arcs->active = $n_enc; $old_arcs->update(); } } } $new_arcanum = DB_DataObject::factory('arcanums'); $new_arcanum->id_portals = $portalid; $this->request['active'] = "y"; $this->request['created'] = TIME; $new_arcanum = $this->arc_encrypt_input($new_arcanum, $this->request); $new_arcanum->insert(); $this->content = 1; $port = DB_DataObject::factory('portals'); $port->get($portalid); $portal = $this->arc_decrypt_output($port->name); $this->user_log(e('arcanums_changes') . ': [' . $portal . ']'); $this->useview = FALSE; }
function execute(&$controller, &$request, &$user) { $account = $request->getParameter('account'); $request->setAttribute('account', $account); $count = $request->hasParameter('count') ? $request->getParameter('count') : 16; $callback = $request->hasParameter('callback') ? $request->getParameter('callback') : false; $request->setAttribute('callback', $callback); $raw = $request->hasParameter('raw') ? true : false; $request->setAttribute('raw', $raw); $member = DB_DataObject::factory('member'); $member->get('account', $account); $site = DB_DataObject::factory('site'); $site->get('member_id', $member->id); $feed = array(); $feed['uri'] = SCRIPT_PATH . "{$member->account}/"; $feed['title'] = $site->title; $feed['description'] = $site->description; $feed['author'] = $member->account; $entries = EntryUtils::get_entries_by_account($account, $count); foreach ($entries as $key => $entry) { $entry['tags'] = TagUtils::get_tags_by_entry_id($entry['id']); $entries[$key] = $entry; } $feed = $feed + $entries; $request->setAttribute('feed', $feed); $request->setAttribute('entries', $entries); return VIEW_SUCCESS; }
/** * @fixme Should this return false on lookup fail to match staticGet? */ function pkeyGet($cls, $kv) { $i = Memcached_DataObject::multicache($cls, $kv); if ($i !== false) { // false == cache miss return $i; } else { $i = DB_DataObject::factory($cls); if (empty($i) || PEAR::isError($i)) { return false; } foreach ($kv as $k => $v) { $i->{$k} = $v; } if ($i->find(true)) { $i->encache(); } else { $i = null; $c = self::memcache(); if (!empty($c)) { $ck = self::multicacheKey($cls, $kv); $c->set($ck, null); } } return $i; } }
function execute(&$controller, &$request, &$user) { $account = $request->getParameter('account'); $format = $request->hasParameter('format') ? $request->getParameter('format') : 'html'; $member = DB_DataObject::factory('member'); $member->get('account', $account); $site = DB_DataObject::factory('site'); $site->get('member_id', $member->id); $feed = DB_DataObject::factory('feed'); $feeds = $feed->getListsByAccount($account); switch ($format) { case 'opml11': foreach ($feeds as $key => $feed) { $f = array('title' => $feed->title, 'text' => $feed->description, 'link' => $feed->link, 'uri' => $feed->uri); $feeds[$key] = $f; } $writer =& new OPMLWriter(); $writer->setHead(array('title' => $site->title, 'date' => time(), 'owner' => $account)); $writer->setOutlines($feeds); $writer->display($format); return VIEW_NONE; case 'html': default: $request->setAttribute('sources', $feeds); return VIEW_SUCCESS; } }
function execute(&$controller, &$request, &$user) { $member = $user->getAttribute('member', GLU_NS); $user->setAttribute('member', $member, GLU_NS); $custom = $request->hasParameter('custom_design_submit') ? $request->getParameter('custom_design_submit') : null; if ($custom) { $ct = DB_DataObject::factory('custom_template'); $ct->member_id = $member->id; if ($ct->count() > 0) { $ct->get('member_id', $member->id); $ct->template = $request->getParameter('css'); $ct->update(); } else { $ct->member_id = $member->id; $ct->template = $request->getParameter('css'); $ct->insert(); } Controller::redirect(SCRIPT_PATH . 'setting/design/changed_custom'); } else { $member->design_id = $request->getParameter('design_id'); $member->update(); Controller::redirect(SCRIPT_PATH . 'setting/design/changed'); } return VIEW_NONE; }
function execute(&$filterChain, &$controller, &$request, &$user) { $loaded =& $request->getAttribute('AutoLoginFilter'); if ($loaded == null) { $token = isset($_COOKIE['token']) ? $_COOKIE['token'] : null; if ($token and !$user->isAuthenticated()) { list($id, $password) = split('-', $token); $member = DB_DataObject::factory('member'); $member->get($id); if ($member->password == $password) { $user->setAuthenticated(true); $user->addPrivilege('member', GLU_NS); $user->setAttribute('member', $member, GLU_NS); // added cookie liftime for footprint /* setcookie( 'token', $token, time() + PLNET_LOGIN_LIFETIME ); */ } } $filterChain->execute($controller, $request, $user); } else { $filterChain->execute($controller, $request, $user); } }
function hasReleases() { $rel =& DB_DataObject::factory('releases'); $rel->channel = $this->channel; $rel->package = $this->package; return $rel->find(); }
function login() { $this->showStylesheets(); $nickname = common_canonical_nickname($this->trimmed('nickname')); $password = $this->arg('password'); $msg = null; if ($nickname) { if (common_check_user($nickname, $password)) { $user = User::staticGet('nickname', $nickname); if (!$user) { $this->showLoginForm(_m("Server error: Couldn't get user!")); } $flink = DB_DataObject::factory('foreign_link'); $flink->user_id = $user->id; $flink->foreign_id = $this->fbuid; $flink->service = FACEBOOK_SERVICE; $flink->created = common_sql_now(); $flink->set_flags(true, false, false, false); $flink_id = $flink->insert(); // XXX: Do some error handling here $this->setDefaults(); $this->getUpdatePermission(); return; } else { $msg = _m('Incorrect username or password.'); } } $this->showLoginForm($msg); $this->showFooter(); }
function getq($params) { $json = new Services_JSON(); $item = DB_DataObject::factory("item"); if (isset($params["categ"]) && $params["categ"] > 0) { $item->whereAdd("subcategory_id = {$params['categ']}", "OR"); $item->whereAdd("subcategory_id2 = {$params['categ']}", "OR"); $item->whereAdd("subcategory_id3 = {$params['categ']}", "OR"); } $count = $item->count(); $total = $count > 0 ? ceil($count / (int) $params["rows"]) : 0; $page = min($params["page"], $total); $start = max(0, (int) $params["rows"] * $page - (int) $params["rows"]); $item->selectAdd(); $item->selectAdd("id, url, title, descr"); $item->orderBy("{$params['sidx']} {$params['sord']}"); $item->limit($start, (int) $params["rows"]); $item->find(); $res = array(); while ($item->fetch()) { $res["rows"][] = array("id" => $item->id, "cell" => array($item->id, $item->url, $item->title, $item->descr)); } $res["page"] = $page; $res["total"] = $total; $res["records"] = $count; print $json->encode($res); }
function _getCache($uri) { $feed = DB_DataObject::factory('feed'); $feed->uri = $uri; $feed->find(); $feed->fetch(); $channel = array('title' => $feed->title, 'link' => $feed->link, 'favicon' => $feed->favicon); // items $items = array(); $f2e = DB_DataObject::factory('feed_to_entry'); $f2e->feed_id = $feed->id; $f2e->find(); while ($f2e->fetch()) { $entry = DB_DataObject::factory('entry'); $entry->id = $f2e->entry_id; $entry->find(); while ($entry->fetch()) { $item = array(); $item['title'] = $entry->title; $item['link'] = $entry->uri; $item['description'] = $entry->description; $item['date'] = $entry->date; $items[] = $item; } } $struct = array('channel' => $channel, 'items' => $items); return $struct; }
public function memo() { if (strlen($this->request['q']) < $this->min_search_chars) { die(e('min_fn_l') . $this->min_search_chars); } $searchlist = array('title', 'note'); $q = str_replace('*', '.*', strtolower($this->request['q'])); $memos = DB_DataObject::factory('memos'); $memos->id_users = $this->id; $this->ret = $this->ret['ret'] = array(); $this->ret['count'] = 0; if ($memos->find()) { while ($memos->fetch()) { $memo_array = $this->arc_decrypt_output(array(clone $memos)); $treffer = FALSE; foreach ($searchlist as $s) { if ($treffer == FALSE) { if (preg_match('%.*' . $q . '.*%', strtolower($memo_array[0][$s]))) { $treffer = TRUE; if (!in_array($memos->id, $this->ret['ret'])) { $this->ret['ret'][] = $memos->id; $this->ret['count']++; } } } } } } $this->content = json_encode($this->ret); $this->useview = $this->setlayout = FALSE; }
public function testAddtag() { $do = DB_DataObject::factory('tagged'); $this->assertFalse($do->addTag($this->tag), 'a tag cannot be added to a record that dont have an ID'); $do->title = 'test title'; $do->insert(); $this->assertTrue($do->addTag($this->tag)); $t = DB_DataObject::factory('tag_record'); $t->record_id = $do->id; $t->tag_id = $this->tag->id; $t->tagged_table = 'tagged'; $this->assertTrue($t->find()); // Adding a tag a second time returns true although.... $this->assertTrue($do->addTag($this->tag)); // ... It's not recorded twice in the relationship table $t = DB_DataObject::factory('tag_record'); $t->record_id = $do->id; $t->tag_id = $this->tag->id; $t->tagged_table = 'tagged'; $t->find(true); $this->assertFalse($t->fetch(), 'A tag can be added only once to a record'); // Testing on another table to see if table name is saved successfully $do2 = DB_DataObject::factory('tagged2'); $do2->title = 'test title'; $do2->insert(); $this->assertTrue($do2->addTag($this->tag)); $t = DB_DataObject::factory('tag_record'); $t->record_id = $do2->id; $t->tag_id = $this->tag->id; $t->tagged_table = 'tagged2'; $this->assertTrue($t->find()); }
public function doExecSetasmain() { $p = DB_DataObject::factory('photo'); $p->get_or_die($_GET['record']); $p->setAsMain(); return $this->setOuput('ok'); }
function recover($code) { if (!$this->getAuthUser()) { $this->jerr("invalid"); } // fixme!!!! $fn = $this->rootDir . '/Pman/' . $code . '.js'; list($app, $mod) = explode('/', $code); if (!file_exists($fn)) { $this->jerr("file does not exist.:" . $fn); } $data = file_get_contents($fn); preg_match("#/*\n--SOURCE--\n([^\\*]+)#m", $data, $matches); // echo "<PRE>";print_R($matches); $base = $matches[1]; $str = bzdecompress(base64_decode($base)); $js = json_decode($str); //echo "<PRE>";print_R($str); $b = DB_DataObject::factory('builder'); $b->app = $app; $b->module = $mod; $b->btype = 'FORM'; $b->name = $js->name; if (!$b->find(true)) { $b->insert(); } echo "<PRE>" . htmlspecialchars(print_r($b, true)); $b->json = $str; $b->update(); $this->jok("DONE"); exit; }
function execute(&$controller, &$request, &$user) { $account = $request->getParameter('account'); $feed = DB_DataObject::factory('feed'); $feeds = $feed->getListsByAccount($account); $request->setAttribute('mycontents', $feeds); return VIEW_SUCCESS; }
protected function _newImage(DB_DataObject $obj) { $defs = $obj->_getPluginsDef(); $tbl = DB_DataObject::factory($defs['otfimagereceiver']['table']); $tbl->record_table = $obj->tableName(); $tbl->record_id = $obj->pk(); return $tbl; }
function get($id) { $ev = DB_DataObject::Factory('Events'); if (!$ev->get((int) $id)) { $this->jerr("invalid id"); } // verify if not admin, then they should $g = DB_DataObject::Factory('core_group_member'); if (is_a($g, 'DB_DataObject')) { $grps = $g->listGroupMembership($this->authUser); //var_dump($grps); $isAdmin = $g->inAdmin; if (!$isAdmin && $ev->person_id != $this->authUser->id) { $this->jerrAuth(); } } echo '<PRE>' . htmlspecialchars(print_r($ev->toArray(), true)) . "</PRE>"; // we have 2 bits of data available at present: // core_event_audit // the event file.. $d = DB_DataObject::factory('core_event_audit'); if (is_a($d, 'DB_DataObject')) { echo "<H2>Changed Data:</H2>"; $d->event_id = $ev->id; foreach ($d->fetchAll() as $d) { echo "{$d->name} SET TO: " . htmlspecialchars($d->newvalue) . "<br/>\n"; } } echo "<HR><H2>Posted Data:</H2>"; $logdir = DB_DAtaObject::Factory('Events')->logDir(); if (!$logdir) { echo "not available (Pman[storedir] not configured)"; exit; } $file = $logdir . date('/Y/m/d/', strtotime($ev->event_when)) . $ev->id . ".php"; if (file_exists($file)) { echo '<PRE>' . htmlspecialchars(file_get_contents($file)) . '</PRE>'; } $file = $logdir . date('/Y/m/d/', strtotime($ev->event_when)) . $ev->id . ".json"; if (!file_exists($file)) { echo "not available (missing file) {$file}"; exit; } echo '<PRE>' . htmlspecialchars(print_r(json_decode(file_get_contents($file)), true)) . '</PRE>'; echo '<BR/><PRE>' . htmlspecialchars($ev->remarks) . '</PRE>'; $json = json_decode($ev->remarks, JSON_PRETTY_PRINT); if (json_last_error() == JSON_ERROR_NONE) { echo "<HR><H2>JSON DECODE Data:</H2>"; echo '<PRE>' . print_r($json, true) . '</PRE>'; } $filesJ = json_decode(file_get_contents($file)); echo '<br /><PRE>Download files</PRE>'; foreach ($filesJ->FILES as $k => $f) { $ip = $ff->baseURL . "/Images/events/" . $ev->id . '/' . $f->tmp_name; echo '<a href="' . $ip . '/download">' . htmlspecialchars($k . ' - ' . $f->name) . '</a><br/>'; } exit; }
function sendVerification($template, $roo) { $content = array('template' => $template, 'person' => $this, 'serverName' => $_SERVER['SERVER_NAME'], 'baseURL' => $roo->baseURL); $sent = DB_DataObject::factory('core_email')->send($content); if (!is_object($sent)) { return true; } return $sent; }
function etype() { $this->etype = DB_DataObject::factory('core_enum'); $this->etype->setFrom(array('etype' => '', 'name' => 'Core.NotifyType', 'display_name' => 'Core.NotifyType', 'active' => 1)); if ($this->etype->find(true)) { return; } $this->etype->insert(); }
function execute(&$controller, &$request, &$user) { $site = DB_DataObject::factory('site'); $request->setAttribute('sites', $site->getNewSite(5)); $member_num = MemberUtils::total(); $request->setAttribute('member_num', $member_num); $request->setAttribute('yesterday', time() - 60 * 60 * 24); return VIEW_SUCCESS; }
function render() { $template =& new JxTemplate(JX_BASE_PATH . '/modules/system/tpl'); $templateFile = 'JxAdminPlugins.tpl'; if (isset($_GET['pluginName']) && isset($_GET['enable'])) { $sql = "UPDATE plugins\n SET available = " . $_GET['enable'] . "\n WHERE name='" . $_GET['pluginName'] . "'"; $result = $this->db->query($sql); if (DB::isError($result)) { echo $result->getMessage(); } } $pluginDirs = array(JX_CORE_PATH, JX_HOSTED_PATH); foreach ($pluginDirs as $path) { $dir = dir($path . '/modules'); while (false !== ($entry = $dir->read())) { if (!in_array($entry, array('.', '..')) && is_dir($path . '/modules/' . $entry)) { $plugins = $path . '/modules/' . $entry . '/plugins'; if (file_exists($plugins) && is_dir($plugins)) { $pdir = dir($plugins); while (false !== ($pentry = $pdir->read())) { if (!in_array($pentry, array('.', '..')) && eregi('^[a-z]', $pentry) && is_file($plugins . '/' . $pentry)) { list($pluginName, ) = explode('.', $pentry); if (!class_exists($pluginName)) { include_once $plugins . '/' . $pentry; } $sql = "SELECT COUNT(*) AS total\n FROM plugins\n WHERE name='{$pluginName}'"; $total = $this->db->getOne($sql); if (!DB::isError($total) && $total == 0) { $class =& new $pluginName(); $sql = "INSERT INTO plugins\n SET name='{$pluginName}', \n available=0,\n module='{$entry}',\n title='" . $class->title . "'"; $insert = $this->db->query($sql); if (DB::isError($insert)) { echo $insert->getMessage() . '<br />'; } } elseif (DB::isError($total)) { echo $total->getMessage() . '<br />'; } } } $pdir->close(); } } } $dir->close(); } $plugins = array(); $plugin =& DB_DataObject::factory('plugins'); if (!PEAR::isError($plugin)) { if ($plugin->find()) { while ($plugin->fetch()) { $plugins[] = $plugin->toArray(); } } } $template->assign('plugins', $plugins); return $template->fetch($templateFile); }