public function settings()
 {
     $errors = false;
     if (get_request_method() == 'POST') {
         $data = $_POST['settings'];
         $settings = array();
         $settings['filemanager_base'] = preg_replace('/\\s+/', '', $data['filemanager_base']);
         $settings['filemanager_base'] = trim($settings['filemanager_base'], '/');
         $settings['filemanager_view'] = isset($data['filemanager_view']) ? $data['filemanager_view'] : 'grid';
         // image extensions
         if (isset($data['filemanager_images'])) {
             $settings['filemanager_images'] = serialize($data['filemanager_images']);
         } else {
             $errors[] = __("You need to select at least one image extension!");
         }
         $settings['filemanager_upload_size'] = !empty($data['filemanager_upload_size']) && is_numeric($data['filemanager_upload_size']) ? $data['filemanager_upload_size'] : '0';
         $settings['filemanager_dateformat'] = !empty($data['filemanager_dateformat']) ? trim($data['filemanager_dateformat']) : 'd M Y H:i';
         $booleans = array('filemanager_enabled', 'filemanager_browse_only', 'filemanager_upload_overwrite', 'filemanager_upload_images_only');
         foreach ($booleans as $bool) {
             $settings[$bool] = isset($data[$bool]) && $data[$bool] == 1 ? '1' : '0';
         }
         if (Plugin::setAllSettings($settings, 'ckeditor')) {
             Flash::setNow('success', 'Settings were updated successfully');
         } else {
             $errors[] = __("There was a problem saving the settings.");
         }
     } else {
         $settings = Plugin::getAllSettings('ckeditor');
     }
     if ($errors !== false) {
         Flash::setNow('error', implode('<br/>', $errors));
     }
     $this->display('settings', array('settings' => $settings));
 }
 /**
  * Save the settings
  *
  * @todo Add a sanity check for input.
  */
 function save()
 {
     $settings = $_POST['settings'];
     $ret = Plugin::setAllSettings($settings, 'multi_lang');
     if ($ret) {
         Flash::set('success', __('The settings have been updated.'));
     } else {
         Flash::set('error', 'An error has occurred while trying to save the settings.');
     }
     redirect(get_url('plugin/multi_lang/settings'));
 }
 function save()
 {
     $options = $_POST['options'];
     $ret = Plugin::setAllSettings($options, 'easysnippet');
     if ($ret) {
         Flash::set('success', __('The settings have been updated.'));
     } else {
         Flash::set('error', 'An error has occurred while trying to save the settings.');
     }
     redirect(get_url('plugin/easysnippet/settings'));
 }
Beispiel #4
0
 function save()
 {
     if (isset($_POST['settings'])) {
         if (Plugin::setAllSettings($_POST['settings'], 'archive')) {
             Flash::set('success', __('The settings have been saved.'));
         } else {
             Flash::set('error', __('An error occured trying to save the settings.'));
         }
     } else {
         Flash::set('error', __('Could not save settings, no settings found.'));
     }
     redirect(get_url('plugin/archive/settings'));
 }
 public function edit_settings()
 {
     if (isset($_POST['settings'])) {
         if (Plugin::setAllSettings($_POST['settings'], 'registered_users')) {
             Flash::set('success', __('The settings have been saved.'));
         } else {
             Flash::set('error', __('An error occured trying to save the settings.'));
         }
     } else {
         Flash::set('error', __('Could not save settings, no settings found.'));
     }
     redirect(get_url('plugin/registered_users/settings'));
 }
 function save()
 {
     if (isset($_POST['settings'])) {
         $settings = $_POST['settings'];
         $ret = Plugin::setAllSettings($settings, 'backup_restore');
         if ($ret) {
             Flash::set('success', __('The settings have been saved.'));
         } else {
             Flash::set('error', 'An error occured trying to save the settings.');
         }
     } else {
         Flash::set('error', 'Could not save settings, no settings found.');
     }
     redirect(get_url('plugin/backup_restore/settings'));
 }
Beispiel #7
0
 function save()
 {
     if (isset($_POST['settings'])) {
         $settings = $_POST['settings'];
         foreach ($settings as $key => $value) {
             $settings[$key] = mysql_escape_string($value);
         }
         $ret = Plugin::setAllSettings($settings, 'archive');
         if ($ret) {
             Flash::set('success', __('The settings have been saved.'));
         } else {
             Flash::set('error', 'An error occured trying to save the settings.');
         }
     } else {
         Flash::set('error', 'Could not save settings, no settings found.');
     }
     redirect(get_url('plugin/archive/settings'));
 }
	public function settings($save=false) {
		
		self::__checkPermission('redirector_settings');
		
		if ( $save ) {
			
			$settings['threshold'] = (int)$_POST['threshold'];
			$settings['expireafter'] = (int)$_POST['expireafter'];
			
			if ( ! Plugin::setAllSettings($settings, 'redirector') )
				Flash::set('error',__('Could not save settings!'));
			
			redirect( get_url('plugin/redirector/settings') );
		
		}
		
		$this->display('redirector/views/settings', $this->settings);
	
	}
Beispiel #9
0
 * This file is part of Wolf CMS. Wolf CMS is licensed under the GNU GPLv3 license.
 * Please see license.txt for the full license text.
 */
/**
 * The multi lang plugin redirects users to a page with content in their language.
 *
 * The redirect only occurs when a user's indicated preferred language is
 * available. There are multiple methods to determine the desired language.
 * These are:
 *
 * - HTTP_ACCEPT_LANG header
 * - URI based language hint (for example: http://www.example.com/en/page.html
 * - Preferred language setting of logged in users
 *
 * @package Plugins
 * @subpackage multi-lang
 *
 * @author Martijn van der Kleijn <*****@*****.**>
 * @copyright Martijn van der Kleijn, 2010
 * @license http://www.gnu.org/licenses/gpl.html GPLv3 license
 */
