Esempio n. 1
0
function update_preferences($pref_id = 0)
{
    /* Get current keys */
    $sql = "SELECT `id`,`name`,`type` FROM `preference`";
    /* If it isn't the System Account's preferences */
    if ($pref_id != '-1') {
        $sql .= " WHERE `catagory` != 'system'";
    }
    $db_results = Dba::read($sql);
    $results = array();
    // Collect the current possible keys
    while ($r = Dba::fetch_assoc($db_results)) {
        $results[] = array('id' => $r['id'], 'name' => $r['name'], 'type' => $r['type']);
    }
    // end collecting keys
    /* Foreach through possible keys and assign them */
    foreach ($results as $data) {
        /* Get the Value from POST/GET var called $data */
        $name = $data['name'];
        $apply_to_all = 'check_' . $data['name'];
        $new_level = 'level_' . $data['name'];
        $id = $data['id'];
        $value = scrub_in($_REQUEST[$name]);
        /* Some preferences require some extra checks to be performed */
        switch ($name) {
            case 'transcode_bitrate':
                $value = Stream::validate_bitrate($value);
                break;
            default:
                break;
        }
        if (preg_match('/_pass$/', $name)) {
            if ($value == '******') {
                unset($_REQUEST[$name]);
            } else {
                if (preg_match('/md5_pass$/', $name)) {
                    $value = md5($value);
                }
            }
        }
        /* Run the update for this preference only if it's set */
        if (isset($_REQUEST[$name])) {
            Preference::update($id, $pref_id, $value, $_REQUEST[$apply_to_all]);
        }
        if (Access::check('interface', '100') && $_REQUEST[$new_level]) {
            Preference::update_level($id, $_REQUEST[$new_level]);
        }
    }
    // end foreach preferences
    // Now that we've done that we need to invalidate the cached preverences
    Preference::clear_from_session();
}
Esempio n. 2
0
 /**
  * load
  * This loads up the data we need into this object, this stuff comes 
  * from the preferences.
  */
 public function load($user)
 {
     $user->set_preferences();
     $data = $user->prefs;
     if (strlen(trim($data['growl_address']))) {
         $this->address = trim($data['growl_address']);
     } else {
         debug_event($this->name, 'No server address, not scrobbling', '3');
         return false;
     }
     $this->password = trim($data['growl_pass']);
     $this->message = trim($data['growl_message']);
     $registered_address = trim($data['growl_registered_address']);
     $confhash = md5($this->address . ':' . $this->password);
     if ($registered_address != $confhash) {
         $growl = $this->get_growl();
         $icon = AmpConfig::get('theme_path') . '/images/ampache.png';
         $growl->registerApplication($icon);
         debug_event($this->name, 'Growl registered.', '5');
         Preference::update('growl_registered_address', $user->id, $confhash);
     }
     $this->user_id = $user->id;
     return true;
 }
Esempio n. 3
0
<?php

$key = '';
$dao_preference = new Preference();
if (Params::getParam('key') != '') {
    $key = Params::getParam('key');
} else {
    $key = osc_google_maps_key() != '' ? osc_google_maps_key() : '';
}
if (Params::getParam('option') == 'stepone') {
    $dao_preference->update(array("s_value" => $key), array("s_section" => "plugin-google_maps", "s_name" => "google_maps_key"));
    echo '<div style="text-align:center; font-size:22px; background-color:#00bb00;"><p>' . __('Congratulations. The plugin is now configured', 'google_maps') . '.</p></div>';
}
unset($dao_preference);
?>

<form action="<?php 
osc_admin_base_url(true);
?>
" method="post">
    <input type="hidden" name="page" value="plugins" />
    <input type="hidden" name="action" value="renderplugin" />
    <input type="hidden" name="file" value="google_maps/admin.php" />
    <input type="hidden" name="option" value="stepone" />
    <div>
        <?php 
_e('Please enter your Google Maps', 'google_maps');
?>
 <label for="key" style="font-weight: bold;"><?php 
