コード例 #1
0
ファイル: _config.php プロジェクト: vluo/myPoto
function check_theme_config($posts)
{
    unset($posts['style']);
    foreach ($posts as $k => $v) {
        if (!check_color($v)) {
            form_ajax_failed('text', lang('style_' . $k) . ' ' . $v . ': ' . lang('not_aliable_color'));
        }
    }
}
コード例 #2
0
ファイル: category.ctl.php プロジェクト: vluo/myPoto
 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'));
     }
 }
コード例 #3
0
ファイル: albums.ctl.php プロジェクト: vluo/myPoto
 function save_priv()
 {
     need_login('ajax');
     $album['priv_type'] = $this->getPost('priv_type', '0');
     $album['priv_pass'] = $this->getPost('priv_pass');
     $album['priv_question'] = safe_convert($this->getPost('priv_question'));
     $album['priv_answer'] = safe_convert($this->getPost('priv_answer'));
     $id = intval($this->getGet('id'));
     if ($album['priv_type'] == '1') {
         if ($album['priv_pass'] == '') {
             form_ajax_failed('text', lang('album_password_empty'));
         }
     }
     if ($album['priv_type'] == '2') {
         if ($album['priv_question'] == '') {
             form_ajax_failed('text', lang('album_question_empty'));
         }
         if ($album['priv_answer'] == '') {
             form_ajax_failed('text', lang('album_answer_empty'));
         }
     }
     if ($this->mdl_album->update($id, $album)) {
         $this->plugin->trigger('modified_album_priv', $id);
         form_ajax_success('box', lang('modify_album_priv_success'), null, 0.5, $_SERVER['HTTP_REFERER']);
     } else {
         form_ajax_failed('text', lang('modify_album_priv_failed'));
     }
 }
コード例 #4
0
ファイル: comments.ctl.php プロジェクト: vluo/myPoto
 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'));
     }
 }
コード例 #5
0
ファイル: setting.ctl.php プロジェクト: vluo/myPoto
 function save_nav()
 {
     need_login('ajax_box');
     $mdl_nav =& Loader::model('nav');
     $names = $this->getPost('name');
     $urls = $this->getPost('url');
     $sorts = $this->getPost('sort');
     $dels = $this->getPost('del');
     $enables = $this->getPost('enable');
     $flag = true;
     //编辑及删除
     if ($names) {
         foreach ($names as $key => $name) {
             $key = intval($key);
             $name = trim($name);
             $urls[$key] = isset($urls[$key]) ? trim($urls[$key]) : '';
             if (isset($dels[$key])) {
                 //delete 记录
                 $mdl_nav->delete($key);
             } else {
                 $data = array();
                 if ($name) {
                     $data['name'] = $name;
                 }
                 if ($urls[$key]) {
                     $data['url'] = $urls[$key];
                 }
                 if ($sorts[$key]) {
                     $data['sort'] = intval($sorts[$key]);
                 }
                 if (isset($enables[$key])) {
                     $data['enable'] = 1;
                 } else {
                     $data['enable'] = 0;
                 }
                 if (!$mdl_nav->update($key, $data)) {
                     $flag = false;
                 }
             }
         }
     }
     //新增
     $newnames = $this->getPost('namenew');
     $newurls = $this->getPost('urlnew');
     $newsorts = $this->getPost('sortnew');
     if ($newnames) {
         foreach ($newnames as $key => $newname) {
             $newname = trim($newname);
             $newurls[$key] = trim($newurls[$key]);
             if ($newname == '') {
                 continue;
             }
             if ($newurls[$key] == '') {
                 $flag = false;
                 continue;
             }
             $data = array('name' => $newname, 'url' => $newurls[$key], 'sort' => $newsorts[$key] ? intval($newsorts[$key]) : 100, 'enable' => 1);
             if (!$mdl_nav->save($data)) {
                 $flag = false;
             }
         }
     }
     //清除菜单缓存
     $mdl_nav->clear_nav_cache();
     if ($flag) {
         form_ajax_success('box', lang('nav_save_succ'), null, 0.5, $_SERVER['HTTP_REFERER']);
     } else {
         form_ajax_failed('box', lang('nav_save_fail'), null, 2, $_SERVER['HTTP_REFERER']);
     }
 }
コード例 #6
0
ファイル: users.ctl.php プロジェクト: vluo/myPoto
 function save_profile()
 {
     need_login('ajax');
     $current_id = $this->user->get_field('id');
     $arr['user_nicename'] = safe_convert($this->getPost('user_nicename'));
     $new_pass = $this->getPost('new_pass');
     $old_pass = $this->getPost('old_pass');
     $new_pass_again = $this->getPost('new_pass_again');
     $extra_arr = $this->getPost('extra');
     if ($extra_arr['email'] && !check_email($extra_arr['email'])) {
         form_ajax_failed('text', lang('error_email'));
     }
     if ($new_pass) {
         if (!$this->user->check_pass($current_id, md5($old_pass))) {
             form_ajax_failed('text', lang('old_pass_error'));
         }
         if ($new_pass != $new_pass_again) {
             form_ajax_failed('text', lang('pass_twice_error'));
         }
         $arr['user_pass'] = md5($new_pass);
     }
     if ($this->user->update($current_id, $arr)) {
         $this->user->save_extra($current_id, $extra_arr);
         form_ajax_success('box', lang('modify_success') . ($new_pass ? lang('pass_edit_ok') : ''), null, 0.5, $_SERVER['HTTP_REFERER']);
     } else {
         form_ajax_failed('text', lang('modify_failed'));
     }
 }
コード例 #7
0
ファイル: photos.ctl.php プロジェクト: vluo/myPoto
 function save_desc()
 {
     need_login('ajax');
     $id = intval($this->getGet('id'));
     $desc = safe_convert($this->getPost('desc'));
     if ($desc == '') {
         form_ajax_failed('text', lang('empty_photo_desc'));
     }
     if ($this->mdl_photo->update($id, array('desc' => $desc))) {
         $this->plugin->trigger('modified_photo_desc', $id);
         form_ajax_success('text', $desc);
     } else {
         form_ajax_failed('text', lang('modify_photo_desc_failed'));
     }
     return;
 }