コード例 #1
0
 /**
  * 系统设置
  *
  */
 public function setting()
 {
     if ($this->isPost()) {
         if (C('TOKEN_ON') && !checkFormToken($_POST)) {
             die('hack attemp.');
         }
         /* 保存变量值 */
         $count = count($_POST['value']);
         $configModel = M('site_config');
         $arr = array();
         $res = $configModel->field('id,value')->select();
         foreach ($res as $row) {
             $arr[$row['id']] = $row['value'];
         }
         foreach ($_POST['value'] as $key => $val) {
             if ($arr[$key] != $val) {
                 $configModel->where("id={$key}")->save(array('value' => trim($val)));
             }
         }
         F('site_config', null);
         $this->success('编辑成功');
     }
     /* 可选语言 */
     $_LANG = L('SysConfig');
     $lang_list = array();
     $this->assign('group_list', $this->_get_settings(null, null, $_LANG));
     $this->assign('lang_list', array());
     $this->assign('lang', $_LANG);
     $this->assign('ur_href', '系统管理 > 系统设置');
     $this->assign('_hash_', buildFormToken());
     $this->display();
 }
コード例 #2
0
 /**
  * 清除今日以前的临时文件
  *
  */
 public function clean()
 {
     if ($this->isPost() && $this->isAjax()) {
         if (C('TOKEN_ON') && !checkFormToken($_POST)) {
             die('hack attemp.');
         }
         @set_time_limit(3600);
         if (function_exists('ini_set')) {
             ini_set('max_execution_time', 3600);
             ini_set("memory_limit", "256M");
         }
         $localTimeObj = LocalTime::getInstance();
         $today = $localTimeObj->local_strtotime(date('Y-m-d 00:00:00'));
         $upload_path = DOC_ROOT_PATH . get_upload_path();
         $dir = $upload_path . 'temp/';
         $dirhandle = opendir($dir);
         while (($file = readdir($dirhandle)) !== false) {
             if ($file != "." && $file != "..") {
                 if (filemtime($dir . $file) < $today) {
                     if (is_dir($dir . $file)) {
                         del_dir($dir . $file);
                     } else {
                         @unlink($dir . $file);
                     }
                 }
             }
         }
         @closedir($dirhandle);
         $this->ajaxReturn('', buildFormToken(), 1);
     }
 }
コード例 #3
0
 public function set()
 {
     $module = $_REQUEST['module'];
     $privRoleObj = AdminPriv::getInstance();
     if ($this->isPost()) {
         if (C('TOKEN_ON') && !checkFormToken($_REQUEST)) {
             die('hack attemp.');
         }
         if ($privRoleObj->_update('module', $module, $_REQUEST['priv_roleid'])) {
             $this->assign('jumpUrl', $this->_refererUrl);
             $this->success('修改成功');
         } else {
             $this->assign('jumpUrl', $this->_refererUrl);
             $this->success('修改失败');
         }
     }
     $privs_conf = C('_privs_.Admin');
     $module_privs = $privs_conf[$module];
     $this->assign('module_privs', $module_privs);
     $this->assign('privs', $privRoleObj->getPrivs($module));
     $this->assign('module', $module);
     $sysRoles = null;
     $roleModule = D('AdminRole');
     $sysRoles = $roleModule->getAll();
     $this->assign('sysRoles', $sysRoles);
     $this->assign('ur_href', '权限管理');
     $this->assign('_hash_', buildFormToken());
     $this->display();
 }
コード例 #4
0
 public function add()
 {
     if ($this->isAjax()) {
         if (C('TOKEN_ON') && !checkFormToken($_REQUEST)) {
             die('hack attemp.');
         }
         $cid = intval($_REQUEST['id']);
         $name = $_REQUEST['name'];
         $data = array('cid' => $cid, 'name' => $name);
         if (M('tao_shop_category')->add($data)) {
             //清除缓存
             $params = null;
             B('TaoShopCategory', $params);
             $this->ajaxReturn('', buildFormToken(), 1);
         } else {
             $this->ajaxReturn('', buildFormToken(), 0);
         }
     }
     import('@.Com.taobao.Taobao');
     $taobaoObj = Taobao::getInstance();
     $tao_shop_categorys = $taobaoObj->ShopCatesList();
     $this->assign('tao_shop_categorys', $tao_shop_categorys);
     $this->assign('ur_href', '淘宝店铺分类管理 &gt; 添加分类');
     $this->assign('_hash_', buildFormToken());
     $this->display();
 }
コード例 #5
0
ファイル: codebase.php プロジェクト: phill104/branches
function template_uninstall()
{
    global $CONFIG, $lang_errors;
    $superCage = Inspekt::makeSuperCage();
    if (!checkFormToken()) {
        cpg_die(ERROR, $lang_errors['invalid_form_token'], __FILE__, __LINE__);
    }
    // Delete the plugin config records
    return true;
}
コード例 #6
0
 /**
  * 设置
  *
  */
 public function setting()
 {
     if ($this->isPost()) {
         if (C('TOKEN_ON') && !checkFormToken($_POST)) {
             die('hack attemp.');
         }
         $captcha = 0;
         $captcha = empty($_POST['captcha_register']) ? $captcha : $captcha | CAPTCHA_REGISTER;
         $captcha = empty($_POST['captcha_login']) ? $captcha : $captcha | CAPTCHA_LOGIN;
         $captcha = empty($_POST['captcha_comment']) ? $captcha : $captcha | CAPTCHA_COMMENT;
         $captcha = empty($_POST['captcha_tag']) ? $captcha : $captcha | CAPTCHA_TAG;
         $captcha = empty($_POST['captcha_admin']) ? $captcha : $captcha | CAPTCHA_ADMIN;
         $captcha = empty($_POST['captcha_login_fail']) ? $captcha : $captcha | CAPTCHA_LOGIN_FAIL;
         $captcha = empty($_POST['captcha_message']) ? $captcha : $captcha | CAPTCHA_MESSAGE;
         $captcha_width = empty($_POST['captcha_width']) ? 100 : intval($_POST['captcha_width']);
         $captcha_height = empty($_POST['captcha_height']) ? 30 : intval($_POST['captcha_height']);
         $m = M('site_config');
         $m->where('code="captcha"')->save(array('value' => $captcha));
         $m->where('code="captcha_width"')->save(array('value' => $captcha_width));
         $m->where('code="captcha_height"')->save(array('value' => $captcha_height));
         clear_all_caches();
         $this->success('编辑成功');
     }
     $res = M('site_config')->where('code="captcha"')->find();
     $captcha = $res['value'];
     $captcha_check = array();
     if ($captcha & CAPTCHA_REGISTER) {
         $captcha_check['register'] = 'checked="checked"';
     }
     if ($captcha & CAPTCHA_LOGIN) {
         $captcha_check['login'] = '******';
     }
     if ($captcha & CAPTCHA_COMMENT) {
         $captcha_check['comment'] = 'checked="checked"';
     }
     if ($captcha & CAPTCHA_ADMIN) {
         $captcha_check['admin'] = 'checked="checked"';
     }
     if ($captcha & CAPTCHA_MESSAGE) {
         $captcha_check['message'] = 'checked="checked"';
     }
     if ($captcha & CAPTCHA_LOGIN_FAIL) {
         $captcha_check['login_fail_yes'] = 'checked="checked"';
     } else {
         $captcha_check['login_fail_no'] = 'checked="checked"';
     }
     $this->assign('captcha', $captcha_check);
     $res = M('site_config')->where('code="captcha_width"')->find();
     $this->assign('captcha_width', $res['value']);
     $res = M('site_config')->where('code="captcha_height"')->find();
     $this->assign('captcha_height', $res['value']);
     $this->assign('ur_href', '验证码管理 &gt; 验证码设置');
     $this->assign('_hash_', buildFormToken());
     $this->display();
 }
コード例 #7
0
ファイル: delete.php プロジェクト: erikbroo/androidcpg
function jsCheckFormToken()
{
    global $lang_common, $lang_errors;
    //Check if the form token is valid
    if (!checkFormToken()) {
        $dataArray = array('message' => 'false', 'title' => $lang_common['error'], 'description' => $lang_errors['invalid_form_token']);
        header("Content-Type: text/plain");
        echo json_encode($dataArray);
        exit;
    }
}
コード例 #8
0
ファイル: creategeodata.php プロジェクト: phill104/branches
function remove_picture_geodata()
{
    global $CONFIG, $USER_DATA, $lang_errors, $lang_editpics_php, $geodata_superCage, $lang_plugin_geodata, $aid;
    //Check if the form token is valid
    if (!checkFormToken()) {
        cpg_die(ERROR, $lang_errors['invalid_form_token'], __FILE__, __LINE__);
    }
    //PID picture + AID album
    $pid = $geodata_superCage->post->getInt('id');
    $query = "DELETE from {$CONFIG['TABLE_PREFIX']}plugin_geodata where geodata_pid='{$pid}'";
    $vResult = cpg_db_query($query);
}
コード例 #9
0
ファイル: codebase.php プロジェクト: phill104/branches
function plugin_geoip_uninstall()
{
    global $CONFIG;
    $superCage = Inspekt::makeSuperCage();
    if (!checkFormToken()) {
        global $lang_errors;
        cpg_die(ERROR, $lang_errors['invalid_form_token'], __FILE__, __LINE__);
    }
    // Delete the plugin config records
    cpg_db_query("DELETE FROM {$CONFIG['TABLE_CONFIG']} WHERE name = 'plugin_geoip_scope'");
    return true;
}
コード例 #10
0
 /**
  * 清除缓存
  *
  */
 public function clear()
 {
     if ($this->isPost() && $this->isAjax()) {
         if (C('TOKEN_ON') && !checkFormToken($_POST)) {
             die('hack attemp.');
         }
         set_time_limit(0);
         //清空数据缓存
         clear_all_caches();
         $this->ajaxReturn('', buildFormToken(), 1);
     }
     $this->assign('_hash_', buildFormToken());
     $this->assign('ur_href', '清除系统缓存');
     $this->display();
 }
