function showsublinks($sep = "·", $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;
    }
}
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;
    }
}
 public function addNode($nodeId, $nodeName, $addInside, $nodeFields, $nodeValues)
 {
     // Lock table
     $result = dbquery("LOCK TABLE " . $this->catTable . " WRITE");
     $result = dbquery("SELECT " . $this->_getSelectFields() . " \n\t\t\tFROM " . $this->catTable . "\n\t\t\tWHERE " . $this->itemCatId . "='" . $nodeId . "'\n\t\t\tLIMIT 1");
     if (dbrows($result)) {
         // category_id	name	lft	rgt
         $data = dbarray($result);
         // Add inside
         if ($addInside == 1) {
             if ($data[$this->catLeft] + 1 == $data[$this->catRight]) {
                 $value = $data[$this->catLeft];
             } else {
                 $value = $data[$this->catRight] - 1;
             }
             // Add bellow
         } else {
             $value = $data[$this->catRight];
         }
         // Update
         $this->_setNewNodeUpdate($value);
         // Insert new node
         $this->_setNewNodeInset($nodeName, $value, $nodeFields, $nodeValues);
     }
     // Unlock table
     $result = dbquery("UNLOCK TABLES");
 }
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;
}
function GetExpeditionsCount($player_id)
{
    global $db_prefix;
    $query = "SELECT * FROM " . $db_prefix . "fleet WHERE (mission = 15 OR mission = 115 OR mission = 215) AND owner_id = {$player_id};";
    $result = dbquery($query);
    return dbrows($result);
}
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 
}
 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);
     }
 }
Exemple #8
0
 /**
  * Site Link Loader
  * @param $link_id
  * @return array
  */
 public static function load_sitelinks($link_id)
 {
     $array = array();
     if (isnum($link_id)) {
         $result = dbquery("SELECT * FROM " . DB_SITE_LINKS . " " . (multilang_table("SL") ? "WHERE link_language='" . LANGUAGE . "' AND" : "WHERE") . " link_id='" . $_GET['link_id'] . "'");
         if (dbrows($result)) {
             return (array) dbarray($result);
         }
     }
     return (array) $array;
 }
