Exemplo n.º 1
0
function do_categories() {
	global $globals, $current_user, $db, $user, $login;

	$options = array();
	$options[$user->username] = get_user_uri($user->username);
	$options[_('categorías personalizadas')] = get_user_uri($user->username, 'categories');
	if ($current_user->user_id == $user->id || $current_user->user_level == 'god') {
		$options[_('modificar perfil').' →'] = $globals['base_url'].'profile.php?login='******'rss2.php?personal='.$user->id, _('categorías personalizadas en rss2'));
	
	if (is_array($_POST['categories'])) {
		$db->query("delete from prefs where pref_user_id = $current_user->user_id and pref_key = 'category'");
		$total = (int) $db->get_var("SELECT count(*) FROM categories WHERE category_parent != 0");
		if (count($_POST['categories']) < $total) {
			for ($i=0; $i<count($_POST['categories']); $i++){ 
				$cat = intval($_POST['categories'][$i]); 
				$db->query("insert into prefs (pref_user_id, pref_key, pref_value) values ($current_user->user_id, 'category', $cat)");
			}
		}
	}

  if ($_POST['comment_options_form']) {
    if ($_POST['karma_order']) {
      $db->query("delete from prefs where pref_user_id = $current_user->user_id and pref_key = 'comment'");
      $db->query("insert into prefs (pref_user_id, pref_key, pref_value) values ($current_user->user_id, 'comment', 'korder');"); // korder : karma_order
    } else {
      $db->query("delete from prefs where pref_user_id = $current_user->user_id and pref_key = 'comment'");
    }
  }

	print_options_checkboxes($user);
	print_categories_checkboxes($user);
}
Exemplo n.º 2
0
function do_categories()
{
    global $globals, $current_user, $db, $user, $login;
    $options = array();
    $options[$user->username] = get_user_uri($user->username);
    $options[_('categorías personalizadas')] = get_user_uri($user->username, 'categories');
    if ($current_user->user_id == $user->id || $current_user->user_level == 'god') {
        $options[_('modificar perfil') . ' &rarr;'] = $globals['base_url'] . 'profile.php?login='******'rss2.php?personal=' . $user->id, _('categorías personalizadas en rss2'));
    if (is_array($_POST['categories'])) {
        $db->query("delete from prefs where pref_user_id = {$current_user->user_id} and pref_key = 'category_" . SitesMgr::my_id() . "'");
        $total = count(SitesMgr::get_categories());
        if (count($_POST['categories']) < $total) {
            for ($i = 0; $i < count($_POST['categories']); $i++) {
                $cat = intval($_POST['categories'][$i]);
                $db->query("insert into prefs (pref_user_id, pref_key, pref_value) values ({$current_user->user_id}, 'category_" . SitesMgr::my_id() . "', {$cat})");
            }
        }
    }
    print_categories_checkboxes($user);
}
Exemplo n.º 3
0
function do_categories()
{
    global $current_user, $db, $user;
    if (is_array($_POST['categories'])) {
        $db->query("delete from prefs where pref_user_id = {$current_user->user_id} and pref_key = 'category'");
        $total = (int) $db->get_var("SELECT count(*) FROM categories WHERE category_parent != 0");
        if (count($_POST['categories']) < $total) {
            for ($i = 0; $i < count($_POST['categories']); $i++) {
                $cat = intval($_POST['categories'][$i]);
                $db->query("insert into prefs (pref_user_id, pref_key, pref_value) values ({$current_user->user_id}, 'category', {$cat})");
            }
        }
    }
    echo '<div id="genericform">';
    print_categories_checkboxes($user);
    echo '</div>';
}