private function uploadFile(CUploadedFile $upload, $fileType = UPLOAD_TYPE_UNKNOWN, $additional = 'files') { $filename = BetaBase::uploadFile($upload, $additional); if ($filename === false || !$this->afterUploaded($upload, $filename['url'], $fileType)) { $data = array('error' => 1, 'message' => t('upload_file_error')); } else { $data = array('error' => 0, 'url' => fbu($filename['url'])); } echo CJSON::encode($data); exit(0); }
public function actionSetDelete($id, $callback) { $id = (int) $id; $model = AdminSpecial::model()->findByPk($id); if ($model === null) { throw new CHttpException(500); } if ($model->delete()) { $data = array('errno' => BETA_NO, 'label' => t('delete_success', 'admin')); BetaBase::jsonp($callback, $data); } else { throw new CHttpException(500, var_export($model->getErrors(), true)); } }
public function actionEdit($callback) { $id = request()->getPost('kwid'); $model = FilterKeyword::model()->findByPk($id); if ($model === null) { throw new CHttpException(404); } $keyword = trim(request()->getPost('keyword')); $replace = trim(request()->getPost('replace')); $model->keyword = $keyword; $model->replace = $replace; $result = $model->save() && FilterKeyword::updateCacheFile(); $data = array('errno' => (int) (!$result), 'message' => $model->getError('keyword') . $model->getError('replace')); BetaBase::jsonp($callback, $data); exit(0); }
public function saveThumbnail() { if ($this->thumbnail && $this->thumbnail instanceof CUploadedFile) { $topicThumbnailDir = 'special'; $filename = BetaBase::uploadImage($this->thumbnail, 'special'); if ($filename === false) { return false; } else { $this->thumbnail = $filename['url']; $this->update(array('thumbnail')); return $filename; } } else { return null; } }
public function saveIcon() { if ($this->icon && $this->icon instanceof CUploadedFile) { $topicThumbnailDir = 'topic'; $filename = BetaBase::uploadImage($this->icon, 'topic'); if ($filename === false) { return false; } else { $this->icon = $filename['url']; $this->update(array('icon')); return $filename; } } else { return null; } }
/** * baidu ping test */ public function actionPing() { $result = BetaBase::ping('贝塔资讯', 'http://www.waduanzi.com/', 'http://www.24beta.com/archives/406', 'http://www.24beta.com/'); print_r($result); exit; $client = new SoapClient(BAIDU_PING_URL); $functions = $client->__getFunctions(); var_dump($functions); exit; $arguments = array('贝塔IT资讯', 'http://www.24beta.com', 'http://www.24beta.com/archives/406', 'http://www.24beta.com'); $result = $client->__soapCall('weblogUpdates.extendedPing', $arguments); var_dump($result); }
protected function beforeSave() { if ($this->getIsNewRecord()) { $this->create_time = $_SERVER['REQUEST_TIME']; $this->create_ip = BetaBase::getClientIp(); } return true; }
/** * 批量设置热门文章 * @param array $ids 文章ID数组 * @param string $callback jsonp回调函数,自动赋值 */ public function actionMultiHottest($callback) { $ids = (array) request()->getPost('ids'); $successIds = $failedIds = array(); foreach ($ids as $id) { $model = AdminPost::model()->findByPk($id); if ($model === null) { continue; } $model->hottest = BETA_YES; $model->state = POST_STATE_ENABLED; $result = $model->save(true, array('hottest', 'state')); if ($result) { $successIds[] = $id; } else { $failedIds[] = $id; } } $data = array('success' => $successIds, 'failed' => $failedIds); BetaBase::jsonp($callback, $data); }
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="content-type" content="text/html; charset=<?php echo app()->charset; ?> " /> <title><?php echo $this->pageTitle; ?> </title> <meta name="MSSmartTagsPreventParsing" content="true" /> <meta name="author" content="24beta.com" /> <meta name="generator" content="<?php echo BetaBase::powered(); ?> " /> <meta name="copyright" content="Copyright (c) 2009-2012 24beta.com All Rights Reserved." /> <meta name="robots" content="all" /> <link rel="alternate" type="application/rss+xml" title="RSS 2.0" href="<?php echo aurl('feed'); ?> " /> <link rel="start" href="<?php echo abu('/'); ?> " title="Home" /> <link rel="home" href="<?php echo abu('/'); ?> " title="Home" />
public function encryptPassword() { $this->password = BetaBase::encryptPassword($this->password); }
public function actionDigg($callback) { $id = (int) $_POST['pid']; if ($id < 0) { throw new CHttpException(500); } $model = Post::model()->published()->findByPk($id); if ($model === null) { throw new CHttpException(500); } $model->digg_nums += 1; $result = $model->save(true, array('digg_nums')); $data = array('digg_nums' => $model->digg_nums); $data['errno'] = (int) $result; BetaBase::jsonp($callback, $data); }
/** * 批量禁用用户 * @param array $ids 用户ID数组 * @param string $callback jsonp回调函数,自动赋值 */ public function actionMultiForbidden($callback) { $ids = (array) request()->getPost('ids'); $successIds = $failedIds = array(); $attributes = array('state' => USER_STATE_FORBIDDEN); foreach ($ids as $id) { $result = AdminUser::model()->updateByPk($id, $attributes); if ($result) { $successIds[] = $id; } else { $failedIds[] = $id; } } $data = array('success' => $successIds, 'failed' => $failedIds, 'label' => t('user_forbidden', 'admin')); BetaBase::jsonp($callback, $data); }
public function getFilterContent() { $content = BetaBase::filterText($this->content); return nl2br($content); }