/* Security measure */
if (!defined('IN_CMS')) {
    exit;
}
$PDO = Record::getConnection();
$driver = strtolower($PDO->getAttribute(Record::ATTR_DRIVER_NAME));
// Store settings
$settings = array('style' => 'tab', 'langsource' => 'header');
Plugin::setAllSettings($settings, 'multi_lang');
Beispiel #10
0
 public function save()
 {
     if (!$this->_isInternal()) {
         page_not_found();
     }
     $imgPath = array_key_exists('img-path', $_POST) ? $_POST['img-path'] : '';
     if ($imgPath === '/' or $imgPath === '\\') {
         $imgPath = '';
     }
     $settings = array('path' => $imgPath);
     if (Plugin::setAllSettings($settings, 'image')) {
         Flash::set('success', 'Image - ' . __('plugin settings saved.'));
     } else {
         Flash::set('error', 'Image - ' . __('plugin settings not saved!'));
     }
     redirect(get_url('plugin/image/settings'));
 }
Beispiel #11
0
 public function save()
 {
     $tablename = TABLE_PREFIX . 'tinymce';
     if (!array_key_exists('listhidden', $_POST)) {
         $listhidden = '0';
     } else {
         $listhidden = '1';
     }
     if (!array_key_exists('imagesdir', $_POST) || !array_key_exists('imagesuri', $_POST) || !array_key_exists('cssuri', $_POST)) {
         Flash::set('error', 'TinyMCE - ' . __('form was not posted.'));
         redirect(get_url('plugin/tinymce'));
     } else {
         $imagesdir = $_POST['imagesdir'];
         $imagesuri = $_POST['imagesuri'];
         $cssuri = $_POST['cssuri'];
         if ($imagesdir[strlen($imagesdir) - 1] == '/' || $imagesdir[strlen($imagesdir) - 1] == '\\') {
             $imagesdir = substr($imagesdir, 0, strlen($imagesdir) - 1);
         }
         if ($imagesuri[strlen($imagesuri) - 1] == '/' || $imagesuri[strlen($imagesuri) - 1] == '\\') {
             $imagesuri = substr($imagesuri, 0, strlen($imagesuri) - 1);
         }
     }
     if (empty($imagesdir) || empty($imagesuri) || empty($cssuri)) {
         Flash::set('error', 'TinyMCE - ' . __('one of the fields was empty, please try again!'));
         redirect(get_url('plugin/tinymce'));
     } else {
         $settings = array('listhidden' => $listhidden, 'imagesdir' => $imagesdir, 'imagesuri' => $imagesuri, 'cssuri' => $cssuri);
         if (Plugin::setAllSettings($settings, 'tinymce')) {
             Flash::set('success', 'TinyMCE - ' . __('plugin settings saved.'));
         } else {
             Flash::set('error', 'TinyMCE - ' . __('plugin settings not saved!'));
         }
         redirect(get_url('plugin/tinymce/settings'));
     }
 }
 public function settings_save()
 {
     AuthUser::load();
     if (!AuthUser::isLoggedIn()) {
         redirect(get_url('login'));
     } else {
         if (!AuthUser::hasPermission('admin_edit')) {
             Flash::set('error', __('You do not have permission to access the requested page!'));
             redirect(get_url());
         }
     }
     if (!isset($_POST['settings'])) {
         Flash::set('error', 'File Manager - ' . __('form was not posted.'));
         redirect(get_url('plugin/file_manager/settings'));
     } else {
         $settings = $_POST['settings'];
         if ($settings['umask'] == 0) {
             $settings['umask'] = 0;
         } elseif (!preg_match('/^0?[0-7]{3}$/', $settings['umask'])) {
             $settings['umask'] = 0;
         }
         if (strlen($settings['umask']) === 3) {
             $settings['umask'] = '0' . $settings['umask'];
         } elseif (strlen($settings['umask']) !== 4 && $settings['umask'] != 0) {
             $settings['umask'] = 0;
         }
         if (!preg_match('/^0?[0-7]{3}$/', $settings['dirmode'])) {
             $settings['dirmode'] = '0755';
         }
         if (strlen($settings['dirmode']) === 3) {
             $settings['dirmode'] = '0' . $settings['dirmode'];
         }
         if (!preg_match('/^0?[0-7]{3}$/', $settings['filemode'])) {
             $settings['filemode'] = '0755';
         }
         if (strlen($settings['filemode']) === 3) {
             $settings['filemode'] = '0' . $settings['filemode'];
         }
     }
     if (Plugin::setAllSettings($settings, 'file_manager')) {
         Flash::setNow('success', 'File Manager - ' . __('plugin settings saved.'));
     } else {
         Flash::setNow('error', 'File Manager - ' . __('plugin settings not saved!'));
     }
     $this->display('file_manager/views/settings', array('settings' => $settings));
 }
Beispiel #13
0
<?php

/*
 * Wolf CMS - Content Management Simplified. <http://www.wolfcms.org>
 * Copyright (C) 2009-2011 Martijn van der Kleijn <*****@*****.**>
 *
 * This file is part of Wolf CMS. Wolf CMS is licensed under the GNU GPLv3 license.
 * Please see license.txt for the full license text.
 */
/* Security measure */
if (!defined('IN_CMS')) {
    exit;
}
/**
 * The BackupRestore plugin provides administrators with the option of backing
 * up their pages and settings to an XML file.
 *
 * @package Plugins
 * @subpackage backup_restore
 *
 * @author Martijn van der Kleijn <*****@*****.**>
 * @copyright Martijn van der Kleijn, 2009-2011
 * @license http://www.gnu.org/licenses/gpl.html GPLv3 license
 */
