function getMediaLink($aMedia) { $sFile = $this->aMediaConfig['dir']['tmp'] . $aMedia['med_file']; if (extFileExists($sFile)) { return $this->aMediaConfig['site']['tmp'] . $aMedia['med_file']; } else { if (copy($this->sMediaDir . $aMedia['med_file'], $sFile)) { return $this->aMediaConfig['site']['tmp'] . $aMedia['med_file']; } } return false; }
function getPostModMediaPage($sType = 'photo', $sStatus = 'passive', $iUser = 0) { global $dir; global $site, $max_thumb_width, $max_thumb_height, $max_photo_width, $max_photo_height; $ret = ''; $aFiles = getUnapprovedFilesArray($sType, $sStatus, $iUser); $style = ' float:left; margin:5px 11px; padding:5px; border:1px solid silver; text-align:center; '; $style2 = ' width:' . $max_thumb_width . 'px; height:' . $max_thumb_height . 'px; background-color:#f1f1f1; border:1px solid silver; '; $ret .= '<div style="clear:both;"></div>'; $ret .= "<script>\r\n\tfunction checkAll( _pref, do_check )\r\n\t{\r\n\t\taElems = document.getElementsByTagName( 'input' );\r\n\t\t\r\n\t\tfor( i = 0; i < aElems.length; i ++ )\r\n\t\t{\r\n\t\t\telt = aElems[i];\r\n\t\t\tif( elt.name.substr( 0, _pref.length ) == _pref )\r\n\t\t\t\telt.checked = do_check;\r\n\t\t}\r\n\t}\r\n\t</script>"; $ret .= '<div><form method="post" action="' . $_HTTP['REFERER'] . '">'; foreach ($aFiles as $aMedia) { $sThumbFile = $dir['profileImage'] . $aMedia['med_prof_id'] . '/thumb_' . $aMedia['med_file']; if (extFileExists($sThumbFile)) { $sThumbUrl = $site['profileImage'] . $aMedia['med_prof_id'] . '/thumb_' . $aMedia['med_file']; $sMediaUrl = $site['profileImage'] . $aMedia['med_prof_id'] . '/photo_' . $aMedia['med_file']; $ret .= '<div style="' . $style . '">'; $ret .= '<div style="' . $style2 . '">'; $ret .= '<img src="' . $sThumbUrl . '" onclick="window.open(\'' . $sMediaUrl . '\', \'photo\',\'width=' . ($max_photo_width + 10) . ',height=' . ($max_photo_height + 10) . ',left=100,top=100,copyhistory=no,directories=no,menubar=no,location=no,resizable=yes,scrollbars=yes\');" />'; $ret .= '</div>'; $ret .= '<br />'; $ret .= '<div><input type="checkbox" name="check[]" id="ch' . $aMedia['med_id'] . '" value="' . $aMedia['med_id'] . '"></div>'; $ret .= '</div>'; } } $ret .= '<div style="clear:both;"></div>'; if (!empty($aFiles)) { $sAppBut = $sStatus == 'passive' ? '<input type="submit" name="Approve" value="Approve">' : ''; $sCheck = count($aFiles) > 1 ? '<input type="checkbox" name=\\"ch_all" onclick="checkAll( \'ch\', this.checked )" />Check all' : ''; $ret .= '<div style="clear:both;font-weight:bold; text-align:center;">' . $sCheck . ' <input type="submit" name="Delete" value="Delete">'; $ret .= $sAppBut . '</div>'; } $ret .= '</form></div>'; return $ret; }
function serviceGetEntry($iId, $sType = 'browse') { $iId = (int) $iId; $sqlQuery = "SELECT a.`ID` as `id`,\n a.`Title` as `title`,\n a.`Description` as `description`,\n a.`Uri` as `uri`,\n a.`Owner` as `owner`,\n a.`Date` as `date`,\n a.`Video`,\n a.`Source`,\n a.`Rate` AS `rate`,\n a.`RateCount` AS `rate_count`,\n a.`CommentsCount` AS `comments_count`,\n a.`Views` AS `views_count`,\n a.`Status` AS `status`,\n b.`id_album` as `album_id`\n FROM `RayVideoFiles` as a\n LEFT JOIN `sys_albums_objects` as b ON b.`id_object` = a.`ID`\n LEFT JOIN `sys_albums` as c ON c.`ID`=b.`id_album`\n WHERE a.`ID`='{$iId}' AND c.`Type`='bx_videos'"; $aImageInfo = db_arr($sqlQuery); if (empty($aImageInfo) || !is_array($aImageInfo)) { return array(); } $sFileName = $sFilePath = ''; $sImg = $aImageInfo['id'] . $this->aConstants['picPostfix'][$sType]; if ($sImg != '' && extFileExists($this->aConstants['filesDir'] . $sImg)) { $sFileName = $this->aConstants['filesUrl'] . $sImg; $sFilePath = $this->aConstants['filesDir'] . $sImg; } return array('id' => $aImageInfo['id'], 'file' => $sFileName, 'file_path' => $sFilePath, 'title' => $aImageInfo['title'], 'owner' => $aImageInfo['owner'], 'description' => $aImageInfo['description'], 'width' => (int) $this->oModule->_oConfig->getGlParam('browse_width') + 2 * 2, 'height' => (int) (int) $this->oModule->_oConfig->getGlParam('browse_height') + 2 * 2, 'url' => $this->getCurrentUrl('file', $iId, $aImageInfo['uri']), 'video' => $aImageInfo['Video'], 'source' => $aImageInfo['Source'], 'rate' => $aImageInfo['rate'], 'rate_count' => $aImageInfo['rate_count'], 'comments_count' => $aImageInfo['comments_count'], 'views_count' => $aImageInfo['views_count'], 'status' => $aImageInfo['status'], 'album_id' => $aImageInfo['album_id']); }
function getTemplateIcon($sFileName) { global $site; global $dir; global $tmpl; $sBase = $dir['root'] . 'templates/base/images/icons/' . $sFileName; $sTemplate = $dir['root'] . 'templates/tmpl_' . $tmpl . '/images/icons/' . $sFileName; if (extFileExists($sTemplate)) { $iconUrl = $site['icons'] . $sFileName; } else { if (extFileExists($dir['base'] . 'images/icons/' . $sFileName)) { $iconUrl = $site['base'] . 'images/icons/' . $sFileName; } else { $iconUrl = getTemplateIcon('spacer.gif'); } } return $iconUrl; }
/** * Get absolute location of some template's part. * * @param string $sType result type. Available values 'url' and 'path'. * @param string $sName requested part name. * @return string absolute location (path/url) of the part. */ function _getAbsoluteLocationJs($sType, $sName) { $sResult = ''; $aLocations = array_reverse($this->_aLocationsJs, true); foreach ($aLocations as $sKey => $aLocation) { if (extFileExists($aLocation['path'] . $sName)) { $sResult = $aLocation[$sType] . $sName; } else { continue; } break; } return $sType == 'path' && !empty($sResult) ? realpath($sResult) : $sResult; }
function validateMediaArray($aMedia) { foreach ($aMedia as $iKey => $aValue) { $sIconSrc = $this->sMediaDir . 'icon_' . $aValue['med_file']; $sThumbSrc = $this->sMediaDir . 'thumb_' . $aValue['med_file']; $sPhotoSrc = $this->sMediaDir . 'photo_' . $aValue['med_file']; if (!extFileExists($sIconSrc) || !extFileExists($sThumbSrc) || !extFileExists($sPhotoSrc)) { if ($aValue['med_id'] == $aValue['PrimPhoto']) { $this->oMediaQuery->resetPrimPhoto($this->iProfileID); } unset($aMedia[$iKey]); } } return array_values($aMedia); }
function _getImageFullUrl($aImageInfo, $sType = 'thumb') { $sName = $aImageInfo['id'] . $this->aConstants['picPostfix'][$sType]; $sName = str_replace('{ext}', $aImageInfo['ext'], $sName); $sImageUrl = !empty($aImageInfo['id']) && extFileExists($this->oModule->_oConfig->getFilesPath() . $sName) ? $this->getImgUrl($aImageInfo['Hash'], $sType) : ''; return $sImageUrl; }
function getRatingPhoto($aPhoto) { global $max_photo_width, $max_photo_height, $dir, $site; $sFileSrc = $dir['profileImage'] . $aPhoto['med_prof_id'] . '/photo_' . $aPhoto['med_file']; if (extFileExists($sFileSrc)) { $sPhotoUrl = $site['profileImage'] . $aPhoto['med_prof_id'] . '/photo_' . $aPhoto['med_file']; } else { header('Location:' . $_SERVER['PHP_SELF']); } $ret = ''; $ret .= '<div class="mediaTitle">'; $ret .= process_line_output($aPhoto['med_title']); $ret .= '</div>'; $ret .= '<div class="photoBlock" style="text-align:center;">'; $ret .= '<img src="' . getTemplateIcon('spacer.gif') . '" style="width:' . $max_photo_width . 'px; height:' . $max_photo_height . 'px; background-image:url(' . $sPhotoUrl . ');" class="photo" />'; $ret .= '</div>'; return $ret; }
} else { $special_user = isSpecialOrcaUser($user); $orca_admin = isOrcaAdmin($user); require_once BX_DIRECTORY_PATH_ROOT . 'inc/utils.inc.php'; require_once BX_DIRECTORY_PATH_ROOT . 'profilePhotos.php'; $oProfile = new BxDolProfile($user); $userID = $oProfile->_iProfileID; $av = $gConf['url']['icon'] . 'basic.gif'; $profile_url = $gConf['url']['base'] . "?action=goto&amp;user={$user}"; if ('admin' == $user) { $av = $gConf['url']['icon'] . 'admin.gif'; } elseif ($userID) { $oPhoto = new ProfilePhotos($userID); $oPhoto->getMediaArray(); $aFile = $oPhoto->getPrimaryPhotoArray(); if (extFileExists($oPhoto->sMediaDir . 'icon_' . $aFile['med_file'])) { $av = $oPhoto->sMediaUrl . 'icon_' . $aFile['med_file']; } elseif ($special_user) { $av = $gConf['url']['icon'] . 'special.gif'; } $profile_url = $site['url'] . 'profile.php?ID=' . $userID; } // Ray integration [begin] $iId = $userID; $sPassword = md5(getPassword($iId)); $bEnableRay = getParam('enable_ray') == 'on'; $check_res = checkAction($iId, ACTION_ID_USE_RAY_IM); $aRay = '<ray_on>0</ray_on>'; if ($bEnableRay && $check_res[CHECK_ACTION_RESULT] == CHECK_ACTION_RESULT_ALLOWED) { $aRay = '<ray_on>1</ray_on><ray_id>' . $iId . '</ray_id><ray_pwd>' . $sPassword . '</ray_pwd>'; }
function serviceGetVideoArray($iPicId, $sImgType = 'browse') { $iPicId = (int) $iPicId; $sqlQuery = "SELECT a.`ID` as `id`,\r\n\t\t\t\t\t\t\ta.`Title` as `title`,\r\n\t\t\t\t\t\t\ta.`Description` as `description`,\r\n\t\t\t\t\t\t\ta.`Uri` as `uri`,\r\n\t\t\t\t\t\t\ta.`Owner` as `owner`,\r\n\t\t\t\t\t\t\ta.`Date` as `date`,\r\n\t\t\t\t\t\t\ta.`Video`,\r\n\t\t\t\t\t\t\ta.`Source`,\r\n\t\t\t\t\t\t\tb.`id_album` as `album_id`\r\n\t\t\t\t\t\tFROM `RayVideoFiles` as a\r\n\t\t\t\t\t\tLEFT JOIN `sys_albums_objects` as b ON b.`id_object` = a.`ID`\r\n\t\t\t\t\t\tLEFT JOIN `sys_albums` as c ON c.`ID`=b.`id_album`\r\n\t\t\t\t\t\tWHERE a.`ID`='{$iPicId}' AND c.`Type`='bx_videos'"; $aImageInfo = db_arr($sqlQuery); if (empty($aImageInfo) || !is_array($aImageInfo)) { return array(); } $sImg = $aImageInfo['id'] . $this->aConstants['picPostfix'][$sImgType]; $sFileName = $sImg != '' && extFileExists($this->aConstants['filesDir'] . $sImg) ? $this->aConstants['filesUrl'] . $sImg : ''; return array('file' => $sFileName, 'title' => $aImageInfo['title'], 'owner' => $aImageInfo['owner'], 'description' => $aImageInfo['description'], 'width' => (int) $this->oModule->_oConfig->getGlParam('browse_width') + 2 * 2, 'height' => (int) (int) $this->oModule->_oConfig->getGlParam('browse_height') + 2 * 2, 'url' => $this->getCurrentUrl('file', $iPicId, $aImageInfo['uri']), 'video' => $aImageInfo['Video'], 'source' => $aImageInfo['Source'], 'album_id' => $aImageInfo['album_id']); }
function get_member_primary_photo($ID, $float) { global $site; require_once BX_DIRECTORY_PATH_ROOT . 'profilePhotos.php'; $oPhoto = new ProfilePhotos($ID); $oPhoto->getActiveMediaArray(); $aFile = $oPhoto->getPrimaryPhotoArray(); if (extFileExists($oPhoto->sMediaDir . 'photo_' . $aFile['med_file'])) { $sFileName = $oPhoto->sMediaUrl . 'photo_' . $aFile['med_file']; } else { $sFileName = getTemplateIcon($oPhoto->sSexPic); } $style = 'width:' . $oPhoto->aMediaConfig['size']['photoWidth'] . 'px;' . 'height:' . $oPhoto->aMediaConfig['size']['photoHeight'] . 'px;' . 'background-image:url(' . $sFileName . ');'; $ret = ''; $ret .= '<div class="thumbnail_block" style="float:' . $float . '; ">'; $ret .= "<a href=\"{$site['url']}upload_media.php\">"; $ret .= '<img src="' . getTemplateIcon('spacer.gif') . '" style="' . $style . '" alt="' . process_line_output($aFileName['med_title']) . '" />'; $ret .= '</a>'; $ret .= '</div>'; return $ret; }
function _getIconsList2(&$sJsArray, &$iCountPhotos) { $ret = ''; $sJsArray = 'var oIcons = {'; $iCountPhotos = 0; for ($i = 0; $i < $this->aMediaConfig['max']['photo']; $i++) { $sIconSrc = $this->sMediaDir . 'icon_' . $this->aMedia[$i]['med_file']; if (extFileExists($sIconSrc)) { $iPhotoRatingCount = $this->aMedia[$i]['voting_count'] ? $this->aMedia[$i]['voting_count'] : 0; $iPhotoRating = $this->aMedia[$i]['voting_rate'] ? $this->aMedia[$i]['voting_rate'] : 0; $sIconUrl = $this->sMediaUrl . 'icon_' . $this->aMedia[$i]['med_file']; $atrib = "'{$this->aMedia[$i]['med_id']}'"; $ret .= '<img src="' . getTemplateIcon('spacer.gif') . '" style="width:' . $this->aMediaConfig['size']['iconWidth'] . 'px; height:' . $this->aMediaConfig['size']['iconHeight'] . 'px; background-image:url(' . $sIconUrl . ');" alt="" class="icons" onclick="return changeThumb(' . $atrib . ');" />'; $sJsArray .= "'{$this->aMedia[$i]['med_id']}' : {" . "'title' : '{$this->aMedia[$i]['med_title']}'," . "'file' : '{$this->aMedia[$i]['med_file']}'," . "'rate' : '{$iPhotoRating}'," . "'count' : '{$iPhotoRatingCount}'},\n"; ++$iCountPhotos; } } if ($iCountPhotos) { $sJsArray = substr($sJsArray, 0, -2); } $sJsArray .= '}'; return $ret; }
function getMediaBlock($iMediaID = 0, $bCouple = false) { global $site; global $votes_pic; $ret = ''; if ($this->iMediaCount > 0) { $iMediaID = $iMediaID > 0 ? $iMediaID : $this->aMedia['0']['PrimPhoto']; $aCurPhoto = $this->getElementArrayByID($iMediaID); if (empty($aCurPhoto)) { $sPhotoUrl = getTemplateIcon($this->sSexPic); } else { $iPhotoID = $aCurPhoto['med_id']; $sPhotoUrl = $this->sMediaUrl . 'photo_' . $aCurPhoto['med_file']; } } else { $sPhotoUrl = getTemplateIcon($this->sSexPic); } $bUseFeature = getParam("profile_gallery_feature") == "on" ? true : false; //$bUseFeature = true; $bSUseFeature = $bUseFeature ? 'true' : 'false'; $ret .= $this->getJSCode($aCurPhoto, $bSUseFeature); $sFeature = ''; if ($bUseFeature) { for ($i = 0; $i < $this->aMediaConfig['max']['photo']; $i++) { $sIconSrc = $this->sMediaDir . 'photo_' . $this->aMedia[$i]['med_file']; if (extFileExists($sIconSrc)) { $sIconUrl = $this->sMediaUrl . 'photo_' . $this->aMedia[$i]['med_file']; //$atrib = "'{$this -> aMedia[$i]['med_id']}'"; //$sFeatImgs .= '<a href="' . $site['url'] . 'photos_gallery.php?ID=' . $this -> iProfileID . '">'; $sFeatImgs .= '<img src="' . getTemplateIcon('spacer.gif') . '" style="width:' . $this->aMediaConfig['size']['photoWidth'] . 'px; height:' . $this->aMediaConfig['size']['photoHeight'] . 'px; background-image:url(' . $sIconUrl . ');position:absolute;" alt="" class="icons" />'; //$sFeatImgs .= '</a>'; } } $sFeatTotalHeight = $this->aMediaConfig['size']['photoHeight'] + 30; $sFeature = <<<EOF <script type="text/javascript" src="{$site['url']}inc/js/jquery.dolPromoT.js"></script> <script type="text/javascript"> \t\$(document).ready( function() { \t\t\$( '#iiPPhoto' ).dolPromo( 3000, 1 ); \t} ); </script> <div style="position:relative;width:100%;height:{$sFeatTotalHeight}px;overflow:hidden;"> \t<div id="iiPPhoto"> \t\t{$sFeatImgs} \t</div> </div> EOF; $ret .= $sFeature; } else { $ret .= '<div class="photoBlock" id="photoKeeper">'; $style = 'width:' . $this->aMediaConfig['size']['photoWidth'] . 'px;' . 'height:' . $this->aMediaConfig['size']['photoHeight'] . 'px;' . 'background-image:url(' . $sPhotoUrl . ');'; $ret .= '<a href="' . $site['url'] . 'photos_gallery.php?ID=' . $this->iProfileID . '" id="temThumbLink">'; $ret .= '<img src="' . getTemplateIcon('spacer.gif') . '" style="' . $style . '" class="photo" alt="" id="temThumbID" />'; //$ret .= '<img src="' . getTemplateIcon('spacer.gif') . '" style="' . $style . '" class="photo" alt="" onload="return setThumb();" id="temThumbID" />'; $ret .= '</a>'; $ret .= '</div>'; } $ret .= '<div id="temPhotoTitle" class="photo_title">' . stripslashes($aCurPhoto['med_title']) . '</div>'; if ($bCouple) { return $ret . '<div class="clear_both"></div>'; } $sJsIconsArray = ''; $iCountPhotos = 0; $sIcons = $this->_getIconsList2($sJsIconsArray, $iCountPhotos); $oVotingView = new BxTemplVotingView('media', (int) $aCurPhoto['med_id']); if ($iCountPhotos && $votes_pic && $oVotingView->isEnabled()) { $ret .= $oVotingView->getSmallVoting(); } $ret .= '<div class="clear_both"></div>'; if (strlen($sIcons)) { $ret .= '<div class="scrollIconContainer">'; $ret .= '<div class="scrollCont" id="scrollCont">'; $ret .= '<div class="scrollLeft" onmouseover="moveScrollLeftAuto( \'iconBlock\', 1 );" onmouseout="moveScrollLeftAuto( \'iconBlock\', 0 );"><img src="' . getTemplateIcon('left_arrow.gif') . '"/></div>'; $ret .= '<div class="scrollRight" onmouseover="moveScrollRightAuto( \'iconBlock\', 1 );" onmouseout="moveScrollRightAuto( \'iconBlock\', 0 );"><img src="' . getTemplateIcon('right_arrow.gif') . '"/></div>'; $ret .= '<div class="clear_both"></div>'; $ret .= '</div>'; $ret .= '<div class="iconBlockCont">'; $ret .= '<div id="iconBlock" class="iconBlock">'; $ret .= $sIcons; $ret .= '</div>'; $ret .= '</div>'; $ret .= '</div>'; } $ret .= '<script type="text/javascript">' . $sJsIconsArray . '</script>'; return $ret; }