function index() { $page = intval($this->getGet('page', '1')); //search $search['name'] = safe_convert($this->getRequest('sname')); $search['tag'] = safe_convert($this->getRequest('tag')); $search['cate_id'] = $this->getGet('cate'); //这里不能加上intval $par['page'] = '[#page#]'; if ($search['name']) { $par['sname'] = $search['name']; } if ($search['tag']) { $par['tag'] = $search['tag']; } if ($search['cate_id'] != '') { $par['cate'] = $search['cate_id']; } $pageurl = site_link('albums', 'index', $par); //如果是搜索表单提交,则进行页面跳转 if ($this->isPost()) { $redirect_url = site_link('albums', 'index', array('page' => $page) + $par); redirect($redirect_url); } if ($search['name'] || $search['tag']) { $this->output->set('is_search', true); } else { $this->output->set('is_search', false); } //get page setting list($pageset, $page_setting_str) = get_page_setting('album'); //get sort setting $sort_setting = array(lang('create_time') => 'ct', lang('upload_time') => 'ut', lang('photo_nums') => 'p'); list($sort, $sort_list) = get_sort_list($sort_setting, 'album', 'ct_desc'); $this->mdl_album->set_pageset($pageset); $albums = $this->mdl_album->get_all($page, $search, $sort); $g_enable_comment = $this->setting->get_conf('system.enable_comment'); if (is_array($albums['ls'])) { $mdl_photo =& loader::model('photo'); foreach ($albums['ls'] as $k => $v) { $albums['ls'][$k]['album_control_icons'] = $this->plugin->filter('album_control_icons', '', $v['id']); if ($v['cover_id']) { $cover_info = $mdl_photo->get_info($v['cover_id'], 'thumb'); if ($cover_info) { $albums['ls'][$k]['cover_path'] = $cover_info['thumb']; } else { $albums['ls'][$k]['cover_id'] = 0; } } //是否允许评论 if ($g_enable_comment && $v['enable_comment'] == 1) { $albums['ls'][$k]['enable_comment'] = 1; } else { $albums['ls'][$k]['enable_comment'] = 0; } } } $this->output->set('album_col_menu', $this->plugin->filter('album_col_menu', $page_setting_str . $sort_list)); $this->output->set('album_multi_opt', $this->plugin->filter('album_multi_opt', '')); $this->output->set('albums', $albums['ls']); $page_obj =& loader::lib('page'); $this->output->set('pagestr', $page_obj->fetch($albums['total'], $albums['current'], $pageurl)); $this->output->set('total_num', $albums['count']); $this->output->set('search', arr_stripslashes($search)); $this->output->set('show_uptime', $sort == 'ut_desc' || $sort == 'ut_asc' ? true : false); $this->output->set('album_sidebar', $this->plugin->filter('album_sidebar', '')); $title = ''; //面包屑 $crumb_nav = array(array('name' => lang('album_list'), 'link' => site_link('albums'))); if ($search['cate_id'] != '') { $cate_nav = $this->mdl_cate->cate_path_link($search['cate_id']); if ($cate_nav) { $crumb_nav = $cate_nav; foreach ($cate_nav as $b) { $title = $b['name'] . ' < ' . $title; } } } else { $title = '全部相册 - '; } if ($search['name']) { $crumb_nav[] = array('name' => lang('search_s', $search['name'])); } elseif ($search['tag']) { $crumb_nav[] = array('name' => lang('search_tag', $search['tag'])); } $this->page_crumb($crumb_nav); //显示分类 $categorylist = $this->mdl_cate->get_categorys_width_cache(); $this->output->set('categorylist', $categorylist); //page head $page_title = $title . $this->setting->get_conf('site.title'); $page_keywords = $this->setting->get_conf('site.keywords'); $page_description = $this->setting->get_conf('site.description'); $this->page_init($page_title, $page_keywords, $page_description); $this->render(); }
function plugin_save_config() { need_login('ajax'); $plugin = $this->getGet('plugin'); $plugin_obj = $this->plugin->get_plugin_obj($plugin); $config = $this->getPosts(); $config = arr_stripslashes($config); $plugin_obj && $plugin_obj->save_config($config); if ($this->plugin->save_config($plugin, $config)) { form_ajax_success('box', lang('save_setting_success'), null, 0.5, $_SERVER['HTTP_REFERER']); } else { form_ajax_success('text', lang('save_setting_failed'), null, 0.5, $_SERVER['HTTP_REFERER']); } }