// Check if the plugin's settings already exist and create them if not.
if (Plugin::getSetting('zip', 'backup_restore') === false) {
    // Store settings new style
    $settings = array('zip' => '1', 'pwd' => '1', 'default_pwd' => 'pswpsw123', 'stamp' => 'Ymd', 'extension' => 'xml', 'wolfversion' => '0.6.0');
    Plugin::setAllSettings($settings, 'backup_restore');
}
Beispiel #14
0
 * @copyright Philippe Archambault & Martijn van der Kleijn, 2008
 * @license http://www.gnu.org/licenses/gpl.html GPLv3 license
 */
$PDO = Record::getConnection();
$driver = strtolower($PDO->getAttribute(Record::ATTR_DRIVER_NAME));
// Setup table structure
if ($driver == 'mysql') {
    $PDO->exec("CREATE TABLE " . TABLE_PREFIX . "comment (\n\t  id int(11) unsigned NOT NULL auto_increment,\n\t  page_id int(11) unsigned NOT NULL default '0',\n\t  body text,\n\t  author_name varchar(50) default NULL,\n\t  author_email varchar(100) default NULL,\n\t  author_link varchar(100) default NULL,\n          ip char(100) NOT NULL default '0',\n\t  is_approved tinyint(1) unsigned NOT NULL default '1',\n\t  created_on datetime default NULL,\n\t  PRIMARY KEY  (id),\n\t  KEY page_id (page_id),\n\t  KEY created_on (created_on)\n\t) ENGINE=MyISAM  DEFAULT CHARSET=utf8");
    $PDO->exec("ALTER TABLE " . TABLE_PREFIX . "page ADD comment_status tinyint(1) NOT NULL default '0' AFTER status_id");
} else {
    if ($driver == 'sqlite') {
        $PDO->exec("CREATE TABLE comment (\n                id INTEGER NOT NULL PRIMARY KEY,\n                page_id int(11) NOT NULL default '0',\n                body text ,\n                author_name varchar(50) default NULL ,\n                author_email varchar(100) default NULL ,\n                author_link varchar(100) default NULL ,\n                ip char(100) NOT NULL default '0' ,\n                is_approved tinyint(1) NOT NULL default '1' ,\n                created_on datetime default NULL\n              )");
        $PDO->exec("CREATE INDEX comment_page_id ON comment (page_id)");
        $PDO->exec("CREATE INDEX comment_created_on ON comment (created_on)");
        $PDO->exec("ALTER TABLE page ADD comment_status tinyint(1) NOT NULL default '0'");
    } else {
        if ($driver == 'pgsql') {
            $PDO->exec("CREATE TABLE " . TABLE_PREFIX . "comment (\n        id serial,\n        page_id integer NOT NULL DEFAULT 0,\n        body text,\n        author_name character varying(50) DEFAULT NULL,\n        author_email character varying(100) DEFAULT NULL,\n        author_link character varying(100) DEFAULT NULL,\n        ip char(100) NOT NULL default '0',\n        is_approved integer NOT NULL default 1,\n        created_on timestamp DEFAULT NULL,\n        PRIMARY KEY (id)\n    )");
            $PDO->exec("CREATE INDEX comment_page_id ON comment (page_id)");
            $PDO->exec("CREATE INDEX comment_created_on ON comment (created_on)");
            $PDO->exec("ALTER TABLE " . TABLE_PREFIX . "page ADD comment_status integer NOT NULL DEFAULT 0");
        }
    }
}
// Install snippets
$PDO->exec("INSERT INTO " . TABLE_PREFIX . "snippet (name, filter_id, content, content_html, created_on, created_by_id) VALUES ('comment-form', '', '<form action=\"<?php echo \$this->url(); ?>\" method=\"post\" id=\"comment_form\"> \r\n<p>\r\n\t<input class=\"comment-form-name\" type=\"text\" name=\"comment[author_name]\" id=\"comment_form_name\" value=\"\" size=\"22\" /> \r\n\t<label for=\"comment_form_name\"> Name (required)</label>\r\n</p>\r\n<p>\r\n\t<input class=\"comment-form-email\" type=\"text\" name=\"comment[author_email]\" id=\"comment_form_email\" value=\"\" size=\"22\" /> \r\n\t<label for=\"comment_form_email\"> Email (will not be published; required)</label>\r\n</p>\r\n<p>\r\n\t<input class=\"comment-form-link\" type=\"text\" name=\"comment[author_link]\" id=\"comment_form_link\" value=\"\" size=\"22\" /> \r\n\t<label for=\"comment_form_link\"> Website</label>\r\n</p>\r\n<p>\r\n\t<?php captcha(); ?>\r\n</p>\r\n<p>\r\n\t<textarea class=\"comment-form-body\" id=\"comment_form_body\" name=\"comment[body]\" cols=\"100%\" rows=\"10\"></textarea>\r\n</p>\r\n<p>\r\n\t<input class=\"comment-form-submit\" type=\"submit\" name=\"commit-comment\" id=\"comment_form_submit\" value=\"Submit comment\" />\r\n</p>\r\n</form>', '<form action=\"<?php echo \$this->url(); ?>\" method=\"post\" id=\"comment_form\"> \r\n<p>\r\n\t<input class=\"comment-form-name\" type=\"text\" name=\"comment[author_name]\" id=\"comment_form_name\" value=\"\" size=\"22\" /> \r\n\t<label for=\"comment_form_name\"> Name (required)</label>\r\n</p>\r\n<p>\r\n\t<input class=\"comment-form-email\" type=\"text\" name=\"comment[author_email]\" id=\"comment_form_email\" value=\"\" size=\"22\" /> \r\n\t<label for=\"comment_form_email\"> Email (will not be published; required)</label>\r\n</p>\r\n<p>\r\n\t<input class=\"comment-form-link\" type=\"text\" name=\"comment[author_link]\" id=\"comment_form_link\" value=\"\" size=\"22\" /> \r\n\t<label for=\"comment_form_link\"> Website</label>\r\n</p>\r\n<p>\r\n <?php captcha(); ?>\r\n</p>\r\n<p>\r\n\t<textarea class=\"comment-form-body\" id=\"comment_form_body\" name=\"comment[body]\" cols=\"100%\" rows=\"10\"></textarea>\r\n</p>\r\n<p>\r\n\t<input class=\"comment-form-submit\" type=\"submit\" name=\"commit-comment\" id=\"comment_form_submit\" value=\"Submit comment\" />\r\n</p>\r\n</form>', '" . date('Y-m-d H:i:s') . "', 1);");
$PDO->exec("INSERT INTO " . TABLE_PREFIX . "snippet (name, filter_id, content, content_html, created_on, created_by_id) VALUES ('comment-each', '', '<p><strong><?php echo \$num_comments = comments_count(\$this); ?></strong> comment<?php if (\$num_comments != 1) { echo ''s''; } ?></p>\r\n<?php \$comments = comments(\$this); ?>\r\n<ol class=\"comments\">\r\n<?php foreach (\$comments as \$comment): ?>\r\n  <li class=\"comment\">\r\n    <p><?php echo nl2br(\$comment->body()); ?></p>\r\n    <p> &#8212; <?php echo \$comment->name(); ?> <small class=\"comment-date\"><?php echo \$comment->date(); ?></small></p>\r\n  </li>\r\n<?php endforeach; // comments; ?>\r\n</ol>', '<p><strong><?php echo \$num_comments = comments_count(\$this); ?></strong> comment<?php if (\$num_comments != 1) { echo ''s''; } ?></p>\r\n<?php \$comments = comments(\$this); ?>\r\n<ol class=\"comments\">\r\n<?php foreach (\$comments as \$comment): ?>\r\n  <li class=\"comment\">\r\n    <p><?php echo nl2br(\$comment->body()); ?></p>\r\n    <p> — <?php echo \$comment->name(); ?> <small class=\"comment-date\"><?php echo \$comment->date(); ?></small></p>\r\n  </li>\r\n<?php endforeach; // comments; ?>\r\n</ol>', '" . date('Y-m-d H:i:s') . "', 1)");
// Store settings new style
$settings = array('auto_approve_comment' => '0', 'use_captcha' => '1', 'rowspage' => '15', 'numlabel' => '1');
Plugin::setAllSettings($settings, 'comment');
Beispiel #15
0
<?php