_e('developer key', 'google_maps');
?>
Esempio n. 4
0
 /**
  * Get latest available version from GitHub.
  * @param boolean $force
  * @return string
  */
 public static function get_latest_version($force = false)
 {
     $lastversion = '';
     // Forced or last check expired, check latest version from Github
     if ($force || self::lastcheck_expired() && AmpConfig::get('autoupdate')) {
         // Always update last check time to avoid infinite check on permanent errors (proxy, firewall, ...)
         $time = time();
         Preference::update('autoupdate_lastcheck', $GLOBALS['user']->id, $time);
         AmpConfig::set('autoupdate_lastcheck', $time, true);
         // Development version, get latest commit on develop branch
         if (self::is_develop()) {
             $commits = self::github_request('/commits/develop');
             if (!empty($commits)) {
                 $lastversion = $commits->sha;
                 Preference::update('autoupdate_lastversion', $GLOBALS['user']->id, $lastversion);
                 AmpConfig::set('autoupdate_lastversion', $lastversion, true);
                 $available = self::is_update_available(true);
                 Preference::update('autoupdate_lastversion_new', $GLOBALS['user']->id, $available);
                 AmpConfig::set('autoupdate_lastversion_new', $available, true);
             }
         } else {
             $tags = self::github_request('/tags');
             if (!empty($tags)) {
                 $lastversion = $tags[0]->name;
                 Preference::update('autoupdate_lastversion', $GLOBALS['user']->id, $lastversion);
                 AmpConfig::set('autoupdate_lastversion', $lastversion, true);
                 $available = self::is_update_available(true);
                 Preference::update('autoupdate_lastversion_new', $GLOBALS['user']->id, $available);
                 AmpConfig::set('autoupdate_lastversion_new', $available, true);
             }
         }
     } else {
         $lastversion = AmpConfig::get('autoupdate_lastversion');
     }
     return $lastversion;
 }
Esempio n. 5
0
<?php

if (!defined('OC_ADMIN') || OC_ADMIN !== true) {
    exit('Access is not allowed.');
}
$dao_preference = new Preference();
$webid = Params::getParam('webid');
$option = Params::getParam('option');
if ($option == 'stepone') {
    $dao_preference->update(array("s_value" => $webid), array("s_section" => "plugin-yandex_maps", "s_name" => "yandex_maps_key"));
    echo '<div style="text-align:center; font-size:22px; background-color:#00bb00;"><p>' . __('Congratulations. The plugin is now configured', 'yandex_map') . '.</p></div>';
} else {
    $webid = osc_yandex_map_key();
}
?>

<form action="<?php 
osc_admin_base_url(true);
?>
" method="get">
    <input type="hidden" name="page" value="plugins" />
    <input type="hidden" name="action" value="renderplugin" />
    <input type="hidden" name="file" value="yandex_maps/admin.php" />
    <input type="hidden" name="option" value="stepone" />
    <div>
        <p>
            <?php 
_e('Please enter your Yandex.Map ', 'yandex_maps');
?>
 <label for="id" style="font-weight: bold;"><?php 
_e('API key', 'yandex_maps');
Esempio n. 6
0
 /**
  * set_active_instance
  * This sets the specified instance as the 'active' one
  */
 public function set_active_instance($uid, $user_id = '')
 {
     // Not an admin? bubkiss!
     if (!$GLOBALS['user']->has_access('100')) {
         $user_id = $GLOBALS['user']->id;
     }
     $user_id = $user_id ? $user_id : $GLOBALS['user']->id;
     Preference::update('vlc_active', $user_id, intval($uid));
     AmpConfig::set('vlc_active', intval($uid), true);
     return true;
 }
Esempio n. 7
0
 /**
  * createUser
  * Create a new user.
  * Takes the username, password and email with optional roles in parameters.
  */
 public static function createuser($input)
 {
     self::check_version($input, "1.1.0");
     $username = self::check_parameter($input, 'username');
     $password = self::check_parameter($input, 'password');
     $email = self::check_parameter($input, 'email');
     $ldapAuthenticated = $input['ldapAuthenticated'];
     $adminRole = $input['adminRole'] == 'true';
     //$settingsRole = $input['settingsRole'];
     //$streamRole = $input['streamRole'];
     //$jukeboxRole = $input['jukeboxRole'];
     $downloadRole = $input['downloadRole'] == 'true';
     $uploadRole = $input['uploadRole'] == 'true';
     //$playlistRole = $input['playlistRole'];
     $coverArtRole = $input['coverArtRole'] == 'true';
     //$commentRole = $input['commentRole'];
     //$podcastRole = $input['podcastRole'];
     $shareRole = $input['shareRole'] == 'true';
     if (Access::check('interface', 100)) {
         $access = 25;
         if ($adminRole) {
             $access = 100;
         } elseif ($coverArtRole) {
             $access = 75;
         }
         $password = self::decrypt_password($password);
         $user_id = User::create($username, $username, $email, null, $password, $access);
         if ($user_id > 0) {
             if ($downloadRole) {
                 Preference::update('download', $user_id, '1');
             }
             if ($uploadRole) {
                 Preference::update('allow_upload', $user_id, '1');
             }
             if ($shareRole) {
                 Preference::update('share', $user_id, '1');
             }
             $r = Subsonic_XML_Data::createSuccessResponse();
         } else {
             $r = Subsonic_XML_Data::createError(Subsonic_XML_Data::SSERROR_DATA_NOTFOUND);
         }
     } else {
         $r = Subsonic_XML_Data::createError(Subsonic_XML_Data::SSERROR_UNAUTHORIZED);
     }
     self::apiOutput($input, $r);
 }
