コード例 #1
0
function tanish_options()
{
    global $options;
    if ($_POST['action'] == 'save') {
        save_options();
    }
    print options_followinfo();
    print "\n        <form id='settings' action='' method='post' class='themeform'\n            style='margin: 20px;'>\n\n            <h3>Customise this Theme</h3>\n\n            Want to customise this theme? Don't edit the stylesheets or PHP files\n            of this theme using the Theme Editor. Why not? Because when you use\n            the WP upgrade mechanism to upgrade this theme, it blows away all your\n            changes. The/One right way to customise themes is to create a 'child\n            theme' -- that will be a feature available in an upcoming release of\n            this theme. In the meantime, if you want to do the manual work, please\n            <a href='http://ahren.org/code/contact'>contact me</a> for\n            instructions.\n\n            <h3>General</h3>\n\n            <input type='hidden' id='action' name='action' value='save'>\n\n            <input type='checkbox' name='showauthors' id='showauthors'" . ($options['showauthors'] == 1 ? ' checked' : '') . " />\n            <label style='margin-left: 5px;' for='showauthors'>Show Authors in Sidebar</label>\n\n            <br />\n\n            <input type='checkbox' name='expandfirst' id='expandfirst'" . ($options['expandfirst'] == 1 ? ' checked' : '') . " />\n            <label style='margin-left: 5px;' for='expandfirst'>\n                In home page (posts mode) expand top most (latest) post\n            </label>\n\n            <br />\n\n            <input type='checkbox' name='showcredits' id='showcredits'" . ($options['showcredits'] == 1 ? ' checked' : '') . " />\n            <label style='margin-left: 5px;' for='showcredits'>\n                Show credits at the bottom\n            </label>\n\n            <br />\n\n            <input type='checkbox' name='hidecomments' id='hidecomments'" . ($options['hidecomments'] == 1 ? ' checked' : '') . " />\n            <label style='margin-left: 5px;' for='hidecomments'>\n                Make comments collapsible/expandable on posts/pages\n            </label>\n\n            <br />\n\n            <input type='checkbox' name='iewarn' id='iewarn'" . ($options['iewarn'] == 1 ? ' checked' : '') . " />\n            <label style='margin-left: 5px;' for='iewarn'>\n                Offer helpful upgrade suggestions to Internet Explorer users ;-)\n            </label>\n\n            <br/>\n            <br/>\n\n            <h3>Background Images</h3>\n\n            <label for='mainbgtile'>Choose background (tile):</label><br />\n\n    " . images_dir_html("bgtile", 4, 'mainbgtile') . "\n            <label for='mainbgimage'>Choose background image:</label><br />\n    " . images_dir_html("bgimage", 4, 'mainbgimage') . "\n            </div>\n            <br clear='all' />\n            <br/>\n            <hr size='1'/>\n\n            <p class='submit'><input type='submit' value='Save Changes' name='save'/></p>\n\n        </form>\n\n        <div style='\n            width: 60%;\n            margin: 30px 0px;\n            background-color: #cceeff;\n            border: 1px solid #88bbcc;\n            padding: 30px;'\n        >\n            All graphics and libraries (jQuery and derivatives)\n            used in this theme are released by their respective authors as\n            either free (for unlimited free or commercial use, without\n            need for attribution), or under the GPL. Many thanks are owed to\n            them for their contribution to the public domain.\n\n            <br/>\n\n        </div>\n    ";
}
コード例 #2
0
    /**
     * Lilina installer
     *
     * Installs Lilina after going through many complicated checks
     *
     * @param string $sitename Name of the site
     * @param string $username Initial username of the admin user
     * @param string $password Initial password of the admin user
     * @return bool True if the installer succeeded, false otherwise
     */
    public function install($sitename, $username, $password)
    {
        global $installer;
        require_once LILINA_INCPATH . '/core/version.php';
        $settings = $this->generate_default_settings($sitename, $username, $password);
        if (!is_writable(LILINA_PATH . '/content/system/config/') || !($settings_file = @fopen(LILINA_PATH . '/content/system/config/settings.php', 'w+'))) {
            $this->file_error_notice(LILINA_PATH . '/content/system/config/settings.php', $sitename, $username, $password);
            return false;
        }
        fputs($settings_file, $settings);
        fclose($settings_file);
        if (file_exists(LILINA_PATH . '/content/system/config/feeds.data')) {
            echo "<p>Using existing feeds data</p>\n";
        } else {
            $feeds_file = @fopen(LILINA_PATH . '/content/system/config/feeds.data', 'w+');
            if (is_resource($feeds_file)) {
                $data['version'] = LILINA_FEEDSTORAGE_VERSION;
                $sdata = base64_encode(serialize($data));
                if (!$feeds_file) {
                    $this->file_error_notice(LILINA_PATH . '/content/system/config/feeds.data', $sitename, $username, $password);
                    return false;
                }
                fputs($feeds_file, $sdata);
                fclose($feeds_file);
            } else {
                echo "<p>Couldn't create <code>content/system/config/feeds.data</code>. Please ensure you create this yourself and make it writable by the server</p>\n";
            }
        }
        /** Make sure it's writable now */
        if (!$this->make_writable(LILINA_PATH . '/content/system/config/feeds.data')) {
            echo "<p>Couldn't make <code>content/system/config/feeds.data</code> writable. Please ensure you make it writable yourself</p>\n";
        }
        default_options();
        require_once LILINA_INCPATH . '/core/class-datahandler.php';
        if (!save_options()) {
            $this->file_error_notice(LILINA_PATH . '/content/system/config/options.data', $sitename, $username, $password);
            return false;
        }
        ?>
	<h1>Installation Complete!</h1>
	<p>Lilina has been installed and is now ready to go. Please note your username and password below, as it <strong>won't be shown again</strong>!</p>
	<dl>
		<dt>Your username is</dt>
		<dd id="username"><?php 
        echo $username;
        ?>
</dd>
		<dt>and your password is</dt>
		<dd id="password"><?php 
        echo $password;
        ?>
</dd>
	</dl>
	<p>We can <a href="admin/first-run.php">help you get started</a>, or if you know what you're doing, <a href="admin/">head straight for the admin panel</a>.</p>
	<?php 
        return true;
    }