defined('IN_CMS') || exit;
$images = serialize(array('gif', 'jpg', 'jpeg', 'png'));
$settings = array('version' => '2.1.0', 'filemanager_enabled' => '1', 'filemanager_base' => 'public/images', 'filemanager_view' => 'grid', 'filemanager_images' => $images, 'filemanager_dateformat' => 'd M Y H:i', 'filemanager_browse_only' => '0', 'filemanager_upload_overwrite' => '0', 'filemanager_upload_images_only' => '0', 'filemanager_upload_size' => '0');
$old = Plugin::getAllSettings('ckeditor');
//Other ckeditor filter
if (isset($old['fileBrowserRootUri'])) {
    $settings['filemanager_base'] = trim($old['fileBrowserRootUri'], '/');
} else {
    if (isset($old['filemanager_base'])) {
        $settings = $old;
        $settings['version'] = '2.1.0';
    }
}
// Remove all settings from db
Plugin::deleteAllSettings('ckeditor');
// Insert the new ones
if (Plugin::setAllSettings($settings, 'ckeditor')) {
    Flash::setNow('success', __('CKEditor - plugin settings initialized.'));
}
if (!defined('USE_MOD_REWRITE') || !USE_MOD_REWRITE) {
    Flash::set('info', __('FileManager will not ne ebabled if "MOD_REWRITE" is set to false'));
} else {
    Flash::setNow('error', __('CKEditor - unable to store plugin settings!'));
}
Beispiel #16
0
 * This file is part of Wolf CMS. Wolf CMS is licensed under the GNU GPLv3 license.
 * Please see license.txt for the full license text.
 */
/* Security measure */
if (!defined('IN_CMS')) {
    exit;
}
/**
 * The FileManager allows users to upload and manipulate files.
 *
 * Note - Mostly rewritten since Wolf CMS 0.6.0
 *
 * @package Plugins
 * @subpackage file_manager
 *
 * @author Martijn van der Kleijn <*****@*****.**>
 * @copyright Martijn van der Kleijn, 2008-2010
 * @license http://www.gnu.org/licenses/gpl.html GPLv3 license
 *
 * @todo Starting from PHP 5.3, use FileInfo
 */
//	check for settings
$settings = Plugin::getAllSettings('file_manager');
//	merge settings
$settings = array('umask' => isset($settings['umask']) ? $settings['umask'] : '0022', 'dirmode' => isset($settings['dirmode']) ? $settings['dirmode'] : '0755', 'filemode' => isset($settings['filemode']) ? $settings['filemode'] : '0644', 'show_hidden' => isset($settings['show_hidden']) ? $settings['show_hidden'] : '0', 'show_backups' => isset($settings['show_backups']) ? $settings['show_backups'] : '1');
//	flash message
if (Plugin::setAllSettings($settings, 'file_manager')) {
    Flash::set('success', 'File Manager - ' . __('plugin settings initialized.'));
} else {
    Flash::set('error', 'File Manager - ' . __('unable to store plugin settings!'));
}
Beispiel #17
0
<?php

