Ejemplo n.º 1
0
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.

"""
from django.conf.urls.defaults import *
from b3portal.plugins import PLUGINS
from b3portal.plugins import is_plugin_installed
from django.conf import settings
import views

urlpatterns = patterns(
    "",
    url(r"^$", views.home),
    url(r"^userinformation/$", views.userinformation, name="userinformation"),
    url(r"^client/", include("b3portal.client.urls")),
    url(r"^banned/", include("b3portal.penalties.urls")),
    url(r"^server/", include("b3portal.server.urls", namespace="server")),
    url(r"^rcon/", include("b3portal.rconadmin.urls", namespace="rcon")),
)

for plugin in PLUGINS:
    if is_plugin_installed(plugin[0]):
        app = plugin[0]
        urlpatterns += patterns("", url(r"^%s/" % app, include("b3portal.plugins.%s.urls" % app, namespace=app)))
Ejemplo n.º 2
0
    client = get_object_or_404(Client, id=id, using=request.server)
    
    try:
        if client.group.level >= settings.HIGH_LEVEL_CLIENT:
            if not has_server_perm(request.user, perm.VIEW_HIGH_LEVEL_CLIENT, request.server):
                messages.warning(request, _('You are not authorized to view details about this player.'))
                raise Http403
    except Group.DoesNotExist:
        pass
    except Exception, e:
        logger.exception(str(e))
        raise
    
    online = None
    server = Server.objects.get(uuid=request.server)
    if is_plugin_installed('status'):
        try:
            from b3portal.plugins.status.models import ServerStatus
            status = ServerStatus.objects.filter(server=server).latest()
            online = status.is_online(client.id)
        except Exception, e:
            logger.exception(str(e))

    playedtime = None
    playedlastmonth = None
    if is_plugin_enabled(server, 'ctime'):
        try:
            from b3portal.plugins.ctime import functions as ctime
            from common.utils.timesince import minutes_to_string
            ptime = ctime.get_total_playtime(client, request.server)
            playedtime = {'start': ptime['since'], 'total': minutes_to_string(ptime['total'])}