Exemplo n.º 1
0
                        if($(this)[0].number == dotnum) {
                            $(this)[0].fillStyle = 'rgb('+palette[0][0]+','+palette[0][1]+','+palette[0][2]+')';
                        } else {
                            if(typeof $(this)[0].number !== 'undefined')
                                $(this)[0].fillStyle = "grey";
                        }
                        $("#nav-bar").drawLayer(layer);
                        layer++;
                    });
                }, { offset: '76px' });
            });
        });
    </script>

    <?php 
if (bonus()) {
    ?>
        <script>

        var titleedited=false;
        var subtitleedited=false;
        var bodyedited=false;
        var photoadded=false;
        var hasphoto=false;
        var photocreditedited=false;
        var photocaptionedited=false;

        $(document).ready(function() {
            // SET TOOLTIPS
            $("#series, #articletitle, #articlesubtitle, #addauthor, #addauthorjob, #photocreditbonus, #photocaptionbonus, #articlebody").each(function() {
                if($("#"+$(this).attr("id")).html().trim() == "" || $("#"+$(this).attr("id")).html().trim() == "<br>" || $("#"+$(this).attr("id")).html().trim() == "<p></p>") {
Exemplo n.º 2
0
 public function ajax_attachment_big($attachment_id)
 {
     if (!bonus()) {
         exit("Permission denied. Try refreshing and logging in again.");
     }
     $toggle = $this->input->post("big");
     $this->attachments_model->set_big($attachment_id, $toggle);
     exit("Big " . ($toggle == 'true' ? 'enabled' : 'disabled') . ".");
 }
Exemplo n.º 3
0
    <?php 
if (!empty($featured)) {
    ?>
    <!-- FEATURED ARTICLES -->
    <section id="Featured" class="featured">
        <h2>★ Featured 
            <?php 
    if (substr(uri_string(), 0, 8) == "article/" && bonus()) {
        ?>
 <input type="checkbox" name="featured" value="featured" <?php 
        if ($article->featured) {
            ?>
checked="checked"<?php 
        }
        ?>
 /><?php 
    }
    ?>
        </h2>
        <?php 
    $blocktype = array("blocks" => $featured, "twotier" => FALSE, "medtile" => TRUE);
    ?>
        <?php 
    $this->load->view('template/articleblock', $blocktype);
    ?>
    </section>
    <?php 
}
?>

    <footer id="bodyfooter">
Exemplo n.º 4
0
                                $('#article-sidebar').css('opacity','1');
                                sticky2.css('position','inherit');
                                sticky2.css('top','auto');
                                sticky2.css('left','auto');
                                //sticky2.css('top','0');
                                //sticky2.css('left','-200px');
                            }
                        }); */
            });
        </script>
    <?php 
}
?>

    <?php 
