Ejemplo n.º 1
0
function aa_CheckArchive()
{
    global $config_date_adjust;
    // Get the current time/date
    $now = time();
    // Load all the plugin settings
    $aa = new PluginSettings('Auto_Archive');
    // Find the "last archive" time
    $last_archive = (int) $aa->settings['last_archive'];
    // Check if this is the first time it has been run
    if ($last_archive == 0) {
        // Set the new "last archive" time
        $aa->settings['last_archive'] = $now;
        // Save the plugin settings
        $aa->save();
    }
    // Check if an archive is needed
    if (date(AA_OCCURENCE, $last_archive) != date(AA_OCCURENCE, $now)) {
        // Create an archive
        aa_CreateArchive($now);
        // Set the new "last archive" time
        $aa->settings['last_archive'] = $now;
        // Save the plugin settings
        $aa->save();
    }
}
function PN_AdminOptions($hook)
{
    // Load the plugin settings
    $PN = new PluginSettings('Previous-Next');
    if (!empty($_GET['PN'])) {
        $PN->settings['prevnext'] = $_GET['PN'];
        $PN->save();
        msg('info', 'Previous Next Settings Saved', 'Your settings were saved successfully', '?mod=options&action=PN');
    }
    // Display header
    echoheader('user', 'Previous Next Configuration');
    $catrestrict = $PN->settings['prevnext'];
    if (empty($catrestrict)) {
        $catrestrict = STAY_IN_CATEGORIES;
    }
    if ($catrestrict == 'true') {
        $text = "Staying In Category<br />";
        $link = "false";
        $linktext = "Check all categories";
    } else {
        $text = "Checking all categories<br />";
        $link = "true";
        $linktext = "Stay In Category";
    }
    $buffer = $text . '<br /><a href="?mod=options&amp;action=PN&amp;subaction=save&amp;PN=' . $link . '">' . $linktext . '</a>';
    echo $buffer;
    // Display footer
    echofooter();
}
Ejemplo n.º 3
0
function ping_options()
{
    global $PHP_SELF;
    $blogname = $_POST['blogname'];
    $mainpage = $_POST['mainpage'];
    $defaultsites = $_POST['defaultsites'];
    $defaultsites = str_replace("\n", "|", $defaultsites);
    echoheader("pingsetup", "Trackback Ping Setup");
    $pingsettings = new PluginSettings('Ping_Settings');
    if (!empty($blogname) || !empty($mainpage)) {
        $pingsettings->settings['blogname'] = $blogname;
        $pingsettings->settings['mainpage'] = $mainpage;
        $pingsettings->settings['defaultsites'] = stripslashes($defaultsites);
        $pingsettings->save();
    }
    $buffer = '<form action="' . $PHP_SELF . '?mod=options&action=ping" method="post">
<label for="blogname">Blog Name:</label><br />
<input type="text" id="blogname" name="blogname" value="' . stripslashes($pingsettings->settings['blogname']) . '"><br />
<label for="mainpage">Full path to main page that news will be displayed on:</label><br />
<input type="text" id="mainpage" name="mainpage" value="' . $pingsettings->settings['mainpage'] . '"><br />
<label for="defaultsites">Default XML/RPC sites to ping:</label><br />
<textarea rows="10" id="defaultsites" cols="40" name="defaultsites" wrap="off">' . stripslashes($pingsettings->settings['defaultsites']) . '</textarea><br />
<input type="submit" value="update"></form>
				';
    echo $buffer;
    echofooter();
}
Ejemplo n.º 4
0
<?php

