Esempio n. 1
0
	function edit() {
		require_once KPATH_SITE . '/lib/kunena.link.class.php';
		$app = JFactory::getApplication ();
		if (! JRequest::checkToken ()) {
			$app->enqueueMessage ( JText::_ ( 'COM_KUNENA_ERROR_TOKEN' ), 'error' );
			$this->redirectBack ();
		}

		$model = $this->getModel('announcement');
		$this->canEdit = $model->getCanEdit();
		if (! $this->canEdit) {
			$app->enqueueMessage ( JText::_ ( 'COM_KUNENA_POST_NOT_MODERATOR' ), 'error' );
			$this->redirectBack ();
		}

		$model->edit();
		if (1) {
			$id = JRequest::getInt ( 'id', 0 );
			$app->enqueueMessage ( JText::_ ( $id ? 'COM_KUNENA_ANN_SUCCESS_EDIT' : 'COM_KUNENA_ANN_SUCCESS_ADD' ) );
		}
		$this->setRedirect (CKunenaLink::GetAnnouncementURL ( 'show', false, false ));
	}
Esempio n. 2
0
	function displayLoginBox($tpl = null) {
		$my = JFactory::getUser ();
		$cache = JFactory::getCache('com_kunena', 'output');
		$cachekey = "{$this->template->name}.common.loginbox.u{$my->id}";
		$cachegroup = 'com_kunena.template';

		$contents = $cache->get($cachekey, $cachegroup);
		if (!$contents) {
			require_once KPATH_SITE . '/lib/kunena.link.class.php';

			$this->assign ( 'moduleHtml', $this->getModulePosition('kunena_profilebox'));

			$login = KunenaFactory::getLogin();
			if ($my->get ( 'guest' )) {
				$this->setLayout('login');
				if ($login) {
					$this->assignRef ( 'login', $login->getLoginFormFields() );
					$this->assignRef ( 'register', $login->getRegistrationURL() );
					$this->assignRef ( 'lostpassword', $login->getResetURL() );
					$this->assignRef ( 'lostusername', $login->getRemindURL() );
				}
			} else {
				$this->setLayout('logout');
				if ($login) $this->assignRef ( 'logout', $login->getLogoutFormFields() );
				$this->lastvisitDate = KunenaDate::getInstance($this->me->lastvisitDate);

				// Private messages
				$private = KunenaFactory::getPrivateMessaging();
				if ($private) {
					$count = $private->getUnreadCount($this->me->userid);
					$this->assign ( 'privateMessagesLink', $private->getInboxLink($count ? JText::sprintf('COM_KUNENA_PMS_INBOX_NEW', $count) : JText::_('COM_KUNENA_PMS_INBOX')));
				}

				// TODO: Edit profile (need to get link to edit page, even with integration)
				//$this->assign ( 'editProfileLink', '<a href="' . CKunenaLink::GetAnnouncementURL ( 'show' ).'">'. JText::_('COM_KUNENA_PROFILE_EDIT').'</a>');

				// Announcements
				if ( $this->me->isModerator()) {
					$this->assign ( 'announcementsLink', '<a href="' . CKunenaLink::GetAnnouncementURL ( 'show' ).'">'. JText::_('COM_KUNENA_ANN_ANNOUNCEMENTS').'</a>');
				}

			}
			$contents = $this->loadTemplate($tpl);
			if (JError::isError($contents)) {
				return $contents;
			}
			$cache->store($contents, $cachekey, $cachegroup);
		}
		$contents = preg_replace_callback('|\[K=(\w+)(?:\:([\w-_]+))?\]|', array($this, 'fillLoginBoxInfo'), $contents);
		echo $contents;
	}
 function delete($id)
 {
     if (!$this->canEdit) {
         while (@ob_end_clean()) {
         }
         $this->app->redirect(CKunenaLink::GetKunenaURL(false), JText::_('COM_KUNENA_POST_NOT_MODERATOR'));
     }
     $query = "DELETE FROM #__kunena_announcement WHERE id={$this->db->Quote($id)} ";
     $this->db->setQuery($query);
     $this->db->query();
     if (KunenaError::checkDatabaseError()) {
         return;
     }
     while (@ob_end_clean()) {
     }
     $this->app->redirect(CKunenaLink::GetAnnouncementURL('show', null, false), JText::_('COM_KUNENA_ANN_DELETED'));
 }
Esempio n. 4
0
// ]]>');
?>
<div id="Kunena">
<?php
$this->displayMenu ();
$this->displayLoginBox ();
?>
<div class="kblock kannouncement">
	<div class="kheader">
		<h2><?php echo JText::_('COM_KUNENA_ANN_ANNOUNCEMENTS'); ?>: <?php echo $this->announcement->id ? JText::_('COM_KUNENA_ANN_EDIT') : JText::_('COM_KUNENA_ANN_ADD'); ?></h2>
	</div>
	<div class="kcontainer" id="kannouncement">
		<div class="kactions"><?php echo CKunenaLink::GetAnnouncementLink('show',NULL, JText::_('COM_KUNENA_ANN_CPANEL'), JText::_('COM_KUNENA_ANN_CPANEL')); ?></div>
		<div class="kbody">
			<div class="kanndesc">
				<form class="form-validate" action="<?php echo CKunenaLink::GetAnnouncementURL('doedit'); ?>" method="post" name="editform" onsubmit="return myValidate(this);">
					<?php echo JHTML::_( 'form.token' ); ?>
				<div>
					<label>
						<?php echo JText::_('COM_KUNENA_ANN_TITLE'); ?>:
						<input class="klarge required" type="text" name="title" value="<?php echo $this->escape($this->announcement->title) ;?>"/>
					</label>
					<label>
						<?php echo JText::_('COM_KUNENA_ANN_SORTTEXT'); ?>:
						<textarea class="ksmall required" rows="80" cols="4" name="sdescription"><?php echo $this->escape($this->announcement->sdescription); ?></textarea>
					</label>
				</div>
				<div>
					<label>
						<?php echo JText::_('COM_KUNENA_ANN_LONGTEXT'); ?>:
						<textarea class="klarge" rows="80" cols="16" name="description"><?php echo $this->escape($this->announcement->description); ?></textarea>