/*
 * Wolf CMS - Content Management Simplified. <http://www.wolfcms.org>
 * Copyright (C) 2011 Martijn van der Kleijn <*****@*****.**>
 *
 * This file is part of Wolf CMS. Wolf CMS is licensed under the GNU GPLv3 license.
 * Please see license.txt for the full license text.
 */
/**
 * The Archive plugin provides an Archive pagetype behaving similar to a blog or news archive.
 *
 * @package Plugins
 * @subpackage archive
 *
 * @author Martijn van der Kleijn <*****@*****.**>
 * @copyright Martijn van der Kleijn, 2011
 * @license http://www.gnu.org/licenses/gpl.html GPLv3 license
 */
/* Security measure */
if (!defined('IN_CMS')) {
    exit;
}
// Store settings new style
$settings = array('use_dates' => '1');
Plugin::setAllSettings($settings, 'archive');
if (!defined("IN_CMS")) {
    exit;
}
// CHECK
$error = true;
if (version_compare(PHP_VERSION, "5.3.0") <= 0) {
    $error = "php";
} else {
    $themes = Setting::getThemes();
    $supported = array("fox", "wint", "wordpress-3.8");
    foreach ($themes as $key => $theme) {
        if (in_array($key, $supported)) {
            $error = false;
            break;
        }
    }
}
// PERFORM
if ($error !== false) {
    if ($error !== "php") {
        Plugin::deactivate("themer");
        Flash::set("error", __("This plugin requires a pawedWolf admin theme!"));
    } else {
        Plugin::deactivate("themer");
        Flash::set("error", __("This plugin requires PHP 5.3 or higher!"));
    }
} else {
    Plugin::deleteAllSettings("themer");
    $settings = array("fox" => serialize(array("color" => "fox.css")), "wordpress-3.8" => serialize(array("color" => "default.css", "sidebar_width" => 180)), "wint" => serialize(array("color" => "default.css", "sidebar_width" => 200, "responsive" => true)));
    Plugin::setAllSettings($settings, "themer");
}
Beispiel #19
0
    // Store settings.
    if (Plugin::setAllSettings($settings, 'tinymce')) {
        if ($upgrade) {
            Flash::set('success', __('TinyMCE - plugin settings copied from old installation.'));
        } else {
            Flash::set('success', __('TinyMCE - plugin settings initialized.'));
        }
    } else {
        Flash::set('error', __('TinyMCE - unable to store plugin settings!'));
    }
} else {
    // Found an old post-2.0.0 RC1 install
    $settings = Plugin::getAllSettings('tinymce');
    $settings = array('version' => '3.5.0', 'tb_obfuscate' => 'sukthvgnhgliuhgldutnvlru', 'tb_docroot' => '/var/www', 'tb_unixpermissions' => '0755', 'tb_imagepath' => '/wolfcms/public/images/', 'tb_mediapath' => '/wolfcms/public/media/', 'tb_filepath' => '/wolfcms/public/files/', 'tb_maximagesize' => '0', 'tb_maxmediasize' => '0', 'tb_maxfilesize' => '0', 'tb_autoresizewidth' => '0', 'tb_autoresizeheight' => '0', 'tb_thumbsize' => '80', 'tb_imagequality' => '80', 'tb_thumbquality' => '80', 'tb_allowedimagestypes' => '*.jpg, *.jpeg, *.gif, *.png', 'tb_allowedmediatypes' => '*.swf, *.dcr, *.mov, *.qt, *.mpg, *.mp3, *.mp4, *.mpeg, *.avi, *.wmv, *.wm, *.asf, *.asx, *.wmx, *.wvx, *.rm, *.ra, *.ram', 'tb_allowedfiletypes' => '*.*');
    // Store settings.
    if (Plugin::setAllSettings($settings, 'tinymce')) {
        Flash::set('success', __('TinyMCE - plugin settings updated.'));
    } else {
        Flash::set('error', __('TinyMCE - unable to store plugin settings!'));
    }
}
/**
 * This function checks to see if there is a valid old installation with regards to the DB.
 * 
 * @return boolean
 */
