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


PHP Komento::getDate方法代码示例

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


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

示例1: clear

 /**
  * Delete the outdated entries.
  */
 public function clear()
 {
     $db = Komento::getDBO();
     $date = Komento::getDate();
     $query = 'DELETE FROM ' . $db->nameQuote('#__komento_captcha') . ' WHERE ' . $db->nameQuote('created') . ' <= DATE_SUB( ' . $db->Quote($date->toMySQL()) . ', INTERVAL 12 HOUR )';
     $db->setQuery($query);
     $db->query();
     return true;
 }
开发者ID:kosmosby,项目名称:medicine-prof,代码行数:12,代码来源:captcha.php

示例2: upload

	public function upload( $fileItem, $fileName = '', $storagePath = '', $published = 1 )
	{
		// $fileItem['name'] = filename
		// $fileItem['type'] = mime
		// $fileItem['tmp_name'] = temporary source
		// $fileItem['size'] = size

		if( empty( $fileItem ) )
		{
			return false;
		}

		// store record first
		$uploadtable = Komento::getTable( 'uploads' );

		$now = Komento::getDate()->toMySQL();
		$uploadtable->created = $now;

		$profile = Komento::getProfile();
		$uploadtable->created_by = $profile->id;

		$uploadtable->published = $published;

		$uploadtable->mime = $fileItem['type'];

		$uploadtable->size = $fileItem['size'];

		if( $fileName == '' )
		{
			$fileName = $fileItem['name'];
		}
		$uploadtable->filename = $fileName;

		if( $storagePath == '' )
		{
			$config = Komento::getConfig();
			$storagePath = $config->get( 'upload_path' );
		}
		$uploadtable->path = $storagePath;

		if( !$uploadtable->upload() )
		{
			return false;
		}

		$source = $fileItem['tmp_name'];
		$destination = $uploadtable->getFilePath();

		jimport( 'joomla.filesystem.file' );
		if( !JFile::copy( $source , $destination ) )
		{
			$uploadtable->rollback();
			return false;
		}

		return $uploadtable->id;
	}
开发者ID:kosmosby,项目名称:medicine-prof,代码行数:57,代码来源:file.php

示例3: add

	public function add( $type, $comment_id, $uid )
	{
		$table	= Komento::getTable( 'activities' );

		$table->type		= $type;
		$table->comment_id	= $comment_id;
		$table->uid			= $uid;
		$table->created		= Komento::getDate()->toMySQL();
		$table->published	= 1;

		return $table->store();
	}
开发者ID:kosmosby,项目名称:medicine-prof,代码行数:12,代码来源:activity.php

示例4: getReloadSyntax

	public function getReloadSyntax()
	{
		if ($currentId = JRequest::getInt( 'captcha-id' ))
		{
			$ref	= Komento::getTable( 'Captcha' , 'KomentoTable' );
			$ref->load( $currentId );
			$ref->delete();
		}

		// Regenerate a new captcha object
		$captcha	= Komento::getTable( 'Captcha' , 'KomentoTable' );
		$captcha->created	= Komento::getDate()->toMySQL();
		$captcha->store();

		$url	= $this->getCaptchaUrl( $captcha->id );

		$reloadData = array(
			'image'	=> $url,
			'id'	=> $captcha->id
		);

		return $reloadData;
	}
开发者ID:kosmosby,项目名称:medicine-prof,代码行数:23,代码来源:captcha.php

示例5: subscribe

	private function subscribe( $type = 'comment', $component, $cid, $commentId = 0, $userid = 0, $name, $email )
	{
		if( $commentId !== 0 && ( !$component || !$cid ) )
		{
			$comment = Komento::getComment( $commentId );
			$component = $comment->component;
			$cid = $comment->cid;
		}

		if( !$component || !$cid )
		{
			return false;
		}

		$subscriptionExist = Komento::getModel( 'subscription' )->checkSubscriptionExist( $component, $cid, $userid, $email, $type );

		if( !$subscriptionExist )
		{
			$data = array(
				'type'		=> $type,
				'component' => $component,
				'cid'		=> $cid,
				'userid'	=> $userid,
				'fullname'	=> $name,
				'email'		=> $email,
				'created'	=> Komento::getDate()->toMySQL(),
				'published'	=> 1
			);

			$config = Komento::getConfig();

			if( $config->get( 'subscription_confirmation' ) )
			{
				$data['published'] = 0;
			}

			$subscribeTable = Komento::getTable( 'subscription' );

			$subscribeTable->bind( $data );

			if( !$subscribeTable->store() )
			{
				return false;
			}

			if( $config->get( 'subscription_confirmation' ) )
			{
				Komento::getHelper( 'Notification' )->push( 'confirm', 'me', array( 'component' => $component, 'cid' => $cid, 'subscribeId' => $subscribeTable->id, 'commentId' => $commentId ) );
			}
		}

		return true;
	}