コード例 #11
0
 /**
  * 更新淘宝店铺全文索引
  *
  */
 public function updateTaoShop()
 {
     if ($this->isPost() && $this->isAjax()) {
         if (C('TOKEN_ON') && !checkFormToken($_POST)) {
             die('hack attemp.');
         }
         set_time_limit(0);
         $shopModel = D('TaoShop');
         $shopModel->_updateFullIndex();
         $this->ajaxReturn('', buildFormToken(), 1);
     }
     $this->assign('_hash_', buildFormToken());
     $this->assign('ur_href', '更新淘宝店铺全文索引');
     $this->display();
 }
コード例 #12
0
	public function processPost()
	{
		parent::processPost();
		session_start();
		// #TODO: User submitted data. Save it to DB, email, etc.
		copyArray($_POST, $fv, 'ftoken', 'name', 'email', 'optin|checkbox', 'msg');
		
		checkFormToken('ftoken_contact_us', $fv['ftoken']);		

		$v = $this->smarty;
		$v->assign('title', 'Thank you!');
		$v->assign(array(
				'name' => sanitizeString($fv['name']),
				'email' => sanitizeEmail($fv['email']),
				'optin' => $fv['optin']
		));
		$v->assign('inc_content', v('contact_us_done.html'));
		$this->display($v, v('index.html'));
	}
コード例 #13
0
 public function del()
 {
     if ($this->isAjax()) {
         if (C('TOKEN_ON') && !checkFormToken($_REQUEST)) {
             die('hack attemp.');
         }
         $role_id = intval($_REQUEST['id']);
         $arModel = D('AdminRole');
         $role = $arModel->info($role_id);
         if (!$role) {
             $this->ajaxReturn('', 'id invalid', 0);
         }
         if ($arModel->del_role($role_id)) {
             $this->ajaxReturn('', buildFormToken(), 1);
         } else {
             $this->ajaxReturn('', '', 0);
         }
     }
 }
コード例 #14
0
ファイル: codebase.php プロジェクト: phill104/branches
function flv_player_uninstall()
{
    $superCage = Inspekt::makeSuperCage();
    if (!$superCage->post->keyExists('drop')) {
        return 1;
    }
    if (!checkFormToken()) {
        global $lang_errors;
        cpg_die(ERROR, $lang_errors['invalid_form_token'], __FILE__, __LINE__);
    }
    if ($superCage->post->getInt('drop') == 1) {
        global $CONFIG;
        $allowed_mov_types = str_replace('/flv', '', $CONFIG['allowed_mov_types']);
        $allowed_mov_types = str_replace('flv/', '', $allowed_mov_types);
        $allowed_mov_types = str_replace('flv', '', $allowed_mov_types);
        cpg_db_query("UPDATE {$CONFIG['TABLE_CONFIG']} SET value = '{$allowed_mov_types}' WHERE name = 'allowed_mov_types'");
        cpg_db_query("DELETE FROM {$CONFIG['TABLE_FILETYPES']} WHERE extension = 'flv'");
        return true;
    }
}
コード例 #15
0
ファイル: codebase.php プロジェクト: phill104/branches
function album_fav_boxes_uninstall()
{
    global $CONFIG;
    $superCage = Inspekt::makeSuperCage();
    if (!checkFormToken()) {
        global $lang_errors;
        cpg_die(ERROR, $lang_errors['invalid_form_token'], __FILE__, __LINE__);
    }
    // Delete the plugin config records
    cpg_db_query("DELETE FROM {$CONFIG['TABLE_CONFIG']} WHERE name = 'plugin_album_fav_boxes_regular'");
    cpg_db_query("DELETE FROM {$CONFIG['TABLE_CONFIG']} WHERE name = 'plugin_album_fav_boxes_search'");
    cpg_db_query("DELETE FROM {$CONFIG['TABLE_CONFIG']} WHERE name = 'plugin_album_fav_boxes_favpics'");
    cpg_db_query("DELETE FROM {$CONFIG['TABLE_CONFIG']} WHERE name = 'plugin_album_fav_boxes_lastcom'");
    cpg_db_query("DELETE FROM {$CONFIG['TABLE_CONFIG']} WHERE name = 'plugin_album_fav_boxes_lastcomby'");
    cpg_db_query("DELETE FROM {$CONFIG['TABLE_CONFIG']} WHERE name = 'plugin_album_fav_boxes_lastup'");
    cpg_db_query("DELETE FROM {$CONFIG['TABLE_CONFIG']} WHERE name = 'plugin_album_fav_boxes_lastupby'");
    cpg_db_query("DELETE FROM {$CONFIG['TABLE_CONFIG']} WHERE name = 'plugin_album_fav_boxes_topn'");
    cpg_db_query("DELETE FROM {$CONFIG['TABLE_CONFIG']} WHERE name = 'plugin_album_fav_boxes_toprated'");
    cpg_db_query("DELETE FROM {$CONFIG['TABLE_CONFIG']} WHERE name = 'plugin_album_fav_boxes_lasthits'");
    cpg_db_query("DELETE FROM {$CONFIG['TABLE_CONFIG']} WHERE name = 'plugin_album_fav_boxes_random'");
    cpg_db_query("DELETE FROM {$CONFIG['TABLE_CONFIG']} WHERE name = 'plugin_album_fav_boxes_lastalb'");
    return true;
}
コード例 #16
0
 public function edit()
 {
     $id = intval($_REQUEST['id']);
     $cccService = service('CouponCodeCategory');
     $category = $cccService->info($id);
     if ($this->isPost()) {
         if (C('TOKEN_ON') && !checkFormToken($_REQUEST)) {
             die('hack attemp.');
         }
         if (!$_REQUEST['name'] || !$_REQUEST['sort_order']) {
             $this->error('请填写所有的必填项');
         }
         $data = array('parent_id' => intval($_REQUEST['parent_id']), 'name' => $_REQUEST['name'], 'sort_order' => intval($_REQUEST['sort_order']));
         $cccModel = D('CouponCodeCategory');
         if ($cccModel->_edit($id, $data)) {
             //清除缓存
             $params = null;
             B('CouponCodeCategory', $params);
             $this->assign('jumpUrl', '?g=' . GROUP_NAME . '&m=' . MODULE_NAME);
             $this->success('编辑成功');
         } else {
             $this->error('编辑失败');
         }
     }
     $categorys = array();
     $data = $cccService->getTree();
     foreach ($data as $rs) {
         $categorys[$rs['id']] = $rs;
         $categorys[$rs['id']]['prefix'] = str_repeat("&nbsp;&nbsp;&nbsp;&nbsp;", $rs['level']);
     }
     $this->assign('categorys', $categorys);
     $this->assign('category', $category);
     $this->assign('ur_href', '分类管理 &gt; 编辑分类');
     $this->assign('_hash_', buildFormToken());
     $this->display('post');
 }
コード例 #17
0
 public function edit_pwd()
 {
     if ($this->isPost()) {
         if (C('TOKEN_ON') && !checkFormToken($_REQUEST)) {
             die('hack attemp.');
         }
         $auModel = D('AdminUsers');
         $user_id = $_SESSION[C('SESSION_PREFIX') . 'user_id'];
         $auInfo = $auModel->info($user_id);
         if ($auInfo['password'] != md5(md5($_REQUEST['old_password']))) {
             $this->error('旧密码输入错误');
         }
         $data = array('password' => md5(md5($_REQUEST['password'])));
         if ($auModel->edit_user($user_id, $data)) {
             $this->assign('jumpUrl', '?g=' . GROUP_NAME . '&m=User&a=logout');
             $this->success('修改成功.请重新登陆');
         } else {
             $this->error('修改失败,请重试');
         }
     }
     $this->assign('ur_href', '修改密码');
     $this->assign('_hash_', buildFormToken());
     $this->display();
 }