Esempio n. 8
0
 /**
  * uninstall
  * This runs the uninstall for the localplay controller we've
  * currently pimped out
  */
 public function uninstall()
 {
     // Run the players uninstaller
     $this->_player->uninstall();
     // If its our current player, reset player to nothing
     if (AmpConfig::get('localplay_controller') == $this->type) {
         Preference::update('localplay_controller', $GLOBALS['user']->id, '');
     }
     return true;
 }
Esempio n. 9
0
         $new_user = $_POST['db_username'];
         $new_pass = $_POST['db_password'];
         if (!strlen($new_user) || !strlen($new_pass)) {
             Error::add('general', T_('Error: Ampache SQL Username or Password missing'));
             require_once 'templates/show_install.inc.php';
             break;
         }
     }
     if (!$skip_admin) {
         if (!install_insert_db($new_user, $new_pass, $_REQUEST['create_db'], $_REQUEST['overwrite_db'], $_REQUEST['create_tables'])) {
             require_once 'templates/show_install.inc.php';
             break;
         }
     }
     // Now that it's inserted save the lang preference
     Preference::update('lang', '-1', AmpConfig::get('lang'));
     header('Location: ' . $web_path . "/install.php?action=show_create_config&local_db={$database}&local_host={$hostname}&local_port={$port}&htmllang={$htmllang}&charset={$charset}");
     break;
 case 'create_config':
     $download = !isset($_POST['write']);
     $download_htaccess_rest = isset($_POST['download_htaccess_rest']);
     $download_htaccess_play = isset($_POST['download_htaccess_play']);
     $write_htaccess_rest = isset($_POST['write_htaccess_rest']);
     $write_htaccess_play = isset($_POST['write_htaccess_play']);
     if ($write_htaccess_rest || $download_htaccess_rest) {
         $created_config = install_rewrite_rules($htaccess_rest_file, $_POST['web_path'], $download_htaccess_rest);
     } elseif ($write_htaccess_play || $download_htaccess_play) {
         $created_config = install_rewrite_rules($htaccess_play_file, $_POST['web_path'], $download_htaccess_play);
     } else {
         $created_config = install_create_config($download);
     }
Esempio n. 10
0
<?php

$dao_preference = new Preference();
$webid = Params::getParam('webid');
$option = Params::getParam('option');
if ($option == 'stepone') {
    $dao_preference->update(array("s_value" => $webid), array("s_section" => "plugin-google_analytics", "s_name" => "google_analytics_id"));
    echo '<div style="text-align:center; font-size:22px; background-color:#00bb00;"><p>' . __('Congratulations. The plugin is now configured', 'google_analytics') . '.</p></div>';
} else {
    $webid = osc_google_analytics_id();
}
?>

<form action="<?php 
osc_admin_base_url(true);
?>
" method="get">
    <input type="hidden" name="page" value="plugins" />
    <input type="hidden" name="action" value="renderplugin" />
    <input type="hidden" name="file" value="google_analytics/admin.php" />
    <input type="hidden" name="option" value="stepone" />
    
    <div>
        <?php 
_e('Please enter your Google Analytics', 'google_analytics');
?>
 <label for="webid" style="font-weight: bold;"><?php 