开发者ID:kosmosby,项目名称:medicine-prof,代码行数:53,代码来源:view.ajax.php

示例6: populatedb

 public function populatedb()
 {
     $db = Komento::getDBO();
     $articles = array('8', '50', '35');
     $authors = array('0' => 'Alien', '42' => 'Super User', '62' => 'Jason');
     $comments = array('hahaha :) love you', 'me too!!!', 'this is a link http://test.com', '[b]bbcode in use[/b] :( fuck you');
     $parentmap = array();
     $counter = 0;
     $date = Komento::getDate();
     for ($i = 0; $i < 20000; $i++) {
         $date->sub(new DateInterval('PT' . (20001 - $i) . 'S'));
         $modulo = $i % 3;
         $set = (int) ($i / 3);
         $setmodulo = (int) ($set / 3);
         $factor = $setmodulo * 6;
         $level = $set % 3 + 1;
         $lft = $level + $factor;
         $rgt = 7 - $level + $factor;
         $author = array_rand($authors);
         $article = $articles[$modulo];
         $comment = array_rand($comments);
         $parentid = 0;
         if ($level > 1) {
             $parentid = $parentmap[$article][$setmodulo][$level - 1];
         }
         $table = Komento::getTable('comments');
         $table->component = 'com_content';
         $table->comment = $comments[$comment];
         $table->cid = $article;
         $table->lft = $lft;
         $table->rgt = $rgt;
         $table->published = 1;
         $table->name = $authors[$author];
         $table->created_by = $author;
         $table->created = $date->toMySQL();
         $table->parent_id = $parentid;
         $result = $table->store();
         if (!$result) {
             var_dump($table);
             exit;
         }
         $parentmap[$article][$setmodulo][$level] = $table->id;
     }
     echo 'done';
     exit;
 }
开发者ID:kosmosby,项目名称:medicine-prof,代码行数:46,代码来源:controller.php

示例7: push


//.........这里部分代码省略.........
		// process requested recipients first
		foreach ($recipients as $recipient)
		{
			$recipient		= 'get' . ucfirst( strtolower( trim($recipient) ) );

			if( !method_exists($this, $recipient) )
			{
				continue;
			}

			if( $recipient == 'getMe' )
			{
				$skipMe = false;
			}

			$result = $this->$recipient( $type, $options );

			// stacking up all the emails and details
			$rows	= $rows + $result;
		}

		// process usergroups notification based on notification type
		$rows = $rows + $this->getUsergroups( $type );

		if( $type == 'report' )
		{
			$admins = $this->getAdmins();

			foreach( $admins as $admin )
			{
				if( isset($rows[$options['comment']->email]) && $options['comment']->email === $admin->email )
				{
					$skipMe = false;
				}
			}
		}

		if( empty($rows) )
		{
			return;
		}

		// Do not send to the commentor/actor
		if( $skipMe && isset($rows[$options['comment']->email]) )
		{
			unset( $rows[$options['comment']->email] );
		}

		$lang = JFactory::getLanguage();

		// Load English first as fallback
		$konfig = Komento::getKonfig();
		if( $konfig->get( 'enable_language_fallback' ) )
		{
			$lang->load( 'com_komento', JPATH_ROOT, 'en-GB', true );
		}

		// Load site's selected language
		$lang->load( 'com_komento', JPATH_ROOT, $lang->getDefault(), true );

		// Load user's preferred language file
		$lang->load( 'com_komento', JPATH_ROOT, null, true );

		$jconfig	= JFactory::getConfig();
		$data		= $this->prepareData( $type, $options );
		$template	= $this->prepareTemplate( $type, $options );
		$subject	= $this->prepareTitle( $type, $options );

		$mailfrom	= Komento::_( 'JFactory::getConfig', 'mailfrom' );
		$fromname	= Komento::_( 'JFactory::getConfig', 'fromname' );

		$config	= Komento::getConfig();
		$sendHTML = $config->get( 'notification_sendmailinhtml' ) ? 'html' : 'text';

		// Storing notifications into mailq
		foreach ($rows as $row)
		{
			if( Komento::trigger( 'onBeforeSendNotification', array( 'component' => $options['component'], 'cid' => $options['cid'], 'recipient' => &$row ) ) === false )
			{
				continue;
			}

			if( empty( $row->email ) )
			{
				continue;
			}

			$body	= $this->getTemplateBuffer( $template, $data, array( 'recipient' => $row ) );
			$mailQ	= Komento::getTable( 'mailq' );
			$mailQ->mailfrom	= $mailfrom;
			$mailQ->fromname	= $fromname;
			$mailQ->recipient	= $row->email;
			$mailQ->subject		= $subject;
			$mailQ->body		= $body;
			$mailQ->created		= Komento::getDate()->toMySQL();
			$mailQ->type		= $sendHTML;
			$mailQ->status		= 0;
			$result = $mailQ->store();
		}
	}
