Example #1
0
 /**
  * The default method that will display the output of this view which is called by
  * Joomla
  *
  * @param	string template	Template file name
  **/
 public function display($tpl = null)
 {
     $document = JFactory::getDocument();
     $params = $this->get('Params');
     //user's email privacy setting
     //CFactory::load( 'libraries' , 'notificationtypes' );
     $notificationTypes = new CNotificationTypes();
     $lists = array();
     for ($i = 1; $i <= 31; $i++) {
         $qscale[] = JHTML::_('select.option', $i, $i);
     }
     $lists['qscale'] = JHTML::_('select.genericlist', $qscale, 'qscale', 'class="inputbox" size="1"', 'value', 'text', $params->get('qscale', '11'));
     $videosSize = array(JHTML::_('select.option', '320x240', '320x240 (QVGA 4:3)'), JHTML::_('select.option', '400x240', '400x240 (WQVGA 5:3)'), JHTML::_('select.option', '400x300', '400x300 (Quarter SVGA 4:3)'), JHTML::_('select.option', '480x272', '480x272 (Sony PSP 30:17)'), JHTML::_('select.option', '480x320', '480x320 (iPhone 3:2)'), JHTML::_('select.option', '480x360', '480x360 (4:3)'), JHTML::_('select.option', '512x384', '512x384 (4:3)'), JHTML::_('select.option', '600x480', '600x480 (4:3)'), JHTML::_('select.option', '640x360', '640x360 (16:9)'), JHTML::_('select.option', '640x480', '640x480 (VCA 4:3)'), JHTML::_('select.option', '800x600', '800x600 (SVGA 4:3)'));
     $lists['videosSize'] = JHTML::_('select.genericlist', $videosSize, 'videosSize', 'class="inputbox" size="1"', 'value', 'text', $params->get('videosSize'));
     $imgQuality = array(JHTML::_('select.option', '60', 'Low'), JHTML::_('select.option', '80', 'Medium'), JHTML::_('select.option', '90', 'High'), JHTML::_('select.option', '95', 'Very High'));
     $lists['imgQuality'] = JHTML::_('select.genericlist', $imgQuality, 'output_image_quality', 'class="inputbox" size="1"', 'value', 'text', $params->get('output_image_quality'));
     //album mode
     $albumMode = array(JHTML::_('select.option', '0', JText::_('COM_COMMUNITY_SAME_WINDOW')), JHTML::_('select.option', '1', JText::_('COM_COMMUNITY_MODAL_WINDOW')));
     $lists['albumMode'] = JHTML::_('select.genericlist', $albumMode, 'album_mode', 'class="inputbox" size="1"', 'value', 'text', $params->get('album_mode'));
     //video mode
     $videoMode = array(JHTML::_('select.option', '0', JText::_('COM_COMMUNITY_SAME_WINDOW')), JHTML::_('select.option', '1', JText::_('COM_COMMUNITY_MODAL_WINDOW')));
     $lists['videoMode'] = JHTML::_('select.genericlist', $videoMode, 'video_mode', 'class="inputbox" size="1"', 'value', 'text', $params->get('video_mode'));
     //video native
     $videoNative = array(JHTML::_('select.option', '0', JText::_('COM_COMMUNITY_STREAM_VIDEO_PLAYER_MEDIAELEMENT')), JHTML::_('select.option', '1', JText::_('COM_COMMUNITY_STREAM_VIDEO_PLAYER_NATIVE')));
     $lists['videoNative'] = JHTML::_('select.genericlist', $videoNative, 'video_native', 'class="inputbox" size="1"', 'value', 'text', $params->get('video_native'));
     // Group discussion order option
     $groupDiscussionOrder = array(JHTML::_('select.option', 'ASC', 'Older first'), JHTML::_('select.option', 'DESC', 'Newer first'));
     $lists['groupDicussOrder'] = JHTML::_('select.genericlist', $groupDiscussionOrder, 'group_discuss_order', 'class="inputbox" size="1"', 'value', 'text', $params->get('group_discuss_order'));
     $videoThumbSize = array(JHTML::_('select.option', '320x180', '320x180'), JHTML::_('select.option', '640x360', '640x360'), JHTML::_('select.option', '1280x720', '1280x720'));
     $lists['videoThumbSize'] = JHTML::_('select.genericlist', $videoThumbSize, 'videosThumbSize', 'class="inputbox" size="1"', 'value', 'text', $params->get('videosThumbSize'));
     $dstOffset = array();
     $counter = -4;
     for ($i = 0; $i <= 8; $i++) {
         $dstOffset[] = JHTML::_('select.option', $counter, $counter);
         $counter++;
     }
     $watermarkPosition = array(JHTML::_('select.option', 'left_top', JText::_('COM_COMMUNITY_CONFIGURATION_PHOTOS_WATERMARK_POSITION_LFFT_TOP')), JHTML::_('select.option', 'left_bottom', JText::_('COM_COMMUNITY_CONFIGURATION_PHOTOS_WATERMARK_POSITION_LFFT_BOTTOM')), JHTML::_('select.option', 'right_top', JText::_('COM_COMMUNITY_CONFIGURATION_PHOTOS_WATERMARK_POSITION_RIGHT_TOP')), JHTML::_('select.option', 'right_bottom', JText::_('COM_COMMUNITY_CONFIGURATION_PHOTOS_WATERMARK_POSITION_RIGHT_BOTTOM')));
     $lists['watermarkPosition'] = JHTML::_('select.genericlist', $watermarkPosition, 'watermark_position', 'class="inputbox" size="1"', 'value', 'text', $params->get('watermark_position'));
     $lists['dstOffset'] = JHTML::_('select.genericlist', $dstOffset, 'daylightsavingoffset', 'class="inputbox" size="1"', 'value', 'text', $params->get('daylightsavingoffset'));
     $networkModel = $this->getModel('network', false);
     $JSNInfo = $networkModel->getJSNInfo();
     $JSON_output = $networkModel->getJSON();
     $lists['enable'] = JHTML::_('select.booleanlist', 'network_enable', 'class="inputbox"', $JSNInfo['network_enable']);
     $uploadLimit = ini_get('upload_max_filesize');
     $uploadLimit = CString::str_ireplace('M', ' MB', $uploadLimit);
     require_once JPATH_ROOT . '/administrator/components/com_community/libraries/autoupdate.php';
     $isuptodate = CAutoUpdate::checkUpdate();
     $this->assign('JSNInfo', $JSNInfo);
     $this->assign('JSON_output', $JSON_output);
     $this->assign('lists', $lists);
     $this->assign('uploadLimit', $uploadLimit);
     $this->assign('config', $params);
     $this->assign('isuptodate', $isuptodate);
     $this->assign('notificationTypes', $notificationTypes);
     parent::display($tpl);
 }