_e('Web property ID', 'google_analytics');
?>
</label>: <input type="text" name="webid" id="webid" value="<?php 
echo $webid;
Esempio n. 11
0
$adEmailEx = '';
$dao_preference = new Preference();
if (Params::getParam('adEmailEx') != '') {
    $adEmailEx = Params::getParam('adEmailEx');
} else {
    $adEmailEx = osc_item_adManage_adEmailEx() != '' ? osc_item_adManage_adEmailEx() : '';
}
$deleteDays = '';
$dao_preference = new Preference();
if (Params::getParam('deleteDays') != '') {
    $deleteDays = Params::getParam('deleteDays');
} else {
    $deleteDays = osc_item_adManage_deleteDays() != '' ? osc_item_adManage_deleteDays() : '';
}
if (Params::getParam('option') == 'stepone') {
    $dao_preference->update(array("s_value" => $expire_days), array("s_section" => "plugin-item_adManage", "s_name" => "adManageed_expire"));
    $dao_preference->update(array("s_value" => $payPost), array("s_section" => "plugin-item_adManage", "s_name" => "adManageed_payperpost"));
    $dao_preference->update(array("s_value" => $rTimes), array("s_section" => "plugin-item_adManage", "s_name" => "adManageed_repubTimes"));
    $dao_preference->update(array("s_value" => $freeTimes), array("s_section" => "plugin-item_adManage", "s_name" => "adManageed_freeRepubs"));
    $dao_preference->update(array("s_value" => $adEmailEx), array("s_section" => "plugin-item_adManage", "s_name" => "adManageed_expireEmail"));
    $dao_preference->update(array("s_value" => $deleteDays), array("s_section" => "plugin-item_adManage", "s_name" => "adManageed_deleteDays"));
    echo '<div style="text-align:center; font-size:22px; background-color:#00bb00;"><p>' . __('Settings Saved', 'adManage') . '.</p></div>';
}
unset($dao_preference);
?>


    <fieldset>
    <h2><?php 
_e('Advanced Ad Management Configuration', 'adManage');
?>
Esempio n. 12
0
 */
if (!defined('AJAX_INCLUDE')) {
    exit;
}
$results = array();
switch ($_REQUEST['action']) {
    case 'set_instance':
        // Make sure they they are allowed to do this
        if (!Access::check('localplay', '5')) {
            debug_event('DENIED', 'Error attempted to set instance without required level', '1');
            exit;
        }
        $type = $_REQUEST['instance'] ? 'localplay' : 'stream';
        $localplay = new Localplay(AmpConfig::get('localplay_controller'));
        $localplay->set_active_instance($_REQUEST['instance']);
        Preference::update('play_type', $GLOBALS['user']->id, $type);
        // We should also refesh the sidebar
        ob_start();
        require_once AmpConfig::get('prefix') . UI::find_template('sidebar.inc.php');
        $results['sidebar-content'] = ob_get_contents();
        ob_end_clean();
        break;
    case 'command':
        // Make sure they are allowed to do this
        if (!Access::check('localplay', '50')) {
            debug_event('DENIED', 'Attempted to control Localplay without sufficient access', '1');
            exit;
        }
        $localplay = new Localplay(AmpConfig::get('localplay_controller'));
        $localplay->connect();
        // Switch on valid commands
            $fp_backup = fopen(osc_base_path() . "robots_backup.txt", "wb");
            fwrite($fp_backup, file_get_contents(osc_base_path() . "robots.txt"));
            fclose($fp_backup);
            message_ok(__('Backup file robots_backup.txt file was successfully created', 'all_in_one'));
        }
        $content = $robots;
    }
    $fp = fopen(osc_base_path() . "robots.txt", "wb");
    fwrite($fp, $content);
    fclose($fp);
    osc_reset_preferences();
    message_ok(__('robots.txt file was successfully updated', 'all_in_one'));
    if (!is_writable(osc_base_path() . "/robots.txt")) {
        message_error(__('It is impossible to write to robots.txt file, please change CHMOD settings on this file.', 'all_in_one'));
    }
    $dao_preference->update(array("s_value" => $robotsEnabled), array("s_section" => "plugin-all_in_one", "s_name" => "allSeo_robots_enabled"));
    $dao_preference->update(array("s_value" => $robots), array("s_section" => "plugin-all_in_one", "s_name" => "allSeo_robots"));
}
unset($dao_preference);
?>

<div id="settings_form">
  <?php 
echo config_menu();
?>

  <form name="promo_form" id="promo_form" action="<?php 
echo osc_admin_base_url(true);
?>
" method="POST" enctype="multipart/form-data" >
    <input type="hidden" name="page" value="plugins" />