开发者ID:kosmosby,项目名称:medicine-prof,代码行数:101,代码来源:notification.php

示例8: publish

 function publish($comments = array(), $publish = 1)
 {
     if ($comments == null) {
         return false;
     }
     if (!is_array($comments)) {
         $comments = array($comments);
     }
     $affectChild = JRequest::getInt('affectchild', 0);
     if (count($comments) > 0) {
         $now = Komento::getDate()->toMySql();
         $publishDateColumn = '';
         if ($publish == 0) {
             $publishDateColumn = 'publish_down';
         } else {
             $publishDateColumn = 'publish_up';
         }
         $nodes = $comments;
         foreach ($nodes as $comment) {
             $related = array();
             if ($publish == 1) {
                 $related = array_merge($related, self::getParents($comment));
             }
             if ($publish == 0 || $publish == 1 && $affectChild) {
                 $related = array_merge($related, self::getChilds($comment));
             }
             if (count($related) > 0) {
                 $comments = array_merge($comments, $related);
             }
         }
         $comments = array_unique($comments);
         $allComments = implode(',', $comments);
         foreach ($comments as $comment) {
             if (!Komento::getComment($comment)->publish($publish)) {
                 return false;
             }
         }
         return true;
     }
     return false;
 }
开发者ID:BetterBetterBetter,项目名称:B3App,代码行数:41,代码来源:comments.php

示例9: setReplyTime

	function setReplyTime()
	{
		return $this->session->set('komento_last_reply', serialize( Komento::getDate()->toUnix() ) );
	}
开发者ID:kosmosby,项目名称:medicine-prof,代码行数:4,代码来源:session.php

示例10: save

 function save($comment)
 {
     $new = Komento::getTable('comments');
     $new->component = $this->component;
     $new->cid = $this->cid;
     $new->comment = $comment->comment;
     $new->name = $comment->name;
     $new->email = $comment->email;
     $new->url = $comment->website;
     // careful because rscomments save their datetime in unix format
     $new->created = Komento::getDate($comment->date)->toMySql();
     $new->created_by = $comment->uid;
     $new->published = $comment->published;
     $new->ip = $comment->ip;
     $new->parent_id = $comment->parent_id;
     $new->lft = $comment->lft;
     $new->rgt = $comment->rgt;
     if ($this->publishingState !== 'inherit') {
         $new->published = $this->publishingState;
     }
     if (!$new->store()) {
         return false;
     }
     return $new;
 }
开发者ID:kosmosby,项目名称:medicine-prof,代码行数:25,代码来源:migrators.php

示例11: getContentPermalink

 public function getContentPermalink()
 {
     require_once JPATH_ROOT . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_jevents' . DIRECTORY_SEPARATOR . 'jevents.defines.php';
     require_once JPATH_ROOT . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_jevents' . DIRECTORY_SEPARATOR . 'libraries' . DIRECTORY_SEPARATOR . 'helper.php';
     $Itemid = JEVHelper::getItemid();
     $task = JRequest::getCmd('task');
     $title = JFilterOutput::stringURLSafe($this->_item->summary);
     $date = Komento::getDate($this->_item->dtstart);
     $year = $date->toFormat('%Y');
     $month = $date->toFormat('%m');
     $day = $date->toFormat('%d');
     //Get the rp_id from the #__jevents_repetition table and assign to the permalink url
     $newEventId = $this->getEventId($this->_item->ev_id);
     $link = 'index.php?option=com_jevents&task=icalrepeat.detail&evid=' . $newEventId . '&Itemid=' . $Itemid . '&year=' . $year . '&month=' . $month . '&day=' . $day . '&title=' . $title . '&uid=' . $this->_item->uid;
     $link = $this->prepareLink($link);
     return $link;
 }
开发者ID:BetterBetterBetter,项目名称:B3App,代码行数:17,代码来源:com_jevents.php

示例12: addAction

	function addAction($type, $comment_id, $user_id)
	{
		$comment	= Komento::getComment( $comment_id );

		$now			= Komento::getDate()->toMySQL();

		$actionsTable	= Komento::getTable( 'actions' );

		$actionsTable->type			= $type;
		$actionsTable->comment_id	= $comment_id;
		$actionsTable->action_by	= $user_id;
		$actionsTable->actioned		= $now;

		if(!$actionsTable->store())
		{
			return false;
			// return JText::_( 'COM_KOMENTO_LIKES_ERROR_SAVING_LIKES' );
		}

		return $actionsTable->id;
	}
