Example #1
0
function theme_post(&$a)
{
    if (!local_user()) {
        return;
    }
    if (isset($_POST['diabook-settings-submit'])) {
        set_pconfig(local_user(), 'diabook', 'font_size', $_POST['diabook_font_size']);
        set_pconfig(local_user(), 'diabook', 'line_height', $_POST['diabook_line_height']);
        set_pconfig(local_user(), 'diabook', 'resolution', $_POST['diabook_resolution']);
        set_pconfig(local_user(), 'diabook', 'color', $_POST['diabook_color']);
        set_pconfig(local_user(), 'diabook', 'TSearchTerm', $_POST['diabook_TSearchTerm']);
        set_pconfig(local_user(), 'diabook', 'ELZoom', $_POST['diabook_ELZoom']);
        set_pconfig(local_user(), 'diabook', 'ELPosX', $_POST['diabook_ELPosX']);
        set_pconfig(local_user(), 'diabook', 'ELPosY', $_POST['diabook_ELPosY']);
        set_pconfig(local_user(), 'diabook', 'ELPosY', $_POST['diabook_ELPosY']);
        set_pconfig(local_user(), 'diabook', 'close_pages', $_POST['diabook_close_pages']);
        set_pconfig(local_user(), 'diabook', 'close_mapquery', $_POST['diabook_close_mapquery']);
        set_pconfig(local_user(), 'diabook', 'close_profiles', $_POST['diabook_close_profiles']);
        set_pconfig(local_user(), 'diabook', 'close_helpers', $_POST['diabook_close_helpers']);
        set_pconfig(local_user(), 'diabook', 'close_services', $_POST['diabook_close_services']);
        set_pconfig(local_user(), 'diabook', 'close_friends', $_POST['diabook_close_friends']);
        set_pconfig(local_user(), 'diabook', 'close_twitter', $_POST['diabook_close_twitter']);
        set_pconfig(local_user(), 'diabook', 'close_lastusers', $_POST['diabook_close_lastusers']);
        set_pconfig(local_user(), 'diabook', 'close_lastphotos', $_POST['diabook_close_lastphotos']);
        set_pconfig(local_user(), 'diabook', 'close_lastlikes', $_POST['diabook_close_lastlikes']);
    }
}
function langfilter_addon_settings_post(&$a, &$b)
{
    if (!local_user()) {
        return;
    }
    if ($_POST['langfilter-settings-submit']) {
        set_pconfig(local_user(), 'langfilter', 'languages', trim($_POST['langfilter_languages']));
        $enable = x($_POST, 'langfilter_enable') ? intval($_POST['langfilter_enable']) : 0;
        $disable = 1 - $enable;
        set_pconfig(local_user(), 'langfilter', 'disable', $disable);
        $minconfidence = 0 + $_POST['langfilter_minconfidence'];
        if (!$minconfidence) {
            $minconfidence = 0;
        } else {
            if ($minconfidence < 0) {
                $minconfidence = 0;
            } else {
                if ($minconfidence > 100) {
                    $minconfidence = 100;
                }
            }
        }
        set_pconfig(local_user(), 'langfilter', 'minconfidence', $minconfidence / 100.0);
        info(t('Language Filter Settings saved.') . EOL);
    }
}
Example #3
0
function redred_settings_post($a, $post)
{
    if (!local_channel()) {
        return;
    }
    // don't check redred settings if redred submit button is not clicked
    if (!x($_POST, 'redred-submit')) {
        return;
    }
    $channel = App::get_channel();
    // Don't let somebody post to their self channel. Since we aren't passing message-id this would be very very bad.
    if (!trim($_POST['redred_channel'])) {
        notice(t('Channel is required.') . EOL);
        return;
    }
    if ($channel['channel_address'] === trim($_POST['redred_channel'])) {
        notice(t('Invalid channel.') . EOL);
        return;
    }
    set_pconfig(local_channel(), 'redred', 'baseapi', trim($_POST['redred_baseapi']));
    set_pconfig(local_channel(), 'redred', 'username', trim($_POST['redred_username']));
    set_pconfig(local_channel(), 'redred', 'password', z_obscure(trim($_POST['redred_password'])));
    set_pconfig(local_channel(), 'redred', 'channel', trim($_POST['redred_channel']));
    set_pconfig(local_channel(), 'redred', 'post', intval($_POST['redred_enable']));
    set_pconfig(local_channel(), 'redred', 'post_by_default', intval($_POST['redred_default']));
    info(t('redred Settings saved.') . EOL);
}
Example #4
0
/** @file */
function notes_init(&$a)
{
    if (!local_channel()) {
        return;
    }
    $ret = array('success' => true);
    if (array_key_exists('note_text', $_REQUEST)) {
        $body = escape_tags($_REQUEST['note_text']);
        // I've had my notes vanish into thin air twice in four years.
        // Provide a backup copy if there were contents previously
        // and there are none being saved now.
        if (!$body) {
            $old_text = get_pconfig(local_channel(), 'notes', 'text');
            if ($old_text) {
                set_pconfig(local_channel(), 'notes', 'text.bak', $old_text);
            }
        }
        set_pconfig(local_channel(), 'notes', 'text', $body);
    }
    // push updates to channel clones
    if (argc() > 1 && argv(1) === 'sync') {
        require_once 'include/zot.php';
        build_sync_packet();
    }
    logger('notes saved.', LOGGER_DEBUG);
    json_return_and_die($ret);
}
Example #5
0
function skeleton_settings_post($a, $s)
{
    if (!local_channel()) {
        return;
    }
    set_pconfig(local_channel(), 'skeleton', 'some_setting', $_POST['some_setting']);
}
Example #6
0
function widgets_settings(&$a, &$o)
{
    if (!local_user()) {
        return;
    }
    $key = get_pconfig(local_user(), 'widgets', 'key');
    if ($key == '') {
        $key = mt_rand();
        set_pconfig(local_user(), 'widgets', 'key', $key);
    }
    $widgets = array();
    $d = dir(dirname(__FILE__));
    while (false !== ($f = $d->read())) {
        if (substr($f, 0, 7) == "widget_") {
            preg_match("|widget_([^.]+).php|", $f, $m);
            $w = $m[1];
            if ($w != "") {
                require_once $f;
                $widgets[] = array($w, call_user_func($w . "_widget_name"));
            }
        }
    }
    $t = file_get_contents(dirname(__FILE__) . "/settings.tpl");
    $o .= replace_macros($t, array('$submit' => t('Generate new key'), '$baseurl' => $a->get_baseurl(), '$title' => "Widgets", '$label' => t('Widgets key'), '$key' => $key, '$widgets_h' => t('Widgets available'), '$widgets' => $widgets));
}
function notimeline_settings_post($a, $post)
{
    if (!local_user() || !x($_POST, 'notimeline-submit')) {
        return;
    }
    set_pconfig(local_user(), 'system', 'no_wall_archive_widget', intval($_POST['notimeline']));
    info(t('No Timeline settings updated.') . EOL);
}
Example #8
0
/**
 *
 * Callback from the settings post function.
 * $post contains the $_POST array.
 * We will make sure we've got a valid user account
 * and if so set our configuration setting for this person.
 *
 */
