|
From: <be...@us...> - 2013-06-17 01:23:28
|
Revision: 11704
http://sourceforge.net/p/xoops/svn/11704
Author: beckmi
Date: 2013-06-17 01:23:24 +0000 (Mon, 17 Jun 2013)
Log Message:
-----------
adding highlighter for non-empty alphabet listing
Modified Paths:
--------------
XoopsModules/xoopstube/trunk/xoopstube/include/functions.php
XoopsModules/xoopstube/trunk/xoopstube/xoops_version.php
XoopsModules/xoopstube/trunk/xoopstube/xtubestyle.css
Added Paths:
-----------
XoopsModules/xoopstube/trunk/xoopstube/images/icon/backgnd_green.png
Added: XoopsModules/xoopstube/trunk/xoopstube/images/icon/backgnd_green.png
===================================================================
(Binary files differ)
Index: XoopsModules/xoopstube/trunk/xoopstube/images/icon/backgnd_green.png
===================================================================
--- XoopsModules/xoopstube/trunk/xoopstube/images/icon/backgnd_green.png 2013-06-16 19:39:27 UTC (rev 11703)
+++ XoopsModules/xoopstube/trunk/xoopstube/images/icon/backgnd_green.png 2013-06-17 01:23:24 UTC (rev 11704)
Property changes on: XoopsModules/xoopstube/trunk/xoopstube/images/icon/backgnd_green.png
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
Modified: XoopsModules/xoopstube/trunk/xoopstube/include/functions.php
===================================================================
--- XoopsModules/xoopstube/trunk/xoopstube/include/functions.php 2013-06-16 19:39:27 UTC (rev 11703)
+++ XoopsModules/xoopstube/trunk/xoopstube/include/functions.php 2013-06-17 01:23:24 UTC (rev 11704)
@@ -5,13 +5,14 @@
*/
/**
- * wfs_gethandler()
+ * xtube_gethandler()
*
* @param $name
* @param boolean $optional
- * @return
+ * @return bool
*/
-function &xtube_gethandler($name, $optional = FALSE) {
+function &xtube_gethandler($name, $optional = false)
+{
global $handlers, $xoopsModule;
$name = strtolower(trim($name));
@@ -30,30 +31,33 @@
}
if (!isset($handlers[$name]) && !$optional) {
trigger_error(
- '<div>Class <b>' . $class . '</b> does not exist.</div>
- <div>Handler Name: ' . $name, E_USER_ERROR
+ '<div>Class <span style="font-weight: bold;">' . $class . '</span> does not exist.</div>
+ <div>Handler Name: ' . $name,
+ E_USER_ERROR
) . '</div>';
}
- return isset($handlers[$name]) ? $handlers[$name] : FALSE;
+ return isset($handlers[$name]) ? $handlers[$name] : false;
}
-function xtube_checkgroups($cid = 0, $permType = 'XTubeCatPerm', $redirect = FALSE) {
+function xtube_checkgroups($cid = 0, $permType = 'XTubeCatPerm', $redirect = false)
+{
global $xoopsUser, $xoopsModule;
$groups = is_object($xoopsUser) ? $xoopsUser->getGroups() : XOOPS_GROUP_ANONYMOUS;
- $gperm_handler = &xoops_gethandler('groupperm');
+ $gperm_handler = & xoops_gethandler('groupperm');
if (!$gperm_handler->checkRight($permType, $cid, $groups, $xoopsModule->getVar('mid'))) {
- if ($redirect == FALSE) {
- return FALSE;
+ if ($redirect == false) {
+ return false;
} else {
redirect_header('index.php', 3, _NOPERM);
exit();
}
}
- return TRUE;
+ return true;
}
-function xtube_getVoteDetails($lid = 0) {
+function xtube_getVoteDetails($lid = 0)
+{
global $xoopsDB;
$sql
@@ -72,14 +76,15 @@
$sql .= ' WHERE lid=' . $lid;
}
if (!$result = $xoopsDB->query($sql)) {
- return FALSE;
+ return false;
}
$ret = $xoopsDB->fetchArray($result);
return $ret;
}
-function xtube_calcVoteData($sel_id = 0) {
+function xtube_calcVoteData($sel_id = 0)
+{
$ret = array();
$ret['useravgrating'] = 0;
@@ -88,7 +93,7 @@
' WHERE lid=' . $sel_id;
}
if (!$result = $xoopsDB->query($sql)) {
- return FALSE;
+ return false;
}
$ret['uservotes'] = $xoopsDB->getRowsNum($result);
while (list($rating) = $xoopsDB->fetchRow($result)) {
@@ -100,23 +105,24 @@
return $ret;
}
-function xtube_cleanRequestVars(&$array, $name = NULL, $def = NULL, $strict = FALSE, $lengthcheck = 15) {
+function xtube_cleanRequestVars(&$array, $name = null, $def = null, $strict = false, $lengthcheck = 15)
+{
// Sanitise $_request for further use. This method gives more control and security.
// Method is more for functionality rather than beauty at the moment, will correct later.
unset($array['usercookie']);
unset($array['PHPSESSID']);
- if (is_array($array) && $name == NULL) {
+ if (is_array($array) && $name == null) {
$globals = array();
foreach (array_keys($array) as $k) {
$value = strip_tags(trim($array[$k]));
if (strlen($value >= $lengthcheck)) {
- return NULL;
+ return null;
}
if (ctype_digit($value)) {
$value = intval($value);
} else {
- if ($strict == TRUE) {
+ if ($strict == true) {
$value = preg_replace('/\W/', '', trim($value));
}
$value = strtolower(strval($value));
@@ -133,7 +139,7 @@
if (ctype_digit($value)) {
$value = intval($value);
} else {
- if ($strict == TRUE) {
+ if ($strict == true) {
$value = preg_replace('/\W/', '', trim($value));
}
$value = strtolower(strval($value));
@@ -141,18 +147,20 @@
return $value;
}
-function xtube_toolbar($cid = 0) {
+function xtube_toolbar($cid = 0)
+{
$toolbar = '[ ';
- if (TRUE == xtube_checkgroups($cid, 'XTubeSubPerm')) {
+ if (true == xtube_checkgroups($cid, 'XTubeSubPerm')) {
$toolbar .= '<a href="submit.php?cid=' . $cid . '">' . _MD_XTUBE_SUBMITVIDEO . '</a> | ';
}
$toolbar
.= '<a href="newlist.php?newvideoshowdays=7">' . _MD_XTUBE_LATESTLIST . '</a> | <a href="topten.php?list=hit">'
- . _MD_XTUBE_POPULARITY . '</a> | <a href="topten.php?list=rate">' . _MD_XTUBE_TOPRATED . '</a> ]';
+ . _MD_XTUBE_POPULARITY . '</a> | <a href="topten.php?list=rate">' . _MD_XTUBE_TOPRATED . '</a> ]';
return $toolbar;
}
-function xtube_serverstats() {
+function xtube_serverstats()
+{
global $xoopsModule;
echo '<fieldset style="border: #E8E8E8 1px solid;">
<legend style="display: inline; font-weight: bold; color: #0A3760;">' . _AM_XTUBE_VIDEO_IMAGEINFO . '</legend>
@@ -168,7 +176,7 @@
$gdlib = (function_exists('gd_info')) ? _AM_XTUBE_VIDEO_GDON : _AM_XTUBE_VIDEO_GDOFF;
echo '<li>' . _AM_XTUBE_VIDEO_GDLIBSTATUS . $gdlib;
if (function_exists('gd_info')) {
- if (TRUE == $gdlib = gd_info()) {
+ if (true == $gdlib = gd_info()) {
echo '<li>' . _AM_XTUBE_VIDEO_GDLIBVERSION . '<b>' . $gdlib['GD Version'] . '</b>';
}
}
@@ -186,7 +194,8 @@
// @param integer $status
// @param integer $counter
// @return
-function xtube_displayicons($time, $status = 0, $counter = 0) {
+function xtube_displayicons($time, $status = 0, $counter = 0)
+{
global $xoopsModuleConfig, $xoopsModule;
$new = '';
@@ -200,20 +209,22 @@
if (intval($status) > 1) {
if ($xoopsModuleConfig['displayicons'] == 1) {
$new
- = ' <img src="' . XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname')
- . '/images/icon/updated.gif" alt="" style="vertical-align: middle;" />';
+ = ' <img src="' . XOOPS_URL . '/modules/' . $xoopsModule->getVar(
+ 'dirname'
+ ) . '/images/icon/updated.gif" alt="" style="vertical-align: middle;" />';
}
if ($xoopsModuleConfig['displayicons'] == 2) {
- $new = '<i>' . _MD_XTUBE_UPDATED . '</i>';
+ $new = '<em>' . _MD_XTUBE_UPDATED . '</em>';
}
} else {
if ($xoopsModuleConfig['displayicons'] == 1) {
$new
- = ' <img src="' . XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname')
- . '/images/icon/new.gif" alt="" style="vertical-align: middle;" />';
+ = ' <img src="' . XOOPS_URL . '/modules/' . $xoopsModule->getVar(
+ 'dirname'
+ ) . '/images/icon/new.gif" alt="" style="vertical-align: middle;" />';
}
if ($xoopsModuleConfig['displayicons'] == 2) {
- $new = '<i>' . _MD_XTUBE_NEW . '</i>';
+ $new = '<em>' . _MD_XTUBE_NEW . '</em>';
}
}
}
@@ -221,11 +232,12 @@
if ($counter >= $xoopsModuleConfig['popular']) {
if ($xoopsModuleConfig['displayicons'] == 1) {
$pop
- = ' <img src="' . XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname')
- . '/images/icon/popular.png" alt="" style="vertical-align: middle;" />';
+ = ' <img src="' . XOOPS_URL . '/modules/' . $xoopsModule->getVar(
+ 'dirname'
+ ) . '/images/icon/popular.png" alt="" style="vertical-align: middle;" />';
}
if ($xoopsModuleConfig['displayicons'] == 2) {
- $pop = '<i>' . _MD_XTUBE_POPULAR . '!</i>';
+ $pop = '<em>' . _MD_XTUBE_POPULAR . '!</em>';
}
}
}
@@ -239,112 +251,115 @@
// xtube_convertorderbyin()
// @param $orderby
// @return
- function xtube_convertorderbyin($orderby) {
+ function xtube_convertorderbyin($orderby)
+ {
switch (trim($orderby)) {
- case 'titleA':
- $orderby = 'title ASC';
- break;
- case 'dateA':
- $orderby = 'published ASC';
- break;
- case 'hitsA':
- $orderby = 'hits ASC';
- break;
- case 'ratingA':
- $orderby = 'rating ASC';
- break;
- case 'countryA':
- $orderby = 'country ASC';
- break;
- case 'titleD':
- $orderby = 'title DESC';
- break;
- case 'hitsD':
- $orderby = 'hits DESC';
- break;
- case 'ratingD':
- $orderby = 'rating DESC';
- break;
- case'dateD':
- $orderby = 'published DESC';
- break;
- case 'countryD':
- $orderby = 'country DESC';
- break;
+ case 'titleA':
+ $orderby = 'title ASC';
+ break;
+ case 'dateA':
+ $orderby = 'published ASC';
+ break;
+ case 'hitsA':
+ $orderby = 'hits ASC';
+ break;
+ case 'ratingA':
+ $orderby = 'rating ASC';
+ break;
+ case 'countryA':
+ $orderby = 'country ASC';
+ break;
+ case 'titleD':
+ $orderby = 'title DESC';
+ break;
+ case 'hitsD':
+ $orderby = 'hits DESC';
+ break;
+ case 'ratingD':
+ $orderby = 'rating DESC';
+ break;
+ case'dateD':
+ $orderby = 'published DESC';
+ break;
+ case 'countryD':
+ $orderby = 'country DESC';
+ break;
}
return $orderby;
}
}
if (!function_exists('xtube_convertorderbytrans')) {
- function xtube_convertorderbytrans($orderby) {
+ function xtube_convertorderbytrans($orderby)
+ {
switch ($orderby) {
- case 'hits ASC':
- $orderbyTrans = _MD_XTUBE_POPULARITYLTOM;
- break;
- case 'hits DESC':
- $orderbyTrans = _MD_XTUBE_POPULARITYMTOL;
- break;
- case 'title ASC':
- $orderbyTrans = _MD_XTUBE_TITLEATOZ;
- break;
- case 'title DESC':
- $orderbyTrans = _MD_XTUBE_TITLEZTOA;
- break;
- case 'published ASC':
- $orderbyTrans = _MD_XTUBE_DATEOLD;
- break;
- case 'published DESC':
- $orderbyTrans = _MD_XTUBE_DATENEW;
- break;
- case 'rating ASC':
- $orderbyTrans = _MD_XTUBE_RATINGLTOH;
- break;
- case 'rating DESC':
- $orderbyTrans = _MD_XTUBE_RATINGHTOL;
- break;
- case'country ASC':
- $orderbyTrans = _MD_XTUBE_COUNTRYLTOH;
- break;
- case 'country DESC':
- $orderbyTrans = _MD_XTUBE_COUNTRYHTOL;
- break;
+ case 'hits ASC':
+ $orderbyTrans = _MD_XTUBE_POPULARITYLTOM;
+ break;
+ case 'hits DESC':
+ $orderbyTrans = _MD_XTUBE_POPULARITYMTOL;
+ break;
+ case 'title ASC':
+ $orderbyTrans = _MD_XTUBE_TITLEATOZ;
+ break;
+ case 'title DESC':
+ $orderbyTrans = _MD_XTUBE_TITLEZTOA;
+ break;
+ case 'published ASC':
+ $orderbyTrans = _MD_XTUBE_DATEOLD;
+ break;
+ case 'published DESC':
+ $orderbyTrans = _MD_XTUBE_DATENEW;
+ break;
+ case 'rating ASC':
+ $orderbyTrans = _MD_XTUBE_RATINGLTOH;
+ break;
+ case 'rating DESC':
+ $orderbyTrans = _MD_XTUBE_RATINGHTOL;
+ break;
+ case'country ASC':
+ $orderbyTrans = _MD_XTUBE_COUNTRYLTOH;
+ break;
+ case 'country DESC':
+ $orderbyTrans = _MD_XTUBE_COUNTRYHTOL;
+ break;
}
return $orderbyTrans;
}
}
if (!function_exists('xtube_convertorderbyout')) {
- function xtube_convertorderbyout($orderby) {
+ function xtube_convertorderbyout($orderby)
+ {
switch ($orderby) {
- case 'title ASC':
- $orderby = 'titleA';
- break;
- case 'published ASC':
- $orderby = 'dateA';
- break;
- case 'hits ASC':
- $orderby = 'hitsA';
- break;
- case 'rating ASC':
- $orderby = 'ratingA';
- break;
- case 'country ASC':
- $orderby = 'countryA';
- break;
- case 'title DESC':
- $orderby = 'titleD';
- break;
- case 'published DESC':
- $orderby = 'dateD';
- break;
- case 'hits DESC':
- $orderby = 'hitsD';
- break;
- case 'rating DESC':
- $orderby = 'ratingD';
- break;
- case 'country DESC':
- $orderby = 'countryD';
- break;
+ case 'title ASC':
+ $orderby = 'titleA';
+ break;
+ case 'published ASC':
+ $orderby = 'dateA';
+ break;
+ case 'hits ASC':
+ $orderby = 'hitsA';
+ break;
+ case 'rating ASC':
+ $orderby = 'ratingA';
+ break;
+ case 'country ASC':
+ $orderby = 'countryA';
+ break;
+ case 'title DESC':
+ $orderby = 'titleD';
+ break;
+ case 'published DESC':
+ $orderby = 'dateD';
+ break;
+ case 'hits DESC':
+ $orderby = 'hitsD';
+ break;
+ case 'rating DESC':
+ $orderby = 'ratingD';
+ break;
+ case 'country DESC':
+ $orderby = 'countryD';
+ break;
}
return $orderby;
}
@@ -353,7 +368,8 @@
// updaterating()
// @param $sel_id
// @return updates rating data in itemtable for a given item
-function xtube_updaterating($sel_id) {
+function xtube_updaterating($sel_id)
+{
global $xoopsDB;
$query = 'SELECT rating FROM ' . $xoopsDB->prefix('xoopstube_votedata') . ' WHERE lid=' . $sel_id;
$voteresult = $xoopsDB->query($query);
@@ -364,14 +380,21 @@
}
$finalrating = $totalrating / $votesDB;
$finalrating = number_format($finalrating, 4);
- $sql = sprintf('UPDATE %s SET rating = %u, votes = %u WHERE lid = %u', $xoopsDB->prefix('xoopstube_videos'), $finalrating, $votesDB, $sel_id);
+ $sql = sprintf(
+ 'UPDATE %s SET rating = %u, votes = %u WHERE lid = %u',
+ $xoopsDB->prefix('xoopstube_videos'),
+ $finalrating,
+ $votesDB,
+ $sel_id
+ );
$xoopsDB->query($sql);
}
// totalcategory()
// @param integer $pid
// @return
-function xtube_totalcategory($pid = 0) {
+function xtube_totalcategory($pid = 0)
+{
global $xoopsDB;
$sql = 'SELECT cid FROM ' . $xoopsDB->prefix('xoopstube_cat');
@@ -393,19 +416,20 @@
// @param integer $get_child
// @param integer $return_sql
// @return
-function xtube_getTotalItems($sel_id = 0, $get_child = 0, $return_sql = 0) {
+function xtube_getTotalItems($sel_id = 0, $get_child = 0, $return_sql = 0)
+{
global $xoopsDB, $mytree, $_check_array;
if ($sel_id > 0) {
$sql = 'SELECT a.lid, a.cid, a.published FROM ' . $xoopsDB->prefix('xoopstube_videos') . ' a LEFT JOIN '
- . $xoopsDB->prefix('xoopstube_altcat') . ' b' . ' ON b.lid=a.lid'
- . ' WHERE a.published > 0 AND a.published <= ' . time() . ' AND (a.expired = 0 OR a.expired > ' . time()
- . ') AND offline = 0 ' . ' AND (b.cid=a.cid OR (a.cid=' . $sel_id . ' OR b.cid=' . $sel_id . '))'
- . ' GROUP BY a.lid, a.cid, a.published';
+ . $xoopsDB->prefix('xoopstube_altcat') . ' b' . ' ON b.lid=a.lid'
+ . ' WHERE a.published > 0 AND a.published <= ' . time() . ' AND (a.expired = 0 OR a.expired > ' . time()
+ . ') AND offline = 0 ' . ' AND (b.cid=a.cid OR (a.cid=' . $sel_id . ' OR b.cid=' . $sel_id
+ . '))' . ' GROUP BY a.lid, a.cid, a.published';
} else {
$sql = 'SELECT lid, cid, published FROM ' . $xoopsDB->prefix('xoopstube_videos')
- . ' WHERE offline = 0 AND published > 0 AND published <= ' . time() . ' AND (expired = 0 OR expired > '
- . time() . ')';
+ . ' WHERE offline = 0 AND published > 0 AND published <= ' . time() . ' AND (expired = 0 OR expired > '
+ . time() . ')';
}
if ($return_sql == 1) {
return $sql;
@@ -417,7 +441,7 @@
$arr = array();
$result = $xoopsDB->query($sql);
while (list($lid, $cid, $published) = $xoopsDB->fetchRow($result)) {
- if (TRUE == xtube_checkgroups()) {
+ if (true == xtube_checkgroups()) {
$count++;
$published_date = ($published > $published_date) ? $published : $published_date;
}
@@ -429,10 +453,10 @@
$size = count($arr);
for ($i = 0; $i < count($arr); $i++) {
$query2 = 'SELECT a.lid, a.published, a.cid FROM ' . $xoopsDB->prefix('xoopstube_videos') . ' a LEFT JOIN '
- . $xoopsDB->prefix('xoopstube_altcat') . ' b' . ' ON b.lid = a.lid'
- . ' WHERE a.published > 0 AND a.published <= ' . time() . ' AND (a.expired = 0 OR a.expired > ' . time()
- . ') AND offline = 0' . ' AND (b.cid=a.cid OR (a.cid=' . $arr[$i] . ' OR b.cid=' . $arr[$i]
- . ')) GROUP BY a.lid, a.published, a.cid';
+ . $xoopsDB->prefix('xoopstube_altcat') . ' b' . ' ON b.lid = a.lid'
+ . ' WHERE a.published > 0 AND a.published <= ' . time() . ' AND (a.expired = 0 OR a.expired > '
+ . time() . ') AND offline = 0' . ' AND (b.cid=a.cid OR (a.cid=' . $arr[$i] . ' OR b.cid='
+ . $arr[$i] . ')) GROUP BY a.lid, a.published, a.cid';
$result2 = $xoopsDB->query($query2);
while (list($lid, $published) = $xoopsDB->fetchRow($result2)) {
@@ -449,7 +473,8 @@
return $info;
}
-function xtube_imageheader($indeximage = '', $indexheading = '') {
+function xtube_imageheader($indeximage = '', $indexheading = '')
+{
global $xoopsDB, $xoopsModuleConfig;
if ($indeximage == '') {
$result = $xoopsDB->query('SELECT indeximage, indexheading FROM ' . $xoopsDB->prefix('xoopstube_indexpage'));
@@ -463,7 +488,8 @@
return $image;
}
-function xtube_displayimage($image = '', $path = '', $imgsource = '', $alttext = '') {
+function xtube_displayimage($image = '', $path = '', $imgsource = '', $alttext = '')
+{
global $xoopsConfig, $xoopsUser, $xoopsModule;
$showimage = '';
@@ -475,33 +501,50 @@
if (!is_dir(XOOPS_ROOT_PATH . "/{$imgsource}/{$image}") && file_exists(XOOPS_ROOT_PATH . "/{$imgsource}/{$image}")
) {
$showimage
- .= "<img src='" . XOOPS_URL . "/{$imgsource}/{$image}' border='0' title='" . $alttext . "' alt='" . $alttext
- . "' /></a>";
+ .= "<img src='" . XOOPS_URL . "/{$imgsource}/{$image}' border='0' title='" . $alttext . "' alt='"
+ . $alttext . "' /></a>";
} else {
if ($xoopsUser && $xoopsUser->isAdmin($xoopsModule->getVar('mid'))) {
$showimage .= '<img src="' . XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname')
- . '/images/brokenimg.png" alt="' . _MD_XTUBE_ISADMINNOTICE . '" /></a>';
+ . '/images/brokenimg.png" alt="' . _MD_XTUBE_ISADMINNOTICE . '" /></a>';
} else {
$showimage
.= '<img src="' . XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/images/blank.png" alt="'
- . $alttext . '" /></a>';
+ . $alttext . '" /></a>';
}
}
clearstatcache();
return $showimage;
}
-function xoopstube_letters() {
- global $xoopsModule;
+function xoopstube_letters()
+{
+ global $xoopsModule, $xoopsDB;
$letterchoice = '<div>' . _MD_XTUBE_BROWSETOTOPIC . '</div>';
- $alphabet = xoopstube_alfabet();
- $num = count($alphabet) - 1;
- $counter = 0;
+ $alphabet = xoopstube_alfabet();
+ $num = count($alphabet) - 1;
+ $counter = 0;
+ $distinctDbLetters_arr = array();
+ $sql = 'SELECT DISTINCT (UPPER(LEFT(title, 1))) AS letter FROM ' . $xoopsDB->prefix('xoopstube_videos') ;
+ if ($result = $xoopsDB->query($sql)) {
+ while ($row = $xoopsDB->fetchArray($result)) {
+ $distinctDbLetters_arr[] = $row['letter'];
+ }
+ }
+ unset($sql);
+
while (list(, $ltr) = each($alphabet)) {
- $letterchoice
- .= '<a class="xoopstube_letters" href="' . XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname')
- . '/viewcat.php?list=' . $ltr . '">' . $ltr . '</a>';
+
+ if (in_array($ltr, $distinctDbLetters_arr)) {
+ $letterchoice
+ .= '<a class="xoopstube_letters xoopstube_letters_green" href="';
+ } else {
+ $letterchoice
+ .= '<a class="xoopstube_letters" href="';
+ }
+ $letterchoice .= XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/viewcat.php?list=' . $ltr . '">'
+ . $ltr . '</a>';
if ($counter == round($num / 2)) {
$letterchoice .= '<br />';
} elseif ($counter != $num) {
@@ -512,7 +555,8 @@
return $letterchoice;
}
-function xtube_isnewimage($published) {
+function xtube_isnewimage($published)
+{
global $xoopsModule, $xoopsDB;
$oneday = (time() - (86400 * 1));
@@ -540,11 +584,13 @@
return $indicator;
}
-function xtube_strrrchr($haystack, $needle) {
+function xtube_strrrchr($haystack, $needle)
+{
return substr($haystack, 0, strpos($haystack, $needle) + 1);
}
-function xtube_adminmenu($header = '', $menu = '', $extra = '', $scount = 4) {
+function xtube_adminmenu($header = '', $menu = '', $extra = '', $scount = 4)
+{
global $xoopsConfig, $xoopsModule, $xoopsModuleConfig;
$_named_vidid = xoops_getenv('PHP_SELF');
@@ -565,7 +611,7 @@
</span>
<span style="margin: 1px; padding: 4px; border: #E8E8E8 1px solid;">
<a href="../../system/admin.php?fct=preferences&op=showmod&mod=' . $xoopsModule->getVar('mid') . '">'
- . _AM_XTUBE_PREFS . '</a>
+ . _AM_XTUBE_PREFS . '</a>
</span>
<span style="margin: 1px; padding: 4px; border: #E8E8E8 1px solid;">
<a href="../admin/permissions.php">' . _AM_XTUBE_BPERMISSIONS . '</a>
@@ -575,7 +621,7 @@
</span>
<span style="margin: 1px; padding: 4px; border: #E8E8E8 1px solid;">
<a href="../../system/admin.php?fct=modulesadmin&op=update&module=' . $xoopsModule->getVar('dirname') . '">'
- . _AM_XTUBE_BUPDATE . '</a>
+ . _AM_XTUBE_BUPDATE . '</a>
</span>
<span style="margin: 1px; padding: 4px; border: #E8E8E8 1px solid;">
<a href="../admin/about.php">' . _AM_XTUBE_ABOUT . '</a>
@@ -585,22 +631,22 @@
if (empty($menu)) {
// You can change this part to suit your own module. Defining this here will save you form having to do this each time.
$menu = array(
- _AM_XTUBE_MVIDEOS => 'main.php?op=edit',
- _AM_XTUBE_MCATEGORY => 'category.php',
- _AM_XTUBE_INDEXPAGE => 'indexpage.php',
+ _AM_XTUBE_MVIDEOS => 'main.php?op=edit',
+ _AM_XTUBE_MCATEGORY => 'category.php',
+ _AM_XTUBE_INDEXPAGE => 'indexpage.php',
// _AM_XTUBE_MXOOPSTUBE => 'main.php?op=edit',
- _AM_XTUBE_MUPLOADS => 'upload.php',
- _AM_XTUBE_VUPLOADS => 'vupload.php',
- _AM_XTUBE_MVOTEDATA => 'votedata.php',
- _AM_XTUBE_MCOMMENTS => '../../system/admin.php?module=' . $xoopsModule->getVar('mid')
- . '&status=0&limit=100&fct=comments&selsubmit=Go'
+ _AM_XTUBE_MUPLOADS => 'upload.php',
+ _AM_XTUBE_VUPLOADS => 'vupload.php',
+ _AM_XTUBE_MVOTEDATA => 'votedata.php',
+ _AM_XTUBE_MCOMMENTS => '../../system/admin.php?module=' . $xoopsModule->getVar('mid')
+ . '&status=0&limit=100&fct=comments&selsubmit=Go'
);
}
if (!is_array($menu)) {
echo '<table width="100%" cellpadding="2" cellspacing="1" class="outer">';
echo '<tr><td class="even" align="center"><b>' . _AM_XTUBE_NOMENUITEMS . '</b></td></tr></table><br />';
- return FALSE;
+ return false;
}
$oddnum = array(
@@ -620,7 +666,7 @@
$rowcount = $menurow / ceil($menurows);
$count = 0;
for ($i = count($menu); $i < $menurow; $i++) {
- $tempArray = array(1 => NULL);
+ $tempArray = array(1 => null);
$menu = array_merge($menu, $tempArray);
$count++;
}
@@ -657,10 +703,10 @@
if ($thispage . $op == $menuvideo) {
$classcol[$count] = 'outer';
}
- echo'<td class="' . $classcol[$count]
- . '" style="padding: 4px; text-align: center;" valign="middle" width="' . $width . '%">';
+ echo '<td class="' . $classcol[$count]
+ . '" style="padding: 4px; text-align: center;" valign="middle" width="' . $width . '%">';
if (is_string($menuvideo)) {
- echo '<a href="' . $menuvideo . '"><small>' . $menutitle . '</small></a></td>';
+ echo '<a href="' . $menuvideo . '"><span style="font-size: small;">' . $menutitle . '</span></a></td>';
} else {
echo ' </td>';
}
@@ -680,7 +726,8 @@
if (is_dir(XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/update/')) {
xoops_error(
sprintf(
- _AM_XTUBE_WARNINSTALL1, XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/update/'
+ _AM_XTUBE_WARNINSTALL1,
+ XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/update/'
)
);
echo '<br />';
@@ -690,7 +737,8 @@
if (file_exists($_file)) {
xoops_error(
sprintf(
- _AM_XTUBE_WARNINSTALL2, XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/update.php'
+ _AM_XTUBE_WARNINSTALL2,
+ XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/update.php'
)
);
echo '<br />';
@@ -769,7 +817,8 @@
}
}
-function xtube_getDirSelectOption($selected, $dirarray, $namearray) {
+function xtube_getDirSelectOption($selected, $dirarray, $namearray)
+{
echo "<select size='1' name='workd' onchange='location.href=\"upload.php?rootpath=\"+this.options[this.selectedIndex].value'>";
echo "<option value=''>--------------------------------------</option>";
foreach ($namearray as $namearray => $workd) {
@@ -783,7 +832,8 @@
echo '</select>';
}
-function xtube_VgetDirSelectOption($selected, $dirarray, $namearray) {
+function xtube_VgetDirSelectOption($selected, $dirarray, $namearray)
+{
echo "<select size='1' name='workd' onchange='location.href=\"vupload.php?rootpath=\"+this.options[this.selectedIndex].value'>";
echo "<option value=''>--------------------------------------</option>";
foreach ($namearray as $namearray => $workd) {
@@ -798,7 +848,12 @@
}
function xtube_uploading(
- $FILES, $uploaddir = 'uploads', $allowed_mimetypes = '', $redirecturl = 'index.php', $num = 0, $redirect = 0,
+ $FILES,
+ $uploaddir = 'uploads',
+ $allowed_mimetypes = '',
+ $redirecturl = 'index.php',
+ $num = 0,
+ $redirect = 0,
$usertype = 1
) {
global $FILES, $xoopsConfig, $xoopsModuleConfig, $xoopsModule;
@@ -839,7 +894,8 @@
}
}
-function xtube_categorylistheader($heading) {
+function xtube_categorylistheader($heading)
+{
echo '
<h4 style="font-weight: bold; color: #0A3760;">' . $heading . '</h4>
<table width="100%" cellspacing="1" class="outer" summary>
@@ -857,14 +913,15 @@
';
}
-function xtube_categorylistbody($published) {
+function xtube_categorylistbody($published)
+{
global $xtubemyts, $imagearray, $xoopsModuleConfig;
$lid = $published['lid'];
$cid = $published['cid'];
$title = '<a href="../singlevideo.php?cid=' . $published['cid'] . '&lid=' . $published['lid'] . '">'
- . $xtubemyts->htmlSpecialCharsStrip(trim($published['title'])) . '</a>';
+ . $xtubemyts->htmlSpecialCharsStrip(trim($published['title'])) . '</a>';
$maintitle = urlencode($xtubemyts->htmlSpecialChars(trim($published['title'])));
$cattitle
=
@@ -872,9 +929,12 @@
$submitter = xoopstube_getLinkedUnameFromId($published['submitter']);
$returnsource = xtube_returnsource($published['vidsource']);
$submitted = xoopstube_time(formatTimestamp($published['date'], $xoopsModuleConfig['dateformatadmin']));
- $publish = ($published['published']
- > 0) ? xoopstube_time(formatTimestamp($published['published'], $xoopsModuleConfig['dateformatadmin'])) : 'Not Published';
- $expires = $published['expired'] ? xoopstube_time(formatTimestamp($published['expired'], $xoopsModuleConfig['dateformatadmin'])) : _AM_XTUBE_MINDEX_NOTSET;
+ $publish = ($published['published'] > 0) ? xoopstube_time(
+ formatTimestamp($published['published'], $xoopsModuleConfig['dateformatadmin'])
+ ) : 'Not Published';
+ $expires = $published['expired'] ? xoopstube_time(
+ formatTimestamp($published['expired'], $xoopsModuleConfig['dateformatadmin'])
+ ) : _AM_XTUBE_MINDEX_NOTSET;
if ((($published['expired'] && $published['expired'] > time()) OR $published['expired'] == 0)
&& ($published['published'] && $published['published'] < time())
@@ -890,19 +950,19 @@
if ($published['vidsource'] == 200) {
$icon = '<a href="main.php?op=edit&lid=' . $lid . '" title="' . _AM_XTUBE_ICO_EDIT . '">'
- . $imagearray['editimg'] . '</a> ';
+ . $imagearray['editimg'] . '</a> ';
} else {
$icon = '<a href="main.php?op=edit&lid=' . $lid . '" title="' . _AM_XTUBE_ICO_EDIT . '">'
- . $imagearray['editimg'] . '</a> ';
+ . $imagearray['editimg'] . '</a> ';
}
$icon .= '<a href="main.php?op=delete&lid=' . $lid . '" title="' . _AM_XTUBE_ICO_DELETE . '">'
- . $imagearray['deleteimg'] . '</a> ';
+ . $imagearray['deleteimg'] . '</a> ';
$icon .= '<a href="altcat.php?op=main&cid=' . $cid . '&lid=' . $lid . '&title=' . $published['title']
- . '" title="' . _AM_XTUBE_ALTCAT_CREATEF . '">' . $imagearray['altcat'] . '</a>';
+ . '" title="' . _AM_XTUBE_ALTCAT_CREATEF . '">' . $imagearray['altcat'] . '</a>';
echo '
<tr style="text-align: center; font-size: smaller;">
- <td class="head">' . $lid . '</small></td>
+ <td class="head">' . $lid . '</span></td>
<td class="even" style="text-align: left;">' . $title . '</td>
<td class="even">' . $returnsource . '</td>
<td class="even">' . $cattitle . '</td>
@@ -916,11 +976,12 @@
}
-function xtube_categorylistpagenav($pubrowamount, $start, $art = 'art', $_this = '', $align) {
+function xtube_categorylistpagenav($pubrowamount, $start, $art = 'art', $_this = '', $align)
+{
global $xoopsModuleConfig;
if (($pubrowamount < $xoopsModuleConfig['admin_perpage'])) {
- return FALSE;
+ return false;
}
// Display Page Nav if published is > total display pages amount.
include_once XOOPS_ROOT_PATH . '/class/pagenav.php';
@@ -928,13 +989,15 @@
echo '<div style="text-align: ' . $align . '; padding: 8px;">' . $pagenav->renderNav() . '</div>';
}
-function xtube_categorylistfooter() {
+function xtube_categorylistfooter()
+{
echo '<tr style="text-align: center;">
<td class="head" colspan="7">' . _AM_XTUBE_MINDEX_NOVIDEOSFOUND . '</td>
</tr>';
}
-function xtube_videolistheader($heading) {
+function xtube_videolistheader($heading)
+{
echo '
<h4 style="font-weight: bold; color: #0A3760;">' . $heading . '</h4>
<table width="100%" cellspacing="1" class="outer" summary>
@@ -952,14 +1015,15 @@
';
}
-function xtube_videolistbody($published) {
+function xtube_videolistbody($published)
+{
global $xtubemyts, $imagearray, $xoopsModuleConfig;
$lid = $published['lid'];
$cid = $published['cid'];
$title = '<a href="../singlevideo.php?cid=' . $published['cid'] . '&lid=' . $published['lid'] . '">'
- . $xtubemyts->htmlSpecialCharsStrip(trim($published['title'])) . '</a>';
+ . $xtubemyts->htmlSpecialCharsStrip(trim($published['title'])) . '</a>';
$maintitle = urlencode($xtubemyts->htmlSpecialChars(trim($published['title'])));
$cattitle
=
@@ -967,9 +1031,12 @@
$submitter = xoopstube_getLinkedUnameFromId($published['submitter']);
$returnsource = xtube_returnsource($published['vidsource']);
$submitted = xoopstube_time(formatTimestamp($published['date'], $xoopsModuleConfig['dateformatadmin']));
- $publish = ($published['published']
- > 0) ? xoopstube_time(formatTimestamp($published['published'], $xoopsModuleConfig['dateformatadmin'])) : 'Not Published';
- $expires = $published['expired'] ? xoopstube_time(formatTimestamp($published['expired'], $xoopsModuleConfig['dateformatadmin'])) : _AM_XTUBE_MINDEX_NOTSET;
+ $publish = ($published['published'] > 0) ? xoopstube_time(
+ formatTimestamp($published['published'], $xoopsModuleConfig['dateformatadmin'])
+ ) : 'Not Published';
+ $expires = $published['expired'] ? xoopstube_time(
+ formatTimestamp($published['expired'], $xoopsModuleConfig['dateformatadmin'])
+ ) : _AM_XTUBE_MINDEX_NOTSET;
if ((($published['expired'] && $published['expired'] > time()) OR $published['expired'] == 0)
&& ($published['published'] && $published['published'] < time())
@@ -985,19 +1052,19 @@
if ($published['vidsource'] == 200) {
$icon = '<a href="main.php?op=edit&lid=' . $lid . '" title="' . _AM_XTUBE_ICO_EDIT . '">'
- . $imagearray['editimg'] . '</a> ';
+ . $imagearray['editimg'] . '</a> ';
} else {
$icon = '<a href="main.php?op=edit&lid=' . $lid . '" title="' . _AM_XTUBE_ICO_EDIT . '">'
- . $imagearray['editimg'] . '</a> ';
+ . $imagearray['editimg'] . '</a> ';
}
$icon .= '<a href="main.php?op=delete&lid=' . $lid . '" title="' . _AM_XTUBE_ICO_DELETE . '">'
- . $imagearray['deleteimg'] . '</a> ';
+ . $imagearray['deleteimg'] . '</a> ';
$icon .= '<a href="altcat.php?op=main&cid=' . $cid . '&lid=' . $lid . '&title=' . $published['title']
- . '" title="' . _AM_XTUBE_ALTCAT_CREATEF . '">' . $imagearray['altcat'] . '</a>';
+ . '" title="' . _AM_XTUBE_ALTCAT_CREATEF . '">' . $imagearray['altcat'] . '</a>';
echo '
<tr style="text-align: center; font-size: smaller;">
- <td class="head">' . $lid . '</small></td>
+ <td class="head">' . $lid . '</span></td>
<td class="even" style="text-align: left;">' . $title . '</td>
<td class="even">' . $returnsource . '</td>
<td class="even">' . $cattitle . '</td>
@@ -1010,7 +1077,8 @@
unset($published);
}
-function xtube_cattitle($catt) {
+function xtube_cattitle($catt)
+{
global $xoopsDB;
$sql = 'SELECT title FROM ' . $xoopsDB->prefix('xoopstube_cat') . ' WHERE cid=' . $catt;
$result = $xoopsDB->query($sql);
@@ -1018,17 +1086,19 @@
return $result['title'];
}
-function xtube_videolistfooter() {
+function xtube_videolistfooter()
+{
echo '<tr style="text-align: center;">
<td class="head" colspan="7">' . _AM_XTUBE_MINDEX_NOVIDEOSFOUND . '</td>
</tr>';
}
-function xtube_videolistpagenav($pubrowamount, $start, $art = 'art', $_this = '', $align) {
+function xtube_videolistpagenav($pubrowamount, $start, $art = 'art', $_this = '', $align)
+{
global $xoopsModuleConfig;
if (($pubrowamount < $xoopsModuleConfig['admin_perpage'])) {
- return FALSE;
+ return false;
}
// Display Page Nav if published is > total display pages amount.
include_once XOOPS_ROOT_PATH . '/class/pagenav.php';
@@ -1036,173 +1106,9 @@
echo '<div style="text-align: ' . $align . '; padding: 8px;">' . $pagenav->renderNav() . '</div>';
}
-// Code for retreiving an editor is based on code from Hervet
-function &xtube_getWysiwygForm($caption, $name, $value) {
- global $xoopsModuleConfig, $xoopsUser, $xoopsModule;
- $xoops22 = FALSE;
- $xv = str_replace('XOOPS ', '', XOOPS_VERSION);
- if (substr($xv, 2, 1) == '2') {
- $xoops22 = TRUE;
- }
-
- $isadmin = (
- (is_object($xoopsUser) && !empty($xoopsUser)) && $xoopsUser->isAdmin($xoopsModule->mid())) ? TRUE : FALSE;
- if ($isadmin == TRUE) {
- $formuser = $xoopsModuleConfig['form_options'];
- } else {
- $formuser = $xoopsModuleConfig['form_optionsuser'];
- }
-
- switch ($formuser) {
- case 'dhtml':
- $editor = xoopstube_dhtmleditor($caption, $name, $value, $xoops22);
- break;
-
- case 'dhtmlext':
- $editor = xoopstube_dhtmlexteditor($caption, $name, $value, $xoops22);
- break;
- case 'textarea':
- $editor = new XoopsFormTextArea($caption, $name, $value, $xoops22);
- break;
-
- case 'fck':
- $editor = xoopstube_fckeditor($caption, $name, $value, $xoops22);
- break;
- case 'koivi':
- $editor = xoopstube_koivieditor($caption, $name, $value, $xoops22);
- break;
-
- case 'tinyeditor':
- $editor = xoopstube_tinyeditor($caption, $name, $value, $xoops22);
- break;
-
- case 'tinymce' :
- $editor = xoopstube_tinymce($caption, $name, $value);
- break;
- }
- return $editor;
-}
-
-function xoopstube_dhtmleditor($caption, $name, $value, $xoops22) {
- if (!$xoops22) {
- $xoopstube_editor = new XoopsFormDhtmlTextArea($caption, $name, $value, 20, 60);
- } else {
- $xoopstube_editor = new XoopsFormEditor($caption, 'dhtmltextarea', $editor_configs);
- }
- return $xoopstube_editor;
-}
-
-function xoopstube_dhtmlexteditor($caption, $name, $value, $xoops22) {
- if (!$xoops22) {
- if (is_readable(XOOPS_ROOT_PATH . '/editors/dhtmlext/dhtmlext.php')) {
- include_once(XOOPS_ROOT_PATH . '/editors/dhtmlext/dhtmlext.php');
- $xoopstube_editor = new XoopsFormDhtmlTextAreaExtended($caption, $name, $value, 10, 50);
- } elseif (is_readable(XOOPS_ROOT_PATH . '/class/xoopseditor/dhtmlext/dhtmlext.php')) {
- include_once(XOOPS_ROOT_PATH . '/class/xoopseditor/dhtmlext/dhtmlext.php');
- $xoopstube_editor = new XoopsFormDhtmlTextAreaExtended($caption, $name, $value, 10, 50);
- } else {
- if ($dhtml) {
- $xoopstube_editor = new XoopsFormDhtmlTextArea($caption, $name, $value, 50, 60);
- } else {
- $xoopstube_editor = new XoopsFormTextArea($caption, $name, $value, 7, 60);
- }
- }
- } else {
- $xoopstube_editor = new XoopsFormEditor($caption, 'dhtmlext', $editor_configs);
- }
- return $xoopstube_editor;
-}
-
-function xoopstube_fckeditor($caption, $name, $value, $xoops22) {
- if (!$xoops22) {
- if (file_exists(XOOPS_ROOT_PATH . '/editors/FCKeditor/formfckeditor.php')) {
- include_once(XOOPS_ROOT_PATH . '/editors/FCKeditor/formfckeditor.php');
- $xoopstube_editor = new XoopsFormFckeditor($editor_configs, TRUE);
- } elseif (file_exists(XOOPS_ROOT_PATH . '/class/xoopseditor/fckeditor/formfckeditor.php')) {
- include_once(XOOPS_ROOT_PATH . '/class/xoopseditor/fckeditor/formfckeditor.php');
- $xoopstube_editor = new XoopsFormFckeditor($editor_configs, TRUE);
- } else {
- if ($dhtml) {
- $xoopstube_editor = new XoopsFormDhtmlTextArea($caption, $name, $value, 20, 60);
- } else {
- $xoopstube_editor = new XoopsFormTextArea($caption, $name, $value, 7, 60);
- }
- }
- } else {
- $xoopstube_editor = new XoopsFormEditor($caption, 'fckeditor', $editor_configs);
- }
- return $xoopstube_editor;
-}
-
-function xoopstube_koivieditor($caption, $name, $value, $xoops22) {
- if (!$xoops22) {
- if (is_readable(XOOPS_ROOT_PATH . '/class/xoopseditor/koivi/formwysiwygtextarea.php')) {
- include_once(XOOPS_ROOT_PATH . '/class/xoopseditor/koivi/formwysiwygtextarea.php');
- $xoopstube_editor = new XoopsFormWysiwygTextArea($caption, $name, $value, '100%', '400px');
- } else {
- if ($dhtml) {
- $xoopstube_editor = new XoopsFormDhtmlTextArea($caption, $name, $value, 20, 60);
- } else {
- $xoopstube_editor = new XoopsFormTextArea($caption, $name, $value, 7, 60);
- }
- }
- } else {
- $xoopstube_editor = new XoopsFormEditor($caption, 'koivi', $editor_configs);
- }
- return $xoopstube_editor;
-}
-
-function xoopstube_tinyeditor($caption, $name, $value, $xoops22) {
- if (!$xoops22) {
- if (is_readable(XOOPS_ROOT_PATH . '/class/xoopseditor/tinyeditor/formtinyeditortextarea.php')) {
- include_once(XOOPS_ROOT_PATH . '/class/xoopseditor/tinyeditor/formtinyeditortextarea.php');
- $xoopstube_editor = new XoopsFormTinyeditorTextArea(array(
- 'caption' => $caption,
- 'name' => $name,
- 'value' => $value,
- 'width' => '100%',
- 'height' => '400px'
- ));
- } else {
- if ($dhtml) {
- $xoopstube_editor = new XoopsFormDhtmlTextArea($caption, $name, $value, 50, 60);
- } else {
- $xoopstube_editor = new XoopsFormTextArea($caption, $name, $value, 7, 60);
- }
- }
- } else {
- $xoopstube_editor = new XoopsFormEditor($caption, 'tinyeditor', $editor_configs);
- }
- return $xoopstube_editor;
-}
-
-function xoopstube_tinymce($caption, $name, $value) {
- if (file_exists(XOOPS_ROOT_PATH . '/editors/tinymce/formtinymce.php')) {
- include_once(XOOPS_ROOT_PATH . '/editors/tinymce/formtinymce.php');
- $xoopstube_editor = new XoopsFormTinymce(array(
- 'caption' => $caption,
- 'name' => $name,
- 'value' => $value,
- 'width' => '100%',
- 'height' => '500px', 0
- ));
- } elseif (file_exists(XOOPS_ROOT_PATH . '/class/xoopseditor/tinymce/formtinymce.php')) {
- include_once(XOOPS_ROOT_PATH . '/class/xoopseditor/tinymce/formtinymce.php');
- $xoopstube_editor = new XoopsFormTinymce(array(
- 'caption' => $caption,
- 'name' => $name,
- 'value' => $value,
- 'width' => '100%',
- 'height' => '500px', 0
- ));
- } else {
- $xoopstube_editor = new XoopsFormDhtmlTextArea($caption, $name, $value, 50, 60);
- }
- return $xoopstube_editor;
-}
-
-function xtube_html2text($document) {
+function xtube_html2text($document)
+{
// PHP Manual:: function preg_replace
// $document should contain an HTML document.
// This will remove HTML tags, javascript sections
@@ -1215,11 +1121,30 @@
"'<[\/\!]*?[^<>]*?>'si", // Strip out HTML tags
"'([\r\n])[\s]+'", // Strip out white space
"'&(quot|#34);'i", // Replace HTML entities
- "'&(amp|#38);'i", "'&(lt|#60);'i", "'&(gt|#62);'i", "'&(nbsp|#160);'i", "'&(iexcl|#161);'i", "'&(cent|#162);'i", "'&(pound|#163);'i", "'&(copy|#169);'i",
+ "'&(amp|#38);'i",
+ "'&(lt|#60);'i",
+ "'&(gt|#62);'i",
+ "'&(nbsp|#160);'i",
+ "'&(iexcl|#161);'i",
+ "'&(cent|#162);'i",
+ "'&(pound|#163);'i",
+ "'&(copy|#169);'i",
); // evaluate as php
$replace = array(
- "", "", "", "\\1", "\"", "&", "<", ">", " ", chr(161), chr(162), chr(163), chr(169),
+ "",
+ "",
+ "",
+ "\\1",
+ "\"",
+ "&",
+ "<",
+ ">",
+ " ",
+ chr(161),
+ chr(162),
+ chr(163),
+ chr(169),
);
$text = preg_replace($search, $replace, $document);
@@ -1228,13 +1153,14 @@
}
// Check if Tag module is installed
-function xtube_tag_module_included() {
+function xtube_tag_module_included()
+{
static $xtube_tag_module_included;
if (!isset($xtube_tag_module_included)) {
$modules_handler = xoops_gethandler('module');
$tag_mod = $modules_handler->getByDirName('tag');
if (!$tag_mod) {
- $tag_mod = FALSE;
+ $tag_mod = false;
} else {
$xtube_tag_module_included = $tag_mod->getVar('isactive') == 1;
}
@@ -1243,7 +1169,8 @@
}
// Add item_tag to Tag-module
-function xtube_tagupdate($lid, $item_tag) {
+function xtube_tagupdate($lid, $item_tag)
+{
global $xoopsModule;
if (xtube_tag_module_included()) {
include_once XOOPS_ROOT_PATH . '/modules/tag/include/formtag.php';
@@ -1252,13 +1179,15 @@
}
}
-function xtube_updateCounter($lid) {
+function xtube_updateCounter($lid)
+{
global $xoopsDB;
$sql = 'UPDATE ' . $xoopsDB->prefix('xoopstube_videos') . ' SET hits=hits+1 WHERE lid=' . intval($lid);
$result = $xoopsDB->queryF($sql);
}
-function xtube_getbanner_from_id_banner($banner_id) {
+function xtube_getbanner_from_id_banner($banner_id)
+{
###### Hack by www.stefanosilvestrini.com ######
global $xoopsConfig;
$db =& XoopsDatabaseFactory::getDatabaseConnection();
@@ -1273,7 +1202,9 @@
}
if ($numrows > 0) {
$bresult = $db->query('SELECT * FROM ' . $db->prefix('banner') . ' WHERE bid=' . $banner_id, 1, $bannum);
- list ($bid, $cid, $imptotal, $impmade, $clicks, $imageurl, $clickurl, $date, $htmlbanner, $htmlcode) = $db->fetchRow($bresult);
+ list ($bid, $cid, $imptotal, $impmade, $clicks, $imageurl, $clickurl, $date, $htmlbanner, $htmlcode) = $db->fetchRow(
+ $bresult
+ );
if ($xoopsConfig['my_ip'] == xoops_getenv('REMOTE_ADDR')) {
// EMPTY
} else {
@@ -1282,22 +1213,31 @@
/* Check if this impression is the last one and print the banner */
if ($imptotal == $impmade) {
$newid = $db->genId($db->prefix('bannerfinish') . '_bid_seq');
- $sql = sprintf('INSERT INTO %s (bid, cid, impressions, clicks, datestart, dateend) VALUES (%u, %u, %u, %u, %u, %u)', $db->prefix('bannerfinish'), $newid, $cid, $impmade, $clicks, $date, time());
+ $sql = sprintf(
+ 'INSERT INTO %s (bid, cid, impressions, clicks, datestart, dateend) VALUES (%u, %u, %u, %u, %u, %u)',
+ $db->prefix('bannerfinish'),
+ $newid,
+ $cid,
+ $impmade,
+ $clicks,
+ $date,
+ time()
+ );
$db->queryF($sql);
$db->queryF(sprintf('DELETE FROM %s WHERE bid = %u', $db->prefix('banner'), $bid));
}
if ($htmlbanner) {
$bannerobject = $htmlcode;
} else {
- $bannerobject = '<div align="center"><a href="' . XOOPS_URL . '/banners.php?op=click&bid=' . $bid
- . '" target="_blank">';
+ $bannerobject = '<div align="center"><a href="' . XOOPS_URL . '/banners.php?op=click&bid='
+ . $bid . '" target="_blank">';
if (stristr($imageurl, '.swf')) {
$bannerobject = $bannerobject
- . '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0" width="468" height="60">'
- . '<param name="movie" value="' . $imageurl . '"></param>'
- . '<param name="quality" value="high"></param>' . '<embed src="' . $imageurl
- . '" quality="high" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="468" height="60">'
- . '</embed>' . '</object>';
+ . '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0" width="468" height="60">'
+ . '<param name="movie" value="' . $imageurl . '"></param>'
+ . '<param name="quality" value="high"></param>' . '<embed src="' . $imageurl
+ . '" quality="high" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="468" height="60">'
+ . '</embed>' . '</object>';
} else {
$bannerobject = $bannerobject . '<img src="' . $imageurl . '" alt="" />';
}
@@ -1307,7 +1247,8 @@
}
}
-function xtube_getbanner_from_id_client($client_id) {
+function xtube_getbanner_from_id_client($client_id)
+{
###### Hack by www.stefanosilvestrini.com ######
global $xoopsConfig;
$db =& XoopsDatabaseFactory::getDatabaseConnection();
@@ -1322,9 +1263,13 @@
}
if ($numrows > 0) {
$bresult = $db->query(
- 'SELECT * FROM ' . $db->prefix('banner') . ' WHERE cid=' . $client_id . ' ORDER BY rand()', 1, $bannum
+ 'SELECT * FROM ' . $db->prefix('banner') . ' WHERE cid=' . $client_id . ' ORDER BY rand()',
+ 1,
+ $bannum
);
- list ($bid, $cid, $imptotal, $impmade, $clicks, $imageurl, $clickurl, $date, $htmlbanner, $htmlcode) = $db->fetchRow($bresult);
+ list ($bid, $cid, $imptotal, $impmade, $clicks, $imageurl, $clickurl, $date, $htmlbanner, $htmlcode) = $db->fetchRow(
+ $bresult
+ );
if ($xoopsConfig['my_ip'] == xoops_getenv('REMOTE_ADDR')) {
// EMPTY
} else {
@@ -1333,22 +1278,31 @@
/* Check if this impression is the last one and print the banner */
if ($imptotal == $impmade) {
$newid = $db->genId($db->prefix('bannerfinish') . '_bid_seq');
- $sql = sprintf('INSERT INTO %s (bid, cid, impressions, clicks, datestart, dateend) VALUES (%u, %u, %u, %u, %u, %u)', $db->prefix('bannerfinish'), $newid, $cid, $impmade, $clicks, $date, time());
+ $sql = sprintf(
+ 'INSERT INTO %s (bid, cid, impressions, clicks, datestart, dateend) VALUES (%u, %u, %u, %u, %u, %u)',
+ $db->prefix('bannerfinish'),
+ $newid,
+ $cid,
+ $impmade,
+ $clicks,
+ $date,
+ time()
+ );
$db->queryF($sql);
$db->queryF(sprintf('DELETE FROM %s WHERE bid = %u', $db->prefix('banner'), $bid));
}
if ($htmlbanner) {
$bannerobject = $htmlcode;
} else {
- $bannerobject = '<div align="center"><a href="' . XOOPS_URL . '/banners.php?op=click&bid=' . $bid
- . '" target="_blank">';
+ $bannerobject = '<div align="center"><a href="' . XOOPS_URL . '/banners.php?op=click&bid='
+ . $bid . '" target="_blank">';
if (stristr($imageurl, '.swf')) {
$bannerobject = $bannerobject
- . '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0" width="468" height="60">'
- . '<param name="movie" value="' . $imageurl . '"></param>'
- . '<param name="quality" value="high"></param>' . '<embed src="' . $imageurl
- . '" quality="high" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="468" height="60">'
- . '</embed>' . '</object>';
+ . '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0" width="468" height="60">'
+ . '<param name="movie" value="' . $imageurl . '"></param>'
+ . '<param name="quality" value="high"></param>' . '<embed src="' . $imageurl
+ . '" quality="high" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="468" height="60">'
+ . '</embed>' . '</object>';
} else {
$bannerobject = $bannerobject . '<img src="' . $imageurl . '" alt="" />';
}
@@ -1358,7 +1312,8 @@
}
}
-function xoopstube_noindexnofollow() {
+function xoopstube_noindexnofollow()
+{
global $xoTheme, $xoopsTpl;
if (is_object($xoTheme)) {
$xoTheme->addMeta('meta', 'robots', 'noindex,nofollow');
@@ -1367,7 +1322,8 @@
}
}
-function xoopstube_getLinkedUnameFromId($userid) {
+function xoopstube_getLinkedUnameFromId($userid)
+{
$userid = intval($userid);
if ($userid > 0) {
$member_handler =& xoops_gethandler('member');
@@ -1381,53 +1337,52 @@
return $GLOBALS['xoopsConfig']['anonymous'];
}
-function xoopstube_time($time) {
+function xoopstube_time($time)
+{
global $xoopsConfig, $xoopsModuleConfig;
$mydirname = basename(dirname(dirname(__FILE__)));
include_once XOOPS_ROOT_PATH . '/modules/' . $mydirname . '/language/' . $xoopsConfig['language'] . '/local.php';
$trans = array(
- 'Monday' => _XOOPSTUBE_MONDAY,
- 'Tuesday' => _XOOPSTUBE_TUESDAY,
- 'Wednesday' => _XOOPSTUBE_WEDNESDAY,
- 'Thursday' => _XOOPSTUBE_THURSDAY,
- 'Friday' => _XOOPSTUBE_FRIDAY,
- 'Saturday' => _XOOPSTUBE_SATURDAY,
- 'Sunday' => _XOOPSTUBE_SUNDAY,
- 'Mon' => _XOOPSTUBE_MON,
- 'Tue' => _XOOPSTUBE_TUE,
- 'Wed' => _XOOPSTUBE_WED,
- 'Thu' => _XOOPSTUBE_THU,
- 'Fri' => _XOOPSTUBE_FRI,
- 'Sat' => _XOOPSTUBE_SAT,
- 'Sun' => _XOOPSTUBE_SUN,
- 'Januari' => _XOOPSTUBE_JANUARI,
- 'Februari' => _XOOPSTUBE_FEBRUARI,
- 'March' => _XOOPSTUBE_MARCH,
- 'April' => _XOOPSTUBE_APRIL,
- 'May' => _XOOPSTUBE_MAY,
- 'June' => _XOOPSTUBE_JUNE,
- 'July' => _XOOPSTUBE_JULY,
- 'August' => _XOOPSTUBE_AUGUST,
- 'September' => _XOOPSTUBE_SEPTEMBER,
- 'October' => _XOOPSTUBE_OCTOBER,
- 'November' => _XOOPSTUBE_NOVEMBER,
- 'December' => _XOOPSTUBE_DECEMBER,
- 'Jan' => _XOOPSTUBE_JAN,
- 'Feb' => _XOOPSTUBE_FEB,
- 'Mar' => _XOOPSTUBE_MAR,
- 'Apr' => _XOOPSTUBE_APR,
- 'May' => _XOOPSTUBE_MAY2,
- 'Jun' => _XOOPSTUBE_JUN,
- 'Jul' => _XOOPSTUBE_JUL,
- 'Aug' => _XOOPSTUBE_AUG,
- 'Sep' => _XOOPSTUBE_SEP,
- 'Oct' => _XOOPSTUBE_OCT,
- 'Nov' => _XOOPSTUBE_NOV,
- 'Dec' => _XOOPSTUBE_DEC
+ 'Monday' => _XOOPSTUBE_MONDAY,
+ 'Tuesday' => _XOOPSTUBE_TUESDAY,
+ 'Wednesday' => _XOOPSTUBE_WEDNESDAY,
+ 'Thursday' => _XOOPSTUBE_THURSDAY,
+ 'Friday' => _XOOPSTUBE_FRIDAY,
+ 'Saturday' => _XOOPSTUBE_SATURDAY,
+ 'Sunday' => _XOOPSTUBE_SUNDAY,
+ 'Mon' => _XOOPSTUBE_MON,
+ 'Tue' => _XOOPSTUBE_TUE,
+ 'Wed' => _XOOPSTUBE_WED,
+ 'Thu' => _XOOPSTUBE_THU,
+ 'Fri' => _XOOPSTUBE_FRI,
+ 'Sat' => _XOOPSTUBE_SAT,
+ 'Sun' => _XOOPSTUBE_SUN,
+ 'Januari' => _XOOPSTUBE_JANUARI,
+ 'Februari' => _XOOPSTUBE_FEBRUARI,
+ 'March' => _XOOPSTUBE_MARCH,
+ 'April' => _XOOPSTUBE_APRIL,
+ 'May' => _XOOPSTUBE_MAY,
+ 'June' => _XOOPSTUBE_JUNE,
+ 'July' => _XOOPSTUBE_JULY,
+ 'August' => _XOOPSTUBE_AUGUST,
+ 'September' => _XOOPSTUBE_SEPTEMBER,
+ 'October' => _XOOPSTUBE_OCTOBER,
+ 'November' => _XOOPSTUBE_NOVEMBER,
+ 'December' => _XOOPSTUBE_DECEMBER,
+ 'Jan' => _XOOPSTUBE_JAN,
+ 'Feb' => _XOOPSTUBE_FEB,
+ 'Mar' => _XOOPSTUBE_MAR,
+ 'Apr' => _XOOPSTUBE_APR,
+ 'May' => _XOOPSTUBE_MAY2,
+ 'Jun' => _XOOPSTUBE_JUN,
+ 'Jul' => _XOOPSTUBE_JUL,
+ 'Aug' => _XOOPSTUBE_AUG,
+ 'Sep' => _XOOPSTUBE_SEP,
+ 'Oct' => _XOOPSTUBE_OCT,
+ 'Nov' => _XOOPSTUBE_NOV,
+ 'Dec' => _XOOPSTUBE_DEC
);
$timestamp = strtr($time, $trans);
return $timestamp;
}
-
-?>
\ No newline at end of file
Modified: XoopsModules/xoopstube/trunk/xoopstube/xoops_version.php
===================================================================
--- XoopsModules/xoopstube/trunk/xoopstube/xoops_version.php 2013-06-16 19:39:27 UTC (rev 11703)
+++ XoopsModules/xoopstube/trunk/xoopstube/xoops_version.php 2013-06-17 01:23:24 UTC (rev 11704)
@@ -6,8 +6,8 @@
*/
$mydirname = basename(dirname(__FILE__));
-$modversion['name'] = _MI_XTUBE_NAME;
-$mod...
[truncated message content] |