Example #2
0
    ?>
                    <p><img src="<?php 
    echo COMMUNITY_ASSETS_URL;
    ?>
/images/notice-success.png"> <?php 
    echo JText::_('COM_COMMUNITY_CONFIGURATION_AUTOUPDATE_UPTODATE_MSG');
    ?>
</p>
                    <?php 
} else {
    ?>
                    <p><img src="<?php 
    echo COMMUNITY_ASSETS_URL;
    ?>
/images/notice-notice.png"> <?php 
    $err = CAutoUpdate::getError();
    echo array_shift($err);
    ?>
</p>
					<?php 
}
?>
					<input data-inprogresstext="<?php 
echo JText::_('COM_COMMUNITY_CONFIGURATION_AUTOUPDATE_INPROGRESS');
?>
" type="button" id="autoupdatesubmit" name="checkautoupdate" value="<?php 
echo JText::_('COM_COMMUNITY_CONFIGURATION_CHECK_AUTOUPDATE');
?>
" onclick="azcommunity.runAutoUpdate(); return false;" />&nbsp;&nbsp;<img style="display:none;" class="autoupdate-loader" src="<?php 
echo COMMUNITY_BASE_ASSETS_URL;
?>
Example #3
0
 /**
  * Set Error Message
  *
  * @param string error message
  * @return array error list
  */
 private static function setError($errmsg)
 {
     $err = self::$error;
     $err[] = $errmsg;
     self::$error = $err;
     return self::$error;
 }