Esempio n. 14
0
UI::show_header();
switch ($_REQUEST['action']) {
    case 'install_localplay':
        $localplay = new Localplay($_REQUEST['type']);
        if (!$localplay->player_loaded()) {
            Error::add('general', T_('Install Failed, Controller Error'));
            Error::display('general');
            break;
        }
        // Install it!
        $localplay->install();
        // Go ahead and enable Localplay (Admin->System) as we assume they want to do that
        // if they are enabling this
        Preference::update('allow_localplay_playback', '-1', '1');
        Preference::update('localplay_level', $GLOBALS['user']->id, '100');
        Preference::update('localplay_controller', $GLOBALS['user']->id, $localplay->type);
        header("Location:" . AmpConfig::get('web_path') . '/admin/modules.php?action=show_localplay');
        break;
    case 'install_catalog_type':
        $type = scrub_in($_REQUEST['type']);
        $catalog = Catalog::create_catalog_type($type);
        if ($catalog == null) {
            Error::add('general', T_('Install Failed, Catalog Error'));
            Error::display('general');
            break;
        }
        $catalog->install();
        /* Show Confirmation */
        $url = AmpConfig::get('web_path') . '/admin/modules.php?action=show_catalog_types';
        $title = T_('Plugin Installed');
        $body = '';
    $freq = osc_get_preference('allSeo_sitemap_freq', 'plugin-all_in_one') != '' ? osc_get_preference('allSeo_sitemap_freq', 'plugin-all_in_one') : '';
}
$sitemap_items = '';
if (Params::getParam('sitemap_items') != '') {
    $sitemap_items = Params::getParam('sitemap_items');
} else {
    $sitemap_items = osc_get_preference('allSeo_sitemap_items', 'plugin-all_in_one') != '' ? osc_get_preference('allSeo_sitemap_items', 'plugin-all_in_one') : '';
}
$sitemap_items_limit = '';
if (Params::getParam('sitemap_items_limit') != '') {
    $sitemap_items_limit = Params::getParam('sitemap_items_limit');
} else {
    $sitemap_items_limit = osc_get_preference('allSeo_sitemap_items_limit', 'plugin-all_in_one') != '' ? osc_get_preference('allSeo_sitemap_items_limit', 'plugin-all_in_one') : '';
}
if (Params::getParam('plugin_action') == 'done') {
    $dao_preference->update(array("s_value" => $freq), array("s_section" => "plugin-all_in_one", "s_name" => "allSeo_sitemap_freq"));
    $dao_preference->update(array("s_value" => $sitemap_items), array("s_section" => "plugin-all_in_one", "s_name" => "allSeo_sitemap_items"));
    $dao_preference->update(array("s_value" => $sitemap_items_limit), array("s_section" => "plugin-all_in_one", "s_name" => "allSeo_sitemap_items_limit"));
    //Generate sitemap
    $execution_time = seo_sitemap_generator();
    message_ok(__('Sitemap.xml generated correctly in', 'all_in_one') . ' ' . round($execution_time, 2) . ' ' . __('seconds', 'all_in_one') . '.');
    osc_reset_preferences();
}
unset($dao_preference);
?>

<div id="settings_form">
  <?php 
