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


PHP errors函数代码示例

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


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

示例1: deletetheme

function deletetheme($themeid, $reset)
{
    global $user, $FUNCTIONS_LANG, $error, $error_die;
    if (!$user['admin_panel']) {
        # No one should be able to actually use this function except an admin,
        #  its there just to be safe ;)
        $error_die[] = $FUNCTIONS_LANG["e_permissions"];
        return false;
    }
    if (empty($themeid)) {
        # tut tut, dont mess around with the URLs
        $error[] = $FUNCTIONS_LANG["e_th_specify_delete"];
        return false;
    }
    # tut tut, dont mess around with the URLs
    if (empty($reset)) {
        $error[] = $FUNCTIONS_LANG["e_th_specify_everyone"];
        return false;
    }
    if (!errors()) {
        $themes = call('sql_query', "SELECT * FROM themes WHERE theme_id = '{$themeid}'");
        $r = call('sql_fetch_array', $themes);
        $query = call('sql_query', "DELETE FROM themes WHERE theme_id = '{$themeid}'");
        $sql = call('sql_query', "DELETE FROM theme_settings WHERE theme_id = '{$themeid}'");
        $sql = call('sql_query', "UPDATE users SET theme = '{$reset}' WHERE theme = '" . $r['theme_name'] . "'");
        if ($sql) {
            return true;
        }
    }
}
开发者ID:eodivision,项目名称:eoCMS,代码行数:30,代码来源:deletetheme.php

示例2: editarticle

function editarticle($subject, $summary, $full_article, $cat, $rating, $comment, $id)
{
    global $user, $error, $error_die;
    if (!$user['admin_panel']) {
        $error_die[] = 'You do not have permission to do this';
        //No one should be able to actually use this function except an admin, its there just to be safe ;)
        return false;
    }
    if (empty($subject)) {
        $error[] = 'You must specify a subject';
        return false;
    }
    if (empty($summary)) {
        $error[] = 'You must specify a summary for your article';
        return false;
    }
    $comment = !isset($comment) ? 0 : 1;
    $rating = !isset($rating) ? 0 : 1;
    if (!errors()) {
        $query = call('sql_query', "UPDATE articles SET subject = '{$subject}', summary = '{$summary}', full_article = '{$full_article}', cat = '{$cat}', ratings = '{$rating}', comments = '{$comment}' WHERE id = '{$id}'");
        if ($query) {
            return true;
        }
    }
}
开发者ID:eodivision,项目名称:eoCMS,代码行数:25,代码来源:editarticle.php

示例3: output_maintenance

function output_maintenance($title = '', $body = '', $head = '')
{
    global $error, $error_die;
    if (theme('output_error') != false) {
        $body = theme('output_error');
        $title = 'Error';
        unset($error_die);
    }
    if (errors()) {
        $error = theme('title', 'Error') . theme('start_content') . '<div class="errors"><ul>';
        foreach ($error as $errors) {
            $error .= '<li>' . $errors . '</li>';
        }
        $error .= '</ul></div>' . theme('end_content');
        unset($error);
    } else {
        $error = '';
    }
    $output = theme('head', stripslashes($title), $head) . '
<body class="thrColLiqHdr">
<div id="maintenance-container">' . theme('start_content') . stripslashes($body) . theme('end_content') . '</div>
  </body>
</html>';
    die($output);
}
开发者ID:eodivision,项目名称:eoCMS,代码行数:25,代码来源:output_maintenance.php

示例4: addemoticon

function addemoticon($code, $image, $text)
{
    global $user, $error, $error_die;
    if (!$user['admin_panel']) {
        $error_die[] = 'You do not have permission to do this';
        //No one should be able to actually use this function except an admin, its there just to be safe ;)
        return false;
    }
    if (empty($code)) {
        $error[] = 'You must specify the code';
        return false;
    }
    if (empty($image)) {
        $error[] = 'You must specify an image';
        return false;
    }
    if (empty($text)) {
        $error[] = 'You must specify text';
        return false;
    }
    $code = str_replace(array("\"", "'"), '', $code);
    if (!errors()) {
        $query = call('sql_query', "INSERT INTO emoticons (code, image, alt) VALUES ('{$code}', '{$image}', '{$text}')");
        if ($query) {
            return true;
        }
    }
}
开发者ID:eodivision,项目名称:eoCMS,代码行数:28,代码来源:addemoticon.php

