Example #1
0
function getFontFamily($font)
{
    $query = "SELECT * FROM fonts WHERE name='{$font}' LIMIT 1";
    $result = dbquery($query);
    $assoc = mysql_fetch_assoc($result);
    return $assoc["family"];
}
Example #2
0
function panels_list($panel_id = NULL)
{
    $panel_list = "";
    $result = dbquery("SELECT panel_id, panel_filename FROM " . DB_PANELS . " ORDER BY panel_id");
    while ($data = dbarray($result)) {
        $panels[] = $data['panel_filename'];
    }
    $temp = opendir(INFUSIONS);
    while ($folder = readdir($temp)) {
        if (!in_array($folder, array(".", "..")) && strstr($folder, "_panel")) {
            if (is_dir(INFUSIONS . $folder)) {
                if (!in_array($folder, $panels)) {
                    $panel_list[] = ucwords(str_replace('_', ' ', $folder));
                }
            }
        }
    }
    closedir($temp);
    if ($panel_list > 0) {
        if (count($panel_list)) {
            sort($panel_list);
        }
        if ($panel_id != NULL) {
            $panel_name = $panel_list[$panel_id];
            return $panel_name;
        } else {
            return $panel_list;
        }
    }
}
Example #3
0
File: gao.php Project: hdp/brass
function DoTask()
{
    global $GAME;
    if ($GAME['MyColour'] == 50) {
        $mypage = page::standard();
        $mypage->title_body('Not playing in this game');
        $mypage->leaf('p', 'You are not currently playing in this game, so unfortunately you cannot save notes on it. Please click <a href="board.php?GameID=' . $GAME['GameID'] . '">here</a> to go to the board page, or <a href="index.php">here</a> to return to the Main Page.');
        $mypage->finish();
    }
    $EscapedNotes = sanitise_str_fancy(@$_POST['GameNotes'], 1, 25000, STR_GPC | STR_ESCAPE_HTML);
    if ($EscapedNotes[1] == 1) {
        $mypage = page::standard();
        $mypage->title_body('Notes too long');
        $mypage->leaf('p', 'The notes you entered are too long. The limit is around 25,&thinsp;000 characters (proviso: depending on the content you enter, the number of characters after the content is processed may vary slightly from that before). Please click <a href="board.php?GameID=' . $GAME['GameID'] . '">here</a> to go to the board page, or <a href="index.php">here</a> to return to the Main Page. Here are the notes you entered:');
        $mypage->leaf('textarea', $EscapedNotes[0], 'cols=80 rows=20');
        $mypage->finish();
    }
    if ($EscapedNotes[1] == -1) {
        dbquery(DBQUERY_WRITE, 'DELETE FROM "PlayerGameNotes" WHERE "Game" = :game: AND "User" = :user:'******'game', $GAME['GameID'], 'user', $GAME['PlayerUserID'][$GAME['MyColour']]);
    } else {
        dbquery(DBQUERY_WRITE, 'REPLACE INTO "PlayerGameNotes" ("Game", "User", "Notes") VALUES (:game:, :user:, :notes:)', 'game', $GAME['GameID'], 'user', $GAME['PlayerUserID'][$GAME['MyColour']], 'notes', $EscapedNotes[0]);
    }
    dbquery(DBQUERY_COMMIT);
    page::redirect(3, 'board.php?GameID=' . $GAME['GameID'], 'Successfully saved notes.');
}
Example #4
0
function links($cat = 0, $direction = "asc")
{
    global $linksmessage, $prefix;
    if ($direction != "asc" && $direction != "desc") {
        $direction = "asc";
    }
    $out = "";
    if ($cat) {
        $query = "SELECT * FROM " . $prefix . "linkscat WHERE id=" . $cat . " ORDER BY nome";
    } else {
        $query = "SELECT * FROM " . $prefix . "linkscat ORDER BY nome";
    }
    if (!($cresult = dbquery($query))) {
        die($linksmessage[4]);
    }
    $out .= "\n<div id=\"LNE_show\">\n";
    while ($crow = fetch_array($cresult)) {
        $out .= "<h3>" . decode($crow['descr']) . "</h3>\n";
        $query = "SELECT * FROM " . $prefix . "links where hits=" . $crow[0] . " ORDER BY name " . $direction;
        if (!($result = dbquery($query))) {
            die($linksmessage[5]);
        }
        if (num_rows($result)) {
            $out .= "<ul>\n";
            while ($row = fetch_array($result)) {
                $out .= "<li><a href=\"" . $row['link'] . "\" onclick=\"window.open(this.href,'_blank');return false;\">" . decode($row['name']) . "</a><div>" . decode($row['descr']) . "</div></li>\n";
            }
            $out .= "</ul>\n";
        }
    }
    $out .= "</div>\n";
    return $out;
}
Example #5
0
function sendemail_template($template_key, $subject, $message, $user, $receiver, $thread_url = "", $toemail, $sender = "", $fromemail = "")
{
    global $settings;
    $data = dbarray(dbquery("SELECT * FROM " . DB_EMAIL_TEMPLATES . " WHERE template_key='" . $template_key . "' LIMIT 1"));
    $message_subject = $data['template_subject'];
    $message_content = $data['template_content'];
    $template_format = $data['template_format'];
    $sender_name = $sender != "" ? $sender : $data['template_sender_name'];
    $sender_email = $fromemail != "" ? $fromemail : $data['template_sender_email'];
    $subject_search_replace = array("[SUBJECT]" => $subject, "[SITENAME]" => $settings['sitename'], "[SITEURL]" => $settings['siteurl'], "[USER]" => $user, "[SENDER]" => $sender_name, "[RECEIVER]" => $receiver);
    $message_search_replace = array("[SUBJECT]" => $subject, "[SITENAME]" => $settings['sitename'], "[SITEURL]" => $settings['siteurl'], "[MESSAGE]" => $message, "[USER]" => $user, "[SENDER]" => $sender_name, "[RECEIVER]" => $receiver, "[THREAD_URL]" => $thread_url);
    foreach ($subject_search_replace as $search => $replace) {
        $message_subject = str_replace($search, $replace, $message_subject);
    }
    foreach ($message_search_replace as $search => $replace) {
        $message_content = str_replace($search, $replace, $message_content);
    }
    if ($template_format == "html") {
        $message_content = nl2br($message_content);
    }
    if (sendemail($receiver, $toemail, $sender_name, $sender_email, $message_subject, $message_content, $template_format)) {
        return TRUE;
    } else {
        return FALSE;
    }
}
Example #6
0
	/**
	* Report a comment as a spam.
	* @param string $comid Comment ID
	* @param string $revid Revision ID of the comment
	* @param integer $uid User ID of person who reported spam.
	* @return integer Spam return ID
	*/
	public static function report($comid, $revid, $uid)
	{
		$sql = "Insert into comment_spam(sp_comid,sp_revid,sp_uid) values('$comid','$revid','$uid') returning sp_id";
		$row=pg_fetch_row(dbquery($sql));
		return $row[0];
		
	}