コード例 #18
0
function process_post_data()
{
    global $CONFIG, $USER_DATA, $lang_errors, $lang_editpics_php, $superCage;
    //Check if the form token is valid
    if (!checkFormToken()) {
        cpg_die(ERROR, $lang_errors['invalid_form_token'], __FILE__, __LINE__);
    }
    $user_album_set = array();
    $result = cpg_db_query("SELECT aid FROM {$CONFIG['TABLE_ALBUMS']} WHERE category = " . (FIRST_USER_CAT + USER_ID) . " OR owner = " . USER_ID . " OR uploads = 'YES'");
    while ($row = mysql_fetch_assoc($result)) {
        $user_album_set[$row['aid']] = 1;
    }
    mysql_free_result($result);
    $pid = $superCage->post->getInt('id');
    $aid = $superCage->post->getInt('aid');
    $pwidth = $superCage->post->getInt('pwidth');
    $pheight = $superCage->post->getInt('pheight');
    $title = cpgSanitizeUserTextInput($superCage->post->getEscaped('title'));
    $caption = cpgSanitizeUserTextInput($superCage->post->getEscaped('caption'));
    $keywords = cpgSanitizeUserTextInput(utf_replace($superCage->post->getEscaped('keywords')));
    $user1 = cpgSanitizeUserTextInput($superCage->post->getEscaped('user1'));
    $user2 = cpgSanitizeUserTextInput($superCage->post->getEscaped('user2'));
    $user3 = cpgSanitizeUserTextInput($superCage->post->getEscaped('user3'));
    $user4 = cpgSanitizeUserTextInput($superCage->post->getEscaped('user4'));
    $galleryicon = $superCage->post->getInt('galleryicon');
    $isgalleryicon = $galleryicon == $pid;
    $read_exif = $superCage->post->keyExists('read_exif') ? $superCage->post->getInt('read_exif') : 0;
    $reset_vcount = $superCage->post->keyExists('reset_vcount') ? $superCage->post->getInt('reset_vcount') : 0;
    $reset_votes = $superCage->post->keyExists('reset_votes') ? $superCage->post->getInt('reset_votes') : 0;
    $del_comments = $superCage->post->keyExists('del_comments') ? $superCage->post->getInt('del_comments') : 0;
    $result = cpg_db_query("SELECT category, owner_id, url_prefix, filepath, filename, pwidth, pheight, p.aid AS aid FROM {$CONFIG['TABLE_PICTURES']} AS p INNER JOIN {$CONFIG['TABLE_ALBUMS']} AS a ON a.aid = p.aid WHERE pid = '{$pid}'");
    if (!mysql_num_rows($result)) {
        cpg_die(CRITICAL_ERROR, $lang_errors['non_exist_ap'], __FILE__, __LINE__);
    }
    $pic = mysql_fetch_assoc($result);
    mysql_free_result($result);
    if (!GALLERY_ADMIN_MODE && !MODERATOR_MODE && !USER_ADMIN_MODE && !user_is_allowed() && !$CONFIG['users_can_edit_pics']) {
        if ($pic['category'] != FIRST_USER_CAT + USER_ID) {
            cpg_die(ERROR, $lang_errors['perm_denied'], __FILE__, __LINE__);
        }
        if (!isset($user_album_set[$aid])) {
            cpg_die(ERROR, $lang_errors['perm_denied'], __FILE__, __LINE__);
        }
    }
    if (!USER_ID || !(GALLERY_ADMIN_MODE || $pic['category'] == FIRST_USER_CAT + USER_ID || $CONFIG['users_can_edit_pics'] && $pic['owner_id'] == USER_ID)) {
        cpg_die(ERROR, $lang_errors['access_denied'], __FILE__, __LINE__);
    }
    $result = cpg_db_query("SELECT category FROM {$CONFIG['TABLE_ALBUMS']} WHERE aid = '{$aid}'");
    if (!mysql_num_rows($result)) {
        cpg_die(CRITICAL_ERROR, $lang_errors['non_exist_ap'], __FILE__, __LINE__);
    }
    $new_alb = mysql_fetch_assoc($result);
    mysql_free_result($result);
    cpg_trim_keywords($keywords);
    $update = "aid = '{$aid}'";
    if (is_movie($pic['filename'])) {
        $update .= ", pwidth = " . $pwidth;
        $update .= ", pheight = " . $pheight;
    }
    $update .= ", title = '{$title}'";
    $update .= ", caption = '{$caption}'";
    $update .= ", keywords = '{$keywords}'";
    if (GALLERY_ADMIN_MODE) {
        $approved = $superCage->post->getAlpha('approved');
        $update .= ", approved = '{$approved}'";
    } elseif ($new_alb['category'] < FIRST_USER_CAT && $aid != $pic['aid']) {
        $approved = $USER_DATA['pub_upl_need_approval'] ? 'NO' : 'YES';
        $update .= ", approved = '{$approved}'";
    } elseif ($new_alb['category'] > FIRST_USER_CAT && $aid != $pic['aid'] && $pic['category'] < FIRST_USER_CAT) {
        $approved = $USER_DATA['priv_upl_need_approval'] ? 'NO' : 'YES';
        $update .= ", approved = '{$approved}'";
    }
    $update .= ", user1 = '{$user1}'";
    $update .= ", user2 = '{$user2}'";
    $update .= ", user3 = '{$user3}'";
    $update .= ", user4 = '{$user4}'";
    if ($isgalleryicon && $pic['category'] > FIRST_USER_CAT) {
        $sql = "UPDATE {$CONFIG['TABLE_PICTURES']} SET galleryicon = 0 WHERE owner_id = {$pic['owner_id']}";
        cpg_db_query($sql);
        $update .= ", galleryicon = " . $galleryicon;
    }
    if ($reset_vcount) {
        $update .= ", hits = 0";
        resetDetailHits($pid);
    }
    if ($reset_votes) {
        $update .= ", pic_rating = 0, votes = 0";
        resetDetailVotes($pid);
    }
    if ($read_exif) {
        // If "read exif info again" is checked then just delete the entry from the exif table.
        // The new exif information will automatically be read when someone views the image.
        $query = "DELETE FROM {$CONFIG['TABLE_EXIF']} WHERE pid = '{$pid}'";
        cpg_db_query($query);
    }
    if ($del_comments) {
        $query = "DELETE FROM {$CONFIG['TABLE_COMMENTS']} WHERE pid = '{$pid}'";
        cpg_db_query($query);
    }
    $query = "UPDATE {$CONFIG['TABLE_PICTURES']} SET {$update} WHERE pid='{$pid}' LIMIT 1";
    cpg_db_query($query);
    // Executes after a file update is committed
    CPGPluginAPI::action('after_edit_file', $pid);
    // rename a file
    if ($superCage->post->keyExists('filename')) {
        $post_filename = $superCage->post->getEscaped('filename');
    }
    if ($post_filename != $pic['filename']) {
        if ($CONFIG['make_intermediate'] && cpg_picture_dimension_exceeds_intermediate_limit($pic['pwidth'], $pic['pheight'])) {
            $prefixes = array('fullsize', 'normal', 'thumb');
        } else {
            $prefixes = array('fullsize', 'thumb');
        }
        if ($CONFIG['enable_watermark'] == '1' && ($CONFIG['which_files_to_watermark'] == 'both' || $CONFIG['which_files_to_watermark'] == 'original')) {
            $prefixes[] = 'orig';
        }
        if (!is_image($pic['filename'])) {
            $prefixes = array('fullsize');
            // Check for custom thumbnails
            $mime_content_old = cpg_get_type($pic['filename']);
            $mime_content_new = cpg_get_type(replace_forbidden($post_filename));
            $file_base_name_old = str_replace('.' . $mime_content_old['extension'], '', basename($pic['filename']));
            foreach (array('.gif', '.png', '.jpg') as $thumb_extension) {
                if (file_exists($CONFIG['fullpath'] . $pic['filepath'] . $CONFIG['thumb_pfx'] . $file_base_name_old . $thumb_extension)) {
                    // Thumbnail found, check if it's the only file using that thumbnail
                    $count = mysql_result(cpg_db_query("SELECT COUNT(*) FROM {$CONFIG['TABLE_PICTURES']} WHERE filepath = '{$pic['filepath']}' AND filename LIKE '{$file_base_name_old}.%'"), 0);
                    if ($count == 1) {
                        $prefixes[] = 'thumb';
                        $custom_thumb = TRUE;
                        break;
                    }
                }
            }
        }
        $pic_prefix = array('thumb' => $CONFIG['thumb_pfx'], 'normal' => $CONFIG['normal_pfx'], 'orig' => $CONFIG['orig_pfx'], 'fullsize' => '');
        $files_to_rename = array();
        foreach ($prefixes as $prefix) {
            $oldname = urldecode($CONFIG['fullpath'] . $pic['filepath'] . $pic_prefix[$prefix] . $pic['filename']);
            $filename = replace_forbidden($post_filename);
            $newname = str_replace($pic['filename'], $filename, $oldname);
            if ($custom_thumb == TRUE && $prefix == 'thumb') {
                $oldname = str_replace('.' . $mime_content_old['extension'], $thumb_extension, $oldname);
                $newname = str_replace('.' . $mime_content_new['extension'], $thumb_extension, $newname);
            }
            $old_mime = cpg_get_type($oldname);
            $new_mime = cpg_get_type($newname);
            if ($old_mime['mime'] != $new_mime['mime'] && isset($new_mime['mime'])) {
                cpg_die(CRITICAL_ERROR, sprintf($lang_editpics_php['mime_conv'], $old_mime['mime'], $new_mime['mime']), __FILE__, __LINE__);
            }
            if (!is_known_filetype($newname)) {
                cpg_die(CRITICAL_ERROR, $lang_editpics_php['forb_ext'], __FILE__, __LINE__);
            }
            if (file_exists($newname)) {
                cpg_die(CRITICAL_ERROR, sprintf($lang_editpics_php['file_exists'], $newname), __FILE__, __LINE__);
            }
            if (!file_exists($oldname)) {
                cpg_die(CRITICAL_ERROR, sprintf($lang_editpics_php['src_file_missing'], $oldname), __FILE__, __LINE__);
            }
            // Check if there will be no conflicts before doing anything
            $files_to_rename[] = array('oldname' => $oldname, 'filename' => $filename, 'newname' => $newname);
        }
        if (count($files_to_rename) > 0) {
            foreach ($files_to_rename as $file) {
                if (rename($file['oldname'], $file['newname'])) {
                    cpg_db_query("UPDATE {$CONFIG['TABLE_PICTURES']} SET filename = '{$file['filename']}' WHERE pid = '{$pid}' LIMIT 1");
                } else {
                    cpg_die(CRITICAL_ERROR, sprintf($lang_editpics_php['rename_failed'], $oldname, $newname), __FILE__, __LINE__);
                }
            }
        }
    }
}
コード例 #19
0
 /**
  * 删除
  *
  */
 public function del()
 {
     if ($this->isAjax()) {
         if (C('TOKEN_ON') && !checkFormToken($_REQUEST)) {
             die('hack attemp.');
         }
         $link_id = intval($_REQUEST['id']);
         $flModel = D('FriendLink');
         $link = $flModel->info($link_id);
         if ($flModel->del($link_id)) {
             if (is_file(FixedUploadedFileUrl($link['link_code']))) {
                 @unlink(FixedUploadedFileUrl($link['link_code']));
             }
             $params = null;
             B('FriendLinks', $params);
             $this->ajaxReturn('', buildFormToken(), 1);
         } else {
             $this->ajaxReturn('', '', 0);
         }
     }
 }
