Commits

Anonymous committed ab283c0

Fixed invalid redirect when a hg repo contains spaces.
Updated version to reflect changes.

  • Participants
  • Parent commits eae5cf5

Comments (0)

Files changed (8)

 http://redirect.joshjcarrier.com/?r=hgwebinstall
 
 More information available on the blog.
-Last updated: 5/16/2010
+Last updated: 5/19/2010
 ==============================
 Author: Josh Carrier <josh@joshjcarrier.com>
 Web: http://redirect.joshjcarrier.com/?r=hgphp

File admin/application/config/config.php

 |	http://example.com/
 |
 */
-//$config['base_url']	= "http://hg-php.joshjcarrier.com/admin/";
 $config['base_url']	= "http://localhost/admin/";
 
 /*

File admin/application/config/hgphp.php

 define('HGPHP_REPO_STATUS_DISABLED', 0);
 define('HGPHP_REPO_STATUS_MISSING', 2);
 
-define('HGPHP_VERSION', '1.0.20100516');
+define('HGPHP_VERSION', '1.0.20100519');
 define('HGPHP_AUTHOR_NAME', 'Josh Carrier');
 define('HGPHP_AUTHOR_LINK', 'http://www.joshjcarrier.com');
 

File admin/application/controllers/hg_manage.php

-<?php
-
-class Hg_Manage extends MY_Controller {
-
-	function Hg_Manage()
-	{
-		parent::MY_Controller();
-		$this->load->library('hg_confparser');
-	}
-	
-	function index()
-	{
-		$this->template->title('Repository Directory', 'Mercurial Repository Manager');
-
-//$this->template->inject_partial('user_err', 'hello world!');
-//$this->template->inject_partial('user_msg', 'hello world!');
-		
-		$lsdir = $this->hg_confparser->lsdir();
-		$this->template->build('repo_directory', array('lsdir'=>$lsdir));
-	}
-	
-	function repo()
-	{
-		$this->load->view('repository');
-	}
-}
-
-/* End of file welcome.php */
-/* Location: ./system/application/controllers/welcome.php */

