function currentDateTimeStamp()
{
    $site_info = getSiteInfo();
    $gm_hour = $site_info->gmt_hour;
    $gm_minute = $site_info->gmt_minute;
    $year = gmdate("Y");
    $month = gmdate("m");
    $day = gmdate("d");
    $hour = gmdate("H") + $gm_hour;
    $min = gmdate("i") + $gm_minute;
    $sec = gmdate("s");
    $today = mktime($hour, $min, $sec, $month, $day, $year);
    return $today;
}
Esempio n. 2
0
function osc_multisite_url()
{
    return getSiteInfo('s_site', '');
}
Esempio n. 3
0
 function _addSiteForm()
 {
     bx_sites_import('FormAdd');
     $oForm = new BxSitesFormAdd($this);
     $sMsgBox = '';
     if (isset($_POST['url'])) {
         if (isset($_POST['title'])) {
             $aParam = array('url' => process_pass_data($_POST['url']));
             if (isset($_POST['thumbnail_html'])) {
                 $this->_addThumbToForm($_POST['thumbnail_html'], $aParam);
             }
             $oForm = new BxSitesFormAdd($this, $aParam);
             $oForm->initChecker();
             if ($oForm->isSubmittedAndValid()) {
                 $sCategories = implode(';', array_unique(explode(';', $oForm->getCleanValue('categories'))));
                 $sEntryUri = getEntryUri($_POST['title']);
                 unset($oForm->aInputs['categories']);
                 $aValsAdd = array('date' => time(), 'entryUri' => $oForm->generateUri(), 'status' => $this->_oConfig->_bAutoapprove || $this->isAdmin() ? 'approved' : 'pending', 'categories' => $sCategories);
                 if (isset($_FILES['photo']['tmp_name']) && $_FILES['photo']['tmp_name']) {
                     $aValsAdd['photo'] = $oForm->uploadPhoto($_FILES['photo']['tmp_name']);
                 }
                 $aValsAdd['ownerid'] = $this->iOwnerId;
                 if ($iSiteId = $oForm->insert($aValsAdd)) {
                     $this->isAllowedAdd(true);
                     $this->onSiteCreate($iSiteId, $aValsAdd['status']);
                     header('Location:' . BX_DOL_URL_ROOT . $this->_oConfig->getBaseUri() . 'browse/my');
                 } else {
                     $sMsgBox = MsgBox(_t('_bx_sites_error_occured'));
                 }
             }
         } else {
             $oForm->initChecker();
             if ($oForm->isSubmittedAndValid()) {
                 $sUrl = process_pass_data($_POST['url']);
                 $sUrlFull = strncasecmp($sUrl, 'http://', 7) != 0 && strncasecmp($sUrl, 'https://', 8) != 0 ? 'http://' . $sUrl : $sUrl;
                 $aSite = $this->_oDb->getSiteByUrl($sUrl);
                 if (count($aSite) == 0) {
                     $aInfo = getSiteInfo($sUrlFull);
                     if (!empty($aInfo)) {
                         $aParam = array('url' => $sUrl, 'title' => $aInfo['title'], 'description' => $aInfo['description']);
                         // BEGIN STW INTEGRATION
                         if (getParam('bx_sites_account_type') != 'No Automated Screenshots') {
                             $aSTWOptions = array();
                             bx_sites_import('STW');
                             $sThumbHTML = getThumbnailHTML($sUrlFull, $aSTWOptions, false, false);
                             if ($sThumbHTML) {
                                 $this->_addThumbToForm($sThumbHTML, $aParam);
                             }
                         }
                         // END STW INTEGRATION
                         $oForm = new BxSitesFormAdd($this, $aParam);
                     } else {
                         $sMsgBox = MsgBox(_t('_bx_sites_site_link_error'));
                         $oForm->aInputs['url']['value'] = $sUrl;
                     }
                 } else {
                     header('Location:' . BX_DOL_URL_ROOT . $this->_oConfig->getBaseUri() . 'view/' . $aSite['entryUri']);
                 }
             }
         }
     }
     return $sMsgBox . $this->_oTemplate->parseHtmlByName('form.html', array('form' => $oForm->getCode()));
 }