function gnot_settings_post($a, $post)
{
    if (!local_user() || !x($_POST, 'gnot-submit')) {
        return;
    }
    set_pconfig(local_user(), 'gnot', 'enable', intval($_POST['gnot']));
    info(t('Gnot settings updated.') . EOL);
}
Example #9
0
/**
 *
 * Callback from the settings post function.
 * $post contains the $_POST array.
 * We will make sure we've got a valid user account
 * and if so set our configuration setting for this person.
 *
 */
function editplain_settings_post($a, $post)
{
    if (!local_user() || !x($_POST, 'editplain-submit')) {
        return;
    }
    set_pconfig(local_user(), 'system', 'plaintext', intval($_POST['editplain']));
    info(t('Editplain settings updated.') . EOL);
}
Example #10
0
/**
 *
 * Callback from the settings post function.
 * $post contains the $_POST array.
 * We will make sure we've got a valid user account
 * and if so set our configuration setting for this person.
 *
 */
function numfriends_settings_post($a, $post)
{
    if (!local_user() || !x($_POST, 'numfriends-submit')) {
        return;
    }
    set_pconfig(local_user(), 'system', 'display_friend_count', intval($_POST['numfriends']));
    info(t('Numfriends settings updated.') . EOL);
}
Example #11
0
/**
 *
 * Callback from the settings post function.
 * $post contains the $_POST array.
 * We will make sure we've got a valid user account
 * and if so set our configuration setting for this person.
 *
 */
function altpager_settings_post($a, $post)
{
    if (!local_user() || !x($_POST, 'altpager-submit')) {
        return;
    }
    set_pconfig(local_user(), 'system', 'alt_pager', intval($_POST['altpager']));
    info(t('Altpager settings updated.') . EOL);
}
/**
 *
 * Callback from the settings post function.
 * $post contains the $_POST array.
 * We will make sure we've got a valid user account
 * and if so set our configuration setting for this person.
 *
 */
