function error_add($data)
{
    global $error_counter;
    if (strpos($data, 'rrors were encountered during processing') !== false) {
        log_add('<br><font color="red"><strong>Errors were encountered during processing! Review the following list of error messages and/or the log for more information.</strong></font>');
    } else {
        log_add($data);
        $error_counter++;
    }
    global $error_list;
    global $errors;
    global $debug;
    global $error_happened;
    $error_happened = true;
    if ($errors || $debug) {
        $error_list = $error_list . "<br>\n" . $data;
    }
}
function error_add($data)
{
    global $error_counter;
    $error_counter++;
    if (strpos($data, 'rrors were encountered during processing') !== false) {
        $error_counter_final = $error_counter - 1;
        log_add('<br><font color="red"><strong>' . $error_counter_final . ' errors were encountered during processing! Review the following list of error messages and/or the log for more information.</strong></font><br> Note that if you are running the tests, some errors are normal.');
    } else {
        log_add($data);
    }
    global $error_list;
    global $errors;
    global $debug;
    global $error_happened;
    $error_happened = true;
    if ($errors || $debug) {
        if (strpos($data, 'rrors were encountered during processing') !== false) {
            $error_list = $error_list . "<br>\n" . $data;
        } else {
            $error_list = $error_list . "<br>\n<strong>Error " . $error_counter . ':</strong> ' . $data;
        }
    }
}
Esempio n. 3
0
    }
    // End switch
    $qFindSeats = db_query("SELECT seatX,seatY FROM " . $sql_prefix . "_seatReg\n\t\tWHERE eventID = " . $sessioninfo->eventID);
    while ($rFindSeats = db_fetch($qFindSeats)) {
        // If this seat is 1 (checked), update it's type
        if ($_POST['x' . $rFindSeats->seatX . 'y' . $rFindSeats->seatY] == 1) {
            db_query("UPDATE " . $sql_prefix . "_seatReg SET\n\t\t\t\ttype = '" . db_escape($type) . "',\n\t\t\t\tcolor = '{$color}',\n\t\t\t\textra = '{$extra}'\n\t\t\t\tWHERE seatX = {$rFindSeats->seatX}\n\t\t\t\tAND seatY = {$rFindSeats->seatY}\n\t\t\t\tAND eventID = {$sessioninfo->eventID}\n\t\t\t");
        }
        // end if POST = 1
    }
    // End while rFindSeats
    $newlog['extra'] = $extra;
    $newlog['POST'] = $_POST;
    $newlog['type'] = $type;
    $newlog['color'] = $color;
    log_add("seatadmin", "doUpdateSeat", serialize($newlog));
    header("Location: ?module=seatadmin");
} elseif ($action == "resetmap") {
    // ask if the user really wants to delete all map fields, and add one field.
    $content .= "<form method=\"post\" action=\"?module=seatadmin&amp;action=doresetmap\">";
    $content .= "<input type=\"submit\" value='" . lang("Confirm map reset") . "' />\n";
    $content .= "</form>";
} elseif ($action == "doresetmap") {
    // Delete all map fields on this event
    db_query("DELETE FROM " . $sql_prefix . "_seatReg WHERE eventID = " . $sessioninfo->eventID);
    // Add a single field to the map
    db_query("INSERT INTO " . $sql_prefix . "_seatReg SET eventID = " . $sessioninfo->eventID . ", seatX = 1, seatY = 1");
    log_add("seatadmin", "doresetmap");
    // Go back to seatadmin
    header("Location: ?module=seatadmin");
}
Esempio n. 4
0
 /**
  * Присвоение языкового пакета по-умолчанию
  * @param string $name имя языка
  * @return null
  */
 public function bydefault($name)
 {
     if (config::o()->v('default_lang') == $name) {
         return;
     }
     config::o()->set('default_lang', $name);
     log_add('changed_config', 'admin');
 }
Esempio n. 5
0
 /**
  * Удаление категории
  * @param int $id ID категории
  * @return null
  * @throws EngineException
  */
 public function delete($id)
 {
     $id = (int) $id;
     if (!$this->cats->get($id)) {
         throw new EngineException();
     }
     $ids = array();
     $this->cats->get_children_ids($id, $ids);
     $ids[] = $id;
     db::o()->p($ids)->delete('categories', 'WHERE id IN(@' . count($ids) . '?)');
     log_add('deleted_cat', 'admin', $id);
 }
Esempio n. 6
0
        db_query($q);
        $log['ID'] = db_insert_id();
        $log['eventID'] = $sessioninfo->eventID;
        $log['screenID'] = $screenID;
        $log['wait'] = $wait;
        $log['slideID'] = $slideID;
        log_add("infoscreens", "queueAdd", serialize($log));
        header('Location: ?module=infoscreens');
        die;
    }
} elseif ($action == 'queueRemove' and ($acl == 'Admin' or $acl == 'Write')) {
    $queueID = $_REQUEST['queueID'];
    if (empty($queueID) or !is_numeric($queueID)) {
        $content .= "<p>" . _('You did something wrong. Go back and try again.') . "</p>";
    } else {
        # FIXME: infoscreensQueues... should do some testing on the separation of different events and their acls... not sure this is 100% safe...
        $q = sprintf('DELETE FROM %s WHERE ID=%s AND eventID=%s', $queuetable, db_escape($queueID), $sessioninfo->eventID);
        db_query($q);
        $log['id'] = $queueID;
        log_add("infoscreens", "queueRemove", serialize($log));
        header('Location: ?module=infoscreens');
        die;
    }
} elseif ($action == "addScreen" && $acl == 'Admin') {
    $name = $_POST['name'];
    db_query("INSERT INTO " . $sql_prefix . "_infoscreens SET name = '" . db_escape($name) . "', eventID = '{$sessioninfo->eventID}'");
    $log_new['name'] = $name;
    log_add("infoscreens", "addScreen", serialize($log_new));
    header("Location: ?module=infoscreens");
}
// End elseif action == addScreen
Esempio n. 7
0
 /**
  * Инициализация AJAX-части модуля
  * @return null
  */
 public function init()
 {
     $POST = globals::g('POST');
     lang::o()->get('admin/config');
     $cprefix = config_man::config_prefix;
     $cprefix_length = strlen($cprefix);
     $keys = array();
     $newcfg = array();
     $i = 0;
     $sort = array();
     foreach ($POST as $key => $value) {
         if (strpos($key, $cprefix) !== 0) {
             continue;
         }
         $key = substr($key, $cprefix_length);
         if (!config::o()->visset($key)) {
             continue;
         }
         $keys[] = $key;
         $newcfg[$key] = $value;
         $sort[$key] = ++$i;
     }
     if (!$keys) {
         return;
     }
     try {
         plugins::o()->pass_data(array("newcfg" => &$newcfg, "sort" => &$sort), true)->run_hook('admin_config_save');
     } catch (PReturn $e) {
         return $e->r();
     }
     $r = db::o()->p($keys)->query('SELECT name,type,allowed FROM config WHERE name IN(@' . count($keys) . '?)');
     $c = 0;
     while (list($name, $type, $allowed) = db::o()->fetch_row($r)) {
         if (!$this->check_type($type, $newcfg[$name], $allowed, $name)) {
             continue;
         }
         $c++;
         config::o()->set($name, $newcfg[$name], $sort[$name]);
     }
     db::o()->query('ALTER TABLE `config` ORDER BY `cat`, `sort`');
     log_add('changed_config', 'admin');
     print $c;
     die;
 }