// Copyright SQCRM. For licensing, reuse, modification and distribution see license.txt
/**
* Plugin settings page
* @author Abhik Chakraborty
*/
$do_plugin_settings = new PluginSettings();
$plugins = $do_plugin_settings->get_available_plugins();
$activated_plugins = $do_plugin_settings->get_activated_plugins();
$activated_plugin_names = array();
$detail_view_plugins = array();
$action_view_plugins = array();
if (is_array($activated_plugins) && count($activated_plugins) > 0) {
    foreach ($activated_plugins as $key => $val) {
        $activated_plugin_names[$key] = $val["name"];
        if ((int) $val["action_priority"] > 0) {
            $action_view_plugins[$val["action_priority"]] = array("id" => $key, "name" => $val["name"]);
        }
        if ((int) $val["display_priority"] > 0) {
            $detail_view_plugins[$val["display_priority"]] = array("id" => $key, "name" => $val["name"]);
        }
    }
}
if (count($action_view_plugins) > 0) {
    ksort($action_view_plugins);
}
if (count($detail_view_plugins) > 0) {
    ksort($detail_view_plugins);
}
require_once 'view/plugin_sort_settings_view.php';
function furls_AdminOptions()
{
    global $cutepath, $cute_query_string;
    include $cutepath . '/data/config.php';
    echoheader('user', 'Userfriendly URL Setup');
    $furls = new PluginSettings('Userfriendly_URLs');
    $bhelp = '<p><a href="?mod=options&action=furls">Back</a> / <a href="http://www.brandedthoughts.co.uk/cutewiki/index.php/Userfriendly%20URLs%20Plugin">Help</a></p>';
    switch ($_GET['subaction']) {
        case 'edit':
            $linkdata = $furls->settings['text']['0'];
            $buffer = $bhelp . '
	<p>This version of the plugin only needs to know the path to your include-file and what prefix you want on archived entry and category links.</p>
	<form method="post" action="?mod=options&amp;action=furls&amp;subaction=doadd" class="easyform">
		<div>
			<label for="txtCA">Category</label>
			<input id="txtCA" name="furls[category]" value="' . $linkdata[CA] . '" />
		</div>
		<div>
			<label for="txtAR">Archive prefix</label>
			<input id="txtAR" name="furls[archives]" value="' . $linkdata[AR] . '" />
		</div>
		<div style="padding-top: 10px;"><label for="txtPATH" style="width: 100%;">Path to including file<br /><small>If your including file is located at http://yoursite.com/content/news/index.php, type &quot;/content/news/index.php&quot; in this box. <br />Note that it\'s the full url to the file without &quot;http://yoursite.com/&quot;.</small></label>
			<input style="width: 200px;" id="txtPATH" name="furls[path]" value="' . $linkdata[PATH] . '" />
		</div>
		<div>
		<input type="submit" value="Save" />
		</div>
	</form>';
            break;
        case 'templates':
            // List templates
            $templates_list = array();
            if (!($handle = opendir("{$cutepath}/data"))) {
                die("<center>Can not open directory {$cutepath}/data ");
            }
            while (false !== ($file = readdir($handle))) {
                if (eregi(".tpl", $file)) {
                    $file_arr = explode(".", $file);
                    $templates_list[] = $file_arr[0];
                }
            }
            closedir($handle);
            echo $bhelp;
            echo '<p>This tool will automatically convert your old link, full-link and com-link tags to the new humanlink, 
			humanmorelink and humancomlink tags used by this plugin to create friendly url links to your posts. If you want to reverse 
			the process, check the &quot;reverse&quot; checkbox.</p>
		
		<form method="post" action="?mod=options&amp;action=furls&amp;subaction=dotemplates" class="easyform">
		<div>
			<label for="txtTemplate">Template</label>
		<select id="txtTemplate" name="furls[template]">';
            foreach ($templates_list as $null => $single_template) {
                if ($single_template == "Default") {
                    echo "<option selected=\"selected\" value=\"{$single_template}\">{$single_template}</option>";
                } else {
                    echo "<option value=\"{$single_template}\">{$single_template}</option>";
                }
            }
            echo '</select></div>
   		<div>
			<label for="txtReverse">Reverse</label>
			<input type="checkbox" id="txtReverse" name="furls[reverse]" value="true" />
		</div>
			<div>
				<input type="submit" value="Update my templates" />
			</div>
		</form>';
            break;
        case 'htaccess':
            $info = $furls->settings['text']['0'];
            $rewritebase = dirname($info[PATH]);
            if ($rewritebase != "/") {
                $rewritebase = $rewritebase . "/";
            }
            $includefile = str_replace(dirname($info[PATH]) . "/", "", $info[PATH]);
            $htaccesscont = 'RewriteEngine On
RewriteBase ' . $rewritebase . '
RewriteRule ^' . $info[AR] . '/([0-9]{10})/([0-9]{4})/([0-9]{2})/([0-9]{2})/(.*)/(.*)\\.html$ ' . $includefile . '?archive=$1&furls_date=$2/$3/$4&aj_go=more&category=$5&id=$6 [QSA]
RewriteRule ^([0-9]{4})/([0-9]{2})/([0-9]{2})/(.*)/(.*)\\.html$ ' . $includefile . '?furls_date=$1/$2/$3&aj_go=more&category=$4&id=$5 [QSA]
RewriteRule ^' . $info[CA] . '/(.*)\\.html$ ' . $includefile . '?category=$1 [QSA]';
            echo $bhelp;
            echo '<p>This tool will try to create a .htaccess-file in the location you specify. If you\'ve pointed the plugin to the correct include-file-path, 
	the content shown below should be ready for use. You can add variables to the last part of each rewriterule-line. Say you have your include-code in 
	index.php, but it only shows news if you have show=news in your url; you would then add &quot;&show=news&quot; to the end of each line.</p>
	
	
		<form method="post" action="?mod=options&amp;action=furls&amp;subaction=dohtaccess" class="easyform">
		<div>
			<label style="width: 300px;" for="txtHtaccess">.htaccess contents:</label>
			<textarea style="width: 100%; height: 200px;" wrap="off" id="txtHtaccess" name="furls[htaccess]">' . $htaccesscont . '</textarea>
		</div>
		<div>
		
		<p>The location must be relative to 
	your cutenews directory. If you type just &quot;.htaccess&quot;, the file will be created in your cutenews directory. 
	If you type &quot;../.htaccess&quot;, the file will be created in the parent directory of your cutenews installation.
	If you have cutenews installed in &quot;/content/cutenews&quot; and your include-file in &quot;/&quot;, type &quot;../../.htaccess&quot; in the field (&quot;../&quot; means one directory up).<br /></p>

			<p><span class="warning">This <b>might</b> cause your server to crash - so be warned! Not exactly crash, but create a file that is 
			unreadable/unwritable/assigned to another user than yourself on the host machine, thus in a worst-case scenario rendering 
			your site non-functional. If you\'re uncomfortable 
			risking a server&quot;crash&quot;, you should do this manually by writing and uploading the .htaccess file yourself. 
			The directory you are writing .htaccess to must be writable and readable for this tool to work. (' . $_SERVER["PHP_SELF"] . ')</span></p>
			
			<label for="txtTemplate">Write to file:</label>
			<input id="txtTemplate" name="furls[htaccessfile]" value="../.htaccess" />
		</div>
		
			<div>
				<input type="submit" value="Write file!" />
				
			</div>
		</form>';
            break;
        case 'dohtaccess':
            if (WriteContents(stripslashes($_POST[furls][htaccess]), stripslashes($_POST[furls][htaccessfile])) == "true") {
                echo "{$bhelp} <p>Written to " . stripslashes($_POST[furls][htaccessfile]) . "</p>";
            } else {
                echo "{$bhelp} <p>Couldn't write file - make sure the directory you are writing to is actually writable (CHMOD 777)</p>";
            }
            break;
        case 'dotemplates':
            $templatefile = "{$cutepath}/data/" . stripslashes($_POST[furls][template]) . ".tpl";
            $furl_templatec = GetContents($templatefile);
            if (stripslashes($_POST[furls][reverse]) == "true") {
                $furl_templatec = str_replace("humanmorelink", "full-link", $furl_templatec);
                $furl_templatec = str_replace("humancomlink", "com-link", $furl_templatec);
                $furl_templatec = str_replace("humanlink", "link", $furl_templatec);
                $state = "Original links placed";
            } else {
                $furl_templatec = str_replace("full-link", "humanmorelink", $furl_templatec);
                $furl_templatec = str_replace("com-link", "humancomlink", $furl_templatec);
                $furl_templatec = str_replace("[link]", "[humanlink]", $furl_templatec);
                $furl_templatec = str_replace("[/link]", "[/humanlink]", $furl_templatec);
                $state = "Friendly links placed";
            }
            if (WriteContents($furl_templatec, $templatefile) == "true") {
                echo $bhelp;
                echo "<p>Template <b>" . stripslashes($_POST[furls][template]) . "</b> updated successfully! ({$state})</p>";
            } else {
                echo $bhelp;
                echo "<p>Something bad happened... couldn't write to template-file specified!<br /><a href=\"?mod=options&action=furls\">Back</a></p>";
            }
            break;
        case 'doadd':
            $linkdata = array(CA => stripslashes($_POST[furls][category]), AR => stripslashes($_POST[furls][archives]), PATH => stripslashes($_POST[furls][path]));
            $furls->settings['text']['0'] = $linkdata;
            $buffer = $bhelp . '<p>Saved link info</p>';
            $furls->save();
            break;
        default:
            $info = $furls->settings['text']['0'];
            $buffer .= '
		<ul>
			<li><a href="?mod=options&amp;action=furls&amp;subaction=edit">Edit friendly link settings</a></li>
			<li><a href="?mod=options&amp;action=furls&amp;subaction=templates">Auto-update templates</a></li>
			<li><a href="?mod=options&amp;action=furls&amp;subaction=htaccess">Write required .htaccess-file</a></li>
		</ul>';
            $buffer .= '
		<h2>General help:</h2>
		<p>To make these new links work, you\'ll need to upload the .htaccess-file generated in step two above and place it in the same
		 directory as the file you\'re including show_news.php in resides in. The plugin can also 
		 <a href="?mod=options&amp;action=furls&amp;subaction=htaccess">do this for you</a> if this directory is writable. 
		 Read the warning text given there before pressing submit!</p>
		 
		<p>After uploading the .htaccess-file to the correct directory, you can replace [link][/link], [full-link][/full-link]
		 and [com-link][/com-link] in your templates with [humanlink][/humanlink], [humanmorelink][/humanmorelink] and [humancomlink][/humancomlink] 
		 to make the plugin output your new, more aesthetical URLs. You can also 
		 <a href="?mod=options&amp;action=furls&amp;subaction=templates">make the plugin do this</a> for you.</p>
		 <p>The last thing you need to do is put a &lt;base href=&quot;http://path/&quot; /&gt; tag in the &lt;head&gt; section of your including file. 
		 If your including file is at http://yoursite.org/news/, the base tag href mentioned here should reflect that.</p>
		 <h2>Requirements</h2>
		<p>- Apache with mod_rewrite enabled<br />
		- Linux/Unix or Win32 OS<br />
		- Host must allow .htaccess overrides<br />
		- Host must have FollowSymLinks enabled</p>
		';
    }
    echo $buffer;
    echofooter();
}
function cqt_AdminOptions()
{
    echoheader('user', 'Custom Quick Tags');
    $cqt = new PluginSettings('Custom_Quick_Tags');
    switch ($_GET['subaction']) {
        case 'edit':
            $tag = $cqt->settings['tags'][$_GET['id']];
        case 'add':
            $id = $tag ? '&amp;id=' . $_GET['id'] : '';
            $buffer = '
	<p><a href="http://www.brandedthoughts.co.uk/cutewiki/index.php/Custom%20Quick%20Tags%20Plugin">Help</a></p>
	<form method="post" action="?mod=options&amp;action=cqt&amp;subaction=doadd' . $id . '" class="easyform">
		<div>
			<label for="txtName">Name</label>
			<input id="txtName" name="cqt[name]" value="' . $tag[name] . '" />
		</div>
		<div>
			<label for="txtTag">Tag</label>
			<input id="txtTag" name="cqt[tag]" value="' . $tag[tag] . '" />
		</div>
		<div>
			<label for="txtComplex">Complex</label>
			<input type="checkbox" id="txtComplex" name="cqt[complex]"' . ($tag[complex] ? ' checked="checked"' : '') . ' value="true" />
		</div>
		<div>
			<label for="txtReplace">Replace</label>
			<textarea id="txtReplace" rows="2" name="cqt[replace]">' . $tag[replace] . '</textarea>
		</div>
		<input type="submit" value="Save" />
	</form>';
            break;
        case 'delete':
            $tag = $cqt->settings['tags'][$_GET['id']];
            if ($tag[name]) {
                $buffer = '<p>Removed tag: <strong>' . $tag[name] . '</strong></p>';
            }
            unset($cqt->settings['tags'][$_GET['id']]);
            $cqt->save();
            break;
        case 'doadd':
            $tag = array(name => stripslashes($_POST[cqt][name]), tag => stripslashes($_POST[cqt][tag]), complex => stripslashes($_POST[cqt][complex]), replace => stripslashes($_POST[cqt][replace]));
            if ($_GET['id']) {
                $cqt->settings['tags'][$_GET['id']] = $tag;
            } else {
                $cqt->settings['tags'][] = $tag;
            }
            $buffer = '<p>Saved tag: <strong>' . $_POST[cqt][name] . '</strong></p>';
            $cqt->save();
        default:
            $buffer .= '
		<table class="grid" id="cqt_tags">
			<thead>
				<tr>
					<th>Name</th>
					<th>Tag</th>
					<th>Type</th>
					<th>Replace</th>
					<th>Action</th>
				</tr>
			</thead>
			<tbody>';
            $tags = $cqt->settings['tags'];
            if (empty($tags)) {
                $buffer .= '<td colspan="5">No custom quick tags</td>';
            } else {
                foreach ($cqt->settings['tags'] as $id => $tag) {
                    $buffer .= '
				<tr>
					<td>' . $tag[name] . '</td>
					<td>[' . $tag[tag] . ']</td>
					<td>' . ($tag[complex] ? 'Complex' : 'Simple') . '</td>
					<td>' . htmlentities($tag[replace]) . '</td>
					<td><a href="?mod=options&amp;action=cqt&amp;subaction=edit&amp;id=' . $id . '">Edit</a> <a href="?mod=options&amp;action=cqt&amp;subaction=delete&amp;id=' . $id . '">Delete</a></td>
				</tr>';
                }
            }
            $buffer .= '
			<tbody>
		</table>
		<p><a href="?mod=options&amp;action=cqt&amp;subaction=add">Add</a></p>';
    }
    echo $buffer;
    echofooter();
}
Ejemplo n.º 7
0
 /**
  * Update a plugin setting
  *
  * @param string $folder name of plugin folder
  * @param string $setting name of the setting
  * @param string $setting stting value
  */
 public function updateSetting($setting = '', $value = '', $folder = '')
 {
     $pluginSettings = PluginSettings::instance();
     return $pluginSettings->updateSetting($this, $setting, $value, $folder);
 }
