echo lang('article_random_review');
    ?>
</h3>
</div>
<?php 
    foreach ($random_list as $item) {
        ?>
<div class="row">
    <div class="span_12">
        <p>
            <strong><?php 
        echo $item['title'];
        ?>
</strong> 
            <?php 
        echo smart_trim(strip_tags($item['body']), 200);
        ?>
&nbsp;
            <em>(<?php 
        echo substr($item['published_on'], 0, 4);
        ?>
)</em> &raquo; 
                <?php 
        echo anchor('articles/display/' . $item['slug'], lang('read_more'));
        ?>
        </p>
    </div>
</div>
<?php 
    }
    ?>
Example #2
0
function textResize($text, $size)
{
    return smart_trim($text, $size, false, '');
}
 function search($search_value)
 {
     $this->trace .= 'search<br/>';
     $result = array();
     $this->db->select('a.id, a.slug, a.title, intro, a.category_id, ' . 'a.image_file, a.body, a.updated_on, a.published_on')->from('articles a')->join('categories c', 'c.id = a.category_id', 'left')->order_by('updated_on', 'desc')->where('status', 'live')->where('a.published_on <= CURDATE()')->like('a.title', $search_value);
     $query = $this->db->get();
     $this->trace .= 'sql: ' . $this->db->last_query() . "<br/>\n";
     $result = $query->result_array();
     foreach ($result as &$item) {
         if ($item['category_id'] == 1 && !$item['image_file']) {
             $this->trace .= 'no image assigned to review<br/>';
             $item['image_file'] = $this->get_main_image($item['id'], $item['category_id']);
             if (!$item['intro']) {
                 $item['intro'] = smart_trim($item['body'], 200);
             }
         }
         $item['credits'] = $this->get_credits($item['id']);
         unset($item['body']);
     }
     return $result;
 }
Example #4
0
 public function old_edit()
 {
     $user_input = array();
     $credits = array();
     $artists = array();
     $topics = array();
     if ($this->input->post('user-id')) {
         $user_input['submitter'] = $this->input->post('user-id');
     }
     if ($this->input->post('article-id')) {
         $user_input['article_id'] = $this->input->post('article-id');
     } else {
         $user_input['article_id'] = 0;
     }
     if ($this->input->post('category')) {
         $user_input['category'] = $this->input->post('category');
     }
     if ($this->input->post('title')) {
         $user_input['title'] = $this->input->post('title');
     }
     if ($this->input->post('intro')) {
         $user_input['intro'] = $this->input->post('intro');
     } else {
         $user_input['intro'] = smart_trim($this->input->post('body'), 200);
     }
     if ($this->input->post('author')) {
         $this->page_data['trace'] .= 'process author list<br/>';
         $temp = $this->input->post('original-author');
         if (count($temp)) {
             foreach ($temp as $item) {
                 $credits[$item] = array('action' => 'delete');
             }
         }
         foreach ($this->input->post('author') as $item) {
             if (array_key_exists($item, $credits)) {
                 $this->page_data['trace'] .= $item . ': item already in list<br/>';
                 unset($credits[$item]);
             } else {
                 $this->page_data['trace'] .= $item . ': added to list<br/>';
                 $credits[$item] = array('action' => 'insert');
             }
         }
         $user_input['author'] = $credits;
     }
     if ($this->input->post('artist')) {
         $this->page_data['trace'] .= 'process artist list<br/>';
         $temp = $this->input->post('original-artists');
         if (count($temp)) {
             foreach ($temp as $item) {
                 $artists[$item] = 'delete';
             }
         }
         foreach ($this->input->post('artist') as $item) {
             if (array_key_exists($item, $artists)) {
                 $this->page_data['trace'] .= $item . ': item already in list<br/>';
                 unset($artists[$item]);
             } else {
                 $this->page_data['trace'] .= $item . ': added to list<br/>';
                 $artists[$item] = 'insert';
             }
         }
         $user_input['artist'] = $artists;
     }
     if ($this->input->post('topic')) {
         $this->page_data['trace'] .= 'process topic list<br/>';
         $temp = $this->input->post('original-topics');
         if (count($temp)) {
             foreach ($temp as $item) {
                 $topics[$item] = 'delete';
             }
         }
         foreach ($this->input->post('topic') as $item) {
             if (array_key_exists($item, $topics)) {
                 $this->page_data['trace'] .= $item . ': item already in list<br/>';
                 unset($topics[$item]);
             } else {
                 $this->page_data['trace'] .= $item . ': added to list<br/>';
                 $topics[$item] = 'insert';
             }
         }
         $user_input['topic'] = $topics;
     }
     if ($this->input->post('body')) {
         $user_input['body'] = $this->input->post('body');
     }
     if (count($user_input) == 0) {
         redirect('articles/index');
     }
     $user_input['user_id'] = $this->page_data['user_id'];
     // validate
     $this->Article_model->update($user_input);
     $this->page_data['trace'] .= $this->Article_model->trace;
     echo $this->page_data['trace'] . '<br/>' . anchor('articles/display/' . $this->input->post('slug'));
     exit;
     redirect('articles/display/' . $this->input->post('slug'));
 }
    if (($td + 1) % 3 == 0) {
        echo 'last';
    }
    ?>