echo config_menu();
?>
  
}
$pageOtherTitle = '';
if (Params::getParam('plugin_action') == 'done') {
    $pageOtherTitle = Params::getParam('pageOtherTitle');
} else {
    $pageOtherTitle = osc_get_preference('allSeo_other_page_title', 'plugin-all_in_one') != '' ? osc_get_preference('allSeo_other_page_title', 'plugin-all_in_one') : '';
}
$showTitleFirst = '';
if (Params::getParam('plugin_action') == 'done') {
    $showTitleFirst = Params::getParam('showTitleFirst');
} else {
    $showTitleFirst = osc_get_preference('allSeo_title_first', 'plugin-all_in_one') != '' ? osc_get_preference('allSeo_title_first', 'plugin-all_in_one') : '';
}
// UPDATE PROCESS OF PARAMETERS
if (Params::getParam('plugin_action') == 'done') {
    $dao_preference->update(array("s_value" => $keywords), array("s_section" => "plugin-all_in_one", "s_name" => "allSeo_keywords"));
    $dao_preference->update(array("s_value" => $delimiter), array("s_section" => "plugin-all_in_one", "s_name" => "allSeo_delimiter"));
    $dao_preference->update(array("s_value" => $showCity), array("s_section" => "plugin-all_in_one", "s_name" => "allSeo_city_show"));
    $dao_preference->update(array("s_value" => $showRegion), array("s_section" => "plugin-all_in_one", "s_name" => "allSeo_region_show"));
    $dao_preference->update(array("s_value" => $showCountry), array("s_section" => "plugin-all_in_one", "s_name" => "allSeo_country_show"));
    $dao_preference->update(array("s_value" => $showCategory), array("s_section" => "plugin-all_in_one", "s_name" => "allSeo_category_show"));
    $dao_preference->update(array("s_value" => $showTitle), array("s_section" => "plugin-all_in_one", "s_name" => "allSeo_title_show"));
    $dao_preference->update(array("s_value" => $orderCity), array("s_section" => "plugin-all_in_one", "s_name" => "allSeo_city_order"));
    $dao_preference->update(array("s_value" => $orderRegion), array("s_section" => "plugin-all_in_one", "s_name" => "allSeo_region_order"));
    $dao_preference->update(array("s_value" => $orderCountry), array("s_section" => "plugin-all_in_one", "s_name" => "allSeo_country_order"));
    $dao_preference->update(array("s_value" => $orderCategory), array("s_section" => "plugin-all_in_one", "s_name" => "allSeo_category_order"));
    $dao_preference->update(array("s_value" => $orderTitle), array("s_section" => "plugin-all_in_one", "s_name" => "allSeo_title_order"));
    $dao_preference->update(array("s_value" => $orderBody), array("s_section" => "plugin-all_in_one", "s_name" => "allSeo_body_order"));
    $dao_preference->update(array("s_value" => $pageTitle), array("s_section" => "plugin-all_in_one", "s_name" => "allSeo_page_title"));
    $dao_preference->update(array("s_value" => $showSearchCity), array("s_section" => "plugin-all_in_one", "s_name" => "allSeo_search_city_show"));
    $dao_preference->update(array("s_value" => $showSearchRegion), array("s_section" => "plugin-all_in_one", "s_name" => "allSeo_search_region_show"));
            if (strpos($web_content, $detail['seo_href_to']) !== false) {
                ModelSeoLink::newInstance()->updateRecStatus(Params::getParam('link_id'), 1);
                message_ok(__('Status of Reciprocal Link with ID', 'all_in_one') . ' ' . Params::getParam('link_id') . ' ' . __('was successfully updated', 'all_in_one'));
            } else {
                ModelSeoLink::newInstance()->updateRecStatus(Params::getParam('link_id'), 2);
                message_ok(__('Status of Reciprocal Link with ID', 'all_in_one') . ' ' . Params::getParam('link_id') . ' ' . __('was successfully updated', 'all_in_one'));
            }
        }
    } else {
        message_error(__('It is not possible to get content of website', 'all_in_one') . ' ' . $detail['seo_href_from']);
    }
}
if (Params::getParam('plugin_action') == 'done') {
    if (Params::getParam('link_add_update') == 'update') {
        //update parameter
        $dao_preference->update(array("s_value" => $show_links_footer), array("s_section" => "plugin-all_in_one", "s_name" => "allSeo_links_footer"));
        osc_reset_preferences();
        foreach (osc_has_links_seo() as $links) {
            $detail = ModelSeoLink::newInstance()->getAttrByLinkId($links['seo_link_id']);
            $show_footer = Params::getParam('seo_footer' . $links['seo_link_id']) == 'on' ? 1 : 0;
            $nofollow = Params::getParam('seo_rel' . $links['seo_link_id']) == 'on' ? 1 : 0;
            if (Params::getParam('seo_title' . $links['seo_link_id']) == '') {
                message_error(__('Error when updating backlink link', 'all_in_one') . ' #' . $links['seo_link_id'] . ': ' . __('Link title cannot be empty!', 'all_in_one'));
            } else {
                if (Params::getParam('seo_href' . $links['seo_link_id']) == '') {
                    message_error(__('Error when updating  backlink', 'all_in_one') . ' #' . $links['seo_link_id'] . ': ' . __('Link URL cannot be empty!', 'all_in_one'));
                } else {
                    if (isset($detail['seo_link_id'])) {
                        ModelSeoLink::newInstance()->updateAttr($links['seo_link_id'], Params::getParam('seo_title' . $links['seo_link_id']), Params::getParam('seo_href' . $links['seo_link_id']), $show_footer, $nofollow);
                    } else {
                        ModelSeoLink::newInstance()->insertAttr($links['seo_link_id'], Params::getParam('seo_title' . $links['seo_link_id']), Params::getParam('seo_href' . $links['seo_link_id']), $show_footer, $nofollow);
Esempio n. 18
0
function install_config_backends(array $backends)
{
    $dbconfig = array('subsonic_backend' => '0', 'plex_backend' => '0', 'daap_backend' => '0', 'upnp_backend' => '0', 'webdav_backend' => '0', 'stream_beautiful_url' => '0');
    foreach ($backends as $backend) {
        switch ($backend) {
            case 'subsonic':
                $dbconfig['subsonic_backend'] = '1';
                break;
            case 'plex':
                $dbconfig['plex_backend'] = '1';
                break;
            case 'upnp':
                $dbconfig['upnp_backend'] = '1';
                $dbconfig['stream_beautiful_url'] = '1';
                break;
            case 'daap':
                $dbconfig['daap_backend'] = '1';
                break;
            case 'webdav':
                $dbconfig['webdav_backend'] = '1';
                break;
        }
    }
    foreach ($dbconfig as $preference => $value) {
        Preference::update($preference, -1, $value, true, true);
    }
}
Esempio n. 19
0
 /**
  * set_handshake
  * This runs a handshake and properly updates the preferences as needed.
  * It returns the data as an array so we don't have to requery the db.
  * This requires a userid so it knows whose crap to update.
  */
 public function set_handshake($user_id)
 {
     $scrobbler = new scrobbler($this->username, $this->password, '', '', '', '', 'turtle.libre.fm');
     $data = $scrobbler->handshake();
     if (!$data) {
         debug_event($this->name, 'Handshake Failed: ' . $scrobbler->error_msg, '3');
         return false;
     }
     $this->hostname = $data['submit_host'];
     $this->port = $data['submit_port'];
     $this->path = $data['submit_url'];
     $this->challenge = $data['challenge'];
     // Update the preferences
     Preference::update('librefm_port', $user_id, $data['submit_port']);
     Preference::update('librefm_host', $user_id, $data['submit_host']);
     Preference::update('librefm_url', $user_id, $data['submit_url']);
     Preference::update('librefm_challenge', $user_id, $data['challenge']);
     return true;
 }
Esempio n. 20
0
$pmSent = '';
$dao_preference = new Preference();
if (Params::getParam('pmSent') != '') {
    $pmSent = Params::getParam('pmSent');
} else {
    $pmSent = pmSent() != '' ? pmSent() : '';
}
$pmAdmin = '';
$dao_preference = new Preference();
if (Params::getParam('pmAdmin') != '') {
    $pmAdmin = Params::getParam('pmAdmin');
} else {
    $pmAdmin = pmAdmin() != '' ? pmAdmin() : '';
}
if (Params::getParam('option') == 'stepone') {
    $dao_preference->update(array("s_value" => $sendEmail), array("s_section" => "plugin-osclass_pm", "s_name" => "sendEmail"));
    $dao_preference->update(array("s_value" => $maxPm), array("s_section" => "plugin-osclass_pm", "s_name" => "maxPMs"));
    $dao_preference->update(array("s_value" => $deletePM), array("s_section" => "plugin-osclass_pm", "s_name" => "deletePM"));
    $dao_preference->update(array("s_value" => $pmBlocking), array("s_section" => "plugin-osclass_pm", "s_name" => "pmBlocking"));
    $dao_preference->update(array("s_value" => $pmDrafts), array("s_section" => "plugin-osclass_pm", "s_name" => "pmDrafts"));
    $dao_preference->update(array("s_value" => $pmSent), array("s_section" => "plugin-osclass_pm", "s_name" => "pmSent"));
    $dao_preference->update(array("s_value" => $pmAdmin), array("s_section" => "plugin-osclass_pm", "s_name" => "pmAdmin"));
    echo '<div style="text-align:center; font-size:22px; background-color:#00bb00;"><p>' . __('Settings Saved', 'osclass_pm') . '.</p></div>';
}
unset($dao_preference);
$pluginInfo = osc_plugin_get_info('osclass_pm/index.php');
//print_r(osc_plugin_get_info('osclass_pm/index.php'));
?>

<form action="<?php 
osc_admin_base_url(true);
Esempio n. 21
0
        $myplex_authtoken = '';
        $myplex_published = false;
        Preference::update('myplex_username', -1, $myplex_username, true, true);
        Preference::update('myplex_authtoken', -1, $myplex_authtoken, true, true);
        Preference::update('myplex_published', -1, $myplex_published, true, true);
        break;
    case 'save':
        $plex_servername = $_POST['plex_servername'];
        $plex_local_auth = $_POST['plex_local_auth'] ?: '0';
        $plex_match_email = $_POST['plex_match_email'] ?: '0';
        Preference::update('plex_servername', -1, $plex_servername, true, true);
        Preference::update('plex_local_auth', -1, $plex_local_auth, true, true);
        Preference::update('plex_match_email', -1, $plex_match_email, true, true);
        break;
    case 'change_uniqid':
        Preference::update('plex_uniqid', -1, uniqid(), true, true);
        echo T_('Server UUID changed.') . "<br />\r\n";
        break;
}
?>
    <p class="info">Configure your Plex server settings bellow.</p>

    <div class="configform">
        <h3>Server Settings</h3>
        <form action="" method="POST" enctype="multipart/form-data">
            <input type="hidden" name="plexact" value="save" />
            <div class="field">
                <label for="plex_servername">Server Name:</label>
                <input id="plex_servername" class="field_value" type="text" name="plex_servername" value="<?php 
echo $plex_servername;
?>
Esempio n. 22
0
             }
             $new = $_POST['type'];
             break;
         case 'web_player':
             $new = $_POST['type'];
             // Rien a faire
             break;
         default:
             $new = 'stream';
             $results['rfc3514'] = '0x1';
             break 2;
     }
     // end switch
     $current = AmpConfig::get('play_type');
     // Go ahead and update their preference
     if (Preference::update('play_type', $GLOBALS['user']->id, $new)) {
         AmpConfig::set('play_type', $new, true);
     }
     if ($new == 'localplay' and $current != 'localplay' or $current == 'localplay' and $new != 'localplay') {
         $results['rightbar'] = UI::ajax_include('rightbar.inc.php');
     }
     $results['rfc3514'] = '0x0';
     break;
 case 'directplay':
     debug_event('stream.ajax.php', 'Play type {' . $_REQUEST['playtype'] . '}', 5);
     $object_type = $_REQUEST['object_type'];
     $object_id = $_REQUEST['object_id'];
     if (is_array($object_id)) {
         $object_id = implode(',', $object_id);
     }
     if (Core::is_playable_item($object_type)) {
Esempio n. 23
0
 /**
  * get_session
  * This call the getSession method and properly updates the preferences as needed.
  * This requires a userid so it knows whose crap to update.
  */
 public function get_session($user_id, $token)
 {
     $scrobbler = new scrobbler($this->api_key, $this->scheme, $this->api_host, '', $this->secret);
     $session_key = $scrobbler->get_session_key($token);
     if (!$session_key) {
         debug_event($this->name, 'getSession Failed: ' . $scrobbler->error_msg, '3');
         return false;
     }
     $this->challenge = $session_key;
     // Update the preferences
     Preference::update('lastfm_challenge', $user_id, $session_key);
     debug_event($this->name, 'getSession Successful', '3');
     return true;
 }
            $fp_backup = fopen(osc_base_path() . ".htaccess_backup", "wb");
            fwrite($fp_backup, file_get_contents(osc_base_path() . ".htaccess"));
            fclose($fp_backup);
            message_ok(__('Backup file .htaccess_backup file was successfully created', 'all_in_one'));
        }
        $content = $htaccess;
    }
    $fp = fopen(osc_base_path() . "/.htaccess", "wb");
    fwrite($fp, $content);
    fclose($fp);
    osc_reset_preferences();
    message_ok(__('.htaccess file was successfully updated', 'all_in_one'));
    if (!is_writable(osc_base_path() . "/.htaccess")) {
        message_error(__('It is impossible to write to .htaccess file, please change CHMOD settings on this file.', 'all_in_one'));
    }
    $dao_preference->update(array("s_value" => $htaccessEnabled), array("s_section" => "plugin-all_in_one", "s_name" => "allSeo_htaccess_enabled"));
    $dao_preference->update(array("s_value" => $htaccess), array("s_section" => "plugin-all_in_one", "s_name" => "allSeo_htaccess"));
}
unset($dao_preference);
?>

<div id="settings_form">
  <?php 
echo config_menu();
?>

  <?php 
if ($rewriteEnabled != 1) {
    ?>
    <?php 
    message_error(__('You did not activated Friendly URLs. Activate it first or you will not be able to save settings.', 'all_in_one') . '</br></br><strong><a href="' . osc_base_url() . 'oc-admin/index.php?page=settings&action=permalinks" target="_blank">' . __('Activate Permalinks (Friendly URLs) >>', 'all_in_one') . '</a></strong>');