function group_text_settings_post($a, $post)
{
    if (!local_user() || !x($_POST, 'group_text-submit')) {
        return;
    }
    set_pconfig(local_user(), 'system', 'groupedit_image_limit', intval($_POST['group_text']));
    info(t('Group Text settings updated.') . EOL);
}
function remote_permissions_settings_post($a, $post)
{
    if (!local_user() || !x($_POST, 'remote-perms-submit')) {
        return;
    }
    set_pconfig(local_user(), 'remote_perms', 'show', intval($_POST['remote-perms']));
    info(t('Remote Permissions settings updated.') . EOL);
}
function snautofollow_settings_post($a, $post)
{
    if (!local_user() || !x($_POST, 'snautofollow-submit')) {
        return;
    }
    set_pconfig(local_user(), 'system', 'ostatus_autofriend', intval($_POST['snautofollow']));
    info(t('StatusNet AutoFollow settings updated.') . EOL);
}
function uhremotestorage_settings_post($a, $post)
{
    if (!local_user()) {
        return;
    }
    set_pconfig(local_user(), 'uhremotestorage', 'unhoestedurl', $_POST['unhoestedurl']);
    set_pconfig(local_user(), 'uhremotestorage', 'unhoestedauth', $_POST['unhoestedauth']);
    set_pconfig(local_user(), 'uhremotestorage', 'unhoestedapi', $_POST['unhoestedapi']);
}
Example #16
0
function fromapp_settings_post($a, $post)
{
    if (!local_user() || !x($_POST, 'fromapp-submit')) {
        return;
    }
    set_pconfig(local_user(), 'fromapp', 'app', $_POST['fromapp-input']);
    set_pconfig(local_user(), 'fromapp', 'force', intval($_POST['fromapp-force']));
    info(t('Fromapp settings updated.') . EOL);
}
Example #17
0
function theme_post(&$a)
{
    if (!local_user()) {
        return;
    }
    if (isset($_POST['vier-settings-submit'])) {
        set_pconfig(local_user(), 'vier', 'style', $_POST['vier_style']);
    }
}
Example #18
0
function libertree_settings_post(&$a, &$b)
{
    if (x($_POST, 'libertree-submit')) {
        set_pconfig(local_user(), 'libertree', 'post', intval($_POST['libertree']));
        set_pconfig(local_user(), 'libertree', 'post_by_default', intval($_POST['libertree_bydefault']));
        set_pconfig(local_user(), 'libertree', 'libertree_api_token', trim($_POST['libertree_api_token']));
        set_pconfig(local_user(), 'libertree', 'libertree_url', trim($_POST['libertree_url']));
    }
}
Example #19
0
function dwpost_settings_post(&$a, &$b)
{
    if (x($_POST, 'dwpost-submit')) {
        set_pconfig(local_channel(), 'dwpost', 'post', intval($_POST['dwpost']));
        set_pconfig(local_channel(), 'dwpost', 'post_by_default', intval($_POST['dw_bydefault']));
        set_pconfig(local_channel(), 'dwpost', 'dw_username', trim($_POST['dw_username']));
        set_pconfig(local_channel(), 'dwpost', 'dw_password', z_obscure(trim($_POST['dw_password'])));
    }
}
Example #20
0
function theme_post(&$a)
{
    if (!local_user()) {
        return;
    }
    if (isset($_POST['duepuntozero-settings-submit'])) {
        set_pconfig(local_user(), 'duepuntozero', 'colorset', $_POST['duepuntozero_colorset']);
    }
}
Example #21
0
function curweather_plugin_settings_post($a, $post)
{
    if (!local_user() || !x($_POST, 'curweather-settings-submit')) {
        return;
    }
    set_pconfig(local_user(), 'curweather', 'curweather_loc', trim($_POST['curweather_loc']));
    set_pconfig(local_user(), 'curweather', 'curweather_enable', intval($_POST['curweather_enable']));
    info(t('Current Weather settings updated.') . EOL);
}
Example #22
0
function ljpost_settings_post(&$a, &$b)
{
    if (x($_POST, 'ljpost-submit')) {
        set_pconfig(local_user(), 'ljpost', 'post', intval($_POST['ljpost']));
        set_pconfig(local_user(), 'ljpost', 'post_by_default', intval($_POST['lj_bydefault']));
        set_pconfig(local_user(), 'ljpost', 'lj_username', trim($_POST['lj_username']));
        set_pconfig(local_user(), 'ljpost', 'lj_password', trim($_POST['lj_password']));
    }
}
Example #23
0
/**
 *
 * Callback from the settings post function.
 * $post contains the $_POST array.
 * We will make sure we've got a valid user account
 * and if so set our configuration setting for this person.
 *
 */