/**
 * 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']);
        }
    }
}
function forum_subcats($forum_id)
{
    global $settings, $locale, $userdata, $lastvisited;
    $a_result = dbquery("SELECT * FROM " . DB_FORUMS . " f LEFT JOIN " . DB_USERS . " u on f.forum_lastuser=u.user_id WHERE " . groupaccess('f.forum_access') . " AND forum_parent='" . $_GET['forum_id'] . "' ORDER BY forum_order");
    if (dbrows($a_result) != 0) {
        echo "<table cellpadding='0' cellspacing='1' width='100%' class='tbl-border forum_idx_table'>\n<tr>\n";
        echo "<td colspan='2' class='tbl2'>" . $locale['401'] . "</td>\n";
        echo "<td align='center' width='1%' class='tbl2' style='white-space:nowrap'>" . $locale['402'] . "</td>\n";
        echo "<td align='center' width='1%' class='tbl2' style='white-space:nowrap'>" . $locale['403'] . "</td>\n";
        echo "<td width='1%' class='tbl2' style='white-space:nowrap'>" . $locale['404'] . "</td>\n";
        echo "</tr>\n";
        while ($a_data = dbarray($a_result)) {
            echo "<tr>\n";
            $moderators = "";
            if ($a_data['forum_moderators']) {
                $mod_groups = explode(".", $a_data['forum_moderators']);
                foreach ($mod_groups as $mod_group) {
                    if ($moderators) {
                        $moderators .= ", ";
                    }
                    $moderators .= $mod_group < 101 ? "<a href='" . BASEDIR . "profile.php?group_id=" . $mod_group . "'>" . getgroupname($mod_group) . "</a>" : getgroupname($mod_group);
                }
            }
            if ($a_data['forum_lastpost'] > $lastvisited) {
                $forum_match = "\\|" . $a_data['forum_lastpost'] . "\\|" . $a_data['forum_id'];
                if (iMEMBER && ($a_data['forum_lastuser'] == $userdata['user_id'] || preg_match("({$forum_match}\\.|{$forum_match}\$)", $userdata['user_threads']))) {
                    $fim = "<img src='" . get_image("folder") . "' alt='" . $locale['561'] . "' />";
                } else {
                    $fim = "<img src='" . get_image("foldernew") . "' alt='" . $locale['560'] . "' />";
                }
            } else {
                $fim = "<img src='" . get_image("folder") . "' alt='" . $locale['561'] . "' />";
            }
            echo "<td align='center' width='1%' class='tbl2' style='white-space:nowrap'>{$fim}</td>\n";
            echo "<td class='tbl1 forum_name'><!--forum_name--><a href='viewforum.php?forum_id=" . $a_data['forum_id'] . "'>" . $a_data['forum_name'] . "</a><br />\n";
            if ($a_data['forum_description'] || $moderators) {
                echo "<span class='small'>" . $a_data['forum_description'] . ($a_data['forum_description'] && $moderators ? "<br />\n" : "");
                echo ($moderators ? "<strong>" . $locale['411'] . "</strong>" . $moderators . "</span>\n" : "</span>\n") . "\n";
            }
            echo "</td>\n";
            echo "<td align='center' width='1%' class='tbl2' style='white-space:nowrap'>" . $a_data['forum_threadcount'] . "</td>\n";
            echo "<td align='center' width='1%' class='tbl1' style='white-space:nowrap'>" . $a_data['forum_postcount'] . "</td>\n";
            echo "<td width='1%' class='tbl2' style='white-space:nowrap'>";
            if ($a_data['forum_lastpost'] == 0) {
                echo $locale['405'] . "</td>\n</tr>\n";
            } else {
                echo showdate("forumdate", $a_data['forum_lastpost']) . "<br />\n";
                echo "<span class='small'>" . $locale['406'] . profile_link($a_data['forum_lastuser'], $a_data['user_name'], $a_data['user_status']) . "</span></td>\n";
                echo "</tr>\n";
            }
        }
        echo "</table>";
    }
}
function read_session($session_id)
{
    global $sess_read;
    $result = dbquery("SELECT session_data FROM " . DB_SESSIONS . " WHERE session_id='" . valid_session($session_id) . "'");
    if (dbrows($result)) {
        $sess_read = dbarray($result);
        return $sess_read['session_data'];
    } else {
        return $sess_read = "";
    }
}
Exemple #12
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;
}
function inGroup($id)
{
    global $userdata;
    if (iMEMBER) {
        $check = dbquery("SELECT * FROM " . DB_GS_GROUP_USERS . " WHERE guser_user='******'user_id'] . "' AND guser_group='" . $id . "'");
        if (dbrows($check)) {
            return true;
        } else {
            return false;
        }
    } else {
        return false;
    }
}
function Admin_Browse()
{
    global $session;
    global $db_prefix;
    global $GlobalUser;
    $query = "SELECT * FROM " . $db_prefix . "browse ORDER BY date DESC LIMIT 50";
    $result = dbquery($query);
    AdminPanel();
    $rows = dbrows($result);
    echo "Последняя история переходов (50 записей):<br>";
    echo "<table>\n";
    while ($rows--) {
        $log = dbarray($result);
        $user = LoadUser($log['owner_id']);
        ?>
        <tr><td><table>
        <tr> <th> <?php 
        echo $user['oname'];
        ?>
 </th> <th> <?php 
        echo $log['url'];
        ?>
 </th> </tr>
        <tr> <th rowspan=2>
        <?php 
        echo $log['method'];
        ?>
<br>
        <?php 
        echo date("d M Y", $log['date']);
        ?>
<br>
        <?php 
        echo date("H:i:s", $log['date']);
        ?>
        </th> <th> <?php 
        echo print_r(unserialize($log['getdata']));
        ?>
 </th> </tr>
        <tr> <th> <?php 
        echo print_r(unserialize($log['postdata']));
        ?>
 </th> </tr>
        </table></td></tr>

<?php 
    }
    echo "</table>\n";
}
Exemple #15
0
 public static function get_attachments(array $thread_data)
 {
     $attachments = array();
     if (self::get_attachment_permissions("can_download_attach") == TRUE) {
         $a_result = dbquery("SELECT * FROM " . DB_FORUM_ATTACHMENTS . " WHERE thread_id='" . intval($thread_data['thread_id']) . "' ORDER BY post_id ASC");
         if (dbrows($a_result) > 0) {
             while ($a_data = dbarray($a_result)) {
                 if (file_exists(INFUSIONS . "forum/attachments/" . $a_data['attach_name'])) {
                     //$this->thread_info['attachments'][$a_data['post_id']][] = $a_data;
                     $attachments[$a_data['post_id']][] = $a_data;
                 }
             }
         }
     }
     return (array) $attachments;
 }
function send_pm($to, $from, $subject, $message, $smileys = "y")
{
    global $settings;
    include LOCALE . LOCALESET . "messages.php";
    require_once INCLUDES . "sendmail_include.php";
    require_once INCLUDES . "flood_include.php";
    $msg_settings = dbarray(dbquery("SELECT pm_inbox, pm_email_notify FROM " . DB_MESSAGES_OPTIONS . " WHERE user_id='0'"));
    $smileys = preg_match("#(\\[code\\](.*?)\\[/code\\]|\\[geshi=(.*?)\\](.*?)\\[/geshi\\]|\\[php\\](.*?)\\[/php\\])#si", $message) ? "n" : $smileys;
    $error = 0;
    if (!flood_control("message_datestamp", DB_MESSAGES, "message_from='" . $from . "'")) {
        $result = dbquery("SELECT u.user_id, u.user_name, u.user_email, u.user_level, mo.pm_email_notify, COUNT(message_id) as message_count FROM " . DB_USERS . " u\n\t\t\tLEFT JOIN " . DB_MESSAGES_OPTIONS . " mo USING(user_id)\n\t\t\tLEFT JOIN " . DB_MESSAGES . " ON message_to=u.user_id AND message_folder='0'\n\t\t\tWHERE u.user_id='{$to}' GROUP BY u.user_id");
        if (dbrows($result)) {
            $data = dbarray($result);
            $result = dbquery("SELECT user_id, user_name FROM " . DB_USERS . " WHERE user_id='" . $from . "'");
            if (dbrows($result)) {
                $userdata = dbarray($result);
                if ($to != $from) {
                    if ($data['user_id'] == 1 || $data['user_level'] > 101 || $msg_settings['pm_inbox'] == "0" || $data['message_count'] + 1 <= $msg_settings['pm_inbox']) {
                        $result = dbquery("INSERT INTO " . DB_MESSAGES . " (message_to, message_from, message_subject, message_message, message_smileys, message_read, message_datestamp, message_folder) VALUES('" . $data['user_id'] . "','" . $userdata['user_id'] . "','" . $subject . "','" . $message . "','" . $smileys . "','0','" . time() . "','0')");
                        $message_content = str_replace("[SUBJECT]", $subject, $locale['626']);
                        $message_content = str_replace("[USER]", $userdata['user_name'], $message_content);
                        $send_email = isset($data['pm_email_notify']) ? $data['pm_email_notify'] : $msg_settings['pm_email_notify'];
                        if ($send_email == "1") {
                            sendemail($data['user_name'], $data['user_email'], $settings['siteusername'], $settings['siteemail'], $locale['625'], $data['user_name'] . $message_content);
                        }
                    } else {
                        // Inbox is full
                        $error = 1;
                    }
                } else {
                    // Reciever and sender are the same user
                    $error = 2;
                }
            } else {
                // Sender does not exist in DB
                $error = 3;
            }
        } else {
            // Reciever does not exist in DB
            $error = 4;
        }
    } else {
        // Floodcontrol exceeded
        $error = 5;
    }
    return $error;
}
function GalaxyToolUpdateAllyStats()
{
    global $db_prefix;
    $list = array();
    $query = "SELECT * FROM " . $db_prefix . "ally ORDER BY ally_id ASC";
    $result = dbquery($query);
    $rows = dbrows($result);
    while ($rows--) {
        $ally = dbarray($result);
        $list[$ally['ally_id']] = array();
        $list[$ally['ally_id']]['name'] = $ally['tag'];
    }
    $text = serialize($list);
    $f = fopen("galaxytool/ally_statistics.txt", "w");
    fwrite($f, $text);
    fclose($f);
}
Exemple #18
0
function catFullPath($cat_id, $cat_tbl, $col_id, $col_parent, $col_title)
{
    $tmp_id = $cat_id;
    $cat_list = array();
    while ($tmp_id > 0) {
        $result = dbquery("SELECT " . $col_id . ", " . $col_parent . ", " . $col_title . " FROM " . $cat_tbl . " WHERE " . $col_id . "='" . $tmp_id . "'");
        $tmp_id = 0;
        if (dbrows($result)) {
            $data = dbarray($result);
            $cat_item = array('id' => $data[$col_id], 'parent' => $data[$col_parent], 'title' => $data[$col_title]);
            $cat_list[] = $cat_item;
            $tmp_id = $data[$col_parent];
        } else {
            return false;
        }
    }
    return array_reverse($cat_list);
}
Exemple #19
0
function forum_rank_cache()
{
    global $settings, $forum_mod_rank_cache, $forum_rank_cache;
    $forum_mod_rank_cache = array();
    $forum_rank_cache = array();
    if ($settings['forum_ranks']) {
        $result = dbquery("SELECT rank_title, rank_image, rank_posts, rank_apply FROM " . DB_FORUM_RANKS . " ORDER BY rank_apply DESC, rank_posts ASC");
        if (dbrows($result)) {
            while ($data = dbarray($result)) {
                if ($data['rank_apply'] > 101) {
                    $forum_mod_rank_cache[] = $data;
                } else {
                    $forum_rank_cache[] = $data;
                }
            }
        }
    }
}
Exemple #20
0
function edoc_header($page_ident)
{
    global $settings;
    $admin_images = dbquery("SELECT \r\n                                admin_image, \r\n                                admin_title \r\n                                FROM " . DB_ADMIN . " \r\n                                WHERE admin_page='" . $page_ident . "' \r\n                                AND admin_link !='reserved' \r\n                                ORDER BY \r\n                                admin_title\r\n                                ");
    $rows = dbrows($admin_images);
    echo "<table align='center' width='100%' class='tbl-border'>\n<tr>\n";
    if ($rows != 0) {
        while ($data = dbarray($admin_images)) {
            if (file_exists(EDOC_IMGS . $data['admin_image'] . "")) {
                echo "<td align='center' valign='bottom' width='100' class='small'><img src='" . EDOC_IMGS . $data['admin_image'] . "' alt='' title='' border='0' /></td>\n";
            } else {
                echo "<td align='center' valign='bottom' width='100' class='small'><img src='" . EDOC_IMGS . "not_known_sm.png' alt='' title='' border='0' /></td>\n";
            }
        }
    }
    echo "</tr>\n</table>\n";
    $page_ident = "";
}
function rs_access($status = 1, $select = 0)
{
    global $locale;
    $go = "";
    if ($status) {
        $go .= "<option value='0'" . ($select == 0 ? " selected='selected'" : "") . ">" . $locale['user0'] . "</option>\n";
        $go .= "<option value='101'" . ($select == 101 ? " selected='selected'" : "") . ">" . $locale['user1'] . "</option>\n";
    }
    $go .= "<option value='102'" . ($select == 102 ? " selected='selected'" : "") . ">" . $locale['user2'] . "</option>\n";
    $go .= "<option value='103'" . ($select == 103 ? " selected='selected'" : "") . ">" . $locale['user3'] . "</option>\n";
    $result = dbquery("SELECT * FROM " . DB_USER_GROUPS . " ORDER BY group_name");
    if (dbrows($result)) {
        while ($data = dbarray($result)) {
            $go .= "<option value='" . $data['group_id'] . "'" . ($select == $data['group_id'] ? " selected='selected'" : "") . ">" . $data['group_name'] . "</option>\n";
        }
    }
    return $go;
}
Exemple #22
0
function returnimages($dirname = ".")
{
    $pattern = "(\\.jpg\$)|(\\.png\$)|(\\.jpeg\$)|(\\.gif\$)";
    $files = array();
    $curimage = 0;
    if ($handle = opendir($dirname)) {
        while (false !== ($file = readdir($handle))) {
            if (eregi($pattern, $file)) {
                $result = dbquery("SELECT * FROM " . $db_prefix . "sf_gift WHERE gift_image=''");
                if (dbrows($result) == 0) {
                    echo 'picsarray[' . $curimage . ']="' . $file . '";';
                    $curimage++;
                }
            }
        }
        closedir($handle);
    }
    return $files;
}
Exemple #23
0
function postRatings($post)
{
    global $locale, $fb4;
    $result = dbquery("select r.*, t.*, count(t.type_name) as total from " . DB_PREFIX . "fb_rate r\n\tleft join " . DB_PREFIX . "fb_rate_type t on r.rate_type=t.type_id\n\twhere r.rate_post='{$post}' group by r.rate_type");
    if (dbrows($result)) {
        echo "<div style='float:left;vertical-align:middle;'>\n";
        while ($data = dbarray($result)) {
            $user_res = dbquery("select * from " . DB_PREFIX . "fb_rate r\n\t\t\tleft join " . DB_USERS . " u on u.user_id=r.rate_by\n\t\t\twhere r.rate_post='{$post}' and r.rate_type='" . $data['rate_type'] . "'");
            $i = 0;
            $users = "<b>" . $locale['fb862'] . "</b><br />";
            while ($user_data = dbarray($user_res)) {
                $users .= ($i !== 0 ? "<br />" : "") . $user_data['user_name'];
                $i++;
            }
            echo "&nbsp;<span class='ratingbox small' onmouseover='this.style.opacity=\"1\"' onmouseout='this.style.opacity=\"" . $fb4['rating_opacity'] . "\"' " . ($fb4['boxover_ratings'] ? "title='header=[" . $data['type_name'] . "] body=[{$users}]'" : "") . " style='vertical-align:middle;'><img src='" . INFUSIONS . "fusionboard4/images/forum_icons/" . $data['type_icon'] . "' style='vertical-align:middle;' /> x " . $data['total'] . "</span>";
        }
        echo "</div>\n";
    }
}
function setError($error_level, $error_message, $error_file, $error_line, $error_context)
{
    global $userdata, $_errorHandler;
    $showError = true;
    $result = dbquery("SELECT error_id, error_status FROM " . DB_ERRORS . "\n\t\tWHERE error_level='" . intval($error_level) . "' AND error_file='" . stripinput($error_file) . "'\n\t\tAND error_line='" . intval($error_line) . "' AND error_status!='1'\n\t\tORDER BY error_timestamp DESC LIMIT 1");
    if (dbrows($result) == 0) {
        $result = dbquery("INSERT INTO " . DB_ERRORS . " (\n\t\t\t\terror_level, error_message, error_file, error_line, error_page,\n\t\t\t\terror_user_level, error_user_ip, error_user_ip_type, error_status, error_timestamp\n\t\t\t) VALUES (\n\t\t\t\t'" . intval($error_level) . "', '" . stripinput($error_message) . "',\n\t\t\t\t'" . stripinput($error_file) . "', '" . intval($error_line) . "',\n\t\t\t\t'" . TRUE_PHP_SELF . "', '" . $userdata['user_level'] . "', '" . USER_IP . "', '" . USER_IP_TYPE . "',\n\t\t\t\t'0', '" . time() . "'\n\t\t\t)");
        $errorId = mysql_insert_id();
    } else {
        $data = dbarray($result);
        $errorId = $data['error_id'];
        if ($data['error_status'] == 2) {
            $showError = false;
        }
    }
    if ($showError) {
        $_errorHandler[] = array("id" => $errorId, "level" => $error_level, "file" => $error_file, "line" => $error_line);
    }
}
    global $settings;
    if ($settings['enable_tags']) {
        $result = dbquery("SELECT tag_name FROM " . DB_TAGS . " WHERE tag_item_id='" . (int) $item_id . "' AND tag_type=" . _db($type) . "");
        if (dbrows($result)) {
            $result = dbquery("UPDATE " . DB_TAGS . " SET tag_name=" . _db($name) . " WHERE tag_item_id='" . (int) $item_id . "' AND tag_type=" . _db($type) . "");
        } else {
            $result = dbquery("INSERT INTO " . DB_TAGS . " (tag_item_id, tag_type, tag_name) VALUES ('" . (int) $item_id . "', " . _db($type) . ", " . _db($name) . ")");
        }
    }
}
function delete_tags($item_id, $type)
{
    $result = dbquery("DELETE FROM " . DB_TAGS . " WHERE tag_item_id='" . (int) $item_id . "' AND tag_type=" . _db($type) . "");
    return $result ? true : false;
}
function show_tags($item_id, $type)
{
    global $settings, $locale;
    if ($settings['enable_tags']) {
        $result = dbquery("SELECT tag_name FROM " . DB_TAGS . " WHERE tag_item_id='" . (int) $item_id . "' AND tag_type=" . _db($type));
        if (dbrows($result)) {
            $data = dbarray($result);
            if ($data['tag_name'] != "") {
                switch ($type) {
                    case "N":
                        $title = $locale['tag_news'];
                        break;
                    case "A":
                        $title = $locale['tag_articles'];
                        break;
                    case "C":
                        $title = $locale['tag_custom'];
                        break;
                    case "F":
                        $title = $locale['tag_thread'];
                        break;
                    default:
                        $title = $locale['tag_custom'];
                }
                opentable($title);
                $tag_a = explode(",", $data['tag_name']);
                $tag_r = "";
Exemple #26
0
function send_pm($to_id, $subject, $body, $smilies)
{
    global $locale, $userdata, $settings;
    if (iMEMBER) {
        $from_id = $userdata['user_id'];
    } else {
        $from_id = 0;
    }
    if (!$to_id || $from_id == $to_id) {
        return true;
    }
    // get user
    $res = dbquery("SELECT user_name, user_email\n\t\tFROM " . DB_USERS . "\n\t\tWHERE user_id='" . $to_id . "'");
    if (!dbrows($res)) {
        return false;
    }
    $data = dbarray($res);
    // send pm
    $ok = dbquery("INSERT INTO " . DB_MESSAGES . "\n\t\tSET\n\t\tmessage_to='" . $to_id . "',\n\t\tmessage_from='" . $from_id . "',\n\t\tmessage_subject='" . stripinput($subject) . "',\n\t\tmessage_message='" . stripinput($body) . "',\n\t\tmessage_smileys='" . ($smilies ? '1' : '0') . "',\n\t\tmessage_read='0',\n\t\tmessage_datestamp='" . time() . "'");
    // FIXME: inform about NEW PM!
    /*FIXME
    	// send mail
    	require_once(INCLUDES."sendmail_include.php");
    	$type = "plain";
    
    	$body = $subject;
    	$body .= "\n\n";
    	$body .= stripinput($locale['PDP902']['body'][$pm_type]);
    	$body .= "\n\n";
    	$body .= $locale['PDP026'].": ".$settings['siteurl']
    		."infusions/pro_download_panel/download.php"
    		."?did=".$this->id;
    	$body .= "\n\n";
    
    	sendemail($data['user_name'], $data['user_email'],
    		$settings['siteusername'],
    		$settings['siteemail'],
    		$subject, strip_tags(nl2br(parseubb($body))), $type);
    */
    return true;
}
Exemple #27
0
function flood_control($field, $table, $where, $debug = FALSE)
{
    global $userdata, $settings, $locale, $defender;
    $flood = FALSE;
    if (!iSUPERADMIN && !iADMIN && (!defined("iMOD") || !iMOD) || $debug) {
        $result = dbquery("SELECT MAX(" . $field . ") AS last_post FROM " . $table . " WHERE " . $where);
        if (dbrows($result)) {
            $time = time();
            $data = dbarray($result);
            if ($time - $data['last_post'] < $settings['flood_interval']) {
                $defender->stop();
                addNotice('warning', sprintf($locale['flood'], countdown($settings['flood_interval'] - ($time - $data['last_post']))));
                $flood = TRUE;
                $result = dbquery("INSERT INTO " . DB_FLOOD_CONTROL . " (flood_ip, flood_ip_type, flood_timestamp) VALUES ('" . USER_IP . "', '" . USER_IP_TYPE . "', '" . time() . "')");
                // This should be in settings, "After how many flood offences take action" then a setting for what action to take
                if (dbcount("(flood_ip)", DB_FLOOD_CONTROL, "flood_ip='" . USER_IP . "'") > 4) {
                    if (!$debug) {
                        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']);
                            $message = str_replace("[USER_IP]", USER_IP, $message);
                            $message = str_replace("[USER_IP]", USER_IP, $message);
                            $message = str_replace("[SITE_EMAIL]", $settings['siteemail'], $message);
                            $message = str_replace("[SITEUSERNAME]", $settings['siteusername'], $message);
                            $subject = str_replace("[SITENAME]", $settings['sitename'], $locale['global_441']);
                            sendemail($userdata['user_name'], $userdata['user_email'], $settings['siteusername'], $settings['siteemail'], $subject, $message);
                        } elseif (!iMEMBER) {
                            $result = dbquery("INSERT INTO " . DB_BLACKLIST . " (blacklist_ip, blacklist_ip_type, blacklist_email, blacklist_reason) VALUES ('" . USER_IP . "', '" . USER_IP_TYPE . "', '', '" . $locale['global_440'] . "')");
                        }
                    } else {
                        addNotice('info', "DEBUG MESSAGE: Triggered flood control action due to repeated offences. This could've resulted in a ban or suspenstion");
                    }
                }
            }
        }
    }
    return $flood;
}
Exemple #28
0
function forum_rank_cache()
{
    global $settings, $forum_mod_rank_cache, $forum_post_rank_cache, $forum_special_rank_cache;
    $forum_post_rank_cache = array();
    $forum_mod_rank_cache = array();
    $forum_special_rank_cache = array();
    if ($settings['forum_ranks']) {
        $result = dbquery("SELECT rank_title, rank_image, rank_type, rank_posts, rank_apply, rank_language FROM " . DB_FORUM_RANKS . " " . (multilang_table("FR") ? "WHERE rank_language='" . LANGUAGE . "'" : "") . " ORDER BY rank_apply DESC, rank_posts ASC");
        if (dbrows($result)) {
            while ($data = dbarray($result)) {
                if ($data['rank_type'] == 0) {
                    $forum_post_rank_cache[] = $data;
                } elseif ($data['rank_type'] == 1) {
                    $forum_mod_rank_cache[] = $data;
                } else {
                    $forum_special_rank_cache[] = $data;
                }
            }
        }
    }
}
function article_admin_editlist($id)
{
    global $data;
    $editlist = "";
    $sel = "";
    $checkparent = dbcount("(article_cat_id)", DB_ARTICLE_CATS, "article_cat_parent='" . (int) $id . "'");
    $result2 = dbquery("SELECT article_cat_id, article_cat_name FROM " . DB_ARTICLE_CATS . " WHERE article_cat_parent='0' ORDER BY article_cat_name");
    if (dbrows($result2) != 0) {
        $editlist .= "<option value='0'" . $sel . "><span class='small'></span></option>\n";
        while ($data2 = dbarray($result2)) {
            if (isset($_GET['action']) && $_GET['action'] == "edit") {
                $sel = $data['article_cat_parent'] == $data2['article_cat_id'] ? " selected='selected'" : "";
            }
            if (isset($_GET['action']) && $_GET['action'] == "edit" && $_GET['cat_id'] != $data2['article_cat_id'] && $checkparent == 0) {
                $editlist .= "<option value='" . $data2['article_cat_id'] . "'{$sel}>" . $data2['article_cat_name'] . "</option>\n";
            } elseif (!isset($_GET['action'])) {
                $editlist .= "<option value='" . $data2['article_cat_id'] . "'{$sel}>" . $data2['article_cat_name'] . "</option>\n";
            }
        }
    }
    return $editlist;
}
function photo_admin_editopts($id)
{
    global $data;
    $editlist = "";
    $sel = "";
    $checkparent = dbcount("(album_id)", DB_PHOTO_ALBUMS, "album_parent='" . (int) $id . "'");
    $result2 = dbquery("SELECT album_id, album_title FROM " . DB_PHOTO_ALBUMS . "  WHERE album_parent='0' ORDER BY album_order");
    if (dbrows($result2) != 0) {
        $editlist .= "<option value='0'" . $sel . "></option>\n";
        while ($data2 = dbarray($result2)) {
            if (isset($_GET['action']) && $_GET['action'] == "edit") {
                $sel = $data['album_parent'] == $data2['album_id'] ? " selected='selected'" : "";
            }
            if (isset($_GET['action']) && $_GET['action'] == "edit" && $_GET['album_id'] != $data2['album_id'] && $checkparent == 0) {
                $editlist .= "<option value='" . $data2['album_id'] . "'{$sel}>" . $data2['album_title'] . "</option>\n";
            } elseif (!isset($_GET['action'])) {
                $editlist .= "<option value='" . $data2['album_id'] . "'{$sel}>" . $data2['album_title'] . "</option>\n";
            }
        }
    }
    return $editlist;
}