Esempio n. 4
0
 function _processLinkUpload()
 {
     $aOwner = $this->_oDb->getUser($this->_getAuthorId());
     $sUrl = trim(process_db_input($_POST['url'], BX_TAGS_STRIP));
     if (empty($sUrl)) {
         return array('code' => 1, 'message' => '_wall_msg_link_empty_link');
     }
     $aSiteInfo = getSiteInfo($sUrl, array('thumbnailUrl' => array('tag' => 'link', 'content_attr' => 'href'), 'OGImage' => array('name_attr' => 'property', 'name' => 'og:image')));
     $sTitle = isset($aSiteInfo['title']) ? $aSiteInfo['title'] : $sUrl;
     $sDescription = isset($aSiteInfo['description']) ? $aSiteInfo['description'] : '';
     $sThumbnail = '';
     if (!empty($aSiteInfo['thumbnailUrl'])) {
         $sThumbnail = $aSiteInfo['thumbnailUrl'];
     } else {
         if (!empty($aSiteInfo['OGImage'])) {
             $sThumbnail = $aSiteInfo['OGImage'];
         }
     }
     $bThumbnail = !empty($sThumbnail);
     return array('object_id' => $aOwner['id'], 'content' => $this->_oTemplate->parseHtmlByName('common_link.html', array('bx_if:show_thumnail' => array('condition' => $bThumbnail, 'content' => array('thumbnail' => $sThumbnail)), 'title' => $sTitle, 'url' => strpos($sUrl, 'http://') === false && strpos($sUrl, 'https://') === false ? 'http://' . $sUrl : $sUrl, 'description' => $sDescription)), 'title' => _t('_wall_added_title_link', $aOwner['username']), 'description' => $sUrl . ' - ' . $sTitle);
 }
Esempio n. 5
0
 function _processLinkUpload()
 {
     $aOwner = $this->_oDb->getUser($this->_getAuthorId());
     $sUrl = trim(process_db_input($_POST['url'], BX_TAGS_STRIP));
     if (empty($sUrl)) {
         return array('code' => 1, 'message' => '_wall_msg_link_empty_link');
     }
     $a = getSiteInfo($sUrl);
     $sTitle = isset($a['title']) ? $a['title'] : $sUrl;
     $sDescription = isset($a['description']) ? $a['description'] : '';
     return array('object_id' => $aOwner['id'], 'content' => $this->_oTemplate->parseHtmlByName('common_link.html', array('title' => $sTitle, 'url' => strpos($sUrl, 'http://') === false && strpos($sUrl, 'https://') === false ? 'http://' . $sUrl : $sUrl, 'description' => $sDescription)), 'title' => $aOwner['username'] . ' ' . _t('_wall_shared_link'), 'description' => $sUrl . ' - ' . $sTitle);
 }
 function serviceAcceptEmbedFile()
 {
     $sErrorReturn = '<script type="text/javascript">parent.' . $this->_sJsPostObject . '.showErrorMsg("video_embed_failed_message");parent.' . $this->_sJsPostObject . '.resetEmbed();</script>';
     $sVideoId = substr(trim($_POST['embed']), -11);
     if (empty($sVideoId)) {
         return $sErrorReturn;
     }
     $aSiteInfo = getSiteInfo('https://www.youtube.com/watch?v=' . $sVideoId, array('name' => array(), 'duration' => array(), 'thumbnailUrl' => array('tag' => 'link', 'content_attr' => 'href')));
     $aSiteInfo['duration'] = bx_parse_time_duration($aSiteInfo['duration']);
     $sTitle = $aSiteInfo['name'];
     $sDesc = $aSiteInfo['description'];
     $sTags = $aSiteInfo['keywords'];
     $sImage = $aSiteInfo['thumbnailUrl'];
     $iDuration = (int) $aSiteInfo['duration'];
     if (empty($sTitle)) {
         return $sErrorReturn;
     }
     $sResult = $this->_embedVideo($sVideoId, $sTitle, $sDesc, $sTags, $sImage, $iDuration);
     return $sResult != '' ? $this->GenJquieryInjection() . $sResult : '';
 }