Esempio n. 5
0
                    <br/>

                    <br/>

                    <br/>
                </form>
            </td>
        </tr>
    </tbody>
</table>
</div>
</div>
</div>
</div>
</div>
<?php 
    }
    // FINISH: EDIT ANN
    // BEGIN: delete ANN
    if ($do == "delete") {
        $query1 = "DELETE FROM #__fb_announcement WHERE id={$id} ";
        $kunena_db->setQuery($query1);
        $kunena_db->query() or trigger_dberror("Unable to delete announcement.");
        $app->redirect(CKunenaLink::GetAnnouncementURL($fbConfig, 'show'), _ANN_DELETED);
    }
    // FINISH: delete ANN
    ?>
<!-- /announcement-->
<?php 
}
Esempio n. 6
0
echo JText::_('COM_KUNENA_ANN_ANNOUNCEMENTS');
?>
: <?php 
echo $this->id ? JText::_('COM_KUNENA_ANN_EDIT') : JText::_('COM_KUNENA_ANN_ADD');
?>
</h2>
	</div>
	<div class="kcontainer" id="kannouncement">
		<div class="kactions"><?php 
echo CKunenaLink::GetAnnouncementLink('show', NULL, JText::_('COM_KUNENA_ANN_CPANEL'), JText::_('COM_KUNENA_ANN_CPANEL'));
?>
</div>
		<div class="kbody">
			<div class="kanndesc">
				<form class="form-validate" action="<?php 
echo CKunenaLink::GetAnnouncementURL('doedit');
?>
" method="post" name="editform" onsubmit="return myValidate(this);">
					<?php 
echo JHTML::_('form.token');
?>
				<div>
					<label>
						<?php 
echo JText::_('COM_KUNENA_ANN_TITLE');
?>
:
						<input class="klarge required" type="text" name="title" value="<?php 
echo $this->escape($this->announcement->title);
?>
"/>
Esempio n. 7
0
    ?>
</li>
					<?php 
}
?>
					<?php 
$user_fields = @explode(',', $this->config->annmodid);
if (in_array($this->my->id, $user_fields) || $this->my->usertype == 'Administrator' || $this->my->usertype == 'Super Administrator') {
    $is_editor = true;
} else {
    $is_editor = false;
}
if ($is_editor) {
    ?>
						<li><a href="<?php 
    echo CKunenaLink::GetAnnouncementURL('show');
    ?>
"><?php 
    echo JText::_('COM_KUNENA_ANN_ANNOUNCEMENTS');
    ?>
</a></li>
					<?php 
}
?>
				</ul>
				<ul class="kprofilebox-welcome">
					<li><?php 
echo JText::_('COM_KUNENA_PROFILEBOX_WELCOME');
?>
, <strong><?php 
echo CKunenaLink::GetProfileLink(intval($this->user->id), $this->escape($this->kunena_username));
Esempio n. 8
0
    ?>
"><?php 
    echo _PROFILEBOX_LOGOUT;
    ?>
</a>
<?php 
    $user_fields = @explode(',', $fbConfig->annmodid);
    if (in_array($kunena_my->id, $user_fields) || $kunena_my->usertype == 'Administrator' || $kunena_my->usertype == 'Super Administrator') {
        $is_editor = true;
    } else {
        $is_editor = false;
    }
    if ($is_editor) {
        ?>
| <a href = "<?php 
        echo CKunenaLink::GetAnnouncementURL($fbConfig, 'show');
        ?>
"><?php 
        echo _ANN_ANNOUNCEMENTS;
        ?>
 </a>
<?php 
    }
    ?>
| <?php 
    echo CKunenaLink::GetSearchLink($fbConfig, 'search', '', 0, 0, _KUNENA_SEARCH_ADVSEARCH);
    ?>

</td>
			<?php 
    if (JDocumentHTML::countModules('kunena_profilebox')) {
Esempio n. 9
0
                        <?php 
    }
    ?>

                        <div class = "anndesc">
<?php 
    echo $annsdescription;
    ?>

<?php 
    if (!empty($anndescription)) {
        ?>

    &nbsp;&nbsp;&nbsp;<a href = "<?php 
        echo CKunenaLink::GetAnnouncementURL($fbConfig, 'read', $annID);
        ?>
"> <?php 
        echo _ANN_READMORE;
        ?>
</a>

<?php 
    }
    ?>
                        </div>
                    </td>
                </tr>
        </tbody>
    </table>
    </div>