2006-12-02 04:36:16 +00:00
|
|
|
<?php
|
|
|
|
/*
|
2008-12-10 16:59:19 +00:00
|
|
|
* e107 website system
|
|
|
|
*
|
|
|
|
* Copyright (C) 2001-2008 e107 Inc (e107.org)
|
|
|
|
* Released under the terms and conditions of the
|
|
|
|
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
|
|
|
|
*
|
|
|
|
* Image Administration Area
|
|
|
|
*
|
|
|
|
* $Source: /cvs_backup/e107_0.8/e107_admin/image.php,v $
|
2008-12-10 23:46:47 +00:00
|
|
|
* $Revision: 1.13 $
|
|
|
|
* $Date: 2008-12-10 23:46:47 $
|
2008-12-10 16:59:19 +00:00
|
|
|
* $Author: secretr $
|
|
|
|
*
|
2006-12-02 04:36:16 +00:00
|
|
|
*/
|
|
|
|
require_once("../class2.php");
|
|
|
|
if (!getperms("A")) {
|
2008-12-10 16:59:19 +00:00
|
|
|
header("location:".e_HTTP."index.php");
|
2006-12-02 04:36:16 +00:00
|
|
|
exit;
|
|
|
|
}
|
2008-12-10 16:59:19 +00:00
|
|
|
|
2006-12-02 04:36:16 +00:00
|
|
|
$e_sub_cat = 'image';
|
2008-12-10 16:59:19 +00:00
|
|
|
|
2006-12-02 04:36:16 +00:00
|
|
|
require_once("auth.php");
|
|
|
|
require_once(e_HANDLER."form_handler.php");
|
|
|
|
require_once(e_HANDLER."userclass_class.php");
|
|
|
|
$rs = new form;
|
|
|
|
|
2008-12-10 16:59:19 +00:00
|
|
|
/*
|
|
|
|
* CLOSE - GO TO MAIN SCREEN
|
|
|
|
*/
|
|
|
|
if(isset($_POST['submit_cancel_show']))
|
2008-12-05 22:01:25 +00:00
|
|
|
{
|
2008-12-10 16:59:19 +00:00
|
|
|
header('Location: '.e_SELF);
|
|
|
|
exit();
|
2006-12-02 04:36:16 +00:00
|
|
|
}
|
|
|
|
|
2008-12-10 16:59:19 +00:00
|
|
|
/*
|
|
|
|
* DELETE CHECKED AVATARS - SHOW AVATAR SCREEN
|
|
|
|
*/
|
|
|
|
if (isset($_POST['submit_show_delete_multi']))
|
|
|
|
{
|
|
|
|
if(varset($_POST['multiaction']))
|
|
|
|
{
|
|
|
|
$tmp = array(); $tmp1 = array(); $message = array();
|
|
|
|
|
|
|
|
foreach ($_POST['multiaction'] as $todel)
|
|
|
|
{
|
|
|
|
$todel = explode('#', $todel);
|
|
|
|
$todel[1] = basename($todel[1]);
|
|
|
|
|
|
|
|
$image_type = 2;
|
|
|
|
if(strpos($todel[1], '-upload-') === 0)
|
|
|
|
{
|
|
|
|
$image_type = 1;
|
|
|
|
$todel[1] = substr($todel[1], strlen('-upload-'));
|
|
|
|
}
|
|
|
|
|
|
|
|
//delete it from server
|
|
|
|
@unlink(e_FILE."public/avatars/".$todel[1]);
|
|
|
|
|
|
|
|
//admin log & sysmessage
|
|
|
|
$message[] = $todel[1];
|
|
|
|
|
|
|
|
//It's owned by an user
|
|
|
|
if($todel[0])
|
|
|
|
{
|
|
|
|
switch ($image_type)
|
|
|
|
{
|
|
|
|
case 1: //avatar
|
|
|
|
$tmp[] = intval($todel[0]);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 2: //photo
|
|
|
|
$tmp1[] = intval($todel[0]);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//Reset all deleted user avatars with one query
|
|
|
|
if(!empty($tmp))
|
|
|
|
{
|
|
|
|
$sql->db_Update("user", "user_image='' WHERE user_id IN (".implode(',', $tmp).")");
|
|
|
|
}
|
|
|
|
//Reset all deleted user photos with one query
|
|
|
|
if(!empty($tmp1))
|
|
|
|
{
|
|
|
|
$sql->db_Update("user", "user_sess='' WHERE user_id IN (".implode(',', $tmp1).")");
|
|
|
|
}
|
|
|
|
unset($tmp, $tmp1);
|
|
|
|
|
|
|
|
//Format system message
|
|
|
|
if(!empty($message))
|
|
|
|
{
|
|
|
|
$admin_log->log_event('IMALAN_01', implode('[!br!]', $message), E_LOG_INFORMATIVE, '');
|
|
|
|
$message = implode(', ', $message).' '.IMALAN_28;
|
|
|
|
}
|
|
|
|
else $message = '';
|
|
|
|
}
|
|
|
|
}
|
2008-12-05 22:01:25 +00:00
|
|
|
|
2008-12-10 16:59:19 +00:00
|
|
|
/*
|
|
|
|
* DELETE ALL UNUSED IMAGES - SHOW AVATAR SCREEN
|
|
|
|
*/
|
|
|
|
if (isset($_POST['submit_show_deleteall']))
|
2008-12-05 22:01:25 +00:00
|
|
|
{
|
2006-12-02 04:36:16 +00:00
|
|
|
$handle = opendir(e_FILE."public/avatars/");
|
2008-12-10 16:59:19 +00:00
|
|
|
$dirlist = array();
|
2008-12-09 15:19:03 +00:00
|
|
|
while ($file = readdir($handle)) {
|
2008-12-10 16:59:19 +00:00
|
|
|
if (!is_dir(e_FILE."public/avatars/{$file}") && $file != '.' && $file != '..' && $file != "index.html" && $file != "null.txt" && $file != '/' && $file != 'CVS' && $file != 'Thumbs.db') {
|
2006-12-02 04:36:16 +00:00
|
|
|
$dirlist[] = $file;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
closedir($handle);
|
2008-12-10 16:59:19 +00:00
|
|
|
|
|
|
|
if(!empty($dirlist))
|
2008-12-05 22:01:25 +00:00
|
|
|
{
|
2008-12-10 16:59:19 +00:00
|
|
|
$imgList = '';
|
|
|
|
$count = 0;
|
|
|
|
foreach ($dirlist as $image_name)
|
|
|
|
{
|
|
|
|
$image_name = basename($image_name);
|
|
|
|
$image_todb = $tp->toDB($image_name);
|
|
|
|
if (!$sql->db_Count('user', '(*)', "WHERE user_image='-upload-{$image_todb}' OR user_sess='{$image_todb}'")) {
|
|
|
|
unlink(e_FILE."public/avatars/".$image_name);
|
|
|
|
$imgList .= '[!br!]'.$image_name;
|
|
|
|
$count++;
|
|
|
|
}
|
2006-12-02 04:36:16 +00:00
|
|
|
}
|
2008-12-10 16:59:19 +00:00
|
|
|
|
|
|
|
$message = $count." ".IMALAN_26;
|
|
|
|
$admin_log->log_event('IMALAN_02', $message.$imgList,E_LOG_INFORMATIVE, '');
|
|
|
|
unset($imgList);
|
2006-12-02 04:36:16 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-12-05 22:01:25 +00:00
|
|
|
|
2008-12-10 16:59:19 +00:00
|
|
|
/*
|
|
|
|
* DELETE ALL CHECKED BAD IMAGES - VALIDATE SCREEN
|
|
|
|
*/
|
|
|
|
if (isset($_POST['submit_avdelete_multi']))
|
2008-12-05 22:01:25 +00:00
|
|
|
{
|
2006-12-02 04:36:16 +00:00
|
|
|
require_once(e_HANDLER."avatar_handler.php");
|
2008-12-05 22:01:25 +00:00
|
|
|
$avList = array();
|
2008-12-10 16:59:19 +00:00
|
|
|
$tmp = array();
|
|
|
|
$uids = array();
|
|
|
|
//Sanitize
|
|
|
|
$_POST['multiaction'] = $tp->toDB($_POST['multiaction']);
|
|
|
|
|
|
|
|
//sql queries significant reduced
|
|
|
|
if(!empty($_POST['multiaction']) && $sql->db_Select("user", 'user_id, user_name, user_image', "user_id IN (".implode(',', $_POST['multiaction']).")"))
|
2006-12-02 04:36:16 +00:00
|
|
|
{
|
2008-12-10 16:59:19 +00:00
|
|
|
$search_users = $sql->db_getList('ALL', FALSE, FALSE, 'user_id');
|
|
|
|
foreach($_POST['multiaction'] as $uid)
|
2008-12-05 22:01:25 +00:00
|
|
|
{
|
2008-12-10 16:59:19 +00:00
|
|
|
if (varsettrue($search_users[$uid]))
|
|
|
|
{
|
|
|
|
$avname = avatar($search_users[$uid]['user_image']);
|
|
|
|
if (strpos($avname, "http://") === FALSE)
|
|
|
|
{ // Internal file, so unlink it
|
|
|
|
@unlink($avname);
|
|
|
|
}
|
|
|
|
|
|
|
|
$uids[] = $uid;
|
|
|
|
$tmp[] = $search_users[$uid]['user_name'];
|
|
|
|
$avList[] = $uid.':'.$search_users[$uid]['user_name'].':'.$search_users[$uid]['user_image'];
|
2006-12-02 04:36:16 +00:00
|
|
|
}
|
|
|
|
}
|
2008-12-10 16:59:19 +00:00
|
|
|
|
|
|
|
//sql queries significant reduced
|
|
|
|
if(!empty($uids))
|
|
|
|
{
|
|
|
|
$sql->db_Update("user", "user_image='' WHERE user_id IN (".implode(',', $uids).")");
|
|
|
|
}
|
|
|
|
|
|
|
|
$message = IMALAN_51.'<strong>'.implode(', ', $tmp).'</strong> '.IMALAN_28;
|
|
|
|
$admin_log->log_event('IMALAN_03', implode('[!br!]', $avList), E_LOG_INFORMATIVE, '');
|
|
|
|
unset($search_users);
|
2006-12-02 04:36:16 +00:00
|
|
|
}
|
2008-12-10 16:59:19 +00:00
|
|
|
unset($avList, $tmp, $uids);
|
|
|
|
|
2006-12-02 04:36:16 +00:00
|
|
|
}
|
|
|
|
|
2008-12-10 16:59:19 +00:00
|
|
|
/*
|
|
|
|
* UPDATE IMAGE OPTIONS - MAIN SCREEN
|
|
|
|
*/
|
2008-12-09 15:19:03 +00:00
|
|
|
if (isset($_POST['update_options']))
|
2008-12-05 22:01:25 +00:00
|
|
|
{
|
2008-12-10 16:59:19 +00:00
|
|
|
$tmp = array();
|
|
|
|
$tmp['image_post'] = intval($_POST['image_post']);
|
|
|
|
$tmp['resize_method'] = $tp->toDB($_POST['resize_method']);
|
|
|
|
$tmp['im_path'] = trim($tp->toDB($_POST['im_path']));
|
|
|
|
$tmp['image_post_class'] = intval($_POST['image_post_class']);
|
|
|
|
$tmp['image_post_disabled_method'] = intval($_POST['image_post_disabled_method']);
|
|
|
|
$tmp['enable_png_image_fix'] = intval($_POST['enable_png_image_fix']);
|
|
|
|
|
|
|
|
if ($admin_log->logArrayDiffs($tmp, $pref, 'IMALAN_04'))
|
2008-12-05 22:01:25 +00:00
|
|
|
{
|
2008-12-06 15:48:26 +00:00
|
|
|
save_prefs(); // Only save if changes
|
2008-12-05 22:01:25 +00:00
|
|
|
$message = IMALAN_9;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$message = IMALAN_20;
|
|
|
|
}
|
2006-12-02 04:36:16 +00:00
|
|
|
}
|
|
|
|
|
2008-12-10 16:59:19 +00:00
|
|
|
/*
|
|
|
|
* SYSTEM MESSAGE
|
|
|
|
*/
|
|
|
|
//FIXME - better message handler, sysmessages CSS rules
|
|
|
|
if (varsettrue($message))
|
2008-12-05 22:01:25 +00:00
|
|
|
{
|
2008-12-10 16:59:19 +00:00
|
|
|
//no tablerender for sys-messages anymore
|
|
|
|
$message = "
|
|
|
|
<div class='s-message info'><span>".$message."</span></div>
|
|
|
|
";
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$message = '';
|
2006-12-02 04:36:16 +00:00
|
|
|
}
|
|
|
|
|
2008-12-10 16:59:19 +00:00
|
|
|
/*
|
|
|
|
* SHOW AVATARS SCREEN
|
|
|
|
*/
|
2008-12-09 15:19:03 +00:00
|
|
|
if (isset($_POST['show_avatars']))
|
2008-12-05 22:01:25 +00:00
|
|
|
{
|
2006-12-02 04:36:16 +00:00
|
|
|
$handle = opendir(e_FILE."public/avatars/");
|
2008-12-10 16:59:19 +00:00
|
|
|
$dirlist = array();
|
2008-12-09 15:19:03 +00:00
|
|
|
while ($file = readdir($handle))
|
|
|
|
{
|
|
|
|
if ($file != '.' && $file != '..' && $file != "index.html" && $file != "null.txt" && $file != '/' && $file != 'CVS' && $file != 'Thumbs.db' && !is_dir($file))
|
2008-12-05 22:01:25 +00:00
|
|
|
{
|
2006-12-02 04:36:16 +00:00
|
|
|
$dirlist[] = $file;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
closedir($handle);
|
|
|
|
|
2008-12-09 15:19:03 +00:00
|
|
|
$text = '';
|
2006-12-02 04:36:16 +00:00
|
|
|
|
2008-12-10 16:59:19 +00:00
|
|
|
if (empty($dirlist))
|
2008-12-05 22:01:25 +00:00
|
|
|
{
|
2006-12-02 04:36:16 +00:00
|
|
|
$text .= IMALAN_29;
|
2008-12-09 15:19:03 +00:00
|
|
|
}
|
|
|
|
else
|
2008-12-05 22:01:25 +00:00
|
|
|
{
|
2008-12-09 17:49:59 +00:00
|
|
|
$text = "
|
2008-12-10 16:59:19 +00:00
|
|
|
<form method='post' action='".e_SELF."' id='core-iamge-show-avatars-form'>
|
|
|
|
<fieldset id='core-iamge-show-avatars'>
|
2008-12-09 17:49:59 +00:00
|
|
|
";
|
|
|
|
|
2008-12-09 15:19:03 +00:00
|
|
|
$count = 0;
|
|
|
|
while (list($key, $image_name) = each($dirlist))
|
2008-12-05 22:01:25 +00:00
|
|
|
{
|
2006-12-02 04:36:16 +00:00
|
|
|
$users = IMALAN_21." | ";
|
2008-12-10 16:59:19 +00:00
|
|
|
$row = array('user_id' => '');
|
|
|
|
$image_pre = '';
|
|
|
|
$disabled = '';
|
|
|
|
if ($sql->db_Select("user", "*", "user_image='-upload-".$tp->toDB($image_name)."' OR user_sess='".$tp->toDB($image_name)."'"))
|
2008-12-09 15:19:03 +00:00
|
|
|
{
|
|
|
|
/*
|
|
|
|
//Is it possible?! I don't think so
|
|
|
|
while ($row = $sql->db_Fetch())
|
|
|
|
{
|
2008-12-10 16:59:19 +00:00
|
|
|
extract($row); // kill this!!!
|
2006-12-02 04:36:16 +00:00
|
|
|
$users .= "<a href='".e_BASE."user.php?id.$user_id'>$user_name</a> <span class='smalltext'>(".($user_sess == $image_name ? IMALAN_24 : IMALAN_23).")</span> | ";
|
2008-12-09 15:19:03 +00:00
|
|
|
}*/
|
|
|
|
$row = $sql->db_Fetch();
|
2008-12-10 16:59:19 +00:00
|
|
|
if($row['user_image'] == '-upload-'.$image_name) $image_pre = '-upload-';
|
2008-12-09 15:19:03 +00:00
|
|
|
$users .= "<a href='".e_BASE."user.php?id.{$row['user_id']}'>{$row['user_name']}</a> <span class='smalltext'>(".($row['user_sess'] == $image_name ? IMALAN_24 : IMALAN_23).")</span>";
|
2006-12-02 04:36:16 +00:00
|
|
|
} else {
|
2008-12-09 15:19:03 +00:00
|
|
|
$users = '<span class="warning">'.IMALAN_22.'</span>';
|
2006-12-02 04:36:16 +00:00
|
|
|
}
|
|
|
|
|
2008-12-10 16:59:19 +00:00
|
|
|
//directory?
|
|
|
|
if(is_dir(e_FILE."public/avatars/".$image_name))
|
|
|
|
{
|
|
|
|
//File info
|
|
|
|
$users = "<a class='e-tooltip' href='#' title='".IMALAN_69.": {$image_name}'><img src='".e_IMAGE_ABS."admin_images/docs_16.png' alt='".IMALAN_66.": {$image_name}' /></a> <span class='error'>".IMALAN_69."</span>";
|
2008-12-09 15:19:03 +00:00
|
|
|
|
2008-12-10 16:59:19 +00:00
|
|
|
// Control over the image size (design)
|
|
|
|
$image_size = getimagesize(e_FILE."public/avatars/".$image_name);
|
2008-12-09 15:19:03 +00:00
|
|
|
|
2008-12-10 16:59:19 +00:00
|
|
|
//Friendly UI - click text to select a form element
|
|
|
|
$img_src = '<span class="error">'.IMALAN_70.'</span>';
|
|
|
|
$disabled = ' disabled="disabled"';
|
2008-12-09 15:19:03 +00:00
|
|
|
}
|
2008-12-10 16:59:19 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
//File info
|
|
|
|
$users = "<a class='e-tooltip' href='#' title='".IMALAN_66.": {$image_name}'><img src='".e_IMAGE_ABS."admin_images/docs_16.png' alt='".IMALAN_66.": {$image_name}' /></a> ".$users;
|
|
|
|
|
|
|
|
// Control over the image size (design)
|
|
|
|
$image_size = getimagesize(e_FILE."public/avatars/".$image_name);
|
2008-12-09 15:19:03 +00:00
|
|
|
|
2008-12-10 16:59:19 +00:00
|
|
|
//Friendly UI - click text to select a form element
|
|
|
|
$img_src = "<label for='image-action-{$count}' title='".IMALAN_56."'><img src='".e_FILE_ABS."public/avatars/{$image_name}' alt='{$image_name}' /></label>";
|
|
|
|
if ($image_size[0] > $pref['im_width'] || $image_size[1] > $pref['im_height'])
|
|
|
|
{
|
|
|
|
$img_src = "<a class='image-preview' href='".e_FILE_ABS."public/avatars/".rawurlencode($image_name)."' rel='external'>".IMALAN_57."</a>";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//style attribute allowed here - server side width/height control
|
|
|
|
//options class - used for JS selectors (see eCoreImage object)
|
2008-12-09 15:19:03 +00:00
|
|
|
$text .= "
|
2008-12-10 16:59:19 +00:00
|
|
|
<div class='image-box f-left center options' style='width: ".(intval($pref['im_width'])+40)."px; height: ".(intval($pref['im_height'])+100)."px;'>
|
2008-12-09 15:19:03 +00:00
|
|
|
<div class='spacer'>
|
|
|
|
<div class='image-users'>{$users}</div>
|
|
|
|
<div class='image-preview'>{$img_src}</div>
|
2008-12-09 17:49:59 +00:00
|
|
|
<div class='image-delete options'>
|
2008-12-10 16:59:19 +00:00
|
|
|
<input type='checkbox' class='checkbox' id='image-action-{$count}' name='multiaction[]' value='{$row['user_id']}#{$image_pre}{$image_name}'{$disabled} />
|
2008-12-09 15:19:03 +00:00
|
|
|
</div>
|
2008-12-09 17:49:59 +00:00
|
|
|
|
2008-12-09 15:19:03 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
2008-12-09 17:49:59 +00:00
|
|
|
|
2008-12-09 15:19:03 +00:00
|
|
|
";
|
|
|
|
|
|
|
|
$count++;
|
2006-12-02 04:36:16 +00:00
|
|
|
}
|
|
|
|
|
2008-12-09 15:19:03 +00:00
|
|
|
$text .= "
|
|
|
|
<div class='spacer clear'>
|
2008-12-10 16:59:19 +00:00
|
|
|
<div class='buttons-bar'>
|
|
|
|
<input type='hidden' name='show_avatars' value='1' />
|
|
|
|
<button class='action' type='button' name='check_all' value='".IMALAN_59."'><span>".IMALAN_59."</span></button>
|
|
|
|
<button class='action' type='button' name='uncheck_all' value='".IMALAN_60."'><span>".IMALAN_60."</span></button>
|
|
|
|
<button class='delete' type='submit' name='submit_show_delete_multi' value='".IMALAN_58."'><span>".IMALAN_58."</span></button>
|
|
|
|
<button class='delete' type='submit' name='submit_show_deleteall' value='".IMALAN_25."'><span>".IMALAN_25."</span></button>
|
|
|
|
<button class='cancel' type='submit' name='submit_cancel_show' value='".IMALAN_68."'><span>".IMALAN_68."</span></button>
|
|
|
|
</div>
|
2008-12-09 17:49:59 +00:00
|
|
|
</div>
|
2008-12-10 16:59:19 +00:00
|
|
|
</fieldset>
|
2006-12-02 04:36:16 +00:00
|
|
|
</form>
|
2008-12-09 17:49:59 +00:00
|
|
|
";
|
2006-12-02 04:36:16 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-12-10 16:59:19 +00:00
|
|
|
$ns->tablerender(IMALAN_18, $message.$text);
|
2006-12-02 04:36:16 +00:00
|
|
|
}
|
|
|
|
|
2008-12-10 16:59:19 +00:00
|
|
|
/*
|
|
|
|
* CHECK AVATARS SCREEN
|
|
|
|
*/
|
2008-12-09 15:19:03 +00:00
|
|
|
if (isset($_POST['check_avatar_sizes']))
|
2008-12-05 22:01:25 +00:00
|
|
|
{
|
2006-12-02 04:36:16 +00:00
|
|
|
// Set up to track what we've done
|
|
|
|
//
|
|
|
|
$iUserCount = 0;
|
|
|
|
$iAVinternal = 0;
|
|
|
|
$iAVexternal = 0;
|
|
|
|
$iAVnotfound = 0;
|
|
|
|
$iAVtoobig = 0;
|
|
|
|
require_once(e_HANDLER."avatar_handler.php");
|
2008-12-09 15:19:03 +00:00
|
|
|
|
|
|
|
$text = "
|
|
|
|
<form method='post' action='".e_SELF."'>
|
2008-12-10 16:59:19 +00:00
|
|
|
<fieldset id='core-image-check-avatar'>
|
2008-12-09 15:19:03 +00:00
|
|
|
<legend class='e-hideme'>".CACLAN_3."</legend>
|
|
|
|
<table cellpadding='0' cellspacing='0' class='adminlist'>
|
2008-12-10 16:59:19 +00:00
|
|
|
<colgroup span='4'>
|
2008-12-09 15:19:03 +00:00
|
|
|
<col style='width:10%'></col>
|
|
|
|
<col style='width:20%'></col>
|
|
|
|
<col style='width:25%'></col>
|
|
|
|
<col style='width:45%'></col>
|
|
|
|
</colgroup>
|
|
|
|
<thead>
|
|
|
|
<tr>
|
|
|
|
<th class='center'>".IMALAN_61."</th>
|
|
|
|
<th class='center'>".IMALAN_64."</th>
|
|
|
|
<th class='center'>".IMALAN_62."</th>
|
|
|
|
<th class='center last'>".IMALAN_63."</th>
|
|
|
|
</tr>
|
|
|
|
</thead>
|
|
|
|
<tbody>
|
|
|
|
";
|
|
|
|
|
|
|
|
|
2006-12-02 04:36:16 +00:00
|
|
|
//
|
|
|
|
// Loop through avatar field for every user
|
|
|
|
//
|
|
|
|
$iUserCount = $sql->db_Count("user");
|
2008-12-10 16:59:19 +00:00
|
|
|
$found = false;
|
|
|
|
$allowedWidth = intval($pref['im_width']);
|
|
|
|
$allowedHeight = intval($pref['im_width']);
|
2006-12-02 04:36:16 +00:00
|
|
|
if ($sql->db_Select("user", "*", "user_image!=''")) {
|
2008-12-10 16:59:19 +00:00
|
|
|
|
2008-12-09 15:19:03 +00:00
|
|
|
while ($row = $sql->db_Fetch())
|
2008-12-05 22:01:25 +00:00
|
|
|
{
|
2008-12-10 16:59:19 +00:00
|
|
|
//Check size
|
|
|
|
$avname=avatar($row['user_image']);
|
2008-12-09 15:19:03 +00:00
|
|
|
if (strpos($avname,"http://")!==FALSE)
|
2006-12-02 04:36:16 +00:00
|
|
|
{
|
|
|
|
$iAVexternal++;
|
|
|
|
$bAVext=TRUE;
|
|
|
|
} else {
|
|
|
|
$iAVinternal++;
|
|
|
|
$bAVext=FALSE;
|
|
|
|
}
|
2008-12-10 16:59:19 +00:00
|
|
|
|
2006-12-02 04:36:16 +00:00
|
|
|
$image_stats = getimagesize($avname);
|
|
|
|
$sBadImage="";
|
2008-12-10 16:59:19 +00:00
|
|
|
|
2006-12-02 04:36:16 +00:00
|
|
|
if (!$image_stats)
|
|
|
|
{
|
|
|
|
$iAVnotfound++;
|
|
|
|
// allow delete
|
|
|
|
$sBadImage=IMALAN_42;
|
2008-12-10 16:59:19 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2006-12-02 04:36:16 +00:00
|
|
|
$imageWidth = $image_stats[0];
|
|
|
|
$imageHeight = $image_stats[1];
|
2008-12-10 16:59:19 +00:00
|
|
|
|
|
|
|
if ( ($imageHeight > $allowedHeight) || ($imageWidth > $allowedWidth) )
|
2006-12-02 04:36:16 +00:00
|
|
|
{ // Too tall or too wide
|
|
|
|
$iAVtoobig++;
|
2008-12-10 16:59:19 +00:00
|
|
|
if ($imageWidth > $allowedWidth)
|
|
|
|
{
|
2006-12-02 04:36:16 +00:00
|
|
|
$sBadImage = IMALAN_40." ($imageWidth)";
|
|
|
|
}
|
2008-12-10 16:59:19 +00:00
|
|
|
|
|
|
|
if ($imageHeight > $allowedHeight)
|
|
|
|
{
|
2006-12-02 04:36:16 +00:00
|
|
|
if (strlen($sBadImage))
|
|
|
|
{
|
|
|
|
$sBadImage .= ", ";
|
|
|
|
}
|
|
|
|
$sBadImage .= IMALAN_41." ($imageHeight)";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2008-12-09 15:19:03 +00:00
|
|
|
|
2008-12-10 16:59:19 +00:00
|
|
|
//If not found or too large, allow delete
|
2006-12-02 04:36:16 +00:00
|
|
|
if (strlen($sBadImage))
|
|
|
|
{
|
2008-12-10 16:59:19 +00:00
|
|
|
$found = true;
|
2006-12-02 04:36:16 +00:00
|
|
|
$text .= "
|
|
|
|
<tr>
|
2008-12-09 15:19:03 +00:00
|
|
|
<td class='options center'>
|
2008-12-10 16:59:19 +00:00
|
|
|
<input class='checkbox' type='checkbox' name='multiaction[]' id='avdelete-{$row['user_id']}' value='{$row['user_id']}' />
|
2008-12-09 15:19:03 +00:00
|
|
|
</td>
|
|
|
|
<td>
|
2008-12-10 16:59:19 +00:00
|
|
|
<label for='avdelete-{$row['user_id']}' title='".IMALAN_56."'>".IMALAN_51."</label><a href='".e_BASE."user.php?id.{$row['user_id']}'>".$row['user_name']."</a>
|
2008-12-09 15:19:03 +00:00
|
|
|
</td>
|
|
|
|
<td>".$sBadImage."</td>
|
|
|
|
<td>".$avname."</td>
|
2006-12-02 04:36:16 +00:00
|
|
|
</tr>";
|
|
|
|
}
|
2008-12-10 16:59:19 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//Nothing found
|
|
|
|
if(!$found)
|
|
|
|
{
|
|
|
|
$text .= "
|
2008-12-09 15:19:03 +00:00
|
|
|
<tr>
|
|
|
|
<td colspan='4' class='center'>".IMALAN_65."</td>
|
2008-12-10 16:59:19 +00:00
|
|
|
</tr>
|
|
|
|
";
|
2006-12-02 04:36:16 +00:00
|
|
|
}
|
2008-12-10 16:59:19 +00:00
|
|
|
|
2006-12-02 04:36:16 +00:00
|
|
|
$text .= "
|
2008-12-09 15:19:03 +00:00
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
<div class='buttons-bar'>
|
2008-12-10 16:59:19 +00:00
|
|
|
<input type='hidden' name='check_avatar_sizes' value='1' />
|
|
|
|
<button class='action' type='button' name='check_all' value='".IMALAN_59."'><span>".IMALAN_59."</span></button>
|
|
|
|
<button class='action' type='button' name='uncheck_all' value='".IMALAN_60."'><span>".IMALAN_60."</span></button>
|
|
|
|
<button class='delete' type='submit' name='submit_avdelete_multi' value='".IMALAN_58."'><span>".IMALAN_58."</span></button>
|
2008-12-09 15:19:03 +00:00
|
|
|
</div>
|
|
|
|
</fieldset>
|
|
|
|
</form>
|
|
|
|
|
|
|
|
<table cellpadding='0' cellspacing='0' class='admininfo'>
|
2008-12-10 16:59:19 +00:00
|
|
|
<colgroup span='2'>
|
|
|
|
<col style='width:20%'></col>
|
|
|
|
<col style='width:80%'></col>
|
|
|
|
</colgroup>
|
|
|
|
<tbody>
|
|
|
|
<tr>
|
|
|
|
<td class='label'>".IMALAN_38."</td>
|
|
|
|
<td class='control'>{$allowedWidth}</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td class='label'>".IMALAN_39."</td>
|
|
|
|
<td class='control'>{$allowedHeight}</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td class='label'>".IMALAN_45."</td>
|
|
|
|
<td class='control'>{$iAVnotfound}</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td class='label'>".IMALAN_46."</td>
|
|
|
|
<td class='control'>{$iAVtoobig}</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td class='label'>".IMALAN_47."</td>
|
|
|
|
<td class='control'>{$iAVinternal}</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td class='label'>".IMALAN_48."</td>
|
|
|
|
<td class='control'>{$iAVexternal}</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td class='label'>".IMALAN_49."</td>
|
|
|
|
<td class='control'>".($iAVexternal+$iAVinternal)." (".(int)(100.0*(($iAVexternal+$iAVinternal)/$iUserCount)).'%, '.$iUserCount." ".IMALAN_50.")</td>
|
|
|
|
</tr>
|
|
|
|
</tbody>
|
2008-12-09 15:19:03 +00:00
|
|
|
</table>
|
|
|
|
";
|
2006-12-02 04:36:16 +00:00
|
|
|
|
2008-12-10 16:59:19 +00:00
|
|
|
$ns->tablerender(IMALAN_37, $message.$text);
|
2006-12-02 04:36:16 +00:00
|
|
|
}
|
|
|
|
|
2008-12-10 20:54:06 +00:00
|
|
|
/*
|
|
|
|
* MAIN CONFIG SCREEN
|
|
|
|
*/
|
2007-03-25 03:27:16 +00:00
|
|
|
if(function_exists('gd_info'))
|
|
|
|
{
|
|
|
|
$gd_info = gd_info();
|
|
|
|
$gd_version = $gd_info['GD Version'];
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2008-12-09 15:19:03 +00:00
|
|
|
$gd_version = "<span class='error'> ".IMALAN_55."</span>";
|
2007-03-25 03:27:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
$IM_NOTE = "";
|
|
|
|
if($pref['im_path'] != "")
|
|
|
|
{
|
2007-12-07 19:53:27 +00:00
|
|
|
$im_file = $pref['im_path'].'convert';
|
|
|
|
if(!file_exists($im_file))
|
2007-03-25 03:27:16 +00:00
|
|
|
{
|
2008-12-09 15:19:03 +00:00
|
|
|
$IM_NOTE = "<span class='error'>".IMALAN_52."</span>";
|
2007-03-25 03:27:16 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2007-12-07 19:53:27 +00:00
|
|
|
$cmd = "{$im_file} -version";
|
2007-03-25 03:27:16 +00:00
|
|
|
$tmp = `$cmd`;
|
|
|
|
if(strpos($tmp, "ImageMagick") === FALSE)
|
|
|
|
{
|
2008-12-09 15:19:03 +00:00
|
|
|
$IM_NOTE = "<span class='error'>".IMALAN_53."</span>";
|
2007-03-25 03:27:16 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2006-12-02 04:36:16 +00:00
|
|
|
|
2008-12-09 15:19:03 +00:00
|
|
|
$text = "
|
2006-12-02 04:36:16 +00:00
|
|
|
<form method='post' action='".e_SELF."'>
|
2008-12-10 16:59:19 +00:00
|
|
|
<fieldset id='core-image-settings'>
|
2008-12-09 15:19:03 +00:00
|
|
|
<legend class='e-hideme'>".IMALAN_7."</legend>
|
|
|
|
<table cellpadding='0' cellspacing='0' class='adminform'>
|
|
|
|
<colgroup span='2'>
|
2008-12-10 16:59:19 +00:00
|
|
|
<col class='col-label'></col>
|
|
|
|
<col class='col-control'></col>
|
2008-12-09 15:19:03 +00:00
|
|
|
</colgroup>
|
|
|
|
<tbody>
|
|
|
|
<tr>
|
|
|
|
<td class='label'>
|
|
|
|
".IMALAN_1."
|
|
|
|
</td>
|
2008-12-10 20:54:06 +00:00
|
|
|
<td class='options control'>
|
|
|
|
<input class='checkbox' type='checkbox' name='image_post' value='1'".($pref['image_post'] ? " checked='checked'" : '')." />
|
2008-12-09 15:19:03 +00:00
|
|
|
<div class='smalltext field-help'>".IMALAN_2."</div>
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td class='label'>
|
|
|
|
".IMALAN_10."
|
|
|
|
</td>
|
2008-12-10 20:54:06 +00:00
|
|
|
<td class='control'>
|
|
|
|
".r_userclass('image_post_class',$pref['image_post_class'],"off","public,guest,nobody,member,admin,main,classes")."
|
2008-12-09 15:19:03 +00:00
|
|
|
<div class='smalltext field-help'>".IMALAN_11."</div>
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
|
|
|
|
<tr>
|
|
|
|
<td class='label'>
|
|
|
|
".IMALAN_12."
|
|
|
|
</td>
|
|
|
|
<td class='control'>
|
2008-12-10 20:54:06 +00:00
|
|
|
<select name='image_post_disabled_method' class='tbox select'>
|
|
|
|
<option value='0'".($pref['image_post_disabled_method'] == "0" ? " selected='selected'" : '').">".IMALAN_14."</option>
|
|
|
|
<option value='1'".($pref['image_post_disabled_method'] == "1" ? " selected='selected'" : "").">".IMALAN_15."</option>
|
2008-12-09 15:19:03 +00:00
|
|
|
</select>
|
|
|
|
<div class='smalltext field-help'>".IMALAN_13."</div>
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
|
|
|
|
<tr>
|
2008-12-09 17:49:59 +00:00
|
|
|
<td class='label'>".IMALAN_3."<div class='label-note'>".IMALAN_54." {$gd_version}</div></td>
|
2008-12-09 15:19:03 +00:00
|
|
|
<td class='control'>
|
2008-12-10 20:54:06 +00:00
|
|
|
<select name='resize_method' class='tbox'>
|
|
|
|
<option".($pref['resize_method'] == "gd1" ? " selected='selected'" : '').">gd1</option>
|
|
|
|
<option".($pref['resize_method'] == "gd2" ? " selected='selected'" : '').">gd2</option>
|
|
|
|
<option".($pref['resize_method'] == "ImageMagick" ? " selected='selected'" : '').">ImageMagick</option>
|
2008-12-09 15:19:03 +00:00
|
|
|
</select>
|
|
|
|
<div class='smalltext field-help'>".IMALAN_4."</div>
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
|
|
|
|
<tr>
|
2008-12-09 17:49:59 +00:00
|
|
|
<td class='label'>".IMALAN_5."<div class='label-note'>{$IM_NOTE}</div></td>
|
2008-12-09 15:19:03 +00:00
|
|
|
<td class='control'>
|
2008-12-10 20:54:06 +00:00
|
|
|
<input class='tbox input-text' type='text' name='im_path' size='40' value='{$pref['im_path']}' maxlength='200' />
|
2008-12-09 15:19:03 +00:00
|
|
|
<div class='smalltext field-help'>".IMALAN_6."</div>
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
|
|
|
|
<tr>
|
|
|
|
<td class='label'>".IMALAN_34."
|
|
|
|
</td>
|
2008-12-10 20:54:06 +00:00
|
|
|
<td class='options control'>
|
|
|
|
<input type='checkbox' class='checkbox' name='enable_png_image_fix' value='1'".($pref['enable_png_image_fix'] ? " checked='checked'" : '')." />
|
2008-12-09 15:19:03 +00:00
|
|
|
<div class='smalltext field-help'>".IMALAN_35."</div>
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
|
|
|
|
<tr>
|
|
|
|
<td class='label'>".IMALAN_16."</td>
|
|
|
|
<td class='control'>
|
|
|
|
<button class='action' type='submit' name='show_avatars'><span>".IMALAN_17."</span></button>
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
|
|
|
|
<tr>
|
|
|
|
<td class='label'>".IMALAN_36."</td>
|
|
|
|
<td class='control'>
|
|
|
|
<button class='action' type='submit' name='check_avatar_sizes'><span>".IMALAN_17."</span></button>
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
<div class='buttons-bar center'>
|
2008-12-10 20:54:06 +00:00
|
|
|
<button class='update' type='submit' name='update_options' value='".IMALAN_8."'><span>".IMALAN_8."</span></button>
|
2008-12-09 15:19:03 +00:00
|
|
|
</div>
|
|
|
|
</fieldset>
|
|
|
|
</form>";
|
2008-12-10 16:59:19 +00:00
|
|
|
$ns->tablerender(IMALAN_7, $message.$text);
|
2006-12-02 04:36:16 +00:00
|
|
|
|
2008-12-10 16:59:19 +00:00
|
|
|
//Just in case...
|
|
|
|
if(!e_AJAX_REQUEST) require_once("footer.php");
|
2008-12-09 17:49:59 +00:00
|
|
|
|
2008-12-10 16:59:19 +00:00
|
|
|
/**
|
|
|
|
* Handle page DOM within the page header
|
|
|
|
*
|
|
|
|
* @return string JS source
|
|
|
|
*/
|
2008-12-09 17:49:59 +00:00
|
|
|
function headerjs()
|
|
|
|
{
|
|
|
|
require_once(e_HANDLER.'js_helper.php');
|
2008-12-10 23:46:47 +00:00
|
|
|
//FIXME - how exactly to call JS lan?
|
2008-12-09 17:49:59 +00:00
|
|
|
$ret = "
|
2008-12-10 23:46:47 +00:00
|
|
|
<script type='text/javascript'>
|
|
|
|
//add required core lan
|
|
|
|
(".e_jshelper::toString(IMALAN_67).").addModLan('core', 'delete_confirm');
|
|
|
|
</script>
|
|
|
|
<script type='text/javascript' src='".e_FILE_ABS."jslib/core/admin.js'></script>
|
2008-12-09 17:49:59 +00:00
|
|
|
";
|
|
|
|
|
|
|
|
return $ret;
|
|
|
|
}
|
2008-12-09 15:19:03 +00:00
|
|
|
?>
|