当前位置: 首页>>代码示例>>PHP>>正文


PHP Fix_Quotes函数代码示例

本文整理汇总了PHP中Fix_Quotes函数的典型用法代码示例。如果您正苦于以下问题:PHP Fix_Quotes函数的具体用法?PHP Fix_Quotes怎么用?PHP Fix_Quotes使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了Fix_Quotes函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: mail_password

function mail_password()
{
    global $user_prefix, $db, $pagetitle, $userinfo;
    if ((!isset($_POST['lost_username']) || empty($_POST['lost_username'])) && (!isset($_POST['lost_email']) || empty($_POST['lost_email']))) {
        cpg_error('Please enter either a username or email address');
    }
    if (isset($_POST['lost_username']) && (!isset($_POST['lost_email']) || empty($_POST['lost_email']))) {
        $username = Fix_Quotes($_POST['lost_username']);
        if (empty($username) || strtolower($username) == 'anonymous') {
            cpg_error('Invalid username');
        }
        $sql = "username='{$username}'";
    } else {
        $sql = "user_email='" . Fix_Quotes($_POST['lost_email']) . "'";
    }
    $result = $db->sql_query('SELECT username, user_email, user_password, user_level FROM ' . $user_prefix . '_users WHERE ' . $sql);
    $pagetitle .= ' ' . _BC_DELIM . ' ' . _PASSWORDLOST;
    if ($db->sql_numrows($result) != 1) {
        cpg_error(_SORRYNOUSERINFO);
    } else {
        $row = $db->sql_fetchrow($result);
        $username = $row['username'];
        if ($row['user_level'] > 0) {
            global $sitename, $MAIN_CFG;
            $code = $_POST['code'];
            $areyou = substr($row['user_password'], 0, 10);
            $from = 'noreply@' . str_replace('www.', '', $MAIN_CFG['server']['domain']);
            if ($areyou == $code) {
                $newpass = make_pass(8, 5);
                $message = _USERACCOUNT . " '{$username}' " . _AT . " {$sitename} " . _HASTHISEMAIL . "  " . _AWEBUSERFROM . " " . decode_ip($userinfo["user_ip"]) . " " . _HASREQUESTED . "\n\n" . _YOURNEWPASSWORD . " {$newpass}\n\n " . _YOUCANCHANGE . " " . URL::index('Your_Account', true, true) . "\n\n" . _IFYOUDIDNOTASK;
                $subject = _USERPASSWORD4 . " {$username}";
                if (!send_mail($mailer_message, $message, 0, $subject, $row['user_email'], $username, $from)) {
                    cpg_error($mailer_message);
                }
                // Next step: add the new password to the database
                $cryptpass = md5($newpass);
                $query = "UPDATE " . $user_prefix . "_users SET user_password='{$cryptpass}' WHERE username='{$username}'";
                if (!$db->sql_query($query)) {
                    cpg_error(_UPDATEFAILED);
                }
                cpg_error(_PASSWORD4 . " {$username} " . _MAILED, _TB_INFO, URL::index());
                // If no code, send it
            } else {
                $message = _USERACCOUNT . " '{$username}' " . _AT . " {$sitename} " . _HASTHISEMAIL . " " . _AWEBUSERFROM . " " . decode_ip($userinfo["user_ip"]) . " " . _CODEREQUESTED . "\n\n" . _YOURCODEIS . " {$areyou} \n\n" . _WITHTHISCODE . " " . URL::index('&op=pass_lost', true, true) . "\n" . _IFYOUDIDNOTASK2;
                $subject = _CODEFOR . " {$username}";
                if (!send_mail($mailer_message, $message, 0, $subject, $row['user_email'], $username, $from)) {
                    cpg_error($mailer_message);
                }
                cpg_error(_CODEFOR . " {$username} " . _MAILED, _TB_INFO, URL::index('&op=pass_lost'));
            }
        } elseif ($row['user_level'] == 0) {
            cpg_error(_ACCSUSPENDED);
        } elseif ($row['user_level'] == -1) {
            cpg_error(_ACCDELETED);
        }
    }
}
开发者ID:cbsistem,项目名称:nexos,代码行数:57,代码来源:index.php

示例2: get_post_var

function get_post_var($var, $pid, $html2bb = false)
{
    $var_name = $var . $pid;
    if (!isset($_POST[$var_name])) {
        cpg_die(_CRITICAL_ERROR, PARAM_MISSING . " ({$var_name})", __FILE__, __LINE__);
    }
    if ($html2bb) {
        return Fix_Quotes(html2bb($_POST[$var_name]));
    } else {
        return Fix_Quotes($_POST[$var_name], 1);
    }
}
开发者ID:cbsistem,项目名称:nexos,代码行数:12,代码来源:editpics.php

示例3: automated_news