">
				<?php 
    print render(field_view_field('node', $results[$td], 'field_featured', array('settings' => array('image_style' => 'featured'))));
    ?>
				<a class="title" title="<?php 
    print $results[$td]->title;
    ?>
" href="<?php 
    print $base_url . '/page/' . $results[$td]->nid;
    ?>
"><?php 
    print smart_trim($results[$td]->title, 60);
    ?>
</a>
				<p><?php 
    print $results[$td]->body['und'][0]['summary'];
    ?>
</p>
				<div class="ocurrences">
				<?php 
    print $results[$td]->field_numofresused['und'][0]['safe_value'];
    ?>
				</div>
			</li>
		<?php 
}
?>
function getfeatures_atom($threshhold = '2w', $sortby = FALSE, $sortdir = FALSE, $searchterm = FALSE)
{
    exec("ls -c /home/planwatc/public_html/features/*.feature", $featurelist);
    if (!$threshhold) {
        $threshhold = '2w';
    }
    $thresh_url = $threshhold;
    if (strstr($threshhold, 'r')) {
        $threshhold = str_replace('r', '', $threshhold);
        $reverse = 1;
    }
    if (strstr($threshhold, 'w')) {
        $threshhold = time() - 604800 * str_replace('w', '', $threshhold);
    }
    if (strstr($threshhold, 'd')) {
        $threshhold = time() - 86400 * str_replace('d', '', $threshhold);
    }
    if (strstr($threshhold, 'h')) {
        $threshhold = time() - 3600 * str_replace('h', '', $threshhold);
    }
    if (strstr($threshhold, 'm')) {
        $threshhold = time() - 60 * str_replace('m', '', $threshhold);
    }
    if (!$sortby) {
        $sortby = 'featuretime';
    }
    if (!$sortdir) {
        $sortdir = 'down';
    }
    $planowner = "Feature Request/Bug Tracking";
    $rss_link = "http://{$_SERVER['HTTP_HOST']}{$_SERVER['WEB_ROOT']}/feature";
    $lastupdatetime = time();
    if ($featurelist) {
        foreach ($featurelist as $i => $feature) {
            $feature = trim($feature);
            parse_str(file_get_contents($feature), $feature_array[$i]);
            $feature_array[$i]['featuretime'] = filemtime($feature);
            $feature_array[$i]['url_feature'] = basename($feature);
            $sort_array[$i] = $feature_array[$i][$sortby];
        }
        if ($sortdir == 'down') {
            array_multisort($sort_array, SORT_DESC, $feature_array);
        } else {
            array_multisort($sort_array, SORT_ASC, $feature_array);
        }
        foreach ($feature_array as $i => $feature) {
            if ($feature['featuretime'] > $threshhold || $feature['status'] != "Verified Fixed" && stripslashes($feature['status']) != "Won't Fix" && $feature['status'] != "On Hold") {
                $somefeature = TRUE;
                $entry_content = stripslashes(htmlentities($feature['response'] . "\n\n[Original Issue]\n" . $feature['note']));
                $entry_summary = smart_trim(strip_tags($entry_content), 255, FALSE);
                $entry_updated = date('Y-m-d\\TH:i:s+00:00', $feature['featuretime']);
                $plan .= "\n\t\t\t\t\t<entry>\n\t\t\t\t\t\t<link rel=\"alternate\" href=\"http://{$_SERVER['HTTP_HOST']}{$_SERVER['WEB_ROOT']}/feature/description/{$feature['url_feature']}\" type=\"text/html\"/>\n\t\t\t\t\t\t<title type='html'>{$feature['title']} ({$feature['priority']}, {$feature['status']})</title>\n\t\t\t\t\t\t<summary type='html'>{$entry_summary}</summary>\n\t\t\t\t\t\t<content type='html'>{$entry_content}</content>\n\t\t\t\t\t\t<updated>{$entry_updated}</updated>\n\t\t\t\t\t\t<id>http://{$_SERVER['HTTP_HOST']}{$_SERVER['WEB_ROOT']}/feature/description/{$feature['url_feature']}</id>\n\t\t\t\t\t\t<author>\n\t\t\t\t\t\t\t<name> [{$feature['submitter']}] </name>\n\t\t\t\t\t\t</author>\n\t\t\t\t\t</entry>";
            }
        }
    }
    if (!isset($somefeature)) {
        $entry_updated = date('Y-m-d\\TH:i:s+00:00', time());
        $plan .= "\n\t\t\t\t\t<entry>\n\t\t\t\t\t\t<title type='html'>All Clear</title>\n\t\t\t\t\t\t<summary type='html'>Nothing to see here</summary>\n\t\t\t\t\t\t<content type='html'>All feature requests and bugs have been satisfied. Go have a cup of tea.</summary>\n\t\t\t\t\t\t<link rel=\"alternate\" href=\"http://{$_SERVER['HTTP_HOST']}{$_SERVER['WEB_ROOT']}/feature/\" type=\"text/html\"/>\n\t\t\t\t\t\t<updated>{$entry_updated}</updated>\n\t\t\t\t\t\t<id>http://{$_SERVER['HTTP_HOST']}{$_SERVER['WEB_ROOT']}/feature/</id>\n\t\t\t\t\t\t<author>\n\t\t\t\t\t\t\t<name>jwdavidson</name>\n\t\t\t\t\t\t</author>\n\t\t\t\t\t</entry>";
    }
    $plan = "<link rel=\"self\" href=\"http://planwatch.org/scripts/featurecreep.php?action=getfeatures\" type=\"text/xml\"/>\n{$plan}";
    //$_SERVER['OUTPUT_MODE']='ATOM1.0';
    //$content=output("Bugs / Features","<!-- FEED_DIVIDER --> $plan");
    //$_SERVER['OUTPUT_MODE']='HTML';
    //echo $content;
    return $plan;
}
                            <?php 
}
?>
                        </div> <!-- carousel images -->
                        <div class="barousel_content">
                            <?php 
