1a107601fa490ca69215facceebe3d0dc5e7f1f8 | 6bcef0037bdb2d139a15065c3f31e872bae79df3 | ||
---|---|---|---|
154 | 154 | ||
155 | # if permalink page, add that message first to the content | 155 | # if permalink page, add that message first to the content |
156 | if comment: | 156 | if comment: |
157 | displayPane.append(PermalinkMessage(article.permalink)) | 157 | displayPane.append(PermalinkMessage(article.make_permalink_slow())) |
158 | 158 | ||
159 | # insert reply box only for logged in user | 159 | # insert reply box only for logged in user |
160 | if c.user_is_loggedin and article.subreddit_slow.can_comment(c.user): | 160 | if c.user_is_loggedin and article.subreddit_slow.can_comment(c.user): |
... | ... | ||
328 | ).render() | 328 | ).render() |
329 | return res | 329 | return res |
330 | 330 | ||
331 | def GET_stylesheet(self): | ||
332 | if hasattr(c.site,'stylesheet_contents') and not g.css_killswitch: | ||
333 | self.check_modified(c.site,'stylesheet_contents') | ||
334 | |||
335 | c.response.content = c.site.stylesheet_contents | ||
336 | c.response_content_type = 'text/css' | ||
337 | |||
338 | return c.response | ||
339 | else: | ||
340 | return self.abort404() | ||
341 | |||
331 | @base_listing | 342 | @base_listing |
332 | @validate(location = nop('location')) | 343 | @validate(location = nop('location')) |
333 | def GET_editreddit(self, location, num, after, reverse, count): | 344 | def GET_editreddit(self, location, num, after, reverse, count): |
334 | """Edit reddit form. """ | 345 | """Edit reddit form.""" |
335 | if isinstance(c.site, FakeSubreddit): | 346 | if isinstance(c.site, FakeSubreddit): |
336 | return self.abort404() | 347 | return self.abort404() |
337 | 348 | ||
... | ... | ||
346 | pane = BannedList(editable = is_moderator) | 357 | pane = BannedList(editable = is_moderator) |
347 | elif location == 'contributors' and c.site.type != 'public': | 358 | elif location == 'contributors' and c.site.type != 'public': |
348 | pane = ContributorList(editable = is_moderator) | 359 | pane = ContributorList(editable = is_moderator) |
360 | elif (location == 'stylesheet' | ||
361 | and c.site.can_change_stylesheet(c.user) | ||
362 | and not g.css_killswitch): | ||
363 | if hasattr(c.site,'stylesheet_contents_user') and c.site.stylesheet_contents_user: | ||
364 | stylesheet_contents = c.site.stylesheet_contents_user | ||
365 | elif hasattr(c.site,'stylesheet_contents') and c.site.stylesheet_contents: | ||
366 | stylesheet_contents = c.site.stylesheet_contents | ||
367 | else: | ||
368 | stylesheet_contents = '' | ||
369 | pane = SubredditStylesheet(site = c.site, | ||
370 | stylesheet_contents = stylesheet_contents) | ||
349 | elif is_moderator and location == 'spam': | 371 | elif is_moderator and location == 'spam': |
350 | links = Link._query(Link.c._spam == True) | 372 | links = Link._query(Link.c._spam == True) |
351 | comments = Comment._query(Comment.c._spam == True) | 373 | comments = Comment._query(Comment.c._spam == True) |
... | ... | ||
486 | """wipe login cookie and redirect to referer.""" | 508 | """wipe login cookie and redirect to referer.""" |
487 | self.logout() | 509 | self.logout() |
488 | dest = request.referer or '/' | 510 | dest = request.referer or '/' |
511 | if c.cname: | ||
512 | dest = '/?cnameframe=1' | ||
513 | if not dest.startswith("http://"): | ||
514 | return self.redirect(c.site.path + dest) | ||
489 | return self.redirect(dest) | 515 | return self.redirect(dest) |
490 | 516 | ||
491 | 517 | ||
... | ... | ||
591 | ApiController.POST_optin.""" | 617 | ApiController.POST_optin.""" |
592 | return self._render_opt_in_out(msg_hash, False) | 618 | return self._render_opt_in_out(msg_hash, False) |
593 | 619 | ||
620 | def GET_frame(self): | ||
621 | """used for cname support. makes a frame and | ||
622 | puts the proper url as the frame source""" | ||
623 | sub_domain = request.environ.get('sub_domain') | ||
624 | original_path = request.environ.get('original_path') | ||
625 | sr = Subreddit._by_domain(sub_domain) | ||
626 | if sub_domain and sr and original_path: | ||
627 | return Cnameframe(original_path, sr.name, sr.title, sub_domain).render() | ||
628 | else: | ||
629 | return self.abort404() | ||
630 |