function automated_news()
{
    global $prefix, $currentlang, $db;
    $result = $db->sql_query('SELECT * FROM ' . $prefix . '_autonews WHERE time<=' . time());
    while ($row2 = $db->sql_fetchrow($result, SQL_ASSOC)) {
        $title = Fix_Quotes($row2['title']);
        $hometext = Fix_Quotes($row2['hometext']);
        $bodytext = Fix_Quotes($row2['bodytext']);
        $notes = Fix_Quotes($row2['notes']);
        $db->sql_query('INSERT INTO ' . $prefix . '_stories (sid, catid, aid, title, time, hometext, bodytext, comments, counter, topic, informant, notes, ihome, alanguage, acomm, haspoll, poll_id, score, ratings, associated, display_order) ' . "VALUES (DEFAULT, '{$row2['catid']}', '{$row2['aid']}', '{$title}', '{$row2['time']}', '{$hometext}', '{$bodytext}', '0', '0', '{$row2['topic']}', '{$row2['informant']}', '{$notes}', '{$row2['ihome']}', '{$row2['alanguage']}', '{$row2['acomm']}', '0', '0', '0', '0', '{$row2['associated']}', 0)");
    }
    if ($db->sql_numrows($result)) {
        $db->sql_query('DELETE FROM ' . $prefix . '_autonews WHERE time<=' . time());
    }
    $db->sql_freeresult($result);
}
开发者ID:cbsistem,项目名称:nexos,代码行数:16,代码来源:functions.php

示例4: online

function online()
{
    global $userinfo, $prefix, $db, $module_title, $SESS, $mainindex;
    if ($SESS->dbupdate) {
        $url = URL::uri();
        $uname = $SESS->sess_id;
        $guest = 1;
        if (is_user()) {
            $uname = $userinfo['username'];
            $guest = 0;
        } elseif (SEARCHBOT) {
            $uname = SEARCHBOT;
            $guest = 3;
        }
        if (is_admin()) {
            global $CLASS;
            if ($guest == 1) {
                $uname = $CLASS['member']->admin['aid'];
            }
            $guest = 2;
            if (defined('ADMIN_PAGES')) {
                $url = $mainindex;
            }
        }
        $uname = Fix_Quotes($uname);
        if (empty($uname)) {
            return;
        }
        # something screwey
        $ctime = time();
        $custom_title = Fix_Quotes($module_title ? $module_title : _HOME);
        $url = Fix_Quotes(str_replace('&', '&amp;', $url));
        if ($db->sql_count($prefix . '_session', "uname='{$uname}'")) {
            $db->sql_query('UPDATE ' . $prefix . "_session SET time='{$ctime}', module='{$custom_title}', url='{$url}', guest='{$guest}' WHERE uname='{$uname}'", true);
        } else {
            $db->sql_query('INSERT INTO ' . $prefix . "_session (uname, time, host_addr, guest, module, url) VALUES ('{$uname}', '{$ctime}', {$userinfo['user_ip']}, '{$guest}', '{$custom_title}', '{$url}')", true);
        }
    }
}
开发者ID:cbsistem,项目名称:nexos,代码行数:39,代码来源:header.php

