示例#1
0
文件: forum.php 项目: anqh/forum
 /**
  * Construct controller
  */
 public function before()
 {
     parent::before();
     $this->page_title = __('Forum');
     // Generic page actions
     $this->page_actions['new-posts'] = array('link' => Route::url('forum'), 'text' => '<i class="icon-comment icon-white"></i> ' . __('New posts'));
     // Forum areas dropdown
     $groups = Model_Forum_Group::factory()->find_all();
     $areas = array();
     foreach ($groups as $group) {
         $divider = false;
         foreach ($group->areas() as $area) {
             if (Permission::has($area, Model_Forum_Area::PERMISSION_READ, self::$user)) {
                 $divider = true;
                 $areas[] = array('link' => Route::model($area), 'text' => HTML::entities($area->name));
             }
         }
         if ($divider) {
             $areas[] = array('divider' => true);
         }
     }
     array_pop($areas);
     $this->page_actions['areas'] = array('link' => Route::url('forum_group'), 'text' => '<i class="icon-folder-open icon-white"></i> ' . __('Areas'));
     $this->page_actions['area'] = array('link' => Route::url('forum_group'), 'text' => '', 'dropdown' => $areas);
     if (self::$user) {
         $this->page_actions['private-messages'] = array('link' => Forum::private_messages_url(), 'text' => '<i class="icon-envelope icon-white"></i> ' . __('Private messages'));
     }
 }
示例#2
0
文件: site.php 项目: anqh/anqh
<?php

defined('SYSPATH') or die('No direct access allowed.');
/**
 * Site config
 *
 * @package    Anqh
 * @author     Antti Qvickström
 * @copyright  (c) 2010-2014 Antti Qvickström
 * @license    http://www.opensource.org/licenses/mit-license.php MIT license
 */