示例5: addcomment

function addcomment($id, $type, $message, $token)
{
    global $user, $error, $error_die;
    call('checktoken', $token);
    if (!$user['post_comment']) {
        $error[] = 'You do not have permission to post a comment';
        return false;
    }
    $existcheck = call('sql_query', "SELECT id, comments FROM {$type} WHERE id = '{$id}'");
    $fetch = call('sql_fetch_array', $existcheck);
    if (call('sql_num_rows', $existcheck) == 0) {
        $error_die[] = 'This ' . $type . ' no longer exists so adding a comment was not possible';
        return false;
    }
    if ($fetch['comments'] != '1') {
        $error_die[] = 'Posting of comments on this ' . $type . ' is disabled';
        return false;
    }
    if (empty($message)) {
        $error[] = 'Please enter a message';
        return false;
    }
    if (!errors()) {
        $sql = call('sql_query', "INSERT INTO comments (comment_type, type_id, message, author, author_id, ip, post_time) VALUES ('{$type}', '{$id}', '{$message}', '" . $user['user'] . "', '" . $user['id'] . "', '" . call('visitor_ip') . "', '" . time() . "' ) ");
        if ($sql) {
            return true;
        }
    }
}
开发者ID:eodivision,项目名称:eoCMS,代码行数:29,代码来源:addcomment.php

示例6: editpage

function editpage($name, $content, $id, $comment, $rating)
{
    global $user, $error, $error_die;
    if (!$user['admin_panel']) {
        $error_die[] = 'You do not have permission to do this';
        //No one should be able to actually use this function except an admin, its there just to be safe ;)
        return false;
    }
    $sql = call('sql_query', "SELECT * FROM pages WHERE id = '{$id}'");
    if (call('sql_num_rows', $sql) == 0) {
        $error[] = 'This page no longer exists';
        return false;
    }
    if (empty($content)) {
        $error[] = 'You must specify content for the page';
        return false;
    }
    if (empty($name)) {
        $error[] = 'You must specify a name for the page';
        return false;
    }
    if (!errors()) {
        $comment = !isset($comment) ? 0 : 1;
        $rating = !isset($rating) ? 0 : 1;
        $query = call('sql_query', "UPDATE pages SET pagename = '{$name}', content = '{$content}', comments = '{$comment}', ratings = '{$rating}' WHERE id = '{$id}'");
        if ($query) {
            return true;
        }
    }
}
开发者ID:eodivision,项目名称:eoCMS,代码行数:30,代码来源:editpage.php

示例7: deleteuser

function deleteuser($id)
{
    global $user, $error, $error_die;
    if (!$user['admin_panel']) {
        $error_die[] = 'You do not have permission to do this';
        //No one should be able to actually use this function except an admin, its there just to be safe ;)
        return false;
    }
    if ($user['id'] == $id) {
        $error_die[] = 'You can not delete your own account';
        //why would you want to delete your own account in the admin panel? Makes no sense
        return false;
    }
    $sql = call('sql_query', "SELECT * FROM users WHERE id = '{$id}'");
    if (call('sql_num_rows', $sql) == 0) {
        $error[] = 'This user no longer exists';
        return false;
    }
    if (!errors()) {
        $query = call('sql_query', "DELETE FROM users WHERE id = '{$id}'");
        if ($query) {
            return true;
        }
    }
}
开发者ID:eodivision,项目名称:eoCMS,代码行数:25,代码来源:deleteuser.php

示例8: editemoticon