コード例 #3
0
ファイル: install-functions.php プロジェクト: rmccue/Lilina
    /**
     * Lilina installer
     *
     * Installs Lilina after going through many complicated checks
     *
     * @param string $sitename Name of the site
     * @param string $username Initial username of the admin user
     * @param string $password Initial password of the admin user
     * @return bool True if the installer succeeded, false otherwise
     */
    public function install($sitename, $username, $password)
    {
        global $installer;
        require_once LILINA_INCPATH . '/core/version.php';
        require_once LILINA_INCPATH . '/core/class-datahandler.php';
        $settings = $this->generate_default_settings($sitename, $username, $password);
        if (!is_writable(LILINA_PATH . '/content/system/config/') || !($settings_file = @fopen(LILINA_PATH . '/content/system/config/settings.php', 'w+'))) {
            $this->file_error_notice(LILINA_PATH . '/content/system/config/settings.php', $sitename, $username, $password);
            return false;
        }
        fputs($settings_file, $settings);
        fclose($settings_file);
        if (file_exists(LILINA_PATH . '/content/system/config/feeds.data')) {
            echo "<p>Using existing feeds data</p>\n";
        } else {
            $feeds_file = new DataHandler(LILINA_CONTENT_DIR . '/system/config/');
            $feeds_file = $feeds_file->save('feeds.json', json_encode(array()));
            if (!$feeds_file) {
                $this->file_error_notice(LILINA_PATH . '/content/system/config/feeds.json', $sitename, $username, $password);
                return false;
            }
        }
        /** Make sure it's writable now */
        if (!$this->make_writable(LILINA_PATH . '/content/system/config/feeds.json')) {
            echo "<p>Couldn't make <code>content/system/config/feeds.json</code> writable. Please ensure you make it writable yourself</p>\n";
        }
        default_options();
        global $options;
        $options['sitename'] = $sitename;
        if (!save_options()) {
            $this->file_error_notice(LILINA_PATH . '/content/system/config/options.data', $sitename, $username, $password);
            return false;
        }
        ?>
	<h1 id="title">Installation Complete!</h1>
	<p>Lilina has been installed and is now ready to go. Please note your username and password below, as it <strong>won't be shown again</strong>!</p>
	<dl id="logindetails">
		<dt>Your username is</dt>
		<dd id="username"><?php 
        echo $username;
        ?>
</dd>
		<dt>and your password is</dt>
		<dd id="password"><?php 
        echo $password;
        ?>
</dd>
	</dl>
	<p>We can <a href="admin/first-run.php">help you get started</a>, or if you know what you're doing, <a href="admin/">head straight for the admin panel</a>.</p>
	<?php 
        return true;
    }
