Exemple #1
0
/**
 * Resolve a given path against currently defined include paths
 * @param string unresolved relative path
 * @param string optional current working directory
 * @param array optional additional paths to search
 * @param bool optionally avoid using include_path ini setting
 * @return string full path to resolved location
 */
function findpath($f, $cwd = '.', array $extra = null, $noini = false)
{
    if ($f == '') {
        return $cwd;
    }
    if ($f[0] === '/') {
        return cleanpath($f);
    }
    $incs = $noini ? array() : explode(':', ini_get('include_path'));
    if (!is_null($extra)) {
        $incs = array_merge($incs, $extra);
    }
    foreach ($incs as $inc) {
        if ($inc === '.') {
            // current dir
            $inc = $cwd;
        } else {
            if ($inc[0] !== '/') {
                // relative path as include path, bad idea
                $inc = $cwd . $inc;
            }
        }
        if ($f[0] !== '/' && substr($inc, -1, 1) !== '/') {
            // glue required
            $path = $inc . '/' . $f;
        } else {
            // already has glue
            $path = $inc . $f;
        }
        if (file_exists($path)) {
            return cleanpath($path);
        }
    }
    // no path matched
    return null;
}
 /**
  * @internal
  * @param array token for directive, e.g. [T_STRING,'import']
  * @param array all tokens with pointer at start of statement
  * @param bool
  * @return string source to substitute for statement
  */
 private function handle_inc_statement(array $tok, array &$tokens, $path)
 {
     $func = $tok[1];
     // gather entire statement up to next `;'
     // warning: if you do something like "import() or die();" parsing will fail.
     $src = $tok[1];
     $inctokens = array($tok);
     $pathargs = array();
     while ($inctok = next($tokens)) {
         $inctokens[] = $inctok;
         $src .= is_scalar($inctok) ? $inctok : $inctok[1];
         if ($inctok === ';') {
             break;
         }
     }
     // hand off to any special cases
     switch ($func) {
         case 'import_return_value':
             return $this->import_return_value($src);
     }
     // The remaining directives require compilation of simple string arguments.
     // Attempt parse - will throw on error ...
     $Compiler = new IncParser();
     try {
         $Stat = $Compiler->parse($inctokens);
         // ensure current __FILE__ reference is correct as it may be referenced in include statement
         $consts = $this->conf_consts;
         $consts['__FILE__'] = $path;
         $pathargs = $Stat->get_args($consts, $this->conf_vars);
     } catch (Exception $Ex) {
         trigger_error("Failed to parse `{$func}' directive in `{$path}', line {$tok[2]}: " . $Ex->getMessage(), E_USER_WARNING);
         // return empty statement with commented error in case of error
         return sprintf('/* Failed to parse %s directive */;', $func);
     }
     // process all arguments according to directive type
     $src = '';
     foreach ($pathargs as $arg) {
         $arg = cleanpath($arg);
         switch ($func) {
             case 'import':
                 $s = $this->compile_import($arg);
                 break;
             case 'include':
             case 'require':
             case 'include_once':
             case 'require_once':
                 $s = $this->compile_php($arg, $func);
                 break;
             case 'virtual':
                 $s = $this->compile_virtual($arg);
                 break;
         }
         // handle error if no source returned
         if (is_null($s)) {
             $this->open_php($src);
             $src .= "{$func} (" . var_export($arg, 1) . "); // <- failed \n";
         } else {
             $src .= $s;
         }
     }
     // handle php state, when we return to where this directive was found, we are expected to still be in php
     $this->open_php($src);
     return $src;
 }
Exemple #3
0
    /**
     * Quick and nice way to output mixed variable(s) to the browser
     */
    public function dumpAsHtml()
    {
        $arguments = func_get_args();
        $total = count($arguments);
        $backtrace = debug_backtrace();
        // locate the first file entry that isn't this class itself
        foreach ($backtrace as $stack => $trace) {
            if (isset($trace['file'])) {
                // If being called from within, or using call_user_func(), get the next entry
                if (strpos($trace['function'], 'call_user_func') === 0 or isset($trace['class']) and $trace['class'] == get_class($this)) {
                    continue;
                }
                $callee = $trace;
                $label = $this->inflector->humanize($backtrace[$stack + 1]['function']);
                // get info about what was dumped
                $callee['code'] = '';
                for ($i = $callee['line']; $i > 0; $i--) {
                    $line = $this->fileLines($callee['file'], $i, false, 0);
                    $callee['code'] = reset($line) . ' ' . trim($callee['code']);
                    $tokens = token_get_all('<?php ' . trim($callee['code']));
                    if (is_array($tokens[1]) and isset($tokens[1][0]) and $tokens[1][0] != 377) {
                        break;
                    }
                }
                $results = array();
                $r = false;
                $c = 0;
                foreach ($tokens as $token) {
                    // skip everything before our function call
                    if ($r === false) {
                        if (isset($token[1]) and $token[1] == $callee['function']) {
                            $r = 0;
                        }
                        continue;
                    }
                    // and quit if we find an end-of-statement
                    if ($token == ';') {
                        break;
                    } elseif ($token == '(') {
                        $c++;
                        if ($c === 1) {
                            continue;
                        }
                    } elseif ($token == ')') {
                        $c--;
                        if ($c === 0) {
                            $r++;
                            continue;
                        }
                    } elseif ($token == ',' and $c === 1) {
                        $r++;
                        continue;
                    }
                    // make sure we have an array entry to add to, and add the token
                    if (!isset($results[$r])) {
                        $results[$r] = '';
                    }
                    $results[$r] .= is_array($token) ? $token[1] : $token;
                }
                // make sure we've parsed the same number of expressions as we have arguments
                if (count($results) == $total) {
                    $callee['code'] = $results;
                } else {
                    // parsing failed, try it the old fashioned way
                    if (preg_match('/(.*' . $callee['function'] . '\\()(.*?)\\);(.*)/', $callee['code'], $matches)) {
                        $callee['code'] = 'Variable' . ($total == 1 ? '' : 's') . ' dumped: ' . $matches[2];
                    }
                }
                $callee['file'] = cleanpath($callee['file']);
                break;
            }
        }
        if (!$this->jsDisplayed) {
            echo <<<JS
<script type="text/javascript">function fuel_debug_toggle(a){if(document.getElementById){if(document.getElementById(a).style.display=="none"){document.getElementById(a).style.display="block"}else{document.getElementById(a).style.display="none"}}else{if(document.layers){if(document.id.display=="none"){document.id.display="block"}else{document.id.display="none"}}else{if(document.all.id.style.display=="none"){document.all.id.style.display="block"}else{document.all.id.style.display="none"}}}};</script>
JS;
            $this->jsDisplayed = true;
        }
        echo '<div class="fuelphp-dump" style="font-size: 13px;background: #EEE !important; border:1px solid #666; color: #000 !important; padding:10px;">';
        echo '<h1 style="padding: 0 0 5px 0; margin: 0; font: bold 110% sans-serif;">File: ' . $callee['file'] . ' @ line: ' . $callee['line'] . '</h1>';
        if (is_string($callee['code'])) {
            echo '<h5 style="border-bottom: 1px solid #CCC;padding: 0 0 5px 0; margin: 0 0 5px 0; font: bold 85% sans-serif;">' . $callee['code'] . '</h5>' . PHP_EOL;
        }
        echo '<pre style="overflow:auto;font-size:100%;">';
        $i = 0;
        foreach ($arguments as $argument) {
            if (is_string($callee['code'])) {
                echo '<strong>Variable #' . ++$i . ' of ' . $total . ':</strong>' . PHP_EOL;
            } elseif (substr(trim($callee['code'][$i]), 0, 1) == '$') {
                echo '<strong>Variable: ' . trim($callee['code'][$i++]) . '</strong>' . PHP_EOL;
            } else {
                echo '<strong>Expression: ' . trim($callee['code'][$i++]) . '</strong>' . PHP_EOL;
            }
            echo $this->format('', $argument);
            if ($i < $total) {
                echo PHP_EOL;
            }
        }
        echo "</pre>";
        echo "</div>";
    }