function checkForOldInstall()
{
    $tablename = TABLE_PREFIX . 'tinymce';
    $PDO = Record::getConnection();
    $sql = "SELECT COUNT(*) FROM {$tablename}";
	/**
	 * Saves settings of plugin. Requires role have permission 'banner_settings'.
	 *
	 * @param string $permission - possible values banner_view, banner_new, banner_edit, banner_delete, banner_settings
	 * @return redirects the user if they do not have permission
	 */
	public function settings_save() {
		$this->__checkPermission('banner_settings');
		
		//	clean any keys from the $_POST array that aren't valid
		$settings = $this->__clean($_POST,self::VALID_SETTINGS);
		
		//	sanitize the input path
		$settings['imgpath'] = $this->__sanitize($settings['imgpath']);
		$settings['imguri'] = $this->__sanitize($settings['imguri']);
		
		
		//	make sure classes and targets only have a limited set of characters in them
		$settings['cssclass'] = preg_replace('/[^a-z0-9\s_-]/i','',$settings['cssclass']);
		$settings['target'] = preg_replace('/[^a-z0-9_-]/i','',$settings['target']);
		
		//	cleanup the masks
		$settings['umask'] = (int)$settings['umask'] == 0 ? 0 : sprintf("%04s",(int)$settings['umask']<=777 ? (int)$settings['umask'] : 0);
		$settings['dirmode'] = sprintf("%04s",(int)$settings['dirmode']<=777 && 111 <= (int)$settings['dirmode'] ? (int)$settings['dirmode'] : 755);
		$settings['filemode'] = sprintf("%04s",(int)$settings['filemode']<=777 && 111 <= (int)$settings['filemode'] ? (int)$settings['filemode'] : 644);
		
		if (Plugin::setAllSettings($settings, 'banner')) Flash::set('success', 'Banners - '.__('plugin settings saved.'));
		else Flash::set('error', 'Banners - '.__('plugin settings not saved!'));

		redirect(get_url('plugin/banner/settings'));

	}//*/
Beispiel #21
0
		
		//	create new permissions
		if ( ! Installer::createPermissions('facts_view,facts_new,facts_edit,facts_delete') ) Installer::failInstall( 'facts' );

		//	create new roles
		if ( ! Installer::createRoles('facts admin,facts editor,facts user') ) Installer::failInstall( 'facts' );
			
		//	assign permissions
		//	note: admin_view is needed in case they don't have any other permissions, otherwise they won't be able to log in to admin interface
		if ( ! Installer::assignPermissions('administrator','facts_view,facts_new,facts_edit,facts_delete') ) Installer::failInstall( 'facts' );
		if ( ! Installer::assignPermissions('editor','facts_view') ) Installer::failInstall( 'facts' );
		if ( ! Installer::assignPermissions('facts admin','admin_view,facts_view,facts_new,facts_edit,facts_delete') ) Installer::failInstall( 'facts' );
		if ( ! Installer::assignPermissions('facts editor','admin_view,facts_view,facts_new,facts_edit,facts_delete') ) Installer::failInstall( 'facts' );
		if ( ! Installer::assignPermissions('facts user','admin_view,facts_view') ) Installer::failInstall( 'facts' );
		
		//	setup plugin settings
		$settings = array(
			'version'		=>	'0.0.2'
		);
		if ( ! Plugin::setAllSettings($settings, 'facts') ) Installer::failInstall( 'facts', __('Unable to store plugin settings!') );
			
		Flash::set('success', __('Successfully installed Facts plugin.'));
		
		//	we must exit the switch so upgrades are not applied to new installation (they should already be integrated for new installs)
		break;
		
	//	upgrade 0.0.2 to 0.0.3
	case '0.0.2':
		// nothing here because we're still on 0.0.2, if we were on 0.0.1 and this was 0.0.3 upgrades would process in order
	
}
SQL;
		$sql = $driver == 'mysql' ? $errors_table_mysql : $errors_table_sqlite ;
		if ( ! Installer::query($sql) ) Installer::failInstall( 'redirector', __('Could not alter table 2 of 2.') );

		//	create new permissions
		if ( ! Installer::createPermissions('redirector_view,redirector_new,redirector_edit,redirector_delete,redirector_settings') ) Installer::failInstall( 'redirector' );

		//	create new roles
		if ( ! Installer::createRoles('redirector admin,redirector editor,redirector user') ) Installer::failInstall( 'redirector' );
			
		//	assign permissions
		//	note: admin_view is needed in case they don't have any other permissions, otherwise they won't be able to log in to admin interface
		if ( ! Installer::assignPermissions('administrator','redirector_view,redirector_new,redirector_edit,redirector_delete,redirector_settings') ) Installer::failInstall( 'redirector' );
		if ( ! Installer::assignPermissions('editor','redirector_view') ) Installer::failInstall( 'redirector' );
		if ( ! Installer::assignPermissions('redirector admin','admin_view,redirector_view,redirector_new,redirector_edit,redirector_delete,redirector_settings') ) Installer::failInstall( 'redirector' );
		if ( ! Installer::assignPermissions('redirector editor','admin_view,redirector_view,redirector_new,redirector_edit,redirector_delete') ) Installer::failInstall( 'redirector' );
		if ( ! Installer::assignPermissions('redirector user','admin_view,redirector_view') ) Installer::failInstall( 'redirector' );
		
		//	setup plugin settings
		$settings = array(
			'version'		=>	'0.2.5',
			'threshold'		=>	'10',
			'expireafter'	=>	'365'
		);
		if ( ! Plugin::setAllSettings($settings, 'redirector') ) Installer::failInstall( 'redirector', __('Unable to store plugin settings!') );

		Flash::set( 'success', __('Successfully upgraded Redirector plugin.') );
		break;

}
// EOF
 private function _saveSettings($post, $type)
 {
     $this->_check("user_config");
     // VALIDATE REQUEST
     if (!isset($post["token"]) || !SecureToken::validateToken($post["token"], get_url("user/settings/" . $type))) {
         $this->errors[] = __("The CSRF Token does not exist or is invalid!");
         return false;
     }
     $settings = $this->_validateSettings($post, $type);
     // UPDATE AND REDIRECT
     if (!empty($settings)) {
         if (Plugin::setAllSettings($settings, "paw_users")) {
             $this->_redirect(get_url("user/settings/success#" . $type));
         }
     }
     $this->errors[] = __("An unknown error is occurred!");
     return false;
 }
 public function save()
 {
     $tablename = TABLE_PREFIX . 'ckeditor';
     if (!array_key_exists('urlBrowserEnable', $_POST)) {
         $urlBrowserEnable = '0';
     } else {
         $urlBrowserEnable = '1';
     }
     if (!array_key_exists('urlBrowserListHidden', $_POST)) {
         $urlBrowserListHidden = '0';
     } else {
         $urlBrowserListHidden = '1';
     }
     if (!array_key_exists('fileBrowserEnable', $_POST)) {
         $fileBrowserEnable = '0';
     } else {
         $fileBrowserEnable = '1';
     }
     if (!array_key_exists('fileBrowserRootDir', $_POST) || !array_key_exists('fileBrowserRootUri', $_POST) || !array_key_exists('editorContentsCss', $_POST) || !array_key_exists('editorToolbarSet', $_POST)) {
         Flash::set('error', 'CKEditor - ' . __('form was not posted.'));
         redirect(get_url('plugin/ckeditor/settings'));
     } else {
         $fileBrowserRootDir = $_POST['fileBrowserRootDir'];
         $fileBrowserRootUri = $_POST['fileBrowserRootUri'];
         $editorContentsCss = $_POST['editorContentsCss'];
         $editorToolbarSet = $_POST['editorToolbarSet'];
         if ($fileBrowserRootDir[strlen($fileBrowserRootDir) - 1] == '/' || $fileBrowserRootDir[strlen($fileBrowserRootDir) - 1] == '\\') {
             $fileBrowserRootDir = substr($fileBrowserRootDir, 0, strlen($fileBrowserRootDir) - 1);
         }
         if ($fileBrowserRootUri[strlen($fileBrowserRootUri) - 1] == '/' || $fileBrowserRootUri[strlen($fileBrowserRootUri) - 1] == '\\') {
             $fileBrowserRootUri = substr($fileBrowserRootUri, 0, strlen($fileBrowserRootUri) - 1);
         }
     }
     if (empty($fileBrowserRootDir) || empty($fileBrowserRootUri)) {
         Flash::set('error', 'CKEditor - ' . __('one of the fields was empty, please try again!'));
         redirect(get_url('plugin/ckeditor/settings'));
     } else {
         $settings = array('urlBrowserEnable' => $urlBrowserEnable, 'urlBrowserListHidden' => $urlBrowserListHidden, 'fileBrowserEnable' => $fileBrowserEnable, 'fileBrowserRootDir' => $fileBrowserRootDir, 'fileBrowserRootUri' => $fileBrowserRootUri, 'editorContentsCss' => $editorContentsCss, 'editorToolbarSet' => $editorToolbarSet);
         if (Plugin::setAllSettings($settings, 'ckeditor')) {
             Flash::set('success', 'CKEditor - ' . __('plugin settings saved.'));
         } else {
             Flash::set('error', 'CKEditor - ' . __('plugin settings not saved!'));
         }
         redirect(get_url('plugin/ckeditor/settings'));
     }
 }
