public static function get_tree_nodes($tree_name) { $dbh = DB::m(); $tree_name = mysql_real_escape_string($tree_name, $dbh); $query = <<<SQL SELECT \thpi_navigation_trees.title AS tree_title, \thpi_navigation_nodes.id AS node_id, \thpi_navigation_nodes.parent_id AS parent_id, \thpi_navigation_nodes.sort_order AS sort_order,\t \thpi_navigation_nodes.open_in_new_window AS open_in_new_window, \thpi_navigation_urls.title AS url_title, \thpi_navigation_urls.href AS url_href FROM \thpi_navigation_trees \t\tINNER JOIN hpi_navigation_nodes ON \t\t\thpi_navigation_trees.id = hpi_navigation_nodes.tree_id \t\tINNER JOIN hpi_navigation_urls ON \t\t\thpi_navigation_nodes.url_id = hpi_navigation_urls.id WHERE \thpi_navigation_trees.title = '{$tree_name}' ORDER BY \tsort_order ASC \t SQL; #echo $query; exit; $result = mysql_query($query, $dbh); $nodes = array(); while ($row = mysql_fetch_assoc($result)) { $nodes[] = $row; } return $nodes; }
public static function render_tree($tree_name) { $dbh = DB::m(); $query = <<<SQL SELECT \thpi_navigation_trees.title AS tree_title, \thpi_navigation_nodes.id AS node_id, \thpi_navigation_nodes.parent_id AS parent_id, \thpi_navigation_nodes.sort_order AS sort_order,\t \thpi_navigation_nodes.open_in_new_window AS open_in_new_window, \thpi_navigation_urls.title AS url_title, \thpi_navigation_urls.href AS url_href FROM \thpi_navigation_trees \t\tINNER JOIN hpi_navigation_nodes ON \t\t\thpi_navigation_trees.id = hpi_navigation_nodes.tree_id \t\tINNER JOIN hpi_navigation_urls ON \t\t\thpi_navigation_nodes.url_id = hpi_navigation_urls.id WHERE \thpi_navigation_trees.title = '{$tree_name}' ORDER BY \tsort_order ASC \t SQL; #echo $query; exit; $result = mysql_query($query, $dbh); $nodes = array(); while ($row = mysql_fetch_assoc($result)) { $nodes[] = $row; } #print_r($nodes); #exit; $links_tree = new Navigation_LinksTree($node); $links_tree->render_ol(); }
public function is_user_id_allowed_to_view_drama($user_id, Oedipus_Drama $drama) { $user = NULL; $drama_id = $drama->get_id(); if (InputValidation_NumberValidator::validate_database_id($user_id)) { $dbh = DB::m(); $user_id = mysql_real_escape_string($user_id, $dbh); $query = <<<SQL SELECT \tcount(user_id) AS count FROM \toedipus_users_allowed_to_view_drama_links WHERE \toedipus_users_allowed_to_view_drama_links.user_id = {$user_id} \tAND \toedipus_users_allowed_to_view_drama_links.drama_id = {$drama_id} SQL; $result = mysql_query($query, $dbh); if ($row = mysql_fetch_assoc($result)) { if ($row['count'] == 1) { return TRUE; } return FALSE; } } }
public function edit_something() { //print_r($_POST);exit; //print_r($_GET);exit; $dbh = DB::m(); $id = mysql_real_escape_string($_GET['id']); $name = mysql_real_escape_string($_POST['name']); $url = mysql_real_escape_string($_POST['url']); $status = mysql_real_escape_string($_POST['status']); $haddock_class_name = mysql_real_escape_string($_POST['haddock_class_name']); $stmt = <<<SQL UPDATE \thpi_video_library_external_video_providers SET \tname = '{$name}', \turl = '{$url}', \thaddock_class_name = '{$haddock_class_name}', \tstatus = '{$status}' WHERE \tid = {$id} SQL; // print_r($stmt);exit; $result = mysql_query($stmt, $dbh); return $id; }
public static function render_news_item($news_item_id) { $dbh = DB::m(); $query = <<<SQL SELECT \t* FROM \thpi_news_items WHERE \tid = {$news_item_id} SQL; $result = mysql_query($query, $dbh); if (mysql_num_rows($result) == 0) { throw new Exception('No news item found!'); } else { $news_item = mysql_fetch_assoc($result); /* * The title, */ echo '<h3>'; echo $news_item['title']; echo " \n"; echo date('d/m/y', strtotime($news_item['submitted'])); echo "</h3>\n"; /* * The first paragraph. */ $item = $news_item['item']; $item = stripslashes($item); $paragraphs = Strings_Splitter::blank_line_separated($item); foreach ($paragraphs as $p) { echo "<p>{$p}</p>\n"; } } }
public function delete_everything() { $dbh = DB::m(); $stmt = <<<SQL TRUNCATE TABLE \thpi_polls_answers SQL; mysql_query($stmt, $dbh); }
public function delete_everything() { $dbh = DB::m(); $stmt = <<<SQL TRUNCATE TABLE \thpi_navigation_nodes SQL; mysql_query($stmt, $dbh); }
public function content() { $dbh = DB::m(); $query = <<<SQL SELECT \t* FROM \thpi_polls_questions ORDER BY \tquestion ASC SQL; $result = mysql_query($query, $dbh); $questions = array(); while ($row = mysql_fetch_assoc($result)) { $questions[] = $row; } ?> <table> <caption>Questions</caption> <thead> <tr> <th>Question</th> <th>Current</th> <th>Make Current</th> </tr> </thead> <tbody> <?php foreach ($questions as $question) { echo "<tr>\n"; echo "<td>\n"; echo stripcslashes($question['question']); echo "</td>\n"; echo "<td>\n"; echo $question['current']; echo "</td>\n"; echo "<td>\n"; if ($question['current'] == 'Yes') { echo ' '; } else { echo '<a '; $return_to = $this->get_current_base_url(); $return_to = urlencode($return_to->get_as_string()); echo ' href="/haddock/public-html/public-html/index.php?oo-page=1&page-class=Polls_ChooseCurrentQuestionAdminRedirectScript&question_id=' . $question['id'] . '&return_to=' . $return_to . '" '; echo '>'; echo "Do it"; echo "</a>\n"; } echo "</td>\n"; echo "</tr>\n"; } ?> </tbody> </table> <?php }
protected function render_edit_something_form_ol() { $acm = $this->get_admin_crud_manager(); echo "<ol>\n"; ?> <li> <?php $dbh = DB::m(); $query = <<<SQL SELECT \tid, \tquestion FROM \thpi_polls_questions ORDER BY \tquestion ASC SQL; $result = mysql_query($query, $dbh); if ($result && mysql_num_rows($result) > 0) { ?> <label for="question_id">Question</label> <select name="question_id" > <?php while ($row = mysql_fetch_assoc($result)) { ?> <option value="<?php echo $row['id']; ?> " <?php if ($acm->has_current_var('question_id') && $acm->get_current_var('question_id') == $row['id']) { echo ' selected="selected"'; } ?> ><?php echo stripcslashes($row['question']); ?> </option> <?php } ?> </select> <?php } else { ?> <p class="error">No questions available!</p> <?php } ?> </li> <?php $this->render_edit_something_form_li_text_input('answer'); echo "</ol>\n"; }
public function delete_everything() { $dbh = DB::m(); $acm = $this->get_admin_crud_manager(); $table_name = $acm->get_table_name(); $stmt = <<<SQL TRUNCATE TABLE \t{$table_name} SQL; mysql_query($stmt, $dbh); }
public static function restore_all_products() { $dbh = DB::m(); $stmt = <<<SQL UPDATE \thpi_trackit_stock_management_products SET \tdeleted = 'No' SQL; #echo $stmt; mysql_query($stmt, $dbh); }
public static function get_rows_for_query(Database_SQLSelectQuery $query) { $rows = array(); $dbh = DB::m(); $str_query = $query->get_as_string(); #echo "\$str_query: $str_query\n"; #exit; $result = mysql_query($str_query, $dbh); while ($row = mysql_fetch_assoc($result)) { $rows[] = $row; } #print_r($rows); return $rows; }
public function delete_everything() { $dbh = DB::m(); $stmt = <<<SQL TRUNCATE TABLE \thpi_video_library_external_video_libraries SQL; mysql_query($stmt, $dbh); $stmt_2 = <<<SQL TRUNCATE TABLE \thpi_video_library_ext_vid_to_ext_vid_lib_links SQL; mysql_query($stmt_2, $dbh); }
public static function disassociate_product_photo($product_id, $photograph_id) { $dbh = DB::m(); $product_id = mysql_real_escape_string($product_id, $dbh); $photograph_id = mysql_real_escape_string($photograph_id, $dbh); $stmt = <<<SQL DELETE FROM \thpi_shop_product_photograph_links WHERE \tproduct_id = {$product_id} \tAND \tphotograph_id = {$photograph_id} SQL; mysql_query($stmt, $dbh); }
public static function delete_row($id, $table_name) { $dbh = DB::m(); $id = mysql_real_escape_string($id, $dbh); $table_name = mysql_real_escape_string($table_name, $dbh); $stmt = <<<SQL DELETE FROM \t{$table_name} WHERE \tid = {$id} SQL; mysql_query($stmt, $dbh); if (mysql_error($dbh)) { throw new Database_MySQLException($dbh); } else { return TRUE; } }
/** * Applies the modifying statement to the database. * * If the statement is a Database_SQLInsertStatement object or subclass, * the insert ID is returned. * * Otherwise, the number of affected rows is returned. */ public static function apply_statement(Database_SQLStatement $statement) { #echo __METHOD__ . "\n"; #print_r($statement); #exit; $statement_as_string = $statement->get_as_string(); #echo "\$statement_as_string:\n$statement_as_string\n"; #echo 'strlen($statement_as_string): ' . strlen($statement_as_string) . "\n"; #exit; $dbh = DB::m(); mysql_query($statement_as_string, $dbh); if (mysql_errno($dbh)) { throw new Database_MySQLException($dbh); } if ($statement instanceof Database_SQLInsertStatement) { return mysql_insert_id($dbh); } else { return mysql_affected_rows($dbh); } }
public static function get_external_videos_through_union_query($sql_parts, $options = array('count' => FALSE)) { $dbh = DB::m(); $i = 0; $query = ''; if ($options['count']) { $query .= 'SELECT count(id) AS count FROM (' . "\n"; } foreach ($sql_parts as $sql) { if ($i > 0) { $query .= "\n" . 'UNION DISTINCT' . "\n"; } $i++; $query .= "\n" . '('; $query .= self::assemble_query_from_sql_parts_for_union($sql); $query .= ')' . "\n"; } if ($options['count'] == FALSE) { /* * Use the limit from the first part */ $query .= "\n" . $sql_parts[0]['limit']; } else { $query .= ') AS count'; // print_r($query);exit; } // print_r($query);exit; $result = mysql_query($query, $dbh); $videos = array(); while ($row = mysql_fetch_assoc($result)) { $videos[] = $row; } if ($options['count']) { // print_r($videos);exit; return $videos[0]['count']; } return $videos; }
public function do_actions() { #print_r($_GET); if (isset($_GET['answer_id'])) { $dbh = DB::m(); $answer_id = mysql_real_escape_string($_GET['answer_id'], $dbh); $session_id = session_id(); $remote_address = $_SERVER['REMOTE_ADDR']; $http_user_agent = $_SERVER['HTTP_USER_AGENT']; $stmt = <<<SQL INSERT INTO \thpi_polls_votes SET \tanswer_id = {$answer_id}, \tsubmitted = NOW(), \tremote_address = '{$remote_address}', \tsession_id = '{$session_id}', \thttp_user_agent = '{$http_user_agent}' SQL; mysql_query($stmt, $dbh); } #exit; }
public function do_actions() { if (isset($_GET['question_id'])) { $dbh = DB::m(); $stmt = <<<SQL UPDATE \thpi_polls_questions SET \tcurrent = 'No' SQL; mysql_query($stmt, $dbh); $question_id = mysql_real_escape_string($_GET['question_id'], $dbh); $stmt = <<<SQL UPDATE \thpi_polls_questions SET \tcurrent = 'Yes' WHERE \tid = {$question_id} SQL; mysql_query($stmt, $dbh); } }
/** * Decouple this from the mash shop project! */ public static function get_available_stock_level($product_id, $variation = NULL) { $available_stock_level = 0; if (isset($variation) && isset($variation['size']) && isset($variation['colour'])) { $dbh = DB::m(); $product_id = mysql_real_escape_string($product_id, $dbh); $size = $variation['size']; $size = mysql_real_escape_string($size, $dbh); $colour = $variation['colour']; $colour = mysql_real_escape_string($colour, $dbh); $query = <<<SQL SELECT \thpi_trackit_stock_management_stock_levels.quantity FROM \thpi_trackit_stock_management_products \t\tINNER JOIN hpi_trackit_stock_management_stock_levels \t\t\tON \t\t\t\thpi_trackit_stock_management_products.product_id \t\t\t\t= \t\t\t\thpi_trackit_stock_management_stock_levels.product_id WHERE \thpi_trackit_stock_management_products.shop_product_id = {$product_id} \tAND \thpi_trackit_stock_management_stock_levels.size = '{$size}' \tAND \thpi_trackit_stock_management_stock_levels.colour = '{$colour}' SQL; #echo $query; exit; $result = mysql_query($query, $dbh); if ($row = mysql_fetch_array($result)) { $available_stock_level = floor($row[0]); } #print_r($stock_level_data); exit; } #echo $available_stock_level; exit; return $available_stock_level; }
/** * Should each log in be logged? * * We could remove the last_logged_in field and * add another table, recording the start and finish * of each session. */ public static function log_in($user_id) { /* * Update the last logged in field. */ $dbh = DB::m(); $user_id = mysql_real_escape_string($user_id, $dbh); $stmt = <<<SQL UPDATE \tps_users SET \tlast_logged_in = NOW() WHERE \tid = {$user_id} SQL; mysql_query($stmt, $dbh); /* * Set the session variable. */ #print_r($_SESSION); $_SESSION['logged-in-id'] = $user_id; #print_r($_SESSION); #exit; }
protected function get_all_rows_raw_data() { $query = $this->get_fetch_all_rows_sql_query(); $dbh = DB::m(); $result = mysql_query($query->get_as_string(), $dbh); $arrd = array(); while ($row = mysql_fetch_assoc($result)) { $arrd[] = $row; } echo 'print_r($arrd):' . "\n"; print_r($arrd); return $arrd; }
public function get_products_table_as_str() { ob_start(); $order = $this->get_element(); $txn_id = $order->get('txn_id'); $dbh = DB::m(); # $query = <<<SQL #SELECT # hpi_shop_products.name AS product_name, # hpi_trackit_stock_management_products.product_id AS trackit_product_id, # hpi_trackit_stock_management_products.supplier_code AS trackit_supplier_code, # hpi_shop_shopping_baskets.size AS size, # hpi_shop_shopping_baskets.colour AS colour, # hpi_shop_shopping_baskets.quantity AS order_quantity, # hpi_trackit_stock_management_stock_levels.quantity AS quantity_in_stock #FROM # hpi_shop_shopping_baskets, # hpi_shop_products, # hpi_trackit_stock_management_products, # hpi_trackit_stock_management_stock_levels #WHERE # hpi_shop_shopping_baskets.txn_id = $txn_id # AND # hpi_shop_shopping_baskets.product_id = hpi_shop_products.id # AND # hpi_shop_shopping_baskets.product_id = hpi_trackit_stock_management_products.shop_product_id # AND # ( # hpi_shop_shopping_baskets.size = hpi_trackit_stock_management_stock_levels.size # AND # hpi_shop_shopping_baskets.colour = hpi_trackit_stock_management_stock_levels.colour # AND # hpi_trackit_stock_management_products.product_id = hpi_trackit_stock_management_stock_levels.product_id # ) #SQL; $query = <<<SQL SELECT \thpi_shop_products.name AS product_name, \thpi_trackit_stock_management_products.product_id AS trackit_product_id, \thpi_trackit_stock_management_products.supplier_code AS trackit_supplier_code, \thpi_shop_shopping_baskets.size AS size, \thpi_shop_shopping_baskets.colour AS colour, \thpi_shop_shopping_baskets.quantity AS order_quantity, \thpi_trackit_stock_management_stock_levels.quantity AS quantity_in_stock, \thpi_shop_product_photograph_links.photograph_id AS photograph_id FROM \thpi_shop_shopping_baskets \t\tINNER JOIN hpi_shop_products \t\t\tON hpi_shop_shopping_baskets.product_id = hpi_shop_products.id \t\tINNER JOIN hpi_trackit_stock_management_products \t\t\tON hpi_shop_shopping_baskets.product_id = hpi_trackit_stock_management_products.shop_product_id \t\tINNER JOIN hpi_trackit_stock_management_stock_levels \t\t\tON hpi_trackit_stock_management_products.product_id = hpi_trackit_stock_management_stock_levels.product_id \t\tLEFT JOIN hpi_shop_product_photograph_links \t\t\tON hpi_shop_products.id = hpi_shop_product_photograph_links.product_id WHERE \thpi_shop_shopping_baskets.txn_id = {$txn_id} SQL; /* Removed these last two AND clauses cos some products weren't showing! */ // AND // ( // hpi_shop_shopping_baskets.size = hpi_trackit_stock_management_stock_levels.size // AND // hpi_shop_shopping_baskets.colour = hpi_trackit_stock_management_stock_levels.colour // ) // AND // hpi_shop_product_photograph_links.type = 'main' //SQL; #echo "$query\n"; exit; #INNER JOIN hpi_trackit_stock_management_stock_levels ON # hpi_trackit_stock_management_products.shop_product_id = hpi_trackit_stock_management_stock_levels.product_id $result = mysql_query($query, $dbh); $products = array(); while ($row = mysql_fetch_assoc($result)) { $products[] = $row; } #print_r($products); $order_row = $this->get_element(); $database = $order_row->get_database(); $photographs_table = $database->get_table('hpi_shop_photographs'); ?> <table id="order_products"> <caption>Products</caption> <thead> <tr> <th>Name</th> <th>Product ID</th> <th>Supplier Code</th> <th>Size</th> <th>Colour</th> <th>Order Quantity</th> <th>Quantity in stock</th> <th>Photograph</th> </tr> </thead> <tbody> <?php foreach ($products as $product) { ?> <tr> <td><?php echo $product['product_name']; ?> </td> <td><?php echo $product['trackit_product_id']; ?> </td> <td><?php echo $product['trackit_supplier_code']; ?> </td> <td><?php echo $product['size']; ?> </td> <td><?php echo $product['colour']; ?> </td> <td><?php echo floor($product['order_quantity']); ?> </td> <td><?php echo floor($product['quantity_in_stock']); ?> </td> <td><?php if (isset($product['photograph_id'])) { $photograph_row = $photographs_table->get_row_by_id($product['photograph_id']); $photograph_row_renderer = $photograph_row->get_renderer(); echo $photograph_row_renderer->get_thumbnail_image_a(); } ?> </td> </tr> <?php } ?> </tbody> </table> <?php return ob_get_clean(); }
/** * Returns an array of associative arrays of the data from the database * that matches the given constraints. * The data is limited and sorted according to the settings of the page. * * This could be refactored to the database class. */ protected function get_matching_rows() { $dbh = DB::m(); $query = $this->get_matching_rows_query(); #echo $query; exit; $result = mysql_query($query, $dbh); if ($result) { $matching_rows = array(); while ($row = mysql_fetch_assoc($result)) { $matching_rows[] = $row; } return $matching_rows; } else { #throw new Exception("Unable to fetch the matching rows!"); throw new Database_MySQLException($dbh); } }
/** * If a page sets a get variable that is an ID, * it should be checked here before being put into a * query. */ public static function clean_get_id($id) { if (!is_numeric($id)) { throw new Exception("{$id} is not numeric!"); } if ($id < 1) { throw new Exception("{$id} is less than 1!"); } if (!preg_match('/^[0-9]+$/', $id)) { throw new Exception("{$id} is not an integer!"); } /* * Not really necessary at this point but * it's better to be safe. */ $dbh = DB::m(); $id = mysql_real_escape_string($id, $dbh); return $id; }
public function add_something() { //print_r($_POST);exit; $dbh = DB::m(); $name = mysql_real_escape_string($_POST['name']); $description = mysql_real_escape_string($_POST['description']); $status = mysql_real_escape_string($_POST['status']); $sort_order = mysql_real_escape_string($_POST['sort_order']); $stmt = <<<SQL INSERT INTO \thpi_video_library_external_videos_frame_grabbing_queue SET \tdate_added = NOW() SQL; //print_r($stmt);exit; $result = mysql_query($stmt, $dbh); return mysql_insert_id($dbh); }
public function get_key_values_from_get_vars() { $cs = $this->get_key_columns_for_something(); $vs = array(); $dbh = DB::m(); foreach ($cs as $c) { if (isset($_GET[$c])) { $vs[$c] = mysql_real_escape_string($_GET[$c], $dbh); } else { throw new Exception("{$c} must be set!"); } } return $vs; }
public static function test_dbh_is_pingable() { $dbh = DB::m(); return mysql_ping($dbh); }
public static function item_is_in_cache($feed_id, $item_id) { $dbh = DB::m(); $feed_id = mysql_real_escape_string($feed_id); $stmt = <<<SQL SELECT COUNT(*) as count FROM hpi_feed_aggregator_cache WHERE feed_id = '{$feed_id}' AND unique_item_id = '{$item_id}' SQL; // print_r($stmt);exit; $result = mysql_query($stmt, $dbh); $row = mysql_fetch_assoc($result); // print_r($row);exit; if ($row['count'] > 0) { return TRUE; } else { return FALSE; } }
protected function do_actions() { //print_r($_POST);exit; /** EXAMPLE FORM POST *<textarea name="contents"> *$contents *</textarea> *<input type="hidden" name="filter_function" value="$filter_function" /> *<input type="hidden" name="page" value="$page" /> *<input type="hidden" name="section" value="$section" /> *<input type="hidden" name="language" value="$name" /> *<input type="hidden" name="path" value="$path" /> *<input type="submit" value="Edit" /> */ $return_url = VideoLibrary_URLHelper::get_home_page_url(); if (Admin_LogInHelper::is_logged_id()) { $return_url = $this->get_redirect_script_return_url(); // print_r($return_url);exit; try { if (isset($_POST['name']) && $_POST['name'] != '' && (isset($_POST['length']) && $this->validate_length($_POST['length'])) && (isset($_POST['external_video_provider_id']) && $_POST['external_video_provider_id'] != '') && (isset($_POST['external_video_library_id']) && $_POST['external_video_library_id'] != '') && (isset($_POST['providers_internal_id']) && $_POST['providers_internal_id'] != '') && (isset($_POST['status']) && $_POST['status'] != '') && $this->is_video_unique($_POST['external_video_provider_id'], $_POST['providers_internal_id'])) { $dbh = DB::m(); $name = htmlentities($_POST['name']); $name = mysql_real_escape_string($name, $dbh); $length_seconds = $this->get_length_in_seconds_from_input($_POST['length']); $length_seconds = mysql_real_escape_string($length_seconds); $external_video_library_id = mysql_real_escape_string($_POST['external_video_library_id']); $external_video_provider_id = mysql_real_escape_string($_POST['external_video_provider_id']); $providers_internal_id = mysql_real_escape_string($_POST['providers_internal_id']); $status = mysql_real_escape_string($_POST['status']); $added_by = mysql_real_escape_string(VideoLibrary_AdminHelper::get_logged_in_admin_user_name()); $tags = VideoLibrary_TagsHelper::get_tags_array_for_admin_post_input($_POST['tags']); //print_r($tags);exit; $stmt = <<<SQL INSERT INTO hpi_video_library_external_videos SET name = '{$name}', length_seconds = '{$length_seconds}', external_video_provider_id = '{$external_video_provider_id}', providers_internal_id = '{$providers_internal_id}', status = '{$status}', date_added = NOW(), added_by = '{$added_by}' SQL; //print_r($stmt);exit; $result = mysql_query($stmt, $dbh); $id = mysql_insert_id($dbh); $stmt_2 = <<<SQL INSERT INTO hpi_video_library_ext_vid_to_ext_vid_lib_links SET external_video_id = '{$id}', external_video_library_id = '{$external_video_library_id}' SQL; //print_r($stmt);exit; $result = mysql_query($stmt_2, $dbh); foreach ($tags as $tag) { $tag = mysql_real_escape_string($tag); $tag_query_1 = <<<SQL INSERT INTO hpi_video_library_tags SET tag = '{$tag}', principal = 'no' SQL; $result = mysql_query($tag_query_1, $dbh); if ($result) { $tag_id = mysql_insert_id($dbh); } else { if (mysql_errno() == 1062) { #duplicate $tag_id = VideoLibrary_DatabaseHelper::get_tag_id_for_tag_string($tag); } } $tag_query_2 = <<<SQL INSERT INTO hpi_video_library_tags_to_ext_vid_links SET tag_id = '{$tag_id}', external_video_id = '{$id}' SQL; $result = mysql_query($tag_query_2, $dbh); if (!$result) { if (mysql_errno() == 1062) { #duplicate # Do nothing, link already exists } } } $this->add_video_to_thumbnail_queue($id); } else { throw new VideoLibrary_AddVideoDataNotSetException(); } } catch (VideoLibrary_Exception $e) { $return_url->set_get_variable('error', urlencode($e->getMessage())); } $return_url->set_get_variable('edited', '1'); $return_url->set_get_variable('message', 'Added Video ' . urlencode('#') . $id); } $this->set_return_to_url($return_url); }