当前位置: 首页>>代码示例>>PHP>>正文


PHP Topic::getUser方法代码示例

本文整理汇总了PHP中Topic::getUser方法的典型用法代码示例。如果您正苦于以下问题:PHP Topic::getUser方法的具体用法?PHP Topic::getUser怎么用?PHP Topic::getUser使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Topic的用法示例。


在下文中一共展示了Topic::getUser方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: deletetopic

function deletetopic()
{
	global $CONF;
	$user = $_SESSION['user'];

	if (!isset($_GET['topicid_deletetopic']) || empty($_GET['topicid_deletetopic']))
		return array('ok'=>'false','error'=>'no id');
	elseif ($user->isAnon())
		return array('ok'=>false,'error'=>'anon cannot delete topic');
	else {

		$topic = new Topic();
		$topic->setId($_GET['topicid_deletetopic']);
		$topic->load();
		if (
		    (!$topic->getUser()->isAnon() && $topic->getUser()->getId() == $user->getId()) ||
		    ($topic->getChannel()->getUser()->getId() == $user->getId())
		   )
		{
			$topic->delete();
			return array('ok'=>true,'error'=>'');
		}
		return array('ok'=>false,'error'=>'you cannot delete this topic');
	}
}
开发者ID:rczeus,项目名称:Rapid-Coffee,代码行数:25,代码来源:deletetopic.php

示例2: update_topic

function update_topic()
{
	global $user;
	global $CONF;

//	if (isset($_SESSION['topic_last_flood_time'])){
//
//		if ((time() - $_SESSION['topic_last_flood_time']) < $CONF['topic_time_to_wait_flood']){
//			$time_to_wait = $CONF['topic_time_to_wait_flood'] - (time() - $_SESSION['topic_last_flood_time']);
//			return array('ok'=>false, 'error'=>'flood '.$time_to_wait);
//		}
//
//	}

	$_SESSION['topic_last_flood_time']=time();

	$user = $_SESSION['user'];	

	$topic = new Topic();
	if (isset($_GET['topicid_update_topic'])){
		$topic->setId($_GET['topicid_update_topic']);
		$topic->load();
		if ( ($user->getId()!=$topic->getUser()->getId()) || ($user->isAnon()!=$topic->getUser()->isAnon()) )
			return array('ok'=>false, 'error'=>'you are not the owner');
	} else {
		return array('ok'=>false, 'error'=>'no id');
	}

	//$subject = strip_tags($_POST['subject']);
	//if (strlen(str_replace(' ', '', $subject)) < $CONF['min_msg_chars'])
	//	return array('ok'=>false, 'error'=>'Too short subject.');
	//$topic->setSubject($subject);

	$msg = unescape_ampersand($_POST['msg_update_topic']);
	if (strlen(str_replace(' ', '', strip_tags($msg))) < $CONF['min_msg_chars'])
		return array('ok'=>false, 'error'=>'Too short message.');

	$msg = strip_tags($msg, $CONF['permitted_tags_msg']);
	$topic->setMsg($msg);

	if ($topic->save()=='ok'){
		//$topic->follow();
		return array('ok'=>true, 'error'=>'');
	}
	else
		return array('ok'=>false, 'error'=>'problems with this topic');
}
开发者ID:rczeus,项目名称:Rapid-Coffee,代码行数:47,代码来源:update_topic.php

示例3: foreach

 $count = 0;
 foreach ($fileC as $line) {
     $temp = new Post($line);
     $userId = $temp->getUser()->getUserId();
     $fileC = file("db/Users/" . $userId . ".dat", FILE_IGNORE_NEW_LINES);
     $fileC[4] = trim($fileC[4]) - 1;
     $str = "";
     foreach ($fileC as $temp) {
         $str .= $temp . "\n";
     }
     file_put_contents("db/Users/" . $userId . ".dat", $str);
     $count++;
 }
 //******************************
 $topic = new Topic(file_get_contents("db/Topics/" . $_GET['topicId'] . "/topic.dat", FILE_IGNORE_NEW_LINES));
 $fileC = file("db/Users/" . $topic->getUser()->getUserId() . ".dat", FILE_IGNORE_NEW_LINES);
 $fileC[3] = trim($fileC[3]) - 1;
 $str = "";
 foreach ($fileC as $temp) {
     $str .= $temp . "\n";
 }
 file_put_contents("db/Users/" . $topic->getUser()->getUserId() . ".dat", $str);
 //*******************************
 $fileC = file("db/forumStatistics.dat", FILE_IGNORE_NEW_LINES);
 $fileC[1] = $fileC[1] - 1;
 $fileC[2] = $fileC[2] - $count;
 $str = "";
 foreach ($fileC as $temp) {
     $str .= $temp . "\n";
 }
 file_put_contents("db/forumStatistics.dat", $str);
开发者ID:rosslagerwall,项目名称:floobb,代码行数:31,代码来源:moderate.php


注:本文中的Topic::getUser方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。