Beispiel #25
0
 public function save()
 {
     $db_dsn = explode(';', DB_DSN);
     $db_host = str_replace('host=', '', $db_dsn[1]);
     if (mysql_connect($db_host, DB_USER, DB_PASS)) {
         $tag_type = mysql_real_escape_string($_POST['tag_type']);
         $case = mysql_real_escape_string($_POST['case']);
         $rowspage = mysql_real_escape_string($_POST['rowspage']);
         $sort_field = mysql_real_escape_string($_POST['sort_field']);
         $sort_order = mysql_real_escape_string($_POST['sort_order']);
         $settings = array('tag_type' => $tag_type, 'case' => $case, 'rowspage' => $rowspage, 'sort_field' => $sort_field, 'sort_order' => $sort_order);
         $ret = Plugin::setAllSettings($settings, 'tagger');
     }
     if ($ret) {
         Flash::set('success', __('The settings have been updated.'));
     } else {
         Flash::set('error', __('An error has occured.'));
     }
     redirect(get_url('plugin/tagger/settings'));
 }
Beispiel #26
0
 * @copyright Martijn van der Kleijn, 2009-2013
 * 
 * Original author:
 * 
 * @author Andrew Waters <*****@*****.**>
 * @copyright Andrew Waters, 2009
 *
 */