function editemoticon($code, $image, $text, $id)
{
    global $user, $error, $error_die;
    if (!$user['admin_panel']) {
        $error_die[] = 'You do not have permission to do this';
        //No one should be able to actually use this function except an admin, its there just to be safe ;)
        return false;
    }
    if (empty($code)) {
        $error[] = 'You must specify the code';
        return false;
    }
    if (empty($image)) {
        $error[] = 'You must specify an image';
        return false;
    }
    if (empty($text)) {
        $error[] = 'You must specify text';
        return false;
    }
    if (!errors()) {
        $query = call('sql_query', "UPDATE emoticons SET code='{$code}', image='{$image}', alt='{$text}' WHERE id='{$id}'");
        if ($query) {
            return true;
        }
    }
}
开发者ID:eodivision,项目名称:eoCMS,代码行数:27,代码来源:editemoticon.php

示例9: action

function action()
{
    router();
    if (empty($_GET[0]) || $_GET[0] == 'index.php') {
        $_GET[0] = SCRIPT_NAME;
    }
    if (empty($_GET[1])) {
        $_GET[1] = 'main';
    }
    //$_GET = array_map('strtolower', $_GET);
    // $file = CONTROLLERS_PATH . $_GET[0] . '.php';
    $file = CONTROLLERS_PATH . $_GET[0] . '.php';
    // var_dump($file ,__FILE__);exit;
    if (!file_exists($file)) {
        errors();
        exit;
        //die('The server is busy, please try again later.');
    }
    // echo  $_GET[1];eixt;
    $c = new index();
    // if( !method_exists( $c, $_GET[1] ) )
    // {
    // 	errors();
    // 	exit();
    // 	//die('The server is busy, please try again later.');
    // }
    $c->{$_GET}[1]();
    // $c->display($c->tpl);
}
开发者ID:noikiy,项目名称:webgame,代码行数:29,代码来源:functions.php

示例10: addban

function addban($ip, $reason, $type)
{
    global $user, $error, $error_die;
    if (!$user['admin_panel']) {
        $error_die[] = 'You do not have permission to do this';
        //No one should be able to actually use this function except an admin, its there just to be safe ;)
        return false;
    }
    if (empty($ip)) {
        $error[] = 'You must specify an ip address to ban';
        return false;
    }
    if ($type == 'ip' && !preg_match('^([1]?\\d{1,2}|2[0-4]{1}\\d{1}|25[0-5]{1})(\\.([1]?\\d{1,2}|2[0-4]{1}\\d{1}|25[0-5]{1})){3}$^', $ip)) {
        $error[] = 'Invalid IP';
        return false;
    }
    $visitor_range = substr(call('visitor_ip'), 0, strlen(call('visitor_ip')) - strlen(strrchr(call('visitor_ip'), ".")));
    $visitor_range = substr($visitor_range, 0, strlen($visitor_range) - strlen(strrchr($visitor_range, ".")));
    if (call('visitor_ip') == $ip || $visitor_range == $ip) {
        $error[] = 'You can not ban your own IP';
        return false;
    }
    if (!errors()) {
        if ($type == 'ip') {
            $query = call('sql_query', "INSERT INTO bans (ip, reason, time_created, created_by) VALUES ('{$ip}', '{$reason}', '" . time() . "', '" . $user['id'] . "')");
        } elseif ($type == 'range') {
            $query = call('sql_query', "INSERT INTO bans (ip_range, reason, time_created, created_by) VALUES ('{$ip}', '{$reason}', '" . time() . "', '" . $user['id'] . "')");
        }
        if ($query) {
            return true;
        }
    }
}
开发者ID:eodivision,项目名称:eoCMS,代码行数:33,代码来源:addban.php

示例11: sitesettings

