Example #1
0
 // create components.xml page
 $init = $relative . "data/other/components.xml";
 $temp = "inc/tmp/tmp-components.xml";
 if (!file_exists($init)) {
     copy($temp, $init);
 }
 // create 404.xml page
 $init = $relative . "data/other/404.xml";
 $temp = "inc/tmp/tmp-404.xml";
 if (!file_exists($init)) {
     copy($temp, $init);
 }
 // create root .htaccess page
 $init = $relative . ".htaccess";
 $temp_data = file_get_contents("inc/tmp/tmp.htaccess");
 $temp_data = str_replace('**REPLACE**', tsl($path_parts), $temp_data);
 $fp = fopen($init, 'w');
 fwrite($fp, $temp_data);
 fclose($fp);
 // create gsconfig.php if it doesn't exist yet.
 $init = $relative . "gsconfig.php";
 $temp = $relative . "temp.gsconfig.php";
 if (file_exists($init)) {
     unlink($temp);
 } else {
     rename($temp, $init);
 }
 // send email to new administrator
 $subject = $site_full_name . ' ' . $i18n['EMAIL_COMPLETE'];
 $message .= $i18n['EMAIL_USERNAME'] . ': ' . stripslashes($_POST['user']);
 $message .= '<br>' . $i18n['EMAIL_PASSWORD'] . ': ' . $random;
Example #2
0
        // init gs namespace and i18n
        var GS     = {};
        GS.i18n    = <?php 
echo json_encode($jsi18n);
?>
;
        GS.debug   = <?php 
echo isDebug() === true ? 'true' : 'false';
?>
 ;
        GS.siteurl = '<?php 
echo $SITEURL;
?>
';
        GS.uploads = '<?php 
echo tsl($SITEURL) . getRelPath(GSDATAUPLOADPATH);
?>
';

		var uploadSession = '<?php 
echo $SESSIONHASH;
?>
';
		var uploadPath    = '<?php 
echo isset($_GET['path']) ? $_GET['path'] : "";
?>
';
		var maxFileSize   = '<?php 
echo toBytesShorthand(getMaxUploadSize(), 'M');
?>
';
Example #3
0
// $GS_script_assets = array(
// 	'jquery' => array(
// 		'cdn' => array(
// 			'url' => '//ajax.googleapis.com/ajax/libs/jquery/'.$jquery_ver.'/jquery.min.js',
// 			'ver' => $jquery_ver
// 		),
// 		'local' => array(
// 			'url' => $ASSETURL.$GSADMIN.'/template/js/jquery/jquery-'.$jquery_ver.'.min.js',
// 			'ver' => $jquery_ver
// 		)
// 	)
// )
/**
 * Core assets
 */
