| [ Index ] |
|
Code source de e107 0.7.8 |
1 <?php 2 /* 3 + ----------------------------------------------------------------------------+ 4 | e107 website system 5 | 6 | ©Steve Dunstan 2001-2002 7 | http://e107.org 8 | jalist@e107.org 9 | 10 | Released under the terms and conditions of the 11 | GNU General Public License (http://gnu.org). 12 | 13 | $Source: /cvsroot/e107/e107_0.7/e107_admin/image.php,v $ 14 | $Revision: 1.16 $ 15 | $Date: 2007/02/03 03:10:09 $ 16 | $Author: e107coders $ 17 +----------------------------------------------------------------------------+ 18 */ 19 require_once ("../class2.php"); 20 if (!getperms("A")) { 21 header("location:".e_BASE."index.php"); 22 exit; 23 } 24 $e_sub_cat = 'image'; 25 require_once ("auth.php"); 26 require_once(e_HANDLER."form_handler.php"); 27 require_once(e_HANDLER."userclass_class.php"); 28 $rs = new form; 29 30 if (isset($_POST['delete'])) { 31 $image = $_POST['filename']; 32 @unlink(e_FILE."public/avatars/".$image); 33 $sql->db_Update("user", "user_image='' WHERE user_image='-upload-$image'"); 34 $sql->db_Update("user", "user_sess='' WHERE user_sess='$image'"); 35 $message = $image." ".IMALAN_28; 36 } 37 38 if (isset($_POST['deleteall'])) { 39 $handle = opendir(e_FILE."public/avatars/"); 40 while ($file = readdir($handle)) { 41 if ($file != '.' && $file != '..' && $file != "index.html" && $file != "null.txt" && $file != '/' && $file != 'CVS' && $file != 'Thumbs.db') { 42 $dirlist[] = $file; 43 } 44 } 45 closedir($handle); 46 $count = 0; 47 while (list($key, $image_name) = each($dirlist)) { 48 if (!$sql->db_Select("user", "*", "user_image='-upload-$image_name' OR user_sess='$image_name'")) { 49 unlink(e_FILE."public/avatars/".$image_name); 50 $count ++; 51 } 52 } 53 $message = $count." ".IMALAN_26; 54 } 55 56 if (isset($_POST['avdelete'])) { 57 require_once(e_HANDLER."avatar_handler.php"); 58 foreach($_POST['avdelete'] as $key => $val) 59 { 60 $key = $tp->toDB($key); // We only need the key 61 if ($sql->db_Select("user", "*", "user_id='$key'")) { 62 $row = $sql->db_Fetch(); 63 extract($row); 64 $avname=avatar($user_image); 65 if (strpos($avname,"http://")===FALSE) 66 { // Internal file, so unlink it 67 @unlink($avname); 68 } 69 $sql->db_Update("user","user_image='' WHERE user_id='$key'"); 70 $message = IMALAN_51.$user_name." ".IMALAN_28; 71 } 72 } 73 $_POST['check_avatar_sizes'] = TRUE; // Force size recheck after doing one or more deletes 74 } 75 76 if (isset($_POST['update_options'])) { 77 $pref['image_post'] = $_POST['image_post']; 78 $pref['resize_method'] = $_POST['resize_method']; 79 $pref['im_path'] = $tp->toDB($_POST['im_path']); 80 $pref['image_post_class'] = $_POST['image_post_class']; 81 $pref['image_post_disabled_method'] = $_POST['image_post_disabled_method']; 82 $pref['enable_png_image_fix'] = $_POST['enable_png_image_fix']; 83 84 save_prefs(); 85 $message = IMALAN_9; 86 } 87 88 if (isset($message)) { 89 $ns->tablerender("", "<div style='text-align:center'><b>".$message."</b></div>"); 90 } 91 92 93 if (isset($_POST['show_avatars'])) { 94 95 $handle = opendir(e_FILE."public/avatars/"); 96 while ($file = readdir($handle)) { 97 if ($file != '.' && $file != '..' && $file != "index.html" && $file != "null.txt" && $file != '/' && $file != 'CVS' && $file != 'Thumbs.db' && !is_dir($file)) { 98 $dirlist[] = $file; 99 } 100 } 101 closedir($handle); 102 103 $text = "<div style='text-align:center'>\n"; 104 105 if (!is_array($dirlist)) { 106 $text .= IMALAN_29; 107 } else { 108 109 110 111 while (list($key, $image_name) = each($dirlist)) { 112 $users = IMALAN_21." | "; 113 if ($sql->db_Select("user", "*", "user_image='-upload-$image_name' OR user_sess='$image_name'")) { 114 while ($row = $sql->db_Fetch()) { 115 extract($row); 116 $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> | "; 117 } 118 } else { 119 $users = IMALAN_22; 120 } 121 122 $text .= "<div class='spacer'> 123 <form method='post' action='".e_SELF."'> 124 <table style='".ADMIN_WIDTH."' class='fborder'> 125 <tr> 126 <td class='fcaption'>$image_name</td> 127 </tr> 128 <tr> 129 <td class='forumheader3'><img src='".e_FILE."public/avatars/".$image_name."' alt='' /><br /> 130 <input type='hidden' name='filename' value='".$image_name."' /> 131 <input class='button' type='submit' name='delete' value='".LAN_DELETE."' /> 132 </td> 133 </tr> 134 <tr> 135 <td class='forumheader3'>$users</td> 136 </tr> 137 </table> 138 </form> 139 </div>"; 140 } 141 142 $text .= "<div class='spacer'> 143 <form method='post' action='".e_SELF."'> 144 <table style='".ADMIN_WIDTH."' class='fborder'> 145 <tr> 146 <td class='forumheader'> 147 <input class='button' type='submit' name='deleteall' value='".IMALAN_25."' /> 148 </td> 149 </tr> 150 </table> 151 </form> 152 </div>"; 153 154 } 155 156 $text .= "</div>"; 157 158 $ns->tablerender(IMALAN_18, $text); 159 } 160 161 if (isset($_POST['check_avatar_sizes'])) { 162 // 163 // Set up to track what we've done 164 // 165 $iUserCount = 0; 166 $iAVinternal = 0; 167 $iAVexternal = 0; 168 $iAVnotfound = 0; 169 $iAVtoobig = 0; 170 require_once(e_HANDLER."avatar_handler.php"); 171 $text = "<div style='text-align:center'>\n"; 172 $text .= "<div class='spacer'> 173 <form method='post' action='".e_SELF."'> 174 <table style='".ADMIN_WIDTH."' class='fborder'> 175 <tr> 176 <td class='forumheader3'>".$pref['im_width']."</td> 177 <td class='forumheader3'>".IMALAN_38."</td> 178 </tr> 179 <tr> 180 <td class='forumheader3'>".$pref['im_height']."</td> 181 <td class='forumheader3'>".IMALAN_39."</td> 182 </tr>"; 183 184 // 185 // Loop through avatar field for every user 186 // 187 $iUserCount = $sql->db_Count("user"); 188 if ($sql->db_Select("user", "*", "user_image!=''")) { 189 while ($row = $sql->db_Fetch()) { 190 extract($row); 191 192 // 193 // Check size 194 // 195 $avname=avatar($user_image); 196 if (strpos($avname,"http://")!==FALSE) 197 { 198 $iAVexternal++; 199 $bAVext=TRUE; 200 } else { 201 $iAVinternal++; 202 $bAVext=FALSE; 203 } 204 $image_stats = getimagesize($avname); 205 $sBadImage=""; 206 if (!$image_stats) 207 { 208 $iAVnotfound++; 209 // allow delete 210 $sBadImage=IMALAN_42; 211 } else { 212 $imageWidth = $image_stats[0]; 213 $imageHeight = $image_stats[1]; 214 if ( ($imageHeight > $pref['im_height']) || ($imageWidth>$pref['im_width']) ) 215 { // Too tall or too wide 216 $iAVtoobig++; 217 if ($imageWidth > $pref['im_width']) { 218 $sBadImage = IMALAN_40." ($imageWidth)"; 219 } 220 if ($imageHeight > $pref['im_height']) { 221 if (strlen($sBadImage)) 222 { 223 $sBadImage .= ", "; 224 } 225 $sBadImage .= IMALAN_41." ($imageHeight)"; 226 } 227 } 228 } 229 230 // 231 // If not found or too big, allow delete 232 // 233 if (strlen($sBadImage)) 234 { 235 $sBadImage .=" [".$avname."]"; // Show all files that have a problem 236 $text .= " 237 <tr> 238 <td class='forumheader3'> 239 <input class='button' type='submit' name='avdelete[$user_id]' value='".($bAVext ? IMALAN_44 : IMALAN_43)."' /> 240 </td> 241 <td class='forumheader3'>".IMALAN_51."<a href='".e_BASE."user.php?id.".$user_id."'>".$user_name."</a> ".$sBadImage."</td> 242 </tr>"; 243 } 244 } 245 } 246 // 247 // Done, so show stats 248 // 249 $text .= " 250 <tr> 251 <td class='forumheader3'>".$iAVnotfound."</td> 252 <td class='forumheader3'>".IMALAN_45."</td> 253 </tr> 254 <tr> 255 <td class='forumheader3'>".$iAVtoobig."</td> 256 <td class='forumheader3'>".IMALAN_46."</td> 257 </tr> 258 <tr> 259 <td class='forumheader3'>".$iAVinternal."</td> 260 <td class='forumheader3'>".IMALAN_47."</td> 261 </tr> 262 <tr> 263 <td class='forumheader3'>".$iAVexternal."</td> 264 <td class='forumheader3'>".IMALAN_48."</td> 265 </tr> 266 <tr> 267 <td class='forumheader3'>".($iAVexternal+$iAVinternal)." (".(int)(100.0*(($iAVexternal+$iAVinternal)/$iUserCount)).'%, '.$iUserCount." ".IMALAN_50.")</td> 268 <td class='forumheader3'>".IMALAN_49."</td> 269 </tr> 270 </table> 271 </form> 272 </div>"; 273 274 $text .= "</div>"; 275 276 $ns->tablerender(IMALAN_37, $text); 277 } 278 279 280 $text = "<div style='text-align:center'> 281 <form method='post' action='".e_SELF."'> 282 <table style='".ADMIN_WIDTH."' class='fborder'> 283 284 <tr> 285 <td style='width:75%' class='forumheader3'> 286 ".IMALAN_1."<br /> 287 <span class='smalltext'>".IMALAN_2."</span> 288 </td> 289 <td style='width:25%;text-align:center' class='forumheader3' >". ($pref['image_post'] ? "<input type='checkbox' name='image_post' value='1' checked='checked' />" : "<input type='checkbox' name='image_post' value='1' />")." 290 </td> 291 </tr> 292 293 294 <tr> 295 <td style='width:75%' class='forumheader3'> 296 ".IMALAN_10."<br /> 297 <span class='smalltext'>".IMALAN_11."</span> 298 </td> 299 <td style='width:25%;text-align:center' class='forumheader3' >".r_userclass('image_post_class',$pref['image_post_class'],"off","public,guest,nobody,member,admin,main,classes")."</td> 300 </tr> 301 302 <tr> 303 <td style='width:75%' class='forumheader3'> 304 ".IMALAN_12."<br /> 305 <span class='smalltext'>".IMALAN_13."</span> 306 </td> 307 <td style='width:25%;text-align:center' class='forumheader3' > 308 <select name='image_post_disabled_method' class='tbox'>". ($pref['image_post_disabled_method'] == "0" ? "<option value='1' selected='selected'>".IMALAN_14."</option>" : "<option value='0'>".IMALAN_14."</option>"). ($pref['image_post_disabled_method'] == "1" ? "<option value='1' selected='selected'>".IMALAN_15."</option>" : "<option value='1'>".IMALAN_15."</option>")." 309 </select></td> 310 </tr> 311 312 <tr> 313 <td style='width:75%' class='forumheader3'>".IMALAN_3."<br /><span class='smalltext'>".IMALAN_4."</span></td> 314 <td style='width:25%;text-align:center' class='forumheader3' > 315 <select name='resize_method' class='tbox'>". ($pref['resize_method'] == "gd1" ? "<option selected='selected'>gd1</option>" : "<option>gd1</option>"). ($pref['resize_method'] == "gd2" ? "<option selected='selected'>gd2</option>" : "<option>gd2</option>"). ($pref['resize_method'] == "ImageMagick" ? "<option selected='selected'>ImageMagick</option>" : "<option>ImageMagick</option>")." 316 </select> 317 </td> 318 </tr> 319 320 <tr> 321 <td style='width:75%' class='forumheader3'>".IMALAN_5."<br /><span class='smalltext'>".IMALAN_6."</span></td> 322 <td style='width:25%;text-align:center' class='forumheader3' > 323 <input class='tbox' type='text' name='im_path' size='40' value=\"".$pref['im_path']."\" maxlength='200' /> 324 </td></tr> 325 326 <tr> 327 <td style='width:75%' class='forumheader3'>".IMALAN_34."<br /> 328 <span class='smalltext'>".IMALAN_35."</span> 329 </td> 330 <td style='width:25%;text-align:center' class='forumheader3' >".($pref['enable_png_image_fix'] ? "<input type='checkbox' name='enable_png_image_fix' value='1' checked='checked' />" : "<input type='checkbox' name='enable_png_image_fix' value='1' />")." 331 </td> 332 </tr> 333 334 <tr> 335 <td style='width:75%' class='forumheader3'>".IMALAN_16."</td> 336 <td style='width:25%;text-align:center' class='forumheader3' > 337 <input class='button' type='submit' name='show_avatars' value='".IMALAN_17."' /> 338 </td></tr> 339 340 <tr> 341 <td style='width:75%' class='forumheader3'>".IMALAN_36."</td> 342 <td style='width:25%;text-align:center' class='forumheader3' > 343 <input class='button' type='submit' name='check_avatar_sizes' value='".IMALAN_17."' /> 344 </td></tr> 345 346 <tr> 347 <td colspan='2' style='text-align:center' class='forumheader'> 348 <input class='button' type='submit' name='update_options' value='".IMALAN_8."' /> 349 </td> 350 </tr> 351 352 353 354 355 </table></form></div>"; 356 $ns->tablerender(IMALAN_7, $text); 357 358 359 require_once ("footer.php"); 360 361 362 363 $pref['resize_method'] = $_POST['resize_method']; 364 $pref['im_path'] = $_POST['im_path']; 365 366 367 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
| Généré le : Sun Apr 1 01:23:32 2007 | par Balluche grâce à PHPXref 0.7 |