Esempio n. 8
0
 /**
  * Удаление пользователя
  * @param int $id ID пользователя
  * @return bool статус удаления
  */
 public function delete_user($id)
 {
     $id = (int) $id;
     $r = $this->select_user($id, null, '`group`, avatar, username');
     if (!$r) {
         return;
     }
     $gr = users::o()->get_group($r['group']);
     if (!$gr['can_bedeleted']) {
         return false;
     }
     try {
         plugins::o()->pass_data(array('r' => $r, 'id' => $id), true)->run_hook('users_delete');
     } catch (PReturn $e) {
         return $e->r();
     }
     if ($r['avatar']) {
         $this->remove_user_avatar($id, $r['avatar']);
     }
     users::o()->admin_mode();
     db::o()->p($id)->delete("bans", "WHERE uid = ?");
     db::o()->p($id)->delete("warnings", "WHERE uid = ?");
     /* @var $pm messages_ajax */
     $pm = plugins::o()->get_module('messages', false, true);
     $pm->clear($id);
     db::o()->p($id)->delete("content_readed", "WHERE user_id = ?");
     /* @var $mailer mailer */
     $mailer = n("mailer");
     /* @var $rating rating */
     $rating = n("rating");
     /* @var $comments */
     $comments = n("comments");
     $mailer->remove($id, true);
     $rating->change_type('users')->clear($id);
     db::o()->p($id, $id)->delete("zebra", "WHERE user_id = ? OR to_userid = ?");
     db::o()->p($id)->delete("bookmarks", "WHERE user_id = ?");
     db::o()->p($id)->delete("invites", "WHERE user_id = ?");
     if (config::o('torrents_on')) {
         db::o()->p($id)->delete("content_downloaded", "WHERE uid = ?");
         db::o()->p($id)->delete("content_peers", "WHERE uid = ?");
     }
     $comments->change_type('users')->clear($id);
     db::o()->p($id)->delete("users", "WHERE id = ?");
     users::o()->admin_mode(false);
     log_add('deleted_user', 'admin', array($r['username'], $id));
     return true;
 }
Esempio n. 9
0
    }
    $content .= "</table>\n";
    $content .= "<h3>" . _("Message content") . "</h3>\n";
    # FIXME? Hardcoded textarea width and height
    $content .= "<textarea style='width: 300px; height: 200px;' disabled>" . htmlentities($msgcontent) . "</textarea>\n";
    $content .= "<p>" . _("Number of characters entered:") . " " . strlen($msgcontent) . "</p>\n";
    $content .= "<form method='POST' action='?module=SMS&action=sendSMS'>\n";
    $content .= "<input type='button' onClick='javascript:history.back()' value='" . _("Back") . "' />\n";
    $content .= "<input type='submit' value='" . _("Send SMS") . "' />\n";
    $content .= "<input type='hidden' name='toSmsList' value='" . $_POST['toSmsList'] . "' />\n";
    $content .= "<input type='hidden' name='message' value='" . $_POST['message'] . "' />\n";
    $content .= "</form>\n";
} elseif ($action == "sendSMS" && isset($_POST['toSmsList'])) {
    $toSmsList = $_POST['toSmsList'];
    $SQL = $smsList[$toSmsList]['SQL'];
    if (empty($SQL)) {
        # FIXME: die ()
        die("No such group?");
    }
    $qFindUsers = db_query($SQL);
    while ($rFindUsers = db_fetch($qFindUsers)) {
        db_query("INSERT INTO " . $sql_prefix . "_cronjobs\n\t\t\tSET cronModule = 'SMS',\n\t\t\ttoUser = '******',\n\t\t\tsenderID = '{$sessioninfo->userID}',\n\t\t\tcontent = '" . db_escape($_POST['message']) . "'");
    }
    // End while
    $log_new['toListName'] = $smsList[$toSmsList]['name'];
    $log_new['message'] = $_POST['message'];
    log_add("SMS", "sendSMS", serialize($log_new));
    header("Location: ?module=SMS&sending=success");
} else {
    echo "???";
}
function legacy_cdce_parse($content, $strict)
{
    //$dc=$txt;
    $hex = bin2hex(iconv('UTF-8', 'UTF-32BE', $content));
    //echo '<br>';
    //echo '<br>';
    //echo $data;
    //echo '<br>';
    //echo '<br>';
    //echo $hex;
    //echo '<br>';
    //echo '<br>';
    //echo dce_convert(hex2bin($hex), 'utf32', 'dc');
    //echo '<br>';
    //echo '<br>';
    global $DcMap_Unicode_Lossy;
    global $cdce_html_legacy;
    $counter = 0;
    $txt = '';
    while ($counter < strlen($hex)) {
        log_add('<br>');
        log_add('Bytes: ' . substr($hex, $counter, 48) . '…<br>');
        log_add('UTF-8: ' . hex2bin(ltrim(substr($hex, $counter, 192), '0')) . '<br>');
        log_add('Dc: ' . dce_convert(hex2bin(ltrim(substr($hex, $counter, 192), '0')), 'utf8', 'dc') . '<br>');
        if (substr($hex, $counter, 8) == '00000040') {
            //Conditions:
            //1char
            log_add('<br><br><font color="green">1 character CDCE conditions: <br>');
            //echo ((int) substr($hex, $counter + 16, 8) == '00000040')+0;
            //echo ((int) substr($hex, $counter + 32, 8) == '00000040')+0; //fails incorrectly
            log_add(substr($hex, $counter + 0, 8) . '. Should be: 00000040<br>');
            log_add(substr($hex, $counter + 16, 8) . '. Should be: 00000040<br>');
            log_add(hex2bin(ltrim(substr($hex, $counter + 8, 8), '0')) . '. Should be: greater than 0<br>');
            log_add(hex2bin(ltrim(substr($hex, $counter + 8, 8), '0')) . '. Should be: less than 13<br><br>→');
            log_add(((int) substr($hex, $counter + 0, 8) == '00000040') + 0);
            //this works
            log_add(((int) substr($hex, $counter + 16, 8) == '00000040') + 0);
            //this works
            log_add(((int) hex2bin(ltrim(substr($hex, $counter + 8, 8), '0')) > '0') + 0);
            log_add(((int) hex2bin(ltrim(substr($hex, $counter + 8, 8), '0')) < '13') + 0);
            log_add('<br><br><br>2 character CDCE conditions: <br>');
            //2char
            log_add(substr($hex, $counter + 0, 8) . '. Should be: 00000040<br>');
            log_add(substr($hex, $counter + 24, 8) . '. Should be: 00000040<br>');
            log_add(hex2bin(ltrim(substr($hex, $counter + 8, 8), '0')) . hex2bin(ltrim(substr($hex, $counter + 16, 8), '0')) . '. Should be: greater than 0<br>');
            log_add(hex2bin(ltrim(substr($hex, $counter + 8, 8), '0')) . hex2bin(ltrim(substr($hex, $counter + 16, 8), '0')) . '. Should be: less than 13<br>');
            //echo hex2bin(ltrim(substr($hex, $counter + 8, 8), '0')) . '. Should be: greater than 0<br>';
            //echo hex2bin(ltrim(substr($hex, $counter + 8, 8), '0')) . '. Should be: less than 13<br>';
            //echo hex2bin(ltrim(substr($hex, $counter + 16, 8), '0')) . '. Should be: greater than 0<br>';
            //echo hex2bin(ltrim(substr($hex, $counter + 16, 8), '0')) . '. Should be: less than 13<br><br>→';
            log_add(((int) substr($hex, $counter + 0, 8) == '00000040') + 0);
            log_add(((int) substr($hex, $counter + 24, 8) == '00000040') + 0);
            log_add(((int) hex2bin(ltrim(substr($hex, $counter + 8, 8), '0')) . hex2bin(ltrim(substr($hex, $counter + 16, 8), '0')) > '0') + 0);
            log_add(((int) hex2bin(ltrim(substr($hex, $counter + 8, 8), '0')) . hex2bin(ltrim(substr($hex, $counter + 16, 8), '0')) < '13') + 0);
            //echo ((int) hex2bin(ltrim(substr($hex, $counter + 8, 8), '0')) > '0')+0;
            //echo ((int) hex2bin(ltrim(substr($hex, $counter + 8, 8), '0')) < '13')+0;
            //echo ((int) hex2bin(ltrim(substr($hex, $counter + 16, 8), '0')) > '0')+0;
            //echo ((int) hex2bin(ltrim(substr($hex, $counter + 16, 8), '0')) < '13')+0;
            log_add('<br><br></font>');
            if (substr($hex, $counter + 0, 8) == '00000040' && substr($hex, $counter + 16, 8) == '00000040' && hex2bin(ltrim(substr($hex, $counter + 8, 8), '0')) > '0' && hex2bin(ltrim(substr($hex, $counter + 8, 8), '0')) < '13') {
                $append = hex2bin(ltrim(substr($hex, $counter + 8, 8), '0')) . ',';
                $counter = $counter + 16;
                log_add('<br><font color="red">');
                log_add($counter / 8 + 1 . '. 1-character Dc appended (' . hex2bin(ltrim(substr($hex, $counter - 8, 8), '0')) . '): ' . $append . ' → ' . $txt . $append);
                log_add('<br></font>');
            } else {
                if (substr($hex, $counter + 0, 8) == '00000040' && substr($hex, $counter + 24, 8) == '00000040' && hex2bin(ltrim(substr($hex, $counter + 8, 8), '0')) . hex2bin(ltrim(substr($hex, $counter + 16, 8), '0')) > 0 && hex2bin(ltrim(substr($hex, $counter + 8, 8), '0')) . hex2bin(ltrim(substr($hex, $counter + 16, 8), '0')) < 13) {
                    $append = hex2bin(ltrim(substr($hex, $counter + 8, 8), '0') . ltrim(substr($hex, $counter + 16, 8), '0')) . ',';
                    $counter = $counter + 24;
                    log_add('<br><font color="red">');
                    log_add($counter / 8 + 1 . '. 2-character Dc appended (' . hex2bin(ltrim(substr($hex, $counter - 16, 16), '0')) . '): ' . $append . ' → ' . $txt . $append);
                    log_add('<br></font>');
                } else {
                    if ($strict) {
                        log_add('<br><font color="red">');
                        log_add($counter / 8 + 1 . '. CDCE decoding error!' . ' → ' . $txt . $append);
                        log_add('<br></font>');
                        return str_replace(',,', ',0,', preg_replace('/,\\Z/', '', $txt)) . '… CDCE decoding error!';
                    } else {
                        if (strlen($DcMap_Unicode_Lossy[strtoupper(ltrim(substr($hex, $counter, 8), '0'))]) != 0) {
                            $append = $DcMap_Unicode_Lossy[strtoupper(ltrim(substr($hex, $counter, 8), '0'))] . ',';
                            log_add('<br><font color="red">');
                            log_add($counter / 8 + 1 . '. Unicode appended; attempting recovery of corrupted CDCE data: ' . $append . ' → ' . $txt . $append);
                            log_add('<br></font>');
                        } else {
                            $append = '';
                            log_add('<br><font color="red">');
                            log_add($counter / 8 + 1 . '. Unicode not appended; attempting recovery of corrupted CDCE data' . ' → ' . $txt . $append);
                            log_add('<br></font>');
                        }
                    }
                }
            }
        } else {
            if (strlen($DcMap_Unicode_Lossy[strtoupper(ltrim(substr($hex, $counter, 8), '0'))]) != 0) {
                $append = $DcMap_Unicode_Lossy[strtoupper(ltrim(substr($hex, $counter, 8), '0'))] . ',';
                log_add('<br><font color="red">');
                log_add($counter / 8 + 1 . '. Unicode appended: ' . $append . ' → ' . $txt . $append);
                log_add('<br></font>');
            } else {
                $append = '';
                log_add('<br><font color="red">');
                log_add($counter / 8 + 1 . '. Unicode not appended' . ' → ' . $txt . $append);
                log_add('<br></font>');
            }
        }
        // $txt = $txt . $DcMap_Unicode_Lossy[strtoupper(ltrim(substr($hex, $counter, 8), '0')) ] . ',';
        $txt = $txt . $append;
        //$txt=$txt;
        $counter = $counter + 8;
    }
    //echo $txt;
    $dc = $txt;
    return $dc;
}
Esempio n. 11
0
 /**
  * Удаление группы пользователя
  * @param int $id ID группы
  * @return null
  */
 public function delete($id)
 {
     $id = (int) $id;
     db::o()->p($id)->delete('groups', 'WHERE id=? AND notdeleted="0" LIMIT 1');
     log_add('deleted_group', 'admin', $id);
 }
