Example #1
0
 function copyselectedurl($config = array())
 {
     need_login('ajax_page');
     global $base_root;
     $ids = $this->getPost('sel_id');
     if (!$ids || count($ids) == 0) {
         ajax_box(lang('copyimg:pls_sel_photo_want_to_copy'));
     } else {
         $site_url = $this->setting->get_conf('site.url');
         $mdl_photo =& loader::model('photo');
         $ids = array_keys($ids);
         $html = '';
         $urls = '';
         $ubb = '';
         foreach ($ids as $id) {
             $pic = $mdl_photo->get_info($id);
             $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');
     }
 }
Example #2
0
 function render($type = 'normal')
 {
     if ($type == 'normal') {
         $tpl = IN_CTL . '/' . IN_ACT;
     } else {
         $tpl = IN_CTL . '/' . IN_ACT . '_' . $type;
     }
     loader::view($tpl);
 }
Example #3
0
 function diy()
 {
     $id = $this->getGet('id');
     $path = ROOTDIR . TPLDIR . DIRECTORY_SEPARATOR . $id . '.htm';
     if ($id && preg_match('/^[0-9a-z_\\-\\.]+$/i', $id) && file_exists($path)) {
         $this->output->set('page_crumb', '');
         $page_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);
         loader::view($id);
     } else {
         header("HTTP/1.1 404 Not Found");
         showError(lang('404_not_found'));
     }
 }
Example #4
0
 function save_reply()
 {
     if (!$this->setting->get_conf('system.enable_comment')) {
         form_ajax_failed('text', lang('album_comment_closed'));
     }
     $comment['email'] = safe_convert($this->getPost('email'));
     $comment['author'] = safe_convert($this->getPost('author'));
     $comment['content'] = safe_convert($this->getPost('content'));
     $comment['ref_id'] = intval($this->getPost('ref_id'));
     $comment['type'] = intval($this->getPost('type'));
     $comment['reply_author'] = safe_convert($this->getPost('reply_author'));
     $comment['pid'] = intval($this->getPost('pid'));
     $this->plugin->trigger('before_post_comment');
     if ($this->setting->get_conf('system.enable_comment_captcha') && !$this->user->loggedin()) {
         $captcha =& loader::lib('captcha');
         if (!$captcha->check($this->getPost('captcha'))) {
             form_ajax_failed('text', lang('invalid_captcha_code'));
         }
     }
     if ($comment['email'] && !check_email($comment['email'])) {
         form_ajax_failed('text', lang('error_email'));
     }
     if (!$comment['author']) {
         form_ajax_failed('text', lang('error_comment_author'));
     }
     if (!$comment['content']) {
         form_ajax_failed('text', lang('empty_content'));
     }
     if (!$comment['ref_id'] || !$comment['type'] || !$comment['pid'] || !$comment['reply_author']) {
         form_ajax_failed('text', lang('miss_argument'));
     }
     $comment['post_time'] = time();
     $comment['author_ip'] = get_real_ip();
     if ($this->setting->get_conf('system.comment_audit') == 1 && !$this->user->loggedin()) {
         $comment['status'] = 0;
     } else {
         $comment['status'] = 1;
     }
     if ($reply_id = $this->mdl_comment->save($comment)) {
         $comment['id'] = $reply_id;
         $this->output->set('info', $comment);
         $this->plugin->trigger('reply_comment', $reply_id);
         form_ajax_success('text', loader::view('comments/view', false));
     } else {
         form_ajax_failed('text', lang('reply_failed'));
     }
 }
Example #5
0
File: ui.php Project: vluo/myPoto
function get_page_setting($type)
{
    $arr = array(12, 30, 56);
    $setting_mdl =& loader::model('setting');
    if ($type == 'album') {
        $default = $setting_mdl->get_conf('display.album_pageset', 12);
    } else {
        $default = $setting_mdl->get_conf('display.photo_pageset', 12);
    }
    $current = isset($_COOKIE['Mpic_pageset_' . $type]) ? $_COOKIE['Mpic_pageset_' . $type] : $default;
    $output =& loader::lib('output');
    $output->set('pageset_menu', $arr);
    $output->set('pageset_menu_current', $current);
    $output->set('pageset_menu_type', $type);
    $str = loader::view('block/pageset_menu', false);
    return array($current, $str);
}
Example #6
0
 function _priv_page($id, $album_info = null)
 {
     if (is_null($album_info)) {
         $album_info = $this->mdl_album->get_info($id);
     }
     $this->output->set('album_info', $album_info);
     $ajax = $this->getGet('ajax');
     if ($ajax == 'true') {
         $this->output->set('ajax', true);
         if ($this->mdl_album->check_album_priv($id, $album_info)) {
             ajax_box(lang('has_validate'), null, 0.5, site_link('photos', 'index', array('aid' => $id)));
         }
     } else {
         $this->output->set('ajax', false);
         $page_title = lang('title_need_validate') . ' - ' . lang('system_notice') . ' - ' . $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, $id);
     }
     loader::view('photos/priv_page');
 }
