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 form_ajax($type = 'box|text', $flag, $content, $title = null, $close_time = 0, $forward = '') { no_cache_header(); if ($type == 'box') { $content = ajax_box($content, $title, $close_time, $forward, false); } $json =& loader::lib('json'); echo $json->encode(array('ret' => $flag, 'html' => $content)); exit; }
function emptying() { need_login('ajax_page'); $albums = $this->mdl_album->get_trash(); if ($albums) { foreach ($albums as $v) { $ret = $this->mdl_album->real_delete($v['id'], $v); } } $photos = $this->mdl_photo->get_trash(); if ($photos) { foreach ($photos as $v) { $ret = $this->mdl_photo->real_delete($v['id'], $v); } } ajax_box(lang('empty_trash_success'), null, 0.5, $_SERVER['HTTP_REFERER']); }
function delete() { need_login('ajax_page'); $id = intval($this->getGet('id')); if ($this->mdl_cate->delete($id)) { $mdl_album =& Loader::model('album'); $mdl_album->set_default_cate($id); ajax_box(lang('delete_cate_succ'), null, 0.5, $_SERVER['HTTP_REFERER']); } else { ajax_box(lang('delete_cate_fail')); } }
function delete_batch() { need_login('ajax_page'); $ids = $this->getPost('sel_id'); if (!$ids || count($ids) == 0) { ajax_box(lang('pls_sel_album_to_delete')); } else { if ($this->mdl_album->trash_batch(array_keys($ids))) { $this->plugin->trigger('trashed_many_albums', array_keys($ids)); ajax_box(lang('batch_delete_album_success'), null, 1, $_SERVER['HTTP_REFERER']); } else { ajax_box(lang('batch_delete_album_failed')); } } }
function approve_batch() { need_login('ajax_page'); $ids = $this->getPost('sel_id'); if (!$ids || count($ids) == 0) { ajax_box(lang('pls_sel_comments_want_to_approve')); } else { if ($this->mdl_comment->approve_batch(array_keys($ids))) { ajax_box(lang('batch_approve_comments_success'), null, 1, $_SERVER['HTTP_REFERER']); } else { ajax_box(lang('batch_approve_comments_failed')); } } }
function check_update() { $response = check_update(); if (!$response) { $data = lang('connect_to_server_failed'); } else { if ($response['return'] == 'lastest') { $data = lang('your_system_is_up_to_date'); } elseif ($response['return'] == 'new') { $newversion = $response['version']; $publish_date = $response['pubdate']; $data = lang('new_update_available', $newversion, $publish_date) . '<a href="' . site_link('update', 'core', array('version' => $newversion)) . '">' . lang('update_immediately') . '</a> ' . lang('or') . ' <a href="' . $response['package'] . '">' . lang('update_manually') . '</a>'; } else { $data = lang('connect_to_server_failed'); } } ajax_box($data, lang('check_update')); }
function logout() { $current_username = $this->user->get_field('user_name'); $this->user->clear_login(); $this->plugin->trigger('user_loged_out', $current_username); ajax_box(lang('logout_success'), null, 0.5, $_SERVER['HTTP_REFERER']); }