コード例 #4
0
/**
 * Update the value of an option.
 *
 * If the option does not exist, then the option will be added with the option
 * value, but you will not be able to set whether it is autoloaded. If you want
 * to set whether an option autoloaded, then you need to use the add_option().
 * Any of the old $settings keys are ignored.
 *
 * When the option is updated, then the filter named
 * 'update_option_$option_name', with the $option_name as the $option_name
 * parameter value, will be called. The hook should accept two parameters, the
 * first is the new parameter and the second is the old parameter.
 *
 * @global array <tt>$settings</tt> contains whatever option we are going to change
 * @param string $option Option key to change
 * @param mixed $new_value New value of <tt>$option</tt>
 */
function update_option($option_name, $new_value) {
	if($option_name === 'auth' || $option_name === 'baseurl' || $option_name === 'files')
		return false;

	global $options;
	$options[$option_name] = apply_filters("update_option-$option_name", $new_value);
	return save_options();
}
コード例 #5
0
ファイル: install.php プロジェクト: rmccue/Lilina
/**
 * upgrade() - Run upgrade processes on supplied data
 *
 * {{@internal Missing Long Description}}}
 */
function upgrade()
{
    global $lilina;
    //require_once(LILINA_INCPATH . '/core/plugin-functions.php');
    require_once LILINA_INCPATH . '/core/feed-functions.php';
    require_once LILINA_INCPATH . '/core/version.php';
    require_once LILINA_INCPATH . '/core/misc-functions.php';
    /** Rename possible old files */
    if (@file_exists(LILINA_PATH . '/.myfeeds.data')) {
        rename(LILINA_PATH . '/.myfeeds.data', LILINA_PATH . '/content/system/config/feeds.data');
    } elseif (@file_exists(LILINA_PATH . '/conf/.myfeeds.data')) {
        rename(LILINA_PATH . '/conf/.myfeeds.data', LILINA_PATH . '/content/system/config/feeds.data');
    } elseif (@file_exists(LILINA_PATH . '/conf/.feeds.data')) {
        rename(LILINA_PATH . '/conf/.feeds.data', LILINA_PATH . '/content/system/config/feeds.data');
    } elseif (@file_exists(LILINA_PATH . '/conf/feeds.data')) {
        rename(LILINA_PATH . '/conf/feeds.data', LILINA_PATH . '/content/system/config/feeds.data');
    }
    if (@file_exists(LILINA_PATH . '/conf/settings.php')) {
        rename(LILINA_PATH . '/conf/settings.php', LILINA_PATH . '/content/system/config/settings.php');
    }
    require_once LILINA_PATH . '/inc/core/conf.php';
    /*
    if(@file_exists(LILINA_PATH . '/content/system/config/feeds.data')) {
    	$feeds = file_get_contents(LILINA_PATH . '/content/system/config/feeds.data');
    	$feeds = unserialize( base64_decode($feeds) );
    
    	/** Are we pre-versioned? * /
    	if(!isset($feeds['version'])){
    
    		/** Is this 0.7? * /
    		if(!is_array($feeds['feeds'][0])) {
    			/** 1 dimensional array, each value is a feed URL string * /
    			foreach($feeds['feeds'] as $new_feed) {
    				Feeds::get_instance()->add($new_feed);
    			}
    		}
    
    		/** We must be in between 0.7 and r147, when we started versioning * /
    		elseif(!isset($feeds['feeds'][0]['url'])) {
    			foreach($feeds['feeds'] as $new_feed) {
    				Feeds::get_instance()->add($new_feed['feed'], $new_feed['name']);
    			}
    		}
    
    		/** The feeds are up to date, but we don't have a version * /
    		else {
    		}
    
    	}
    	elseif($feeds['version'] != $lilina['feed-storage']['version']) {
    		/** Note the lack of breaks here, this means the cases cascade * /
    		switch(true) {
    			case $feeds['version'] < 147:
    				/** We had a b0rked upgrader, so we need to make sure everything is okay * /
    				foreach($feeds['feeds'] as $this_feed) {
    					
    				}
    			case $feeds['version'] < 237:
    				/** We moved stuff around this version, but we've handled that above. * /
    		}
    	}
    	else {
    	}
    	global $data;
    	$data = $feeds;
    	$data['version'] = $lilina['feed-storage']['version'];
    	save_feeds();
    } //end file_exists()
    */
    /** Just in case... */
    unset($BASEURL);
    require LILINA_PATH . '/content/system/config/settings.php';
    if (isset($BASEURL) && !empty($BASEURL)) {
        // 0.7 or below
        $raw_php = "<?php\n// What you want to call your Lilina installation\n\$settings['sitename'] = '{$SITETITLE}';\n\n// The URL to your server\n\$settings['baseurl'] = '{$BASEURL}';\n\n// Username and password to log into the administration panel\n// 'pass' is MD5ed\n\$settings['auth'] = array(\n\t\t\t\t\t\t\t'user' => '{$USERNAME}',\n\t\t\t\t\t\t\t'pass' => '" . md5($PASSWORD) . "'\n\t\t\t\t\t\t\t);\n\n// All the enabled plugins, stored in a serialized string\n\$settings['enabled_plugins'] = '';\n\n// Version of these settings; don't change this\n\$settings['settings_version'] = " . $lilina['settings-storage']['version'] . ";\n?>";
        if (!($settings_file = @fopen(LILINA_PATH . '/content/system/config/settings.php', 'w+')) || !is_resource($settings_file)) {
            lilina_nice_die('<p>Failed to upgrade settings: Saving content/system/config/settings.php failed</p>', 'Upgrade failed');
        }
        fputs($settings_file, $raw_php);
        fclose($settings_file);
    } elseif (!isset($settings['settings_version'])) {
        // Between 0.7 and r147
        // Fine to just use existing settings
        $raw_php = file_get_contents(LILINA_PATH . '/content/system/config/settings.php');
        $raw_php = str_replace('?>', "// Version of these settings; don't change this\n" . "\$settings['settings_version'] = " . $lilina['settings-storage']['version'] . ";\n?>", $raw_php);
        if (!($settings_file = @fopen(LILINA_PATH . '/conf/settings.php', 'w+')) || !is_resource($settings_file)) {
            lilina_nice_die('<p>Failed to upgrade settings: Saving content/system/config/settings.php failed</p>', 'Upgrade failed');
        }
        fputs($settings_file, $raw_php);
        fclose($settings_file);
    } elseif ($settings['settings_version'] != $lilina['settings-storage']['version']) {
        /** Note the lack of breaks here, this means the cases cascade */
        switch (true) {
            case $settings['settings_version'] < 237:
                /** We moved stuff around this version, but we've handled that above. */
            /** We moved stuff around this version, but we've handled that above. */
            case $settings['settings_version'] < 297:
                new_options_297();
            case $settings['settings_version'] < 302:
                new_options_302();
            case $settings['settings_version'] < 339:
                new_options_339();
            case $settings['settings_version'] < 368:
                new_options_368();
            case $settings['settings_version'] < 480:
                new_options_368();
        }
        $raw_php = file_get_contents(LILINA_PATH . '/content/system/config/settings.php');
        $raw_php = str_replace("\$settings['settings_version'] = " . $settings['settings_version'] . ";", "\$settings['settings_version'] = " . $lilina['settings-storage']['version'] . ";", $raw_php);
        if (!($settings_file = @fopen(LILINA_PATH . '/content/system/config/settings.php', 'w+')) || !is_resource($settings_file)) {
            lilina_nice_die('<p>Failed to upgrade settings: Saving content/system/config/settings.php failed</p>', 'Upgrade failed');
        }
        fputs($settings_file, $raw_php);
        fclose($settings_file);
        require_once LILINA_INCPATH . '/core/class-datahandler.php';
        if (!save_options()) {
            lilina_nice_die('<p>Failed to upgrade settings: Saving content/system/config/options.data failed</p>', 'Upgrade failed');
        }
    }
    $string = '';
    if (count(MessageHandler::get()) === 0) {
        lilina_nice_die('<p>Your installation has been upgraded successfully. Now, <a href="index.php">get back to reading!</a></p>', 'Upgrade Successful');
        return;
    } else {
        $string .= '<p>Your installation has <strong>not</strong> been upgraded successfully. Here\'s the error:</p><ul><li>';
    }
    lilina_nice_die($string . implode('</li><li>', MessageHandler::get()) . '</li></ul>', 'Upgrade failed');
}
コード例 #6
0
ファイル: settings.php プロジェクト: MenZil/pluck
//Include old settings, to display them.
require_once 'data/settings/options.php';
//If form has been submitted.
if (isset($_POST['save'])) {
    //Check if a sitetitle has been entered.
    if (empty($cont1)) {
        $error = show_error($lang['settings']['fill_name'], 1, true);
    } elseif (!preg_match('/^.+@.+\\..{2,4}$/', $cont2)) {
        $error = show_error($lang['settings']['email_invalid'], 1, true);
    } else {
        //If XHTML-ruleset is not on, turn it off.
        if (!isset($cont3)) {
            $cont3 = 'false';
        }
        //Then, save the settings.
        save_options($cont1, $cont2);
        show_error($lang['settings']['changing_settings'], 3);
        redirect('?action=options', 0);
        include_once 'data/inc/footer.php';
        exit;
    }
}
?>
<p>
	<strong><?php 