function sitesettings($registration, $reg_approval, $email, $mail, $host, $username, $password, $mode, $message, $captcha, $topics, $posts, $name, $tos)
{
    global $user, $error_die;
    if (!$user['admin_panel']) {
        $error_die[] = 'You do not have permission to do this';
        //No one should be able to actually use this function except an admin, its there just to be safe ;)
        return false;
    }
    if (!errors()) {
        $reg = call('sql_query', "UPDATE settings SET value = '{$registration}' WHERE variable = 'registration'");
        $register_approval = call('sql_query', "UPDATE settings SET value = '{$reg_approval}' WHERE variable = 'register_approval'");
        $emailq = call('sql_query', "UPDATE settings SET value = '{$email}' WHERE variable = 'email'");
        $mail_type = call('sql_query', "UPDATE settings SET value = '{$mail}' WHERE variable = 'mail'");
        $smtp_host = call('sql_query', "UPDATE settings SET value = '{$host}' WHERE variable = 'smtp_host'");
        $smtp_username = call('sql_query', "UPDATE settings SET value = '{$username}' WHERE variable = 'smtp_username'");
        $smtp_password = call('sql_query', "UPDATE settings SET value = '{$password}' WHERE variable = 'smtp_password'");
        $maintenance_mode = call('sql_query', "UPDATE settings SET value = '{$mode}' WHERE variable = 'maintenance_mode'");
        $maintenance_message = call('sql_query', "UPDATE settings SET value = '{$message}' WHERE variable = 'maintenance_message'");
        $register_captcha = call('sql_query', "UPDATE settings SET value = '{$captcha}' WHERE variable = 'register_captcha'");
        $topic_page = call('sql_query', "UPDATE settings SET value = '{$topics}' WHERE variable = 'topics_page'");
        $posts_topic = call('sql_query', "UPDATE settings SET value = '{$posts}' WHERE variable = 'posts_topic'");
        $site_name = call('sql_query', "UPDATE settings SET value = '{$name}' WHERE variable = 'site_name'");
        $terms = call('sql_query', "UPDATE settings SET value = '{$tos}' WHERE variable = 'tos'");
        if ($reg && $register_approval && $emailq && $mail_type && $smtp_host && $smtp_username && $smtp_password && $maintenance_mode && $maintenance_message && $register_captcha && $topic_page && $posts_topic && $site_name && $terms) {
            return true;
        }
    }
}
开发者ID:eodivision,项目名称:eoCMS,代码行数:28,代码来源:sitesettings.php

示例12: unstickytopic

function unstickytopic($topicid)
{
    global $user, $error, $error_die;
    if (empty($topicid)) {
        $error_die[] = 'The id of the topic to be made a sticky was not entered';
        return false;
    }
    $checktopic = call('sql_query', "SELECT thread_author FROM forum_topics WHERE topic_id = '{$topicid}'");
    $fetch = call('sql_fetch_array', $checktopic);
    if (call('sql_num_rows', $checktopic) == 0) {
        $error_die[] = 'This topic does not exist';
        return false;
    }
    if ($fetch['thread_author'] == $user['user'] && $user['sticky_own_topic'] || $user['sticky_any_topic']) {
        if (!errors()) {
            $query = call('sql_query', "UPDATE forum_topics SET sticky = '0' WHERE topic_id = '{$topicid}'");
            if ($query) {
                return true;
            }
        } else {
            $error_die[] = 'You do not have permission to perform this action';
            return false;
        }
    }
}
开发者ID:eodivision,项目名称:eoCMS,代码行数:25,代码来源:unstickytopic.php

示例13: editarticlecat

function editarticlecat($name, $description, $visible, $id)
{
    global $user, $error, $error_die;
    if (!$user['admin_panel']) {
        $error_die[] = 'You do not have permission to do this';
        //No one should be able to actually use this function except an admin, its there just to be safe ;)
        return false;
    }
    if (empty($name)) {
        $error[] = 'You must specify a name';
        return false;
    }
    if (empty($description)) {
        $error[] = 'You must specify a description';
        return false;
    }
    if (empty($visible)) {
        $error[] = 'You must state who this category is visible to';
    } else {
        foreach ($visible as $key => $value) {
            $visible .= $value . ',';
        }
        $visible = str_replace('Array', '', $visible);
        $count = strlen($visible);
        $visible = substr($visible, 0, $count - 1);
    }
    if (!errors()) {
        $query = call('sql_query', "UPDATE article_categories SET name = '{$name}', description = '{$description}', visible = '{$visible}' WHERE id = '{$id}'");
        if ($query) {
            return true;
        }
    }
}
开发者ID:eodivision,项目名称:eoCMS,代码行数:33,代码来源:editarticlecat.php

