Esempio n. 1
0
 function add()
 {
     $this->load->library('m_security');
     $this->m_security->filterPost('addname', 'required');
     if ($this->m_security->startPost() == TRUE) {
         $name = $this->input->post('addname', TRUE);
         $slug = $this->input->post('addslug', TRUE);
         $desc = $this->input->post('adddescription', TRUE);
         $proses = insertTags($name, $slug, $desc, '0');
         if ($proses == TRUE) {
             echo json_encode("ok");
         } else {
             echo json_encode("no");
         }
     } else {
         echo json_encode("no");
     }
 }
Esempio n. 2
0
 function insertTagPost($postid, $tags = '')
 {
     $p = '';
     if (!empty($tags)) {
         foreach ($tags as $row) {
             $p .= $row['text'] . ",";
             $slug = stringCreateSlug($row['text']);
             $s = array('term_type' => 'tag', 'term_value' => $row['text']);
             if ($this->m_database->isBOF('poststaxonomy', $s) == TRUE) {
                 $d = array('post_id' => $postid, 'term_type' => 'tag', 'term_value' => $row['text']);
                 $this->m_database->addRow('poststaxonomy', $d);
                 insertTags($row['text'], $slug, "", "0");
             }
         }
     }
 }
Esempio n. 3
0
         die(json_encode($data));
     }
 } else {
     if ($isAdmin && strpos($_POST['form_id'], 'quote-admin-') === 0) {
         error_log($_POST['form_id'] . ' called');
         $quote = mysqli_real_escape_string($con, $_POST['quote']);
         $source = mysqli_real_escape_string($con, $_POST['source']);
         $sourcename = mysqli_real_escape_string($con, $_POST['sourcename']);
         $qid = (int) mysqli_real_escape_string($con, $_POST['qid']);
         error_log($qid . ' quote');
         $sql = "UPDATE quotes SET quote='" . $quote . "', source='" . $source . "', sourcename='" . $sourcename . "', verified=" . (isset($_POST['verified']) ? 1 : 0) . " WHERE id=" . $qid;
         $query = mysqli_query($con, $sql) or trigger_error("Query Failed: " . mysqli_error($con));
         // remove existing tags
         $sql = "DELETE FROM quote_tags WHERE qid=" . $qid;
         $query = mysqli_query($con, $sql) or trigger_error("Query Failed: " . mysqli_error($con));
         insertTags($qid, $_POST['tags']);
     } else {
         if ($isAdmin && strpos($_POST['form_id'], 'delete-') === 0) {
             error_log($_POST['form_id'] . ' called');
             $qid = (int) mysqli_real_escape_string($con, substr($_POST['form_id'], 7));
             error_log($qid . ' quote');
             $sql = "DELETE FROM quotes WHERE id=" . $qid;
             $query = mysqli_query($con, $sql) or trigger_error("Query Failed: " . mysqli_error($con));
             // remove tag relationships
             $sql = "DELETE FROM quote_tags WHERE qid=" . $qid;
             $query = mysqli_query($con, $sql) or trigger_error("Query Failed: " . mysqli_error($con));
             // remove orphan tags
             $sql = "DELETE FROM tags WHERE id NOT IN (SELECT tid FROM quote_tags)";
             $query = mysqli_query($con, $sql) or trigger_error("Query Failed: " . mysqli_error($con));
         } else {
             if ($_POST['form_id'] == 'getquotes') {