Пример #1
0
// Set content type header from the value set by ViewCVS
// No other headers are generated by ViewCVS because in generate_etags
// is set to 0 in the ViewCVS config file
$found = false;
$line = strtok($content, SEPARATOR);
while ($line && !$found) {
    if (preg_match('/^Content-Type:(.*)$/', $line, $matches)) {
        header('Content-Type:' . $matches[1]);
        $found = true;
    }
    $line = strtok(SEPARATOR);
}
$content = substr($content, strpos($content, $line));
if (viewcvs_is_html()) {
    // If we output html and we found the mbstring extension, we
    // should try to encode the output of ViewCVS in UTF-8
    if (extension_loaded('mbstring')) {
        $encoding = mb_detect_encoding($content, 'UTF-8, ISO-8859-1');
        if ($encoding != 'UTF-8') {
            $content = mb_convert_encoding($content, 'UTF-8', $encoding);
        }
    }
    scm_header(array('title' => _('SCM Repository'), 'group' => $Group->getID()));
    echo $content;
    scm_footer(array());
} else {
    // TODO does not seem to work when allow_tar = 1 in ViewCVS conf
    // (allow to generate on the fly a tar.gz): the generated file
    // seems to be corrupted
    echo $content;
}
Пример #2
0
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with GForge; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */
require_once '../../env.inc.php';
require_once $gfwww . 'include/pre.php';
require_once $gfwww . 'scm/include/scm_utils.php';
require_once $gfcommon . 'scm/SCMFactory.class.php';
global $sys_use_scm;
$group_id = getIntFromRequest('group_id');
// Check permissions
session_require(array('group' => $group_id, 'admin_flags' => 'A'));
scm_header(array('title' => _('SCM Repository'), 'group' => $group_id));
if (getStringFromRequest('submit')) {
    $hook_params = array();
    $hook_params['group_id'] = $group_id;
    $scmradio = '';
    $scmvars = array_keys(_getRequestArray());
    foreach (_getRequestArray() as $key => $value) {
        foreach ($scm_list as $scm) {
            if ($key == strstr($key, $scm . "_")) {
                $hook_params[$key] = $value;
            } elseif ($key == 'scmradio') {
                $scmradio = $value;
            }
        }
    }
    $SCMFactory = new SCMFactory();