示例14: updatethemes

function updatethemes($footer, $logo, $left, $right, $upper, $lower, $visible, $id)
{
    global $user, $FUNCTIONS_LANG;
    if (!$user['admin_panel']) {
        # No one should be able to actually use this function except an admin,
        #  its there just to be safe ;)
        $error_die[] = $FUNCTIONS_LANG["e_permissions"];
        return false;
    }
    if (empty($visible)) {
        $error[] = $FUNCTIONS_LANG["e_th_use_theme"];
        return false;
    } else {
        foreach ($visible as $key => $value) {
            $visible .= $value . ',';
        }
        $visible = str_replace('Array', '', $visible);
        $count = strlen($visible);
        $visible = substr($visible, 0, $count - 1);
    }
    if (!errors()) {
        $site_footer = call('sql_query', "UPDATE theme_settings SET value = '{$footer}' WHERE variable = 'footer' AND theme_id = '{$id}'");
        $site_logo = call('sql_query', "UPDATE theme_settings SET value = '{$logo}' WHERE variable = 'logo'AND theme_id = '{$id}'");
        $exclude_left = call('sql_query', "UPDATE theme_settings SET value = '{$left}' WHERE variable = 'exclude_left'AND theme_id = '{$id}'");
        $exclude_right = call('sql_query', "UPDATE theme_settings SET value = '{$right}' WHERE variable = 'exclude_right'AND theme_id = '{$id}'");
        $exclude_upper = call('sql_query', "UPDATE theme_settings SET value = '{$upper}' WHERE variable = 'exclude_upper'AND theme_id = '{$id}'");
        $exclude_lower = call('sql_query', "UPDATE theme_settings SET value = '{$lower}' WHERE variable = 'exclude_lower'AND theme_id = '{$id}'");
        $theme_perms = call('sql_query', "UPDATE themes SET theme_visibility = '{$visible}' WHERE theme_id = '{$id}'");
        if ($site_footer && $site_logo && $exclude_left && $exclude_right && $exclude_upper && $exclude_lower && $theme_perms) {
            return true;
        }
    }
}
开发者ID:eodivision,项目名称:eoCMS,代码行数:33,代码来源:updatethemes.php

示例15: uninstallplugin

function uninstallplugin($id)
{
    global $user, $error, $error_die;
    if (!$user['admin_panel']) {
        $error_die[] = 'You do not have permission to do this';
        //No one should be able to actually use this function except an admin, its there just to be safe ;)
        return false;
    }
    if (empty($id)) {
        $error[] = 'No Plugin was selected';
        return false;
    }
    $sql = call('sql_query', "SELECT folder FROM plugins WHERE id = '{$id}'");
    if (call('sql_num_rows', $sql) == 0) {
        $error[] = 'This Plugin does not exist';
        return false;
    }
    if (!errors()) {
        $fetch = call('sql_fetch_array', $sql);
        include './Plugins/' . $fetch['folder'] . '/plugin-info.php';
        $delete = call('sql_query', "DELETE FROM plugins WHERE id = '{$id}'");
        if (isset($plugin['uninstall']) && is_array($plugin['uninstall'])) {
            foreach ($plugin['uninstall'] as $uninstall) {
                call('sql_query', $uninstall);
            }
        }
        if ($delete) {
            return true;
        }
    }
}
开发者ID:eodivision,项目名称:eoCMS,代码行数:31,代码来源:uninstallplugin.php


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