foreach ($carousel_list as $item) {
    ?>
                            <div>
                                <p class="header"><?php 
    echo $item['title'];
    ?>
</p>
                                <p>
                                    <?php 
    echo smart_trim($item['intro'], 220);
    ?>
                                    <?php 
    echo anchor('articles/display/' . $item['slug'], lang('read_more'));
    ?>

                                </p>
                            </div><!-- caption -->
                            <?php 
}
?>
                        </div> <!-- carousel captions -->
                    </div> <!-- carousel -->
                </div> <!-- span -->
            </div>
            <div class="row">
Example #8
0
function plan_encapsulate_atom($planowner, $entry_time, $entry)
{
    if (!strstr($entry, '<!--no feed-->')) {
        if (strstr($entry, "<!--TITLE")) {
            preg_match("/<!--TITLE ([^<>]*)-->/", $entry, $matches);
            $title = $matches[1];
        } else {
            $title = formattime($entry_time) . " " . smart_trim(strip_tags($entry), 32, FALSE);
        }
        if (strstr($entry, "Posted By")) {
            preg_match("/Posted By .* <a href=['\"](.*)['\"]>(.*)<\\/a>/", $entry, $matches);
            $link = $matches[1];
            $feedtitle = $matches[2];
            //			$testentry.=var_dump_ret($matches);
            //			$testentry.="linkback";
        } else {
            $link = "http://planwatch.org/read/{$planowner}/{$entry_time}";
        }
        if ($_SERVER['OUTPUT_MODE'] == 'ATOM_PRIVATE') {
            $entry = "<a href='{$link}'>{$link}</a>";
        }
        $entry = "\n\t\t\t<entry>\n\t\t\t\t<title type='html'>{$title}</title>\n\t\t\t\t<summary>" . smart_trim(strip_tags($entry), 255, FALSE) . "</summary>\n\t\t\t\t<content type='html'>" . htmlentities($entry) . "</content>\n\t\t\t\t<link rel=\"alternate\" href=\"{$link}\" type=\"text/html\"/>\n\t\t\t\t<updated>" . gmdate('Y-m-d\\TH:i:s+00:00', $entry_time) . "</updated>\n\t\t\t\t<id>http://planwatch.org/read/{$planowner}/{$entry_time}</id>\n\t\t\t\t<author>\n\t\t\t\t\t<name>{$planowner}</name>\n\t\t\t\t</author>\n\t\t\t</entry>\n\t\t";
        $li = "<rdf:li rdf:resource=\"http://{$_SERVER['HTTP_HOST']}{$_SERVER['WEB_ROOT']}/read/{$planowner}/.{$entry_time}\"/>\n";
    }
    return $entry;
}