File admin/application/controllers/hgrepo.php

 	
 	function browse()
 	{
-		$repositoryName = $this->uri->segment(3, 0);
+		$repositoryName = rawurldecode($this->uri->segment(3, 0));
 		
-		if($repositoryName == FALSE || preg_match('/^([a-z0-9\-_])+$/i', $repositoryName)!=1)
+		if($repositoryName == FALSE || preg_match('/^([a-z0-9\-_ ])+$/i', $repositoryName)!=1)
 		{
 			$this->load->helper('url');
 			redirect('/hgdir');
 	
 	function manage()
 	{
-		$repositoryName = $this->uri->segment(3, 0);
+		$repositoryName = rawurldecode($this->uri->segment(3, 0));
 		
-		if($repositoryName == FALSE || preg_match('/^([a-z0-9\-_])+$/i', $repositoryName)!=1)
+		if($repositoryName == FALSE || preg_match('/^([a-z0-9\-_ ])+$/i', $repositoryName)!=1)
 		{
 			$this->load->helper('url');
 			redirect('/hgdir');

File admin/application/views/repo_browse.php

 	<tr>
 	  <td colspan="3" align="right">
 	  	<p>
-	  	<a href="<?php echo site_url('hgrepo/manage/'.$r_name); ?>" class="ui-state-default ui-corner-all dialog_link"><span class="ui-icon"></span><?php echo lang('hgphp_action_update_config'); ?></a>
+	  	<a href="<?php echo site_url('hgrepo/manage/'.rawurlencode($r_name)); ?>" class="ui-state-default ui-corner-all dialog_link"><span class="ui-icon"></span><?php echo lang('hgphp_action_update_config'); ?></a>
 	  	</p>
 	  </td>
 	</tr>	
 	<tr>
 	  <td colspan="3" align="right">
 	  	<p>
-	  	<a href="<?php echo site_url('hgrepo/manage/'.$r_name); ?>" class="ui-state-default ui-corner-all dialog_link"><span class="ui-icon"></span><?php echo lang('hgphp_action_update_config'); ?></a>
+	  	<a href="<?php echo site_url('hgrepo/manage/'.rawurlencode($r_name)); ?>" class="ui-state-default ui-corner-all dialog_link"><span class="ui-icon"></span><?php echo lang('hgphp_action_update_config'); ?></a>
 	  	</p>
 	  </td>
 	</tr>

File admin/application/views/repo_directory.php

 		<input type="checkbox" disabled="disabled"/>
 	  </td>
 	  <td>
-	    <a href="<?php echo site_url('hgrepo/manage/'.$repo['name']); ?>"><?php echo htmlentities($repo['name']); ?></a>
+	    <a href="<?php echo site_url('hgrepo/manage/'.rawurlencode($repo['name'])); ?>"><?php echo htmlentities($repo['name']); ?></a>
 	  </td>
 	  <td>
 	    <?php if($repo['status'] == HGPHP_REPO_STATUS_ENABLED): echo lang('hgphp_repostatus_enabled'); ?>
 	  </td>
 	  <td>
 	  	<?php if($repo['status'] == HGPHP_REPO_STATUS_ENABLED): ?>
-	  	<a href="<?php echo site_url('hgrepo/browse/'.$repo['name']); ?>" class="ui-state-default ui-corner-all dialog_link"><span class="ui-icon"></span><?php echo lang('hgphp_action_browse'); ?></a>
+	  	<a href="<?php echo site_url('hgrepo/browse/'.rawurlencode($repo['name'])); ?>" class="ui-state-default ui-corner-all dialog_link"><span class="ui-icon"></span><?php echo lang('hgphp_action_browse'); ?></a>
 	  	<?php endif; ?>
 	  </td>
 	</tr>

File admin/application/views/repository.php

 	<tr>
 	  <td colspan="3" align="right">
 	  	<p>
-	  	<a href="<?php echo site_url('hgrepo/browse/'.$r_name); ?>" class="ui-state-default ui-corner-all dialog_link"><span class="ui-icon ui-icon-newwin"></span><?php echo lang('hgphp_action_browse'); ?></a>
+	  	<a href="<?php echo site_url('hgrepo/browse/'.rawurlencode($r_name)); ?>" class="ui-state-default ui-corner-all dialog_link"><span class="ui-icon ui-icon-newwin"></span><?php echo lang('hgphp_action_browse'); ?></a>
 	  	<a href="<?php echo site_url('hgdir'); ?>" id="dialog_link_cancel" class="ui-state-default ui-corner-all dialog_link"><span class="ui-icon"></span><?php print lang('hgphp_action_cancel'); ?></a>
-	  	<a href="<?php echo site_url('hgrepo/manage/'.$r_name); ?>" id="dialog_link_reset" class="ui-state-default ui-corner-all dialog_link"><span class="ui-icon"></span><?php print lang('hgphp_action_reset'); ?></a>
+	  	<a href="<?php echo site_url('hgrepo/manage/'.rawurlencode($r_name)); ?>" id="dialog_link_reset" class="ui-state-default ui-corner-all dialog_link"><span class="ui-icon"></span><?php print lang('hgphp_action_reset'); ?></a>
 	  	<a href="#" id="dialog_link_save" class="ui-state-default ui-corner-all dialog_link"><span class="ui-icon"></span><?php print lang('hgphp_action_save'); ?></a>
 	  	</p>
 	  </td>
 	<tr>
 	  <td colspan="3" align="right">
 	  	<p>
-	  	<a href="<?php echo site_url('hgrepo/browse/'.$r_name); ?>" class="ui-state-default ui-corner-all dialog_link"><span class="ui-icon ui-icon-newwin"></span><?php echo lang('hgphp_action_browse'); ?></a>
+	  	<a href="<?php echo site_url('hgrepo/browse/'.rawurlencode($r_name)); ?>" class="ui-state-default ui-corner-all dialog_link"><span class="ui-icon ui-icon-newwin"></span><?php echo lang('hgphp_action_browse'); ?></a>
 	  	<a href="<?php echo site_url('hgdir'); ?>" id="dialog_link2_cancel" class="ui-state-default ui-corner-all dialog_link"><span class="ui-icon"></span><?php print lang('hgphp_action_cancel'); ?></a>
-	  	<a href="<?php echo site_url('hgrepo/manage/'.$r_name); ?>" id="dialog_link2_reset" class="ui-state-default ui-corner-all dialog_link"><span class="ui-icon"></span><?php print lang('hgphp_action_reset'); ?></a>
+	  	<a href="<?php echo site_url('hgrepo/manage/'.rawurlencode($r_name)); ?>" id="dialog_link2_reset" class="ui-state-default ui-corner-all dialog_link"><span class="ui-icon"></span><?php print lang('hgphp_action_reset'); ?></a>
 	  	<a href="#" id="dialog_link2_save" class="ui-state-default ui-corner-all dialog_link"><span class="ui-icon"></span><?php print lang('hgphp_action_save'); ?></a>
 	  	</p>
 	  </td>