/** * Used to update a thread informations * @global type $input * @return boolean */ function thread_edit() { global $input; $thread_id = $input['thread_id']; $thread_message = surround_url($input['thread_message'] . edited_on()); $thread_timecode = intval($input['thread_timecode']); $thread_title = htmlspecialchars($input['thread_title']); $album = $input['thread_album']; $asset = $input['thread_asset']; $_SESSION['current_thread '] = $thread_id; // remove php and javascript tags $thread_message = safe_text($thread_message); thread_update($thread_id, $thread_title, $thread_message, $thread_timecode, $album, $_SESSION['user_full_name']); cache_asset_threads_unset($album, $asset); cache_album_threads_unset($album); trace_append(array('3', 'thread_edit', $album, $asset, $thread_timecode, $thread_id)); return thread_details_update(); }
/** * Adds a bookmark in the bookmarks file (table of contents) * @param type $album the album the bookmark is intended to * @param type $asset the asset the bookmark is intended to * @param type $timecode the specific time code of the bookmark * @param type $title the title of the bookmark * @param type $description the description of the bookmark * @param type $keywords the keywords of the bookmark * @param type $level the level of the bookmark * @return boolean true if the bookmark has been added to the table of contents; * false otherwise */ function toc_asset_bookmark_add($album, $asset, $timecode, $title = '', $description = '', $keywords = '', $level = '1', $type = '') { // Sanity check if (!ezmam_album_exists($album)) { return false; } if (!ezmam_asset_exists($album, $asset)) { return false; } if (!isset($timecode) || $timecode == '' || $timecode < 0) { return false; } // 1) set the repository path $toc_path = ezmam_repository_path(); if ($toc_path === false) { return false; } // set user's file path $toc_path = $toc_path . '/' . $album; // remove the previous same bookmark if it existed yet toc_asset_bookmark_delete($album, $asset, $timecode); // Get the bookmarks list $bookmarks_list = toc_album_bookmarks_list_get($album); $count = count($bookmarks_list); $index = 0; if ($count > 0) { $index = -1; $asset_ref = $bookmarks_list[0]['asset']; $timecode_ref = $bookmarks_list[0]['timecode']; // loop while the asset is older than the reference asset while ($index < $count && $asset > $asset_ref) { ++$index; $asset_ref = $bookmarks_list[$index]['asset']; $timecode_ref = $bookmarks_list[$index]['timecode']; } // if the asset already contains bookmarks, loop while // timecode is bigger than reference timecode while ($index < $count && $asset == $asset_ref && $timecode > $timecode_ref) { ++$index; $timecode_ref = $bookmarks_list[$index]['timecode']; $asset_ref = $bookmarks_list[$index]['asset']; } if ($index < 0) { // no bookmarks yet $index = 0; } if ($index > $count) { // bookmark is in last position in the table of contents --$index; } } // extract keywords from the description $keywords_array = get_keywords($description); // and save them as keywords foreach ($keywords_array as $keyword) { if (strlen($keywords) > 0) { $keywords .= ', '; } $keywords .= $keyword; } // surround every url by '*' for url recognition in EZplayer $description = surround_url($description); // add a bookmark at the specified index in the albums list array_splice($bookmarks_list, $index, 0, array(null)); $bookmarks_list[$index] = array('album' => $album, 'asset' => $asset, 'timecode' => $timecode, 'title' => $title, 'description' => $description, 'keywords' => $keywords, 'level' => $level, 'type' => $type); return assoc_array2xml_file($bookmarks_list, $toc_path . "/_bookmarks.xml", "bookmarks", "bookmark"); }