function get_tag($tag, $page) { $term = make_it_safe($tag); $text = "SELECT DISTINCT id, time FROM quiz JOIN (SELECT quiz_id FROM tag WHERE tag='{$term}') AS hellyeah ON quiz.id=quiz_id"; $return['query'] = build_query($text, $page); $return['pagination'] = get_pagination($text, $page); return $return; }
function submit_profile_settings($username) { $fullname = $this->input->post('fullname'); $bio = $this->input->post('bio'); $website = $this->input->post('website'); $avatar = $this->input->post('avatar'); $message = $this->validate('profile', $username, '', '', $fullname, $bio, $website); if (!empty($message)) { $this->session->set_flashdata('message', $message); } else { if ($avatar !== '') { $avatardata = array('avatar' => $this->avatar($avatar, get_twitter($username, FALSE, FALSE), get_email($username))); manipulate_database('update', 'user', $avatardata, array('username' => $username)); } if ($website == 'http://') { $website = ''; } $data = array('fullname' => make_it_safe($fullname), 'bio' => make_it_safe($bio), 'website' => $website); manipulate_database('update', 'user', $data, array('username' => $username)); $this->session->set_flashdata('message', array('Awesome! Your profile settings had been saved.')); } }
function edit_form_submit($quizid, $title, $change) { $row = $this->db->query("SELECT title FROM quiz WHERE id='{$quizid}' LIMIT 1")->row(); $data = array('title' => make_it_safe($title)); manipulate_database('update', 'quiz', $data, array('id' => $quizid)); if ($row->title != $title) { $change = TRUE; } if ($change == TRUE) { $data = array('last_edit_time' => time()); manipulate_database('update', 'quiz', $data, array('id' => $quizid)); } }
function insert_tags($quizid, $tag) { $data = array('quiz_id' => $quizid, 'tag' => strtolower(make_it_safe($tag))); manipulate_database('insert', 'tag', $data); }