Exemple #4
0
function ftpadd_theme()
{
    global $user, $globals, $l, $theme, $softpanel, $iscripts, $catwise, $error, $done;
    // For adding FTP User
    if (optGET('ajaxftp')) {
        if (!empty($error)) {
            echo '0' . current($error);
            return false;
        }
        // Creating new table for display new DB
        if (!empty($done)) {
            echo '1' . $l['change_final'];
            return true;
        }
    }
    softheader($l['<title>']);
    echo '<center class="sai_tit"><img src="' . $theme['a_images'] . 'addftp.gif" />' . $l['ftp'] . '</center>
<img src="' . $theme['images'] . 'hr.jpg" width="100%" height="1" alt="" /><br /><br />';
    error_handle($error, '100%');
    echo '<script language="javascript" type="text/javascript"><!-- // --><![CDATA[

	var message_box = function(){			
		return {
			show_message: function(title, body , image) {			
				var okbutton = \'<input  style="width:75px" class="sai_submit" type="button" onclick="message_box.close_message();" value="OK" />\';
				if(image == "1"){
					var img = \'<img src="' . $theme['images'] . 'error.gif" />\';
				}else{
					var img = \'<img src="' . $theme['images'] . 'confirm.gif" />\';			
				}
									
				if(jQuery(\'.sai_message_box\').html() === null) {
					var message = \'<div class="sai_message_box"><table border="0" cellpadding="8" width="100%" height="100%"><tr ><td rowspan="2" width="40%" > \'+ img + \'</td><td width="60%" class ="msg_tr1">\' +  title + \'</td></tr><tr class ="msg_tr2"><td style="text-align:left">\' + body + \'</td></tr><tr ><td colspan="2" class ="msg_tr3">\' + okbutton + \'</td></tr></table></div>\';
					jQuery(document.body).append( message );								
					jQuery(\'.sai_message_box\').css(\'top\', jQuery(\'html, body\').scrollTop() + 150);
					jQuery(\'.sai_message_box\').show(\'slow\');
				}else{
					var message =\' <table border="0" width="100%" cellpadding="8" height="100%"><tr ><td rowspan="2" width="40%">\'+ img +  \'</td><td widt="60%" class ="msg_tr1">\' + title + \'</td></tr><tr class ="msg_tr2"><td style="text-align:left">\' + body + \'</td></tr><tr ><td colspan="2" class ="msg_tr3">\' + okbutton + \'</td></tr></table>\';				
					jQuery(\'.sai_message_box\').css(\'top\', jQuery(\'html, body\').scrollTop() + 150);
					jQuery(\'.sai_message_box\').show(\'slow\');
					jQuery(\'.sai_message_box\').html( message );
				}
			},
			close_message: function() {
				jQuery(\'.sai_message_box\').hide(\'fast\');
			}
		}
	}();

	$(document).ready(function(){
			
			// For creating FTP accounts 
			$("#submitftp").click(function(){
				$("#createftp").css("display", "");	
				var login = ($("#login").val());
				var newpass = ($("#newpass").val());
				var conf = ($("#conf").val());
				var dir = ($("#dir").val());
				$.ajax({
					type: "POST",
					url: window.location+"&create_acc=1&ajaxftp=1",					
					data: "login="******"&newpass="******"&conf="+conf+"&dir="+dir,
					
					// Checking for error
					success: function(data){
						$("#createftp").css("display", "none");
						var result = data.substring(0,1);
						if(result == "1"){
							$_("login").value="";
							$_("newpass").value="";
							$_("conf").value="";
							$_("dir").value="";
							var msg = data.substring(1);
							message_box.show_message( "Done ",msg,2);																					
						}
						if(result == "0"){	
							$("#createmx").css("display", "none");
							var msg = data.substring(1);
							message_box.show_message( "Error",msg,1);
						}
					},
					error: function() {
						message_box.show_message("Error",\'' . $l['connect_error'] . '\',1);						
					}															
				});													
			});	
	});
	
	var dir = false;
	function suggestdompath(domval){
		if(dir){
			return true;	
		}
		$_("dir").value = "' . cleanpath($softpanel->user['homedir']) . '/www/"+$_("login").value;
	}
	// ]]></script>
	
<form accept-charset="' . $globals['charset'] . '" action="" method="post" name="ftp_account">
<table border="0" cellpadding="8" cellspacing="8" width="100%">
	<tr>
		<td width="35%">
			<span class="sai_head">' . $l['loginname'] . '</span><br />
		</td>		
		<td> 
			<input type="text" name="login" id="login" size="30" onkeyup="suggestdompath(this);" size="30" value="' . POSTval('login', '') . '" />
		</td>
	</tr>
	<tr>
		<td>
			<span class="sai_head">' . $l['new_pass'] . '</span><br />
		</td>		
		<td> 
			<input type="password" name="newpass" id="newpass" size="30" value="" />
		</td>
	</tr>
	<tr>
		<td>
			<span class="sai_head">' . $l['retype_pass'] . '</span><br />
		</td>		
		<td> 
			<input type="password" name="conf" id="conf" size="30" value="" />
		</td>
	</tr>
	<tr>
		<td>
			<span class="sai_head">' . $l['directory'] . '</span><br /><span class="sai_exp">' . $l['path'] . '</span>			
		</td>				
		<td> 
			<input type="text" name="dir" id="dir" size="30"  value="' . stripslashes(POSTval('dir', cleanpath($softpanel->path) . '/www/')) . '" onfocus="" />
			<script language="javascript" type="text/javascript"><!-- // --><![CDATA[
			//Add an event handler
			$_("dir").onkeydown = function(){
				dir = true;
			}
			// ]]></script>
		</td>
	</tr>
</table>
<table border="0" width="100%">
<td align="left" width="40%"><a href="http://' . $_SERVER['HTTP_HOST'] . '/ampps/index.php?act=ftpmanage">' . $l['lbl_ftp_manage'] . '</a></td>
<td align="left"><input type="button" style="cursor:pointer" value="' . $l['submit_button'] . '" name="create_acc" class="sai_submit" id="submitftp" /> &nbsp;<img id="createftp" src="' . $theme['images'] . 'progress.gif" style="display:none"></td></table>
</form>';
    softfooter();
}
Exemple #5
0
function publish_theme()
{
    global $theme, $globals, $softpanel, $user, $l, $error, $iscripts, $scripts, $insid, $software, $p, $configure, $_chmod, $done, $soft;
    // Give the staus
    if (optGET('ajaxstatus')) {
        $_status = soft_progress(optGET('ajaxstatus'));
        if (is_array($_status)) {
            echo implode('|', $_status);
            return true;
        }
        // False call
        echo 0;
        return false;
    }
    softheader($l['<title>']);
    echo '<center class="sai_tit"><img src="' . $theme['images'] . 'publish_dp.gif" />&nbsp; &nbsp;' . $l['header'] . '</center>
<img src="' . $theme['images'] . 'hr.jpg" width="100%" height="1" alt="" /><br /><br />

<div id="entire_win">';
    if (!empty($done)) {
        echo '<div class="sai_notice"><img src="' . $theme['images'] . 'success.gif" /> &nbsp; ' . $l['done'] . '</div><br />
' . lang_vars($l['succesful'], array($software['name'])) . ' : <br />
<a href="' . $p->settings['new_softurl'] . '" target="_blank">' . $p->settings['new_softurl'] . '</a>
' . (!empty($software['adminurl']) ? '<br />' . $l['admin_url'] . ' : <a href="' . $p->settings['new_softurl'] . '/' . $software['adminurl'] . '" target="_blank">' . $p->settings['new_softurl'] . '/' . $software['adminurl'] . '</a>' : '') . '<br /><br />
' . $l['enjoy'] . '<br /><br />
' . (!empty($notes) ? $l['publish_notes'] . ' : <br />
<div class="sai_notes">' . softparse($notes, $soft) . '</div><br /><br />' : '') . '
' . $l['please_note'] . '<br /><br />
' . $l['regards'] . ',<br />
' . $l['softinstaller'] . '<!--PROC_DONE-->';
    } else {
        echo '<script language="javascript" type="text/javascript"><!-- // --><![CDATA[

function checkform(dosubmit){
	
	$_("softsubmitbut").disabled = true;	
	//return true;
	
	// Send a request to check the status
	progressbar.start();
	
	// Return false so that the form is not submitted directly
	return false;
	
};

var progressbar = {
	timer: 0,
	total_width: 0,	
	status_key: "",
	synctimer: 0,
	fadeout_div: "#fadeout_div",
	win_div: "#entire_win",
	progress_div: "#progress_bar",
	formid: "#publishins",
	frequency: 3000,
	
	current: function(){
		try{
			return Math.round(parseInt($_("progress_color").width)/parseInt($_("table_progress").width)*100);
		}catch(e){
			return -1;	
		}
	},
	
	reset: function(){ try{
		clearTimeout(this.timer);
		$_("progress_color").width = 1;
	}catch(e){ }},
	
	move: function(dest, speed, todo){ try{
		var cur = this.current();
		if(cur < 0){
			clearTimeout(this.timer);
			return false;
		}
		var cent = cur + 1;
		var new_width = cent/100*this.total_width;
		if(new_width < 1){
			new_width = 1;
		}
		//alert(new_width+" "+dest+" "+cent);
		
		$_("progress_color").width = new_width;
		$_("progress_percent").innerHTML = "("+cent+" %)";
		
		if(cent < dest){
			this.timer = setTimeout("progressbar.move("+dest+", "+speed+")", speed);
		}else{
			eval(todo);	
		}
	}catch(e){ }},
	
	text: function(txt){ try{
		$_("progress_txt").innerHTML = txt;
	}catch(e){ }},
	
	sync: function(){
		if(progressbar.status_key.length < 2){
			return false;
		}
		$.ajax({
			url: window.location+"&ajaxstatus="+progressbar.status_key+"&random="+Math.random(),
			type: "GET",
			success: function(data){
				if(data == 0) return false;
				var tmp = data.split("|");
				var cur = progressbar.current();
				tmp[2] = (3000/(tmp[0]-cur));
				//alert(tmp);
				if(tmp[0] > cur){
					if(parseInt(tmp[2]) == 0){
						tmp[2] = 800;
					}
					progressbar.move(tmp[0], tmp[2]);
				}
				progressbar.text(tmp[1]);
				progressbar.synctimer = setTimeout("progressbar.sync()", progressbar.frequency);
			}
		});
	},
	
	sync_abort: function(){
		clearTimeout(this.synctimer);
	},
	
	start: function(){ try{
		this.post();
		this.reset();
		this.total_width = parseInt($_("table_progress").width);
		this.move(3, 800);
		this.status_key = $("#soft_status_key").attr("value");
		this.sync();
	}catch(e){ }},
	
	post: function(){
		
		// Scroll to the Top and show the progress bar
		goto_top();
		$(progressbar.fadeout_div).fadeOut(500, 
			function(){
				$(progressbar.progress_div).fadeOut(1);
				$(progressbar.progress_div).fadeIn(500);
			}
		);
		
		$.ajax({
			url: window.location+"&jsnohf=1",
			type: "POST",
			data: $(progressbar.formid).serialize(),
			complete: function( jqXHR, status, responseText ) {
				
				progressbar.sync_abort();
				
				// Store the response as specified by the jqXHR object
				responseText = jqXHR.responseText;
				
				try{
					//alert(responseText);
					if(responseText.match(/\\<\\!\\-\\-PROC_DONE\\-\\-\\>/gi)){
						progressbar.text("' . addslashes($l['finishing_process']) . '");
						progressbar.move(99, 10, "$(progressbar.progress_div).fadeOut(1)");
					}else{
						progressbar.reset();
					}
				}catch(e){ }
				
				if ( jqXHR.isResolved() ) {
				
					// #4825: Get the actual response in case
					// a dataFilter is present in ajaxSettings
					jqXHR.done(function( r ) {
						responseText = r;
					});
			
					// Create a dummy div to hold the results
					// inject the contents of the document in, removing the scripts
					// to avoid any "Permission Denied" errors in IE
					var newhtml = jQuery("<div>").append(responseText).find(progressbar.win_div).html();
					
					$(progressbar.win_div).animate({opacity: 0}, 1000, "", function(){
						$(progressbar.win_div).html(newhtml);
					}).delay(50).animate({opacity: 1}, 500);
					
					//alert(newhtml);
					
				}else{
					alert("Oops ... the connection was lost");
				}
			}
		});
	}
};

// ]]></script>

<div id="progress_bar" style="height:125px; display: none;">
	<br /><br />
	<center>
	<font size="4" color="#222222" id="progress_txt">' . $l['checking_data'] . '</font>
	<font style="font-size: 18px;font-weight: 400;color: #444444;" id="progress_percent">(0 %)</font><br /><br />
	</center>
	<table width="500" cellpadding="0" cellspacing="0" id="table_progress" border="0" align="center" height="28" style="border:1px solid #CCC; -moz-border-radius: 5px;
-webkit-border-radius: 5px; border-radius: 5px;">
		<tr>
			<td id="progress_color" width="1" style="background-image: url(' . $theme['images'] . 'bar.gif); -moz-border-radius: 4px; -webkit-border-radius: 4px; border-radius: 4px;"></td>
			<td id="progress_nocolor">&nbsp;</td>
		</tr>
	</table>
</div>

<div id="fadeout_div">';
        error_handle($error, '100%');
        echo '<form accept-charset="' . $globals['charset'] . '" name="publishins" id="publishins" method="post" action="" onsubmit="return checkform();">

<table border="0" cellpadding="8" cellspacing="0" width="100%">
	<tr>
		<td width="40%">
			<span class="sai_head">' . $l['choose_account'] . '</span><br />
			<span class="sai_exp">' . $l['choose_account_exp'] . '</span>
		</td>
		<td>
			<select name="remid" id="remid">';
        foreach ($user['remote'] as $k => $v) {
            echo '<option value="' . $k . '" ' . POSTselect('remid', $k) . '>' . $v['domain_name'] . '</option>';
        }
        echo '</select>
		</td>
	</tr>';
        $defaultdir = basename($user['ins'][$insid]['softpath']);
        // Is it the home folder of a domain ?
        foreach ($softpanel->domainroots as $k => $v) {
            if (strtolower(cleanpath($user['ins'][$insid]['softpath'])) == strtolower(cleanpath($v))) {
                $defaultdir = '';
            }
        }
        echo '<tr>
		<td>
			<span class="sai_head">' . $l['dir'] . '</span><br />
			<span class="sai_exp">' . $l['dir_exp'] . '</span>
		</td>
		<td>
			<input type="text" name="dir" id="dir" size="30" value="' . POSTval('dir', $defaultdir) . '" />
		</td>
	</tr>
	
	<tr>
		<td>
			<span class="sai_head">' . $l['password'] . '</span><br />
			<span class="sai_exp">' . $l['password_exp'] . '</span>
		</td>
		<td>
			<input type="password" name="password" id="password" size="30" value="' . POSTval('password', '') . '" />
		</td>
	</tr>
</table>

<p align="center">
<input type="hidden" name="publishins" id="publishins" value="' . $l['publishins'] . '" />
<input type="submit" name="softsubmitbut" id="softsubmitbut" value="' . $l['publishins'] . '" class="sai_graybluebut" />
</p>
<input type="hidden" name="soft_status_key" id="soft_status_key" value="' . POSTval('soft_status_key', generateRandStr(32)) . '" />
</form>
</div>';
    }
    echo '</div>
<br /><br /><br />
<center><b><a href="' . script_link($soft) . '">' . $l['return'] . '</a></b></center>';
    softfooter();
}
Exemple #6
0
 /**
  * Gets a glob of a directory.
  * 
  * @param string $dir Directory path to glob.
  * @return array Glob of directory.
  */
 public function glob($dir)
 {
     $dir = cleanpath($dir);
     if (isset($this->globs[$dir])) {
         return $this->globs[$dir];
     }
     return $this->globs[$dir] = glob($dir . '/*', GLOB_MARK | GLOB_NOSORT | GLOB_NOESCAPE);
 }
Exemple #7
0
function alias_theme()
{
    global $user, $globals, $l, $theme, $softpanel, $iscripts, $catwise, $error;
    global $insid, $backed, $software, $soft, $done;
    global $alias_list;
    if (optGET('ajaxdel')) {
        if (!empty($error)) {
            echo '0' . current($error);
            return false;
        }
        if (!empty($done)) {
            echo '1' . $l['delete'];
            return true;
        }
    }
    if (optGET('ajaxalias')) {
        if (!empty($error)) {
            echo '0' . current($error);
            return false;
        }
        // Creating new table for display new DB
        if (!empty($done)) {
            $alias_list = $softpanel->alias();
            echo '1 Alias Created Successfully';
            alias_table();
            return true;
        }
    }
    softheader($l['<title>']);
    error_handle($error, '100%');
    echo '<script language="javascript" type="text/javascript"><!-- // --><![CDATA[

	var dompath = false;
	
	// For msgbox
	var message_box = function() {
		return {
			show_message: function(title, body , image) {
				var okbutton = \'<input  style="width:75px" class="sai_submit" type="button" onclick="message_box.close_message();" value="OK" />\';
				if(image == "1"){
					var img = \'<img src="' . $theme['images'] . 'error.gif" />\';
				}else{
					var img = \'<img src="' . $theme['images'] . 'confirm.gif" />\';
				}
				if(jQuery(\'.sai_message_box\').html() === null) {
					var message = \'<div class="sai_message_box"><table border="0" cellpadding="8" width="100%" height="100%"><tr ><td rowspan="2" width="40%" > \'+ img + \'</td><td width="60%" class ="msg_tr1">\' +  title + \'</td></tr><tr class ="msg_tr2"><td style="text-align:left">\' + body + \'</td></tr><tr ><td colspan="2" class ="msg_tr3">\' + okbutton + \'</td></tr></table></div>\';
					jQuery(document.body).append( message );
					jQuery(\'.sai_message_box\').css(\'top\', jQuery(\'html, body\').scrollTop() + 150);
					jQuery(\'.sai_message_box\').show(\'slow\');
				}else{
					var message =\' <table border="0" width="100%" cellpadding="8" height="100%"><tr ><td rowspan="2" width="40%">\'+ img +  \'</td><td widt="60%" class ="msg_tr1">\' + title + \'</td></tr><tr class ="msg_tr2"><td style="text-align:left">\' + body + \'</td></tr><tr ><td colspan="2" class ="msg_tr3">\' + okbutton + \'</td></tr></table>\';
					jQuery(\'.sai_message_box\').css(\'top\', jQuery(\'html, body\').scrollTop() + 150);
					jQuery(\'.sai_message_box\').show(\'slow\');
					jQuery(\'.sai_message_box\').html( message );
				}
			},
			delete_message: function(title, body ,did) {
				var yesbutton = \'<input type="button" style="width:75px" onclick="message_box.yes_close_message(\\\'\'+did+\'\\\');" value="YES" class="sai_submit"/>\';
				var nobutton = \'<input type="button" style="width:75px" onclick="message_box.no_close_message();" value="NO" class="sai_submit" />\';
				var img = \'<img src="' . $theme['images'] . 'remove_big.gif" />\';
				
				if(jQuery(\'.sai_message_box\').html() === null) {
					var message = \'<div class="sai_message_box"><table border="0" cellpadding="8" width="100%" height="100%"><tr height="60%" ><td rowspan="2" width="40%" > \'+ img + \'</td><td width="60%" class ="msg_tr1" height="10%">\' +  title + \'</td></tr><tr ><td style="text-align:left" height="60%" cellpading="2" class ="msg_tr2">\' + body + \'</td></tr><tr ><td colspan="2" class ="msg_tr3" >\' + yesbutton + \'&nbsp; &nbsp; \' + nobutton + \'</td></tr></table></div>\';
					jQuery(document.body).append( message );
					jQuery(\'.sai_message_box\').css(\'top\', jQuery(\'html, body\').scrollTop() + 150);
					jQuery(\'.sai_message_box\').show(\'slow\');
				}else{
					var message = \' <table  border="0" cellpadding="8" width="100%" height="100%"><tr height="60%" ><td rowspan="2" width="40%">\'+ img +  \'</td><td widt="60%" class ="msg_tr1" height="10%">\' + title + \'</td></tr><tr><td style="text-align:left" height="60%" cellpading="2" class ="msg_tr2">\' + body + \'</td></tr><tr ><td colspan="2" class ="msg_tr3" >\' + yesbutton + \'&nbsp; &nbsp; \' + nobutton + \'</td></tr></table>\'
					jQuery(\'.sai_message_box\').css(\'top\', jQuery(\'html, body\').scrollTop() + 150);
					jQuery(\'.sai_message_box\').show(\'slow\');
					jQuery(\'.sai_message_box\').html( message );
				}
			},
			close_message: function() {
				jQuery(\'.sai_message_box\').hide(\'fast\');
			},
			yes_close_message: function(did) {
				$(\'#did\'+did).attr("src","' . $theme['images'] . 'progress.gif");
				jQuery(\'.sai_message_box\').hide(\'fast\');
				$.ajax({
					type: "POST",
					url: window.location+"&ajaxdel=1&delete_alias_id="+did,
					// checking for error
					success: function(data){
						var result = data.substring(0,1);
						var msg = data.substring(1);
						if(result == "1"){
							message_box.show_message( "Delete ",msg,2);
							
							$("#tr"+did).fadeOut(2000);
						}
						if(result == "0"){
							message_box.show_message( "Error ",msg,1);
						}
					},
					error: function(request,error) {
						message_box.show_message("Error",\'' . $l['connect_error'] . '\',1);
					}
				});
			},
			no_close_message: function() {
				jQuery(\'.sai_message_box\').hide(\'fast\');			
			}
		}
	}();
	
	function suggestdompath(domval){
		if(dompath){
			return true;	
		}
		$_("aliaspath").value = "' . cleanpath($softpanel->user['homedir']) . '/www/"+$_("aliasname").value;
	}
	
			
$(document).ready(function(){

	jQuery(\'#butHide\').hide("fast");	
	$(".sai_altrowstable tr").mouseover(function(){
		var old_class = $(this).attr("class");		
		$(this).attr("class", "sai_tr_bgcolor");		
		$(this).mouseout(function(){
			$(this).attr("class", old_class);
		});
	});
	// For showing ADD NEW
	$("#butShow").click(function() {	
		jQuery(\'#showtemp\').slideDown(\'slide\',\'\',1000);
		jQuery(\'#butShow\').fadeOut(0);
		jQuery(\'#butHide\').fadeIn(0);
	});	
	// For hiding ADD NEW
	$("#butHide").click(function() {	
		jQuery(\'#showtemp\').slideUp(\'slide\',\'\',1000);	
		jQuery(\'#butHide\').fadeOut(0);
		jQuery(\'#butShow\').fadeIn(0);			
	});
	// For deleting record
	$(".delete").click(function() {	
		var did = $(this).attr(\'id\');
		did = did.substr(3);
		message_box.delete_message (\'Warning\',\'' . $l['alias_del_conf'] . '\',did);			
	});	
	// for adding alias	
	$(".submitalias").click(function() {
		$("#createalias").css("display", "");	
		var aliasname = ($("#aliasname").val());
		var aliaspath = ($("#aliaspath").val());					
		$.ajax({
			type: "POST",
			url: window.location+"&submitalias=1&ajaxalias=1",					
			data: "aliasname="+aliasname+"&aliaspath="+aliaspath,
			// checking for error
			success: function(data){
				$("#createalias").css("display", "none");						
				var result = data.substring(0,1);														
				if(result == "1"){
					$_("aliasname").value="";				
					var msg = data.substring(2,data.indexOf("<table"));
					var output = data.substring(data.indexOf("<table"));
					message_box.show_message( "Done ",msg,2);							
					$("#showtab").html(output);
					$(".sai_altrowstable tr").mouseover(function(){
						var old_class = $(this).attr("class");		
						$(this).attr("class", "sai_tr_bgcolor");		
						$(this).mouseout(function(){
							$(this).attr("class", old_class);
						});
					});
					// For deleting record
					$(".delete").click(function() {	
						var did = $(this).attr(\'id\');
						did = did.substr(3);
						message_box.delete_message (\'Warning\',\'' . $l['alias_del_conf'] . '\',did);			
					});																								
				}
				if(result == "0"){
					$("#createalias").css("display", "none");
					var msg = data.substring(1);
					message_box.show_message( "Error",msg,1);
				}
			},
			error: function() {
				message_box.show_message("Error",\'' . $l['connect_error'] . '\',1);						
			}															
		});													
	});	
});					
// ]]></script>';
    echo '<table border="0" width="100%"><tr><td align="center" width="70%"><div class="sai_tit"><img src="' . $theme['a_images'] . 'alias.gif" />&nbsp; ' . $l['alias_headling'] . '

</div></td><td align="center"><div id="butShow"><a href="javascript:void(0)" style="text-decoration:none;" class="sai_abut">' . $l['add_new_button'] . '</a></div>
<div id="butHide"><a href="javascript:void(0)" style="text-decoration:none;" class="sai_abut">' . $l['back_button'] . '</a></div></td></tr></table>
<img src="' . $theme['images'] . 'hr.jpg" width="100%" height="1" alt="" /><br /><br /><br />

<div id="showtemp" style="display:none">

<script language="javascript" type="text/javascript"><!-- // --><![CDATA[

// ]]></script>

<table width="100%" cellpadding="5" cellspacing="1" align="center">
	<tr>
		<td width="35%">
			<span class="sai_head">' . $l['alias_label'] . '</span>&nbsp;&nbsp;&nbsp;&nbsp;<span class="sai_exp">' . $l['alias_name_eg'] . '</span><br />
			<span class="sai_exp">' . $l['alias_name_notice'] . '</span>
		</td>
		<td valign="top">
			<input type="text" name="aliasname" id="aliasname" onkeyup="suggestdompath(this);" size="30" value="' . POSTval('aliasname', '') . '" onfocus="" />
		</td>
	</tr>
	
	<tr>
		<td>
			<span class="sai_head">' . $l['alias_path'] . '</span>&nbsp;&nbsp;&nbsp;&nbsp;<span class="sai_exp">' . $l['alias_path_eg'] . '</span><br />
			<span class="sai_exp">' . $l['alias_path_notice'] . '</span>
		</td>
		<td valign="top">
			<input type="text" name="aliaspath" id="aliaspath" size="30" value="' . cleanpath($softpanel->path) . '/www/' . '" onfocus="" />
			<script language="javascript" type="text/javascript"><!-- // --><![CDATA[
			//Add an event handler
			$_("aliaspath").onkeydown = function(){
				dompath = true;
			}
		// ]]></script>
		</td>
	</tr>
</table>

<br /><br />

<p align="center"><input type="button" class="submitalias" style="cursor:pointer" name="submitalias" value="' . $l['submitalias'] . '" /> &nbsp;<img id="createalias" src="' . $theme['images'] . 'progress.gif" style="display:none"></p>
</form><br />
<br />
</div>
<div id="showtab">';
    alias_table();
    echo '</div><form accept-charset="' . $globals['charset'] . '" name="importsoftware" method="post" action="" onsubmit="return checkform();">
<script language="javascript" type="text/javascript"><!-- // --><![CDATA[

function checkform(){
	try{
		if(!formcheck() || !checkdbname(\'softdb\', true)){
			return false;
		}
	}catch(e){
		//Do nothing
	}
	return true;
};

';
    echo '// ]]></script>';
    softfooter();
}
Exemple #8
0
 if ($_GET['page'] == "rules") {
     $name = "dle-rules-page";
 } else {
     $name = trim(totranslit($_POST['name'], true, false));
     if (!count($_POST['grouplevel'])) {
         $_POST['grouplevel'] = array("all");
     }
     $grouplevel = $db->safesql(implode(',', $_POST['grouplevel']));
 }
 $descr = trim($db->safesql(htmlspecialchars($_POST['description'], ENT_QUOTES, $config['charset'])));
 $disable_index = isset($_POST['disable_index']) ? intval($_POST['disable_index']) : 0;
 $template = $db->safesql($template);
 $allow_template = intval($_POST['allow_template']);
 $allow_count = intval($_POST['allow_count']);
 $allow_sitemap = intval($_POST['allow_sitemap']);
 $tpl = $db->safesql(cleanpath($_POST['static_tpl']));
 $skin_name = trim(totranslit($_POST['skin_name'], false, false));
 $newdate = $_POST['newdate'];
 if (isset($_POST['allow_date'])) {
     $allow_date = $_POST['allow_date'];
 } else {
     $allow_date = "";
 }
 if (isset($_POST['allow_now'])) {
     $allow_now = $_POST['allow_now'];
 } else {
     $allow_now = "";
 }
 // Обработка даты и времени
 $added_time = time();
 $newsdate = strtotime($newdate);
		</div>
	</header>
	<div class="container">
		<div class="row">
			<div class="col-md-12">
				<h1><?php 
echo $title;
?>
 <small>We can't find that!</small></h1>
				<hr>
				<p>The controller generating this page is found at <code><?php 
echo cleanpath(realpath(__DIR__ . DS . '..' . DS . '..' . DS . 'classes' . DS . 'Controller' . DS . 'Welcome.php'));
?>
</code>.</p>
				<p>This view is located at <code><?php 
echo cleanpath(__FILE__);
?>
</code>.</p>
			</div>
		</div>
		<footer>
			<p class="pull-right">Page rendered in {exec_time}s using {mem_usage}mb of memory.</p>
			<p>
				<a href="http://fuelphp.com">FuelPHP</a> is released under the MIT license.<br>
				<small>Version: <?php 
echo Fuel::VERSION;
?>
</small>
			</p>
		</footer>
	</div>
Exemple #10
0
function domainadd_theme()
{
    global $user, $globals, $l, $theme, $softpanel, $iscripts, $catwise, $error;
    global $insid, $backed, $software, $soft, $done;
    // For adding MX Record
    if (optGET('ajaxdomadd')) {
        if (!empty($error)) {
            echo '0' . current($error);
            return false;
        }
        // Creating domain
        if (!empty($done)) {
            echo '1' . $l['suc_dom_added'];
            return true;
        }
    }
    softheader($l['<title>']);
    error_handle($error, '100%');
    echo '<form accept-charset="' . $globals['charset'] . '" name="importsoftware" method="post" action="" onsubmit="return checkform();">
<script language="javascript" type="text/javascript"><!-- // --><![CDATA[

var dompath = false;

var message_box = function(){			
return {
	show_message: function(title, body , image) {
		var okbutton = \'<input  style="width:75px" class="sai_submit" type="button" onclick="message_box.close_message();" value="OK" />\';
		if(image == "1"){
			var img = \'<img src="' . $theme['images'] . 'error.gif" />\';
		}else{
			var img = \'<img src="' . $theme['images'] . 'confirm.gif" />\';			
		}
							
		if(jQuery(\'.sai_message_box\').html() === null) {
			var message = \'<div class="sai_message_box"><table border="0" cellpadding="8" width="100%" height="100%"><tr ><td rowspan="2" width="40%" > \'+ img + \'</td><td width="60%" class ="msg_tr1">\' +  title + \'</td></tr><tr class ="msg_tr2"><td style="text-align:left">\' + body + \'</td></tr><tr ><td colspan="2" class ="msg_tr3">\' + okbutton + \'</td></tr></table></div>\';
			jQuery(document.body).append( message );								
			jQuery(\'.sai_message_box\').css(\'top\', jQuery($(jQuery.browser.webkit ? "body": "html")).scrollTop() + 150);
			jQuery(\'.sai_message_box\').show(\'slow\');
		}else{
			var message = \'<table border="0" cellpadding="8" width="100%" height="100%"><tr ><td rowspan="2" width="40%" > \'+ img + \'</td><td width="60%" class ="msg_tr1">\' +  title + \'</td></tr><tr class ="msg_tr2"><td style="text-align:left">\' + body + \'</td></tr><tr ><td colspan="2" class ="msg_tr3">\' + okbutton + \'</a></td></tr></table>\';
			jQuery(\'.sai_message_box\').css(\'top\', jQuery($(jQuery.browser.webkit ? "body": "html")).scrollTop() + 150);
			jQuery(\'.sai_message_box\').show(\'slow\');
			jQuery(\'.sai_message_box\').html( message );
		}
	},
	close_message: function() {
		jQuery(\'.sai_message_box\').hide(\'fast\');
	}
}
}();


function show(){
	if($_("isaddon").checked){		
		$_("addon").style.display = "";
		$_("parked").style.display = "none";
	}else{
		$_("addon").style.display = "none";
		$_("parked").style.display = "";
	}
}
addonload("show();");

function checkform(){
	try{
		if(!formcheck() || !checkdbname(\'softdb\', true)){
			return false;
		}
	}catch(e){
		//Do nothing
	}
	return true;
};

function asuggestdompath(domval){
	if(dompath){
		return true;	
	}
	$_("domainpath").value = "' . (empty($globals['adomain_path']) ? cleanpath($softpanel->user['homedir']) . '/www/' : $globals['adomain_path']) . '"+$_("domain").value;
}

function error(err){
	return err;
}

$(document).ready(function(){
	var r=1;
	$(\'#hostadd\').prop(\'checked\', true);
	
	// For creating MX Record	
	$("#submitdomain").click(function(){
		$("#createdomain").css("display", "");	
		var domain = ($("#domain").val());
		if($_("isaddon").checked == true){
			var isaddon = 1;
			var domainpath = ($("#domainpath").val());
			var tmp = "&domainpath="+domainpath;
		}else{
			var selectdomain = ($("#selectdomain").val());
			var isaddon = 0;
			var tmp = "&selectdomain="+selectdomain;
		}
		if($_("hostadd").checked == true){
			var hostadd = 1;
		}else{
			var hostadd = 0;
		}
		if($_("ssl").checked == true){
			var ssl = 1;
		}else{
			var ssl = 0;
		}
		$.ajax({
			type: "POST",
			url: window.location+"&submitdomain=1&ajaxdomadd=1",					
			data: "domain="+domain+"&isaddon="+isaddon+tmp+"&hostadd="+hostadd+"&ssl="+ssl,
			
			// Checking for error
			success: function(data){
				$("#createdomain").css("display", "none");
				var result = data.substring(0,1);
				var msg = data.substring(1);
				if(result == "1"){
					$_("domain").value="";
					if($_("isaddon").checked == true){
						$_("domainpath").value="' . cleanpath($softpanel->user['homedir']) . '/www/";
					}
					$(\'input:checkbox[name="hostadd"]\').attr(\'checked\', true);
					$(\'input:checkbox[name="ssl"]\').attr(\'checked\', false);
					r=1;
					message_box.show_message( "Done ",msg,2);
				}
				if(result == "0"){
					$("#createdomain").css("display", "none");
					message_box.show_message( "Error",msg,1);
				}
			},
			error: function() {
				message_box.show_message("Error",\'' . $l['connect_error'] . '\',1);
			}
		});
	});
});
// ]]></script>

<center><div class="sai_heading"><img src="' . $theme['images'] . 'adddomain.gif" alt="" /> &nbsp;' . $l['domain_add_label'] . '</div></center>
<img src="' . $theme['images'] . 'hr.jpg" width="100%" height="1" alt="" />

<br /><br />

<table border=0 width="100%" cellpadding="5" cellspacing="1">
	<tr>
		<td width="35%">
			<span class="sai_head">' . $l['domain_label'] . '</span>
		</td>
		<td valign="top">
			<input type="text" name="domain" id="domain" onkeyup="asuggestdompath(this);" size="30" value="' . POSTval('domain', '') . '" />
		</td>
	</tr>
	<tr>
		<td>
			<span class="sai_head">' . $l['is_addon_part'] . '</font></span><br/><span class="sai_exp">' . $l['exp_checkaddon'] . '</span>
		</td>
		<td>
			<input type="checkbox" name="isaddon" id="isaddon" ' . POSTchecked('isaddon', true) . ' onclick="show(this);">
		</td>
	</tr>
	<tr id="addon">
		<td>
			<span class="sai_head">' . $l['domain_path'] . '</span><span class="sai_exp">' . $l['exp_dompath'] . '</span>
		</td>
		<td valign="top">
			<input type="text" name="domainpath" id="domainpath" size="30" value="' . (!empty($globals['adomain_path']) ? $globals['adomain_path'] : cleanpath($softpanel->user['homedir']) . '/www/') . '" onfocus="" />
<script language="javascript" type="text/javascript"><!-- // --><![CDATA[
//Add an event handler
$_("domainpath").onkeydown = function(){
	dompath = true;
}
// ]]></script>
		</td>
	</tr>
	<tr id="parked" style="display:none">
		<td>
			<span class="sai_head">' . $l['select_domain'] . '</span>
		</td>
		<td>
			<select class="input" name="selectdomain" id="selectdomain"> ';
    $domains = $softpanel->domains();
    foreach ($domains as $k => $v) {
        if ($k != '') {
            echo '<option value="' . $k . '">' . $k . '</option>';
        }
    }
    echo '</td>
	</tr>
	<tr id="ssltr" ' . ($softpanel->is_ssl() == true ? '' : 'style="display:none"') . '>
		<td>
			<span class="sai_head">' . $l['ssl_entry'] . '</span><br/><span class="sai_exp">' . $l['exp_ssl'] . '</span>
		</td>
		<td>
			<input type="checkbox" name="ssl" id="ssl" ' . POSTchecked('ssl', false) . '>
		</td>
	</tr>
	<tr ' . ($globals['os'] == 'windows' ? '' : ($softpanel->currentBinary() > 16 ? '' : 'style="display:none"')) . '>
		<td>
			<span class="sai_head">' . $l['host_entry'] . '</span><br/><span class="sai_exp">' . $l['exp_hostadd'] . ($softpanel->isUAC() != 0 ? '<br/><font color=red>' . $l['hosts_perms'] . '</font>' : '') . '</span>
		</td>
		<td>
			<input type="checkbox" name="hostadd" id="hostadd" ' . POSTchecked('hostadd', false) . '>
		</td>
	</tr>
</table>
<br />
<table border="0" width="100%">
<td align="left" width="40%"><a href="http://' . $_SERVER['HTTP_HOST'] . '/ampps/index.php?act=ampps_domainmanage">' . $l['lbl_domain_manage'] . '</a></td>
<td align="left"><input type="button" style="cursor:pointer" name="submitdomain" value="' . $l['submitdomain'] . '" id="submitdomain" class="sai_submit"/> &nbsp;<img id="createdomain" src="' . $theme['images'] . 'progress.gif" style="display:none"></td></table>
</form>';
    softfooter();
}
				<h1>Hello, <?php 
echo $name;
?>
! <small>Congratulations, you just used a Presenter!</small></h1>
				<hr>
				<p>The controller generating this page is found at <code><?php 
echo cleanpath(realpath(__DIR__ . DS . '..' . DS . '..' . DS . 'classes' . DS . 'Controller' . DS . 'Welcome.php'));
?>
</code>.</p>
				<p>
					This view is located at <code><?php 
echo cleanpath(__FILE__);
?>
</code>.
					It is loaded via a Presenter class with a name of <code>\Presenter\Welcome\Hello</code>, located in <code><?php 
echo cleanpath(realpath(__DIR__ . DS . '..' . DS . '..' . DS . 'classes' . DS . 'Presenter' . DS . 'Welcome' . DS . 'Hello.php'));
?>
</code>.
				</p>
			</div>
		</div>
		<footer>
			<p class="pull-right">Page rendered in {exec_time}s using {mem_usage}mb of memory.</p>
			<p>
				<a href="http://fuelphp.com">FuelPHP</a> is released under the MIT license.<br>
				<small>Version: <?php 
echo Fuel::VERSION;
?>
</small>
			</p>
		</footer>
Exemple #12
0
/**
 * Map a relative path from a working directory to a target file
 * - this will always return a relative path, even if target is in the root
 * @example functions/filesystem/relpath.php
 * @param string absoulte path to current working directory
 * @param string absolute path to target 
 * @param array optional include paths, this setting overrides the following.
 * @param bool optionally ommit leading single dot, e.g. './here' becomes 'here'
 * @return string relative path to target from cwd
 */
function relpath($thisdir, $target, array $incs = null, $nodot = false)
{
    if ($target[0] !== '/') {
        // target already relative
        return $target;
    } else {
        if ($thisdir[0] !== '/') {
            trigger_error("first argument must be an absolute path", E_USER_NOTICE);
            return $target;
        }
    }
    // important: this method will fail if paths have redundant references
    $thisdir = cleanpath($thisdir);
    $target = cleanpath($target);
    // support include paths, as base directory
    if (!empty($incs)) {
        $paths = array();
        foreach ($incs as $inc) {
            if ($inc[0] !== '/') {
                $inc = $thisdir . '/' . $inc;
            }
            $inc = cleanpath($inc);
            $nodot = $inc !== $thisdir;
            $relpath = relpath($inc, $target, null, $nodot);
            // log path by length
            $paths[strlen($relpath)] = $relpath;
        }
        // return shortest path calculated
        ksort($paths);
        return current($paths);
    }
    $filename = basename($target);
    $athis = explode('/', $thisdir);
    $atarg = explode('/', dirname($target));
    // at some point paths will branch, that's our common point.
    while (!empty($athis) && !empty($atarg)) {
        $fthis = $athis[0];
        $ftarg = $atarg[0];
        if ($ftarg !== $fthis) {
            // paths branch at this point
            break;
        }
        array_shift($athis);
        array_shift($atarg);
    }
    // target could be in the root
    $inroot = empty($atarg) || $atarg === array('');
    // target is below cwd if athis is empty
    if (empty($athis)) {
        $apath = $nodot ? array() : array('.');
    } else {
        $apath = array_fill(0, count($athis), '..');
    }
    // drill down to target, unless relpath targets root
    if (!$inroot) {
        $apath = array_merge($apath, $atarg);
    }
    // append file name and we're there!
    $apath[] = $filename;
    return implode('/', $apath);
}