Example #4
0
 public function ajaxAutoupdate($ordercode = '', $email = '')
 {
     //do save config first
     if (!empty($ordercode) && !empty($email)) {
         $config = JTable::getInstance('configuration', 'CommunityTable');
         $config->load('config');
         $config->name = 'config';
         $params = new JRegistry($config->params);
         $params->set('autoupdateordercode', $ordercode);
         $params->set('autoupdateemail', $email);
         $config->params = $params->toString();
         $saved = $config->store();
     }
     require_once JPATH_ROOT . '/administrator/components/com_community/libraries/autoupdate.php';
     //Check update
     $res = CAutoUpdate::getUpdate();
     @ob_end_clean();
     $objResponse = new JAXResponse();
     if (!$res) {
         $msg = implode("\n", CAutoUpdate::getError());
         $objResponse->addScriptCall('joms.jQuery(".autoupdate-loader").hide(); ');
         $objResponse->addScriptCall('joms.jQuery("#autoupdateordercode,#autoupdateemail,#autoupdatesubmit").removeAttr("disabled");');
         $objResponse->addScriptCall('joms.jQuery("#autoupdatesubmit").val("' . JText::_('COM_COMMUNITY_CONFIGURATION_CHECK_AUTOUPDATE') . '");');
         $objResponse->addScriptCall('alert("' . JText::sprintf('COM_COMMUNITY_CONFIGURATION_AUTOUPDATE_ERROR', $msg) . '");');
         return $objResponse->sendResponse();
     }
     $objResponse->addScriptCall('joms.jQuery(".autoupdate-loader").hide(); ');
     $objResponse->addScriptCall('joms.jQuery("#autoupdateordercode,#autoupdateemail,#autoupdatesubmit").removeAttr("disabled");');
     $objResponse->addScriptCall('joms.jQuery("#autoupdatesubmit").val("' . JText::_('COM_COMMUNITY_CONFIGURATION_CHECK_AUTOUPDATE') . '");');
     if ($res) {
         jimport('joomla.installer.installer');
         jimport('joomla.installer.helper');
         //$package = JInstallerHelper::unpack($res);
         //Adapted from JInstallerHelper::unpack
         // Path to the archive =========
         $archivename = $res;
         // Temporary folder to extract the archive into
         $tmpdir = uniqid('install_');
         // Clean the paths to use for archive extraction
         $extractdir = JPath::clean(dirname($res) . '/' . $tmpdir);
         $archivename = JPath::clean($archivename);
         // Do the unpacking of the archive
         $result = JArchive::extract($archivename, $extractdir);
         if ($result === false) {
             $objResponse->addScriptCall('joms.jQuery(".autoupdate-loader").hide();');
             $objResponse->addScriptCall('joms.jQuery(".do-download-update").remove();');
             $objResponse->addScriptCall('alert("JomSocial package cannot be unpacked.")');
             return $objResponse->sendResponse();
         }
         $appszip = false;
         $extractdirfiles = scandir($extractdir);
         //error_log(print_r($extractdirfiles, true));
         foreach ($extractdirfiles as $f) {
             if (strpos($f, 'com_community_') !== FALSE) {
                 //error_log('DIR: '.$extractdir.'/'.$f);
                 $package = JInstallerHelper::unpack($extractdir . '/' . $f);
             }
         }
         //shouldnt be empty here, something's wrong with the package
         if (empty($package)) {
             $objResponse->addScriptCall('joms.jQuery(".autoupdate-loader").hide();');
             $objResponse->addScriptCall('joms.jQuery(".do-download-update").remove();');
             $objResponse->addScriptCall('alert("' . JText::_('COM_COMMUNITY_CONFIGURATION_AUTOUPDATE_ERROR_NO_COMPONENT') . '")');
             return $objResponse->sendResponse();
         }
         //error_log( 'PACKAGE:'. print_r($package,true) );
         // Get an installer instance
         //
         //$installer = JInstaller::getInstance();
         //$installer->install($package['dir']);
         $objResponse->addScriptCall('joms.jQuery(".autoupdate-loader").hide();');
         $objResponse->addScriptCall('joms.jQuery(".do-download-update").remove();');
         $objResponse->addScriptCall('joms.jQuery("#autoupdate-progress").empty();');
         $objResponse->addScriptCall("joms.jQuery('#autoupdatesubmit').after(' <form onsubmit=\"return confirm(\\'" . JText::_('COM_COMMUNITY_CONFIGURATION_AUTOUPDATE_ASK_PROCEED') . "\\');\" class=\"do-download-update\" style=\"display:inline\" method=\"post\" action=\"" . JURI::base() . "index.php?option=com_installer&view=install\"><input type=\"hidden\" name=\"install_directory\" value=\\'" . $package['extractdir'] . "\\'><input type=\"hidden\" name=\"task\" value=\"install.install\"><input type=\"hidden\" name=\"installtype\" value=\"folder\"><input type=\"submit\" value=\"" . JText::_('COM_COMMUNITY_CONFIGURATION_AUTOUPDATE_INSTALL_BUTTON') . "\" />" . JHTML::_('form.token') . "</form>');");
     }
     return $objResponse->sendResponse();
 }