示例5: IN

         if (!$value['auth_read']) {
             $ignore_forum_sql .= ($ignore_forum_sql != '' ? ', ' : '') . $key;
         }
     }
     if ($ignore_forum_sql != '') {
         $auth_sql .= $auth_sql != '' ? " AND f.forum_id NOT IN ({$ignore_forum_sql}) " : "f.forum_id NOT IN ({$ignore_forum_sql}) ";
     }
 }
 //
 // Author name search
 //
 if ($search_author != '') {
     if (preg_match('#^[\\*%]+$#', trim($search_author)) || preg_match('#^[^\\*]{1,2}$#', str_replace(array('*', '%'), '', trim($search_author)))) {
         $search_author = '';
     }
     $search_author = str_replace('*', '%', trim(Fix_Quotes($search_author)));
 }
 if ($total_match_count) {
     if ($show_results == 'topics') {
         //
         // This one is a beast, try to seperate it a bit (workaround for connection timeouts)
         //
         $search_id_chunks = array();
         $count = 0;
         $chunk = 0;
         if (count($search_ids) > $limiter) {
             for ($i = 0; $i < count($search_ids); $i++) {
                 if ($count == $limiter) {
                     $chunk++;
                     $count = 0;
                 }
开发者ID:cbsistem,项目名称:nexos,代码行数:31,代码来源:search.php

示例6: search_attachments

function search_attachments($order_by, &$total_rows)
{
    global $db, $_POST, $_GET, $lang;
    $where_sql = array();
    //
    // Get submitted Vars
    //
    $search_vars = array('search_keyword_fname', 'search_keyword_comment', 'search_author', 'search_size_smaller', 'search_size_greater', 'search_count_smaller', 'search_count_greater', 'search_days_greater', 'search_forum', 'search_cat');
    for ($i = 0; $i < count($search_vars); $i++) {
        if (isset($_POST[$search_vars[$i]]) || isset($_GET[$search_vars[$i]])) {
            ${$search_vars}[$i] = isset($_POST[$search_vars[$i]]) ? $_POST[$search_vars[$i]] : $_GET[$search_vars[$i]];
        } else {
            ${$search_vars}[$i] = '';
        }
    }
    //
    // Author name search
    //
    if ($search_author != '') {
        $search_author = str_replace('*', '%', trim(Fix_Quotes($search_author)));
        //
        // We need the post_id's, because we want to query the Attachment Table
        //
        $result = $db->sql_query('SELECT user_id FROM ' . USERS_TABLE . ' WHERE username LIKE \'' . $search_author . '\'');
        $matching_userids = '';
        if ($row = $db->sql_fetchrow($result)) {
            do {
                $matching_userids .= ($matching_userids != '' ? ', ' : '') . $row['user_id'];
            } while ($row = $db->sql_fetchrow($result));
        } else {
            message_die(GENERAL_MESSAGE, $lang['No_attach_search_match']);
        }
        $where_sql[] = ' (t.user_id_1 IN (' . $matching_userids . ')) ';
    }
    //
    // Search Keyword
    //
    if ($search_keyword_fname != '') {
        $match_word = str_replace('*', '%', $search_keyword_fname);
        $where_sql[] = ' (a.real_filename LIKE \'' . $match_word . '\') ';
    }
    if ($search_keyword_comment != '') {
        $match_word = str_replace('*', '%', $search_keyword_comment);
        $where_sql[] = ' (a.comment LIKE \'' . $match_word . '\') ';
    }
    //
    // Search Download Count
    //
    if ($search_count_smaller != '' || $search_count_greater != '') {
        if ($search_count_smaller != '') {
            $where_sql[] = ' (a.download_count < ' . $search_count_smaller . ') ';
        } else {
            if ($search_count_greater != '') {
                $where_sql[] = ' (a.download_count > ' . $search_count_greater . ') ';
            }
        }
    }
    //
    // Search Filesize
    //
    if ($search_size_smaller != '' || $search_size_greater != '') {
        if ($search_size_smaller != '') {
            $where_sql[] = ' (a.filesize < ' . $search_size_smaller . ') ';
        } else {
            if ($search_size_greater != '') {
                $where_sql[] = ' (a.filesize > ' . $search_size_greater . ') ';
            }
        }
    }
    //
    // Search Attachment Time
    //
    if ($search_days_greater != '') {
        $where_sql[] = ' (a.filetime < ' . (time() - $search_days_greater * 86400) . ') ';
    }
    $sql = 'SELECT a.*, t.post_id, p.post_time, p.topic_id
	FROM ' . ATTACHMENTS_TABLE . ' t, ' . ATTACHMENTS_DESC_TABLE . ' a, ' . POSTS_TABLE . ' p WHERE ';
    if (count($where_sql) > 0) {
        $sql .= implode('AND', $where_sql) . ' AND ';
    }
    $sql .= '(t.post_id = p.post_id) AND (a.attach_id = t.attach_id) ';
    $total_rows_sql = $sql;
    $sql .= $order_by;
    $result = $db->sql_query($sql);
    $attachments = $db->sql_fetchrowset($result);
    $num_attach = $db->sql_numrows($result);
    if ($num_attach == 0) {
        message_die(GENERAL_MESSAGE, $lang['No_attach_search_match']);
    }
    $result = $db->sql_query($total_rows_sql);
    $total_rows = $db->sql_numrows($result);
    return $attachments;
}
开发者ID:cbsistem,项目名称:nexos,代码行数:93,代码来源:functions_admin.php

示例7: htmlprepare

             $fields[$f_field] = htmlprepare($val);
         }
     }
 }
 check_dl_details($_POST['in'], $errors);
 if ($db->sql_count($dl_prefix . '_mirrors', "did={$mng_id}") < 1) {
     $errors[] = 'You must specify at least 1 download URL';
 }
 if (empty($errors)) {
     $fields['title'] = Fix_Quotes($in['title'], true);
     $fields['screen'] = $in['screen'];
     $fields['cid'] = intval($in['cat']);
     $fields['desc_short'] = Fix_Quotes($in['desc_short'], true);
     $fields['desc_long'] = Fix_Quotes($in['desc_long'], true);
     $fields['name'] = Fix_Quotes($in['name'], true);
     $fields['email'] = Fix_Quotes($in['email'], true);
     $fields['active'] = can_admin($module_name) ? 1 : 2;
     $fields['access'] = can_admin($module_name) ? intval($in['access']) : 0;
     $fields['submitter'] = is_user() ? $userinfo['user_id'] : 'admin';
     $db->sql_query("INSERT INTO " . $dl_prefix . "_downloads \n\t\t\t\t(lid, cid, active, access, title, screen, desc_short, desc_long, date, name, email, submitter" . $field_list . ") \n\t\t\t\tVALUES \n\t\t\t\t(DEFAULT, '{$fields['cid']}', {$fields['active']}, '{$fields['access']}', '{$fields['title']}', '{$fields['screen']}', '{$fields['desc_short']}', '{$fields['desc_long']}', '" . time() . "', '{$fields['name']}', '{$fields['email']}', '{$fields['submitter']}'" . $value_list . ")");
     $next_id = $db->sql_nextid('lid');
     $db->sql_query("UPDATE " . $dl_prefix . "_mirrors \n\t\t\t\tSET did={$next_id} \n\t\t\t\tWHERE did={$mng_id}");
     $db->sql_query("UPDATE " . $dl_prefix . "_screenshots \n\t\t\t\tSET did={$next_id} \n\t\t\t\tWHERE did={$mng_id}");
     if (can_admin($module_name)) {
         $time = time();
         $time_year = generate_date($time, 'Y');
         $time_month = generate_date($time, 'm');
         $db->sql_query("INSERT INTO " . $dl_prefix . "_stats \n\t\t\t\t(id, year, month, hits, views) \n\t\t\t\tVALUES \n\t\t\t\t('{$next_id}', '{$time_year}', '{$time_month}', 0, 0)");
     }
     if ($fields['version']) {
         $db->sql_query("INSERT INTO " . $dl_prefix . "_history \n\t\t\t\t(id, vers, author, date, comment) \n\t\t\t\tVALUES \n\t\t\t\t({$next_id}, '{$fields['version']}', '{$fields['submitter']}', " . time() . ", 'Initial Version')");
开发者ID:cbsistem,项目名称:nexos,代码行数:31,代码来源:add.php

示例8: htmlprepare

        $cpgtpl->assign_vars(array('EDITLINK' => false, 'EDITCAT' => true, 'S_URL' => _URL, 'S_CPG_MMOPTIONAL' => _CPG_MMOPTIONAL, 'MODE' => $mode, 'CID' => $cid, 'S_CATNAME_VALUE' => htmlprepare($cat['name']), 'S_CATIMAGE_VALUE' => $cat['image'], 'S_CATLINK_VALUE' => $cat['link'], 'S_SUBMIT_VALUE' => $mode != 'new' ? _SAVECHANGES : _CPG_MMADDCAT, 'SEL_LINKTYPE' => select_box('lnktype', $cat['link_type'], array(0 => 'getlink', 1 => 'link', 2 => 'web'))));
        $cpgtpl->set_handle('body', 'admin/cpgmm_edit.html');
        $cpgtpl->display('body');
    } else {
        cpg_error(_CPG_MMNOCAT);
    }
} elseif (isset($_GET['savecat'])) {
    if ($_POST['catname'] == '') {
        cpg_error(_CPG_MMCATEMPTY);
    }
    if ($_GET['savecat'] == 'mod') {
        $db->sql_query("UPDATE " . $prefix . "_modules_cat SET name='" . Fix_Quotes($_POST['catname']) . "', image='{$_POST['catimage']}', link='{$_POST['catlink']}', link_type='{$_POST['lnktype']}' WHERE cid=" . intval($_POST['cid']));
    } else {
        list($pos) = $db->sql_ufetchrow("SELECT pos FROM " . $prefix . "_modules_cat \n\t\t\tORDER BY pos DESC", SQL_NUM);
        $pos = empty($pos) ? 0 : $pos + 1;
        $db->sql_query("INSERT INTO " . $prefix . "_modules_cat (name, image, pos, link, link_type) VALUES ('" . Fix_Quotes($_POST['catname']) . "', '{$_POST['catimage']}', '{$pos}', '{$_POST['catlink']}', '{$_POST['lnktype']}')");
    }
    URL::redirect(URL::admin('cpgmm'));
} elseif ($mode == 'delcat' && intval($_GET['cid']) > 0) {
    $cid = intval($_GET['cid']);
    $result = $db->sql_query("SELECT name FROM " . $prefix . "_modules_cat WHERE cid=" . $cid);
    if ($db->sql_numrows($result) > 0) {
        $cat = $db->sql_fetchrow($result);
        if (isset($_GET['ok'])) {
            $db->sql_query("UPDATE " . $prefix . "_modules_links SET cat_id=0 WHERE cat_id=" . $cid);
            $db->sql_query("UPDATE " . $prefix . "_modules SET cat_id=0 WHERE cat_id=" . $cid);
            $db->sql_query("DELETE FROM " . $prefix . "_modules_cat WHERE cid=" . $cid);
            URL::redirect(URL::admin('cpgmm'));
        }
        $cat['name'] = defined($cat['name']) ? constant($cat['name']) : $cat['name'];
        $pagetitle .= ' ' . _BC_DELIM . ' Delete Category: ' . $cat['name'];
开发者ID:cbsistem,项目名称:nexos,代码行数:31,代码来源:cpgmm.php

示例9: Process_Form

function Process_Form()
{
    // Processes the form, writes the updated file
    //
    // returns the number of bytes written and status messages, which it
    // gets from Write_File
    //
    include "msre_function_global_vars.php";
    $new_file = array();
    $bytes = 0;
    $status_msg = "";
    // Debugging... this displays all my post vars for me
    /*
    echo "<span class=\"debug\">\n";
    echo "POST vars:<br>\n";
    foreach ($_POST as $key => $value) {
        echo "$key: $value<br>\n";
    }
    echo "</span>\n";
    */
    // mmkay... what we'll want to do here is write out
    // a new file with the updated rules that the user has
    // just saved.  Rather than trying to edit the file every
    // time, I'm just going to overwrite it each time.
    // But that means that I need to keep comments on the top...
    // look thru the file, and grab comments on the top,
    // stopping when we have reached a non-comment line
    $previous_line = "";
    $first_line = true;
    foreach (preg_split("/\n/", $file_contents) as $line) {
        if ($line == "" or substr($line, 0, 1) == "#" and !preg_match("/#DISABLED#/", $line)) {
            if (!$first_line) {
                $new_file[] = $previous_line . "\n";
            }
        } else {
            break;
        }
        $previous_line = $line;
        $first_line = false;
    }
    // to make my life easier (or possibly harder), I'm going
    // to re-arrange the rule varibles from the _POST var
    // into a single multi-dimensional array that will hold
    // all the info i need for the rules.
    $new_ruleset = array();
    // I should know the number of rules I have... right?
    // we do <= so that we can check for the add rule thingy,
    // which will end up being on the end of the ruleset
    // Also, we will be pulling out the "default" rule, if
    // it exists, because we want to tack that back onto
    // the end of the ruleset when we're done (default should
    // stay @ the bottom)
    $default_direction = "FromOrTo:";
    $default_action = "";
    $default_desc = "";
    for ($i = -1; $i <= $_POST["rule_count"]; $i++) {
        $rule_prefix = "rule" . $i . "_";
        $description = $rule_prefix . "description";
        $direction = $rule_prefix . "direction";
        $target = $rule_prefix . "target";
        $and = $rule_prefix . "and";
        $and_direction = $rule_prefix . "and_direction";
        $and_target = $rule_prefix . "and_target";
        $action = $rule_prefix . "action";
        $rule_action = $rule_prefix . "rule_action";
        // we need to remove any "magic quoting" from the description, target,
        // and action fields, so that it doesn't put it into the file
        if (isset($_POST[$description])) {
            $_POST[$description] = Fix_Quotes($_POST[$description]);
        } else {
            $_POST[$description] = "";
        }
        //echo "$description: " . $_POST[$description] . "<br>\n";
        // check for "default" rule
        if (isset($_POST[$target])) {
            $_POST[$target] = Fix_Quotes($_POST[$target]);
        } else {
            $_POST[$target] = "default";
        }
        // strip out any embedded blanks from Target
        $_POST[$target] = str_replace(" ", "", $_POST[$target]);
        if (!isset($_POST[$and_direction])) {
            $_POST[$and_direction] = "";
        }
        if (isset($_POST[$and_target])) {
            $_POST[$and_target] = Fix_Quotes($_POST[$and_target]);
        } else {
            $_POST[$and_target] = "";
        }
        // strip out any embedded blanks from AndTarget
        $_POST[$and_target] = str_replace(" ", "", $_POST[$and_target]);
        if (isset($_POST[$action])) {
            $_POST[$action] = Fix_Quotes($_POST[$action]);
        } else {
            $_POST[$action] = "";
        }
        // On no account allow invalid rule
        // Target and Action must both have values
        // delete rule if they don't
        if ($_POST[$target] == "" or $_POST[$action] == "") {
//.........这里部分代码省略.........
开发者ID:rafaelbsd,项目名称:1.2.0,代码行数:101,代码来源:msre_edit.php

示例10: log_serializer

 private static function log_serializer($log)
 {
     for ($i = 0; $i < count($log); ++$i) {
         foreach ($log[$i] as $key => $val) {
             $log[$i][$key] = Fix_Quotes($val, true);
         }
     }
     return serialize($log);
 }
开发者ID:cbsistem,项目名称:nexos,代码行数:9,代码来源:security.php

示例11: sprintf

         $row = $db->sql_fetchrowset($result);
         $num_rows = $db->sql_numrows($result);
         if ($num_rows > 0) {
             for ($i = 0; $i < $num_rows; $i++) {
                 if ($row[$i]['quota_desc'] == $quota_desc) {
                     $error = TRUE;
                     if (isset($error_msg)) {
                         $error_msg .= '<br />';
                     }
                     $error_msg .= sprintf($lang['Quota_limit_exist'], $extension_group);
                 }
             }
         }
         if (!$error) {
             $filesize = $size_select == 'kb' ? round($filesize * 1024) : ($size_select == 'mb' ? round($filesize * 1048576) : $filesize);
             $sql = "INSERT INTO " . QUOTA_LIMITS_TABLE . " (quota_desc, quota_limit)\n\t\t\tVALUES ('" . Fix_Quotes($quota_desc) . "', " . $filesize . ")";
             $db->sql_query($sql);
         }
     }
     if (!$error) {
         $message = $lang['Attach_config_updated'] . '<br /><br />' . sprintf($lang['Click_return_attach_config'], '<a href="' . URL::admin("&amp;do=attachments&amp;mode=quota") . '">', '</a>') . '<br /><br />' . sprintf($lang['Click_return_admin_index'], '<a href="' . URL::admin("Forums") . '">', '</a>');
         message_die(GENERAL_MESSAGE, $message);
         return;
     }
 } else {
     if ($mode == 'quota') {
         $template->set_filenames(array('body' => 'forums/admin/attach_quota_body.html'));
         $max_add_filesize = intval($attach_config['max_filesize']);
         $size = $max_add_filesize >= 1048576 ? 'mb' : ($max_add_filesize >= 1024 ? 'kb' : 'b');
         if ($max_add_filesize >= 1048576) {
             $max_add_filesize = round($max_add_filesize / 1048576 * 100) / 100;
开发者ID:cbsistem,项目名称:nexos,代码行数:31,代码来源:admin_attachments.php

示例12: upgrade

    public function upgrade($prev_version)
    {
        global $db, $prefix, $installer, $userinfo;
        if (version_compare($prev_version, '3', '<')) {
            $this->new_tables();
            $installer->add_query('DROP', $this->prefix . '_modrequest');
            $installer->add_query('DROP', $this->prefix . '_newdownload');
            $installer->add_query('DROP', $this->prefix . '_editorials');
            $installer->add_query('DROP', $this->prefix . '_votedata');
            $installer->add_query('DEL', $this->prefix . '_categories', 'ldescription');
            //			$installer->add_query('DEL', $this->prefix.'_downloads', 'FOREIGN KEY sid');
            $installer->add_query('DEL', $this->prefix . '_downloads', 'INDEX sid');
            $installer->add_query('DEL', $this->prefix . '_downloads', 'INDEX title');
            $installer->add_query('DEL', $this->prefix . '_downloads', 'COLUMN sid, DROP COLUMN downloadratingsummary, DROP COLUMN totalvotes, DROP COLUMN totalcomments');
            $installer->add_query('CHANGE', $this->prefix . '_downloads', 'description desc_long TEXT');
            $installer->add_query('CHANGE', $this->prefix . '_downloads', 'date date int UNSIGNED NOT NULL default ' . time());
            $installer->add_query('ADD', $this->prefix . '_downloads', 'screen INT NOT NULL DEFAULT 0 AFTER url');
            $installer->add_query('ADD', $this->prefix . '_downloads', 'desc_short varchar(255) NOT NULL AFTER screen');
            $installer->add_query('ADD', $this->prefix . '_downloads', 'notes text NOT NULL AFTER desc_long');
            $installer->add_query('ADD', $this->prefix . '_downloads', 'active TINYINT NOT NULL DEFAULT 1 AFTER cid');
            $installer->add_query('ADD', $this->prefix . '_downloads', 'updated int UNSIGNED NOT NULL DEFAULT 0 AFTER date');
            $installer->add_query('ADD', $this->prefix . '_downloads', 'compat varchar(255) NOT NULL AFTER homepage');
            $installer->add_query('ADD', $this->prefix . '_downloads', 'pick TINYINT NOT NULL DEFAULT 0');
            $installer->add_query('ADD', $this->prefix . '_downloads', 'access TINYINT NOT NULL DEFAULT 0 AFTER active');
            $time = time();
            $time_year = intval(L10NTime::date('Y', $time, $userinfo['user_dst'], $userinfo['user_timezone']));
            $time_month = intval(L10NTime::date('m', $time, $userinfo['user_dst'], $userinfo['user_timezone'])) - 1;
            if ($time_month < 1) {
                $time_month = 12;
                $time_year -= 1;
            }
            $result = $db->sql_uquery("SELECT lid, UNIX_TIMESTAMP(date), hits FROM " . $prefix . '_' . $this->prefix . "_downloads");
            while ($row = $db->sql_fetchrow($result)) {
                $installer->add_query('UPDATE', $this->prefix . '_downloads', "date='" . Fix_Quotes($row[1]) . "' WHERE lid='" . $row[0] . "'");
                $installer->add_query('INSERT', $this->prefix . '_stats', "'" . $row[0] . "', '{$time_year}', '{$time_month}', '" . $row[3] . "', 0");
            }
            $installer->add_query('DEL', $this->prefix . '_downloads', 'hits');
            $this->new_config();
            $result = $db->sql_uquery("SELECT lid, url, filesize FROM " . $prefix . '_' . $this->prefix . "_downloads");
            while ($row = $db->sql_fetchrow($result, SQL_NUM)) {
                if (ereg('://', $row[1])) {
                    $row[2] = intval($row[2]);
                    $row[3] = 'N/A';
                } else {
                    $row[2] = intval(filesize($row[2]));
                    $row[3] = md5_file($row[2]);
                    clearstatcache();
                }
                $installer->add_query('INSERT', $this->prefix . '_mirrors', "'NULL', '" . $row[0] . "', '" . Fix_Quotes($row[1]) . "', '', " . $row[2] . ", '" . $row[3] . "', 0");
            }
            $installer->add_query('DEL', $this->prefix . '_downloads', 'url');
        }
        // end upgrade < 3.0.0.0
        // 3.0.0.0 upgrade SPECIAL for multi-screenshot system
        if (version_compare($prev_version, '3.0.0.1', '<')) {
            $installer->add_query('CHANGE', $this->prefix . '_downloads', 'screen screen INT NOT NULL DEFAULT 0');
            $db->sql_query('CREATE TABLE ' . $prefix . '_' . $this->prefix . '_screenshots (
				id int(11) NOT NULL auto_increment,
				did int(11) DEFAULT 0 NOT NULL,
				url varchar(255) NOT NULL,
				uploaded tinyint(4) DEFAULT 0 NOT NULL,
				PRIMARY KEY (id))');
            $result = $db->sql_query("SELECT lid, screen FROM " . $prefix . '_' . $this->prefix . "_downloads");
            while ($row = $db->sql_fetchrow($result, SQL_NUM)) {
                if (!empty($row[1])) {
                    $db->sql_query('INSERT INTO ' . $prefix . '_' . $this->prefix . "_screenshots VALUES (NULL, '" . $row[0] . "', '" . $row[1] . "', 0)");
                    $installer->add_query('UPDATE', $this->prefix . '_downloads', "screen='" . $db->sql_nextid('id') . "' WHERE lid='" . $row[0] . "'");
                }
            }
        }
        if (version_compare($prev_version, '3.0.0.2', '<')) {
            $installer->add_query('INSERT', 'config_custom', '"' . $this->prefix . '", "anon_dl_remote", 1');
            $installer->add_query('INSERT', 'config_custom', '"' . $this->prefix . '", "use_fetch_remote", 1');
        }
        if (version_compare($prev_version, '3.0.0.3', '<')) {
            $installer->add_query('ADD', $this->prefix . '_ratings', 'active TINYINT NOT NULL DEFAULT 1 AFTER uid');
            $installer->add_query('INSERT', 'config_custom', '"' . $this->prefix . '", "r_active", 1');
            $installer->add_query('INSERT', 'config_custom', '"' . $this->prefix . '", "r_queue", 0');
        }
        if (version_compare($prev_version, '3.0.0.4', '<')) {
            $installer->add_query('ADD', $this->prefix . '_broken', 'mid INT NOT NULL DEFAULT 0 AFTER lid');
        }
        if (version_compare($prev_version, '3.0.0.5', '<')) {
            $installer->add_query('INDEX', $this->prefix . '_downloads', 'active', 'active');
            $installer->add_query('INDEX', $this->prefix . '_stats', 'id', 'id');
        }
        if (version_compare($prev_version, '3.0.0.6', '<')) {
            $installer->add_query('INSERT', 'config_custom', '"' . $this->prefix . '", "md5_local", 1');
            $installer->add_query('INSERT', 'config_custom', '"' . $this->prefix . '", "md5_remote", 1');
        }
        if (version_compare($prev_version, '3.0.0.7', '<')) {
            $installer->add_query('INSERT', 'config_custom', '"' . $this->prefix . '", "screen_max", 10');
        }
        if (version_compare($prev_version, '3.0.0.8', '<')) {
            $installer->add_query('INSERT', 'config_custom', '"' . $this->prefix . '", "pub_mirror", 1');
            $installer->add_query('ADD', $this->prefix . '_mirrors', 'uid mediumint(8) UNSIGNED NOT NULL DEFAULT 0 AFTER did');
            $installer->add_query('ADD', $this->prefix . '_mirrors', 'active TINYINT NOT NULL DEFAULT 1');
            $result = $db->sql_query("SELECT lid, submitter FROM " . $prefix . '_' . $this->prefix . "_downloads");
            while ($row = $db->sql_fetchrow($result, SQL_NUM)) {
                $installer->add_query('UPDATE', $this->prefix . '_mirrors', "uid='" . $row[1] . "' WHERE did='" . $row[0] . "'");
//.........这里部分代码省略.........
开发者ID:cbsistem,项目名称:nexos,代码行数:101,代码来源:cpg_inst.php

示例13: while

        while ($badname = $db->sql_fetchrow($nameresult)) {
            if ($username == $badname[0]) {
                $error = _SHOUTUSERBAN;
            }
        }
        $db->sql_freeresult($nameresult);
    }
    //look for bad words, then censor them.
    if ($shoutconf['censor']) {
        $comment = check_words($comment);
    }
    //if error just reload page, else add posting.
    if ($error) {
        cpg_error($error);
    } else {
        $db->sql_query("INSERT INTO " . $prefix . "_shoutblock VALUES (NULL, '" . Fix_Quotes($username) . "', '" . Fix_Quotes($comment) . "', '" . gmtime() . "')");
        url_redirect($CPG_SESS['user']['uri']);
    }
}
function nav_shouts()
{
    global $prefix, $db, $offset, $number, $shoutconf, $userinfo;
    $offset = intval($offset);
    $result = $db->sql_query("SELECT * FROM " . $prefix . "_shoutblock ORDER BY id DESC LIMIT {$offset},25");
    $loop = $db->sql_numrows($result);
    while ($row = $db->sql_fetchrow($result)) {
        echo '<div class="content">';
        $row[2] = set_smilies($row[2]);
        echo '<a href="' . getlink('Your_Account&amp;profile=' . $row[1]) . '"><strong>' . $row[1] . ':</strong></a>';
        if ($shoutconf['date']) {
            echo formatDateTime($row[3], '%d-%b-%Y ');
开发者ID:cbsistem,项目名称:nexos,代码行数:31,代码来源:index.php

示例14: sprintf

        $row = $db->sql_fetchrowset($result);
        $num_rows = $db->sql_numrows($result);
        if ($num_rows > 0) {
            for ($i = 0; $i < $num_rows; $i++) {
                if ($row[$i]['group_name'] == $extension_group) {
                    $error = TRUE;
                    if ($error_msg != '') {
                        $error_msg .= '<br />';
                    }
                    $error_msg .= sprintf($lang['Extension_group_exist'], $extension_group);
                }
            }
        }
        if (!$error) {
            $filesize = $size_select == 'kb' ? round($filesize * 1024) : ($size_select == 'mb' ? round($filesize * 1048576) : $filesize);
            $sql = "INSERT INTO " . EXTENSION_GROUPS_TABLE . " (group_name, cat_id, allow_group, download_mode, upload_icon, max_filesize)\n\t\t\tVALUES ('" . Fix_Quotes($extension_group) . "', " . $cat_id . ", " . $is_allowed . ", " . $download_mode . ", '" . $upload_icon . "', " . $filesize . ")";
            $db->sql_query($sql);
        }
    }
    if (!$error) {
        $message = $lang['Attach_config_updated'] . '<br /><br />' . sprintf($lang['Click_return_attach_config'], '<a href="' . URL::admin("&amp;do=extensions&amp;mode=groups") . '">', '</a>') . '<br /><br />' . sprintf($lang['Click_return_admin_index'], '<a href="' . URL::admin("forums") . '">', '</a>');
        message_die(GENERAL_MESSAGE, $message);
    }
}
if ($mode == 'groups') {
    //
    // Extension Groups
    //
    $template->set_filenames(array('body' => 'forums/admin/attach_extension_groups.html'));
    if (empty($size) && !$submit) {
        $max_add_filesize = intval($attach_config['max_filesize']);
开发者ID:cbsistem,项目名称:nexos,代码行数:31,代码来源:admin_extensions.php

示例15: while

    } else {
        while ($row = $db->sql_fetchrow($result)) {
            $tid = $row['tid'];
            $title = $row['title'];
            echo "<strong><big>&middot;</big></strong>&nbsp;&nbsp;<a href=\"" . getlink("&amp;op=content&amp;tid={$tid}&amp;query={$query}") . "\">{$title}</a><br />";
        }
    }
    echo "<br /><br />" . "<center><form action=\"" . getlink("&file=search") . "\" method=\"post\">" . "<input type=\"text\" size=\"20\" name=\"query\">&nbsp;&nbsp;" . "<input type=\"hidden\" name=\"eid\" value=\"{$eid}\">" . "<input type=\"submit\" value=\"" . _SEARCH . "\">" . "</form><br /><br />" . "[ <a href=\"" . getlink() . "\">" . _RETURNTO . " " . _ENCYCLOPEDIA . "</a> ]<br /><br />" . _GOBACK . "</center>";
    CloseTable();
} elseif (isset($_POST['query']) && !empty($_POST['query']) && $eid > 0) {
    $result2 = $db->sql_query("SELECT title FROM " . $prefix . "_encyclopedia WHERE eid='{$eid}'", false, __FILE__, __LINE__);
    $row = $db->sql_fetchrow($result2);
    OpenTable();
    echo '<center><b>' . _SEARCHRESULTSFOR . ' <i>' . htmlprepare($_POST['query']) . '</i></b></center><br /><br /><br />
    <i><b>' . _RESULTSINTERMTITLE . '</b></i><br /><br />';
    $query = Fix_Quotes($_POST['query'], 1);
    $result = $db->sql_query("SELECT tid, title FROM " . $prefix . "_encyclopedia_text WHERE eid='{$eid}' AND title LIKE '%{$query}%'", false, __FILE__, __LINE__);
    if ($db->sql_numrows($result) < 1) {
        echo _NORESULTSTITLE;
    } else {
        while ($row = $db->sql_fetchrow($result)) {
            $tid = $row[tid];
            $title = $row[title];
            echo "<strong><big>&middot;</big></strong>&nbsp;&nbsp;<a href=\"" . getlink("&amp;op=content&amp;tid={$tid}") . "\">{$title}</a><br />";
        }
    }
    $result = $db->sql_query("SELECT tid, title FROM " . $prefix . "_encyclopedia_text WHERE eid='{$eid}' AND text LIKE '%{$query}%'", false, __FILE__, __LINE__);
    echo "<br /><br /><i><b>" . _RESULTSINTERMTEXT . "</b></i><br /><br />";
    if ($db->sql_numrows($result) < 1) {
        echo _NORESULTSTEXT;
    } else {
开发者ID:cbsistem,项目名称:nexos,代码行数:31,代码来源:search.php


注:本文中的Fix_Quotes函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。