Пример #1
0
        } else {
            $err = new AlertText('Must enter a name', 'Input needed');
            $page->append($err);
        }
        interface_disp_page($page);
        db_disconnect($dbh);
        exit;
    }
    //if not valid username
}
//$if (!$searchnum)
//begin displaying if there is a user with name or number given
// Create the new page
if (User::logged_in()) {
    //TODO add searchname instead?
    $page->url = add_param($page->url, 'searchnum', $searchnum);
    $addtolist = isset($_POST['addtolist']) ? (bool) $_POST['addtolist'] : false;
    // if person is manipulating which tier this plan is on their autoread list
    if (isset($_POST['block_user'])) {
        if ($_POST['block_user'] == 1) {
            $user = User::get();
            if ($user->webview == 1) {
                $warning = new AlertText("Warning! Your plan is set to be viewable by guests. This will allow blocked users to read your plan\nsimply by logging out. If you would like to change this setting, please visit\n<a href=\"/webview.php\">the guest settings page</a>.");
                $page->append($warning);
            }
            Block::addBlock($idcookie, $searchnum);
            $msg = new InfoText("<p>You have blocked this user. Blocking a user is one-directional. Selecting \"Block\" renders the contents of your plan unavailable to this user. Neither will see any [planlove] by the other, and any updates either make will not show up on each other’s planwatch.</p>\n\n<p>If this block was made in error, please use the option at the bottom of the page to un-do.</p>");
        } else {
            Block::removeBlock($idcookie, $searchnum);
            $msg = new InfoText("User " . $planinfo[0][0] . " has been unblocked.");
        }
Пример #2
0
/**
 * Get the optional links for a user
 *
 * These are the links that a user may enable or disable.
 * Gets the links that the given user has enabled.
 *
 * @param int $idcookie The user's id
 * @return array An array of Hyperlink objects
 */
function get_opt_links($idcookie)
{
    $linkarray = mysql_query("Select avail_links.linkname, avail_links.html_code as html_code, static\n    From avail_links, opt_links where   \n    opt_links.userid = '{$idcookie}' and opt_links.linknum = avail_links.linknum");
    $newarr = array();
    while ($new_row = mysql_fetch_row($linkarray)) {
        if ($new_row[2] == 'yes') {
            preg_match("/href=\"([^\"]+)\"/", $new_row[1], $foo);
            $href = $foo[1];
            // TODO this is silly, let's just store href in the db
            $thislink = new Hyperlink('opt_link', false, $href, $new_row[0]);
        } else {
            if ($new_row[0] == 'Secrets') {
                $count = count_unread_secrets($idcookie);
                $thislink = new Hyperlink('mainlink_secrets', true, 'anonymous.php', "Secrets ({$count})");
            } else {
                if ($new_row[0] == 'Jumble') {
                    $url = $_SERVER['REQUEST_URI'];
                    if ($_GET['jumbled'] == 'yes' || $_COOKIE['jumbled'] == 'yes' && $_GET['jumbled'] != 'no') {
                        $url = add_param($url, 'jumbled', 'no');
                        $linktext = 'unjumble';
                    } else {
                        $url = add_param($url, 'jumbled', 'yes');
                        $linktext = 'jumble';
                    }
                    $thislink = new Hyperlink('mainlink_jumble', true, $url, $linktext);
                } else {
                    // the forum link needs this, really we just need a better system
                    preg_match("/href=\"([^\"]+)\"/", $new_row[1], $foo);
                    $href = $foo[1];
                    $thislink = new Hyperlink('opt_link', false, $href, $new_row[0]);
                }
            }
        }
        $newarr[] = $thislink;
    }
    return $newarr;
}
Пример #3
0
     // users per course
     $qry_base = "FROM user AS a LEFT JOIN course_user AS b ON a.id = b.user_id\n                              {$depqryadd} WHERE b.course_id = ?d";
     if ($qry_criteria) {
         $qry_base .= ' AND ' . $qry_criteria;
     }
     $qry = "SELECT DISTINCT a.id, a.surname, a.givenname, a.username, a.email,\n                           a.verified_mail, b.status " . $qry_base;
     add_param('c');
     array_unshift($terms, $c);
 } elseif ($search == 'no_login') {
     // users who have never logged in
     $qry_base = "FROM user LEFT JOIN loginout ON user.id = loginout.id_user {$depqryadd}\n                              WHERE loginout.id_user IS NULL";
     if ($qry_criteria) {
         $qry_base .= ' AND ' . $qry_criteria;
     }
     $qry = "SELECT DISTINCT user.id, surname, givenname, username, email, verified_mail, status " . $qry_base;
     add_param('search', 'no_login');
 } else {
     $qry_base = ' FROM user' . $depqryadd;
     if ($qry_criteria) {
         $qry_base .= ' WHERE ' . $qry_criteria;
     }
     $qry = 'SELECT DISTINCT user.id, surname, givenname, username, email, status, verified_mail' . $qry_base;
 }
 $terms_base[] = $terms;
 // internal search
 if (!empty($_GET['sSearch'])) {
     if ($qry_criteria or $c) {
         $qry .= ' AND (surname LIKE ?s OR givenname LIKE ?s OR username LIKE ?s OR email LIKE ?s)';
     } else {
         $qry .= ' WHERE (surname LIKE ?s OR givenname LIKE ?s OR username LIKE ?s OR email LIKE ?s)';
     }