HEX
Server: Apache
System: Linux msm5694.mjhst.com 3.10.0-1160.119.1.el7.x86_64 #1 SMP Tue Jun 4 14:43:51 UTC 2024 x86_64
User: camjab_ssh (1000)
PHP: 5.3.29
Disabled: NONE
Upload Files
File: /home/httpd/html/xdudes.com/admin/logo.php
<?php
require "db.php";


if (isset($_POST['formSubmit'])) {
    $_POST = array_map_array('trim', $_POST);
	
	if(isset($_FILES['logo']['tmp_name'])) {
		$ext = explode(".", strtolower($_FILES['logo']['name']));
		$ext = array_reverse($ext);
		$validTypes = array('gif','jpg','jpeg','png','svg','webp');
		if(in_array(strtolower($ext[0]),$validTypes)) {
			
			$filename = "logo.".$ext[0];
			$target = "$misc_path/$filename";
			if(move_uploaded_file($_FILES['logo']['tmp_name'], $target)) { 
				$_POST['template_logo_url'] = "$misc_url/$filename"; 
			}
		}
	}
	
	
    foreach ($_POST as $k => $v) {
        if (in_array($k, array('formSubmit'))) {
            continue;
        }
        dbQuery("UPDATE template_configuration SET value = '".mysqli_real_escape_string($dblink,$v)."' WHERE field = '$k' AND template = '" . mysqli_real_escape_string($dblink, $template_name) . "'");
    }	
	

	
		
	if (!getMessages(false, 'error')) {	
		$output = array();
		$results = dbQuery("SELECT * FROM `template_configuration` WHERE template = '".$template_name."'", false);
		foreach ($results as $row) {
			$output[$row['field']] = $row['value'];
		}
		file_put_contents("$basepath/admin/scripts/template_config.json", json_encode($output));
		setMessage('Configuration saved!');
		header("Location: ".$_SERVER['REQUEST_URI']);
		exit();
	}
}
?>

<? require "header.php"; ?>
<script src='<?php echo $basehttp; ?>/admin/js/spectrum.js'></script>
<link rel='stylesheet' href='<?php echo $basehttp; ?>/admin/public/css/spectrum.css' />

<div class="content-page">
    <div class="header-area">

        <div class="breadcrumbs">  
            <a href="index.php">Admin Home</a>          
            <span><a href="logo.php">Logo and Colors</a></span>  
        </div>
    </div>
    <div class="content-outer">  
        <h2>Manage<strong>Logo and Colors</strong></h2>
        <div class="notification info">This page lets you manage the logo and color scheme of your site.</div>
        <div class="content-inner">            
            <form method="POST" enctype="multipart/form-data" action="" class="form" novalidate autocomplete="off">
                <?php if ($error) { ?><div class="notification error"><?php echo $error; ?></div><?php } ?>
                <table class="pagetable"> 
                    <thead>
                        <tr>
                            <th colspan="2">Manage</th>
                        </tr>
                    </thead>
                    <tbody>
                        <tr>
                            <td>Current Logo</td>
                            <td>
							<? if(isset($template_logo_url) && !empty($template_logo_url)) { ?>
								<img src='<?php echo $template_logo_url; ?>?<? echo time(); ?>' style='max-width: 400px;'>
							<? } else { ?>
								<? if(file_exists($template_path.'/images/sprite.svg')) { ?>
									<svg class="" aria-hidden="true" width="302.75" height="42.332" viewBox="0 0 302.75 42.332">
										<use xlink:href="<?php echo $template_url; ?>/images/sprite.svg#logo"></use>
									</svg>
								<? } else { ?>
									<img src="<?php echo $template_url; ?>/images/logo.png?<? echo time(); ?>">
								<? } ?>
							<? } ?>
							</td>
                        </tr>
                        <tr>
                            <td>Upload Logo</td>
                            <td><input type="file" name="logo" accept="image/*" /></td>
                        </tr>
						<tr>
							<td>Use Color Scheme <a href="#" title="Enable/Disable Defined Template Color Scheme"><i class="ion ion-help-circled"></i></a></td>
							<td>
								<select name="template_colors_enabled">
									<option <?php if(isset($template_colors_enabled) && $template_colors_enabled == 1) { ?>selected<?php } ?> value="1">true</option>
									<option <?php if(isset($template_colors_enabled) && $template_colors_enabled == 0) { ?>selected<?php } ?> value="0">false</option>
								</select>
							</td>
						</tr>
						<?
						$result = dbQuery("SELECT * FROM template_configuration WHERE template = '".$template_name."' AND settings = 'color' ORDER BY field_name ASC",false);

						foreach($result as $row) { 
						?>
						<tr>
                            <td><? echo $row['field_name']; ?></td>
                            <td><input name="<? echo $row['field']; ?>" type="color" value="<?php if(isset($row['value'])) { echo $row['value']; } ?>" /></td>
                        </tr>
						<? } ?>
						
                        <tr class="item submit">
                            <td colspan="2">
                                <button type="submit" name='formSubmit' class="btn action-save">Submit</button>
                            </td>
                        </tr>
                    </tbody>
                </table>
            </form>

      
        </div>
    </div>

</div>

<?php require "footer.php"; ?>