summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--preferences.php2
-rw-r--r--role_register.php6
-rw-r--r--templates/user_assigned_modules.tpl4
-rw-r--r--templates/user_theme.tpl75
-rw-r--r--theme.php282
5 files changed, 4 insertions, 365 deletions
diff --git a/preferences.php b/preferences.php
index afbcf08..820946f 100644
--- a/preferences.php
+++ b/preferences.php
@@ -41,7 +41,7 @@ $parsedUrl = parse_url( $_SERVER["REQUEST_URI"] );
// settings only applicable when the wiki package is active
if( $gBitSystem->isPackageActive( 'wiki' )) {
- include_once( WIKI_PKG_PATH.'BitPage.php' );
+ include_once( WIKI_PKG_CLASS_PATH.'BitPage.php' );
$parsedUrl1 = str_replace( USERS_PKG_URL."user_preferences", WIKI_PKG_URL."edit", $parsedUrl["path"] );
$parsedUrl2 = str_replace( USERS_PKG_URL."user_preferences", WIKI_PKG_URL."index", $parsedUrl["path"] );
$gBitSmarty->assign( 'url_edit', httpPrefix(). $parsedUrl1 );
diff --git a/role_register.php b/role_register.php
index 948ca7d..1c6f862 100644
--- a/role_register.php
+++ b/role_register.php
@@ -17,9 +17,9 @@ if( isset( $_REQUEST['tk'] ) ) {
}
require_once( '../kernel/setup_inc.php' );
-require_once( KERNEL_PKG_PATH.'BitBase.php' );
-include_once( KERNEL_PKG_PATH.'notification_lib.php' );
-require_once( USERS_PKG_PATH.'includes/recaptchalib.php' );
+require_once( KERNEL_PKG_CLASS_PATH.'BitBase.php' );
+include_once( KERNEL_PKG_INCLUDE_PATH.'notification_lib.php' );
+// no longer supported, needs update - spiderr require_once( USERS_PKG_INCLUDE_PATH.'recaptchalib.php' );
$gBitSystem->verifyFeature( 'users_allow_register' );
diff --git a/templates/user_assigned_modules.tpl b/templates/user_assigned_modules.tpl
index 4c11822..f899d5b 100644
--- a/templates/user_assigned_modules.tpl
+++ b/templates/user_assigned_modules.tpl
@@ -157,10 +157,6 @@
<option value="{$styles[ix]|escape}" {if $assignStyle eq $styles[ix]}selected="selected"{/if}>{$styles[ix]}</option>
{/section}
</select>
-{if $gBitUser->hasPermission('bit_p_create_css')}
- &nbsp; <strong>{tr}OR{/tr}</strong> &nbsp;
- <a href="{$smarty.const.USERS_PKG_URL}theme.php?fUseCustomTheme=1">Use your custom theme >></a>
-{/if}
{formhelp note="Pick the theme for your personal Homepage."}
{/forminput}
</div>
diff --git a/templates/user_theme.tpl b/templates/user_theme.tpl
deleted file mode 100644
index e9106f6..0000000
--- a/templates/user_theme.tpl
+++ /dev/null
@@ -1,75 +0,0 @@
-<div class="edit themes">
- <div class="header">
- <h1>{tr}Theme Configuration{/tr}</h1>
- </div>
-
- <div class="body">
- {formfeedback success=$successMsg error=$errorMsg}
-
- {if $usingCustomTheme}
- <p>
- {tr}Use the form below to alter your custom theme. You can edit the css directly by using the
- text area. You can also manage the images used by your custom theme (for things like borders, backgrounds
- and the like). If there is a built in theme which you would like to base your custom theme on, you can
- do so by selecting it from the drop down list and clicking the "Reset CSS" button. If you want you can
- <a href="{$smarty.const.USERS_PKG_URL}assigned_modules.php">use one of the built in themes instead</a>.{/tr}
- </p>
-
- {form legend="CSS File Data"}
- <div class="form-group">
- {formlabel label="Load CSS File" for="reset"}
- {forminput}
- <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>
- {formhelp note="Loading a CSS file will erase any changes you have made so far and will replace it with the contents of the selected css file."}
- {/forminput}
- </div>
-
- <div class="form-group submit">
- <input type="submit" class="btn btn-default" name="fResetCSS" id="reset" value="Reset CSS File" onclick="return confirm('{tr}Are you sure you want to reset your CSS back to the defaults? Any changes you have made will be lost.{/tr}');" />
- </div>
-
- <div class="form-group">
- <textarea name="textData" rows="42" cols="50">{$data|escape}</textarea>
- </div>
-
- <div class="form-group submit">
- <input type="submit" class="btn btn-default" name="fSaveCSS" value="Save" />
- <input type="submit" class="btn btn-default" name="fCancelCSS" value="Cancel" />
- </div>
- {/form}
-
- {form enctype="multipart/form-data"}
- {legend legend="Upload new Image"}
- <div class="form-group">
- {formlabel label="Upload Image" for="upload"}
- {forminput}
- <input type="hidden" name="MAX_FILE_SIZE" value="1024000" />
- <input type="file" name="fImgUpload" />
- {formhelp note=""}
- {/forminput}
- </div>
-
- <div class="form-group submit">
- <input type="submit" class="btn btn-default" value="Upload Image" name="fUpload" id="upload" />
- </div>
- {/legend}
-
- {if $imagesCount > 0}
- {legend legend="Images Used By Your Custom Theme"}
- {section name=ix loop=$themeImages}
- <div class="{cycle values='odd,even'}">
- {$themeImages[ix]} <input name="fDeleteImg[{$themeImages[ix]}]" class="icon" type="image" src="{$smarty.const.LIBERTY_PKG_URL}icons/delete_small.gif" title="{tr}Remove{/tr}" alt="{tr}Remove{/tr}" onclick="return confirm('Are you sure you want to delete {$themeImages[ix]}?');" />
- <br />
- <img class="icon" src="{$gQueryUser->getStorageURL('theme/images/',$gQueryUser->mUserId,'')}{$themeImages[ix]}" title="{$themeImages[ix]}" alt="{tr}Preview Image{/tr}" />
- </div>
- {/section}
- {/legend}
- {/if}
- {/form}
- {/if}
- </div><!-- end .body -->
-</div><!-- end .themes -->
diff --git a/theme.php b/theme.php
deleted file mode 100644
index da2e2ce..0000000
--- a/theme.php
+++ /dev/null
@@ -1,282 +0,0 @@
-<?php
-/**
- * user theme selection
- *
- * @copyright (c) 2004-15 bitweaver.org
- *
- * @package users
- * @subpackage functions
- */
-global $gEditMode;
-$gEditMode = 'theme';
-
-/**
- * required setup
- */
-include_once( '../kernel/setup_inc.php' );
-include_once( THEMES_PKG_PATH.'css_lib.php' );
-include_once( KERNEL_PKG_CLASS_PATH.'BitSystem.php' );
-
-global $gBitUser, $gBitSystem;
-
-if (!$gBitUser->isRegistered()) {
- $gBitSmarty->assign('msg', tra("Permission denied: You are not logged in"));
- $gBitSystem->display( 'error.tpl' , NULL, array( 'display_mode' => 'display' ));
- die;
-}
-
-include_once(USERS_PKG_INCLUDE_PATH.'lookup_user_inc.php');
-
-if ($gQueryUser->mUserId != $gBitUser->mUserId && !$gBitUser->object_has_permission($gBitUser->mUserId, $gQueryUser->mInfo['content_id'], 'bituser', 'p_users_admin')) {
- $gBitSmarty->assign('msg', tra('You do not have permission to edit this user\'s theme'));
- $gBitSystem->display('error.tpl', NULL, array( 'display_mode' => 'display' ));
- die;
-}
-
-//******* HELPER FUNCTIONS *******
-// get an array of filesnames in the given directory
-function ls_a($wh)
-{
- $files = NULL;
- if (is_dir($wh) && $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;
-}
-
-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
- }
- }
-}
-
-//******** END HELPER FUNCTIONS **********
-
-$F = array();
-$errorMsg = array();
-
-// Special case: the admin has turned of custom user themes but this user currently uses his/her custom theme
-if ($gQueryUser->getPreference( 'theme' ) == 'custom' && !$gBitUser->canCustomizeTheme() ) {
- $gQueryUser->storePreference('theme', NULL); // Set their homepage theme to fall back to the site's themeImages
- $gQueryUser->setPreference( 'theme', NULL ); // Update their mPrefs
-}
-
-$usingCustomTheme = ($gQueryUser->getPreference( 'theme' ) == 'custom' ? true : false);
-
-$gBitSmarty->assignByRef('usingCustomTheme', $usingCustomTheme);
-
-if( !$gBitUser->canCustomizeTheme() ) {
- $gBitSmarty->assign('msg', tra("Feature disabled"));
- $gBitSystem->display( 'error.tpl' , NULL, array( 'display_mode' => 'display' ));
- die;
-}
-
-$customCSSPath = $gQueryUser->getStoragePath('theme', $gQueryUser->mUserId, NULL); // Path to this user's storage directory
-
-$customCSSFile = $customCSSPath.'custom.css'; // Path to this user's custom stylesheet
-$customCSSImageURL = $gQueryUser->getStorageURL( '/theme/images/', $gQueryUser->mUserId );
-$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' => 'display' ));
- die;
- }
-}
-
-if (isset($_REQUEST['fUseStandardTheme']) && $_REQUEST['fUseStandardTheme']) {
- $gQueryUser->storePreference('theme', NULL);
- $usingCustomTheme = false;
-}
-
-if (isset($_REQUEST['fUseCustomTheme']) && $_REQUEST['fUseCustomTheme']) {
- $gQueryUser->storePreference('theme', 'custom');
- $usingCustomTheme = true;
-}
-
-if ($usingCustomTheme) {
- $assignStyle = 'basic';
-
- // 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' => 'display' ));
- 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)
- unlink_r( $customCSSPath );
- mkdir_p( $customCSSPath.'/images' );
- $resetStyle = $_REQUEST['resetStyle'];
- $cssData = $csslib->load_css2_file(THEMES_PKG_PATH."styles/$resetStyle/$resetStyle.css");
- if (file_exists($customCSSPath.'/images')) {
- $gBitThemes->expunge_dir($customCSSPath.'/images/');
- } else {
- mkdir_p($customCSSPath);
- }
-
- if (file_exists(THEMES_PKG_PATH."styles/$resetStyle/images")) {
- //clean out any old junk
- copy_dirs(THEMES_PKG_PATH."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' => 'display' ));
- die;
- }
-
- fwrite($fp, $cssData);
- fclose ($fp);
- $successMsg[] = "Your CSS has been reset to the $resetStyle theme.";
-
- } elseif (isset($_REQUEST['fUpload'])) {
- 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 (!file_exists($customCSSPath.'/images')) {
- mkdir_p($customCSSPath.'/images');
- }
- 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'])) {
- /*$imgArray = $_REQUEST['fDeleteImg'];
- foreach($imgArray as $key => $value) {
- $imgPath = $customCSSPath.'/images/'.$key;
- if (file_exists($imgPath)) {
- unlink($imgPath);
- $successMsg[] = "$key successfully deleted";
- } else {
- $errorMsg[] = "$key does not exists!";
- }
- }*/
- $imgName = key( $_REQUEST['fDeleteImg'] );
- $imgPath = $customCSSPath.'/images/'.$imgName;
- if (file_exists($imgPath)) {
- unlink($imgPath);
- $successMsg[] = "$imgName successfully deleted";
- } else {
- $errorMsg[] = "$imgName does not exists!";
- }
- } else {
- $action = 'edit';
- }
-} else {
- // User is selecting from the standard themes
- if (isset($_REQUEST['fChangeTheme']) && $_REQUEST['fChangeTheme']) {
- $gQueryUser->storePreference('theme', NULL);
- $successMsg[] = "Theme successfully changed to ".$_REQUEST['fStyleChoice'];
- $assignStyle = $_REQUEST['fStyleChoice'];
- }
- header( 'Location: '.USERS_PKG_URL.'assigned_modules.php' );
-}
-
-// Get the list of themes the user can choose to derive from (aka Reset to)
-$styles = $gBitThemes->getStyles( NULL, ($usingCustomTheme ? FALSE : TRUE), FALSE );
-$gBitSmarty->assignByRef( 'styles', $styles );
-
-// $assignStyle is the default style which will be selected in the drop down list
-if (!isset($assignStyle)) {
- $assignStyle = $gQueryUser->getPreference('theme', '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);
-
-// Export success/error messages for display in the tpl.
-if (isset($successMsg))
- $gBitSmarty->assignByRef('successMsg',$successMsg);
-if (isset($errorMsg))
- $gBitSmarty->assignByRef('errorMsg', $errorMsg);
-
-// Get the list of images used by this user's custom theme
-$imageList = ls_a($customCSSPath.'images/');
-$themeImages = array();
-if( count( $imageList ) ) {
- foreach ($imageList as $image) {
- if (ereg(".JPG$|.PNG$|.GIF$|.BMP$",strtoupper($image))) {
- $themeImages[] = $image;
- }
- }
-}
-
-$gBitSmarty->assign('imagesCount', count($themeImages));
-$gBitSmarty->assignByRef('themeImages',$themeImages);
-$gBitSmarty->assign('SCRIPT_NAME', $_SERVER['SCRIPT_NAME']);
-$gBitSmarty->assignByRef('gQueryUser', $gQueryUser);
-
-$gBitSystem->display( 'bitpackage:users/user_theme.tpl', NULL, array( 'display_mode' => 'display' ));
-?>