function startpage_settings_post($a, $post)
{
    if (!local_user()) {
        return;
    }
    if ($_POST['startpage-submit']) {
        set_pconfig(local_user(), 'startpage', 'startpage', strip_tags(trim($_POST['startpage'])));
    }
}
Example #24
0
function mailhost_addon_settings_post(&$a, &$b)
{
    if (!local_channel()) {
        return;
    }
    if ($_POST['mailhost-submit']) {
        set_pconfig(local_channel(), 'system', 'email_notify_host', trim($_POST['mailhost-mailhost']));
        info(t('MAILHOST Settings saved.') . EOL);
    }
}
function defaultfeatures_register($a, $newuid)
{
    $arr = array();
    $features = get_features();
    foreach ($features as $fname => $fdata) {
        foreach (array_slice($fdata, 1) as $f) {
            set_pconfig($newuid, 'feature', $f[0], intval(get_config('defaultfeatures', $f[0])) ? "1" : "0");
        }
    }
}
Example #26
0
function qcomment_addon_settings_post(&$a, &$b)
{
    if (!local_user()) {
        return;
    }
    if ($_POST['qcomment-submit']) {
        set_pconfig(local_user(), 'qcomment', 'words', xmlify($_POST['qcomment-words']));
        info(t('Quick Comment settings saved.') . EOL);
    }
}
Example #27
0
function ljpost_settings_post(&$a, &$b)
{
    if (x($_POST, 'ljpost-submit')) {
        set_pconfig(local_channel(), 'ljpost', 'post', intval($_POST['ljpost']));
        set_pconfig(local_channel(), 'ljpost', 'post_by_default', intval($_POST['lj_bydefault']));
        set_pconfig(local_channel(), 'ljpost', 'lj_username', trim($_POST['lj_username']));
        set_pconfig(local_channel(), 'ljpost', 'lj_password', z_obscure(trim($_POST['lj_password'])));
        info(t('LiveJournal Settings saved.') . EOL);
    }
}
function libertree_settings_post(&$a, &$b)
{
    if (x($_POST, 'libertree-submit')) {
        set_pconfig(local_channel(), 'libertree', 'post', intval($_POST['libertree']));
        set_pconfig(local_channel(), 'libertree', 'post_by_default', intval($_POST['libertree_bydefault']));
        set_pconfig(local_channel(), 'libertree', 'libertree_api_token', trim($_POST['libertree_api_token']));
        set_pconfig(local_channel(), 'libertree', 'libertree_url', trim($_POST['libertree_url']));
        info(t('Libertree Settings saved.') . EOL);
    }
}
Example #29
0
function theme_post(&$a)
{
    if (!local_user()) {
        return;
    }
    if (isset($_POST['quattro-settings-submit'])) {
        set_pconfig(local_user(), 'quattro', 'align', $_POST['quattro_align']);
        set_pconfig(local_user(), 'quattro', 'color', $_POST['quattro_color']);
    }
}
function ostatus_subscribe_content(&$a)
{
    if (!local_user()) {
        notice(t('Permission denied.') . EOL);
        goaway($_SESSION['return_url']);
        // NOTREACHED
    }
    $o = "<h2>" . t("Subsribing to OStatus contacts") . "</h2>";
    $uid = local_user();
    $a = get_app();
    $counter = intval($_REQUEST['counter']);
    if (get_pconfig($uid, "ostatus", "legacy_friends") == "") {
        if ($_REQUEST["url"] == "") {
            return $o . t("No contact provided.");
        }
        $contact = probe_url($_REQUEST["url"]);
        if (!$contact) {
            return $o . t("Couldn't fetch information for contact.");
        }
        $api = $contact["baseurl"] . "/api/";
        // Fetching friends
        $data = z_fetch_url($api . "statuses/friends.json?screen_name=" . $contact["nick"]);
        if (!$data["success"]) {
            return $o . t("Couldn't fetch friends for contact.");
        }
        set_pconfig($uid, "ostatus", "legacy_friends", $data["body"]);
    }
    $friends = json_decode(get_pconfig($uid, "ostatus", "legacy_friends"));
    $total = sizeof($friends);
    if ($counter >= $total) {
        $a->page['htmlhead'] = '<meta http-equiv="refresh" content="0; URL=' . $a->get_baseurl() . '/settings/connectors">';
        del_pconfig($uid, "ostatus", "legacy_friends");
        del_pconfig($uid, "ostatus", "legacy_contact");
        $o .= t("Done");
        return $o;
    }
    $friend = $friends[$counter++];
    $url = $friend->statusnet_profile_url;
    $o .= "<p>" . $counter . "/" . $total . ": " . $url;
    $data = probe_url($url);
    if ($data["network"] == NETWORK_OSTATUS) {
        $result = new_contact($uid, $url, true);
        if ($result["success"]) {
            $o .= " - " . t("success");
        } else {
            $o .= " - " . t("failed");
        }
    } else {
        $o .= " - " . t("ignored");
    }
    $o .= "</p>";
    $o .= "<p>" . t("Keep this window open until done.") . "</p>";
    $a->page['htmlhead'] = '<meta http-equiv="refresh" content="0; URL=' . $a->get_baseurl() . '/ostatus_subscribe?counter=' . $counter . '">';
    return $o;
}