if (count($photos) > 1 && !bonus()) {
    ?>
        <!-- SwipeView. Only needed for slideshows. -->
        <script type="text/javascript" src="<?php 
    echo base_url();
    ?>
js/swipeview-mwidmann.js"></script>
        <script type="text/javascript">
            var    carousel,
            el,
            i,
            page,
            hasInteracted = false,
            dots = document.querySelectorAll('#swipeview_nav li'),

            slides = [
Exemplo n.º 5
0
 function advsearch($data)
 {
     $this->load->model('author_model', '', TRUE);
     $this->load->model('series_model', '', TRUE);
     if ($data['author']) {
         $author = $this->author_model->get_author_by_name($data['author'], true);
         if (!$author) {
             return false;
         }
     }
     if ($data['series']) {
         $series = $this->series_model->get_series_by_name($data['series'], true);
         if (!$series) {
             return false;
         }
     }
     $this->db->select("\n            article.id, \n            article.date, \n            article.title, \n            article.subtitle, \n            article.excerpt, \n            article.published,\n            article.featured,\n            author.name 'author',\n            author.id 'author_id',\n            series.id 'series_id',\n            series.name 'series', \n            articletype.name 'type', \n            photo.filename_small");
     $this->db->from("article");
     $this->db->join("series", "series.id=article.series");
     $this->db->join("articletype", "articletype.id=article.type");
     $this->db->join("photo", "photo.article_id=article.id and `photo`.`active`='1'", "left");
     // join author
     $this->db->join("articleauthor", "articleauthor.article_id=article.id", "left");
     $this->db->join("author", "author.id=articleauthor.author_id", "left");
     // "active" basically means "hasn't been deleted". we should almost never show inactive articles (or photos).
     $this->db->where("article.active", "1");
     // show draft (unpublished) articles only if logged into bonus.
     if (!bonus()) {
         $this->db->where("article.published", "1");
     }
     // title search
     // would preferably be expanded into indexed fulltext search
     // (or at least excerpt?)
     $this->db->like('title', $data['title']);
     // for carousel or whatever, may choose to just fetch featured articles
     if (!empty($data['featured']) && $data['featured'] == 'featured') {
         $this->db->where("article.featured", "1");
     }
     if ($data['author']) {
         $this->db->where("articleauthor.author_id", $author->id);
     }
     if ($data['series']) {
         $this->db->where('article.series', $series->id);
     }
     // note: both are inclusive
     if ($data['since']) {
         $this->db->where("article.date >=", date("Y-m-d H:i:s", strtotime($data['since'])));
     }
     if ($data['until']) {
         $this->db->where("article.date <=", date("Y-m-d H:i:s", strtotime($data['until'])));
     }
     $this->db->limit('100');
     $this->db->group_by("article.id");
     $this->db->order_by("article.date", "desc");
     $query = $this->db->get();
     if ($query->num_rows() > 0) {
         return $query->result();
     } else {
         return false;
     }
 }
Exemplo n.º 6
0
 public function phpinfo()
 {
     if (!bonus()) {
         $this->load->view('error');
     } else {
         exit(phpinfo());
     }
 }
Exemplo n.º 7
0
 function ajax_delete_ad($ad_id)
 {
     if (!bonus()) {
         exit("Permission denied. Try refreshing and logging in again.");
     }
     if ($this->input->post('remove') == 'true') {
         $this->ad_model->delete_ad($ad_id);
         exit("Ad deleted.");
     } else {
         exit("Delete request wasn't sent properly.");
     }
 }
Exemplo n.º 8
0
 public function date($date = '')
 {
     // just for testing
     //$this->output->enable_profiler(TRUE);
     // if no date specified, use current date
     if (!$date) {
         $date = date("Y-m-d");
     }
     $date_week_ago = date("Y-m-d", time() - 7 * 24 * 60 * 60);
     // get last updated date, PRIOR TO $date requested.
     $last_updated = $this->article_model->get_last_updated($date);
     $last_updated_week_ago = date("Y-m-d", strtotime($last_updated) - 7 * 24 * 60 * 60);
     $last_updated_fivemonths_ago = date("Y-m-d", strtotime($last_updated) - 5 * 4 * 7 * 24 * 60 * 60);
     // get latest issue <= date specified
     $issue = $this->issue_model->get_latest_issue($date);
     if (!$issue) {
         $this->error();
     } else {
         $volume = $issue->volume;
         $issue_number = $issue->issue_number;
         // get adjacent issues (for next/prev buttons)
         $nextissue = $this->issue_model->get_adjacent_issue($volume, $issue_number, 1);
         $previssue = $this->issue_model->get_adjacent_issue($volume, $issue_number, -1);
         // scribd
         try {
             $scribd_thumb_url = false;
             if ($issue->scribd) {
                 $ch = curl_init();
                 curl_setopt($ch, CURLOPT_URL, "http://api.scribd.com/api?method=thumbnail.get&api_key=" . getenv('SCRIBD_API_KEY') . "&doc_id=" . $issue->scribd);
                 curl_setopt($ch, CURLOPT_HEADER, 0);
                 curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
                 curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 3);
                 curl_setopt($ch, CURLOPT_TIMEOUT, 3);
                 //timeout in seconds
                 $scribd_thumb_response = curl_exec($ch);
                 curl_close($ch);
                 if (!empty($scribd_thumb_response)) {
                     libxml_use_internal_errors(TRUE);
                     $scribd_thumb = new SimpleXMLElement($scribd_thumb_response);
                     $scribd_thumb_url = $scribd_thumb->thumbnail_url;
                 }
             }
         } catch (Exception $e) {
             // scribd sucks
         }
         // featured articles for footer
         $featured = $this->article_model->get_articles_by_date($date, false, false, '5', true);
         if (bonus()) {
             // latest/popular articles
             $latest = $this->article_model->get_articles_by_date($date, false, false, '30');
             $popular_week = $this->article_model->get_popular_articles_by_date($last_updated, $last_updated_week_ago, '30');
             $popular_semester = $this->article_model->get_popular_articles_by_date($last_updated, $last_updated_fivemonths_ago, '30');
             // latest/popular articles with photos
             $latest_photo = $this->article_model->get_articles_by_date($date, false, false, 30, false, false, false, false, 'desc', true);
             // I. Hate. PHP.
             $popular_week_photo = $this->article_model->get_popular_articles_by_date($last_updated, $last_updated_week_ago, '30', false, false, false, true);
             $popular_semester_photo = $this->article_model->get_popular_articles_by_date($last_updated, $last_updated_fivemonths_ago, '30', false, false, false, true);
         }
         $atf = $this->tools_model->get_abovethefold();
         $leadstory = $this->article_model->get_article($atf[0]->article);
         $leadstory->seriesname = $this->article_model->get_article_series($leadstory->series)->name;
         $leadstory->authors = $this->article_model->get_article_authors($leadstory->id);
         $carousel = $this->article_model->get_article($atf[1]->article);
         $carousel->authors = $this->article_model->get_article_authors($carousel->id);
         $teaser1 = $this->article_model->get_article($atf[2]->article);
         $teaser1->authors = $this->article_model->get_article_authors($teaser1->id);
         $teaser1->seriesname = $this->article_model->get_article_series($teaser1->series)->name;
         $teaser2 = $this->article_model->get_article($atf[3]->article);
         $teaser2->authors = $this->article_model->get_article_authors($teaser2->id);
         $teaser2->seriesname = $this->article_model->get_article_series($teaser2->series)->name;
         $teaser3 = $this->article_model->get_article($atf[4]->article);
         $teaser3->authors = $this->article_model->get_article_authors($teaser3->id);
         $teaser3->seriesname = $this->article_model->get_article_series($teaser3->series)->name;
         // php 5.4 STRONGLY objects if you don't do this and E_STRICT is turned on (which it is by default on OSX)
         $data = new stdClass();
         $data->headerdata = new stdClass();
         $data->footerdata = new stdClass();
         // get random quote
         $data->footerdata->quote = $this->attachments_model->get_random_quote();
         // get sections
         $sections = $this->issue_model->get_sections();
         foreach ($sections as $section) {
             // get section articles
             $articles[$section->name] = $this->article_model->get_articles_by_date($date, $date_week_ago, $section->id);
             if (count($articles[$section->name]) < 10) {
                 $articles[$section->name] = $this->article_model->get_articles_by_date($date, false, $section->id, 10);
             }
         }
         // load data, view
         $data->headerdata->date = $date;
         $data->headerdata->volume = $volume;
         $data->headerdata->issue_number = $issue_number;
         $data->headerdata->issue = $issue;
         $data->headerdata->alerts = $this->tools_model->get_alerts();
         $data->date = $date;
         $data->issue = $issue;
         $data->scribd_thumb_url = $scribd_thumb_url;
         $data->nextissue = $nextissue;
         $data->previssue = $previssue;
         $data->featured = $featured;
         $data->sections = $sections;
         $data->articles = $articles;
         if (bonus()) {
             $data->articlelists = new stdClass();
             $data->photolists = new stdClass();
             $data->articlelists->latest = $latest;
             $data->articlelists->popular_week = $popular_week;
             $data->articlelists->popular_semester = $popular_semester;
             $data->photolists->latest_photo = $latest_photo;
             $data->photolists->popular_week_photo = $popular_week_photo;
             $data->photolists->popular_semester_photo = $popular_semester_photo;
         }
         $data->homepage = new stdClass();
         $data->homepage->leadstory = $leadstory;
         $data->homepage->carousel = $carousel;
         $data->homepage->carousel->photos = $this->attachments_model->get_photos($carousel->id);
         $data->homepage->teasers = array($teaser1, $teaser2, $teaser3);
         // meta
         $data->page_title = '';
         $data->page_description = '';
         $data->page_type = '';
         $data->ad = $this->ad_model->get_ad();
         $this->load->view('browse', $data);
     }
 }