Esempio n. 12
0
    if (in_array($accessmodule, $globalaccess)) {
        $event = 1;
    } else {
        $event = $eventID;
    }
    $qCheckExisting = db_query("SELECT * FROM " . $sql_prefix . "_ACLs\n\t\tWHERE groupID = '" . db_escape($groupID) . "'\n\t\tAND accessmodule = '" . db_escape($accessmodule) . "'\n\t\tAND eventID = {$event}");
    if (db_num($qCheckExisting) == 0) {
        db_query("INSERT INTO " . $sql_prefix . "_ACLs SET groupID = '" . db_escape($groupID) . "',\n\t\t\taccessmodule = '" . db_escape($accessmodule) . "',\n\t\t\taccess = '" . db_escape($newright) . "',\n\t\t\teventID = {$event}");
    } else {
        db_query("UPDATE " . $sql_prefix . "_ACLs SET access = '" . db_escape($newright) . "'\n\t\t\tWHERE accessmodule = '" . db_escape($accessmodule) . "'\n\t\t\tAND groupID = '" . db_escape($groupID) . "'\n\t\t\tAND eventID = {$event}");
    }
    // End else
    $log_new['groupID'] = $groupID;
    $log_new['accessmodule'] = $accessmodule;
    $log_new['access'] = $newright;
    log_add("eventadmin", "doChangeRight", serialize($log_new));
    if ($accessmodule == 'eventAttendee') {
        header("Location: ?module=eventadmin&action=eventaccess");
    } else {
        header("Location: ?module=eventadmin&action=groupRights&groupID={$groupID}");
    }
} elseif ($action == "eventaccess") {
    // if event is private, admin who can attend
    // FIXME: Only works for accessgroups for now...
    // Should be possible for specially invited people in clans, and all accessgroups
    $qListGroups = db_query("SELECT * FROM " . $sql_prefix . "_groups WHERE groupType = 'access' AND ID != 1 ORDER BY eventID DESC");
    $row = 1;
    $content .= "<table>";
    while ($rListGroups = db_fetch($qListGroups)) {
        $content .= "<tr class='listRow{$row}'><td>";
        $content .= $rListGroups->groupname;
Esempio n. 13
0
         notification_add($_G['gp_uid'], 'system', lang('plugin/dsu_marcothief', 'notice_raids_fail'), array('username' => $_G['username']), 1);
         showmessage('dsu_marcothief:msg_14', dreferer());
     }
 } elseif (submitcheck('run')) {
     if ($user_db['run'] > $_G['timestamp']) {
         showmessage('dsu_marcothief:msg_15', dreferer(), array('mins' => round(($user_db['run'] - $_G['timestamp']) / 60, 0)));
     }
     $run_percentage = $run_success_shop + $config['run_percentage'] > 100 ? 100 : $run_success_shop + $config['run_percentage'];
     $success = mt_rand(0, 100) <= $run_percentage ? TRUE : FALSE;
     if ($success == TRUE) {
         DB::query("UPDATE " . DB::table('dsu_marcothief') . " SET jail='0',run='0',goodluck='0' WHERE uid='{$_G['uid']}'");
         showmessage('dsu_marcothief:msg_17', dreferer());
     } elseif ($police == TRUE && $user_db['run_tool']) {
         DB::query("DELETE FROM " . DB::table('dsu_marcothief_bag') . " WHERE shopid='{$user_db['run_tool']}' AND uid='{$_G['uid']}'");
         DB::query("UPDATE " . DB::table('dsu_marcothief') . " SET run_tool='0' WHERE uid='{$_G['uid']}'");
         log_add($_G['username'], 'run_fail_police');
         showmessage('dsu_marcothief:msg_39', dreferer());
     } else {
         DB::query("UPDATE " . DB::table('dsu_marcothief') . " SET run='" . ($_G['timestamp'] + 60 * $config['run_mins']) . "' WHERE uid='{$_G['uid']}'");
         showmessage('dsu_marcothief:msg_18', dreferer());
     }
 } elseif (submitcheck('money')) {
     if ($user_db['extcredits' . $config['raids_credit']] < $config['bribe_money']) {
         showmessage('dsu_marcothief:msg_20', dreferer(), array('credit' => $_G['setting']['extcredits'][$config['raids_credit']]['title']));
     } else {
         updatemembercount($_G['uid'], array('extcredits' . $config['raids_credit'] => 'extcredits' . $config['raids_credit'] - $config['bribe_money']));
         DB::query("UPDATE " . DB::table('dsu_marcothief') . " SET jail='0',run='0',goodluck='0' WHERE uid='{$_G['uid']}'");
         showmessage('dsu_marcothief:msg_19', dreferer());
     }
 } elseif (submitcheck('goodluck')) {
     $getluck_user = getuserbyuid(intval($_G['gp_goodluck_uid']));
Esempio n. 14
0
 /**
  * Очистка обратной связи
  * @param string $type тип
  * @return null
  */
 public function clear($type = '')
 {
     db::o()->p($type)->delete('feedback', $type ? 'WHERE type=?' : "");
     log_add('cleared_feedback', 'admin');
 }
Esempio n. 15
0
 /**
  * Удаление типов файлов
  * @param string $id имя типа файлов
  * @return null
  */
 public function delete($id)
 {
     /* @var $aft allowedft_man */
     $aft = plugins::o()->get_module('allowedft', 1);
     if ($aft->is_basic($id)) {
         return;
     }
     db::o()->p($id)->delete('allowed_ft', 'WHERE name=? LIMIT 1');
     log_add('deleted_filetype', 'admin', $id);
 }
Esempio n. 16
0
 /**
  * Инициализация AJAX-части модуля
  * @return null
  */
 public function init()
 {
     lang::o()->get('admin/pages/main');
     if (!users::o()->perm('system')) {
         return;
     }
     $act = $_GET["act"];
     users::o()->admin_mode();
     /* @var $etc etc */
     $etc = n("etc");
     $all = false;
     switch ($act) {
         case "attachments":
             $all = true;
         case "unattachments":
             /* @var $attach attachments */
             $attach = n("attachments");
             $attach->clear(0, $all);
             break;
         case "sitemap":
             $this->sitemap();
             ok();
             break;
         case "cleanup":
             /* @var $cleanup cleanup */
             $cleanup = n("cleanup");
             $cleanup->execute(true);
             break;
         case "cache":
             cache::o()->clear();
             break;
         case "cache_tpl":
             cache::o()->clear_tpl();
             break;
         case "stats":
             $st = stats::o()->read();
             foreach ($st as $s => $v) {
                 stats::o()->write($s, 0);
             }
             break;
         case "logs":
             /* @var $logs logs_man_ajax */
             $logs = plugins::o()->get_module('logs', 1, true);
             $logs->clear();
             break;
         case "peers":
             db::o()->truncate_table('content_peers');
             db::o()->update(array('leechers' => 0, 'seeders' => 0), 'content_torrents');
             break;
         case "downloaded":
             db::o()->truncate_table('content_downloaded');
             db::o()->update(array('downloaded' => 0), 'content_torrents');
             break;
         case "chat":
             /* @var $chat chat */
             $chat = plugins::o()->get_module('chat');
             $chat->truncate();
             break;
         case "pm":
             /* @var $pm messages_ajax */
             $pm = plugins::o()->get_module('messages', false, true);
             $pm->clear();
             break;
         case "ratings":
             $r = db::o()->query('SELECT toid, type FROM ratings GROUP BY toid, type');
             /* @var $rating rating */
             $rating = n("rating");
             while ($row = db::o()->fetch_assoc($r)) {
                 $rating->change_type($row['type'])->clear($row['toid']);
             }
             break;
             // Далее: Важная часть сайта, да
         // Далее: Важная часть сайта, да
         case "content":
             $r = db::o()->query('SELECT id FROM content');
             while (list($id) = db::o()->fetch_row($r)) {
                 try {
                     $etc->delete_content($id);
                 } catch (EngineException $e) {
                 }
             }
             break;
         case "comments":
             /* @var $comments comments */
             $comments = n("comments");
             $comments->clear(null, true);
             break;
         case "polls":
             /* @var $polls polls */
             $polls = n("polls");
             $polls->clear();
             break;
         case "news":
             /* @var $news news_ajax */
             $news = plugins::o()->get_module('news', false, true);
             $news->clear();
             break;
         case "bans":
             $r = db::o()->query('SELECT id FROM bans');
             while (list($id) = db::o()->fetch_row($r)) {
                 $etc->unban_user(null, $id);
             }
             break;
         case "warnings":
             $r = db::o()->query('SELECT id FROM warnings');
             while (list($id) = db::o()->fetch_row($r)) {
                 $etc->unwarn_user(null, null, $id);
             }
             break;
     }
     log_add('system_clean', 'admin', array(lang::o()->v('main_page_clear_' . $act), $act));
     ok();
 }
Esempio n. 17
0
 /**
  * Удаление стат. страницы
  * @param int $id ID страницы
  * @return null
  */
 public function delete($id)
 {
     $id = (int) $id;
     db::o()->p($id)->delete('static', 'WHERE id=? LIMIT 1');
     log_add('deleted_static', 'admin', $id);
 }
Esempio n. 18
0
    $seatY = $_GET['seatY'];
    $ticketID = $_GET['ticketID'];
    $eventID = $sessioninfo->eventID;
    $password = $_POST['password'];
    $newlog['ticketID'] = $ticketID;
    $newlog['seatX'] = $seatX;
    $newlog['seatY'] = $seatY;
    $newlog['password'] = $password;
    if (seating_rights($seatX, $seatY, $ticketID, $eventID, $password)) {
        // We have rights to seat that ticket. Update DB
        $qTicketInfo = db_query("SELECT * FROM " . $sql_prefix . "_tickets WHERE ticketID = '" . db_escape($ticketID) . "'");
        $rTicketInfo = db_fetch($qTicketInfo);
        // Check if that ticket is already used
        $qCheckUsedTicket = db_query("SELECT * FROM " . $sql_prefix . "_seatReg_seatings WHERE ticketID = '" . db_escape($ticketID) . "'");
        if (db_num($qCheckUsedTicket) == 0) {
            // Ticket has never been used. Insert it
            db_query("INSERT INTO " . $sql_prefix . "_seatReg_seatings SET\n\t\t\t    eventID = '" . db_escape($eventID) . "',\n\t\t\t    ticketID = '" . db_escape($ticketID) . "',\n\t\t    seatX = '" . db_escape($seatX) . "',\n\t\t    seatY = '" . db_escape($seatY) . "'");
            db_query("UPDATE " . $sql_prefix . "_tickets SET status = 'used'\n\t\t    WHERE ticketID = '" . db_escape($ticketID) . "'");
        } else {
            db_query("UPDATE " . $sql_prefix . "_seatReg_seatings SET\n\t\t    seatX = '" . db_escape($seatX) . "',\n\t\t    seatY = '" . db_escape($seatY) . "'\n\t\t    WHERE ticketID = '" . db_escape($ticketID) . "'");
        }
        // End else
        log_add("seating", "takeseat", serialize($newlog));
    } else {
        // Failed seating_rights()
        log_add("seating", "failedTakeseat", serialize($newlog));
    }
    // End else
    header("Location: ?module=seating&seatX={$seatX}&seatY={$seatY}&ticketID={$ticketID}");
}
// End if action == "takeseat"
Esempio n. 19
0
    }
    $q = sprintf('DELETE FROM %s WHERE eventID=%s AND userID=%s', $sleeperstable, $sessioninfo->eventID, db_escape($userid));
    db_query($q);
    $log['userID'] = $userid;
    log_add("sleepers", "removesleeper", serialize($log));
    header('Location: ?module=sleepers');
    die;
} elseif ($action == 'rmWake') {
    // Remove wake time on sleeper.
    $userID = $_GET['userID'];
    if (isset($userID) == false || is_numeric($userID) == false) {
        header('Location: ?module=sleepers');
        die;
    }
    $log = array('userID' => $userID);
    log_add("sleepers", "removewakeup", serialize($log));
    $wakeupManager->removeWakeup($userID);
    header('Location: ?module=sleepers&wakerm=' . $userID);
    die;
} elseif ($action == 'setwakegui') {
    // Set wake time on sleeper, GUI.
    $userID = $_GET['userID'];
    if (isset($userID) == false || is_numeric($userID) == false) {
        header('Location: ?module=sleepers');
        die;
    }
    $content .= "<a href='?module=sleepers'>" . _("Return to sleepers overview") . "</a>\n";
    ob_start();
    include __DIR__ . "/setwake_gui.php";
    $content .= ob_get_clean();
} elseif ($action == 'setWake') {
Esempio n. 20
0
 /**
  * Delete a crew from the database.
  * 
  * @param \Wannabe\Crew $crew
  * @return boolean Always return true.
  */
 public function deleteCrew(Crew $crew)
 {
     db_query("DELETE FROM `" . db_prefix() . "_wannabeCrews` WHERE `ID`=" . $crew->getCrewID());
     // Log this action.
     $log['ID'] = $crew->getCrewID();
     $log['eventID'] = $crew->getEventID();
     log_add("wannabeadmin", "rmWannabeCrew", serialize($log));
     return true;
 }
function convert_legacy_cdce_to_dc($data, $strict = false)
{
    //This function relies on the lossy UTF8-to-Dc conversion provided by the libdce 1.43 version included with libdce 2.0. Once UTF8 to Dc conversion is implemented in libdce 2.0 this function can be updated.
    $hex = bin2hex(iconv('UTF-8', 'UTF-32BE', $data));
    global $DcMap_Unicode_Lossy;
    global $cdce_html_legacy;
    $counter = 0;
    $txt = '';
    while ($counter < strlen($hex)) {
        log_add('<br>');
        log_add('Bytes: ' . substr($hex, $counter, 48) . '…<br>');
        log_add('UTF-8: ' . hex2bin(ltrim(substr($hex, $counter, 192), '0')) . '<br>');
        log_add('Dc: ' . dce_convert_1_43(hex2bin(ltrim(substr($hex, $counter, 192), '0')), 'utf8', 'dc') . '<br>');
        if (substr($hex, $counter, 8) == '00000040') {
            log_add('<br><br><font color="green">1 character CDCE conditions: <br>');
            log_add(substr($hex, $counter + 0, 8) . '. Should be: 00000040<br>');
            log_add(substr($hex, $counter + 16, 8) . '. Should be: 00000040<br>');
            log_add(hex2bin(ltrim(substr($hex, $counter + 8, 8), '0')) . '. Should be: greater than 0<br>');
            log_add(hex2bin(ltrim(substr($hex, $counter + 8, 8), '0')) . '. Should be: less than 13<br><br>→');
            log_add(((int) substr($hex, $counter + 0, 8) == '00000040') + 0);
            //this works
            log_add(((int) substr($hex, $counter + 16, 8) == '00000040') + 0);
            //this works
            log_add(((int) hex2bin(ltrim(substr($hex, $counter + 8, 8), '0')) > '0') + 0);
            log_add(((int) hex2bin(ltrim(substr($hex, $counter + 8, 8), '0')) < '13') + 0);
            log_add('<br><br><br>2 character CDCE conditions: <br>');
            log_add(substr($hex, $counter + 0, 8) . '. Should be: 00000040<br>');
            log_add(substr($hex, $counter + 24, 8) . '. Should be: 00000040<br>');
            log_add(hex2bin(ltrim(substr($hex, $counter + 8, 8), '0')) . hex2bin(ltrim(substr($hex, $counter + 16, 8), '0')) . '. Should be: greater than 0<br>');
            log_add(hex2bin(ltrim(substr($hex, $counter + 8, 8), '0')) . hex2bin(ltrim(substr($hex, $counter + 16, 8), '0')) . '. Should be: less than 13<br>');
            log_add(((int) substr($hex, $counter + 0, 8) == '00000040') + 0);
            log_add(((int) substr($hex, $counter + 24, 8) == '00000040') + 0);
            log_add(((int) hex2bin(ltrim(substr($hex, $counter + 8, 8), '0')) . hex2bin(ltrim(substr($hex, $counter + 16, 8), '0')) > '0') + 0);
            log_add(((int) hex2bin(ltrim(substr($hex, $counter + 8, 8), '0')) . hex2bin(ltrim(substr($hex, $counter + 16, 8), '0')) < '13') + 0);
            log_add('<br><br></font>');
            if (substr($hex, $counter + 0, 8) == '00000040' && substr($hex, $counter + 16, 8) == '00000040' && hex2bin(ltrim(substr($hex, $counter + 8, 8), '0')) > '0' && hex2bin(ltrim(substr($hex, $counter + 8, 8), '0')) < '13') {
                $append = hex2bin(ltrim(substr($hex, $counter + 8, 8), '0')) . ',';
                $counter = $counter + 16;
                log_add('<br><font color="red">');
                log_add($counter / 8 + 1 . '. 1-character Dc appended (' . hex2bin(ltrim(substr($hex, $counter - 8, 8), '0')) . '): ' . $append . ' → ' . $txt . $append);
                log_add('<br></font>');
            } else {
                if (substr($hex, $counter + 0, 8) == '00000040' && substr($hex, $counter + 24, 8) == '00000040' && hex2bin(ltrim(substr($hex, $counter + 8, 8), '0')) . hex2bin(ltrim(substr($hex, $counter + 16, 8), '0')) > 0 && hex2bin(ltrim(substr($hex, $counter + 8, 8), '0')) . hex2bin(ltrim(substr($hex, $counter + 16, 8), '0')) < 13) {
                    $append = hex2bin(ltrim(substr($hex, $counter + 8, 8), '0') . ltrim(substr($hex, $counter + 16, 8), '0')) . ',';
                    $counter = $counter + 24;
                    log_add('<br><font color="red">');
                    log_add($counter / 8 + 1 . '. 2-character Dc appended (' . hex2bin(ltrim(substr($hex, $counter - 16, 16), '0')) . '): ' . $append . ' → ' . $txt . $append);
                    log_add('<br></font>');
                } else {
                    if ($strict) {
                        error_add('<br><font color="red">');
                        error_add($counter / 8 + 1 . '. CDCE decoding error!' . ' → ' . $txt . $append);
                        error_add('<br></font>');
                        return str_replace(',,', ',0,', preg_replace('/,\\Z/', '', $txt)) . '… CDCE decoding error!';
                    } else {
                        if (strlen($DcMap_Unicode_Lossy[strtoupper(ltrim(substr($hex, $counter, 8), '0'))]) != 0) {
                            $append = $DcMap_Unicode_Lossy[strtoupper(ltrim(substr($hex, $counter, 8), '0'))] . ',';
                            error_add('<br><font color="red">');
                            error_add($counter / 8 + 1 . '. Unicode appended; attempting recovery of corrupted CDCE data: ' . $append . ' → ' . $txt . $append);
                            error_add('<br></font>');
                        } else {
                            $append = '';
                            error_add('<br><font color="red">');
                            error_add($counter / 8 + 1 . '. Unicode not appended; attempting recovery of corrupted CDCE data' . ' → ' . $txt . $append);
                            error_add('<br></font>');
                        }
                    }
                }
            }
        } else {
            if (strlen($DcMap_Unicode_Lossy[strtoupper(ltrim(substr($hex, $counter, 8), '0'))]) != 0) {
                $append = $DcMap_Unicode_Lossy[strtoupper(ltrim(substr($hex, $counter, 8), '0'))] . ',';
                log_add('<br><font color="red">');
                log_add($counter / 8 + 1 . '. Unicode appended: ' . $append . ' → ' . $txt . $append);
                log_add('<br></font>');
            } else {
                $append = '';
                log_add('<br><font color="red">');
                log_add($counter / 8 + 1 . '. Unicode not appended' . ' → ' . $txt . $append);
                log_add('<br></font>');
            }
        }
        $txt = $txt . $append;
        $counter = $counter + 8;
    }
    $dc = $txt;
    return $dc;
}
Esempio n. 22
0
        $content .= _("Verifycationcode not valid");
    } else {
        $qCheckUser = db_query("SELECT EMailConfirmed,EMail,EMailVerifyCode FROM " . $sql_prefix . "_users WHERE ID = '" . db_escape($userID) . "'");
        $rCheckUser = db_fetch($qCheckUser);
        if ($rCheckUser->EMailConfirmed == 1) {
            $content .= _("EMail was already verified. Not verified again");
        } elseif ($rCheckUser->EMailVerifyCode != $verifycode) {
            $content .= "Verificationcode does not match. Try again";
            $log_new['tried_verifycode'] = $verifycode;
            $log_new['actual_verifycode'] = $rCheckUser->EMailVerifyCode;
            log_add("register", "failed_verifycode", serialize($log_new), "", $userID);
        } elseif ($rCheckUser->EMailVerifyCode == $verifycode) {
            $content .= _("EMail verified. Welcome aboard");
            $log_new['verifycode'] = $verifycode;
            db_query("UPDATE " . $sql_prefix . "_users SET EMailConfirmed = 1 WHERE ID = '" . db_escape($userID) . "'");
            log_add("register", "confirmed_verifycode", serialize($log_new), "", $userID);
        }
        // End elseif EMailVerifyCode == verifycode
    }
    // End else
}
// end action = verifymail
if (!isset($action) || $hide_register == FALSE) {
    $design_head .= '<script type="text/javascript" src="inc/AJAX/ajax_postnumber.js"></script>' . "\n";
    if ($register_invalid) {
        $content .= "<font color=red>{$register_invalid}</font><br><br>";
    }
    $content .= "<form method=POST action=?module=register&amp;action=register>\n";
    $content .= "<input type=text name=username value='{$username}'> " . lang("Username", "register");
    $content .= "\n<br><input type=password name=pass1 value='{$pass1}'> " . lang("Password", "register");
    $content .= "\n<br><input type=password name=pass2 value='{$pass2}'> " . lang("Password again", "register");
Esempio n. 23
0
 /**
  * Включение/выключение блока
  * @param int $id ID блока
  * @return null
  */
 public function switch_state($id)
 {
     $id = (int) $id;
     db::o()->p($id)->update(array('_cb_enabled' => 'IF(enabled="1","0","1")'), 'blocks', 'WHERE id=? LIMIT 1');
     log_add('switched_block', 'admin', $id);
 }
Esempio n. 24
0
 /**
  * Функция сохранения комментария
  * @param string $content содержание комментария
  * @param int $resid ID ресурса
  * @param int $id ID комментария
  * @return bool true в случае успешного сохранения комментария
  * @throws EngineException 
  */
 public function save($content, $resid = "", $id = "")
 {
     if (!$this->state) {
         return;
     }
     $type = $this->type;
     lang::o()->get('comments');
     $id = longval($id);
     /* @var $etc etc */
     $etc = n("etc");
     if (!$id) {
         users::o()->check_perms('comment', 2, 2);
         if (!users::o()->v()) {
             $error = array();
             n("captcha")->check($error);
             if ($error) {
                 return implode("\n", $error);
             }
         }
     } else {
         $q = db::o()->p($id)->query('SELECT poster_id FROM comments WHERE id = ? LIMIT 1');
         $poster = db::o()->fetch_assoc($q);
         if (!$poster) {
             throw new EngineException('comment_was_deleted');
         }
         if ($poster['poster_id'] == users::o()->v('id')) {
             users::o()->check_perms('edit_comm');
         } else {
             users::o()->check_perms('edit_comm', 2);
         }
     }
     $content = trim($content);
     $poster = users::o()->v('id') ? users::o()->v('id') : -1;
     if (!longval($resid) && $resid || !longval($id) && $id || !$id && !$resid) {
         throw new EngineException('comment_wrong_data');
     }
     if (!$content || mb_strlen($content) < config::o()->v('min_comm_symb')) {
         throw new EngineException('comment_small_text');
     }
     if (!$id) {
         $etc->anti_flood('comments', 'toid=' . $resid . ' AND type=' . db::o()->esc($type), array('poster_id', 'edited_time'));
     }
     $upd = array();
     if (!$id) {
         $id = $this->check_double_comment($resid, $content);
         if ($id) {
             $upd["edited_time"] = time();
             unset($upd["subject"]);
         }
     }
     $upd["text"] = $content;
     try {
         plugins::o()->pass_data(array('update' => &$upd, "id" => $id), true)->run_hook('comments_save');
     } catch (PReturn $e) {
         return $e->r();
     }
     if (!$id) {
         $upd = array_merge($upd, array("posted_time" => time(), "edited_time" => time(), "poster_id" => $poster, "toid" => $resid, "type" => $type));
         db::o()->insert($upd, "comments");
         $etc->add_res('comm');
         db::o()->no_error();
         $etc->add_res('comm', 1, $type, $resid);
         /* @var $mailer mailer */
         $mailer = n("mailer");
         $mailer->change_type($type)->update($resid);
     } else {
         db::o()->p($id)->update($upd, "comments", 'WHERE id = ? LIMIT 1');
         log_add("edited_comment", "user", array($id));
     }
     return true;
 }
function convert_3_01a_to_dc($data)
{
    //This function needs to be improved to fully support DCE 3.01a!
    $hex = bin2hex($data);
    if (substr($hex, 0, 12) !== '444345650201') {
        error_add('<font color="red">Error! This document is not stored using the specified format. </font>' . 'The substring "' . substr($hex, 0, 12) . '" should be "444345650201".');
        return 'This document is not stored using the specified format.';
    }
    if (substr($hex, 12, 2) !== '02') {
        error_add('<font color="red">Error! This document is not stored using the specified version of DCE.</font>');
        return 'This document is not stored using the specified version of DCE.';
    }
    //######################################################
    //This is a DCE 3.01a file.
    global $DcMap_dce3_01a_Core;
    global $DcMap_dce3_01a_Variant_Selectors;
    global $DcMap_dce3_01a_Semantic_Records;
    global $DcMap_dce3_01a_Mathematics;
    global $DcMap_dce3_01a_Whitespace_and_Punctuation;
    global $Dc_to_Base64;
    $counter = 14;
    $txt = '';
    $state = 'Core';
    $varAppend = 'DcMap_dce3_01a_';
    while ($counter < strlen($hex)) {
        $action_last = $action;
        log_add('<br><font color="red">' . (($counter - 14) / 2 + 1) . ': </font><br>State: ' . $state . '<br>Hex position: ' . substr($hex, $counter, 2) . '<br>Dc ID: ' . $DcMap_dce3_01a_Core[strtoupper(substr($hex, $counter, 2))] . '<br>Appending: ');
        $data_array_name = $varAppend . $state;
        $data_array = ${$data_array_name};
        switch ($state) {
            case 'Core':
                if (substr($DcMap_dce3_01a_Core[strtoupper(substr($hex, $counter, 2))], 0, 1) == '>') {
                    //Switch states
                    $state = substr($DcMap_dce3_01a_Core[strtoupper(substr($hex, $counter, 2))], 1, strlen($DcMap_dce3_01a_Core[strtoupper(substr($hex, $counter, 2))]) - 1);
                    $append = '';
                    $action = 'State switch out of Core) <br>';
                    break;
                } else {
                    $append = $DcMap_dce3_01a_Core[strtoupper(substr($hex, $counter, 2))] . ',';
                    $action = 'Append from Core) <br>';
                }
                break;
            case 'Variant_Selectors':
                if (substr($hex, $counter, 2) == 'fd' || substr($hex, $counter, 2) == 'fe') {
                    $state = 'Core';
                    $append = '';
                    $action = 'State switch out of Variant_Selectors) <br>';
                } else {
                    $append = $DcMap_dce3_01a_Variant_Selectors[strtoupper(substr($hex, $counter, 2))] . ',';
                    $action = 'Append from Variant_Selectors) <br>';
                }
                break;
            case 'Semantic_Records':
                if (substr($hex, $counter, 2) == 'fd' || substr($hex, $counter, 2) == 'fe') {
                    $state = 'Core';
                    $append = '';
                    $action = 'State switch out of Semantic_Records) <br>';
                } else {
                    $append = $DcMap_dce3_01a_Semantic_Records[strtoupper(substr($hex, $counter, 2))] . ',';
                    $action = 'Append from Semantic_Records) <br>';
                }
                break;
            case 'Mathematics':
                if (substr($hex, $counter, 2) == 'fd' || substr($hex, $counter, 2) == 'fe') {
                    $state = 'Core';
                    $append = '';
                    $action = 'State switch out of Mathematics) <br>';
                } else {
                    $append = $DcMap_dce3_01a_Mathematics[strtoupper(substr($hex, $counter, 2))] . ',';
                    $action = 'Append from Mathematics) . <br>';
                }
                break;
            case 'Whitespace_and_Punctuation':
                if (substr($hex, $counter, 2) == 'fd' || substr($hex, $counter, 2) == 'fe') {
                    $state = 'Core';
                    $append = '';
                    $action = 'State switch out of Whitespace_and_Punctuation) <br>';
                } else {
                    $append = $DcMap_dce3_01a_Whitespace_and_Punctuation[strtoupper(substr($hex, $counter, 2))] . ',';
                    $action = 'Append from Whitespace_and_Punctuation) <br>';
                }
                break;
        }
        if (substr($hex, $counter, 4) == 'fd03') {
            $action = '<br>Halting. <br>';
            break;
        }
        $txt = $txt . $append;
        $counter = $counter + 2;
        log_add(rtrim($append, ',') . '<br>Action: ' . substr($action, 0, strlen($action) - 6) . '<br><font color="green">→ ' . $txt . '</font><br><br>');
    }
    log_add(rtrim($append, ',') . '<br>Action: ' . substr($action, 4, strlen($action) - 5) . '<br><br><br><br>');
    $txt = substr($txt, 3, strlen($txt) - 4);
    return $txt;
}
Esempio n. 26
0
 /**
  * Удаление контента
  * @param int $id ID контента
  * @return null
  * @throws EngineException 
  */
 public function delete($id)
 {
     check_formkey();
     $id = (int) $id;
     $lj = $cols = "";
     if ($this->tstate) {
         $cols = ", t.screenshots";
         $lj = ' LEFT JOIN content_torrents AS t ON t.cid=c.id';
     }
     $row = db::o()->p($id)->query('SELECT c.poster_id, c.title, c.posted_time, 
         p.id AS poll_id ' . $cols . ' FROM content AS c ' . $lj . '
             LEFT JOIN polls AS p ON p.type="content" AND p.toid=c.id
             WHERE c.id=? LIMIT 1');
     list($poster_id, $title, $posted_time, $pid, $screenshots) = db::o()->fetch_row($row);
     if ($row) {
         if (users::o()->v('id') == $poster_id) {
             users::o()->check_perms('del_content');
         } else {
             users::o()->check_perms('del_content', '2');
         }
     } else {
         throw new EngineException('content_not_exists');
     }
     db::o()->p($id)->delete('content', 'WHERE id=? LIMIT 1');
     if ($this->tstate) {
         db::o()->p($id)->delete('content_torrents', 'WHERE cid=? LIMIT 1');
         db::o()->p($id)->delete('content_downloaded', 'WHERE tid=? LIMIT 1');
         db::o()->p($id)->delete('content_peers', 'WHERE tid=? LIMIT 1');
         cache::o()->remove("details/l-id" . $id);
         $this->delete_files($posted_time, $poster_id, $screenshots);
     }
     try {
         plugins::o()->pass_data(array('id' => $id), true)->run_hook('content_delete');
     } catch (PReturn $e) {
         return $e->r();
     }
     db::o()->p($id)->delete('content_readed', 'WHERE content_id=? LIMIT 1');
     /* @var $etc etc */
     $etc = n("etc");
     $etc->add_res('content', -1, '', $poster_id);
     log_add("deleted_content", "user", array($title));
     users::o()->admin_mode();
     n("comments")->change_type('content')->clear($id);
     n("rating")->change_type('content')->clear($id);
     n("mailer")->change_type('content')->remove($id);
     if ($pid) {
         n("polls")->delete($pid);
     }
     users::o()->admin_mode(false);
 }
Esempio n. 27
0
function dce_convert($data, $input_format, $output_format = "none")
{
    log_add('<br><strong><span style="background-color:magenta;">Beginning conversion.</span><br><br>State:</strong><br><br><span style="background-color:skyblue;">Input format: ' . $input_format . '<br>Output format: ' . $output_format . '<br>Data: ' . $data . '</span><br>');
    log_add('<br><span style="background-color:magenta;"><strong>Beginning first step: If the input format and the output format are the same, return the input data.</strong></span><br>');
    if ($input_format == $output_format && $input_format != 'dc') {
        return $data;
    } else {
    }
    log_add('<br><span style="background-color:magenta;"><strong>Beginning second step: Detect one-step conversions (translators that have not been updated to the new system) and redirect them.</strong></span><br>');
    $one_steps = array('3_0a_old' => 'none', 'dce2txt' => 'none', 'dce2hex' => 'none', 'hex2dce' => 'none', 'legacy_cdce' => 'html_snippet', 'legacy_cdce' => 'html');
    if (array_key_exists($input_format, $one_steps)) {
        if ($one_steps[$input_format] == $output_format) {
            $onestep = true;
        } else {
            $onestep = false;
        }
    } else {
        $onestep = false;
    }
    log_add('<br><span style="background-color:magenta;"><strong>Beginning third step: If one-step conversions apply, perform them.</strong></span><br>');
    if ($onestep) {
        $onestep_function = 'onestep' . $input_format . '_to_' . $output_format;
        return $onestep_function($data);
    } else {
        log_add('<br><span style="background-color:magenta;"><strong>Beginning fourth step: Otherwise, convert the data to a Dc list.</strong></span><br>');
        $x_to_dc_function = 'convert_' . $input_format . '_to_dc';
        if (!function_exists($x_to_dc_function)) {
            return 'Unknown input format.';
            error_add('<font color="red">Error! Unknown input format.</font>');
        }
        $dc = $x_to_dc_function($data);
        $dc = preg_replace('/,\\Z/', '', $dc);
        $dc = str_replace(',,', ',0,', $dc);
        log_add('<br><span style="background-color:magenta;"><strong>Beginning fifth step: Convert the data to the chosen output format, and return a value.</strong></span><br>');
        $dc_to_x_function = 'convert_dc_to_' . $output_format . '_output';
        if (!function_exists($dc_to_x_function)) {
            return 'Unknown output format.';
            error_add('<font color="red">Error! Unknown output format.</font>');
        }
        return $dc_to_x_function($dc);
        log_add('<br><span style="background-color:magenta;"><strong>Finished conversion.</strong></span><br>');
    }
}
Esempio n. 28
0
        }
        $qFindPref = db_query("SELECT * FROM " . $sql_prefix . "_userPreferences WHERE userID = '" . db_escape($userID) . "' AND name = '{$prefname}'");
        $numFindPref = db_num($qFindPref);
        if ($numFindPref == 0) {
            db_query("INSERT INTO " . $sql_prefix . "_userPreferences\n\t\t\t\tSET userID = '" . db_escape($userID) . "',\n\t\t\t\tname = '{$prefname}',\n\t\t\t\tvalue = '" . db_escape($POST) . "'");
            $log_old[$prefname] = "FALSE";
            $log_new[$prefname] = $POST;
        } else {
            db_query("UPDATE " . $sql_prefix . "_userPreferences SET value = '" . db_escape($POST) . "'\n\t\t\t\tWHERE userID = '" . db_escape($userID) . "'\n\t\t\t\tAND name = '{$prefname}'");
            $rFindPref = db_fetch($qFindPref);
            $log_old[$prefname] = $rFindPref->value;
            $log_new[$prefname] = $POST;
        }
    }
    // End for
    log_add("edituser", "doEditPreferences", serialize($log_new), serialize($log_old));
    header("Location: ?module=edituserinfo&action=editPreferences&user={$userID}&change=success");
} elseif ($action == "profilePicture" && isset($_GET['user'])) {
    $user = $_GET['user'];
    $userAdmin_acl = acl_access("userAdmin", "", 1);
    if ($user == $sessioninfo->userID) {
    } elseif ($userAdmin_acl == 'Admin' || $userAdmin_acl == 'Write') {
    } else {
        die(lang("Not access to edit profile picture", "edituserinfo"));
    }
    $qFindProfile = db_query("SELECT * FROM " . $sql_prefix . "_files WHERE extra = '" . db_escape($user) . "' AND file_type = 'profilepic'");
    if (db_num($qFindProfile) > 0) {
        $rFindProfile = db_fetch($qFindProfile);
        $content .= "<img src='{$rFindProfile->file_path}'>";
    }
    $content .= '<form enctype="multipart/form-data" action="upload.php" method="POST">';
Esempio n. 29
0
        $content .= $rFindSoldTickets->resellerID;
        $content .= "</td><td>";
        $content .= date("Y/m/d H:i", $rFindSoldTickets->saleTime);
        $content .= "</td></tr>";
    }
    // End while
    $content .= "</table>";
} elseif ($action == "addTicket" && !empty($_GET['type'])) {
    $amount = $_POST['amount'];
    $type = $_GET['type'];
    if (acl_access("reseller", $type, $sessioninfo->eventID) == 'No') {
        die("No access to this ticketType");
    }
    while ($amount) {
        $md5 = md5(rand(0, 10000));
        $string = strtoupper(substr($md5, 0, 10));
        $qCheckAlreadyUsed = db_query("SELECT * FROM " . $sql_prefix . "_ticketReseller WHERE resellerTicketID = '{$string}'");
        if (db_num($qCheckAlreadyUsed) == 0) {
            // Key is not already used, use it
            db_query("INSERT INTO " . $sql_prefix . "_ticketReseller \n\t\t\t\tSET resellerTicketID = '{$string}',\n\t\t\t\tticketType = '" . db_escape($type) . "',\n\t\t\t\teventID = '{$sessioninfo->eventID}',\n\t\t\t\tresellerID = '{$sessioninfo->userID}',\n\t\t\t\tsaleTime = '" . time() . "'\n\t\t\t");
            $content .= "<h1>" . $string . "</h1><br />";
            $amount--;
        }
        // End if
    }
    // End while
    $log_new['type'] = $type;
    $log_new['amount'] = $amount;
    log_add("reseller", "addTicket", serialize($log_new));
}
// End addTicket
Esempio n. 30
0
    $log_new['question'] = $question;
    $log_new['answer'] = $answer;
    log_add("FAQ", "doEditFAQ", serialize($log_new));
    header("Location: ?module=FAQ&action=adminFAQs");
} elseif ($action == "addFAQ") {
    // Do ACL-check if you have rights to do this
    if ($acl_access != 'Admin') {
        die("You have to have admin-rights to administer FAQs");
    }
    // Add a new FAQ-items
    $question = $_POST['question'];
    db_query("INSERT INTO " . $sql_prefix . "_FAQ SET\n\t\tquestion = '" . db_escape($question) . "',\n\t\teventID = '" . db_escape($eventID) . "'");
    // Find out what the hell we just did
    $qLastID = db_query("SELECT ID FROM " . $sql_prefix . "_FAQ WHERE \n\t\teventID = " . db_escape($eventID) . "\n\t\tAND question = '" . db_escape($question) . "'\n\t\tORDER BY ID DESC LIMIT 0,1");
    $rLastID = db_fetch($qLastID);
    $log_new['faqID'] = $rLastID->ID;
    $log_new['question'] = $question;
    log_add("FAQ", "addFAQ", serialize($log_new));
    // Jump to edit-mode for this FAQ
    header("Location: ?module=FAQ&action=editFAQ&faqID={$rLastID->ID}");
} elseif ($action == "deleteFAQ" && !empty($faqID)) {
    /* Delete FAQ */
    // Do ACL-check if you have rights to do this
    if ($acl_access != 'Admin') {
        die("You have to have admin-rights to administer FAQs");
    }
    db_query("DELETE FROM " . $sql_prefix . "_FAQ\n\t\tWHERE ID = " . db_escape($faqID) . "\n\t\tAND eventID = " . db_escape($eventID));
    log_add("FAQ", "deleteFAQ", serialize($faqID));
    header("Location: ?module=FAQ&action=adminFAQs");
}
// End action == deleteFAQ