开发者ID:kosmosby,项目名称:medicine-prof,代码行数:21,代码来源:actions.php

示例13: addMailq

	public function addMailq($component, $cid)
	{
		$config = Komento::getConfig();

		$subscribers = Komento::getModel('subscription')->getSubscribers($component, $cid);

		$mainframe	= JFactory::getApplication();
		$mailfrom	= $mainframe->getCfg( 'mailfrom' );
		$fromname 	= $mainframe->getCfg( 'fromname' );

		if( $config->get( 'admin_email' ) )
		{
			// get from config if config exist
		}

		if( count( $subscribers ) > 0 )
		{
			foreach( $subscribers as $subscriber )
			{
				$data = array(
					'mailfrom'	=> $mailfrom,
					'fromname'	=> $fromname,
					'recipient'	=> $subscriber->email,
					'subject'	=> 'new email',
					'body'		=> 'body',
					'created'	=> Komento::getDate()->toMySQL(),
					'status'	=> 0
				);

				$mailqTable = Komento::getTable( 'mailq' );

				$mailqTable->bind( $data );
				$mailqTable->store();
			}

			return true;
		}

		return false;
	}
开发者ID:kosmosby,项目名称:medicine-prof,代码行数:40,代码来源:mailqueue.php

示例14: generate

 public function generate()
 {
     return JString::substr(md5($this->uid . $this->type . Komento::getDate()->toMySQL()), 0, 12);
 }
开发者ID:kosmosby,项目名称:medicine-prof,代码行数:4,代码来源:hashkeys.php

示例15: publish

	public function publish( $type = '1' )
	{
		// set new = false
		$new = false;

		// Create the comment table object
		$commentTable = Komento::getTable( 'Comments' );
		$commentTable->bind($this->getProperties());

		// get date
		$now = Komento::getDate()->toMySQL();

		// check original status == 2
		if( $commentTable->published == 2 )
		{
			$new = true;
		}

		$commentTable->published = $type;

		if( $type == '1' )
		{
			$commentTable->publish_up = $now;
		}
		else
		{
			$commentTable->publish_down = $now;
		}

		// Trigger onBeforePublishComment( $this->component, $this->cid, &$this )
		// Trigger onBeforeUnpublishComment( $this->component, $this->cid, &$this )
		$triggerResult = true;
		if( $type == '1' )
		{
			$triggerResult = Komento::trigger( 'onBeforePublishComment', array( 'component' => $this->component, 'cid' => $this->cid, 'comment' => &$this ) );
		}
		else
		{
			$triggerResult = Komento::trigger( 'onBeforeUnpublishComment', array( 'component' => $this->component, 'cid' => $this->cid, 'comment' => &$this ) );
		}

		if( $triggerResult === false )
		{
			$this->setError( 'Trigger onBeforePublishComment/onBeforeUnpublishComment false' );
			return false;
		}

		if( !$commentTable->store() )
		{
			$this->setError( 'Comment publish/unpublish failed' );
			return false;
		}

		// bind with comment table data after successfully saving comment table.
		$this->setProperties($commentTable->getProperties());

		// Trigger onAfterPublishComment( $this->component, $this->cid, &$this )
		// Trigger onAfterUnpublishComment( $this->component, $this->cid, &$this )
		if( $type == '1' )
		{
			Komento::trigger( 'onAfterPublishComment', array( 'component' => $this->component, 'cid' => $this->cid, 'comment' => &$this ) );
		}
		else
		{
			Komento::trigger( 'onAfterUnpublishComment', array( 'component' => $this->component, 'cid' => $this->cid, 'comment' => &$this ) );
		}

		if( $new )
		{
			$config = Komento::getConfig( $commentTable->component );

			$action = $commentTable->parent_id ? 'reply' : 'comment';

			// send email
			if( $config->get( 'notification_enable' ) )
			{
				if( ( $action == 'comment' && $config->get( 'notification_event_new_comment' ) ) || ( $action == 'reply' && $config->get( 'notification_event_new_reply' ) ) )
				{
					Komento::getHelper( 'Notification' )->push( $action, 'subscribers,author,usergroups', array( 'commentId' => $commentTable->id ) );
				}
			}

			// process activities
			$activity = Komento::getHelper( 'activity' )->process( $action, $commentTable->id );

			// Manually get the attachment of this comment and process the "upload" activity
			$attachments = $commentTable->getAttachments();
			$totalAttachments = count( $attachments );
			for( $i = 0; $i < $totalAttachments; $i++ )
			{
				Komento::getHelper( 'activity' )->process( 'upload', $commentTable->id );
			}
		}

		return true;
	}
开发者ID:kosmosby,项目名称:medicine-prof,代码行数:96,代码来源:comment.php


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