summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorspiderr <spiderr@bitweaver.org>2021-02-03 13:52:02 -0500
committerspiderr <spiderr@bitweaver.org>2021-02-03 13:52:02 -0500
commit372124e44a89a02a916f35687773298b7d96e72e (patch)
tree2f7f9372d07ac989297352dbb2a7ba2c5a65b13b
parent8100f531ffe00ab3da809b8b7f28878607b227de (diff)
downloadthemes-372124e44a89a02a916f35687773298b7d96e72e.tar.gz
themes-372124e44a89a02a916f35687773298b7d96e72e.tar.bz2
themes-372124e44a89a02a916f35687773298b7d96e72e.zip
remove custom theme.php feature themes_edit_css
-rw-r--r--admin/admin_themes_inc.php96
-rw-r--r--edit_css.php206
-rw-r--r--includes/classes/BitThemes.php12
-rw-r--r--templates/edit_css.tpl82
4 files changed, 1 insertions, 395 deletions
diff --git a/admin/admin_themes_inc.php b/admin/admin_themes_inc.php
deleted file mode 100644
index bda7a98..0000000
--- a/admin/admin_themes_inc.php
+++ /dev/null
@@ -1,96 +0,0 @@
-<?php
-$themeSettings = array(
- 'site_use_jscalendar' => array(
- 'label' => 'Enable JSCalendar',
- 'note' => 'If checked, a calendar popup allows for easily selecting a date using an appealing interface.',
- ),
- 'themes_collapsible_modules' => array(
- 'label' => 'Collapsible modules',
- 'note' => 'This allows users to collapse modules by clicking on their titles. Can be useful if you use many modules.',
- ),
-// 'themes_edit_css' => array(
-// 'label' => 'Edit Css',
-// 'note' => 'Enables you to edit CSS files from within your browser to customise your site style according to your desires.',
-// ),
- 'site_disable_fat' => array(
- 'label' => "Disable fading",
- 'note' => "If checked, success, warning or error messages display no fading effect anymore.",
- ),
- 'site_disable_jstabs' => array(
- 'label' => "Disable Javascript tabs",
- 'note' => "If checked, admin pages flow vertically, instead of displaying in a 'tabbed pages' interface.",
- ),
- 'site_fancy_zoom' => array(
- 'label' => "Enable Fancy Zoom for images",
- 'note' => "If checked, a Javascript zooms images when clicking on them. This will modify the behaviour when viewing most images. If you are running a commercial site, please read the license notice in /util/javascript/fancyzoom/js-global/FancyZoom.js.",
- ),
- 'site_mods_req_admn_grp' => array(
- 'label' => 'Modules require membership',
- 'note' => 'If enabled, modules with group/role restrictions require the administrator to be member of the group/role. If disabled, all modules are always visible to administrators.',
- ),
- 'themes_joined_js_css' => array(
- 'label' => 'Joined CSS and JS',
- 'note' => 'If enabled, javascript and CSS files will be concatenated into single files to reduce server requests. This is useful for webdesigners and developers. Please enable this feature on live sites.',
- ),
- 'themes_packed_js_css' => array(
- 'label' => 'Packed CSS and JS',
- 'note' => 'If enabled, javascript and CSS files will be reduced to their smallest possible size. This is useful for webdesigners and developers. Please enable this feature on live sites.',
- ),
- 'themes_disable_pkg_css' => array(
- 'label' => 'Disable All Package CSS',
- 'note' => 'If checked, all css that is automatically included by packages will be disabled. If you want to include some of the package css it is recommended you copy that css to your theme css file.',
- ),
-);
-$gBitSmarty->assign( 'themeSettings', $themeSettings );
-
-if( !empty( $_REQUEST['change_prefs'] )) {
- $pref_simple_values = array(
- "site_biticon_display_style",
- "site_icon_size",
- "themes_jquery_hosting",
- "default_icon_style",
- );
-
- foreach( $pref_simple_values as $svitem ) {
- simple_set_value( $svitem, THEMES_PKG_NAME );
- }
-
- foreach( array_keys( $themeSettings ) as $toggle ) {
- simple_set_toggle( $toggle, THEMES_PKG_NAME );
- }
-
- // due to the packing / joining options, we will remove the cache and reload the page
- $gBitThemes->mThemeCache->expungeCache();
- bit_redirect( KERNEL_PKG_URL."admin/index.php?page=themes" );
-}
-
-// set the options biticon takes
-$biticon_display_options = array(
- 'icon' => tra( 'Icon' ),
- 'text' => tra( 'Text' ),
- 'icon_text' => tra( 'Icon and Text' )
-);
-$gBitSmarty->assign( "biticon_display_options", $biticon_display_options );
-
-// get the icon styles
-$subDirs = array( 'style_info' );
-$iconStyles = $gBitThemes->getStylesList( CONFIG_PKG_PATH."styles/icons/", NULL, $subDirs );
-foreach( $iconStyles as $key=>$style ){
- $iconStyles[$key] = str_replace( "_", " ", $style['style'] );
-}
-$gBitSmarty->assignByRef( "iconStyles", $iconStyles );
-
-$biticon_sizes = array(
- 'small' => tra( 'Small' ),
- 'large' => tra( 'Large' ),
-);
-$gBitSmarty->assign( "biticon_sizes", $biticon_sizes );
-
-// These numbers are intentionally off by 1 due to the way IE fixes name their js
-$jqueryOptions = array(
- 'jquery' => tra( 'Google Hosted' ),
- 'jquerylocal' => tra( 'Local' ),
-);
-$gBitSmarty->assign( 'jqueryOptions', $jqueryOptions );
-
-?>
diff --git a/edit_css.php b/edit_css.php
deleted file mode 100644
index e003f47..0000000
--- a/edit_css.php
+++ /dev/null
@@ -1,206 +0,0 @@
-<?php
-/**
- * @version $Header$
- *
- * Copyright (c) 2002-2003, Luis Argerich, Garland Foster, Eduardo Polidor, et. al.
- * All Rights Reserved. See below for details and a complete list of authors.
- * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See http://www.gnu.org/copyleft/lesser.html for details.
- *
- * @package themes
- */
-
-/**
- * Setup
- */
-include_once( '../kernel/setup_inc.php' );
-include_once( THEMES_PKG_PATH.'css_lib.php' );
-
-/************************************
-**** File Management Functions
-****
-*************************************/
-
-function delete($dir, $pattern = "*.*")
-{
- $deleted = false;
- $pattern = str_replace(array("\*","\?"), array(".*","."), preg_quote($pattern));
- if (substr($dir,-1) != "/") $dir.= "/";
- if (is_dir($dir)) {
- $d = opendir($dir);
- while ($file = readdir($d)) {
- if (is_file($dir.$file) && ereg("^".$pattern."$", $file)){
- if (unlink($dir.$file))
- $deleted[] = $file;
- }
- }
- closedir($d);
- return $deleted;
- }
- else return 0;
-}
-
-// it copies $wf to $wto
-function copy_dirs($wf, $wto)
-{
- if (!file_exists($wto))
- {
- mkdir($wto, 0777);
- }
- $arr=ls_a($wf);
- foreach ($arr as $fn)
- {
- if($fn)
- {
- $fl=$wf."/".$fn;
- $flto=$wto."/".$fn;
- if(is_dir($fl)) copy_dirs($fl, $flto);
- else // begin 2nd improvement
- {
- @copy($fl, $flto);
- chmod($flto, 0666);
- } // end 2nd improvement
- }
- }
-}
-
-// get an array of filesnames in the given directory
-function ls_a($wh)
-{
- if ($handle = opendir($wh))
- {
- while (false !== ($file = readdir($handle)))
- {
- if ($file !== "." && $file !== ".." )
- {
- if(!isset($files)) $files=$file;
- else $files = $file."\r\n".$files;
- }
- }
- closedir($handle);
- }
- $arr=explode("\r\n", $files);
- return $arr;
-}
-/**************************************
-***** End File Management Functions
-*****
-***************************************/
-
-$gBitSystem->verifyFeature( 'themes_edit_css' );
-$gBitSystem->verifyPermission( 'bit_p_create_css' );
-
-$customCSSPath = $gBitUser->getStoragePath( NULL,$gBitUser->mUserId ); // Path to this user's storage directory
-$customCSSFile = $customCSSPath.'custom.css'; // Path to this user's custom stylesheet
-$customCSSImageURL = $gBitUser->getStorageURL( NULL,$gBitUser->mUserId ).'/images/';
-$gBitSmarty->assignByRef('customCSSImageURL',$customCSSImageURL);
-// Create a custom.css for this user if they do not already have one
-if (!file_exists($customCSSFile)) {
- if (!copy(THEMES_PKG_PATH.'/styles/basic/basic.css', $customCSSFile)) {
- $gBitSmarty->assign('msg', tra("Unable to create a custom CSS file for you!"));
- $gBitSystem->display( 'error.tpl' , NULL, array( 'display_mode' => 'edit' ));
- die;
- }
-}
-
-// Action Responses
-if (isset($_REQUEST["fSaveCSS"])and $_REQUEST["fSaveCSS"]) {
- // Save any changes the user made to their CSS
- $fp = fopen($customCSSFile, "w");
-
- if (!$fp) {
- $gBitSmarty->assign('msg', tra("You dont have permission to write the style sheet"));
- $gBitSystem->display( 'error.tpl' , NULL, array( 'display_mode' => 'edit' ));
- die;
- }
-
- fwrite($fp, $_REQUEST["textData"]);
- fclose ($fp);
- $successMsg = "CSS Updated and Saved";
-} elseif (isset($_REQUEST["fCancelCSS"]) && $_REQUEST['fCancelCSS']) {
- // Cancel (e.g. do nothing)
- $successMsg = "Changes have been cancelled";
-} elseif (isset($_REQUEST['fResetCSS'])) {
- // Reset CSS (e.g. copy an existing style as a base for their custom style)
- $resetStyle = $_REQUEST['resetStyle'];
- $cssData = $css_lib->load_css2_file(THEMES_PKG_PATH."styles/$resetStyle/$resetStyle.css");
- if (file_exists($customCSSPath.'/images')) {
- delete($customCSSPath.'/images/', '*.*');
- }
- if (file_exists(THEMES_PKG_PATH."styles/$resetStyle/images")) {
- copy_dirs("styles/$resetStyle/images", $customCSSPath.'/images/');
- }
-
- $fp = fopen($customCSSFile, "w");
-
- if (!$fp) {
- $gBitSmarty->assign('msg', tra("You dont have permission to write the style sheet"));
- $gBitSystem->display( 'error.tpl' , NULL, array( 'display_mode' => 'edit' ));
- die;
- }
-
- fwrite($fp, $cssData);
- fclose ($fp);
- $successMsg = "Your CSS has been reset to the $resetStyle theme.";
-} elseif (isset($_REQUEST['fUpload'])) {
- // User has uploaded an image to use in their custom theme
- //print('You uploaded: '.$_FILES['fImgUpload']['name']);
- print(strtoupper($_FILES['fImgUpload']['name']));
- if (!ereg(".JPG$|.PNG$|.GIF$|.BMP$",strtoupper($_FILES['fImgUpload']['name']))) {
- $errorMsg = "Your image must be one of the following types: .jpg, .png, .gif, .bmp";
- } else {
- if ($_FILES['fImgUpload']['error'] == UPLOAD_ERR_OK && copy($_FILES['fImgUpload']['tmp_name'], $customCSSPath.'/images/'.$_FILES['fImgUpload']['name'])) {
- $successMsg = $_FILES['fImgUpload']['name']." successfully added.";
- }
- else {
- $errorMsg = "There was a problem uploading your image.";
- }
- }
-} elseif (isset($_REQUEST['fDeleteImg'])) {
- // Delete one of the images in this user's storage directory
- $imgName = $customCSSPath.'/images/'.$_REQUEST['fDeleteImg'];
- //print("imgname: $imgName");
- if (file_exists($imgName)) {
- unlink($imgName);
- $successMsg = $_REQUEST['fDeleteImg']." successfully deleted";
- } else {
- $errorMsg = $_REQUEST['fDeleteImg']." does not exists!";
- }
-} else {
- $action = 'edit';
-}
-
-
-// Get the list of themes the user can choose to derive from (aka Reset to)
-$styles = $gBitThemes->getStyles( NULL, FALSE, FALSE );
-$gBitSmarty->assignByRef( 'styles', $styles );
-$assignStyle = 'basic';
-$gBitSmarty->assignByRef( 'assignStyle', $assignStyle);
-
-
-// Read in this user's custom.css to display in the textarea
-$lines = file($customCSSFile);
-$data = '';
-foreach ($lines as $line) {
- $data .= $line;
-}
-
-$gBitSmarty->assign('data', $data);
-if (isset($successMsg))
- $gBitSmarty->assign('successMsg',$successMsg);
-if (isset($errorMsg))
- $gBitSmarty->assign('errorMsg', $errorMsg);
-
-// Get the list of images used by this user's custom theme
-$imageList = ls_a($customCSSPath.'images/');
-$themeImages = array();
-foreach ($imageList as $image) {
- if (ereg(".JPG$|.PNG$|.GIF$|.BMP$",strtoupper($image))) {
- $themeImages[] = $image;
- }
-}
-
-$gBitSmarty->assignByRef('themeImages',$themeImages);
-
-$gBitSystem->display( 'bitpackage:themes/edit_css.tpl', NULL, array( 'display_mode' => 'edit' ));
-
-?>
diff --git a/includes/classes/BitThemes.php b/includes/classes/BitThemes.php
index 487789e..bcb68fe 100644
--- a/includes/classes/BitThemes.php
+++ b/includes/classes/BitThemes.php
@@ -282,16 +282,6 @@ class BitThemes extends BitSingleton {
closedir( $h );
}
- if( $bIncludeCustom && $gBitSystem->getConfig( 'themes_edit_css' )) {
- // Include the users custom css if they have created one
- $customCSSPath = $gBitUser->getStoragePath( NULL,$gBitUser->mUserId );
- $customCSSFile = $customCSSPath.'custom.css';
-
- if (file_exists($customCSSFile)) {
- $ret[] = 'custom';
- }
- }
-
if( count( $ret )) {
sort( $ret );
}
@@ -2307,7 +2297,7 @@ function themes_content_display( $pContent ) {
$gBitThemes->setStyle( $theme );
if( !is_object( $gQueryUser ) ) {
$userClass = $gBitSystem->getConfig( 'user_class', 'BitPermUser' );
- require_once( USERS_PKG_PATH.'includes/' . $userClass .'.php' );
+ require_once( USERS_PKG_PATH.'includes/classes/' . $userClass .'.php' );
$gQueryUser = new $userClass( $pContent->getField( 'user_id' ) );
$gQueryUser->load();
$gBitSmarty->assignByRef( 'gQueryUser', $gQueryUser );
diff --git a/templates/edit_css.tpl b/templates/edit_css.tpl
deleted file mode 100644
index 6b03913..0000000
--- a/templates/edit_css.tpl
+++ /dev/null
@@ -1,82 +0,0 @@
-{literal}
-<script type="text/javascript">
-<!--//
-function confirmform(text)
-{
-var agree=confirm(text);
-
-if (agree)
-return true;
-else
-return false;
-}
-// -->
-</script>
-{/literal}
-
-<a class="pagetitle" href="{$smarty.const.THEMES_PKG_URL}edit_css.php">{tr}Edit Custom Theme{/tr}</a><br /><br />
-{if $successMsg}
-<div style="color: green">{$successMsg}</div>
-{/if}
-{if $errorMsg}
-<div style="color: red">{$errorMsg}</div>
-{/if}
-<div>
- <form method="post" action="{$smarty.const.THEMES_PKG_URL}edit_css.php">
- <div style="padding:4px;border-bottom:1px solid #c3b3a3;">
- <textarea name="textData" rows="42" cols="50" wrap="virtual" style="padding:7px;padding-right:0;">{$data|escape}</textarea>
- </div>
- <div style="">
- <span>
- <input type="submit" class="btn btn-default" name="fSaveCSS" value="Save">
- <input type="submit" class="btn btn-default" name="fCancelCSS" value="Cancel">
- </span>
- <span style="float: right">
-
- <input type="submit" class="btn btn-default" name="fResetCSS" value="Reset CSS" onclick="return confirmform('Are you sure you want to reset your CSS back to the defaults? Any changes you have made will be lost.');">
- to the
- <select name="resetStyle">
- {section name=ix loop=$styles}
- <option value="{$styles[ix]|escape}" {if $assignStyle eq $styles[ix]}selected="selected"{/if}>{$styles[ix]}</option>
- {/section}
- </select>
- theme
-
- </span>
- </div>
- </form>
-</div>
-<!-- Images Used by custom theme -->
-<div>
-<br /><br />
-<h3>Images Used By Your Custom Theme</h3>
-<br />
-
-<table cellpadding="3">
- <tr>
- <th>Image</th>
- <th>Action</th>
- </tr>
- {section name=ix loop=$themeImages}
- <tr bgcolor="{cycle values="#eeeeee,#dddddd"}">
- <td width="200px" cellpadding="3">{$themeImages[ix]}</td>
- <td cellpadding="3">
- {booticon iname="icon-folder-open" ipackage="icons" iexplain=preview onclick="javascript"}
- {booticon iname="icon-folder-open" ipackage="icons" iexplain=preview onclick="javascript:popup('$customCSSImageURL/$themeImages[ix]')"}
- <a href="{$smarty.const.THEMES_PKG_URL}/edit_css.php?fDeleteImg={$themeImages[ix]}">
- {booticon iname="icon-trash" ipackage="icons" iexplain=remove onclick="return confirm('Are you sure you want to delete $themeImages[ix]?');"}
- <img class="icon" src="{$smarty.const.LIBERTY_PKG_URL}icons/delete.gif" title="{tr}Remove{/tr}" alt="{tr}Remove{/tr}" onclick="return confirm('Are you sure you want to delete {$themeImages[ix]}?');"/>
- </a>
- </input>
- </td>
- </tr>
- {/section}
-</table>
-<br />
-<form enctype="multipart/form-data" method="post" action="{$smarty.const.THEMES_PKG_URL}edit_css.php"
-<input type="hidden" name="MAX_FILE_SIZE" value="1024000">
-Upload Image: <input type="file" name="fImgUpload"> <br /> <br/>
-<input type="submit" class="btn btn-default" value="Upload Image" name="fUpload">
-</form>
-</div>
-