public function view() { $id = intval($_REQUEST['id']); $condition['id'] = $id; $vo = M(MODULE_NAME)->where($condition)->find(); $vo = load_msg($vo['type'], $vo); $this->assign('vo', $vo); $this->display(); }
public function index() { global_run(); init_app_page(); $GLOBALS['tmpl']->assign("no_nav", true); //无分类下拉 if (check_save_login() != LOGIN_STATUS_LOGINED) { app_redirect(url("index", "user#login")); } $GLOBALS['tmpl']->assign("page_title", "我的消息"); $user_info = $GLOBALS['user_info']; require_once APP_ROOT_PATH . "app/Lib/page.php"; $page_size = app_conf("PAGE_SIZE"); $page = intval($_REQUEST['p']); if ($page == 0) { $page = 1; } $limit = ($page - 1) * $page_size . "," . $page_size; $sql = "select * from " . DB_PREFIX . "msg_box where user_id = " . $GLOBALS['user_info']['id'] . " and is_delete = 0 order by create_time desc limit " . $limit; $sql_count = "select count(*) from " . DB_PREFIX . "msg_box where user_id = " . $GLOBALS['user_info']['id'] . " and is_delete = 0 "; $list = $GLOBALS['db']->getAll($sql); $ids[] = 0; foreach ($list as $k => $v) { $list[$k] = load_msg($v['type'], $v); $list[$k]['create_time'] = to_date($v['create_time']); $ids[] = $v['id']; } $count = $GLOBALS['db']->getOne($sql_count); $page = new Page($count, $page_size); //初始化分页对象 $p = $page->show(); $GLOBALS['tmpl']->assign('pages', $p); $GLOBALS['tmpl']->assign("list", $list); $ids_str = implode(",", $ids); $GLOBALS['db']->query("update " . DB_PREFIX . "msg_box set is_read = 1 where user_id = " . $GLOBALS['user_info']['id'] . " and id in (" . $ids_str . ")"); require_once APP_ROOT_PATH . "system/model/user.php"; load_user($GLOBALS['user_info']['id'], true); assign_uc_nav_list(); $GLOBALS['tmpl']->assign("user_info", $user_info); $GLOBALS['tmpl']->display("uc/uc_msg.html"); }
function text_save_state($args) { $elem = $args['elem']; $obj = $args['obj']; if (array_shift(elem_classes($elem)) != 'text') { return false; } // make sure the type is set $obj['type'] = 'text'; $obj['module'] = 'text'; // hook invoke_hook('alter_save', array('obj' => &$obj, 'elem' => $elem)); load_modules('glue'); $ret = save_object($obj); if ($ret['#error']) { load_msg('error', 'text_save_state: save_object returned ' . quot($ret['#data'])); return false; } else { return true; } }