function create($post_id) { $tags_r = explode(",", $this->input->post('tags')); foreach ($tags_r as $r) { if (!empty($r)) { $this->db->set('post_id', $post_id); $this->db->set('name', pretty_url(trim($r))); $this->db->insert('tags'); } } }
</h1> <div class="info"> <div class="bio"> <?php echo $bio; ?> <?php if ($website && $website != '' && is_current($resident_id)) { ?> <a class="website bullet" href="<?php echo $website; ?> "> <?php echo pretty_url($website); ?> </a> <?php } ?> </div> <?php $events = get_posts(array('post_type' => 'event', 'orderby' => 'meta_value', 'order' => 'DESC', 'post_status' => 'publish', 'meta_query' => array(array('key' => 'start_date'), array('key' => 'residents', 'value' => '"' . $resident_id . '"', 'compare' => 'LIKE')))); if (is_current($resident_id) && sizeof($residencies) > 1) { echo '<div class="residencies list">'; echo '<h3 class="title">Past Residencies</h3>'; foreach ($residencies as $i => $residency) { if ($i == 0 && is_current($resident_id)) { continue;
function vote_exec() { if ($this->session->userdata('logged_in') != TRUE) { $this->session->set_flashdata('ref', uri_string()); $this->session->set_flashdata('log', 'you are not authorized to access this page without logging in'); redirect('account/login'); } $this->m_votes->create(); #if($this->m_projects->check_author($project_id)==0){ # echo "huh? is this yours?"; #}else{ #echo "welcome to heaven"; //submit to table submissions # $this->m_submissions->create(); #} $contest_id = $this->input->post('contest_id'); $contest_info = $this->m_contests->read($contest_id); redirect('contest/' . $contest_info->contest_id . '/' . pretty_url($contest_info->title)); }
include locate_template('sections/params/contributors.php'); $url = get_permalink(); $contributors = new WP_Query($contributors_query); $GLOBALS['wp_query'] = $contributors; $last_page = $contributors->max_num_pages; if (have_posts()) { while (have_posts()) { the_post(); $contributor_id = $the_ID; $title = get_the_title($contributor_id); $country = get_field('country', $contributor_id)[0]->post_title; $country_slug = get_field('country', $contributor_id)[0]->post_name; $country_permalink = query_url('from', $country_slug, $url); $permalink = get_permalink(); $website = get_field('website', $contributor_id); $pretty_website = pretty_url($website); echo '<div class="contributor shelf-item border-bottom"><div class="inner">'; echo '<div class="value name">'; echo '<h3>' . $title . '</h3>'; echo '</div>'; echo '<div class="value country"><a href="' . $country_permalink . '">' . $country . '</a></div>'; if ($website) { echo '<div class="value website">'; echo '<a href="' . $website . '" target="_blank">' . $pretty_website . '</a>'; echo '</div>'; } echo '</div></div>'; } if ($paged < $last_page) { get_template_part('partials/load-more'); }
</div> <div class="content_container box-content"> <?php if (count($contests) == 0) { ?> <p class="no-item">There are no contests yet.</p> <?php } else { ?> <ul id="contest_list"> <?php foreach ($contests as $i => $r) { ?> <?php $contest_link = base_url() . 'contest/' . $r->contest_id . '/' . pretty_url($r->title); ?> <li> <p><a href="<?php echo $contest_link; ?> "><img src="<?php echo base_url() . 'uploads/contest/' . $r->image; ?> " /></a></p> <p><a href="<?php echo $contest_link; ?> "><?php echo $r->title; ?>
include locate_template('sections/params/sponsors.php'); $url = get_permalink(); $sponsors = new WP_Query($sponsors_query); $GLOBALS['wp_query'] = $sponsors; $last_page = $sponsors->max_num_pages; if (have_posts()) { while (have_posts()) { the_post(); $sponsor_id = $the_ID; $title = get_the_title($sponsor_id); $country = get_field('country', $sponsor_id)[0]->post_title; $country_slug = get_field('country', $sponsor_id)[0]->post_name; $country_permalink = query_url('from', $country_slug, $url); $permalink = get_permalink(); $website = get_field('website', $sponsor_id); $pretty_website = explode('/', pretty_url($website))[0]; echo '<div class="sponsor shelf-item border-bottom"><div class="inner">'; echo '<h2 class="value link name">'; echo '<a href="' . $permalink . '">'; echo $title; echo '</a>'; echo '</h2>'; echo '<div class="value country"><a href="' . $country_permalink . '">' . $country . '</a></div>'; if ($website) { echo '<div class="value website">'; echo '<a href="' . $website . '" target="_blank">' . $pretty_website . '</a>'; echo '</div>'; } echo '</div></div>'; } if ($paged < $last_page) {
function update() { $data = array('title' => $this->input->post('title'), 'alias' => pretty_url($this->input->post('title')), 'object' => $this->input->post('object'), 'category_id' => $this->input->post('category_id'), 'brand_id' => $this->input->post('brand_id'), 'rating' => $this->input->post('rating'), 'content' => $this->input->post('post_content')); $this->db->where('ID', $this->input->post('review_id')); $this->db->update('reviews', $data); }
echo $i + 1; ?> </td> <td><?php echo $r->user_name; ?> </td> <td><a href="<?php echo base_url() . 'review/' . $r->review_id . '/' . pretty_url($r->title); ?> " target="_blank"><img src="<?php echo content_thumb($r->thumb); ?> " height="60" /></a></td> <td><a href="<?php echo base_url() . 'review/' . $r->review_id . '/' . pretty_url($r->title); ?> " target="_blank"><?php echo $r->title; ?> </a></td> <td><?php echo $r->post_deleted == 1 ? 'Deleted by <strong>' . ($r->deleted_by == '-1' ? 'admin' : $r->deleter) . '</strong>' . (!empty($r->deleted_at) ? ' at<br>' . clean_date($r->deleted_at, 'd-m-Y H:i:s') : '') : ''; ?> </td> <td><a href="<?php echo $admin_link . 'review/update/' . $r->review_id; ?> ">edit</a> <a class="delete" href="<?php echo $admin_link . 'review/delete/' . $r->review_id; ?>
function update($image_data = '') { $data = array('series_id' => $this->input->post('series_id'), 'title' => $this->input->post('title'), 'alias' => pretty_url($this->input->post('title')), 'content' => $this->input->post('post_content')); $this->db->where('ID', $this->input->post('blog_id')); $this->db->update('blogs', $data); }
<div class="info"> <div class="block name"> <div class="horizontal-align"> <?php echo $sponsor_title; ?> </div> </div> <div class="block website"> <div class="horizontal-align"> <a href="<?php echo $sponsor_website; ?> "> <?php echo pretty_url($sponsor_website); ?> </a> </div> </div> <div class="block deadline"> <div class="horizontal-align"> <?php if (have_rows('applications', $sponsor_id)) { while (have_rows('applications')) { the_row(); $app_title = get_sub_field('title', $sponsor_id); $app_deadline = get_sub_field('deadline', $sponsor_id); $app_deadline_dt = new DateTime($app_deadline); $app_deadline_format = $app_deadline_dt->format('F d, Y'); $app_brief = get_sub_field('brief', $sponsor_id);
echo $i + 1; ?> </td> <td><?php echo $r->user_name; ?> </td> <td><a href="<?php echo base_url() . 'video/' . $r->video_id . '/' . pretty_url($r->title); ?> " target="_blank"><img src="<?php echo youtube_thumb($r->youtube_id); ?> " height="60" /></a></td> <td><a href="<?php echo base_url() . 'video/' . $r->video_id . '/' . pretty_url($r->title); ?> " target="_blank"><?php echo $r->title; ?> </a></td> <td><?php echo $r->post_deleted == 1 ? 'Deleted by <strong>' . ($r->deleted_by == '-1' ? 'admin' : $r->deleter) . '</strong>' . (!empty($r->deleted_at) ? ' at<br>' . clean_date($r->deleted_at, 'd-m-Y H:i:s') : '') : ''; ?> </td> <td><a href="<?php echo $admin_link . 'video/update/' . $r->video_id; ?> ">edit</a> <a class="delete" href="<?php echo $admin_link . 'video/delete/' . $r->video_id; ?>
function update() { //check if the blog author is the one who's logged in ##### EXPERIMENTAL : COMMENT TO ENABLE ADMIN UPDATE. UNCOMMENT IF THERE'S PROBLEM #if($this->check_author($this->input->post('video_id'))>0){ //yes -> update //check if series_id submitted is in ID or in String //if in ID, insert new row to table blog_series //check for duplicate $youtube_id = $this->input->post('youtube_id'); preg_match('/\\?v=([a-z0-9\\-_]+)\\&?/i', $youtube_id, $a) || preg_match('/([a-z0-9\\-_]{11})/i', $youtube_id, $a); $id = $a[1]; $data = array('title' => $this->input->post('title'), 'alias' => pretty_url($this->input->post('title')), 'youtube_id' => $id, 'content' => $this->input->post('post_content')); $this->db->where('ID', $this->input->post('video_id')); $this->db->update('videos', $data); ##### EXPERIMENTAL : COMMENT TO ENABLE ADMIN UPDATE. UNCOMMENT IF THERE'S PROBLEM #} }
function update() { $data = array('forum_id' => $this->input->post('forum_id'), 'title' => $this->input->post('title'), 'alias' => pretty_url($this->input->post('title')), 'content' => $this->input->post('post_content')); $this->db->where('ID', $this->input->post('thread_id')); $this->db->update('threads', $data); }
} elseif (date("Y-m-d") > $contest_info->voting_end_date) { ?> <p>Voting closed! Thanks for your votes!</p> <?php } else { ?> <a class="btn" href="<?php echo $vote_link; ?> ">Vote and Win</a> <?php } ?> <p><a class="btn" href="<?php echo base_url() . 'contest/' . $contest_info->contest_id . '/' . pretty_url($contest_info->title); ?> ">Overview</a></p> <p><a class="btn" href="<?php echo base_url() . 'contest/' . $contest_info->contest_id . '/entries'; ?> ">View Entries</a></p> <?php if (date("Y-m-d") > $contest_info->submission_end_date) { ?> <p><a class="btn" href="<?php echo base_url() . 'contest/' . $contest_info->contest_id . '/result'; ?> ">View Result</a></p>
echo $i + 1; ?> </td> <td><?php echo $r->user_name; ?> </td> <td><a href="<?php echo base_url() . 'blog/' . $r->blog_id . '/' . pretty_url($r->title); ?> " target="_blank"><img src="<?php echo content_thumb($r->thumb); ?> " height="60" /></a></td> <td><a href="<?php echo base_url() . 'blog/' . $r->blog_id . '/' . pretty_url($r->title); ?> " target="_blank"><?php echo $r->title; ?> </a></td> <td><?php echo $r->series_name; ?> </td> <td><?php echo $r->post_deleted == 1 ? 'Deleted by <strong>' . ($r->deleted_by == '-1' ? 'admin' : $r->deleter) . '</strong>' . (!empty($r->deleted_at) ? ' at<br>' . clean_date($r->deleted_at, 'd-m-Y H:i:s') : '') : ''; ?> </td> <td><a href="<?php echo $admin_link . 'blog/update/' . $r->blog_id;
<h2>Contest Entries</h2> <ul id="entries_list"> <?php foreach ($submissions as $r) { ?> <li> <p class="entry_thumb"><a target="_blank" href="<?php echo base_url() . 'project/' . $r->project_id . '/' . pretty_url($r->title); ?> "><img src="<?php echo content_thumb($r->thumb); ?> " /></a></p> <p><a target="_blank" href="<?php echo base_url() . 'project/' . $r->project_id . '/' . pretty_url($r->title); ?> "><?php echo $r->title; ?> </a></p> <p>by <a target="_blank" href="<?php echo base_url() . 'user/' . $r->user_name; ?> "><?php echo $r->user_name; ?> </a></p> </li> <?php
function update() { $data = array('parent' => $this->input->post('parent'), 'title' => $this->input->post('title'), 'alias' => pretty_url($this->input->post('title')), 'content' => $this->input->post('post_content'), 'last_update' => date("Y-m-d H:i:s")); $this->db->where('page_id', $this->input->post('page_id')); $this->db->update('pages', $data); }
function update($image_data = '') { //need review //BUGS : I can use firebugs to edit other people's projects //SOLUTION : Check if the project is really the logged in user's project //STATUS : DONE //check if the project author is the one who's logged in ##### EXPERIMENTAL : COMMENT TO ENABLE ADMIN UPDATE. UNCOMMENT IF THERE'S PROBLEM #if($this->check_author($this->input->post('project_id'))>0){ //yes -> update //check if series_id submitted is in ID or in String //if in ID, insert new row to table project_series //check for duplicate if (!$this->input->post('title') || !$this->input->post('post_content')) { return FALSE; } else { $data = array('title' => $this->input->post('title'), 'alias' => pretty_url($this->input->post('title')), 'content' => $this->input->post('post_content'), 'tag' => $this->input->post('tag')); $this->db->where('ID', $this->input->post('project_id')); $this->db->update('projects', $data); //if there's an image uploaded if (!empty($image_data)) { //check if project has photo in table photos $a = $this->get_project_photo($this->input->post('project_id')); if (count($a) > 0) { //yes, update //remove the previous image(?) $prev_image = $this->get_project_photo($this->input->post('project_id')); if (is_file('uploads/' . $prev_image->src)) { unlink('uploads/' . $prev_image->src); } $data = array('src' => $image_data['file_name']); $this->db->where('ID', $prev_image->ID); $this->db->update('photos', $data); } else { //no, insert $post_info = $this->get_post($this->input->post('project_id')); $data = array('post_id' => $post_info->ID, 'account_id' => $this->session->userdata('user_id'), 'entry_date' => date('Y-m-d H:i:s'), 'src' => $image_data['file_name']); $this->db->insert('photos', $data); } } return true; } ##### EXPERIMENTAL : COMMENT TO ENABLE ADMIN UPDATE. UNCOMMENT IF THERE'S PROBLEM #} }
function update() { $data = array('title' => $this->input->post('title'), 'alias' => pretty_url($this->input->post('title')), 'content' => $this->input->post('post_content'), 'short_desc' => $this->input->post('short_desc'), 'date' => date("Y-m-d")); $this->db->where('article_id', $this->input->post('article_id')); $this->db->update('articles', $data); }
?> </span></h1> </div> <div class="content_container box-content"> <?php if (empty($article_id)) { ?> <ul class="article_list"> <?php foreach ($articles as $r) { ?> <li> <p><a href="<?php echo base_url() . 'article/' . $r->article_id . '/' . pretty_url($r->title); ?> "><?php echo $r->title; ?> </a></p> <small><?php echo $r->short_desc; ?> </small> </li> <?php } ?> </ul> <?php