本文整理汇总了PHP中Komento::getTable方法的典型用法代码示例。如果您正苦于以下问题:PHP Komento::getTable方法的具体用法?PHP Komento::getTable怎么用?PHP Komento::getTable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Komento
的用法示例。
在下文中一共展示了Komento::getTable方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: registerToolbar
function registerToolbar()
{
$parentId = JRequest::getVar('parentid', 0);
// JToolBarHelper::title( text, iconfilename )
if ($parentId) {
if ($parentId) {
$parent = Komento::getTable('comments');
$parent->load($parentId);
}
JToolBarHelper::title(JText::_('COM_KOMENTO_COMMENTS_TITLE_CHILD_OF') . $parentId, 'comments');
JToolBarHelper::back(JText::_('COM_KOMENTO_BACK'), 'index.php?option=com_komento&view=comments&parentid=' . $parent->parent_id);
} else {
JToolBarHelper::title(JText::_('COM_KOMENTO_COMMENTS_TITLE'), 'comments');
JToolBarHelper::back(JText::_('COM_KOMENTO_ADMIN_HOME'), 'index.php?option=com_komento');
}
JToolBarHelper::divider();
if (Komento::joomlaVersion() >= '3.0') {
JToolBarHelper::custom('stick', 'star', '', JText::_('COM_KOMENTO_STICK'));
JToolBarHelper::custom('unstick', 'star-empty', '', JText::_('COM_KOMENTO_UNSTICK'));
} else {
JToolBarHelper::custom('stick', 'kmt-stick', '', JText::_('COM_KOMENTO_STICK'));
JToolBarHelper::custom('unstick', 'kmt-unstick', '', JText::_('COM_KOMENTO_UNSTICK'));
}
JToolBarHelper::divider();
JToolBarHelper::publishList();
JToolBarHelper::unpublishList();
JToolBarHelper::divider();
JToolBarHelper::deleteList();
}
示例2: preview
function preview()
{
$id = JRequest::getInt('id');
$table = Komento::getTable('mailq');
$table->load($id);
$ajax = Komento::getAjax();
$ajax->success($table->body, $table->type);
$ajax->send();
}
示例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();
}
示例4: migrateSettings
function migrateSettings()
{
$ajax = Komento::getAjax();
$fromTable = Komento::getTable('configs');
$toTable = Komento::getTable('configs');
$component = JRequest::getVar('component');
$currentComponent = JRequest::getVar('currentComponent');
$fromTable->load($component);
$toTable->load($currentComponent);
$toTable->params = $fromTable->params;
$toTable->store();
$ajax->success();
$ajax->send();
}
示例5: attach
public function attach( $id, $uid )
{
$table = Komento::getTable( 'uploads' );
$state = $table->load( $id );
if( !$state )
{
return false;
}
$table->uid = $uid;
return $table->store();
}
示例6: display
/**
* Generates a random captcha image
*
**/
function display($cachable = false, $urlparams = false)
{
$id = JRequest::getInt( 'captcha-id' , '' );
$captcha = Komento::getTable( 'Captcha' , 'KomentoTable' );
if( ob_get_length() !== false )
{
while (@ ob_end_clean());
if( function_exists( 'ob_clean' ) )
{
@ob_clean();
}
}
// clearing the oudated keys.
$captcha->clear();
// load the captcha records.
$captcha->load( $id );
if( !$captcha->id )
{
return false;
}
// @task: Generate a very random integer and take only 5 chars max.
$hash = JString::substr( md5( rand( 0, 9999 ) ) , 0 , 5 );
$captcha->response = $hash;
$captcha->store();
// Captcha width and height
$width = 100;
$height = 20;
$image = ImageCreate( $width , $height );
$white = ImageColorAllocate($image, 255, 255, 255);
$black = ImageColorAllocate($image, 0, 0, 0);
$gray = ImageColorAllocate($image, 204, 204, 204);
ImageFill( $image , 0 , 0 , $white );
ImageString( $image , 5 , 30 , 3 , $hash , $black );
ImageRectangle( $image , 0 , 0 , $width - 1 , $height - 1 , $gray );
imageline( $image , 0 , $height / 2 , $width , $height / 2 , $gray );
imageline( $image , $width / 2 , 0 , $width / 2 , $height , $gray );
header( 'Content-type: image/jpeg' );
ImageJpeg( $image );
ImageDestroy($image);
exit;
}
示例7: save
public function save($data)
{
$component = $data['component'];
$component = preg_replace('/[^A-Z0-9_\\.-]/i', '', $component);
$component = JString::strtolower(JString::trim($component));
unset($data['component']);
$config = Komento::getTable('Configs');
$config->load($component);
$config->component = $component;
$json = Komento::getJSON();
$config->params = $json->encode($data);
$result = $config->store();
// Save it
if (!$result) {
return false;
}
return true;
}
示例8: display
function display($tpl = null)
{
//initialise variables
$document = JFactory::getDocument();
$user = JFactory::getUser();
$mainframe = JFactory::getApplication();
$components = array();
$result = Komento::getHelper('components')->getAvailableComponents();
if (Komento::joomlaVersion() >= '1.6') {
if (!$user->authorise('komento.manage.comments', 'com_komento')) {
$mainframe->redirect('index.php', JText::_('JERROR_ALERTNOAUTHOR'), 'error');
$mainframe->close();
}
}
//Load pane behavior
jimport('joomla.html.pane');
$commentId = JRequest::getVar('commentid', '');
$comment = Komento::getTable('Comments');
$comment->load($commentId);
$this->comment = $comment;
// Set default values for new entries.
if (empty($comment->created)) {
Komento::import('helper', 'date');
$date = KomentoDateHelper::getDate();
$now = KomentoDateHelper::toFormat($date);
$comment->created = $now;
$comment->published = true;
}
// Set all non published comments to unpublished
if ($comment->published != 1) {
$comment->published = 0;
}
// @task: Translate each component with human readable name.
foreach ($result as $item) {
$components[] = JHTML::_('select.option', $item, Komento::loadApplication($item)->getComponentName());
}
$this->assignRef('comment', $comment);
$this->assignRef('components', $components);
parent::display($tpl);
}
示例9: getAttachments
public function getAttachments( $uid )
{
$sql = Komento::getSql();
$sql->select( '#__komento_uploads' )
->where( 'uid', $uid )
->order( 'created' );
$result = $sql->loadObjectList();
$attachments = array();
foreach( $result as $row )
{
$table = Komento::getTable( 'uploads' );
$table->bind( $row );
$attachments[] = $table;
}
return $attachments;
}
示例10: 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;
}
示例11: download
public function download()
{
$id = JRequest::getInt( 'id' );
// need to get component to check acl because controller link component is com_komento
$filetable = Komento::getTable( 'uploads' );
if( !$filetable->load( $id ) )
{
echo JText::_( 'COM_KOMENTO_ATTACHMENT_INVALID_ID' );
exit;
}
$comment = Komento::getComment( $filetable->uid );
$profile = Komento::getProfile();
if( !$profile->allow( 'download_attachment', $comment->component ) )
{
echo JText::_( 'COM_KOMENTO_ATTACHMENT_NO_PERMISSION' );
exit;
}
return $filetable->download();
}
示例12: foreach
<?php
foreach ($activities as $activity) {
$activity->comment = Komento::getComment($activity->comment_id, $process = true);
$activity->comment->comment = strip_tags($activity->comment->comment);
// trim comment length
if (JString::strlen($activity->comment->comment) > $params->get('maxcommentlength')) {
$activity->comment->comment = JString::substr($activity->comment->comment, 0, $params->get('maxcommentlength')) . '...';
}
// trim title length
if (JString::strlen($activity->comment->contenttitle) > $params->get('maxtitlelength')) {
$activity->comment->contenttitle = JString::substr($activity->comment->contenttitle, 0, $params->get('maxtitlelength')) . '...';
}
$profile = Komento::getProfile($activity->uid);
$config = Komento::getConfig($activity->comment->component);
if ($activity->uid != 0 && $profile->id != $activity->uid && $config->get('enable_orphanitem_convert')) {
$table = Komento::getTable('activities');
$table->load($activity->id);
$table->uid = $config->get('orphanitem_ownership');
$table->store();
$activity->uid = $config->get('orphanitem_ownership');
}
?>
<div class="mod-item stream kmt-activity-<?php
echo $activity->id;
?>
">
<div class="stream-head stream-<?php
echo $activity->type;
?>
">
<i class="stream-type"></i>
示例13: migrate
function migrate()
{
$params = JRequest::getVar('params');
$comments = $this->model->getData((object) $params['data']);
$count = count($comments);
foreach ($comments as $comment) {
if ($comment->cid == 'kmt-none') {
continue;
}
$comment->parent_id = 0;
$this->kmtmodel->updateCommentLftRgt($comment);
$newComment = Komento::getTable('comments');
$newComment->bind($comment);
$newComment->store();
}
$newStart = $params['data']['start'] + $count;
$this->ajax->update($count);
$this->ajax->success($newStart);
$this->ajax->send();
}
示例14: mark
public function mark( $type = '0' )
{
$commentTable = Komento::getTable( 'Comments' );
$commentTable->bind($this->getProperties());
$userId = JFactory::getUser()->id;
// remove all reported flags
$actionsModel = Komento::getModel( 'Actions' );
$actionsModel->removeAction('spam', $commentTable->id, 'all');
$actionsModel->removeAction('offensive', $commentTable->id, 'all');
$actionsModel->removeAction('offtopic', $commentTable->id, 'all');
$commentTable->flag = $type;
$commentTable->flag_by = $userId;
if( !$commentTable->store() )
{
$this->setError( 'Comment mark failed' );
return false;
}
return true;
}
示例15: process
public function process( $action, $comment )
{
// process all activities and 3rd party integration here
// Due to the possible conflict data of $comment->created containing lapsed time instead of raw date, we use the table object directly instead
if( !( $comment instanceof KomentoTableComments ) )
{
$id = 0;
if( is_int( $comment ) || is_string( $comment ) )
{
$id = $comment;
}
if( $comment instanceof KomentoComment )
{
$id = $comment->id;
}
$comment = Komento::getTable( 'comments' );
$comment->load( $id );
}
if( $action != 'remove' && $comment->published != 1 )
{
return false;
}
$config = Komento::getConfig();
$profile = Komento::getProfile();
$application = Komento::loadApplication( $comment->component )->load( $comment->cid );
if( $application === false)
{
$application = Komento::getErrorApplication( $comment->component, $comment->cid );
}
$pagelink = $application->getContentPermalink();
$permalink = $pagelink . '#' . $comment->id;
$author = $application->getAuthorId();
$title = $application->getContentTitle();
if( $profile->id == 0 )
{
return false;
}
// native activity
if( ( $action == 'comment' && $config->get( 'activities_comment' ) ) || ( $action == 'reply' && $config->get( 'activities_reply' ) ) || ( $action == 'like' && $config->get( 'activities_like' ) ) )
{
$this->addActivity( $action, $comment->id, $comment->created_by );
}
// Add jomsocial activity
if( $action == 'comment' && $config->get( 'jomsocial_enable_comment' ) )
{
$this->addJomSocialActivityComment( $comment );
}
if( $action == 'reply' && $config->get( 'jomsocial_enable_reply' ) )
{
$this->addJomSocialActivityReply( $comment );
}
if( $action == 'like' && $config->get( 'jomsocial_enable_like' ) )
{
$this->addJomSocialActivityLike( $comment, $profile->id );
}
// Add jomsocial userpoints
if( $config->get( 'jomsocial_enable_userpoints' ) )
{
switch( $action )
{
case 'comment':
Komento::addJomSocialPoint( 'com_komento.comment.add' );
Komento::addJomSocialPoint( 'com_komento.comment.add.author', $author );
break;
case 'reply':
Komento::addJomSocialPoint( 'com_komento.comment.reply' );
break;
case 'like':
Komento::addJomSocialPoint( 'com_komento.comment.like' );
Komento::addJomSocialPoint( 'com_komento.comment.liked', $comment->created_by );
break;
case 'unlike':
Komento::addJomSocialPoint( 'com_komento.comment.unlike' );
Komento::addJomSocialPoint( 'com_komento.comment.unliked', $comment->created_by );
break;
case 'report':
Komento::addJomSocialPoint( 'com_komento.comment.report' );
Komento::addJomSocialPoint( 'com_komento.comment.reported', $comment->created_by );
break;
case 'unreported':
Komento::addJomSocialPoint( 'com_komento.comment.unreport' );
Komento::addJomSocialPoint( 'com_komento.comment.unreported', $comment->created_by );
//.........这里部分代码省略.........