<?php defined('IN_DESTOON') or exit('Access Denied'); require MD_ROOT . '/favorite.class.php'; $do = new favorite(); $menus = array(array('收藏列表', '?moduleid=' . $moduleid . '&file=' . $file)); switch ($action) { case 'edit': $itemid or msg(); $do->itemid = $itemid; if ($submit) { if ($do->pass($post)) { $do->edit($post); dmsg('修改成功', $forward); } else { msg($do->errmsg); } } else { extract($do->get_one()); include tpl('favorite_edit', $module); } break; case 'delete': $itemid or msg('请选择收藏'); $do->delete($itemid); dmsg('删除成功', $forward); break; default: $sfields = array('按条件', '标题', 'URL'); $dfields = array('title', 'title', 'url'); isset($fields) && isset($dfields[$fields]) or $fields = 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 favorite $value A favorite object. * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally). */ public static function addInstanceToPool(favorite $obj, $key = null) { if (Propel::isInstancePoolingEnabled()) { if ($key === null) { $key = (string) $obj->getId(); } if (isset(self::$instances[$key]) || count(self::$instances) < kConf::get('max_num_instances_in_pool')) { self::$instances[$key] = $obj; kMemoryManager::registerPeer('favoritePeer'); } } }
/** * 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 favorite $value A favorite object. * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally). */ public static function addInstanceToPool(favorite $obj, $key = null) { if (Propel::isInstancePoolingEnabled()) { if ($key === null) { $key = (string) $obj->getId(); } // if key === null self::$instances[$key] = $obj; } }
<?php defined('IN_DESTOON') or exit('Access Denied'); login(); require DT_ROOT . '/module/' . $module . '/common.inc.php'; $MG['favorite_limit'] > -1 or dalert(lang('message->without_permission_and_upgrade'), 'goback'); require DT_ROOT . '/include/post.func.php'; $TYPE = get_type('favorite-' . $_userid); require MD_ROOT . '/favorite.class.php'; $do = new favorite(); switch ($action) { case 'add': if ($MG['favorite_limit']) { $r = $db->get_one("SELECT COUNT(*) AS num FROM {$DT_PRE}favorite WHERE userid={$_userid}"); if ($r['num'] >= $MG['favorite_limit']) { dalert(lang($L['limit_add'], array($MG['favorite_limit'], $r['num'])), 'goback'); } } if ($submit) { if ($do->pass($post)) { $post['userid'] = $_userid; $post['addtime'] = $DT_TIME; $do->add($post); dmsg($L['op_add_success'], '?action=index'); } else { message($do->errmsg); } } else { $title = isset($title) ? trim($title) : ''; $url = isset($url) ? trim($url) : ''; $typeid = 0;