Esempio n. 7
0
/**
 * Gets multisite url
 *
 * @return string
 */
function osc_multisite_upload_path()
{
    return getSiteInfo('s_upload_path', '');
}
Esempio n. 8
0
 function _addSiteForm()
 {
     bx_sites_import('FormAdd');
     $oForm = new BxSitesFormAdd($this);
     $sMsgBox = '';
     if (isset($_POST['url'])) {
         if (isset($_POST['title'])) {
             $aParam = array('url' => $_POST['url']);
             if (isset($_POST['thumbnail_url'])) {
                 $this->_addThumbToForm($_POST['thumbnail_url'], $aParam);
             }
             $oForm = new BxSitesFormAdd($this, $aParam);
             $oForm->initChecker();
             if ($oForm->isSubmittedAndValid()) {
                 $sCategories = implode(';', array_unique(explode(';', $oForm->getCleanValue('categories'))));
                 $sEntryUri = getEntryUri($_POST['title']);
                 unset($oForm->aInputs['categories']);
                 $aValsAdd = array('date' => time(), 'entryUri' => $oForm->generateUri(), 'status' => $this->_oConfig->_bAutoapprove || $this->isAdmin() ? 'approved' : 'pending', 'categories' => $sCategories);
                 if (isset($_FILES['photo']['tmp_name']) && $_FILES['photo']['tmp_name']) {
                     $aValsAdd['photo'] = $oForm->uploadPhoto($_FILES['photo']['tmp_name']);
                 } else {
                     if (isset($_POST['thumbnail_url'])) {
                         $aValsAdd['photo'] = $oForm->uploadPhoto($_POST['thumbnail_url'], true);
                     }
                 }
                 $aValsAdd['ownerid'] = $this->iOwnerId;
                 if ($iSiteId = $oForm->insert($aValsAdd)) {
                     $this->isAllowedAdd(true);
                     $this->onSiteCreate($iSiteId, $aValsAdd['status']);
                     header('Location:' . BX_DOL_URL_ROOT . $this->_oConfig->getBaseUri() . 'browse/my');
                 } else {
                     $sMsgBox = MsgBox(_t('_bx_sites_error_occured'));
                 }
             }
         } else {
             // check enter URL if available
             // preg_match("/^(http:\/\/{1})((\w+\.){1,})\w{2,}$/i", $url)
             $oForm->initChecker();
             if ($oForm->isSubmittedAndValid()) {
                 $sUrl = $_POST['url'];
                 $sUrlFull = strncasecmp($sUrl, 'http://', 7) != 0 ? 'http://' . $sUrl : $sUrl;
                 $aSite = $this->_oDb->getSiteByUrl($sUrl);
                 if (count($aSite) == 0) {
                     $aInfo = getSiteInfo($sUrlFull);
                     if (!empty($aInfo)) {
                         $aParam = array('url' => $sUrl, 'title' => $aInfo['title'], 'description' => $aInfo['description']);
                         $sThumbUrl = $this->_queryRemoteThumbnail($sUrlFull, array('Size' => 'lg'));
                         if ($sThumbUrl) {
                             $this->_addThumbToForm($sThumbUrl, $aParam);
                         }
                         $oForm = new BxSitesFormAdd($this, $aParam);
                     } else {
                         $sMsgBox = MsgBox(_t('_bx_sites_site_link_error'));
                         $oForm->aInputs['url']['value'] = $sUrl;
                     }
                 } else {
                     header('Location:' . BX_DOL_URL_ROOT . $this->_oConfig->getBaseUri() . 'view/' . $aSite['entryUri']);
                 }
             }
         }
     }
     return $sMsgBox . $this->_oTemplate->parseHtmlByName('form.html', array('form' => $oForm->getCode()));
 }