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'); } }
function album_control_icons($str, $album_id) { if ($this->loggedin) { return $str . '<li><a href="javascript:void(0);" onclick="Mui.box.show(\'' . site_link('utils', 'copyallurl', array('aid' => $album_id)) . '\',true);" title="' . lang('copyimg:copy_all_to_clipboard') . '"><span class="i_copyclip sprite"></span></a></li>'; } else { return $str; } }
function page_crumb($nav) { $crumb_nav[] = array('name' => lang('album_index'), 'link' => site_link('default', 'index')); $crumb_nav = array_merge($crumb_nav, $nav); $this->output->set('crumb_nav', $crumb_nav); $crumb = loader::view('block/crumb', false); $this->output->set('page_crumb', $crumb); }
function index() { $index_tpl = ROOTDIR . TPLDIR . DIRECTORY_SEPARATOR . 'index.htm'; if (file_exists($index_tpl)) { $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('index'); } else { $url = site_link('albums'); redirect($url); } }
function index() { need_login('page'); $type = intval($this->getGet('type', '1')); $page = intval($this->getGet('page', 1)); $deleted_albums = $this->mdl_album->get_trash_count(); $deleted_photos = $this->mdl_photo->get_trash_count(); if ($deleted_albums <= 0 && $deleted_photos <= 0) { trash_status(2); $this->output->set('isempty', true); } else { if ($type == 1) { $data = $this->mdl_album->get_trash($page); if (is_array($data['ls'])) { foreach ($data['ls'] as $k => $v) { if ($v['cover_id']) { $cover_info = $this->mdl_photo->get_info($v['cover_id'], 'thumb'); if ($cover_info) { $data['ls'][$k]['cover_path'] = $cover_info['thumb']; } else { $data['ls'][$k]['cover_id'] = 0; } } } } } elseif ($type == 2) { $data = $this->mdl_photo->get_trash($page); } $pageurl = site_link('trash', 'index', array('type' => $type, 'page' => '[#page#]')); $page_obj =& loader::lib('page'); $pagestr = $page_obj->fetch($data['total'], $data['current'], $pageurl); $this->output->set('isempty', false); $this->output->set('pagestr', $pagestr); $this->output->set('data', $data['ls']); $this->output->set('deleted_albums', $deleted_albums); $this->output->set('deleted_photos', $deleted_photos); $this->output->set('type', $type); } //面包屑 $crumb_nav = array(); $crumb_nav[] = array('name' => lang('recycle')); $this->page_crumb($crumb_nav); $page_title = lang('recycle') . ' - ' . $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 profile() { if (!$this->user->loggedin()) { redirect(site_link('users', 'login')); } $mdl_theme =& loader::model('theme'); $themes = $mdl_theme->all_themes(); $this->output->set('themes', $themes); //面包屑 $crumb_nav = array(); $crumb_nav[] = array('name' => lang('modify_profile')); $this->page_crumb($crumb_nav); $page_title = lang('modify_profile') . ' - ' . $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 index() { global $base_path; $album_id = intval($this->getGet('aid')); $search = array(); $siteurl = $this->setting->get_conf('site.url'); $sitename = $this->setting->get_conf('site.title'); $description = $this->setting->get_conf('site.description'); $sitedomain = substr($siteurl, 0, -1 * strlen($base_path)); $feed =& loader::lib('rss'); if ($album_id) { $search['album_id'] = $album_id; $album_info = $this->mdl_album->get_info($album_id); $feed->title = $album_info['name'] . ' - ' . $sitename; } else { $feed->title = $sitename; } $feed->link = $siteurl; $feed->description = $description; $this->mdl_photo->set_pageset(50); $data = $this->mdl_photo->get_all(1, $search, 'tu_desc'); if ($data['ls']) { foreach ($data['ls'] as $v) { $item = new RSSItem(); $item->title = "<![CDATA[ " . $v['name'] . " ]]>"; $item->link = $sitedomain . site_link('photos', 'view', array('id' => $v['id'])); $item->set_pubdate($v['create_time']); if (!$this->mdl_album->check_album_priv($album_id, isset($album_info) ? $album_info : null)) { $img = lang('photo_has_priv') . '<br />'; } else { $img = '<img src="' . $siteurl . $v['path'] . '" /><br />'; } $item->description = "<![CDATA[ " . $img . $v['desc'] . " ]]>"; $feed->add_item($item); } } $feed->serve(); }
function index() { $page = intval($this->getGet('page', 1)); $type = $this->getGet('type'); $this->mdl_tag->set_pageset(40); $par = array(); if (in_array($type, array(1, 2))) { $par['type'] = $type; } $tags = $this->mdl_tag->get_all($page, $par); $par['page'] = '[#page#]'; if ($tags['ls']) { foreach ($tags['ls'] as $k => $v) { $tags['ls'][$k]['fontsize'] = $this->mdl_tag->get_fontsize($v['count']); } } $page_obj =& loader::lib('page'); $pageurl = site_link('tags', 'index', $par); $pagestr = $page_obj->fetch($tags['total'], $tags['current'], $pageurl); $this->output->set('pagestr', $pagestr); $this->output->set('tag_list', $tags['ls']); $this->output->set('tag_type', $type); //面包屑 $crumb_nav = array(); $crumb_nav[] = array('name' => lang('tag_list'), 'link' => site_link('tags')); if ($type == 1) { $crumb_nav[] = array('name' => lang('album')); } elseif ($type == 2) { $crumb_nav[] = array('name' => lang('photo')); } $this->page_crumb($crumb_nav); $page_title = lang('tag_list') . ' - ' . $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 update() { need_login('ajax'); $id = intval($this->getGet('id')); $data['par_id'] = $this->getPost('par_id') > 0 ? $this->getPost('par_id') : 0; $data['name'] = $this->getPost('cate_name'); $data['sort'] = intval($this->getPost('sort')); if ($this->mdl_cate->update(intval($id), $data)) { if ($this->getPost('add_nav')) { $nav_data['type'] = 1; $nav_data['name'] = $data['name']; $nav_data['url'] = site_link('albums', 'index', array('cate' => $id)); $nav_data['sort'] = 100; $nav_data['enable'] = 1; $mdl_nav =& loader::model('nav'); $mdl_nav->save($nav_data); //清除菜单缓存 $mdl_nav->clear_nav_cache(); } form_ajax_success('box', lang('edit_category_succ'), null, 0.5, $_SERVER['HTTP_REFERER']); } else { form_ajax_failed('text', lang('edit_category_fail')); } }
function modify() { need_login('ajax_page'); $id = intval($this->getGet('id')); $info = $this->mdl_album->get_info($id); $info['desc'] = safe_invert($info['desc']); $this->output->set('system_enable_comment', $this->setting->get_conf('system.enable_comment')); $this->output->set('info', $info); $cate_mdl =& loader::model('category'); $cate_list = $cate_mdl->get_categorys_width_cache(); $this->output->set('cate_list', $cate_list); $this->output->set('fromurl', base64_encode(site_link('albums', 'modify', array('id' => $id)))); $this->render(); }
function manage() { need_login('page'); //系统设置菜单 $setting_menu = $this->plugin->filter('setting_menu', ''); $this->output->set('setting_menu', $setting_menu); $page = intval($this->getGet('page', 1)); $status = $this->getGet('status', 'all'); $status_nums = $this->mdl_comment->count_group_status(); $pageurl = site_link('comments', 'manage', array('page' => '[#page#]', 'status' => $status)); $this->mdl_comment->set_pageset(20); $data = $this->mdl_comment->get_all($page, array('status' => $status)); if ($data['ls']) { foreach ($data['ls'] as $k => $v) { if ($v['type'] == 1) { $data['ls'][$k]['subject'] = $this->mdl_album->get_info($v['ref_id']); } else { $data['ls'][$k]['subject'] = $this->mdl_photo->get_info($v['ref_id']); } } } $page_obj =& loader::lib('page'); $this->output->set('pagestr', $page_obj->fetch($data['total'], $data['current'], $pageurl)); $this->output->set('comments', $data['ls']); $this->output->set('status', $status); $this->output->set('status_nums', $status_nums); //面包屑 $crumb_nav = array(); $crumb_nav[] = array('name' => lang('system_setting'), 'link' => site_link('setting')); $crumb_nav[] = array('name' => lang('comments_manage')); $this->page_crumb($crumb_nav); $page_title = lang('comments_manage') . ' - ' . lang('system_setting') . ' - ' . $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 nav() { need_login('page'); $mdl_nav =& Loader::model('nav'); $nav_list = $mdl_nav->get_all(); $this->output->set('nav_list', $nav_list); //面包屑 $crumb_nav = array(); $crumb_nav[] = array('name' => lang('system_setting'), 'link' => site_link('setting')); $crumb_nav[] = array('name' => lang('setting_nav')); $this->page_crumb($crumb_nav); $page_title = lang('setting_nav') . ' - ' . lang('system_setting') . ' - ' . $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 core() { need_login('page'); @set_time_limit(0); @ignore_user_abort(true); $newversion = $this->getRequest('version'); $software = 'meiupic'; $version = MPIC_VERSION; if ($newversion == $version) { exit(lang('no_need_to_update')); } if (!$newversion) { exit(lang('version_can_not_be_empty')); } //检查目录是否可以读写 $directory = @dir(ROOTDIR); while ($entry = $directory->read()) { if ($entry == '..' || $entry == '.') { continue; } $filename = ROOTDIR . $entry; if (is_dir($filename) && !dir_writeable($filename)) { exit(lang('dir_not_writable', $filename)); } elseif (is_file($filename) && !is_writable($filename)) { exit(lang('file_not_writable', $filename)); } } $directory->close(); $langset = LANGSET; $time = time(); $hash = md5("{$newversion}{$software}{$version}{$langset}{$time}"); $q = base64_encode("newversion={$newversion}&software={$software}&version={$version}&langset={$langset}&time={$time}&hash={$hash}"); $url = CHECK_UPDATE_URL . '?act=update&q=' . $q; $response = get_remote($url, 2); if (!$response) { exit(lang('connect_to_server_failed')); } $json =& loader::lib('json'); $result = $json->decode($response); if ($result['return']) { $tmpfile = ROOTDIR . 'cache/tmp/update.zip'; if (file_exists($tmpfile) && md5_file($tmpfile) == $result['md5']) { echo lang('file_has_been_downloaded') . '<br />'; } else { $content = get_remote($result['package']); file_put_contents($tmpfile, $content); $file_md5 = md5_file($tmpfile); if ($file_md5 != $result['md5']) { echo lang('download_package_failed') . '<br />'; exit; } echo lang('download_package_succ') . '<br />'; } $zip =& loader::lib('zip'); $zip->load_file($tmpfile); $zip->extract(PCLZIP_OPT_PATH, './', PCLZIP_OPT_REPLACE_NEWER); echo lang('unzip_package_succ') . '<br />'; echo lang('delete_tmp_download_file') . '<br />'; @unlink($tmpfile); echo lang('upgrade_after_jump') . '<br />'; redirect(site_link('default'), 1); } else { exit(lang('get_update_fail')); } }
function meta() { $id = intval($this->getGet('id')); $info = $this->mdl_photo->get_info($id); if (!$info) { showError(lang('photo_not_exists')); } if (!$info['exif']) { showError(lang('no_access_view_exif')); } if (!$this->mdl_album->check_album_priv($info['album_id'])) { $this->_priv_page($info['album_id']); exit; } $info['exif'] = unserialize($info['exif']); $exif_obj =& loader::lib('exif'); $exif = $exif_obj->parse_exif($info['exif']); $metas = array(); if ($exif) { foreach ($exif as $k => $v) { $metas[] = array('key' => $k, 'value' => $v, 'cname' => lang('exif_' . $k)); } } $this->output->set('metas', $metas); $this->output->set('info', $info); $album_info = $this->mdl_album->get_info($info['album_id']); //面包屑 $crumb_nav = $this->mdl_cate->cate_path_link($album_info['cate_id']); $crumb_nav[] = array('name' => $album_info['name'], 'link' => site_link('photos', 'index', array('aid' => $album_info['id']))); $crumb_nav[] = array('name' => lang('view_photo_exif', $info['name']), 'link' => site_link('photos', 'view', array('id' => $info['id']))); $this->page_crumb($crumb_nav); $page_title = lang('view_photo_exif', $info['name']) . ' - ' . $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, $info['album_id'], $id); $this->render(); }
function linkToSite() { return site_link(); }
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'); } }
if (version_compare($prev_version, '2.0', '>=') && version_compare($prev_version, '2.1', '<')) { $prev_version = '2.0'; } elseif (version_compare($prev_version, '2.1', '>=') && version_compare($prev_version, '2.2', '<')) { $prev_version = '2.1'; } } if (version_compare($current_version, $prev_version, '<')) { echo '<div class="msg fail">' . lang('could_not_degrade') . '</div>'; exit; } if ($prev_version == '' || version_compare($prev_version, '2.0', '<')) { echo '<div class="msg fail">' . lang('too_old_to_update') . '</div>'; exit; } $script_file = ROOTDIR . 'install/upgrade_' . $prev_version . '.php'; if (file_exists($script_file)) { require_once $script_file; } $setting_mdl->set_conf('system.version', MPIC_VERSION); $setting_mdl->set_conf('update.return', 'lastest'); //清除缓存 //Todo 需要统一清除缓存的功能,使其兼容memcache等 dir_clear(ROOTDIR . 'cache/data'); dir_clear(ROOTDIR . 'cache/templates'); dir_clear(ROOTDIR . 'cache/tmp'); echo '<div class="msg succ">' . lang('upgrade_success') . ' <a href="' . site_link('default', 'index') . '">' . lang('click_to_jump') . '</a></div>'; } ?> </div> </body> </html>
function cate_path_link($cate_id) { $data = array(); if ($cate_id == 0) { $data[] = array('name' => lang('no_cate_album'), 'link' => site_link('albums', 'index', array('cate' => '0'))); } else { $cache =& loader::lib('cache'); $data = $cache->get('cate_path_' . $cate_id); if (!$data) { $row = $this->get_info(intval($cate_id), 'cate_path'); if ($row) { $cates = explode(',', trim($row['cate_path'], ',')); $cate_infos = $this->get_info($cates, 'id,name'); foreach ($cates as $cate) { foreach ($cate_infos as $info) { if ($info['id'] == $cate) { $data[] = array('name' => $info['name'], 'cate_id' => $cate); } } } } $cache->set('cate_path_' . $cate_id, $data); } if ($data) { foreach ($data as $k => $v) { $data[$k]['link'] = site_link('albums', 'index', array('cate' => $v['cate_id'])); } } } return $data; }