echo $lang['settings']['message'];
?>
</strong>
</p>
<?php 
if (isset($error)) {
コード例 #7
0
ファイル: functions.php プロジェクト: ahrencode/Rachel-for-WP
function rachel_options()
{
    global $options;
    if (isset($_POST['action']) && $_POST['action'] == 'save') {
        save_options();
    }
    ?>
    <div style=
            '
                clear: right;
                float: right;
                margin-top: 10px;
                margin-right: 0px;
                margin-left: 20px;
                background-color: #fff3cc;
                color: #000000;
                padding: 10px 15px;
                border: 2px solid #ddc055; width: 25%;
                border-right: none;
                width: 150px;
            '
    >
        <h3>Keep up with Rachel</h3>

        <p>
            Follow on Twitter, or join the Facebook Page. Subscribe to the blog.
            Create bug/feature requests, download the latest code, and more!
        </p>

        <ul>
        <li style='list-style-type: circle; margin-left: 10px;'>
            Blog:
            <ul>
            <li><a href='http://ahren.org/code/tag/rachel-wp'>Rachel</a></li>
            <li><a href='http://ahren.org/code/'>Ahren Code</a></li>
            </ul>
        </li>
        <li style='list-style-type: circle; margin-left: 10px;'>
            Twitter:
            <ul>
            <li><a href='http://search.twitter.com/search?q=%23rachel-wp'>Rachel</a></li>
            <li><a href='http://twitter.com/ahrencode/'>Ahren Code</a></li>
            </ul>
        </li>
        <li style='list-style-type: circle;  margin-left: 10px;'>
            <a
            href='http://www.facebook.com/AhrenCode'>Facebook</a>
        </li>
        <li style='list-style-type: circle;  margin-left: 10px;'>
            <a href='http://github.com/ahrencode/Rachel-for-WP/issues'>
                Changes, Bugs and Features</a>
        </li>
        </ul>
    </div>

    <form id='settings' action='' method='post' class='themeform'
        style='margin: 20px;'>

        <h3>General</h3>

        <input type='hidden' id='action' name='action' value='save' />

        <input type='checkbox' name='showcredits' id='showcredits'
            <?php 
    print $options['showcredits'] == 1 ? ' checked' : '';
    ?>
 />
        <label style='margin-left: 5px;' for='showcredits'>
            Show credits at the bottom of the Sidebar
        </label>

        <br />

        <br clear='all' />
        <br/>
        <hr size='1'/>

        <p class='submit'><input type='submit' value='Save Changes' name='save' /></p>

    </form>

    <div style='width: 60%; margin: 30px 40px; background-color: #cceeff; border: 1px solid #88bbcc; padding:
   30px;'>
        Icons and background image courtesy of:
            <a href='http://en.wikipedia.org/wiki/Aperiodic_tiling'>Wikipedia</a>,
            <a href='http://www.midtonedesign.com'>midtone design</a> and the KDE project.
    </div>
<?php 
}
コード例 #8
0
ファイル: index.php プロジェクト: vinod-co/centa
         // Handle changes in media for compound fields
         if (in_array('media', $compound_fields)) {
             $question->populate_compound_media($_FILES, $_POST, 'q_media', 'question_media');
         }
         // Strip MS Office HTML.
         $question->set_scenario(clearMSOtags($question->get_scenario()));
         $question->set_leadin(clearMSOtags($question->get_leadin()));
         $question_teams = array();
         if (isset($_POST['teams'])) {
             //$question_teams = array_combine($_POST['teams'], $_POST['teams']);
             foreach ($_POST['teams'] as $idMod) {
                 $question_teams[$idMod] = module_utils::get_moduleid_from_id($idMod, $mysqli);
             }
         }
         $question->set_teams($question_teams);
         save_options($question, $userObject, $mysqli);
         $do_save = true;
     }
 } elseif (isset($_POST['submit-cancel']) and $_POST['submit-cancel'] == $string['cancel']) {
     redirect($userObject, $question->id, $configObject, $mysqli);
 }
 if ($do_save) {
     // If not errored then save the question
     if (count($errors) == 0) {
         try {
             if (!$question->save()) {
                 $errors[] = $string['datasaveerror'];
             } else {
                 // Possibility that we might be converting a MRQ to MCQ
                 if (isset($_POST['mcqconvert']) and $_POST['mcqconvert'] == '1') {
                     $i = 1;
コード例 #9
0
ファイル: install.php プロジェクト: MenZil/pluck
 }
 //Check the email.
 if (!preg_match('/^.+@.+\\..{2,4}$/', $cont2)) {
     $error['email'] = show_error($lang['settings']['email_invalid'], 1, true);
 }
 //Check the passwords.
 if (empty($cont4)) {
     $error['pass'] = show_error($lang['changepass']['empty'], 1, true);
 } elseif ($cont4 != $cont5) {
     $error['pass'] = show_error($lang['changepass']['different'], 1, true);
 }
 if (!isset($error)) {
     //Save prefered language.
     save_language($cont3);
     //Save options.
     save_options($cont1, $cont2, 'yes');
     //Save password.
     save_password($cont4);
     //Save theme.
     save_theme('default');
     //Make some dirs for the trashcan, modules and pages.
     foreach (array('data/trash/pages', 'data/trash/images', 'data/trash/files', 'data/settings/modules', PAGE_DIR) as $dir) {
         if (!is_dir($dir)) {
             mkdir($dir);
         }
         chmod($dir, 0777);
     }
     unset($dir);
     redirect('?action=step3', 0);
     include_once 'data/inc/footer.php';
     exit;