Example #7
0
function breadcrumbs($fid, $tid = null)
{
    $title = getForumTitle($fid);
    $temp_fid = $fid;
    $breadcrumbs = [];
    while (true) {
        $res = dbquery("SELECT parent_id, main FROM forums\n                    WHERE fid=:fid", array("fid" => $temp_fid));
        $pid = $res->fetch(PDO::FETCH_ASSOC);
        if ($pid['main'] == 1) {
            /*$cid = $pid['parent_id'];
              $res = dbquery("SELECT title FROM categories
                              WHERE cid=:cid", array("cid"=>$cid));
              $title = $res->fetch(PDO::FETCH_ASSOC);
              $breadcrumbs[$cid] = $title;*/
            break;
        } else {
            $temp_fid = $pid['parent_id'];
            $breadcrumbs[$temp_fid] = getForumTitle($temp_fid);
        }
    }
    echo "<div id='breadcrumbs'><a href='/'>Board index </a>";
    foreach (array_reverse($breadcrumbs, true) as $temp_fid => $temp_title) {
        echo "&gt&gt <a href='/?page=forum&fid={$temp_fid}'>{$temp_title} </a>";
    }
    echo "&gt&gt <a href='/?page=forum&fid={$fid}'>{$title} </a>";
    if ($tid != null) {
        $title = getTopicTitle($tid);
        echo "&gt&gt <a href='/?page=thread&tid={$tid}'>{$title}</a></div>";
    } else {
        echo "</div>";
    }
}
Example #8
0
File: gak.php Project: hdp/brass
function DoTask()
{
    global $GAME;
    if ($GAME['GameStatus'] != 'In Progress' and $GAME['GameStatus'] != 'Recruiting Replacement' or !$GAME['PlayersMissingThatMatter']) {
        $mypage = page::standard();
        $mypage->title_body('No replacements needed');
        $mypage->leaf('p', 'No replacement players are needed for this game at the moment. (Perhaps something happened after you loaded the board page.) Please click <a href="board.php?GameID=' . $GAME['GameID'] . '">here</a> to go to the board page, or <a href="index.php">here</a> to return to the Main Page.');
        $mypage->finish();
    }
    $mycol = dbquery(DBQUERY_READ_SINGLEROW, 'SELECT "Colour" FROM "ReplacementOffer" WHERE "Game" = :game: AND "User" = :user:'******'game', $GAME['GameID'], 'user', $_SESSION['MyUserID']);
    if ($mycol === 'NONE') {
        $mypage = page::standard();
        $mypage->title_body('Not currently a candidate replacement');
        $mypage->leaf('p', 'You are not currently a candidate replacement. You might be seeing this message because you clicked the button twice. Please click <a href="board.php?GameID=' . $GAME['GameID'] . '">here</a> to go to the board page, or <a href="index.php">here</a> to return to the Main Page.');
        $mypage->finish();
    }
    dbquery(DBQUERY_WRITE, 'DELETE FROM "ReplacementOffer" WHERE "Game" = :game: AND "User" = :user:'******'game', $GAME['GameID'], 'user', $_SESSION['MyUserID']);
    if ($mycol['Colour'] == $GAME['PlayerToMove']) {
        $GAME['AltGameTicker'] .= '8F' . callmovetimediff() . letter_end_number($_SESSION['MyUserID']) . letter_end_number($_SESSION['MyGenderCode']);
        $GAME['GameTickerNames'] .= '|' . $_SESSION['MyUserName'];
        dbformatgamedata();
    } else {
        dbquery(DBQUERY_COMMIT);
    }
    page::redirect(3, 'board.php?GameID=' . $GAME['GameID'], 'Successfully withdrew request.');
}
function showsublinks($sep = "&middot;", $class = "")
{
    $sres = dbquery("SELECT link_window, link_visibility, link_url, link_name FROM " . DB_SITE_LINKS . "\n\t\tWHERE " . groupaccess('link_visibility') . " AND link_position>='2' AND link_url!='---' ORDER BY link_order ASC");
    if (dbrows($sres)) {
        $i = 0;
        $res = "<ul>\n";
        while ($sdata = dbarray($sres)) {
            $link_target = $sdata['link_window'] == "1" ? " target='_blank'" : "";
            $li_class = $i == 0 ? " class='first-link" . ($class ? " {$class}" : "") . "'" : ($class ? " class='{$class}'" : "");
            if (strstr($sdata['link_url'], "http://") || strstr($sdata['link_url'], "https://")) {
                $res .= "<li" . $li_class . ">" . $sep . "<a href='" . $sdata['link_url'] . "'{$link_target}><span>" . $sdata['link_name'] . "</span></a></li>\n";
            } else {
                $res .= "<li" . $li_class . ">" . $sep . "<a href='" . BASEDIR . $sdata['link_url'] . "'{$link_target}><span>" . $sdata['link_name'] . "</span></a></li>\n";
            }
            $i++;
        }
        if (iMEMBER) {
            $res .= "<li" . $li_class . ">" . $sep . "<a href='" . BASEDIR . "setuser.php?logout=yes'><span>Logout</span></a> </li>\n";
        } else {
            $res .= "<li" . $li_class . ">" . $sep . "<a href='" . BASEDIR . "register.php'><span>Register</span></a> </li>\n";
        }
        $res .= "</ul>\n";
        return $res;
    }
}
Example #10
0
function set_start($idx)
{
    global $URL, $pn;
    $dbh = dbconnect();
    $query = "select poll_idx,status from poll_data where poll_idx={$idx}";
    $sth = dbquery($dbh, $query);
    list($poll_idx, $edate) = dbselect($sth);
    if (!$poll_idx) {
        print_alert("존재하지 않는 데이터입니다.   ", 'back');
        exit;
    } elseif ($status == 1) {
        print_alert("현재 설문중입니다.   ", 'back');
        exit;
    }
    /* 설문 재개 */
    $query = "update poll_data set status='1' where poll_idx={$idx}";
    $sth = dbquery($dbh, $query);
    if (!$sth) {
        $msg = "에러가 발생하였습니다.<br><br>\n" . mysql_error();
        print_message($msg);
    } else {
        header("Location: {$URL['list']}?pn={$pn}");
        exit;
    }
    dbclose($dbh);
    exit;
}
Example #11
0
 function quarantine_clean()
 {
     $oldest = date('U', strtotime('-' . QUARANTINE_DAYS_TO_KEEP . " days"));
     $quarantine = get_conf_var('QuarantineDir');
     $d = dir($quarantine) or die($php_errormsg);
     while (false !== ($f = $d->read())) {
         // Only interested in quarantine directories (yyyymmdd)
         if (preg_match('/^\\d{8}$/', $f)) {
             $unixtime = quarantine_date_to_unixtime($f);
             if ($unixtime < $oldest) {
                 // Needs to be deleted
                 $array = quarantine_list_dir($f);
                 dbg("Processing directory {$f}: found " . count($array) . " records to delete");
                 foreach ($array as $id) {
                     // Update the quarantine flag
                     $sql = "UPDATE maillog SET timestamp=timestamp, quarantined = NULL WHERE id='{$id}'";
                     dbquery($sql);
                 }
                 dbg("Deleting: " . escapeshellarg($quarantine . '/' . $f));
                 exec('rm -rf ' . escapeshellarg($quarantine . '/' . $f), $output, $return);
                 if ($return > 0) {
                     echo "Error: {$output}\n";
                 }
             }
         }
     }
     $d->close();
 }