return array('site_name' => 'Anqh', 'image_server' => 'images.domain.tld', 'inviteonly' => false, 'email_contact' => '*****@*****.**', 'email_invitation' => '*****@*****.**', 'google_api_key' => false, 'google_analytics' => false, 'google_analytics_domain' => false, 'facebook' => false, 'og' => array('image' => null), 'foursquare_client_id' => null, 'foursquare_client_secret' => null, 'twitter_username' => null, 'share' => false, 'menu' => array('home' => array('url' => URL::site(), 'text' => __('Home'), 'icon' => 'fa fa-home', 'footer' => true), 'events' => array('url' => Route::url('events'), 'text' => __('Events'), 'icon' => 'fa fa-calendar'), 'forum' => array('url' => Route::url('forum'), 'text' => __('Forum'), 'icon' => 'fa fa-comments-o'), 'galleries' => array('url' => Route::url('galleries'), 'text' => __('Galleries'), 'icon' => 'fa fa-camera-retro'), 'music' => array('url' => Route::url('charts'), 'text' => __('Music'), 'icon' => 'fa fa-music'), 'blogs' => array('url' => Route::url('blogs'), 'text' => __('Blogs'), 'icon' => 'fa fa-book'), 'venues' => array('url' => Route::url('venues'), 'text' => __('Venues'), 'icon' => 'fa fa-map-marker'), 'members' => array('url' => Route::url('users'), 'text' => __('Members'), 'icon' => 'fa fa-group'), 'developers' => array('url' => Route::url('developers'), 'text' => __('Developers'), 'icon' => 'fa fa-gift', 'footer' => true), 'contact' => array('url' => Route::url('contact'), 'text' => __('Contact'), 'icon' => 'fa fa-envelope-o', 'footer' => true)), 'menu_visitor' => array('profile' => array('url' => URL::user(true), 'text' => __('Profile'), 'icon' => 'fa fa-fw fa-user'), 'messages' => array('url' => Forum::private_messages_url(), 'text' => __('Private messages'), 'icon' => 'fa fa-fw fa-envelope'), 'favorites' => array('url' => URL::user(true, 'favorites'), 'text' => __('Favorites'), 'icon' => 'fa fa-fw fa-heart'), 'friends' => array('url' => URL::user(true, 'friends'), 'text' => __('Friends'), 'icon' => 'fa fa-fw fa-group'), 'ignores' => array('url' => URL::user(true, 'ignores'), 'text' => __('Ignores'), 'icon' => 'fa fa-fw fa-ban'), 'settings' => array('url' => URL::user(true, 'settings'), 'text' => __('Settings'), 'icon' => 'fa fa-fw fa-cog'), 'signout' => array('url' => Route::url('sign', array('action' => 'out')), 'text' => __('Logout'), 'icon' => 'fa fa-fw fa-sign-out')), 'menu_admin' => array('roles' => array('url' => Route::url('roles'), 'text' => __('Roles'), 'icon' => 'fa fa-fw fa-asterisk'), 'tags' => array('url' => Route::url('tags'), 'text' => __('Tags'), 'icon' => 'fa fa-fw fa-tags'), 'profiler' => array('url' => '#debug', 'text' => __('Profiler'), 'icon' => 'fa fa-fw fa-signal', 'attributes' => array('onclick' => "\$('.kohana').toggle();"))), 'news' => array('forum_area_id' => 1, 'author_id' => 1), 'themes' => array('light' => array('name' => __('Light'), 'icon' => 'fa fa-fw fa-circle-o'), 'mixed' => array('name' => 'Mixed', 'icon' => 'fa fa-fw fa-adjust'), 'dark' => array('name' => __('Dark'), 'icon' => 'fa fa-fw fa-circle')), 'theme' => 'dark', 'ads' => array('enabled' => false, 'slots' => array('header' => 'head', 'side' => 'side_ads')), 'smiley' => array('dir' => 'smiley', 'smileys' => array()));
示例#3
0
文件: page.php 项目: anqh/core
    /**
     * Render visitor.
     *
     * @return  string
     */
    protected function _visitor()
    {
        ob_start();
        /*
        // Sunrise
        if (self::$_user && self::$_user->latitude && self::$_user->longitude) {
        	$latitude  = self::$_user->latitude;
        	$longitude = self::$_user->longitude;
        } else {
        	$latitude  = 60.1829;
        	$longitude = 24.9549;
        }
        $sun = date_sun_info(time(), $latitude, $longitude);
        $sunrise = __(':day, week :week | Sunrise: :sunrise | Sunset: :sunset', array(
        	':day'     => strftime('%A'),
        	':week'    => strftime('%V'),
        	':sunrise' => Date::format(Date::TIME, $sun['sunrise']),
        	':sunset'  => Date::format(Date::TIME, $sun['sunset'])
        ));
        */
        ?>

	<nav id="visitor" class="navbar-text">
		<ul class="nav" role="menubar">
			<li class="menuitem-notifications"><span><?php 
        echo implode(' ', Anqh::notifications(self::$_user));
        ?>
</span></li>
			<li role="menuitem" class="menuitem-profile"><?php 
        echo HTML::avatar(self::$_user->avatar, self::$_user->username, true);
        ?>
</li>

			<li class="dropdown menu-me" role="menuitem" aria-haspopup="true">
				<a class="dropdown-toggle" href="#" data-toggle="dropdown"><?php 
        echo HTML::chars(self::$_user->username);
        ?>
 <b class="caret"></b></a>
				<ul class="dropdown-menu pull-right" role="menu">
					<li role="menuitem"><?php 
        echo HTML::anchor(URL::user(self::$_user->username), '<i class="icon-user icon-white"></i> ' . __('Profile'));
        ?>
<li>
					<li role="menuitem"><?php 
        echo HTML::anchor(Forum::private_messages_url(), '<i class="icon-envelope icon-white"></i> ' . __('Private messages'));
        ?>
</li>
					<li role="menuitem"><?php 
        echo HTML::anchor(URL::user(self::$_user, 'favorites'), '<i class="icon-calendar icon-white"></i> ' . __('Favorites'));
        ?>
</li>
					<li role="menuitem"><?php 
        echo HTML::anchor(URL::user(self::$_user, 'friends'), '<i class="icon-heart icon-white"></i> ' . __('Friends'));
        ?>
</li>
					<li role="menuitem"><?php 
        echo HTML::anchor(URL::user(self::$_user, 'ignores'), '<i class="icon-ban-circle icon-white"></i> ' . __('Ignores'));
        ?>
</li>
					<li role="menuitem"><?php 
        echo HTML::anchor(URL::user(self::$_user, 'settings'), '<i class="icon-cog icon-white"></i> ' . __('Settings'));
        ?>
</li>
					<?php 
        if (self::$_user->has_role('admin')) {
            ?>
					<li class="divider"></li>
					<li class="nav-header"><?php 
            echo __('Admin functions');
            ?>
</li>
					<li role="menuitem" class="admin"><?php 
            echo HTML::anchor(Route::url('roles'), '<i class="icon-asterisk icon-white"></i> ' . __('Roles'));
            ?>
</li>
					<li role="menuitem" class="admin"><?php 
            echo HTML::anchor(Route::url('tags'), '<i class="icon-tags icon-white"></i> ' . __('Tags'));
            ?>
</li>
					<li role="menuitem" class="admin"><?php 
            echo HTML::anchor('#debug', '<i class="icon-signal icon-white"></i> ' . __('Profiler'), array('onclick' => "\$('div.kohana').toggle();"));
            ?>
</li>
					<?php 
        }
        ?>
					<li class="divider"></li>
					<li role="menuitem">
						<?php 
        echo HTML::anchor(Route::url('sign', array('action' => 'out')), '<i class="icon-off icon-white"></i> ' . __('Sign out'));
        ?>
					</li>
				</ul>
			</li>

			<li class="dropdown menu-search" role="menuitem" aria-haspopup="true">
					<a class="dropdown-toggle" href="#" data-toggle="dropdown"><i class="icon-search icon-white"></i> <b class="caret"></b></a>
					<ul class="dropdown-menu pull-right" role="menu">
						<li role="menuitem">
							<?php 
        echo Form::open(null, array('id' => 'form-search-events', 'class' => 'hidden-phone'));
        ?>
							<label class="span2">
								<i class="icon-calendar icon-white"></i>
								<?php 
        echo Form::input('search-events', null, array('class' => 'input-small search-query', 'placeholder' => __('Search events..'), 'title' => __('Enter at least 3 characters')));
        ?>
							</label>
							<?php 
        echo Form::close();
        ?>
						</li>
						<li role="menuitem">
							<?php 
        echo Form::open(null, array('id' => 'form-search-users', 'class' => 'hidden-phone'));
        ?>
							<label class="span2">
								<i class="icon-user icon-white"></i>
								<?php 
        echo Form::input('search-users', null, array('class' => 'input-small search-query', 'placeholder' => __('Search users..'), 'title' => __('Enter at least 2 characters')));
        ?>
							</label>
							<?php 
        echo Form::close();
        ?>
						</li>
					</ul>
			</li>


		</ul>
	</nav><!-- #visitor -->


<?php 
        return ob_get_clean();
    }