/* Prevent direct access. */
if (!defined('IN_CMS')) {
    exit;
}
// Create default role names "user"
if (!Role::existsIn('Role', 'name="user"')) {
    $role = new Role();
    $role->name = 'user';
    $role->save();
} else {
    $role = Role::findByName('user');
}
// Create database table structures
$PDO = Record::getConnection();
$driver = strtolower($PDO->getAttribute(Record::ATTR_DRIVER_NAME));
// Setup table structure
if ($driver == 'mysql') {
    $PDO->exec("CREATE TABLE IF NOT EXISTS `" . TABLE_PREFIX . "registered_users_temp` (\n                    `id` int(11) unsigned NOT NULL auto_increment,\n                    `name` varchar(100) default NULL,\n                    `email` varchar(255) default NULL,\n                    `username` varchar(40) NOT NULL,\n                    `password` varchar(40) default NULL,\n                    `rand_key` varchar(32) default NULL,\n                    `reg_date` varchar(40) default NULL,\n                    PRIMARY KEY  (`id`),\n                    UNIQUE KEY `username` (`username`),\n                    UNIQUE KEY `email` (`email`)\n                ) ENGINE=MyISAM DEFAULT CHARSET=utf8;\n                ");
    $PDO->exec("CREATE TABLE IF NOT EXISTS `" . TABLE_PREFIX . "permission_page` (\n                    `page_id` int(25) default NULL,\n                    `permission_id` int(25) default NULL\n                ) ENGINE=MyISAM DEFAULT CHARSET=utf8;\n                ");
    $settings = array('allow_registrations' => '1', 'closed_message' => '<p>We are not currently open to new registrations.</p>', 'allow_login' => '1', 'allow_fb_connect' => '0', 'connect_api_key' => '', 'connect_secret_key' => '', 'random_key_length' => '8', 'random_key_type' => 'alnum', 'login_closed_message' => '<p>Sorry, but login is currently disabled.</p>', 'register_page' => 'register', 'already_logged_in' => '<p>You are already logged in to the site.</p>', 'default_permissions' => $role->id, 'welcome_email_pt' => 'Thank you for registering with my site\\r\\n\\r\\nPlease validate your email address by clicking the link below:', 'register_confirm_msg' => '<p>Thank you for registering. You have been sent an authorisation code that you must confirm to activate your account.</p>', 'welcome_email_pt_foot' => 'Thanks\\r\\n\\r\\nThe Team', 'confirm_email_subject' => 'Thanks for registering', 'confirm_email_from' => '*****@*****.**', 'confirm_email_reply' => '', 'confirmation_page' => 'register/confirm', 'message_empty_name' => '<p>Please tell us your name!</p>', 'message_empty_email' => '<p>Please tell us your email!</p>', 'message_empty_username' => '<p>Please choose a username!</p>', 'message_empty_password' => '<p>Please add a password</p>', 'message_empty_password_confirm' => '<p>Please confirm your password</p>', 'message_notvalid_password' => '<p>Those passwords don\'t match!</p>', 'message_notvalid_username' => '<p>Sorry, that username is taken!</p>', 'message_notvalid_email' => '<p>Sorry, someone at that email address already has an account!</p>', 'message_error_technical' => '<p>There has been a Technical error</p>', 'message_error_already_validated' => '<p>You\'ve already validated your account <small>:-)</small></p>', 'message_need_to_register' => 'Do you need to register?', 'auth_required_page' => 'authorisation-required', 'auth_required_page_text' => '<p>You\'ve requested a page which you don\'t have permission to access. Please email the webmaster for help.</p>', 'reset_text' => '<p>Please enter your email address to have a new password emailed to you</p>', 'reset_no_email' => '<p>Please enter the email address you used to sign up with.</p>', 'reset_page' => 'reset', 'reset_password_subject' => 'Reset password', 'reset_password_from' => '*****@*****.**', 'reset_password_reply' => 'no-reply', 'reset_email_body' => 'Your new password is: ', 'reset_pass_type' => 'alpha', 'reset_pass_length' => '8', 'reset_email_confirmed' => '<p>A new password has been mailed to you.</p>', 'welcome_message' => '<p>Your Account has been activated!</p><p>You can now login using your username and the password you chose when you registered.</p>');
}
Plugin::setAllSettings($settings, "registered_users");
Beispiel #27
0
 function save()
 {
     $approve = mysql_escape_string($_POST['autoapprove']);
     $captcha = mysql_escape_string($_POST['captcha']);
     $rowspage = mysql_escape_string($_POST['rowspage']);
     $numlabel = mysql_escape_string($_POST['numlabel']);
     $settings = array('auto_approve_comment' => $approve, 'use_captcha' => $captcha, 'rowspage' => $rowspage, 'numlabel' => $numlabel);
     $ret = Plugin::setAllSettings($settings, 'comment');
     if ($ret) {
         Flash::set('success', __('The settings have been updated.'));
     } else {
         Flash::set('error', 'An error has occured.');
     }
     redirect(get_url('plugin/comment/settings'));
 }
	public function save_settings() {
		$this->__checkPermission('downloads_settings');
		
		//	clean any keys from the $_POST array that aren't valid
		$settings = self::__clean($_POST,self::VALID_SETTINGS);
		
		//	sanitize the path values
		$settings['download_path'] = self::__sanitize($settings['download_path']);
		$settings['download_uri'] = self::__sanitize($settings['download_uri']);
		
		//	cleanup tags
		$settings['filetypes'] = preg_replace('/[^a-z0-9,]/','',strtolower($settings['filetypes']));
		
		//	cleanup the masks
		$settings['umask'] = (int)$settings['umask'] == 0 ? 0 : sprintf("%04s",(int)$settings['umask']<=777 ? (int)$settings['umask'] : 0);
		$settings['dirmode'] = sprintf("%04s",(int)$settings['dirmode']<=777 && 111 <= (int)$settings['dirmode'] ? (int)$settings['dirmode'] : 755);
		$settings['filemode'] = sprintf("%04s",(int)$settings['filemode']<=777 && 111 <= (int)$settings['filemode'] ? (int)$settings['filemode'] : 644);
		
		if (Plugin::setAllSettings($settings, 'downloads')) {
			$this->log(__('modified plugin settings'));
			Flash::set('success',__('Settings saved.'));
		}
		else {
			$this->__log(__('encountered an error saving plugin settings'),self::LOG_ERROR);
			Flash::set('error',__('Could not save settings!'));
		}

		redirect(get_url('plugin/downloads/settings'));

	}//*/
 function save()
 {
     $settings = array();
     $settings['funky_cache_by_default'] = $_POST['funky_cache_by_default'];
     $settings['funky_cache_suffix'] = $_POST['funky_cache_suffix'];
     $settings['funky_cache_folder'] = $_POST['funky_cache_folder'];
     if (Plugin::setAllSettings($settings, 'funky_cache')) {
         Flash::set('success', __('The cache settings have been updated.'));
         $message = sprintf('The cache settings were updated by :username.');
         Observer::notify('log_event', $message, 'funky_cache', 5);
     } else {
         Flash::set('error', 'The cache settings could not be updated due to an error.');
         $message = sprintf('An attempt by :username to update the cache settings failed.');
         Observer::notify('log_event', $message, 'funky_cache', 2);
     }
     redirect(get_url('plugin/funky_cache/settings'));
 }
 public static function setWidgetSettings($widget, $settings)
 {
     if (!array_key_exists($widget, self::$widgets)) {
         return false;
     }
     $widget = self::$widgets[$widget];
     if (!is_callable($widget["settings_cb"])) {
         return false;
     }
     // CHECK SECURE TOKEN
     if (!isset($settings["widget_secure_token"])) {
         return false;
     }
     if (!SecureToken::validateToken($settings["widget_secure_token"], get_url("plugin/dashboard/" . $widget["id"]))) {
         return false;
     }
     // FETCH SETTINGS
     $newsettings = array();
     foreach ($widget["settings"] as $key => $value) {
         if (array_key_exists($key, $settings)) {
             $newsettings[$key] = $settings[$key];
         } else {
             $newsettings[$key] = NULL;
         }
     }
     // SET NEW SETTINGS
     $newsettings = call_user_func($widget["settings_cb"], $newsettings, false);
     Plugin::setAllSettings($newsettings, "dashboard-" . $widget["id"]);
 }