fi
}
+AUTHOR(){
+ if [ "$channel" -a "$USER_ID" -a ! "${CHANNEL_AUTHORS##*${USER_ID}*}" ]; then
+ return 0
+ else
+ return 1
+ fi
+}
+
# Video
# ID NAME DESCRIPTION RESX RESY LENGTH COVER STATUS UPLOADER HITS
REDIRECT "${_BASE}/channel/#ERROR_NOCHANNEL"
elif [ ! "$USER_ID" ]; then
REDIRECT "${_BASE}/channel/${channel}/#ERROR_NOTLOGGEDIN"
- elif [ "${CHANNEL_AUTHORS##*${USER_ID}*}" ]; then
+ elif ! AUTHOR; then
REDIRECT "${_BASE}/channel/${channel}/#ERROR_UPDATE_NOTALLOWED"
elif update_channel "$channel" "$(POST name)" "$(POST description)" \
"" "" "$USER_ID" "" ""; then
newvideo)
video="$(POST video |checkid)"
- [ "$channel" -a "$USER_ID" -a ! "${CHANNEL_AUTHORS##*${USER_ID}*}" ] \
+ AUTHOR \
&& mkdir -p -- "${_DATA}/${channel}/"
if [ ! "$video" ]; then
REDIRECT "${_BASE}/channel/#ERROR_NOCHANNEL"
elif [ ! "$USER_ID" ]; then
REDIRECT "${_BASE}/channel/${channel}/#ERROR_NOTLOGGEDIN"
- elif [ "${CHANNEL_AUTHORS##*${USER_ID}*}" ]; then
+ elif ! AUTHOR; then
REDIRECT "${_BASE}/channel/${channel}/#ERROR_UPDATE_NOTALLOWED"
elif LOCK "$vid_db"; then
if grep -q '^${video} ' "$vid_db"; then
thumb="${_BASE}/${CID}/thumb_${ID}.jpg"
[ "$NAME" = \\ ] && NAME="(Unnamed Video)"
printf '[div .video .thumb
- [h3 [a href="%s/" . %s]]
+ [h3 [a href="%s/channel/%s/%s/" . %s]]
[figure [img src="%s" alt=""]]
[div .description . %s]
- ]' "$ID" "$(UNSTRING "$NAME" |HTML)" "$thumb" "$(UNSTRING "$DESCR_CACHE")"
+ ]' "$_BASE" "$CID" "$ID" "$(UNSTRING "$NAME" |HTML)" "$thumb" "$(UNSTRING "$DESCR_CACHE")"
else
return 1
fi
if [ "$channel" -a "$video" ]; then
. ${_EXEC}/page_video.sh
elif [ "$channel" -a "$action" = edit ]; then
- [ "$USER_ID" -a ! "${CHANNEL_AUTHORS##*${USER_ID}*}" ] \
- || REDIRECT "${_BASE}/${channel}/#ERROR_EDIT_NOTALLOWED"
+ AUTHOR || REDIRECT "${_BASE}/${channel}/#ERROR_EDIT_NOTALLOWED"
yield_page "$CHANNEL_NAME - Edit" "channel edit" <<-EOF
[form .channel .edit method=POST
[input name="name" value="$(HTML "$CHANNEL_NAME")" placeholder="Channel Name"]
elif [ "$channel" ]; then
yield_page "$CHANNEL_NAME" "channel" <<-EOF
[nav [a href="../" Channels] - [span $(HTML "${CHANNEL_NAME:-(Unnamed Channel)}")]
- $( [ "$USER_ID" -a ! "${CHANNEL_AUTHORS##*${USER_ID}*}" ] \
- && printf ' - [a href="edit" edit]'
- )
+ $(AUTHOR && printf ' - [a href="edit" edit]')
]
[h1 .name $(HTML "$CHANNEL_NAME")]
[div .description . ${CHANNEL_DESCR_CACHE}]
[h1 .videos Videos]
[div .videos . $(
- [ "$USER_ID" -a ! "${CHANNEL_AUTHORS##*${USER_ID}*}" ] \
- && printf '
+ AUTHOR && printf '
[form .video .newvideo method=POST
[hidden "video" "%s"]
[submit "action" "newvideo" New Video]