示例#4
0
文件: topic.php 项目: anqh/anqh
 /**
  * Action: index
  */
 public function action_index()
 {
     // Go to post?
     $topic_id = (int) $this->request->param('topic_id');
     if ($topic_id) {
         $post_id = (int) $this->request->param('id');
     } else {
         $topic_id = (int) $this->request->param('id');
     }
     // Load topic
     /** @var  Model_Forum_Private_Topic|Model_Forum_Topic  $topic */
     $topic = $this->private ? Model_Forum_Private_Topic::factory($topic_id) : Model_Forum_Topic::factory($topic_id);
     if (!$topic->loaded()) {
         throw new Model_Exception($topic, $topic_id);
     }
     Permission::required($topic, Model_Forum_Topic::PERMISSION_READ);
     // Did we request single post with ajax?
     if (($this->ajax || $this->internal) && isset($post_id)) {
         $this->history = false;
         $post = $this->private ? Model_Forum_Private_Post::factory($post_id) : Model_Forum_Post::factory($post_id);
         if (!$post->loaded()) {
             throw new Model_Exception($topic, $topic_id);
         }
         // Permission is already checked by the topic, no need to check for post
         $this->response->body($this->section_post($topic, $post));
         return;
     }
     // Update counts
     if ($this->private) {
         $topic->mark_as_read(Visitor::$user);
     }
     if (!Visitor::$user || $topic->author_id != Visitor::$user->id) {
         $topic->read_count++;
         $topic->save();
     }
     // Build page
     $this->view = new View_Page();
     $this->view->title = $topic->name;
     $this->view->title_html = Forum::topic($topic);
     $this->view->subtitle = __($topic->post_count == 1 ? ':posts post' : ':posts posts', array(':posts' => Num::format($topic->post_count, 0)));
     $this->view->tab = 'topic';
     $this->page_actions['topic'] = array('link' => Route::model($topic), 'text' => __('Topic'));
     // Breadcrumbs
     $this->page_breadcrumbs[] = HTML::anchor(Route::url('forum'), __('Forum'));
     // Public topic extras
     if (!$this->private) {
         $this->page_breadcrumbs[] = HTML::anchor(Route::model($topic->area()), $topic->area()->name);
         // Quotes are supported only in public forum as we get notifications anyway in private
         if (Visitor::$user) {
             $quotes = Model_Forum_Quote::factory()->find_by_user(Visitor::$user);
             if (count($quotes)) {
                 foreach ($quotes as $quote) {
                     if ($topic->id == $quote->forum_topic_id) {
                         $quote->delete();
                         break;
                     }
                 }
             }
         }
         // Facebook
         Anqh::page_meta('title', $topic->name);
         Anqh::page_meta('url', URL::site(Route::url('forum_topic', array('id' => $topic->id, 'action' => '')), true));
         Anqh::share(true);
         // Model binding
         $area = $topic->area();
         if ($topic->bind_id && ($bind_config = $area->bind_config())) {
             if ($bind_model = $topic->bind_model()) {
                 // Set actions
                 $this->page_actions[] = array('link' => Route::model($bind_model), 'text' => $bind_config['link']);
                 /*					// Set views
                 					foreach ((array)$bind['view'] as $view) {
                 						$this->view->add(View_Page::COLUMN_RIGHT, View_Module::factory($view, array(
                 							$bind['model'] => $model,
                 						)), Widget::TOP);
                 					}*/
             }
         }
     } else {
         $this->page_breadcrumbs[] = HTML::anchor(Forum::private_messages_url(), __('Private messages'));
     }
     // Set actions
     if (Permission::has($topic, Model_Forum_Topic::PERMISSION_UPDATE)) {
         $this->view->actions[] = array('link' => Route::model($topic, 'edit'), 'text' => __('Edit topic'));
     }
     if (Permission::has($topic, Model_Forum_Topic::PERMISSION_POST)) {
         $this->view->actions[] = array('link' => Request::current_uri() . '#reply', 'text' => __('Reply to topic'), 'class' => 'btn btn-primary topic-post');
     }
     // Pagination
     $this->view->add(View_Page::COLUMN_CENTER, $pagination = $this->section_pagination($topic));
     $this->view->subtitle .= ', ' . __($pagination->total_pages == 1 ? ':pages page' : ':pages pages', array(':pages' => Num::format($pagination->total_pages, 0)));
     $this->view->subtitle .= ', ' . __($topic->read_count == 1 ? ':views view' : ':views views', array(':views' => Num::format($topic->read_count, 0)));
     // Go to post?
     if (isset($post_id)) {
         $pagination->item($topic->get_post_number($post_id) + 1);
         // We need to set pagination urls manually if jumped to a post
         $pagination->base_url = Route::model($topic);
     }
     // Recipients
     if ($this->private) {
         $this->view->add(View_Page::COLUMN_RIGHT, $this->section_recipients($topic));
     }
     // Posts
     $this->view->add(View_Page::COLUMN_CENTER, $this->section_topic($topic, $pagination));
     // Reply
     if (Permission::has($topic, Model_Forum_Topic::PERMISSION_POST)) {
         // Old post warning
         if ($topic->last_posted && time() - $topic->last_posted > Date::YEAR) {
             $this->view->add(View_Page::COLUMN_CENTER, $this->section_ancient_warning($topic->last_posted));
         }
         $section = $this->section_post_edit(View_Forum_PostEdit::REPLY, $this->private ? Model_Forum_Private_Post::factory() : Model_Forum_Post::factory());
         $section->forum_topic = $topic;
         $this->view->add(View_Page::COLUMN_CENTER, $section);
     }
     // Pagination
     $this->view->add(View_Page::COLUMN_CENTER, $pagination);
     $this->_side_views();
 }
