Exemplo n.º 1
0
 function copyallurl($config = array())
 {
     need_login('ajax_page');
     global $base_root;
     $site_url = $this->setting->get_conf('site.url');
     $album_id = $this->getGet('aid');
     list($sort, $sort_list) = get_sort_list(array(), 'photo', 'tu_desc');
     $photo_mdl =& loader::model('photo');
     $pictures = $photo_mdl->get_all(NULL, array('album_id' => $album_id), $sort);
     $html = '';
     $urls = '';
     $ubb = '';
     if ($pictures) {
         foreach ($pictures as $pic) {
             $img_path = img_path($pic['path']);
             $html_code = $config['tpl'];
             $html_code = str_replace('{thumbpath}', img_path($pic['thumb']), $html_code);
             $html_code = str_replace('{imgpath}', $img_path, $html_code);
             $html_code = str_replace('{imgname}', $pic['name'], $html_code);
             $html_code = str_replace('{detailurl}', $base_root . site_link('photos', 'view', array('id' => $pic['id'])), $html_code);
             $html .= $html_code . $config['split'];
             $urls .= $img_path . "\r\n";
             $ubb .= '[IMG]' . $img_path . "[/IMG]\r\n";
         }
     }
     $this->output->set('img_url', $urls);
     $this->output->set('img_html', $html);
     $this->output->set('img_ubb', $ubb);
     loader::view('copyimg:copyurlall');
 }
Exemplo n.º 2
0
 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();
 }
Exemplo n.º 3
0
 function nav()
 {
     $rank = intval($this->getPost('rank'));
     $album_id = $this->getPost('album_id');
     $sort_setting = $this->_sort_setting();
     list($sort, $sort_list) = get_sort_list($sort_setting, 'photo', 'tu_desc');
     $items = $this->mdl_photo->get_items(array('album_id' => $album_id), $sort);
     $current_item = $items[$rank];
     $current_rank = $rank;
     $data = $this->mdl_photo->get_info($current_item);
     $data = array('id' => $data['id'], 'name' => $data['name'], 'thumb' => img_path($data['thumb']), 'url' => site_link('photos', 'view', array('id' => $data['id'])), 'style' => detect_thumb($data['width'], $data['height'], 58));
     $json =& loader::lib('json');
     echo $json->encode($data);
     exit;
 }