include View::getView('twitter'); include View::getView('footer'); View::output(); } if (ROLE === ROLE_ADMIN && $action == 't') { LoginAuth::checkToken(); $Twitter_Model = new Twitter_Model(); $t = isset($_POST['t']) ? addslashes(trim($_POST['t'])) : ''; $attach = isset($_FILES['img']) ? $_FILES['img'] : ''; if ($attach['tmp_name'] && !$t) { $t = '分享图片'; } if (!$t) { emDirect("./?action=tw"); } $tdata = array('content' => $Twitter_Model->formatTwitter($t), 'author' => UID, 'date' => time()); if ($attach['tmp_name']) { $fileinfo = uploadFile($attach['name'], $attach['error'], $attach['tmp_name'], $attach['size'], array('jpg', 'jpeg', 'png'), false, false); $upfname = $fileinfo['file_path']; $size = @getimagesize($upfname); $w = $size[0]; $h = $size[1]; if ($w > 150 || $h > 120) { $uppath = Option::UPLOADFILE_PATH . gmdate('Ym') . '/'; $thum = str_replace($uppath, $uppath . 'thum-', $upfname); resizeImage($upfname, $thum, 120, 150); $upfname = $thum; } $tdata['img'] = str_replace('../', '', $upfname); } $Twitter_Model->addTwitter($tdata);
require_once View::getView('twitter'); include View::getView('footer'); View::output(); } // 发布微语. if ($action == 'post') { $t = isset($_POST['t']) ? addslashes(trim($_POST['t'])) : ''; $img = isset($_POST['img']) ? addslashes(trim($_POST['img'])) : ''; LoginAuth::checkToken(); if ($img && !$t) { $t = '分享图片'; } if (!$t) { emDirect("twitter.php?error_a=1"); } $tdata = array('content' => $Twitter_Model->formatTwitter($t), 'author' => UID, 'date' => time(), 'img' => str_replace('../', '', $img)); $twid = $Twitter_Model->addTwitter($tdata); $CACHE->updateCache(array('sta', 'newtw')); doAction('post_twitter', $t, $twid); emDirect("twitter.php?active_t=1"); } // 删除微语. if ($action == 'del') { LoginAuth::checkToken(); $id = isset($_GET['id']) ? intval($_GET['id']) : ''; $Twitter_Model->delTwitter($id); $CACHE->updateCache(array('sta', 'newtw')); emDirect("twitter.php?active_del=1"); } // 获取回复. if ($action == 'getreply') {