示例#5
0
文件: visitor.php 项目: anqh/core
    }
    ?>

	<li class="menu-profile">
		<?php 
    echo HTML::avatar($user->avatar, $user->username, true);
    ?>
		<?php 
    echo __(':user <var class="uid">[#:id]</var>', array(':id' => $user->id, ':user' => HTML::user($user)));
    ?>
		<?php 
    echo HTML::anchor('#', '&#9660;', array('class' => 'toggler', 'onclick' => '$("#visitor .submenu").toggleClass("toggled"); return false;'));
    ?>
		<ul class="submenu">
			<li class="menu-messages"><?php 
    echo HTML::anchor(Forum::private_messages_url(), __('Private messages'), array('class' => 'icon private-message'));
    ?>
</li>
			<li class="menu-friends"><?php 
    echo HTML::anchor(URL::user($user, 'friends'), __('Friends'), array('class' => 'icon friends'));
    ?>
</li>
			<li class="menu-ignores"><?php 
    echo HTML::anchor(URL::user($user, 'ignores'), __('Ignores'), array('class' => 'icon ignores'));
    ?>
</li>
			<li class="menu-settings"><?php 
    echo HTML::anchor(URL::user($user, 'settings'), __('Settings'), array('class' => 'icon settings'));
    ?>
</li>
			<?php