コード例 #20
0
ファイル: codebase.php プロジェクト: phill104/branches
function shorturl_uninstall()
{
    $superCage = Inspekt::makeSuperCage();
    if (!$superCage->post->keyExists('drop')) {
        return 1;
    }
    if (!checkFormToken()) {
        global $lang_errors;
        cpg_die(ERROR, $lang_errors['invalid_form_token'], __FILE__, __LINE__);
    }
    if ($superCage->post->getInt('drop') == 1) {
        global $CONFIG;
        return cpg_db_query("DROP TABLE IF EXISTS {$CONFIG['TABLE_PREFIX']}plugin_shorturl");
    } else {
        return true;
    }
}
コード例 #21
0
ファイル: codebase.php プロジェクト: phill104/branches
function annotate_configure()
{
    global $CONFIG, $cpg_udb, $THEME_DIR, $thisplugin, $lang_plugin_annotate, $lang_common, $annotate_icon_array, $lang_errors, $annotate_installation, $annotate_title, $LINEBREAK;
    $superCage = Inspekt::makeSuperCage();
    $additional_submit_information = '';
    if (!GALLERY_ADMIN_MODE) {
        cpg_die(ERROR, $lang_errors['access_denied'], __FILE__, __LINE__);
    }
    // Form submit?
    if ($superCage->post->keyExists('submit') == TRUE) {
        //Check if the form token is valid
        if (!checkFormToken()) {
            cpg_die(ERROR, $lang_errors['invalid_form_token'], __FILE__, __LINE__);
        }
        $config_changes_counter = annotate_configuration_submit();
        if ($config_changes_counter > 0) {
            $additional_submit_information .= '<div class="cpg_message_success">' . $lang_plugin_annotate['changes_saved'] . '</div>';
        } else {
            $additional_submit_information .= '<div class="cpg_message_validation">' . $lang_plugin_annotate['no_changes'] . '</div>';
        }
    }
    // Check if guests have greater permissions than registered users
    if ($CONFIG['plugin_annotate_permissions_' . $cpg_udb->guestgroup] > mysql_result(cpg_db_query("SELECT MIN(value) FROM {$CONFIG['TABLE_CONFIG']} WHERE name LIKE 'plugin_annotate_permissions_%'"), 0)) {
        $additional_submit_information .= '<div class="cpg_message_warning">' . $lang_plugin_annotate['guests_more_permissions_than_registered'] . '</div>';
    }
    // Create the table row that is displayed during initial install
    if ($annotate_installation == 1) {
        $additional_submit_information .= '<div class="cpg_message_info">' . $lang_plugin_annotate['submit_to_install'] . '</div>';
    }
    $option_output['plugin_annotate_disable_mobile'] = $CONFIG['plugin_annotate_disable_mobile'] ? 'checked="checked"' : '';
    if ($CONFIG['plugin_annotate_type'] == '0') {
        $option_output['plugin_annotate_type_0'] = 'checked="checked"';
        $option_output['plugin_annotate_type_1'] = '';
        $option_output['plugin_annotate_type_2'] = '';
        $option_output['plugin_annotate_type_3'] = '';
    } elseif ($CONFIG['plugin_annotate_type'] == '1') {
        $option_output['plugin_annotate_type_0'] = '';
        $option_output['plugin_annotate_type_1'] = 'checked="checked"';
        $option_output['plugin_annotate_type_2'] = '';
        $option_output['plugin_annotate_type_3'] = '';
    } elseif ($CONFIG['plugin_annotate_type'] == '2') {
        $option_output['plugin_annotate_type_0'] = '';
        $option_output['plugin_annotate_type_1'] = '';
        $option_output['plugin_annotate_type_2'] = 'checked="checked"';
        $option_output['plugin_annotate_type_3'] = '';
    } elseif ($CONFIG['plugin_annotate_type'] == '3') {
        $option_output['plugin_annotate_type_0'] = '';
        $option_output['plugin_annotate_type_1'] = '';
        $option_output['plugin_annotate_type_2'] = '';
        $option_output['plugin_annotate_type_3'] = 'checked="checked"';
    }
    list($timestamp, $form_token) = getFormToken();
    // Start the actual output
    echo <<<EOT
            <form action="" method="post" name="annotate_config" id="annotate_config">
EOT;
    starttable('100%', $annotate_icon_array['configure'] . $lang_plugin_annotate['configure_plugin'], 8);
    $display_stats_title = sprintf($lang_plugin_annotate['display_stats_title'], $lang_plugin_annotate['annotations_pic'], $lang_plugin_annotate['annotations_album'], $lang_plugin_annotate['annotated_pics']);
    echo <<<EOT
                    <tr>
                        <td valign="top" class="tableb">
                            {$lang_plugin_annotate['disable_mobile']}
                        </td>
                        <td valign="top" class="tableb" colspan="7">
                            <input type="checkbox" name="plugin_annotate_disable_mobile" id="plugin_annotate_disable_mobile" class="checkbox" value="1" {$option_output['plugin_annotate_disable_mobile']} />
                        </td>
                    </tr>
                    <tr>
                        <td valign="top" class="tableb">
                            {$lang_plugin_annotate['annotation_type']}
                        </td>
                        <td valign="top" class="tableb" colspan="7">
                            <input type="radio" name="plugin_annotate_type" id="plugin_annotate_type_0" class="radio" value="0" {$option_output['plugin_annotate_type_0']} />
                            <label for="plugin_annotate_type_0" class="clickable_option">{$lang_plugin_annotate['drop_down_registered_users']}</label>
                            <br />
                            <input type="radio" name="plugin_annotate_type" id="plugin_annotate_type_1" class="radio" value="1" {$option_output['plugin_annotate_type_1']} />
                            <label for="plugin_annotate_type_1" class="clickable_option">{$lang_plugin_annotate['free_text']}</label>
                            <br />
                            <input type="radio" name="plugin_annotate_type" id="plugin_annotate_type_2" class="radio" value="2" {$option_output['plugin_annotate_type_2']} />
                            <label for="plugin_annotate_type_2" class="clickable_option">{$lang_plugin_annotate['drop_down_existing_annotations']}</label>
                            <br />
                            <input type="radio" name="plugin_annotate_type" id="plugin_annotate_type_3" class="radio" value="3" {$option_output['plugin_annotate_type_3']} />
                            <label for="plugin_annotate_type_3" class="clickable_option">{$lang_plugin_annotate['free_text']} + {$lang_plugin_annotate['drop_down_existing_annotations']}</label>
                        </td>
                    </tr>
                    <tr>
                        <td valign="top" class="tableh2" rowspan="2">
                            {$lang_plugin_annotate['group']}
                        </td>
                        <td valign="middle" align="center" class="tableh2" colspan="4">
                            {$lang_plugin_annotate['permissions']}
                        </td>
                        <td valign="middle" align="center" class="tableh2" colspan="1" rowspan="2"><span title="{$lang_plugin_annotate['display_notes_title']}" style="cursor:help;">{$lang_plugin_annotate['display_notes']}</span>
                        </td>
                        <td valign="middle" align="center" class="tableh2" colspan="1" rowspan="2">{$lang_plugin_annotate['display_links']}
                        </td>
                        <td valign="middle" align="center" class="tableh2" colspan="1" rowspan="2"><span title="{$display_stats_title}" style="cursor:help;">{$lang_plugin_annotate['display_stats']}</span>
                        </td>
                    </tr>
                    <tr>
                        <td valign="middle" align="center" class="tableh2">
                            <span title="{$lang_plugin_annotate['no_access']}" style="cursor:help;">{$annotate_icon_array['permission_none']}---</span>
                        </td>
                        <td valign="middle" align="center" class="tableh2">
                            <span title="{$lang_plugin_annotate['read_annotations']}" style="cursor:help;">{$annotate_icon_array['permission_read']}R--</span>
                        </td>
                        <td valign="middle" align="center" class="tableh2">
                            <span title="{$lang_plugin_annotate['read_write_annotations']}" style="cursor:help;">{$annotate_icon_array['permission_write']}RW-</span>
                        </td>
                        <td valign="middle" align="center" class="tableh2">
                            <span title="{$lang_plugin_annotate['read_write_delete_annotations']}" style="cursor:help;">{$annotate_icon_array['permission_delete']}RWD</span>
                        </td>
                    </tr>
EOT;
    // Group output --- start
    $loopCounter = 0;
    $result = cpg_db_query("SELECT group_id, group_name FROM {$CONFIG['TABLE_USERGROUPS']} ORDER BY group_id ASC");
    while ($row = mysql_fetch_assoc($result)) {
        // while-loop mysql_fetch_assoc groups --- start
        if ($loopCounter / 2 == floor($loopCounter / 2)) {
            $cell_style = 'tableb';
        } else {
            $cell_style = 'tableb tableb_alternate';
        }
        $group_output[$row['group_id']] = '';
        if (in_array($row['group_id'], $cpg_udb->admingroups)) {
            echo <<<EOT
                <tr>
                    <td valign="top" align="left" class="{$cell_style}">
                        {$row['group_name']}
                    </td>
                    <td valign="top" align="center" class="{$cell_style}">
                        <input type="radio" class="radio" disabled="disabled" />
                    </td>
                    <td valign="top" align="center" class="{$cell_style}">
                        <input type="radio" class="radio" disabled="disabled" />
                    </td>
                    <td valign="top" align="center" class="{$cell_style}">
                        <input type="radio" class="radio" disabled="disabled" />
                    </td>
                    <td valign="top" align="center" class="{$cell_style}">
                        <input type="radio" class="radio" checked="checked" />
                    </td>
EOT;
        } else {
            $row['permission'] = mysql_result(cpg_db_query("SELECT value FROM {$CONFIG['TABLE_CONFIG']} WHERE name = 'plugin_annotate_permissions_{$row['group_id']}'"), 0);
            echo <<<EOT
                    <td valign="top" align="left" class="{$cell_style}">
                        {$row['group_name']}
                    </td>
EOT;
            for ($i = 0; $i <= 3; $i++) {
                if (!is_numeric($row['permission']) && $i == 0) {
                    $checked = "checked=\"checked\"";
                } else {
                    $checked = $row['permission'] == $i ? "checked=\"checked\"" : "";
                }
                echo <<<EOT
                    <td valign="top" align="center" class="{$cell_style}">
                        <input type="radio" name="plugin_annotate_permissions_{$row['group_id']}" id="plugin_annotate_permissions_{$row['group_id']}_{$i}" class="radio" value="{$i}" {$checked} />
                    </td>
EOT;
            }
        }
        // display notes --- start
        if ($CONFIG['plugin_annotate_display_notes_' . $row['group_id']] == '1') {
            $checked = 'checked="checked"';
        } else {
            $checked = '';
        }
        echo <<<EOT
                    <td valign="top" align="center" class="{$cell_style}">
                        <input type="checkbox" name="plugin_annotate_display_notes_{$row['group_id']}" id="plugin_annotate_display_notes_{$row['group_id']}" class="checkbox" value="1" {$checked} />
                    </td>
EOT;
        // display notes --- end
        // display links --- start
        if ($CONFIG['plugin_annotate_display_links_' . $row['group_id']] == '1') {
            $checked = 'checked="checked"';
        } else {
            $checked = '';
        }
        echo <<<EOT
                    <td valign="top" align="center" class="{$cell_style}">
                        <input type="checkbox" name="plugin_annotate_display_links_{$row['group_id']}" id="plugin_annotate_display_links_{$row['group_id']}" class="checkbox" value="1" {$checked} />
                    </td>
EOT;
        // display links --- end
        // display stats --- start
        if ($CONFIG['plugin_annotate_display_stats_' . $row['group_id']] == '1') {
            $checked = 'checked="checked"';
        } else {
            $checked = '';
        }
        echo <<<EOT
                    <td valign="top" align="center" class="{$cell_style}">
                        <input type="checkbox" name="plugin_annotate_display_stats_{$row['group_id']}" id="plugin_annotate_display_stats_{$row['group_id']}" class="checkbox" value="1" {$checked} />
                    </td>
EOT;
        // display stats --- end
        $loopCounter++;
        echo <<<EOT
                    </tr>
EOT;
    }
    // while-loop mysql_fetch_assoc groups --- end
    mysql_free_result($result);
    // Group output --- end
    echo <<<EOT
                    <tr>
                        <td valign="middle" class="tablef">
                        </td>
                        <td valign="middle" class="tablef" colspan="7">
                            <input type="hidden" name="form_token" value="{$form_token}" />
                            <input type="hidden" name="timestamp" value="{$timestamp}" />
                            <button type="submit" class="button" name="submit" value="{$lang_common['ok']}">{$annotate_icon_array['ok']}{$lang_common['ok']}</button>
                        </td>
                    </tr>
EOT;
    endtable();
    echo <<<EOT
            {$additional_submit_information}
            </form>

EOT;
}
コード例 #22
0
ファイル: codebase.php プロジェクト: phill104/branches
function external_tracker_uninstall()
{
    global $CONFIG;
    if (!checkFormToken()) {
        cpg_die(ERROR, $lang_errors['invalid_form_token'], __FILE__, __LINE__);
    }
    // the cookie is removed always, config on request
    $superCage = Inspekt::makeSuperCage();
    if (!$superCage->post->keyExists('remove')) {
        setcookie($CONFIG['cookie_name'] . '_ext_stats', 'no', time() - 600, $CONFIG['cookie_path']);
        return 1;
    }
    if ($superCage->post->getEscaped('remove')) {
        cpg_db_query("DROP TABLE IF EXISTS {$CONFIG['TABLE_PREFIX']}plugin_external_tracker");
        setcookie($CONFIG['cookie_name'] . '_ext_stats', 'no', time() - 600, $CONFIG['cookie_path']);
    }
    return true;
}
コード例 #23
0
 /**
  * 删除区域
  *
  */
 public function del_area()
 {
     if ($this->isAjax()) {
         if (C('TOKEN_ON') && !checkFormToken($_REQUEST)) {
             die('hack attemp.');
         }
         $id = intval($_REQUEST['id']);
         $cityModel = D('City');
         if ($cityModel->del_city($id)) {
             $this->ajaxReturn('', buildFormToken(), 1);
         } else {
             $this->ajaxReturn('', '', 0);
         }
     }
 }
