Example #1
0
 /**
  * Assign template variables for a given FAQ item.
  *
  * @param array $data	Item data.
  * @param array $auth	Array in form of array(edit => (bool), delete => (bool), move => (bool))
  *	specifying user's permissions.
  * @return null
  */
 protected function assign_item_row_vars($data, $auth)
 {
     $this->faq->__set_array($data);
     // @todo probably should setup an edit time or something for better read tracking in case it was edited
     $folder_img = $folder_alt = '';
     $unread = $this->tracking->get_track(TITANIA_FAQ, $data['faq_id'], true) === 0;
     $this->display->topic_folder_img($folder_img, $folder_alt, 0, $unread);
     $this->template->assign_block_vars('faqlist', array('U_FAQ' => $this->faq->get_url(), 'SUBJECT' => $data['faq_subject'], 'VIEWS' => $data['faq_views'], 'FOLDER_STYLE' => $folder_img, 'FOLDER_IMG' => $this->user->img($folder_img, $folder_alt), 'FOLDER_IMG_SRC' => $this->user->img($folder_img, $folder_alt, false, '', 'src'), 'FOLDER_IMG_ALT' => $this->user->lang[$folder_alt], 'FOLDER_IMG_ALT' => $this->user->lang[$folder_alt], 'FOLDER_IMG_WIDTH' => $this->user->img($folder_img, '', false, '', 'width'), 'FOLDER_IMG_HEIGHT' => $this->user->img($folder_img, '', false, '', 'height'), 'U_MOVE_UP' => $auth['move'] ? $this->faq->get_url('move_up') : false, 'U_MOVE_DOWN' => $auth['move'] ? $this->faq->get_url('move_down') : false, 'U_EDIT' => $auth['edit'] ? $this->faq->get_url('edit') : false, 'U_DELETE' => $auth['delete'] ? $this->faq->get_url('delete') : false, 'S_ACCESS_TEAMS' => $this->access->is_team($data['faq_access']), 'S_ACCESS_AUTHORS' => $this->access->is_author($data['faq_access'])));
 }
Example #2
0
 * @copyright (c) 2008 Customisation Database Team
 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
 *
 */
/**
* @ignore
*/
if (!defined('IN_TITANIA')) {
    exit;
}
titania::add_lang('faq');
$faq_id = request_var('f', 0);
$action = request_var('action', '');
$error = array();
// Setup faq object
$faq = new titania_faq($faq_id);
if ($faq_id) {
    if (!$faq->contrib_id) {
        // Faq does not exist
        trigger_error('FAQ_NOT_FOUND');
    }
    load_contrib($faq->contrib_id);
} else {
    load_contrib();
}
// Output the simple info on the contrib
titania::$contrib->assign_details(true);
switch ($action) {
    case 'create':
    case 'edit':
        if (!phpbb::$auth->acl_get('u_titania_mod_faq_mod') && !phpbb::$auth->acl_get('u_titania_faq_' . $action) && !titania::$contrib->is_author && !titania::$contrib->is_active_coauthor) {