Example #7
0
 function save()
 {
     @set_time_limit(0);
     @ignore_user_abort(true);
     $type = $this->getGet('t');
     $album_id = intval($this->getRequest('aid'));
     if (!$album_id) {
         showError(lang('pls_sel_album'));
     }
     if ($type == 'multi') {
         need_login('ajax');
         /*$files_count = intval($this->getPost('muilti_uploader_count'));
           for($i=0;$i<$files_count;$i++){
               $filename = $this->getPost("muilti_uploader_{$i}_tmpname");
               $realname = $this->getPost("muilti_uploader_{$i}_name");
               $purename = file_pure_name($filename);
               $purerealname = file_pure_name($realname);
               $photorow = $this->mdl_photo->get_photo_by_name_aid($album_id,$purename);
               if($photorow){
                   $this->mdl_photo->update($photorow['id'],array('name'=>$purerealname));
               }
           }
           */
         $this->mdl_album->update_photos_num($album_id);
         $this->mdl_album->check_repare_cover($album_id);
         $gourl = site_link('photos', 'index', array('aid' => $album_id));
         form_ajax_success('box', lang('upload_photo_success'), null, 1, $gourl);
     } else {
         need_login('page');
         $this->output->set('album_id', $album_id);
         $album_info = $this->mdl_album->get_info($album_id);
         $this->output->set('album_info', $album_info);
         $page_title = lang('upload_photo') . ' - ' . $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);
         $imglib =& loader::lib('image');
         $supportType = $imglib->supportType();
         $empty_num = 0;
         $error = '';
         $allowsize = allowsize($this->setting->get_conf('upload.allow_size'));
         if (isset($_FILES['imgs'])) {
             foreach ($_FILES['imgs']['name'] as $k => $upfile) {
                 if (!empty($upfile)) {
                     $filesize = $_FILES['imgs']['size'][$k];
                     $tmpfile = $_FILES['imgs']['tmp_name'][$k];
                     $filename = $upfile;
                     $fileext = file_ext($filename);
                     if ($_FILES['imgs']['error'][$k] == 1) {
                         $error .= lang('failed_larger_than_server', $filename) . '<br />';
                         continue;
                     }
                     if ($allowsize && $filesize > $allowsize) {
                         $error .= lang('failed_larger_than_usetting', $filename) . '<br />';
                         continue;
                     }
                     if ($filesize == 0) {
                         $error .= lang('failed_if_file', $filename) . '<br />';
                         continue;
                     }
                     if (!in_array($fileext, $supportType)) {
                         $error .= lang('failed_not_support', $filename) . '<br />';
                         continue;
                     }
                     if (!$this->mdl_photo->save_upload($album_id, $tmpfile, $filename, true, array('cate_id' => $album_info['cate_id']))) {
                         $error .= lang('file_upload_failed', $filename) . '<br />';
                     }
                 } else {
                     $empty_num++;
                 }
             }
         } else {
             $error = lang('need_sel_upload_file');
         }
         if (isset($_FILES['imgs']) && $empty_num == count($_FILES['imgs']['name'])) {
             $this->output->set('msginfo', '<div class="failed">' . lang('need_sel_upload_file') . '</div>');
         } else {
             $this->mdl_album->update_photos_num($album_id);
             $this->mdl_album->check_repare_cover($album_id);
             if ($error) {
                 $this->output->set('msginfo', '<div class="failed">' . $error . '</div>');
             } else {
                 $this->output->set('msginfo', '<div class="success">' . lang('upload_photo_success') . '<a href="' . site_link('photos', 'index', array('aid' => $album_id)) . '">' . lang('view_album') . '</a></div>');
             }
         }
         $crumb_nav = array();
         $crumb_nav[] = array('name' => lang('upload_photo'));
         $this->page_crumb($crumb_nav);
         loader::view('upload/normal');
     }
 }