if (isset($_GET['tags_list'])) { $TAGS_LIST = explode(',', $_GET['tags_list']); for ($i = 0; $i < count($TAGS_LIST); $i++) { $TAGS_LIST[$i] = round($TAGS_LIST[$i]); } } if (isset($_GET['folders_list'])) { $FOLDERS_LIST = explode(',', $_GET['folders_list']); } if (isset($_GET['locGps'])) { $LOC_GPS = explode(',', $_GET['locGps']); // print_r( $LOC_GPS ); } if (isset($_GET['importStep'])) { $IMPORT_STEP = round($_GET['importStep']); } if (isset($_POST['importAddDir'])) { $IMPORT_FOLDER = $_POST['importFolder']; if (isset($_POST['folderName'])) { $IMPORT_FOLDER_NAME = $_POST['folderName']; } } if (isset($_GET['action'])) { if ($_GET['action'] == 'remTag') { removeTag($CUR_FILE, $_GET['tag']); header('Location: ?file=' . $CUR_FILE . ''); } } if (isset($_POST['addTag'])) { addTagIntoFile($CUR_FILE, $_POST['newTag']); }
function addTagToImage($_tagName, $_imgId) { $tagId = addTagBdd($_tagName); if ($tagId <= 0) { $sql = 'SELECT id FROM tags WHERE name="' . clean_champ($_tagName) . '"'; $req = mysql_query($sql); $infos = mysql_fetch_assoc($req); $tagId = $infos['id']; } $sql = 'SELECT path, filename FROM files WHERE id=' . $_imgId . ''; $req = mysql_query($sql); if (mysql_num_rows($req) > 0) { $infos = mysql_fetch_assoc($req); addTagIntoFile($infos['path'] . '/' . $infos['filename'], $_tagName); $sql = 'INSERT INTO files_tags (file_id, tag_id) VALUES (' . $_imgId . ', ' . $tagId . ')'; return mysql_query($sql); } return false; }