$ASSETPATH = $ASSETURL . tsl(getRelPath(GSADMINTPLPATH));
// core
$GS_script_assets['getsimple']['local']['url'] = $ASSETPATH . 'js/jquery.getsimple.js';
$GS_script_assets['getsimple']['local']['ver'] = $getsimple_ver;
// lazyload (lazy loading assets js/css)
$GS_script_assets['lazyload']['local']['url'] = $ASSETPATH . 'js/lazyload.js';
$GS_script_assets['lazyload']['local']['ver'] = $getsimple_ver;
// gstree (collpaseble heirarchy table tree)
$GS_script_assets['gstree']['local']['url'] = $ASSETPATH . 'js/jquery-gstree.js';
$GS_script_assets['gstree']['local']['ver'] = $getsimple_ver;
// spin (ajax spinners)
$GS_script_assets['spin']['local']['url'] = $ASSETPATH . 'js/spin.js';
$GS_script_assets['spin']['local']['ver'] = $getsimple_ver;
// dropzone (ajax/html uploader w drag and drop)
$GS_script_assets['dropzone']['local']['url'] = $ASSETPATH . 'js/dropzone.js';
$GS_script_assets['dropzone']['local']['ver'] = $getsimple_ver;
Example #4
0
// Setup inclusions
$load['plugin'] = true;
include 'inc/common.php';
login_cookie_check();
$dirsSorted = null;
$filesSorted = null;
$foldercount = null;
if (isset($_GET['path']) && !empty($_GET['path'])) {
    $path = str_replace('../', '', $_GET['path']);
    $path = tsl("../data/uploads/" . $path);
    // die if path is outside of uploads
    if (!path_is_safe($path, GSDATAUPLOADPATH)) {
        die;
    }
    $subPath = str_replace('../', '', $_GET['path']);
    $subFolder = tsl($subPath);
} else {
    $path = "../data/uploads/";
    $subPath = '';
    $subFolder = '';
}
// check if host uses Linux (used for displaying permissions
$isUnixHost = strtoupper(substr(PHP_OS, 0, 3)) === 'WIN' ? false : true;
// if a file was uploaded
if (isset($_FILES['file'])) {
    $uploadsCount = count($_FILES['file']['name']);
    if ($uploadsCount > 0) {
        $errors = array();
        $messages = array();
        for ($i = 0; $i < $uploadsCount; $i++) {
            if ($_FILES["file"]["error"][$i] > 0) {
/**
 * Get Root Install Path
 *
 * Gets the path of the root installation directory
 *
 * @since 1.0
 *
 * @return string
 */
function get_root_path()
{
    $pos = strrpos(dirname(__FILE__), DIRECTORY_SEPARATOR . 'inc');
    $adm = substr(dirname(__FILE__), 0, $pos);
    $pos2 = strrpos($adm, DIRECTORY_SEPARATOR);
    return tsl(substr(__FILE__, 0, $pos2));
}
Example #6
0
/**
 * Creates Standard URL for Pages
 *
 * Default function to create the correct url structure for each front-end page
 *
 * @since 2.0
 * @uses $PRETTYURLS
 * @uses $SITEURL
 * @uses $PERMALINK
 * @uses tsl
 *
 * @param string $slug
 * @param string $parent
 * @param string $type Default is 'full', alternative is 'relative'
 * @return string
 */
function find_url($slug, $parent, $type = 'full')
{
    global $PRETTYURLS;
    global $SITEURL;
    global $PERMALINK;
    if ($type == 'full') {
        $full = $SITEURL;
    } elseif ($type == 'relative') {
        $s = pathinfo(htmlentities(getScriptFile(), ENT_QUOTES));
        $full = $s['dirname'] . '/';
        $full = str_replace('//', '/', $full);
    } else {
        $full = '/';
    }
    if ($parent != '') {
        $parent = tsl($parent);
    }
    if ($PRETTYURLS == '1') {
        if ($slug != 'index') {
            $url = $full . $parent . $slug . '/';
        } else {
            $url = $full;
        }
    } else {
        if ($slug != 'index') {
            $url = $full . 'index.php?id=' . $slug;
        } else {
            $url = $full;
        }
    }
    if (trim($PERMALINK) != '' && $slug != 'index') {
        $plink = str_replace('%parent%/', $parent, $PERMALINK);
        $plink = str_replace('%parent%', $parent, $plink);
        $plink = str_replace('%slug%', $slug, $plink);
        $url = $full . $plink;
    }
    return (string) $url;
}
Example #7
0
" class="gs_image gs_thumb" height="<?php 
echo $thheight;
?>
" width="<?php 
echo $thwidth;
?>
" alt=""></p>
				<p id="code-thumb-link"><?php 
echo tsl($SITEURL) . 'data/thumbs/' . $subPath . 'thumbnail.' . rawurlencode($src);
?>
</p>
				<p id="code-imgthumb-html">&lt;a href="<?php 
echo tsl($SITEURL) . 'data/uploads/' . $subPath . rawurlencode($src);
?>
" class="gs_image_link" >&lt;img src="<?php 
echo tsl($SITEURL) . 'data/thumbs/' . $subPath . 'thumbnail.' . rawurlencode($src);
?>
" class="gs_thumb" height="<?php 
echo $thheight;
?>
" width="<?php 
echo $thwidth;
?>
" alt="" />&lt;/a></p>
			</div>
	</div>
	
	<div id="jcrop_open" class="main">

    <img src="<?php 
echo $src_folder . $subPath . rawurlencode($src);
    }
}
$path = '../backups/other';
$data = getFiles($path);
sort($data);
foreach ($data as $file) {
    if (isFile($file, $path)) {
        echo '<tr><td>' . tsl($path) . $file . '</td><td>' . @valid_xml(tsl($path) . $file) . '</td></tr>';
    }
}
$path = '../backups/pages';
$data = getFiles($path);
sort($data);
foreach ($data as $file) {
    if (isFile($file, $path)) {
        echo '<tr><td>' . tsl($path) . $file . '</td><td>' . @valid_xml(tsl($path) . $file) . '</td></tr>';
    }
}
?>
			</table>
			
			<h3><?php 
echo $i18n['DIR_PERMISSIONS'];
?>
</h3>
			<table class="highlight healthcheck">
				<tr><td style="width:345px;" >../data/pages/</td><td><?php 
if (check_perms("../data/pages/") >= '0755') {
    echo '<span class="OKmsg" >' . check_perms("../data/pages/") . ' ' . $i18n['WRITABLE'] . ' - ' . $i18n['OK'] . '</span>';
} else {
    echo '<span class="ERRmsg" >' . check_perms("../data/pages/") . ' ' . $i18n['NOT_WRITABLE'] . ' - ' . $i18n['ERROR'] . '!</span>';
Example #9
0
function nm_generate_htaccess()
{
    global $NMPAGEURL, $PERMALINK;
    $path = tsl(suggest_site_path(true));
    $prefix = '';
    $page = '';
    # format prefix and page directions
    if ($NMPAGEURL != 'index') {
        if (nm_get_parent() != '' && ($PERMALINK == '' || strpos($PERMALINK, '%parent%') !== false)) {
            $prefix = nm_get_parent() . '/' . $NMPAGEURL . '/';
        } else {
            $prefix = $NMPAGEURL . '/';
        }
        $page = 'id=' . $NMPAGEURL . '&';
    }
    # generate .htaccess contents
    $htaccess = file_get_contents(GSPLUGINPATH . 'news_manager/temp.htaccess');
    $htaccess = str_replace('**PATH**', $path, $htaccess);
    $htaccess = str_replace('**PREFIX**', $prefix, $htaccess);
    $htaccess = str_replace('**PAGE**', $page, $htaccess);
    $htaccess = htmlentities($htaccess, ENT_QUOTES, 'UTF-8');
    # show .htaccess
    include NMTEMPLATEPATH . 'htaccess.php';
}
Example #10
0
    }
}
if (count($filesSorted) != 0) {
    foreach ($filesSorted as $upload) {
        $upload['name'] = rawurlencode($upload['name']);
        $thumb = null;
        $thumbnailLink = null;
        $subDir = $subPath == '' ? '' : $subPath . '/';
        $selectLink = 'title="' . i18n_r('SELECT_FILE') . ': ' . htmlspecialchars($upload['name']) . '" href="javascript:void(0)" onclick="submitLink(' . $CKEditorFuncNum . ',\'' . $fullPath . $subDir . $upload['name'] . '\')"';
        if ($type == 'images') {
            if ($upload['type'] == i18n_r('IMAGES') . ' Images') {
                # get internal thumbnail to show beside link in table
                $thumb = '<td class="imgthumb" style="display:table-cell" >';
                $thumbLink = $urlPath . 'thumbsm.' . $upload['name'];
                if (file_exists(GSTHUMBNAILPATH . $thumbLink . 'a')) {
                    $imgSrc = '<img src="' . tsl($SITEURL) . getRelPath(GSTHUMBNAILPATH) . $thumbLink . '" />';
                } else {
                    $imgSrc = '<img src="inc/thumb.php?src=' . $urlPath . $upload['name'] . '&amp;dest=' . $thumbLink . '&amp;x=65&amp;f=1" />';
                }
                $thumb .= '<a ' . $selectLink . ' >' . $imgSrc . '</a>';
                $thumb .= '</td>';
                # get external thumbnail link
                $thumbLinkExternal = $urlPath . 'thumbnail.' . $upload['name'];
                if (file_exists(GSTHUMBNAILPATH . $thumbLinkExternal)) {
                    $thumbnailLink = '<span>&nbsp;&ndash;&nbsp;&nbsp;</span><a href="javascript:void(0)" onclick="submitLink(' . $CKEditorFuncNum . ',\'' . $sitepath . getRelPath(GSTHUMBNAILPATH) . $thumbLinkExternal . '\')">' . i18n_r('THUMBNAIL') . '</a>';
                }
            } else {
                continue;
            }
        }
        $counter++;
Example #11
0
/****************************************************
*
* @File: 		upload.php
* @Package:	GetSimple
* @Action:	Displays and uploads files to the website 	
*
*****************************************************/
// Setup inclusions
$load['plugin'] = true;
// Relative
$relative = '../';
// Include common.php
include 'inc/common.php';
// Variable settings
login_cookie_check();
$path = tsl("../data/uploads/");
// if a file was uploaded
if (isset($_FILES["file"])) {
    if ($_FILES["file"]["error"] > 0) {
        $error = $i18n['ERROR_UPLOAD'];
    } else {
        //set variables
        $count = '1';
        $file_loc = $path . clean_img_name($_FILES["file"]["name"]);
        $base = $_FILES["file"]["name"];
        //prevent overwriting
        while (file_exists($file_loc)) {
            $file_loc = $path . $count . '-' . clean_img_name($_FILES["file"]["name"]);
            $base = $count . '-' . clean_img_name($_FILES["file"]["name"]);
            $count++;
        }
Example #12
0
    $Err_found = true;
} else {
    if (isset($update) && $update) {
        user_note('设置文件已更新。', 2);
    } else {
        user_note('已新建设置文件。', 2);
    }
}
echo '</div>';
flushNow();
// Remove old files
if ($old_version == '1.5') {
    $removeOldFile = array('lightbox/fancy_close.png', 'lightbox/fancy_loading.png', 'lightbox/fancy_nav_left.png', 'lightbox/fancy_nav_right.png', 'lightbox/fancy_shadow_s.png', 'lightbox/fancy_shadow_e.png', 'lightbox/fancy_shadow_n.png', 'lightbox/fancy_shadow_ne.png', 'lightbox/fancy_shadow_nw.png', 'lightbox/fancy_shadow_se.png', 'lightbox/fancy_shadow_sw.png', 'lightbox/fancy_shadow_w.png', 'lightbox/fancy_title_left.png', 'lightbox/fancy_title_main.png', 'lightbox/fancy_title_over.png', 'lightbox/fancy_title_right.png', 'lightbox/fancybox.png', 'lightbox/fancybox-x.png', 'lightbox/fancybox-y.png', 'lightbox/jquery.fancybox-1.3.4.css', 'lightbox/jquery.fancybox-1.3.4.pack.js', 'img/reset.png', 'img/textback.png', 'lib/dupeimage.class.php', 'lib/remoteImage.class.php', 'lib/resize.class.php');
}
if (isset($removeOldFile)) {
    echo '<div class="ibox"><h2>删除旧版文件</h2>';
    foreach ($removeOldFile as $oldFile) {
        if (@unlink(CFROOTPATH . $oldFile)) {
            user_note('已删除:<b>' . $oldFile . '</b><br/>', 2);
        }
    }
    echo '</div>';
}
// install done
if (!$Err_found) {
    echo '<div class="ibox"><h2>安装/更新完成</h2>';
    user_note('程序安装完成,您现在可以删除 install 目录,然后打开<a href="' . tsl($content['SET_SITEURL']) . 'admin.php">管理员界面</a>,使用下面的用户名与密码登陆后台,对程序进行设置。<br/><br/>
							用户:admin<br/>
							密码:password', 3);
    echo '</div>';
}
function undo($file, $filepath, $bakpath)
{
    $old_file = $filepath . $file;
    $new_file = tsl($bakpath) . $file . ".bak";
    $tmp_file = tsl($bakpath) . $file . ".tmp";
    copy($old_file, $tmp_file);
    copy($new_file, $old_file);
    copy($tmp_file, $new_file);
    unlink($tmp_file);
    if (file_exists($tmp_file)) {
        return false;
    } else {
        return true;
    }
}
Example #14
0
     $cclass = '';
 }
 echo '<tr class="All ' . $upload['type'] . ' ' . $cclass . '" >';
 echo '<td class="imgthumb" >';
 if ($upload['type'] == i18n_r('IMAGES') . ' Images') {
     $gallery = 'rel=" facybox_i"';
     $pathlink = 'image.php?i=' . rawurlencode($upload['name']) . '&amp;path=' . $subPath;
     $thumbLink = $urlPath . 'thumbsm.' . $upload['name'];
     $thumbLinkEncoded = $urlPath . 'thumbsm.' . rawurlencode($upload['name']);
     if (file_exists(GSTHUMBNAILPATH . $thumbLink)) {
         $imgSrc = '<img src="' . tsl($SITEURL) . getRelPath(GSTHUMBNAILPATH) . $thumbLinkEncoded . '" />';
     } else {
         $imgSrc = '<img src="inc/thumb.php?src=' . $urlPath . rawurlencode($upload['name']) . '&amp;dest=' . $thumbLinkEncoded . '&amp;f=1" />';
     }
     // thumbnail link lightbox
     echo '<a href="' . tsl($SITEURL) . getRelPath($path) . rawurlencode($upload['name']) . '" title="' . rawurlencode($upload['name']) . '" rel=" facybox_i" >' . $imgSrc . '</a>';
 } else {
     $gallery = '';
     $controlpanel = '';
     $pathlink = $path . $upload['name'];
 }
 // name column linked
 echo '</td><td><a title="' . i18n_r('VIEW_FILE') . ': ' . htmlspecialchars($upload['name']) . '" href="' . $pathlink . '" class="primarylink">' . htmlspecialchars($upload['name']) . '</a></td>';
 // size column
 echo '<td style="width:80px;text-align:right;" ><span>' . $upload['size'] . '</span></td>';
 // get the file permissions.
 if ($isUnixHost && isDebug() && function_exists('posix_getpwuid')) {
     $filePerms = substr(sprintf('%o', fileperms($path . $upload['name'])), -4);
     $fileOwner = posix_getpwuid(fileowner($path . $upload['name']));
     echo '<td style="width:70px;text-align:right;"><span>' . $fileOwner['name'] . '/' . $filePerms . '</span></td>';
 }
Example #15
0
echo $TEMPLATE;
?>
&f=<?php 
echo $TEMPLATE_FILE;
?>
" method="post" >
			<input id="nonce" name="nonce" type="hidden" value="<?php 
echo get_nonce("save");
?>
" />
			<p><textarea name="content" id="codetext" ><?php 
echo htmlentities($content, ENT_QUOTES, 'UTF-8');
?>
</textarea></p>
			<input type="hidden" value="<?php 
echo tsl($TEMPLATE) . $TEMPLATE_FILE;
?>
" name="edited_file" />
			<?php 
exec_action('theme-edit-extras');
?>
			<p><input class="submit" type="submit" name="submitsave" value="<?php 
echo $i18n['BTN_SAVECHANGES'];
?>
" /> &nbsp;&nbsp;<?php 
echo $i18n['OR'];
?>
&nbsp;&nbsp; <a class="cancel" href="theme-edit.php?cancel"><?php 
echo $i18n['CANCEL'];
?>
</a></p>
Example #16
0
/**
 * Get Theme URL
 * This will return the current active theme's full URL (folder)
 * @param bool $echo Optional, default is true. False will 'return' value
 * @return string Echos or returns based on param $echo
 */
function get_theme_url($for = 'folder', $echo = true)
{
    $theme = getSettings('SET_THEME');
    $return = trim(tsl(getSettings('SET_SITEURL')) . "themes/" . $theme);
    if ($for == 'css') {
        $return .= '/' . $theme . '.css?v=' . getSettings('SET_VERSION');
    }
    if (!$echo) {
        return $return;
    }
    echo $return;
}
" class="gs_image gs_thumb" height="<?php 
echo $thheight;
?>
" width="<?php 
echo $thwidth;
?>
" alt=""></p>
				<p id="code-thumb-link"><?php 
echo tsl($SITEURL) . 'data/thumbs/' . $subPath . 'thumbnail.' . $src;
?>
</p>
				<p id="code-imgthumb-html">&lt;a href="<?php 
echo tsl($SITEURL) . 'data/uploads/' . $subPath . $src;
?>
" class="gs_image_link" >&lt;img src="<?php 
echo tsl($SITEURL) . 'data/thumbs/' . $subPath . 'thumbnail.' . $src;
?>
" class="gs_thumb" height="<?php 
echo $thheight;
?>
" width="<?php 
echo $thwidth;
?>
" alt="" />&lt;/a></p>
			</div>
	</div>
	
	<div id="jcrop_open" class="main">

    <img src="<?php 
echo $src_folder . $subPath . $src;
Example #18
0
 //UserName
 if (!empty($_POST['setUserName'])) {
     $settings['SET_USERNAME'] = cl($_POST['setUserName']);
 } else {
     user_feedback('error', _T("admin_set_err_username"), 'admin_set_username');
 }
 //email
 if (preg_match($emailPattern, cl($_POST['setEmail']))) {
     $settings['SET_CONTACT'] = cl($_POST['setEmail']);
 } else {
     user_feedback('error', _T("admin_set_err_email_invalid"), 'admin_set_email_invalid');
 }
 // Script Url
 $scriptUrl = cl($_POST['setScriptUrl']);
 if (!empty($scriptUrl)) {
     $settings['SET_SITEURL'] = tsl($scriptUrl);
 } else {
     user_feedback('error', _T("admin_set_err_script_url"), 'admin_set_script_url');
 }
 $settings['SET_WATERMARK'] = cl($_POST['setWaterMark']) == 1 ? 1 : 0;
 $settings['SET_WATERMARK_TEXT'] = cl($_POST['setWatermarkText']);
 $settings['SET_WATERMARK_PLACED'] = (int) cl($_POST['setWatermarkPlaced']);
 $settings['SET_WATERMARK_IMAGE'] = cl($_POST['setWatermarkImage']);
 $settings['SET_MOD_REWRITE'] = cl($_POST['setModRewrite']) == 1 ? 1 : 0;
 $settings['SET_AUTO_DELETED'] = cl($_POST['setAutoDeleted']) == 1 ? 1 : 0;
 $settings['SET_HIDE_SEARCH'] = cl($_POST['setHideSearch']) == 1 ? 1 : 0;
 $settings['SET_HIDE_CONTACT'] = cl($_POST['setHideContact']) == 1 ? 1 : 0;
 $settings['SET_HIDE_TOS'] = cl($_POST['setHideTos']) == 1 ? 1 : 0;
 $settings['SET_HIDE_GALLERY'] = cl($_POST['setHideGallery']) == 1 ? 1 : 0;
 $settings['SET_HIDE_FAQ'] = cl($_POST['setHideFaq']) == 1 ? 1 : 0;
 $settings['SET_HIDE_FEED'] = cl($_POST['setHideFeed']) == 1 ? 1 : 0;
Example #19
0
}
# was the form submitted?
if (isset($_POST['submitted'])) {
    # first check for csrf
    if (!defined('GSNOCSRF') || GSNOCSRF == FALSE) {
        $nonce = $_POST['nonce'];
        if (!check_nonce($nonce, "save_settings")) {
            die("CSRF detected!");
        }
    }
    # website-specific fields
    if (isset($_POST['sitename'])) {
        $SITENAME = htmlentities($_POST['sitename'], ENT_QUOTES, 'UTF-8');
    }
    if (isset($_POST['siteurl'])) {
        $SITEURL = tsl($_POST['siteurl']);
    }
    if (isset($_POST['permalink'])) {
        $PERMALINK = trim($_POST['permalink']);
    }
    if (isset($_POST['template'])) {
        $TEMPLATE = $_POST['template'];
    }
    if (isset($_POST['prettyurls'])) {
        $PRETTYURLS = $_POST['prettyurls'];
    } else {
        $PRETTYURLS = '';
    }
    # user-specific fields
    if (isset($_POST['user'])) {
        $USR = strtolower($_POST['user']);
Example #20
0
echo $template_file;
?>
" method="post" >
			<input id="nonce" name="nonce" type="hidden" value="<?php 
echo get_nonce("save");
?>
" />
			<textarea name="content" id="codetext" class="code_edit" data-mode="<?php 
echo $mode;
?>
" wrap='off' ><?php 
echo htmlentities($content, ENT_QUOTES, 'UTF-8');
?>
</textarea>
			<input type="hidden" value="<?php 
echo tsl($template) . $template_file;
?>
" name="edited_file" id="edited_file" />
			<div id="theme-edit-extras-wrap"><?php 
exec_action('theme-edit-extras');
?>
</div>
			<p id="submit_line" >
				<span><input class="submit" type="submit" name="submitsave" value="<?php 
i18n('BTN_SAVECHANGES');
?>
" /></span> &nbsp;&nbsp;<?php 
i18n('OR');
?>
&nbsp;&nbsp; <a class="cancel" href="theme-edit.php?cancel"><?php 
i18n('CANCEL');
Example #21
0
 * Displays and selects file link to insert into CKEditor
 *
 * @subpackage Files
 * 
 * Version: 1.1 (2011-03-12)
 */
// Setup inclusions
include 'inc/common.php';
login_cookie_check();
$filesSorted = null;
$dirsSorted = null;
$path = isset($_GET['path']) ? "../data/uploads/" . $_GET['path'] : "../data/uploads/";
$subPath = isset($_GET['path']) ? $_GET['path'] : "";
$returnid = isset($_GET['returnid']) ? $_GET['returnid'] : "";
$func = isset($_GET['func']) ? $_GET['func'] : "";
$path = tsl($path);
// check if host uses Linux (used for displaying permissions
$isUnixHost = strtoupper(substr(PHP_OS, 0, 3)) === 'WIN' ? false : true;
$CKEditorFuncNum = $_GET['CKEditorFuncNum'];
$sitepath = suggest_site_path();
$fullPath = $sitepath . "data/uploads/";
$type = $_GET['type'];
if (!defined('IN_GS')) {
    die('you cannot load this page directly.');
}
global $LANG;
$LANG_header = preg_replace('/(?:(?<=([a-z]{2}))).*/', '', $LANG);
?>
<!DOCTYPE html>
<html lang="<?php 
echo $LANG_header;
Example #22
0
include 'inc/common.php';
login_cookie_check();
// Variable Settings
$subPath = isset($_GET['path']) ? $_GET['path'] : "";
if ($subPath != '') {
    $subPath = tsl($subPath);
}
$uploadsPath = GSDATAUPLOADPATH;
$uploadsPathRel = getRelPath(GSDATAUPLOADPATH);
$thumbPathRel = getRelPath(GSTHUMBNAILPATH);
$src = strippath($_GET['i']);
$thumb_folder = GSTHUMBNAILPATH . $subPath;
$src_folder = $uploadsPath;
$src_url = tsl($SITEURL) . $uploadsPathRel . $subPath;
$thumb_folder_rel = $thumbPathRel . $subPath;
$thumb_url = tsl($SITEURL) . $thumb_folder_rel;
if (!is_file($src_folder . $subPath . $src)) {
    redirect("upload.php");
}
// handle jcrop thumbnail creation
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    require_once 'inc/imagemanipulation.php';
    $objImage = new ImageManipulation($src_folder . $subPath . $src);
    if ($objImage->imageok) {
        $objImage->setCrop($_POST['x'], $_POST['y'], $_POST['w'], $_POST['h']);
        //$objImage->show();
        $objImage->save($thumb_folder . 'thumbnail.' . $src);
        $success = i18n_r('THUMB_SAVED');
    } else {
        i18n('ERROR');
    }
 public function all_files_read()
 {
     if ($this->auth()) {
         $patho = (string) $this->xml->data->path;
         $path = tsl(GSDATAUPLOADPATH . $patho);
         $filesArray = array();
         $count = 0;
         global $SITEURL;
         $filenames = getFiles($path);
         if (count($filenames) != 0) {
             foreach ($filenames as $file) {
                 if ($file == "." || $file == ".." || $file == ".htaccess") {
                     // not a upload file
                 } else {
                     $filesArray[$count]['name'] = $file;
                     if (is_dir($path . $file)) {
                         $filesArray[$count]['type'] = 'folder';
                     } else {
                         $filesArray[$count]['type'] = 'file';
                         $filesArray[$count]['url'] = tsl($SITEURL . 'data/uploads/' . $patho) . $file;
                         $ext = pathinfo($file, PATHINFO_EXTENSION);
                         $extention = get_FileType($ext);
                         $filesArray[$count]['category'] = $extention;
                         clearstatcache();
                         $ss = stat($path . $file);
                         $filesArray[$count]['date'] = date('c', $ss['ctime']);
                         $filesArray[$count]['size'] = $ss['size'];
                     }
                 }
                 $count++;
             }
         }
         $filesArray = subval_sort($filesArray, 'name');
         $filesArray = subval_sort($filesArray, 'type');
         $wrapper = array('status' => 'success', 'message' => 'all_files_read ok', 'response' => $filesArray);
         return json_encode($wrapper);
     }
 }
Example #24
0
		<p style="display:none" id="waiting" ><?php 
i18n('CREATE_ARC_WAIT');
?>
</p>
		
		<table class="highlight paginate">
			<tr><th><?php 
i18n('ARCHIVE_DATE');
?>
</th><th style="text-align:right;" ><?php 
i18n('FILE_SIZE');
?>
</th><th></th></tr>
			<?php 
$count = "0";
$path = tsl(GSBACKUPSPATH . 'zip/');
$filenames = getFiles($path);
natsort($filenames);
rsort($filenames);
foreach ($filenames as $file) {
    if ($file[0] != ".") {
        $timestamp = explode('_', $file);
        $name = lngDate($timestamp[0]);
        clearstatcache();
        $ss = stat($path . $file);
        $size = fSize($ss['size']);
        echo '<tr>
								<td><a title="' . i18n_r('DOWNLOAD') . ' ' . $name . '" href="download.php?file=' . $path . $file . '&amp;nonce=' . get_nonce("archive", "download.php") . '">' . $name . '</a></td>
								<td style="width:70px;text-align:right;" ><span>' . $size . '</span></td>
								<td class="delete" ><a class="delconfirm" title="' . i18n_r('DELETE_ARCHIVE') . ': ' . $name . '?" href="deletefile.php?zip=' . $file . '&amp;nonce=' . get_nonce("delete", "deletefile.php") . '">&times;</a></td>
							  </tr>';
Example #25
0
     } else {
         $imgSrc = '<img class="' . $ext . '" src="' . tsl($SITEURL) . getRelPath(GSTHUMBNAILPATH) . $thumbLinkEncoded . '" />';
     }
     // thumbnail link lightbox
     echo '<a href="' . tsl($SITEURL) . getRelPath($path) . rawurlencode($upload['name']) . '" title="' . rawurlencode($upload['name']) . '" rel="fancybox_i" >' . $imgSrc . '</a>';
     # get external thumbnail link
     # if not exist generate it
     if (!file_exists(GSTHUMBNAILPATH . $thumbLinkExternal) || isset($_REQUEST['regenthumbnail'])) {
         genStdThumb($subPath, $upload['name']);
     }
     $thumbnailLink = '<a href="' . tsl($SITEURL) . getRelPath(GSTHUMBNAILPATH) . $thumbLinkExternal . '" class="label label-ghost thumblinkexternal" data-fileurl="' . getRelPath(GSTHUMBNAILPATH) . $thumbLinkExternal . '">' . i18n_r('THUMBNAIL') . '</a>';
 } else {
     // other files
     $gallery = '';
     $controlpanel = '';
     $pathlink = tsl($SITEURL) . getRelPath($path) . $upload['name'];
 }
 // name column linked
 echo '</td><td>' . getUploadIcon($upload['name']) . '<a title="' . i18n_r('VIEW_FILE') . ': ' . htmlspecialchars($upload['name']) . '" href="' . $pathlink . '" class="primarylink" data-fileurl="' . $primarylink . '">' . htmlspecialchars($upload['name']) . '</a>' . $thumbnailLink . '</td>';
 // size column
 echo '<td class="file_size right"><span>' . $upload['size'] . '</span></td>';
 // file perms column
 if ($showperms) {
     $filePerms = substr(sprintf('%o', fileperms($path . $upload['name'])), -4);
     if ($isUnixHost) {
         $fileOwner = function_exists('posix_getpwuid') ? posix_getpwuid(fileowner($path . $upload['name'])) : '';
         $fileOwnerName = isset($fileOwner['name']) ? $fileOwner['name'] : '';
     } else {
         $fileOwnerName = getenv('USERNAME');
     }
     echo '<td style="width:70px;text-align:right;"><span>' . $fileOwnerName . '/' . $filePerms . '</span></td>';
Example #26
0
echo tsl($SITEURL) . 'data/uploads/' . $src;
?>
</p>
				<p id="code-thumb-html">&lt;img src="<?php 
echo tsl($SITEURL) . 'data/thumbs/thumbnail.' . $src;
?>
" class="gs_image gs_thumb" alt=""></p>
				<p id="code-thumb-link"><?php 
echo tsl($SITEURL) . 'data/thumbs/thumbnail.' . $src;
?>
</p>
				<p id="code-imgthumb-html">&lt;a href="<?php 
echo tsl($SITEURL) . 'data/uploads/' . $src;
?>
" class="gs_image_link" >&lt;img src="<?php 
echo tsl($SITEURL) . 'data/thumbs/thumbnail.' . $src;
?>
" class="gs_thumb" alt="" />&lt;/a></p>
			</div>
	</div>
	
	<div id="jcrop_open" class="main">

    <img src="<?php 
echo $src_folder . $src;
?>
" id="cropbox" />
    

		<div id="handw" class="toggle" ><?php 
echo $i18n['SELECT_DIMENTIONS'];
Example #27
0
/**
 * Creates Standard URL for Pages
 *
 * Default function to create the correct url structure for each front-end pages
 * 
 * @since 3.4
 * @uses $PRETTYURLS
 * @uses $PERMALINK
 * @uses tsl
 *
 * @param string $slug
 * @param string $parent
 * @param string $absolute force absolute siteurl
 * @return string
 */
function generate_url($slug, $absolute = false)
{
    global $PRETTYURLS;
    global $PERMALINK;
    // force slug to string in case a simpleXml object was passed ( from a page obj for example)
    $slug = (string) $slug;
    $delim = getDef('GSTOKENDELIM');
    if (empty($slug)) {
        return;
    }
    // empty slug
    $path = tsl(getSiteURL($absolute));
    $url = $path;
    // var to build url into
    if ($slug != getDef('GSINDEXSLUG')) {
        if ($PRETTYURLS == '1') {
            $url .= generate_permalink($slug);
        } else {
            if (!empty($PERMALINK)) {
                $url .= generate_permalink($slug, $PERMALINK);
            } else {
                $url .= 'index.php?id=' . $slug;
            }
        }
    }
    $url = exec_filter('generate_url', $url);
    // @filter generate_url (str) for generating urls after processing, for use with custom tokens etc
    return $url;
}
Example #28
0
/**
 * generate a thumbnail
 * @param  str  $sub_path upload path
 * @param  str  $file     filename
 * @param  str  $out_file outfile name, can be null if show is true
 * @param  int  $w        desired width
 * @param  int  $h        desired max height, optional, will limit height and adjust width accordingly
 * @param  int  $quality  quality of image jpg and png
 * @param  bool $show     output to browser if true
 * @param  str $output_format optional output format, if not determining from out_file can be excusivly set (1|'GIF', 2|'JPG,'' 3|'PNG')
 * @param  boolean $upscale  true, allows image to scale up/zoom to fit thumbnail
 * @return bool            success
 */
function generate_thumbnail($file, $sub_path = '', $out_file = null, $w = null, $h = null, $crop = null, $quality = null, $show = false, $output_format = null, $upscale = false)
{
    //gd check, do nothing if no gd
    $php_modules = get_loaded_extensions();
    if (!in_arrayi('gd', $php_modules)) {
        return false;
    }
    $sub_path = tsl($sub_path);
    $upload_folder = GSDATAUPLOADPATH . $sub_path;
    $thumb_folder = GSTHUMBNAILPATH . $sub_path;
    $thumb_file = isset($out_file) && !empty($out_file) ? $thumb_folder . $out_file : '';
    create_dir($thumb_folder);
    require_once 'imagemanipulation.php';
    $objImage = new ImageManipulation($upload_folder . $file);
    if ($objImage->imageok) {
        if ($upscale) {
            $objImage->setUpscale();
        }
        // allow magnification
        if ($quality) {
            $objImage->setQuality($quality);
        }
        // set quality for jpg or png
        if (isset($output_format)) {
            $objImage->setOutputFormat($output_format);
        }
        // setoutput format, ignored if out_file specifies extension
        if (isset($w) && isset($h)) {
            $objImage->setImageWidth($w, $h);
        } elseif (isset($w)) {
            $objImage->setImageWidth($w);
            // if only specifiying width, scale to width only
            // $objImage->resize($w); // constrains both dimensions to $size, same as setImageWidth($w,$w);
        } elseif (isset($h)) {
            $objImage->setImageHeight($h);
            // if only specifiying width, scale to width only
        }
        if (isset($crop)) {
            $objImage->setAutoCrop($crop);
        }
        // die(print_r($objImage));
        $objImage->save($thumb_file, $show);
        return $objImage;
    } else {
        return false;
    }
}
 # create default 404.xml page
 $init = GSDATAOTHERPATH . '404.xml';
 $temp = GSADMININCPATH . 'tmp/tmp-404.xml';
 if (!file_exists($init)) {
     copy($temp, $init);
 }
 # create root .htaccess file
 if (!function_exists('apache_get_modules') or in_arrayi('mod_rewrite', apache_get_modules())) {
     $init = GSROOTPATH . '.htaccess';
     $temp_data = file_get_contents(GSROOTPATH . 'temp.htaccess');
     $temp_data = str_replace('**REPLACE**', tsl($path_parts), $temp_data);
     $fp = fopen($init, 'w');
     fwrite($fp, $temp_data);
     fclose($fp);
     if (!file_exists($init)) {
         $kill .= sprintf(i18n_r('ROOT_HTACCESS_ERROR'), 'temp.htaccess', '**REPLACE**', tsl($path_parts)) . '<br />';
     } else {
         unlink(GSROOTPATH . 'temp.htaccess');
     }
 }
 # create gsconfig.php if it doesn't exist yet.
 $init = GSROOTPATH . 'gsconfig.php';
 $temp = GSROOTPATH . 'temp.gsconfig.php';
 if (file_exists($init)) {
     unlink($temp);
     if (file_exists($temp)) {
         $kill .= sprintf(i18n_r('REMOVE_TEMPCONFIG_ERROR'), 'temp.gsconfig.php') . '<br />';
     }
 } else {
     rename($temp, $init);
     if (!file_exists($init)) {
Example #30
0
        $err = "false";
    }
}
//are any of the control panel checkboxes checked?
$editorchck = '';
$prettychck = '';
if ($HTMLEDITOR != '') {
    $editorchck = 'checked';
}
if ($PRETTYURLS != '') {
    $prettychck = 'checked';
}
// get what we think the 'website base url' should be
$path_parts = pathinfo(htmlentities($_SERVER['PHP_SELF'], ENT_QUOTES));
$path_parts = str_replace("/admin", "", $path_parts['dirname']);
$fullpath = tsl("http://" . htmlentities($_SERVER['SERVER_NAME'], ENT_QUOTES) . $path_parts);
// get available language files
$lang_path = "lang/";
$lang_handle = @opendir($lang_path) or die("Unable to open {$lang_path}");
if ($LANG == '') {
    $LANG = 'en_US';
}
while ($lfile = readdir($lang_handle)) {
    if (is_file($lang_path . $lfile) && $lfile != "." && $lfile != "..") {
        $lang_array[] = basename($lfile, ".php");
    }
}
if (count($lang_array) != 0) {
    sort($lang_array);
    $count = '0';
    $sel = '';