Example #12
0
function version_check_ucc()
{
    global $ucc_config;
    // IF time() - 60*3 > $DB-ZEIT
    $a = time() - 60 * 5;
    if ($a > $ucc_config['ucc_version_time']) {
        $url = "http://basti2web.de/version/phpfusion_ucc.txt";
        $url_p = @parse_url($url);
        $host = $url_p['host'];
        $port = isset($url_p['port']) ? $url_p['port'] : 80;
        $fp = @fsockopen($url_p['host'], $port, $errno, $errstr, 5);
        if (!$fp) {
            return false;
        }
        @fputs($fp, 'GET ' . $url_p['path'] . ' HTTP/1.1' . chr(10));
        @fputs($fp, 'HOST: ' . $url_p['host'] . chr(10));
        @fputs($fp, 'Connection: close' . chr(10) . chr(10));
        $response = @fgets($fp, 1024);
        $content = @fread($fp, 1024);
        $content = preg_replace("#(.*?)text/plain(.*?)\$#is", "\$2", $content);
        @fclose($fp);
        if (preg_match("#404#", $response)) {
            $result = dbquery("UPDATE " . DB_PREFIX . "ucc_settings SET ucc_version_time='" . time() . "', ucc_version_temp=''");
            return false;
        } else {
            $content = trim($content);
            $result = dbquery("UPDATE " . DB_PREFIX . "ucc_settings SET ucc_version_time='" . time() . "', ucc_version_temp='" . $content . "'");
            return $content;
        }
    } else {
        return $ucc_config['ucc_version_temp'];
    }
}
Example #13
0
File: gab.php Project: hdp/brass
function DoTask()
{
    global $Administrator, $GAME;
    if (!$Administrator) {
        $mypage = page::standard();
        $mypage->title_body('Not authorised');
        $mypage->leaf('p', 'You are not authorised to make use of this page. Please click <a href="board.php?GameID=' . $GAME['GameID'] . '">here</a> to go to the board page, or <a href="index.php">here</a> to return to the Main Page.');
        $mypage->finish();
    }
    $thenumber = sanitise_int(@$_POST['thenumber']);
    if ($thenumber < -9 or $thenumber > 99 or $thenumber == 0) {
        $mypage = page::standard();
        $mypage->title_body('Invalid input');
        $mypage->leaf('p', 'Expected a nonzero integer between -9 and 99 inclusive, but received ' . $thenumber . '. Please click <a href="board.php?GameID=' . $GAME['GameID'] . '">here</a> to go to the board page, or <a href="index.php">here</a> to return to the Main Page.');
        $mypage->finish();
    }
    $interval = sanitise_enum(@$_POST['theinterval'], array('MINUTE', 'HOUR', 'DAY'));
    if (@$_POST['whattime'] == 'now') {
        $whattime = 'UTC_TIMESTAMP()';
    } else {
        $whattime = '"LastMove"';
    }
    $time_expr = 'TIMESTAMPADD(' . $interval . ', :thenumber:, ' . $whattime . ')';
    dbquery(DBQUERY_WRITE, 'UPDATE "Game" JOIN "GameInProgress" ON "Game"."GameID" = "GameInProgress"."Game" SET "Game"."LastMove" = ' . $time_expr . ', "GameInProgress"."GIPLastMove" = ' . $time_expr . ' "Game"."GameTicker" = CONCAT("Game"."GameTicker", :tickerconcat:), "Game"."GameTickerNames" = CONCAT("Game"."GameTickerNames", :namesconcat:) WHERE "GameID" = :game:', 'thenumber', $thenumber, 'tickerconcat', '3A' . callmovetimediff() . letter_end_number($_SESSION['MyUserID']) . letter_end_number($_SESSION['MyGenderCode']), 'namesconcat', '|' . $_SESSION['MyUserName'], 'game', $GAME['GameID']);
    dbquery(DBQUERY_COMMIT);
    page::redirect(3, 'board.php?GameID=' . $GAME['GameID'], 'Successfully altered clock.');
}
function make_rss($feed_name, $feed_updfrq, $language = "all", $exists = false)
{
    global $settings, $locale;
    if (IF_MULTI_LANGUAGE && $language) {
        $language = $language;
    } else {
        $language = false;
    }
    $feed_language = $language ? "_" . strtolower($language) : "";
    if ($exists) {
        $rows = true;
    } else {
        $result = dbquery("SELECT feed_name FROM " . DB_SS_FEEDS . " WHERE feed_name='" . $feed_name . "'");
        $rows = dbrows($result);
    }
    if ($rows != 0) {
        if (file_exists(INFUSIONS . "ss_feeds_panel/feeds/" . $feed_name . ".php")) {
            include INFUSIONS . "ss_feeds_panel/feeds/" . $feed_name . ".php";
        }
        $rssfile = INFUSIONS . "ss_feeds_panel/rss/" . $feed_name . "" . $feed_language . ".rss";
        if (file_exists($rssfile)) {
            chmod($rssfile, 0777);
        }
        $write = false;
        $file = fopen($rssfile, "w");
        if (fwrite($file, $rss)) {
            $write = true;
        }
        fclose($file);
        chmod($rssfile, 0644);
        return $write;
    }
}
function flood_control($field, $table, $where)
{
    global $userdata, $settings, $locale;
    $flood = false;
    if (!iSUPERADMIN && !iADMIN && (!defined("iMOD") || !iMOD)) {
        $result = dbquery("SELECT MAX(" . $field . ") AS last_post FROM " . $table . " WHERE " . $where);
        if (dbrows($result)) {
            $data = dbarray($result);
            if (time() - $data['last_post'] < $settings['flood_interval']) {
                $flood = true;
                $result = dbquery("INSERT INTO " . DB_FLOOD_CONTROL . " (flood_ip, flood_timestamp) VALUES ('" . USER_IP . "', '" . time() . "')");
                if (dbcount("(flood_ip)", DB_FLOOD_CONTROL, "flood_ip='" . USER_IP . "'") > 4) {
                    if (iMEMBER && $settings['flood_autoban'] == "1") {
                        require_once INCLUDES . "sendmail_include.php";
                        require_once INCLUDES . "suspend_include.php";
                        $result = dbquery("UPDATE " . DB_USERS . " SET user_status='4', user_actiontime='0' WHERE user_id='" . $userdata['user_id'] . "'");
                        suspend_log($userdata['user_id'], 4, $locale['global_440'], true);
                        $message = str_replace("[USER_NAME]", $userdata['user_name'], $locale['global_442']);
                        sendemail($userdata['user_name'], $userdata['user_email'], $settings['siteusername'], $settings['siteemail'], $locale['global_441'], $message);
                    } elseif (!iMEMBER) {
                        $result = dbquery("INSERT INTO " . DB_BLACKLIST . " (blacklist_ip, blacklist_email, blacklist_reason) VALUES ('" . USER_IP . "', '', '" . $locale['global_440'] . "')");
                    }
                }
            }
        }
    }
    return $flood;
}
Example #16
0
function showratings($rating_type, $rating_item_id, $rating_link)
{
    global $locale, $userdata;
    $settings = \fusion_get_settings();
    if ($settings['ratings_enabled'] == "1") {
        if (iMEMBER) {
            $d_rating = dbarray(dbquery("SELECT rating_vote,rating_datestamp FROM " . DB_RATINGS . " WHERE rating_item_id='" . $rating_item_id . "' AND rating_type='" . $rating_type . "' AND rating_user='******'user_id'] . "'"));
            if (isset($_POST['post_rating'])) {
                // Rate
                if (isnum($_POST['rating']) && $_POST['rating'] > 0 && $_POST['rating'] < 6 && !isset($d_rating['rating_vote'])) {
                    $result = dbquery("INSERT INTO " . DB_RATINGS . " (rating_item_id, rating_type, rating_user, rating_vote, rating_datestamp, rating_ip, rating_ip_type) VALUES ('{$rating_item_id}', '{$rating_type}', '" . $userdata['user_id'] . "', '" . $_POST['rating'] . "', '" . time() . "', '" . USER_IP . "', '" . USER_IP_TYPE . "')");
                    if ($result) {
                        defender::unset_field_session();
                    }
                }
                redirect($rating_link);
            } elseif (isset($_POST['remove_rating'])) {
                // Unrate
                $result = dbquery("DELETE FROM " . DB_RATINGS . " WHERE rating_item_id='{$rating_item_id}' AND rating_type='{$rating_type}' AND rating_user='******'user_id'] . "'");
                if ($result) {
                    defender::unset_field_session();
                }
                redirect($rating_link);
            }
        }
        $ratings = array(5 => $locale['r120'], 4 => $locale['r121'], 3 => $locale['r122'], 2 => $locale['r123'], 1 => $locale['r124']);
        if (!iMEMBER) {
            $message = str_replace("[RATING_ACTION]", "<a href='" . BASEDIR . "login.php'>" . $locale['login'] . "</a>", $locale['r104']);
            if (fusion_get_settings("enable_registration") == TRUE) {
                $message = str_replace("[RATING_ACTION]", "<a href='" . BASEDIR . "login.php'>" . $locale['login'] . "</a> " . $locale['or'] . " <a href='" . BASEDIR . "register.php'>" . $locale['register'] . "</a>", $locale['r104']);
            }
            echo "<div class='text-center'>" . $message . "</div>\n";
        } elseif (isset($d_rating['rating_vote'])) {
            echo "<div class='display-block'>\n";
            echo openform('removerating', 'post', $rating_link, array('class' => 'display-block text-center'));
            echo sprintf($locale['r105'], $ratings[$d_rating['rating_vote']], showdate("longdate", $d_rating['rating_datestamp'])) . "<br /><br />\n";
            echo form_button('remove_rating', $locale['r102'], $locale['r102'], array('class' => 'btn-default', 'icon' => 'fa fa-times m-r-10'));
            echo closeform();
            echo "</div>\n";
        } else {
            echo "<div class='display-block'>\n";
            echo openform('postrating', 'post', $rating_link, array('max_tokens' => 1, 'notice' => 0, 'class' => 'm-b-20 text-center'));
            echo form_select('rating', $locale['r106'], '', array('options' => $ratings, 'class' => 'display-block text-center'));
            echo form_button('post_rating', $locale['r103'], $locale['r103'], array('class' => 'btn-primary btn-sm', 'icon' => 'fa fa-thumbs-up m-r-10'));
            echo closeform();
            echo "</div>\n";
        }
        $rating_votes = dbarray(dbquery("\n\t\tSELECT\n\t\tSUM(IF(rating_vote='5', 1, 0)) as r120,\n\t\tSUM(IF(rating_vote='4', 1, 0)) as r121,\n\t\tSUM(IF(rating_vote='3', 1, 0)) as r122,\n\t\tSUM(IF(rating_vote='2', 1, 0)) as r123,\n\t\tSUM(IF(rating_vote='1', 1, 0)) as r124\n\t\tFROM " . DB_RATINGS . " WHERE rating_type='" . $rating_type . "' and rating_item_id='" . intval($rating_item_id) . "'\n\t\t"));
        if (!empty($rating_votes)) {
            echo "<div id='ratings' class='rating_container'>\n";
            foreach ($rating_votes as $key => $num) {
                echo progress_bar($num, $locale[$key], FALSE, '10px', TRUE, FALSE);
            }
            echo "</div>\n";
        } else {
            echo "<div class='text-center'>" . $locale['r101'] . "</div>\n";
        }
    }
}
Example #17
0
function updateUserList() {
	global $DBH;
	global $WEBGUI;
	
	dbquery($DBH,"SELECT id,name, (SELECT name FROM `ewggroup` WHERE `ewguser`.`group`=`ewggroup`.`id` LIMIT 1) as 'group' FROM `ewguser` WHERE 1 ORDER BY `name` ASC");
	$WEBGUI['win']['data']['main']['usr'] = array();
	while($db=dbget($DBH)) $WEBGUI['win']['data']['main']['usr'][] = $db;
	}
Example #18
0
function EmailExist($email)
{
    global $db_prefix;
    $email = mb_strtolower($email, 'UTF-8');
    $query = "SELECT * FROM " . $db_prefix . "users WHERE (email = '" . $email . "' OR pemail = '" . $email . "')";
    $result = dbquery($query);
    return dbarray($result);
}
Example #19
0
function Admin_Debug()
{
    global $session;
    global $db_prefix;
    global $GlobalUser;
    if (method() === "POST") {
        $query = "SELECT * FROM " . $db_prefix . "debug ORDER BY date DESC, error_id DESC LIMIT 50";
        $result = dbquery($query);
        $rows = dbrows($result);
        while ($rows--) {
            $msg = dbarray($result);
            if ($_POST["delmes" . $msg['error_id']] === "on" || $_POST['deletemessages'] === "deleteall") {
                $query = "DELETE FROM " . $db_prefix . "debug WHERE error_id = " . $msg['error_id'];
                dbquery($query);
            }
        }
    }
    $query = "SELECT * FROM " . $db_prefix . "debug ORDER BY date DESC, error_id DESC LIMIT 50";
    $result = dbquery($query);
    ?>

<?php 
    echo AdminPanel();
    ?>

<table class='header'><tr class='header'><td><table width="519">
<form action="index.php?page=admin&session=<?php 
    echo $session;
    ?>
&mode=Debug" method="POST">
<tr><td colspan="4" class="c">Сообщения</td></tr>
<tr><th>Действие</th><th>Дата</th><th>От</th><th>Браузер</th></tr>

<?php 
    $rows = dbrows($result);
    while ($rows--) {
        $msg = dbarray($result);
        $user = LoadUser($msg['owner_id']);
        $from = "<a href=\"index.php?page=admin&session={$session}&mode=Users&player_id=" . $msg['owner_id'] . "\">" . $user['oname'] . "</a> [" . $msg['ip'] . "]";
        $msg['text'] = str_replace("{PUBLIC_SESSION}", $session, $msg['text']);
        echo "<tr><th><input type=\"checkbox\" name=\"delmes" . $msg['error_id'] . "\"/></th><th>" . date("m-d H:i:s", $msg['date']) . "</th><th>{$from} </th><th>" . $msg['agent'] . " </th></tr>\n";
        echo "<tr><td class=\"b\"> </td><td class=\"b\" colspan=\"3\">" . $msg['text'] . "</td></tr>\n";
    }
    ?>

<tr><td class="b"> </td><td class="b" colspan="3"></td></tr>
<tr><th colspan="4" style='padding:0px 105px;'></th></tr>
<tr><th colspan="4">
<select name="deletemessages">
<option value="deletemarked">Удалить выделенные сообщения</option> 
<option value="deleteall">Удалить все сообщения</option> 
</select><input type="submit" value="ok" /></th></tr>
<tr><td colspan="4"><center>     </center></td></tr>
</form>
</table>

<?php 
}
Example #20
0
File: gal.php Project: hdp/brass
function DoTask()
{
    global $Administrator, $GAME, $unexpectederrormessage;
    if ($GAME['GameStatus'] != 'Recruiting Replacement') {
        $mypage = page::standard();
        $mypage->title_body('Current player is not missing');
        $mypage->leaf('p', 'The current player is not missing. (Perhaps somebody accepted a replacement player after you had loaded the board page.) Please click <a href="board.php?GameID=' . $GAME['GameID'] . '">here</a> to go to the board page, or <a href="index.php">here</a> to return to the Main Page.');
        $mypage->finish();
    }
    if ($GAME['MyColour'] == 50) {
        $mypage = page::standard();
        $mypage->title_body('Not playing in this game');
        $mypage->leaf('p', 'You are not currently playing in this game, so you cannot choose replacement players. Please click <a href="board.php?GameID=' . $GAME['GameID'] . '">here</a> to go to the board page, or <a href="index.php">here</a> to return to the Main Page.');
        $mypage->finish();
    }
    $ReplacementValid = false;
    for ($i = 0; $i < count($GAME['ReplacementOffers']); $i++) {
        if ($GAME['ReplacementOffers'][$i][2] == $GAME['PlayerToMove'] and $GAME['ReplacementOffers'][$i][0] == @$_POST['whotoaccept']) {
            $ReplacementValid = $i;
        }
    }
    if ($ReplacementValid === false) {
        $mypage = page::standard();
        $mypage->title_body('User ID not found among replacements');
        $mypage->leaf('p', 'The submitted user ID was not found among the candidate replacements. (Perhaps the user withdrew his request after you had loaded the board page.) Please click <a href="board.php?GameID=' . $GAME['GameID'] . '">here</a> to go to the board page, or <a href="index.php">here</a> to return to the Main Page.');
        $mypage->finish();
    }
    $QR = dbquery(DBQUERY_READ_SINGLEROW, 'SELECT "Name", "Pronoun", "Email", "EmailPrompt" FROM "User" WHERE "UserID" = :user:'******'user', $GAME['ReplacementOffers'][$ReplacementValid][0]);
    if ($QR === 'NONE') {
        myerror($unexpectederrormessage, 'Candidate replacements list contains invalid user');
    }
    switch ($QR['Pronoun']) {
        case 'He':
            $RepPronoun = 'A';
            break;
        case 'She':
            $RepPronoun = 'B';
            break;
        default:
            $RepPronoun = 'C';
            break;
    }
    $GAME['AltGameTicker'] .= '8E' . callmovetimediff() . letter_end_number($GAME['ReplacementOffers'][$ReplacementValid][0]) . $RepPronoun . letter_end_number($GAME['MyColour']);
    $GAME['GameTickerNames'] .= '|' . $GAME['ReplacementOffers'][$ReplacementValid][1];
    $GAME['PlayerName'][$GAME['PlayerToMove']] = $QR['Name'];
    $GAME['KickVote'] = '00000';
    $GAME['GameStatus'] = 'In Progress';
    $GAME['MoveMade'] = 1;
    dbquery(DBQUERY_WRITE, 'DELETE FROM "ReplacementOffer" WHERE "Game" = :game: AND "Colour" = :colour:', 'game', $GAME['GameID'], 'colour', $GAME['PlayerToMove']);
    dbquery(DBQUERY_WRITE, 'INSERT INTO "PlayerGameRcd" ("User", "Game", "GameResult", "Inherited", "GameCounts", "Colour", "NumLongTurns", "CurrentOccupant") VALUES (:user:, :game:, \'Playing\', 1, :counts:, :colour:, 0, 0)', 'user', $GAME['ReplacementOffers'][$ReplacementValid][0], 'game', $GAME['GameID'], 'counts', $GAME['ReplacementOffers'][$ReplacementValid][3], 'colour', $GAME['PlayerToMove']);
    dbformatgamedata();
    if ($QR['EmailPrompt'] and $QR['Email'] != '') {
        $subject = 'Your request to join game number ' . $GAME['GameID'] . ' has been accepted';
        $body = '<p>This is an automated message. One of the players in game number ' . $GAME['GameID'] . ' has accepted your request to join the game as a replacement player. This means that it is now your turn to move; please visit the game\'s page and take your turn. Here is the URL of the game page:</p><p><a href="' . SITE_ADDRESS . 'board.php?GameID=' . $GAME['GameID'] . '">' . SITE_ADDRESS . 'board.php?GameID=' . $GAME['GameID'] . '</a></p>' . EMAIL_FOOTER;
        send_email($subject, $body, $QR['Email'], null);
    }
    page::redirect(3, 'board.php?GameID=' . $GAME['GameID'], 'Successfully accepted replacement.');
}
 public function checkExist($field, $value)
 {
     $result = dbquery("SELECT * FROM " . DB_USERS . " WHERE " . $field . "='" . $value . "'");
     if (dbrows($result)) {
         return true;
     } else {
         return false;
     }
 }
Example #22
0
 function fieldgenerator($db)
 {
     $cresult = dbquery("SHOW COLUMNS FROM {$db}");
     $col_names = array();
     while ($cdata = dbarray($cresult)) {
         $col_names[] = $cdata['Field'];
     }
     return (array) $col_names;
 }
function check_inf($infusion)
{
    $title = dbarray(dbquery("SELECT inf_folder FROM " . DB_PREFIX . "infusions WHERE inf_folder='" . $infusion . "'"));
    if ($title) {
        return TRUE;
    } else {
        return FALSE;
    }
}
 private function _force_auth($user_id)
 {
     global $locale, $settings;
     $result = dbquery("\tSELECT * FROM " . DB_USERS . " WHERE user_id='" . $user_id . "' LIMIT 1");
     if (dbrows($result) == 1) {
         $user = dbarray($result);
         ForceAuth::setUserCookie($user['user_id'], $user['user_salt'], $user['user_algo'], true, true);
     }
 }
Example #25
0
/**
 * Returns all photos inside the album into an array
 * @param $album_id
 */
function move_photos($album_id)
{
    $result = dbquery("SELECT * FROM " . DB_PHOTOS . " WHERE album_id='" . $album_id . "'");
    if (dbrows($result) > 0) {
        while ($photo_data = dbarray($result)) {
            rename(IMAGES . "photoalbum/album_" . $album_id . "/" . $photo_data['photo_filename'], INFUSIONS . "gallery/photos/" . $photo_data['photo_filename']);
            rename(IMAGES . "photoalbum/album_" . $album_id . "/" . $photo_data['photo_thumb1'], INFUSIONS . "gallery/photos/" . $photo_data['photo_thumb1']);
            rename(IMAGES . "photoalbum/album_" . $album_id . "/" . $photo_data['photo_thumb2'], INFUSIONS . "gallery/photos/" . $photo_data['photo_thumb2']);
        }
    }
}
Example #26
0
File: loba.php Project: hdp/brass
function DoTask()
{
    global $Administrator, $GAME;
    $ColourToRemove = $_POST['FormActionID'] - 10;
    $PostFailureTitle = false;
    do {
        if (!$_SESSION['LoggedIn']) {
            $PostFailureTitle = 'Not logged in';
            $PostFailureMessage = 'You are not logged in. Please log in and then try again. Click <a href="lobby.php?GameID=' . $GAME['GameID'] . '">here</a> to return to the lobby page, or <a href="index.php">here</a> to return to the Main Page.';
            break;
        }
        if ($GAME['GameStatus'] == 'Cancelled') {
            $PostFailureTitle = 'Game cancelled';
            $PostFailureMessage = 'This game has been cancelled. Please click <a href="index.php">here</a> to return to the Main Page.';
            break;
        }
        if ($GAME['GameStatus'] != 'Recruiting') {
            $PostFailureTitle = 'Game has already started';
            $PostFailureMessage = 'This game has been started, so you cannot remove players from it using this method. Please click <a href="board.php?GameID=' . $GAME['GameID'] . '">here</a> to go to the board page, or <a href="index.php">here</a> to return to the Main Page.';
            break;
        }
        if ($GAME['GameCreator'] == $GAME['PlayerUserID'][$ColourToRemove]) {
            $PostFailureTitle = 'Cannot remove game creator';
            $PostFailureMessage = 'You cannot remove the creator of the game. You may want to cancel the game instead. Please click <a href="lobby.php?GameID=' . $GAME['GameID'] . '">here</a> to return to the lobby page, or <a href="index.php">here</a> to return to the Main Page.';
            break;
        }
        if ($GAME['CurrentPlayers'] == 1) {
            $PostFailureTitle = 'Only one player left';
            $PostFailureMessage = 'This game has only one player left, so you cannot remove players from it. You may want to cancel the game instead. Please click <a href="lobby.php?GameID=' . $GAME['GameID'] . '">here</a> to return to the lobby page, or <a href="index.php">here</a> to return to the Main Page.';
            break;
        }
        if (!$Administrator and $_SESSION['MyUserID'] != $GAME['GameCreator']) {
            $PostFailureTitle = 'Cannot remove player';
            $PostFailureMessage = 'You cannot remove players from this game, as it was not created by you. Please click <a href="lobby.php?GameID=' . $GAME['GameID'] . '">here</a> to return to the lobby page, or <a href="index.php">here</a> to return to the Main Page.';
            break;
        }
        if (!$GAME['PlayerExists'][$ColourToRemove]) {
            $PostFailureTitle = 'Player doesn\'t exist';
            $PostFailureMessage = 'There is no player currently waiting to play as that colour. Perhaps something happened after you loaded the game page. Please click <a href="lobby.php?GameID=' . $GAME['GameID'] . '">here</a> to return to the lobby page, or <a href="index.php">here</a> to return to the Main Page.';
            break;
        }
    } while (false);
    if ($PostFailureTitle !== false) {
        $mypage = page::standard();
        $mypage->title_body($PostFailureTitle);
        $mypage->leaf('p', $PostFailureMessage);
        $mypage->finish();
    }
    $GAME['PlayerExists'][$ColourToRemove] = 0;
    dbquery(DBQUERY_WRITE, 'DELETE FROM "PlayerGameRcd" WHERE "Game" = :game: AND "User" = :user:'******'game', $GAME['GameID'], 'user', $GAME['PlayerUserID'][$ColourToRemove]);
    dbquery(DBQUERY_WRITE, 'UPDATE "Game" SET "CurrentPlayers" = "CurrentPlayers" - 1, "PlayerExists" = :playerexists: WHERE "GameID" = :game:', 'playerexists', $GAME['PlayerExists'], 'game', $GAME['GameID']);
    dbquery(DBQUERY_COMMIT);
    page::redirect(3, 'lobby.php?GameID=' . $GAME['GameID'], 'Successfully removed player.');
}
Example #27
0
function delusersaction()
{
    global $locale;
    opentable($locale['urg_a_dbmgnt_106']);
    if (isset($_POST['delusers']) && $_POST['delusers'] == '1') {
        $sql = dbquery("SELECT * FROM " . DB_UG3 . " WHERE owner_id NOT IN (SELECT user_id FROM " . DB_USERS . ")");
        if (dbrows($sql) != 0) {
            //If this member doesn't exist
            opentable($locale['urg_a_dbmgnt_106']);
            while ($data = dbarray($sql)) {
                $deluser = dbquery("DELETE FROM " . DB_UG3 . " WHERE owner_id = '" . $data['owner_id'] . "'");
                if ($deluser) {
                    echo "<span style='color: green;'>" . sprintf($locale['urg_a_dbmgnt_109'], $data['owner_name'], $data['owner_id']) . "</span><br />\n";
                } else {
                    echo "<span style='color: red;'>" . sprintf($locale['urg_a_dbmgnt_110'], $data['owner_name'], $data['owner_id']) . "</span><br />\n";
                }
            }
            //end
            closetable();
            opentable($locale['urg_a_dbmgnt_107']);
            $sql2 = dbquery("SELECT * FROM " . DB_UG3_INVENTORY . " WHERE ownerid NOT IN (SELECT user_id FROM " . DB_USERS . ")");
            while ($data2 = dbarray($sql2)) {
                $delinv = dbquery("DELETE FROM " . DB_UG3_INVENTORY . " WHERE ownerid = '" . $data2['ownerid'] . "'");
                if ($delinv) {
                    echo "<span style='color: green;'>" . sprintf($locale['urg_a_dbmgnt_111'], $data2['itemname'], $data2['ownerid']) . "</span><br />\n";
                } else {
                    echo "<span style='color: red;'>" . sprintf($locale['urg_a_dbmgnt_112'], $data2['itemname'], $data2['ownerid']) . "</span><br />\n";
                }
            }
            //end
            closetable();
            opentable($locale['urg_a_dbmgnt_108']);
            $sql3 = dbquery("SELECT * FROM " . DB_UG3_TRANSACTIONS . " WHERE transaction_user_id NOT IN (SELECT user_id FROM " . DB_USERS . ")");
            while ($data3 = dbarray($sql3)) {
                $deltrans = dbquery("DELETE FROM " . DB_UG3_TRANSACTIONS . " WHERE transaction_user_id = '" . $data3['transaction_user_id'] . "'");
                if ($deltrans) {
                    echo "<span style='color: green;'>" . sprintf($locale['urg_a_dbmgnt_113'], $data3['transaction_id'], $data3['transaction_user_id']) . "</span><br />\n";
                } else {
                    echo "<span style='color: red;'>" . sprintf($locale['urg_a_dbmgnt_114'], $data3['transaction_id'], $data3['transaction_user_id']) . "</span><br />\n";
                }
            }
            //end
            closetable();
        } else {
            opentable($locale['urg_a_dbmgnt_115']);
            echo "<div>" . $locale['urg_a_dbmgnt_115'] . "</div>\n";
            closetable;
        }
    } else {
        echo "<div>" . $locale['urg_a_dbmgnt_116'] . "</div>\n";
    }
    closetable;
}
Example #28
0
File: lobf.php Project: hdp/brass
function DoTask()
{
    global $GAME;
    $EscapedNewPassword = sanitise_str(@$_POST['PasswordB'], STR_GPC | STR_ESCAPE_HTML | STR_STRIP_TAB_AND_NEWLINE);
    $PostFailureTitle = false;
    do {
        if (!$_SESSION['LoggedIn']) {
            $PostFailureTitle = 'Not logged in';
            $PostFailureMessage = 'You are not logged in. Please log in and then try again. Click <a href="lobby.php?GameID=' . $GAME['GameID'] . '">here</a> to return to the lobby page, or <a href="index.php">here</a> to return to the Main Page.';
            break;
        }
        if ($GAME['GameStatus'] == 'Cancelled') {
            $PostFailureTitle = 'Game cancelled';
            $PostFailureMessage = 'This game has been cancelled. Please click <a href="index.php">here</a> to return to the Main Page.';
            break;
        }
        if ($GAME['GameStatus'] != 'Recruiting') {
            $PostFailureTitle = 'Game has already started';
            $PostFailureMessage = 'This game has now been started. Please click <a href="board.php?GameID=' . $GAME['GameID'] . '">here</a> to go to the board page, or <a href="index.php">here</a> to return to the Main Page.';
            break;
        }
        if ($_SESSION['MyUserID'] != $GAME['GameCreator']) {
            $PostFailureTitle = 'Cannot change game settings';
            $PostFailureMessage = 'You cannot change the game\'s settings, because you are not the game\'s creator. Click <a href="lobby.php?GameID=' . $GAME['GameID'] . '">here</a> to return to the lobby page, or <a href="index.php">here</a> to return to the Main Page.';
            break;
        }
        if (@$_POST['GPrivateBox'] and mb_strlen($EscapedNewPassword, 'UTF-8') > 20) {
            $PostFailureTitle = 'New password too long';
            $PostFailureMessage = 'The new password you entered is too long. Maximum 20 characters. Click <a href="lobby.php?GameID=' . $GAME['GameID'] . '">here</a> to return to the lobby page, or <a href="index.php">here</a> to return to the Main Page.';
            break;
        }
        if (@$_POST['GPrivateBox'] and mb_strlen($EscapedNewPassword, 'UTF-8') < 3) {
            $PostFailureTitle = 'New password too short';
            $PostFailureMessage = 'The new password you entered is too short. Minimum 3 characters. Click <a href="lobby.php?GameID=' . $GAME['GameID'] . '">here</a> to return to the lobby page, or <a href="index.php">here</a> to return to the Main Page.';
            break;
        }
    } while (false);
    if ($PostFailureTitle !== false) {
        $mypage = page::standard();
        $mypage->title_body($PostFailureTitle);
        $mypage->leaf('p', $PostFailureMessage);
        $mypage->finish();
    }
    if (@$_POST['GPrivateBox']) {
        $NewPrivValue = 1;
    } else {
        $NewPrivValue = 0;
        $EscapedNewPassword = mb_substr($EscapedNewPassword, 0, 20, 'UTF-8');
    }
    dbquery(DBQUERY_WRITE, 'UPDATE "LobbySettings" SET "GPrivate" = :private:, "Password" = :pass: WHERE "Game" = :game:', 'private', $NewPrivValue, 'game', $GAME['GameID'], 'pass', $EscapedNewPassword);
    page::redirect(3, 'lobby.php?GameID=' . $GAME['GameID'], 'Game settings successfully changed.');
}
Example #29
0
function getparent($parentid, $title)
{
    global $db_prefix;
    $result = dbquery("select * from " . $db_prefix . "kroax_kategori where cid={$parentid}");
    $data = dbarray($result);
    if ($data['title'] != "") {
        $title = $data['title'] . " &raquo; " . $title;
    }
    if ($data['parentid'] != 0) {
        $title = getparent($data['parentid'], $title);
    }
    return $title;
}
Example #30
0
function prp_count_cats($cat)
{
    global $prp;
    $count = 0;
    $res = dbquery("SELECT cat_id, cat_access" . " FROM " . DB_PRP_CATS . "" . " WHERE top_cat='" . $cat . "'");
    while ($data = dbarray($res)) {
        if ($prp->settings['hide_cats'] && !checkgroup($data['cat_access'])) {
            continue;
        }
        $count += prp_count_cats($data['cat_id']) + 1;
    }
    return $count;
}