Hello elbeer,
There are some typos in the file submit.php.
I am working on an updated version that includes this bugfix and has some other changes (see jayjay's posts).
In the mean time I'll would suggest you'll replace the submit.php with this one:
<?php
/**
* $Id: submit.php
* Module: XoopsTube
* Version: v1.0.0
* Licence: GNU
*/
include 'header.php';
include XOOPS_ROOT_PATH . '/header.php';
include XOOPS_ROOT_PATH . '/class/xoopsformloader.php';
$mytree = new XoopsTree( $xoopsDB -> prefix( 'xoopstube_cat' ), 'cid', 'pid' );
global $xtubemyts, $xoopsModuleConfig;
$cid = xtube_cleanRequestVars( $_REQUEST, 'cid', 0 );
$lid = xtube_cleanRequestVars( $_REQUEST, 'lid', 0 );
if ( false == checkgroups( $cid, 'XTubeSubPerm' ) )
{
redirect_header( "index.php", 1, _MD_XTUBE_NOPERMISSIONTOPOST );
exit();
}
if ( true == checkgroups( $cid, 'XTubeSubPerm' ) )
{
if ( xtube_cleanRequestVars( $_REQUEST, 'submit', 0 ) )
{
if ( false == checkgroups( $cid, 'XTubeSubPerm' ) )
{
redirect_header( "index.php", 1, _MD_XTUBE_NOPERMISSIONTOPOST );
exit();
}
$submitter = ( is_object( $xoopsUser ) && !empty( $xoopsUser ) ) ? $xoopsUser -> getVar( 'uid' ) : 0;
$forumid = xtube_cleanRequestVars( $_REQUEST, 'forumid', 0 );
$offline = xtube_cleanRequestVars( $_REQUEST, 'offline', 0 );
// $urlrating = xtube_cleanRequestVars( $_REQUEST, 'urlrating', 6 );
$notifypub = xtube_cleanRequestVars( $_REQUEST, 'notifypub', 0 );
$approve = xtube_cleanRequestVars( $_REQUEST, 'approve', 0 );
$url = $xtubemyts -> addslashes( ltrim($_POST["url"]) );
$title = $xtubemyts -> addslashes( ltrim( $_REQUEST["title"] ) );
$descriptionb = $xtubemyts -> addslashes( ltrim( $_REQUEST["descriptionb"] ) );
$time = $xtubemyts -> addslashes( ltrim( $_REQUEST["time"] ) );
$keywords = $xtubemyts -> addslashes( ltrim( $_REQUEST["keywords"] ) );
$date = time();
$publishdate = 0;
$ipaddress = $_SERVER['REMOTE_ADDR'];
if ( $lid == 0 )
{
$status = 0;
$publishdate = 0;
$message = _MD_XTUBE_THANKSFORINFO;
if ( true == checkgroups( $cid, 'XTubeAutoApp' ) )
{
$publishdate = time();
$status = 1;
$message = _MD_XTUBE_ISAPPROVED;
}
$sql = "INSERT INTO " . $xoopsDB -> prefix( 'xoopstube_videos' ) . " (lid, cid, title, url, submitter, status, date, hits, rating, votes, comments, forumid, published, expired, offline, description, ipaddress, notifypub, urlrating, time, keywords) ";
$sql .= " VALUES ('', $cid, '$title', '$url', '$submitter', '$status', '$date', 0, 0, 0, 0, '$forumid', '$publishdate', 0, '$offline', '$descriptionb', '$ipaddress', '$notifypub', '$urlrating', '$time', '$keywords')";
if ( !$result = $xoopsDB -> query( $sql ) )
{
$_error = $xoopsDB -> error() . " : " . $xoopsDB -> errno();
XoopsErrorHandler_HandleError( E_USER_WARNING, $_error, __FILE__, __LINE__ );
}
$newid = $xoopsDB -> getInsertId();
/**
* Notify of new link (anywhere) and new link in category
*/
$notification_handler = &xoops_gethandler( 'notification' );
$tags = array();
$tags['VIDEO_NAME'] = $title;
$tags['VIDEO_URL'] = XOOPS_URL . '/modules/' . $xoopsModule -> getVar( 'dirname' ) . '/singlevideo.php?cid=' . $cid . '&lid=' . $newid;
$sql = "SELECT title FROM " . $xoopsDB -> prefix( 'xoopstube_cat' ) . " WHERE cid=" . $cid;
$result = $xoopsDB -> query( $sql );
$row = $xoopsDB -> fetchArray( $result );
$tags['CATEGORY_NAME'] = $row['title'];
$tags['CATEGORY_URL'] = XOOPS_URL . '/modules/' . $xoopsModule -> getVar( 'dirname' ) . '/viewcat.php?cid=' . $cid;
if ( true == checkgroups( $cid, 'XTubeAutoApp' ) )
{
$notification_handler -> triggerEvent( 'global', 0, 'new_video', $tags );
$notification_handler -> triggerEvent( 'category', $cid, 'new_video', $tags );
redirect_header( 'index.php', 2, _MD_XTUBE_ISAPPROVED );
}
else
{
$tags['WAITINGFILES_URL'] = XOOPS_URL . '/modules/' . $xoopsModule -> getVar( 'dirname' ) . '/admin/newvideos.php';
$notification_handler -> triggerEvent( 'global', 0, 'video_submit', $tags );
$notification_handler -> triggerEvent( 'category', $cid, 'video_submit', $tags );
if ( $notifypub )
{
include_once XOOPS_ROOT_PATH . '/include/notification_constants.php';
$notification_handler -> subscribe( 'video', $newid, 'approve', XOOPS_NOTIFICATION_MODE_SENDONCETHENDELETE );
}
redirect_header( 'index.php', 2, _MD_XTUBE_THANKSFORINFO );
}
}
else
{
if ( true == checkgroups( $cid, 'XTubeAutoApp' ) || $approve == 1 )
{
$updated = time();
$sql = "UPDATE " . $xoopsDB -> prefix( 'xoopstube_videos' ) . " SET cid=$cid, title='$title', url='$url', updated='$updated', offline='$offline', description='$descriptionb', ipaddress='$ipaddress', notifypub='$notifypub', urlrating='$urlrating', time='$time', keywords='$keywords' WHERE lid =" . $lid;
if ( !$result = $xoopsDB -> query( $sql ) )
{
$_error = $xoopsDB -> error() . " : " . $xoopsDB -> errno();
XoopsErrorHandler_HandleError( E_USER_WARNING, $_error, __FILE__, __LINE__ );
}
$notification_handler = &xoops_gethandler( 'notification' );
$tags = array();
$tags['VIDEO_NAME'] = $title;
$tags['VIDEO_URL'] = XOOPS_URL . '/modules/' . $xoopsModule -> getVar( 'dirname' ) . '/singlevideo.php?cid=' . $cid . '&lid=' . $lid;
$sql = "SELECT title FROM " . $xoopsDB -> prefix( 'xoopstube_cat' ) . " WHERE cid=" . $cid;
$result = $xoopsDB -> query( $sql );
$row = $xoopsDB -> fetchArray( $result );
$tags['CATEGORY_NAME'] = $row['title'];
$tags['CATEGORY_URL'] = XOOPS_URL . '/modules/' . $xoopsModule -> getVar( 'dirname' ) . '/viewcat.php?cid=' . $cid;
$notification_handler -> triggerEvent( 'global', 0, 'new_video', $tags );
$notification_handler -> triggerEvent( 'category', $cid, 'new_video', $tags );
$_message = _MD_XTUBE_ISAPPROVED;
}
else
{
$modifysubmitter = $xoopsUser -> uid();
$requestid = $modifysubmitter;
$requestdate = time();
$updated = xtube_cleanRequestVars( $_REQUEST, 'up_dated', time() );
$sql = "INSERT INTO " . $xoopsDB -> prefix( 'xoopstube_mod' ) . " (requestid, lid, cid, title, url, forumid, description, modifysubmitter, requestdate)";
$sql .= " VALUES ('', $lid, $cid, '$title', '$url', '$forumid', '$descriptionb', '$urlrating' '$modifysubmitter', '$requestdate')";
if ( !$result = $xoopsDB -> query( $sql ) )
{
$_error = $xoopsDB -> error() . " : " . $xoopsDB -> errno();
XoopsErrorHandler_HandleError( E_USER_WARNING, $_error, __FILE__, __LINE__ );
}
$tags = array();
$tags['MODIFYREPORTS_URL'] = XOOPS_URL . '/modules/' . $xoopsModule -> getVar( 'dirname' ) . '/admin/index.php?op=listModReq';
$notification_handler = &xoops_gethandler( 'notification' );
$notification_handler -> triggerEvent( 'global', 0, 'video_modify', $tags );
$tags['WAITINGFILES_URL'] = XOOPS_URL . '/modules/' . $xoopsModule -> getVar( 'dirname' ) . '/admin/index.php?op=listNewvideos';
$notification_handler -> triggerEvent( 'global', 0, 'video_submit', $tags );
$notification_handler -> triggerEvent( 'category', $cid, 'video_submit', $tags );
if ( $notifypub )
{
include_once XOOPS_ROOT_PATH . '/include/notification_constants.php';
$notification_handler -> subscribe( 'video', $newid, 'approve', XOOPS_NOTIFICATION_MODE_SENDONCETHENDELETE );
}
$_message = _MD_XTUBE_THANKSFORINFO;
}
redirect_header( "index.php", 2, $_message );
}
}
else
{
global $xoopsModuleConfig;
$approve = xtube_cleanRequestVars( $_REQUEST, 'approve', 0 );
/*
* Show disclaimer
*/
if ( $xoopsModuleConfig['showdisclaimer'] && !isset( $_GET['agree'] ) && $approve == 0 )
{
echo "<br /><div style='text-align: center;'>" . xtube_imageheader() . "</div><br />n";
echo "<h4>" . _MD_XTUBE_DISCLAIMERAGREEMENT . "</h4>n";
echo "<div>" . $xtubemyts -> displayTarea( $xoopsModuleConfig['disclaimer'], 1, 1, 1, 1, 1 ) . "</div>n";
echo "<form action='submit.php' method='post'>n";
echo "<div style='text-align: center;'>" . _MD_XTUBE_DOYOUAGREE . "</b><br /><br />n";
echo "<input type='button' onclick='location="submit.php?agree=1"' class='formButton' value='" . _MD_XTUBE_AGREE . "' alt='" . _MD_XTUBE_AGREE . "' />n";
echo " n";
echo "<input type='button' onclick='location="index.php"' class='formButton' value='" . _CANCEL . "' alt='" . _CANCEL . "' />n";
echo "</div></form>n";
include XOOPS_ROOT_PATH . '/footer.php';
exit();
}
echo "<br /><div style='text-align: center;'>" . xtube_imageheader() . "</div><br />n";
echo "<div>" . _MD_XTUBE_SUB_SNEWMNAMEDESC . "</div>n<br />n";
$sql = "SELECT * FROM " . $xoopsDB -> prefix( 'xoopstube_videos' ) . " WHERE lid=" . intval( $lid );
$video_array = $xoopsDB -> fetchArray( $xoopsDB -> query( $sql ) );
$lid = $video_array['lid'] ? $video_array['lid'] : 0;
$cid = $video_array['cid'] ? $video_array['cid'] : 0;
$title = $video_array['title'] ? $xtubemyts -> htmlSpecialCharsStrip( $video_array['title'] ) : '';
$url = $video_array['url'] ? $xtubemyts -> htmlSpecialCharsStrip( $video_array['url'] ) : '';
$publisher = $video_array['publisher'] ? $xtubemyts -> htmlSpecialCharsStrip( $video_array['publisher'] ) : '';
$screenshot = $video_array['screenshot'] ? $xtubemyts -> htmlSpecialCharsStrip( $video_array['screenshot'] ) : '';
$descriptionb = $video_array['description'] ? $xtubemyts -> htmlSpecialCharsStrip( $video_array['description'] ) : '';
$published = $video_array['published'] ? $video_array['published'] : 0;
$expired = $video_array['expired'] ? $video_array['expired'] : 0;
$updated = $video_array['updated'] ? $video_array['updated'] : 0;
$offline = $video_array['offline'] ? $video_array['offline'] : 0;
$forumid = $video_array['forumid'] ? $video_array['forumid'] : 0;
$ipaddress = $video_array['ipaddress'] ? $video_array['ipaddress'] : 0;
$notifypub = $video_array['notifypub'] ? $video_array['notifypub'] : 0;
$urlrating = $video_array['urlrating'] ? $video_array['urlrating'] : 1;
$time = $video_array['time'] ? $xtubemyts -> htmlSpecialCharsStrip( $video_array['time'] ) : '00:00';
$keywords = $video_array['keywords'] ? $xtubemyts -> htmlSpecialCharsStrip( $video_array['keywords'] ) : '';
$sform = new XoopsThemeForm( _MD_XTUBE_SUBMITCATHEAD, "storyform", xoops_getenv( 'PHP_SELF' ) );
$sform -> setExtra( 'enctype="multipart/form-data"' );
$sform -> addElement( new XoopsFormText( _MD_XTUBE_FILETITLE, 'title', 50, 255, $title ), true );
$sform -> addElement( new XoopsFormText( _MD_XTUBE_DLURL, 'url', 50, 255, $url ), true );
$mytree = new XoopsTree( $xoopsDB -> prefix( 'xoopstube_cat' ), 'cid', 'pid' );
$submitcats = array();
$sql = "SELECT * FROM " . $xoopsDB -> prefix( 'xoopstube_cat' ) . " ORDER BY title";
$result = $xoopsDB -> query( $sql );
while ( $myrow = $xoopsDB -> fetchArray( $result ) )
{
if ( true == checkgroups( $myrow['cid'], 'XTubeSubPerm' ) )
{
$submitcats[$myrow['cid']] = $myrow['title'];
}
}
$sform -> addElement( new XoopsFormText( _MD_XTUBE_TIME, 'time', 5, 5, $time ), false);
ob_start();
$mytree -> makeMySelBox( 'title', 'title', $cid, 0 );
$sform -> addElement( new XoopsFormLabel( _MD_XTUBE_CATEGORYC, ob_get_contents() ) );
ob_end_clean();
// Link description form
$editor=xtube_getWysiwygForm( _MD_XTUBE_DESCRIPTIONC, 'descriptionb', $descriptionb, 10, 50, '');
$sform->addElement($editor,false);
// $sform -> addElement( new XoopsFormDhtmlTextArea( _MD_XTUBE_DESCRIPTIONC, 'descriptionb', $descriptionb, 20, 70), true);
// Keywords
$sform -> addElement( new XoopsFormText( _MD_XTUBE_KEYWORDS, 'keywords', 70, 128, $keywords ), false);
$sform -> insertBreak( sprintf( _MD_XTUBE_KEYWORDS_NOTE ), "even" );
$option_tray = new XoopsFormElementTray( _MD_XTUBE_OPTIONS, '<br />' );
if ( !$approve )
{
$notify_checkbox = new XoopsFormCheckBox( '', 'notifypub' );
$notify_checkbox -> addOption( 1, _MD_XTUBE_NOTIFYAPPROVE );
$option_tray -> addElement( $notify_checkbox );
}
else
{
$sform -> addElement( new XoopsFormHidden( 'notifypub', 0 ) );
}
if ( true == checkgroups( $cid, 'XTubeAppPerm' ) && $lid > 0 )
{
$approve_checkbox = new XoopsFormCheckBox( '', 'approve', $approve );
$approve_checkbox -> addOption( 1, _MD_XTUBE_APPROVE );
$option_tray -> addElement( $approve_checkbox );
}
else if ( true == checkgroups( $cid, 'XTubeAutoApp' ) )
{
$sform -> addElement( new XoopsFormHidden( 'approve', 1 ) );
}
else
{
$sform -> addElement( new XoopsFormHidden( 'approve', 0 ) );
}
$sform -> addElement( $option_tray );
$button_tray = new XoopsFormElementTray( '', '' );
$button_tray -> addElement( new XoopsFormButton( '', 'submit', _SUBMIT, 'submit' ) );
$button_tray -> addElement( new XoopsFormHidden( 'lid', $lid ) );
$sform -> addElement( $button_tray );
$sform -> display();
include XOOPS_ROOT_PATH . '/footer.php';
}
}
else
{
redirect_header( 'index.php', 2, _MD_XTUBE_NOPERMISSIONTOPOST );
exit();
}
?>