Ejemplo n.º 8
0
function msp_AdminOptions()
{
    global $cutepath;
    include $cutepath . '/data/config.php';
    echoheader('user', 'Mailing System Setup');
    $msp = new PluginSettings('Mailing_System');
    $mhelp = '<p><a href="?mod=options&action=msp">Back</a> / <a href="http://www.brandedthoughts.co.uk/cutewiki/index.php/Mailing_System">Help</a></p>';
    switch ($_GET['subaction']) {
        case 'doedit':
            $mails = array("AddedEmails" => stripslashes($_POST[msp][addedmails]), "EditedEmails" => stripslashes($_POST[msp][editedmails]), "CommentEmails" => stripslashes($_POST[msp][commentmails]), "AuthorEdited" => stripslashes($_POST[msp][authoredited]), "AuthorComments" => stripslashes($_POST[msp][authorcomments]));
            $msp->settings['mails']['me'] = stripslashes($_POST['AdminEmail']);
            //From
            $msp->settings['mails']['subject'] = stripslashes($_POST['subject']);
            //Subject Template
            $msp->settings['mails']['0'] = $mails;
            $buffer = $mhelp . '<p>Saved mailing list</p>';
            $msp->save();
            break;
        default:
            $mails = $msp->settings['mails']['0'];
            $me = $msp->settings['mails']['me'];
            if (empty($me)) {
                $me = 'ajfork@' . $_SERVER['SERVER_NAME'];
            }
            $subject = $msp->settings['mails']['subject'];
            if (empty($subject)) {
                $subject = "Site updated @ {maildate} by {mailuser}";
            }
            if ($mails[AuthorEdited] == "true") {
                $aesel = "checked=\"checked\"";
            }
            if ($mails[AuthorComments] == "true") {
                $acsel = "checked=\"checked\"";
            }
            $buffer = $mhelp . '
	<p>This is where you set up the mailing lists. Input emails in the textareas seperated by comma+space. ie &quot;<strong>first@email.com, second@email.com</strong>&quot;</p>
	<form method="post" action="?mod=options&amp;action=msp&amp;subaction=doedit" class="easyform">		
		<div>
			<label style="width: 50%;" for="txtAdminEmail">Admin Email</label>
			<input type="text" style="width: 100%;" id="txtAdminEmail" name="AdminEmail" value="' . $me . '" />
		</div>
		<div>
			<label style="width: 50%;" for="txtSubject">Subject: Use {maildate} and {mailuser}</label>
			<input type="text" style="width: 100%;" id="txtSubject" name="subject" value="' . $subject . '" />
		</div>
		<div>
			<label style="width: 50%;" for="txtAddedEmails">Who to mail when a story is added</label>
			<textarea class="medium" style="width: 100%;" id="txtAddedEmails" name="msp[addedmails]">' . $mails[AddedEmails] . '</textarea>
		</div>
		<div>
			<label style="width: 50%;" for="txtEditedEmails">Who to mail when a story is edited</label>
			<input type="checkbox" id="txtAuthoredited" name="msp[authoredited]" value="true" ' . $aesel . '/>
			<label style="width: 300px;" for="txtAuthoredited">Mail author</label>
			<textarea class="medium" style="width: 100%;" id="txtEditedEmails" name="msp[editedmails]">' . $mails[EditedEmails] . '</textarea>
		</div>		
		<div>
			<label style="width: 50%;" for="txtCommentEmails">Who to mail when a comment is added</label>
			<input type="checkbox" id="txtAuthorcomments" name="msp[authorcomments]" value="true" ' . $acsel . '/>
			<label style="width: 300px;" for="txtAuthorcomment">Mail author</label>
			<textarea class="medium" style="width: 100%;" id="txtCommentEmails" name="msp[commentmails]">' . $mails[CommentEmails] . '</textarea>
		</div>
		<div>
		<input type="submit" value="Save" />
		</div>
	</form>';
    }
    echo $buffer;
    echofooter();
}
Ejemplo n.º 9
0
 /**
  * Get a message specific param value
  *
  * @param string Setting name
  * @return string Setting value
  */
 function get_msg_setting($parname)
 {
     if (empty($this->Settings)) {
         global $Plugins;
         $Plugins->instantiate_Settings($this, 'Settings');
     }
     $value = $this->Settings->get($parname);
     if (!is_null($value)) {
         // We have a value for this param:
         return $value;
     }
     // Try default values:
     $params = $this->get_msg_setting_definitions($tmp_params = array('for_editing' => true));
     if (isset($params[$parname]['defaultvalue'])) {
         // We have a default value:
         return $params[$parname]['defaultvalue'];
     }
     return NULL;
 }