コード例 #24
0
 /**
  * 取消推荐到首页
  *
  */
 public function unrec()
 {
     if ($this->isAjax()) {
         if (C('TOKEN_ON') && !checkFormToken($_REQUEST)) {
             die('hack attemp.');
         }
         if (empty($_REQUEST['id'])) {
             $this->ajaxReturn('', '请选择店铺', 0);
         }
         $id = $_REQUEST['id'];
         if (M('tao_shop_rec')->where("id IN ({$id})")->delete()) {
             //清除缓存
             $params = null;
             B('TaoShopRecs', $params);
             $this->ajaxReturn('', buildFormToken(), 1);
         } else {
             $this->ajaxReturn('', '操作失败', 0);
         }
     }
 }
コード例 #25
0
ファイル: codebase.php プロジェクト: phill104/branches
function social_bookmarks_configure()
{
    global $CONFIG, $THEME_DIR, $thisplugin, $lang_plugin_social_bookmarks, $lang_common, $social_bookmarks_icon_array, $lang_errors, $social_bookmarks_installation, $socialBookmarks_title;
    $superCage = Inspekt::makeSuperCage();
    if (!GALLERY_ADMIN_MODE) {
        cpg_die(ERROR, $lang_errors['access_denied'], __FILE__, __LINE__);
    }
    // Form submit?
    if ($superCage->post->keyExists('submit') == TRUE) {
        //Check if the form token is valid
        if (!checkFormToken()) {
            cpg_die(ERROR, $lang_errors['invalid_form_token'], __FILE__, __LINE__);
        }
        $config_changes_counter = social_bookmarks_configuration_submit();
        if ($config_changes_counter > 0) {
            $additional_submit_information = '<div class="cpg_message_success">' . $lang_plugin_social_bookmarks['changes_saved'] . '</div>';
        } else {
            $additional_submit_information = '<div class="cpg_message_validation">' . $lang_plugin_social_bookmarks['no_changes'] . '</div>';
        }
    }
    // Set the option output stuff
    if ($CONFIG['plugin_social_bookmarks_position'] == '0') {
        $option_output['plugin_social_bookmarks_position_placeholder_token'] = 'checked="checked"';
        $option_output['plugin_social_bookmarks_position_content_of_main_page'] = '';
        $option_output['plugin_social_bookmarks_position_sys_menu'] = '';
        $option_output['plugin_social_bookmarks_position_sub_menu'] = '';
    } elseif ($CONFIG['plugin_social_bookmarks_position'] == '1') {
        //
        $option_output['plugin_social_bookmarks_position_placeholder_token'] = '';
        $option_output['plugin_social_bookmarks_position_content_of_main_page'] = 'checked="checked"';
        $option_output['plugin_social_bookmarks_position_sys_menu'] = '';
        $option_output['plugin_social_bookmarks_position_sub_menu'] = '';
    } elseif ($CONFIG['plugin_social_bookmarks_position'] == '2') {
        //
        $option_output['plugin_social_bookmarks_position_placeholder_token'] = '';
        $option_output['plugin_social_bookmarks_position_content_of_main_page'] = '';
        $option_output['plugin_social_bookmarks_position_sys_menu'] = 'checked="checked"';
        $option_output['plugin_social_bookmarks_position_sub_menu'] = '';
    } elseif ($CONFIG['plugin_social_bookmarks_position'] == '3') {
        //
        $option_output['plugin_social_bookmarks_position_placeholder_token'] = '';
        $option_output['plugin_social_bookmarks_position_content_of_main_page'] = '';
        $option_output['plugin_social_bookmarks_position_sys_menu'] = '';
        $option_output['plugin_social_bookmarks_position_sub_menu'] = 'checked="checked"';
    }
    if ($CONFIG['plugin_social_bookmarks_visibility'] == '0') {
        $option_output['plugin_social_bookmarks_visibility_always_visible'] = 'checked="checked"';
        $option_output['plugin_social_bookmarks_visibility_expand_on_click'] = '';
        $option_output['plugin_social_bookmarks_visibility_expand_on_mouseover'] = '';
        $option_output['plugin_social_bookmarks_visibility_display_popup'] = '';
    } elseif ($CONFIG['plugin_social_bookmarks_visibility'] == '1') {
        //
        $option_output['plugin_social_bookmarks_visibility_always_visible'] = '';
        $option_output['plugin_social_bookmarks_visibility_expand_on_click'] = 'checked="checked"';
        $option_output['plugin_social_bookmarks_visibility_expand_on_mouseover'] = '';
        $option_output['plugin_social_bookmarks_visibility_display_popup'] = '';
    } elseif ($CONFIG['plugin_social_bookmarks_visibility'] == '2') {
        //
        $option_output['plugin_social_bookmarks_visibility_always_visible'] = '';
        $option_output['plugin_social_bookmarks_visibility_expand_on_click'] = '';
        $option_output['plugin_social_bookmarks_visibility_expand_on_mouseover'] = 'checked="checked"';
        $option_output['plugin_social_bookmarks_visibility_display_popup'] = '';
    } elseif ($CONFIG['plugin_social_bookmarks_visibility'] == '3') {
        //
        $option_output['plugin_social_bookmarks_visibility_always_visible'] = '';
        $option_output['plugin_social_bookmarks_visibility_expand_on_click'] = '';
        $option_output['plugin_social_bookmarks_visibility_expand_on_mouseover'] = '';
        $option_output['plugin_social_bookmarks_visibility_display_popup'] = 'checked="checked"';
    }
    if ($CONFIG['plugin_social_bookmarks_greyout'] == '0') {
        $option_output['plugin_social_bookmarks_greyout'] = '';
    } else {
        $option_output['plugin_social_bookmarks_greyout'] = 'checked="checked"';
    }
    if ($CONFIG['plugin_social_bookmarks_layout'] == '0') {
        $option_output['plugin_social_bookmarks_layout_simple_list'] = 'checked="checked"';
        $option_output['plugin_social_bookmarks_layout_advanced_list'] = '';
        $option_output['plugin_social_bookmarks_layout_icons_only'] = '';
    } elseif ($CONFIG['plugin_social_bookmarks_layout'] == '1') {
        //
        $option_output['plugin_social_bookmarks_layout_simple_list'] = '';
        $option_output['plugin_social_bookmarks_layout_advanced_list'] = 'checked="checked"';
        $option_output['plugin_social_bookmarks_layout_icons_only'] = '';
    } elseif ($CONFIG['plugin_social_bookmarks_layout'] == '2') {
        //
        $option_output['plugin_social_bookmarks_layout_simple_list'] = '';
        $option_output['plugin_social_bookmarks_layout_advanced_list'] = '';
        $option_output['plugin_social_bookmarks_layout_icons_only'] = 'checked="checked"';
    }
    if ($CONFIG['plugin_social_bookmarks_smart_language'] == '0') {
        $option_output['plugin_social_bookmarks_smart_language'] = '';
    } else {
        $option_output['plugin_social_bookmarks_smart_language'] = 'checked="checked"';
    }
    if ($CONFIG['plugin_social_bookmarks_admin_menu'] == '0') {
        $option_output['plugin_social_bookmarks_admin_menu'] = '';
    } else {
        $option_output['plugin_social_bookmarks_admin_menu'] = 'checked="checked"';
    }
    // Create the table row that is displayed during initial install
    if ($social_bookmarks_installation == 1) {
        $additional_submit_information = '<div class="cpg_message_info">' . $lang_plugin_social_bookmarks['submit_to_install'] . '</div>';
    }
    list($timestamp, $form_token) = getFormToken();
    // Start the actual output
    echo <<<EOT
            <form action="" method="post" name="social_bookmarks_config" id="social_bookmarks_config">
EOT;
    starttable('100%', $social_bookmarks_icon_array['configure'] . $lang_plugin_social_bookmarks['config'], 3);
    echo <<<EOT
                    <tr>
                        <td valign="top" class="tableh2" colspan="3">
                            {$lang_plugin_social_bookmarks['site_integration']}
                        </td>
                    </tr>
                    <tr>
                        <td valign="top" class="tableb" rowspan="4">
                            {$lang_plugin_social_bookmarks['position_of_button']}
                        </td>
                        <td valign="top" class="tableb">
                            <input type="radio" name="plugin_social_bookmarks_position" id="plugin_social_bookmarks_position_placeholder_token" class="radio" value="0" {$option_output['plugin_social_bookmarks_position_placeholder_token']} /> 
                        </td>
                        <td valign="top" class="tableb">
                        \t<label for="plugin_social_bookmarks_position_placeholder_token" class="clickable_option">
                        \t    {$lang_plugin_social_bookmarks['placeholder_token']} ({$lang_plugin_social_bookmarks['placeholder_token_explain1']})
                        \t    <br />
                        \t    <span class="album_stat">
                        \t        {$lang_plugin_social_bookmarks['placeholder_token_explain2']}
                        \t    </span>
                        \t</label>
                        </td>
                    </tr>
                    <tr>
                          <td valign="top" class="tableb">
                            <input type="radio" name="plugin_social_bookmarks_position" id="plugin_social_bookmarks_position_content_of_main_page" class="radio" value="1" {$option_output['plugin_social_bookmarks_position_content_of_main_page']} /> 
                        </td>
                        <td valign="top" class="tableb">
                        \t<label for="plugin_social_bookmarks_position_content_of_main_page" class="clickable_option">
                        \t    {$lang_plugin_social_bookmarks['content_of_main_page']} ({$lang_plugin_social_bookmarks['content_of_main_page_explain1']})
                        \t    <br />
                        \t    <span class="album_stat">
                        \t        {$lang_plugin_social_bookmarks['content_of_main_page_explain2']}
                        \t    </span>
                        \t</label>
                        </td>
                    </tr>
                    <tr>
                        <td valign="top" class="tableb">
                            <input type="radio" name="plugin_social_bookmarks_position" id="plugin_social_bookmarks_position_sys_menu" class="radio" value="2" {$option_output['plugin_social_bookmarks_position_sys_menu']} /> 
                        </td>
                        <td valign="top" class="tableb">
                        \t<label for="plugin_social_bookmarks_position_sys_menu" class="clickable_option">
                        \t    {$lang_plugin_social_bookmarks['sys_menu']} ({$lang_plugin_social_bookmarks['menu_explain1']})
                        \t</label>
                        </td>
                    </tr>
                    <tr>
                        <td valign="top" class="tableb">
                            <input type="radio" name="plugin_social_bookmarks_position" id="plugin_social_bookmarks_position_sub_menu" class="radio" value="3" {$option_output['plugin_social_bookmarks_position_sub_menu']} /> 
                        </td>
                        <td valign="top" class="tableb">
                        \t<label for="plugin_social_bookmarks_position_sub_menu" class="clickable_option">
                        \t    {$lang_plugin_social_bookmarks['sub_menu']} ({$lang_plugin_social_bookmarks['menu_explain1']})
                        \t</label>
                        </td>
                    </tr>
                    <tr>
                        <td valign="top" class="tableh2" colspan="3">
                            {$lang_plugin_social_bookmarks['design']}
                        </td>
                    </tr>
                    <tr>
                        <td valign="top" class="tableb">
                            {$lang_plugin_social_bookmarks['visibility_of_details']}
                        </td>
                        <td valign="top" class="tableb" colspan="2">
                            <input type="radio" name="plugin_social_bookmarks_visibility" id="plugin_social_bookmarks_visibility_always_visible" class="radio" value="0" {$option_output['plugin_social_bookmarks_visibility_always_visible']} /> 
                        \t<label for="plugin_social_bookmarks_visibility_always_visible" class="clickable_option">
                        \t    {$lang_plugin_social_bookmarks['always_visible']} ({$lang_plugin_social_bookmarks['not_recommended']})
                        \t</label>
                            <br />
                            <input type="radio" name="plugin_social_bookmarks_visibility" id="plugin_social_bookmarks_visibility_expand_on_click" class="radio" value="1" {$option_output['plugin_social_bookmarks_visibility_expand_on_click']} /> 
                            <label for="plugin_social_bookmarks_visibility_expand_on_click" class="clickable_option">
                        \t    {$lang_plugin_social_bookmarks['expand_on_click']} ({$lang_plugin_social_bookmarks['recommended']})
                        \t</label>
                            <br />   
                            <input type="radio" name="plugin_social_bookmarks_visibility" id="plugin_social_bookmarks_visibility_expand_on_mouseover" class="radio" value="2" {$option_output['plugin_social_bookmarks_visibility_expand_on_mouseover']} /> 
                        \t<label for="plugin_social_bookmarks_visibility_expand_on_mouseover" class="clickable_option">
                        \t    {$lang_plugin_social_bookmarks['expand_on_mouseover']}
                        \t</label>
                            <br />
                            <input type="radio" name="plugin_social_bookmarks_visibility" id="plugin_social_bookmarks_visibility_display_popup" class="radio" value="3" {$option_output['plugin_social_bookmarks_visibility_display_popup']} disabled="disabled" /> 
                        \t<label for="plugin_social_bookmarks_visibility_display_popup" class="clickable_option">
                        \t    {$lang_plugin_social_bookmarks['display_popup']}
                        \t</label>
                        </td>
                    </tr>
\t\t\t\t\t<tr>
                        <td valign="top" class="tableb tableb_alternate">
                            <label for="plugin_social_bookmarks_greyout" class="clickable_option">
                                {$lang_plugin_social_bookmarks['grey_out']}
                            </label>
                        </td>
                        <td valign="top" class="tableb tableb_alternate" colspan="2">
\t\t\t\t\t\t\t<input type="checkbox" name="plugin_social_bookmarks_greyout" id="plugin_social_bookmarks_greyout" class="checkbox" value="1" {$option_output['plugin_social_bookmarks_greyout']} />
\t\t\t\t\t\t\t<label for="plugin_social_bookmarks_greyout" class="clickable_option">
                        \t    {$lang_plugin_social_bookmarks['grey_out_explain1']}
                        \t</label>
                        </td>
                    </tr>
                    <tr>
                        <td valign="top" class="tableb">
                            {$lang_plugin_social_bookmarks['layout']}
                        </td>
                        <td valign="top" class="tableb" colspan="2">
                            <input type="radio" name="plugin_social_bookmarks_layout" id="plugin_social_bookmarks_layout_simple_list" class="radio" value="0" {$option_output['plugin_social_bookmarks_layout_simple_list']} /> 
                        \t<label for="plugin_social_bookmarks_layout_simple_list" class="clickable_option">
                        \t    {$lang_plugin_social_bookmarks['simple_list']} ({$lang_plugin_social_bookmarks['simple_list_explain1']})
                        \t</label>
                            <br />
                            <input type="radio" name="plugin_social_bookmarks_layout" id="plugin_social_bookmarks_layout_advanced_list" class="radio" value="1" {$option_output['plugin_social_bookmarks_layout_advanced_list']} /> 
                            <label for="plugin_social_bookmarks_layout_advanced_list" class="clickable_option">
                        \t    {$lang_plugin_social_bookmarks['advanced_list']} ({$lang_plugin_social_bookmarks['advanced_list_explain1']})
                        \t</label>
                            <br />   
                            <input type="radio" name="plugin_social_bookmarks_layout" id="plugin_social_bookmarks_layout_icons_only" class="radio" value="2" {$option_output['plugin_social_bookmarks_layout_icons_only']} />
                        \t<label for="plugin_social_bookmarks_layout_icons_only" class="clickable_option">
                        \t    {$lang_plugin_social_bookmarks['icons_only']} ({$lang_plugin_social_bookmarks['recommended']})
                        \t</label>
                        </td>
                    </tr>
                    <tr>
                        <td valign="top" class="tableb tableb_alternate">
                            {$lang_plugin_social_bookmarks['number_of_columns']}
                        </td>
                        <td valign="top" class="tableb tableb_alternate" colspan="2">
                        \t<input type="text" name="plugin_social_bookmarks_columns" id="plugin_social_bookmarks_columns" class="textinput spin-button" size="2" maxlength="2" value="{$CONFIG['plugin_social_bookmarks_columns']}" />
                        </td>
                    </tr>
                    <tr>
                        <td valign="top" class="tableh2" colspan="3">
                            {$lang_plugin_social_bookmarks['options']}
                        </td>
                    </tr>
                    <tr>
                        <td valign="top" class="tableb">
                            <label for="plugin_social_bookmarks_smart_language" class="clickable_option">
                                {$lang_plugin_social_bookmarks['smart_language']}
                            </label>
                        </td>
                        <td valign="top" class="tableb" colspan="2">
                            <input type="checkbox" name="plugin_social_bookmarks_smart_language" id="plugin_social_bookmarks_smart_language" class="checkbox" value="1" {$option_output['plugin_social_bookmarks_smart_language']} /> 
                        \t<label for="plugin_social_bookmarks_smart_language" class="clickable_option">
                        \t    {$lang_plugin_social_bookmarks['smart_language_explain1']} ({$lang_plugin_social_bookmarks['recommended']})
                        \t</label>
                        </td>
                    </tr>
                    <tr>
                        <td valign="top" class="tableb tableb_alternate">
                            <label for="plugin_social_bookmarks_admin_menu" class="clickable_option">
                                {$lang_plugin_social_bookmarks['admin_menu_item']}
                            </label>
                        </td>
                        <td valign="top" class="tableb tableb_alternate" colspan="2">
                            <input type="checkbox" name="plugin_social_bookmarks_admin_menu" id="plugin_social_bookmarks_admin_menu" class="checkbox" value="1" {$option_output['plugin_social_bookmarks_admin_menu']} /> 
                        \t<label for="plugin_social_bookmarks_admin_menu" class="clickable_option">
                        \t    {$lang_plugin_social_bookmarks['admin_menu_item_explain1']}
                        \t</label>
                        </td>
                    </tr>
                    <tr>
                        <td valign="top" class="tableh2" colspan="3">
                            {$lang_plugin_social_bookmarks['services']}
                        </td>
                    </tr>
                    <tr>
                        <td valign="top" class="tableb">
                            {$lang_plugin_social_bookmarks['available_services']}
                        </td>
                        <td valign="top" class="tableb" colspan="2">
EOT;
    starttable('100%');
    echo <<<EOT
                            <tr>
                                <th valign="top" class="tableh1">
                                    {$lang_plugin_social_bookmarks['active']}
                                </th>
                                <th valign="top" class="tableh1">
                                    {$lang_plugin_social_bookmarks['service_name']}
                                </th>
\t\t\t\t\t\t\t\t<th valign="top" class="tableh1">
                                    {$lang_plugin_social_bookmarks['link']}
                                </th>
                                <th valign="top" class="tableh1">
                                    {$lang_plugin_social_bookmarks['relevance']}
                                </th>
                                <th valign="top" class="tableh1">
                                    {$lang_plugin_social_bookmarks['languages']}
                                </th>
                            </tr>
EOT;
    $result = cpg_db_query("SELECT * FROM {$CONFIG['TABLE_PREFIX']}plugin_social_bookmarks_services");
    $loopCounter = 0;
    while ($row = mysql_fetch_assoc($result)) {
        if ($row['icon_filename'] != '' && file_exists('plugins/social_bookmarks/images/services/' . $row['icon_filename']) == TRUE) {
            $service_icon = '<img src="plugins/social_bookmarks/images/services/' . $row['icon_filename'] . '" border="0" width="16" height="16" alt="" align="left" class="icon" />';
        } else {
            $service_icon = '<img src="images/spacer.gif" border="0" width="16" height="16" alt="" align="left" class="icon" />';
        }
        if ($loopCounter / 2 == floor($loopCounter / 2)) {
            $tableCellStyle = 'tableb tableb_alternate';
        } else {
            $tableCellStyle = 'tableb';
        }
        $row['service_url'] = str_replace('{u}', urlencode(social_bookmarks_pagelink()), $row['service_url']);
        $row['service_url'] = str_replace('{t}', urlencode($socialBookmarks_title), $row['service_url']);
        unset($service_language);
        $service_language = explode('|', $row['service_lang']);
        $languageFlagString = '';
        foreach ($service_language as $countryLanguage) {
            if ($countryLanguage == 'en') {
                $countryLanguage = 'us';
            }
            if (is_file('images/flags/' . $countryLanguage . '.png') == TRUE) {
                $languageFlagString .= '<img src="images/flags/' . $countryLanguage . '.png" border="0" width="16" height="11" alt="" title="' . $lang_plugin_social_bookmarks[$countryLanguage] . '" /> ';
            } elseif ($countryLanguage == 'multi') {
                $languageFlagString .= cpg_fetch_icon('babelfish', 0, $lang_plugin_social_bookmarks[$countryLanguage]);
            }
        }
        if ($row['service_active'] == 'YES') {
            $option_output['service'] = 'checked="checked"';
        } else {
            $option_output['service'] = '';
        }
        $link_title = sprintf($lang_plugin_social_bookmarks['go_to_servicename'], $row['service_name_full']);
        $relevance = '';
        if ($row['relevance'] < 1 || $row['relevance'] > 10) {
            $row['relevance'] = 0;
        }
        if ($row['relevance'] != 0) {
            $relevance = theme_display_bar($row['relevance'], 10, 150, 'lightsteelblue', '', '', 'lightsteelblue', '');
        }
        $loopCounter++;
        echo <<<EOT
                            <tr>
                                <td valign="top" align="center" class="{$tableCellStyle}">
                                    <input type="checkbox" class="checkbox" name="service_active[{$row['service_id']}]" id="service_active_{$row['service_id']}" value="1" {$option_output['service']} />
                                </td>
                                <td valign="top" class="{$tableCellStyle}">
                                    <label for="service_active_{$row['service_id']}" class="clickable_option">
                                    {$service_icon}
                                    {$row['service_name_full']}
                                    </label>
                                </td>
\t\t\t\t\t\t\t\t<td valign="top" class="{$tableCellStyle}">
                                    <a href="{$row['service_url']}" rel="external">
                                    <img src="images/link.gif" border="0" width="16" height="16" alt="" title="{$link_title}" />
                                    </a>
                                </td>
                                <td valign="top" class="{$tableCellStyle}">
                                    <div title="{$lang_plugin_social_bookmarks['relevance']}: {$row['relevance']}" class="social_bookmarks_relevance">{$relevance}</div>
                                </td>
                                <td valign="top" class="{$tableCellStyle}">
                                    <span class="album_stat">
                                        {$languageFlagString}
                                    </span>
                                </td>
                            </tr>
EOT;
    }
    mysql_free_result($result);
    endtable();
    echo <<<EOT
                        </td>
                    </tr>
                    <tr>
                        <td valign="middle" class="tablef">
                        </td>
                        <td valign="middle" class="tablef" colspan="2">
                            <input type="hidden" name="form_token" value="{$form_token}" />
                            <input type="hidden" name="timestamp" value="{$timestamp}" />
                            <button type="submit" class="button" name="submit" value="{$lang_common['ok']}">{$social_bookmarks_icon_array['ok']}{$lang_common['ok']}</button>
                        </td>
                    </tr>
EOT;
    endtable();
    echo <<<EOT
            {$additional_submit_information}
            </form>

EOT;
}
コード例 #26
0
ファイル: admin.php プロジェクト: phill104/branches
    cpg_die(ERROR, $lang_errors['access_denied'], __FILE__, __LINE__);
}
require_once "./plugins/limit_upload/lang/english.php";
if ($CONFIG['lang'] != 'english' && file_exists("./plugins/limit_upload/lang/{$CONFIG['lang']}.php")) {
    require_once "./plugins/limit_upload/lang/{$CONFIG['lang']}.php";
}
$plugin_limit_upload_icon_array['submit'] = cpg_fetch_icon('ok', 1);
if (in_array('js/jquery.spinbutton.js', $JS['includes']) != TRUE) {
    $JS['includes'][] = 'js/jquery.spinbutton.js';
}
$JS['includes'][] = 'plugins/limit_upload/script.js';
pageheader($lang_plugin_limit_upload['limit_upload'] . " - " . $lang_gallery_admin_menu['admin_lnk']);
$superCage = Inspekt::makeSuperCage();
global $lang_common;
if ($superCage->post->keyExists('submit')) {
    if (!checkFormToken()) {
        global $lang_errors;
        cpg_die(ERROR, $lang_errors['invalid_form_token'], __FILE__, __LINE__);
    }
    if (is_numeric($superCage->post->getInt('upload_limit'))) {
        if ($superCage->post->getInt('upload_limit') >= 0) {
            cpg_db_query("UPDATE {$CONFIG['TABLE_CONFIG']} SET value = '" . $superCage->post->getInt('upload_limit') . "' WHERE name = 'limit_upload_upload_limit'");
        }
    }
    if (array_key_exists($superCage->post->getAlpha('time_limit'), $lang_plugin_limit_upload['upload_limit_values'])) {
        cpg_db_query("UPDATE {$CONFIG['TABLE_CONFIG']} SET value = '" . $superCage->post->getAlpha('time_limit') . "' WHERE name = 'limit_upload_time_limit'");
    }
    starttable("100%", $lang_common['information']);
    echo <<<EOT
        <tr>
            <td class="tableb" width="200">
コード例 #27
0
 public function del()
 {
     if ($this->isAjax()) {
         if (C('TOKEN_ON') && !checkFormToken($_REQUEST)) {
             die('hack attemp.');
         }
         $id = intval($_REQUEST['id']);
         $ccmModel = D('MallPromotion');
         if ($ccmModel->_delete($id)) {
             $this->ajaxReturn('', buildFormToken(), 1);
         } else {
             $this->ajaxReturn('', '删除失败', 0);
         }
     }
 }
コード例 #28
0
 /**
  * 删除管理员账户
  *
  */
 public function del()
 {
     if ($this->isAjax()) {
         if (C('TOKEN_ON') && !checkFormToken($_REQUEST)) {
             die('hack attemp.');
         }
         $user_id = intval($_REQUEST['id']);
         $auModel = D('AdminUsers');
         if ($auModel->_delete($user_id)) {
             //删除角色信息
             $ausModel = D('AdminUserRole');
             $ausModel->_del($user_id);
             $this->ajaxReturn('', buildFormToken(), 1);
         } else {
             $this->ajaxReturn('', '', 0);
         }
     }
 }
コード例 #29
0
    if ($superCage->post->keyExists('send_login_data') && trim($user_email)) {
        require 'include/mailer.inc.php';
        $template_vars = array('{SITE_NAME}' => $CONFIG['gallery_name'], '{SITE_LINK}' => $CONFIG['site_url'], '{USER_NAME}' => trim($user_name), '{USER_PASS}' => trim($user_password));
        if (!cpg_mail(trim($user_email), $lang_usermgr_php['send_login_email_subject'], nl2br(strtr($lang_usermgr_php['send_login_data_email'], $template_vars)))) {
            cpg_die(CRITICAL_ERROR, $lang_usermgr_php['failed_sending_email'], __FILE__, __LINE__);
        }
    } elseif ($user_data['user_actkey'] && $user_data['user_active'] == 'NO' && $user_active == 'YES') {
        // send activation confirmation email (only once)
        require 'include/mailer.inc.php';
        $template_vars = array('{SITE_LINK}' => $CONFIG['site_url'], '{USER_NAME}' => $user_data['user_name'], '{SITE_NAME}' => $CONFIG['gallery_name']);
        cpg_mail($user_data['user_email'], sprintf($lang_register_php['notify_user_email_subject'], $CONFIG['gallery_name']), nl2br(strtr($lang_register_php['activated_email'], $template_vars)));
    }
}
$op = GALLERY_ADMIN_MODE && ($matches = $superCage->get->getMatched('op', '/^[a-z_]+$/')) ? $matches[0] : '';
//Check if the form token is valid
if ($op != '' && !checkFormToken()) {
    cpg_die(ERROR, $lang_errors['invalid_form_token'], __FILE__, __LINE__);
}
switch ($op) {
    case 'edit':
        $user_id = $superCage->get->keyExists('user_id') ? $superCage->get->getInt('user_id') : -1;
        if (USER_ID == $user_id) {
            cpg_die(ERROR, $lang_usermgr_php['err_edit_self'], __FILE__, __LINE__);
        }
        $cpg_udb->edit_users($user_id);
        pageheader($lang_usermgr_php['title']);
        edit_user($user_id);
        pagefooter();
        break;
    case 'update':
        $user_id = $superCage->get->keyExists('user_id') ? $superCage->get->getInt('user_id') : -1;
コード例 #30
0
/**
 * process_post_data()
 *
 * Function to process the form posted
 */
function process_post_data()
{
    global $CONFIG, $user_albums_list, $lang_errors;
    $superCage = Inspekt::makeSuperCage();
    //Check if the form token is valid
    if (!checkFormToken()) {
        cpg_die(ERROR, $lang_errors['invalid_form_token'], __FILE__, __LINE__);
    }
    $user_album_set = array();
    $result = cpg_db_query("SELECT aid FROM {$CONFIG['TABLE_ALBUMS']} WHERE category = " . (FIRST_USER_CAT + USER_ID) . " OR owner = " . USER_ID . " OR uploads = 'YES'");
    while ($row = $result->fetchAssoc()) {
        $user_album_set[$row['aid']] = 1;
    }
    $result->free();
    $pid_array = $superCage->post->getInt('pid');
    if (!is_array($pid_array)) {
        cpg_die(CRITICAL_ERROR, $lang_errors['param_missing'], __FILE__, __LINE__);
    }
    if ($superCage->post->keyExists('galleryicon')) {
        $galleryicon = $superCage->post->getInt('galleryicon');
    } else {
        $galleryicon = '';
    }
    foreach ($pid_array as $pid) {
        $aid = $superCage->post->getInt("aid{$pid}");
        $title = get_post_var('title', $pid);
        $caption = get_post_var('caption', $pid);
        $keywords = get_post_var('keywords', $pid);
        $user1 = get_post_var('user1', $pid);
        $user2 = get_post_var('user2', $pid);
        $user3 = get_post_var('user3', $pid);
        $user4 = get_post_var('user4', $pid);
        $delete = false;
        $reset_vcount = false;
        $reset_votes = false;
        $del_comments = false;
        $isgalleryicon = $galleryicon === $pid;
        if ($superCage->post->keyExists('delete' . $pid)) {
            $delete = $superCage->post->getInt('delete' . $pid);
        }
        if ($superCage->post->keyExists('reset_vcount' . $pid)) {
            $reset_vcount = $superCage->post->getInt('reset_vcount' . $pid);
        }
        if ($superCage->post->keyExists('reset_votes' . $pid)) {
            $reset_votes = $superCage->post->getInt('reset_votes' . $pid);
        }
        if ($superCage->post->keyExists('del_comments' . $pid)) {
            $del_comments = $superCage->post->getInt('del_comments' . $pid);
        }
        // We will be selecting pid in the query as we need it in $pic array for the plugin filter
        $query = "SELECT pid, category, filepath, filename, owner_id FROM {$CONFIG['TABLE_PICTURES']} AS p INNER JOIN {$CONFIG['TABLE_ALBUMS']} AS a ON a.aid = p.aid WHERE pid = {$pid}";
        $result = cpg_db_query($query);
        if (!$result->numRows()) {
            cpg_die(CRITICAL_ERROR, $lang_errors['non_exist_ap'], __FILE__, __LINE__);
        }
        $pic = $result->fetchAssoc(true);
        if (!GALLERY_ADMIN_MODE && !MODERATOR_MODE && !USER_ADMIN_MODE && !user_is_allowed() && !$CONFIG['users_can_edit_pics']) {
            if ($pic['category'] != FIRST_USER_CAT + USER_ID) {
                cpg_die(ERROR, $lang_errors['perm_denied'], __FILE__, __LINE__);
            }
            if (!isset($user_album_set[$aid])) {
                cpg_die(ERROR, $lang_errors['perm_denied'], __FILE__, __LINE__);
            }
        }
        cpg_trim_keywords($keywords);
        $update = "aid = '{$aid}'";
        $update .= ", title = '{$title}'";
        $update .= ", caption = '{$caption}'";
        $update .= ", keywords = '{$keywords}'";
        $update .= ", user1 = '{$user1}'";
        $update .= ", user2 = '{$user2}'";
        $update .= ", user3 = '{$user3}'";
        $update .= ", user4 = '{$user4}'";
        if ($isgalleryicon && $pic['category'] > FIRST_USER_CAT) {
            cpg_db_query("UPDATE {$CONFIG['TABLE_PICTURES']} SET galleryicon = 0 WHERE owner_id = {$pic['owner_id']}");
            $update .= ", galleryicon = " . $galleryicon;
        }
        if (is_movie($pic['filename'])) {
            $pwidth = $superCage->post->getInt('pwidth' . $pid);
            $pheight = $superCage->post->getInt('pheight' . $pid);
            $update .= ", pwidth = " . $pwidth;
            $update .= ", pheight = " . $pheight;
        }
        if ($reset_vcount) {
            $update .= ", hits = 0";
            resetDetailHits($pid);
        }
        if ($reset_votes) {
            $update .= ", pic_rating = 0, votes = 0";
            resetDetailVotes($pid);
        }
        if (GALLERY_ADMIN_MODE || UPLOAD_APPROVAL_MODE || MODERATOR_MODE) {
            $approved = '';
            if ($superCage->post->keyExists('approved' . $pid)) {
                $approved = $superCage->post->getAlpha('approved' . $pid);
            }
            if ($approved == 'YES') {
                $update .= ", approved = 'YES'";
            } else {
                $update .= ", approved = 'NO'";
            }
        }
        if ($del_comments || $delete) {
            cpg_db_query("DELETE FROM {$CONFIG['TABLE_COMMENTS']} WHERE pid = {$pid}");
        }
        if ($delete) {
            $dir = $CONFIG['fullpath'] . $pic['filepath'];
            $file = $pic['filename'];
            if (!is_writable($dir)) {
                cpg_die(CRITICAL_ERROR, sprintf($lang_errors['directory_ro'], $dir), __FILE__, __LINE__);
            }
            $files = array($dir . $file, $dir . $CONFIG['normal_pfx'] . $file, $dir . $CONFIG['orig_pfx'] . $file, $dir . $CONFIG['thumb_pfx'] . $file);
            // Check for custom thumbnails for non-images
            if (!is_image($file)) {
                $mime_content = cpg_get_type($file);
                $file_base_name = str_replace('.' . $mime_content['extension'], '', basename($file));
                foreach (array('.gif', '.png', '.jpg') as $thumb_extension) {
                    if (file_exists($dir . $CONFIG['thumb_pfx'] . $file_base_name . $thumb_extension)) {
                        // Thumbnail found, check if it's the only file using that thumbnail
                        $count = cpg_db_query("SELECT COUNT(*) FROM {$CONFIG['TABLE_PICTURES']} WHERE filepath = '{$pic['filepath']}' AND filename LIKE '{$file_base_name}.%'")->result(0);
                        if ($count == 1) {
                            unset($files[count($files) - 1]);
                            $files[] = $dir . $CONFIG['thumb_pfx'] . $file_base_name . $thumb_extension;
                            break;
                        }
                    }
                }
            }
            foreach ($files as $currFile) {
                if (is_file($currFile)) {
                    @unlink($currFile);
                }
            }
            // Plugin filter to be called before deleting a file
            CPGPluginAPI::action('before_delete_file', $pic);
            cpg_db_query("DELETE FROM {$CONFIG['TABLE_PICTURES']} WHERE pid = {$pid} LIMIT 1");
            cpg_db_query("UPDATE {$CONFIG['TABLE_ALBUMS']} SET thumb = '0' WHERE thumb = '{$pid}'");
            // Plugin filter to be called after a file is deleted
            CPGPluginAPI::action('after_delete_file', $pic);
        } else {
            cpg_db_query("UPDATE {$CONFIG['TABLE_PICTURES']} SET {$update} WHERE pid = {$pid}");
            // Executes after a file update is committed
            CPGPluginAPI::action('after_edit_file', $pid);
        }
    }
}