function videophoto_upload($FILE, $uid) { if ($FILE['size']) { $newfilename = md5(substr($_G['timestamp'], 0, 7) . $uid); $dir1 = substr($newfilename, 0, 1); $dir2 = substr($newfilename, 1, 1); if (!is_dir(DISCUZ_ROOT . './data/avatar/' . $dir1)) { if (!mkdir(DISCUZ_ROOT . './data/avatar/' . $dir1)) { return ''; } } if (!is_dir(DISCUZ_ROOT . './data/avatar/' . $dir1 . '/' . $dir2)) { if (!mkdir(DISCUZ_ROOT . './data/avatar/' . $dir1 . '/' . $dir2)) { return ''; } } $new_name = DISCUZ_ROOT . './' . getvideophoto($newfilename); $tmp_name = $FILE['tmp_name']; if (@copy($tmp_name, $new_name)) { @unlink($tmp_name); } elseif (function_exists('move_uploaded_file') && @move_uploaded_file($tmp_name, $new_name)) { } elseif (@rename($tmp_name, $new_name)) { } else { return ''; } return $newfilename; } else { return ''; } }
<?php /** * [Discuz!] (C)2001-2099 Comsenz Inc. * This is NOT a freeware, use is subject to license terms * * $Id: spacecp_videophoto.php 22572 2011-05-12 09:35:18Z zhengqingpeng $ */ if (!defined('IN_DISCUZ')) { exit('Access Denied'); } if (empty($_G['setting']['verify'][7]['available'])) { showmessage('no_open_videophoto'); } if ($space['videophotostatus']) { space_merge($space, 'field_home'); $videophoto = getvideophoto($space['videophoto']); } else { $videophoto = ''; } $actives = array('verify' => ' class="a"'); $opactives = array('videophoto' => ' class="a"'); $operation = 'verify'; $opactives = array('videophoto' => ' class="a"'); include template("home/spacecp_videophoto");