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


PHP xml_error函数代码示例

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


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

示例1: read_file_to_var

function read_file_to_var($file)
{
    # open the file
    $fh = fopen($file, 'r') or xml_error('Error - File: ' . __FILE__ . ' on line: ' . __LINE__);
    # read it into a string
    $str = fread($fh, filesize_url($file)) or xml_error('Error - File: ' . __FILE__ . ' on line: ' . __LINE__);
    #return the string
    return $str;
}
开发者ID:easy-designs,项目名称:v2,代码行数:9,代码来源:gFSS.php

示例2: parse_weblogsDotCom

function parse_weblogsDotCom($url)
{
    /*
    Grab weblogs.com list of recently updated RSS feeds
    $blogs is array() of feeds
    NAME    name
    URL        address
    WHEN        seconds since ping
    */
    global $blogs, $folder, $inOpmlfolder, $inOpmlItem;
    $folder = __('Root');
    $inOpmlfolder = $inOpmlItem = false;
    $opml = getUrl($url);
    $opml = str_replace("\r", '', $opml);
    $opml = str_replace("\n", '', $opml);
    $xp = xml_parser_create() or xml_error("couldn't create parser");
    xml_set_element_handler($xp, '_xml_startElement', '_xml_endElement') or xml_error("couldnt set XML handlers");
    xml_parse($xp, $opml, true) or xml_error("failed parsing xml at line " . xml_get_current_line_number() . ": " . xml_error_string());
    xml_parser_free($xp) or xml_error("failed freeing the parser");
    return $blogs;
}
开发者ID:jphpsf,项目名称:gregarius,代码行数:21,代码来源:opml.php

示例3: upload_files

function upload_files($r)
{
    xml_start_tag("upload_files");
    list($user, $user_submit) = authenticate_user($r, null);
    $fanout = parse_config(get_config(), "<uldl_dir_fanout>");
    $delete_time = (int) $r->delete_time;
    $batch_id = (int) $r->batch_id;
    //print_r($_FILES);
    $i = 0;
    foreach ($r->md5 as $f) {
        $md5 = (string) $f;
        $name = "file_{$i}";
        $tmp_name = $_FILES[$name]['tmp_name'];
        if (!is_uploaded_file($tmp_name)) {
            xml_error(-1, "{$tmp_name} is not an uploaded file");
        }
        $fname = job_file_name($md5);
        $path = dir_hier_path($fname, project_dir() . "/download", $fanout);
        rename($tmp_name, $path);
        $now = time();
        $jf_id = BoincJobFile::insert("(md5, create_time, delete_time) values ('{$md5}', {$now}, {$delete_time})");
        if (!$jf_id) {
            xml_error(-1, "upload_files(): BoincJobFile::insert({$md5}) failed: " . BoincDb::error());
        }
        if ($batch_id) {
            BoincBatchFileAssoc::insert("(batch_id, job_file_id) values ({$batch_id}, {$jf_id})");
        }
        $i++;
    }
    echo "<success/>\n        </upload_files>\n    ";
}
开发者ID:gchilders,项目名称:boinc,代码行数:31,代码来源:job_file.php

示例4: blogger_setTemplate

function blogger_setTemplate($values)
{
    xml_error("Sorry, this method is not supported yet.");
}
开发者ID:BGCX067,项目名称:f2cont-svn-to-git,代码行数:4,代码来源:xmlrpc.php

示例5: get_str

}
$email_addr = get_str("email_addr");
$passwd_hash = get_str("passwd_hash", true);
$email_addr = BoincDb::escape_string($email_addr);
$user = BoincUser::lookup("email_addr='{$email_addr}'");
if (!$user) {
    xml_error(-136);
}
if (!$passwd_hash) {
    echo "<account_out>\r\n\t<success/>\r\n</account_out>\r\n";
    exit;
}
$auth_hash = md5($user->authenticator . $user->email_addr);
// if no password set, set password to account key
//
if (!strlen($user->passwd_hash)) {
    $user->passwd_hash = $auth_hash;
    $user->update("passwd_hash='{$user->passwd_hash}'");
}
// if the given password hash matches (auth+email), accept it
//
if ($user->passwd_hash == $passwd_hash || $auth_hash == $passwd_hash) {
    echo "<account_out>\n";
    echo "<authenticator>{$user->authenticator}</authenticator>\n";
    echo "</account_out>\n";
} else {
    xml_error(-206);
}
?>

开发者ID:Turante,项目名称:boincweb,代码行数:29,代码来源:lookup_account.php

示例6: header

 *
 * http://localhost/services/api/getMyUserProfile.php?cid=1001
 *
 * param: cid = client id
 */
header('Content-Type: text/xml; charset=utf-8');
require_once "../../../etc/koala.conf.php";
require_once PATH_LIB . "format_handling.inc.php";
require_once PATH_LIB . "http_auth_handling.inc.php";
require_once "error_handling.php";
if (!(defined("API_ENABLED") && API_ENABLED === TRUE)) {
    xml_error("API_ENABLED not set");
    exit;
}
if (!(defined("API_CLIENT_ID") && isset($_GET["cid"]) && API_CLIENT_ID == $_GET["cid"])) {
    xml_error("API_CLIENT_ID not allowed");
    exit;
}
if (http_auth()) {
    $user = lms_steam::get_current_user();
    $user_name = $user->get_name();
    /**
     * without caching
     */
    //	$user_profile = lms_steam::user_get_profile( $user_name );
    /**
     * with caching
     */
    $cache = get_cache_function($user_name, 86400);
    //$user->get_name()
    $user_profile = $cache->call("lms_steam::user_get_profile", $user_name);
开发者ID:rolwi,项目名称:koala,代码行数:31,代码来源:getMyUserProfile_old.php

示例7: xml_header

if ($format == "xml") {
    // don't do caching for XML
    xml_header();
    $retval = db_init_xml();
    if ($retval) {
        xml_error($retval);
    }
    if ($auth) {
        $user = lookup_user_auth($auth);
        $show_hosts = true;
    } else {
        $user = lookup_user_id($id);
        $show_hosts = false;
    }
    if (!$user) {
        xml_error(-136);
    }
    show_user_xml($user, $show_hosts);
} else {
    db_init();
    // need to do this in any case,
    // since show_user_summary_public() etc. accesses DB
    // The page may be presented in many different languages,
    // so here we cache the data instead
    //
    $cache_args = "userid=" . $id;
    $cached_data = get_cached_data(USER_PAGE_TTL, $cache_args);
    if ($cached_data) {
        // We found some old but non-stale data, let's use it
        $data = unserialize($cached_data);
        $user = $data->user;
开发者ID:nicolas17,项目名称:boincgit-test,代码行数:31,代码来源:show_user.php

示例8: check_get_args

require_once "../inc/util.inc";
require_once "../inc/boinc_db.inc";
require_once "../inc/xml.inc";
check_get_args(array("format", "authenticator"));
BoincDb::get(true);
$config = get_config();
if (!parse_bool($config, "show_results")) {
    error_page("This feature is turned off temporarily");
}
$format = get_str("format", true);
if ($format == "xml") {
    xml_header();
    $auth = BoincDb::escape_string(get_str('authenticator'));
    $user = BoincUser::lookup("authenticator='{$auth}'");
    if (!$user) {
        echo "<error>" . xml_error(-136) . "</error>\n";
        exit;
    }
    $sum = 0;
    echo "<pending_credit>\n";
    $results = BoincResult::enum("userid={$user->id} AND (validate_state=0 OR validate_state=4) AND claimed_credit > 0");
    foreach ($results as $result) {
        echo "<result>\n";
        echo "    <resultid>" . $result->id . "</resultid>\n";
        echo "    <workunitid>" . $result->workunitid . "</workunitid>\n";
        echo "    <hostid>" . $result->hostid . "</hostid>\n";
        echo "    <claimed_credit>" . $result->claimed_credit . "</claimed_credit>\n";
        echo "    <received_time>" . $result->received_time . "</received_time>\n";
        echo "</result>\n";
        $sum += $result->claimed_credit;
    }
开发者ID:nicolas17,项目名称:boincgit-test,代码行数:31,代码来源:pending.php

示例9: header

require_once "../../../etc/koala.conf.php";
require_once PATH_LIB . "http_auth_handling.inc.php";
require_once "error_handling.php";
if (http_auth()) {
    if (!(defined("API_ENABLED") && API_ENABLED === TRUE)) {
        header('Content-Type: text/xml; charset=utf-8');
        echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>";
        xml_error("API_ENABLED not set");
        exit;
    }
    if (!(defined("API_CLIENT_ID") && isset($_GET["cid"]) && API_CLIENT_ID == $_GET["cid"])) {
        header('Content-Type: text/xml; charset=utf-8');
        echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>";
        xml_error("API_CLIENT_ID not allowed");
        exit;
    }
    if (isset($_GET["id"]) && isset($_GET["name"])) {
        $download_url = "/download/" . $_GET["id"] . "/" . $_GET["name"];
        header("Location: " . $download_url);
    } else {
        header('Content-Type: text/xml; charset=utf-8');
        echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>";
        xml_error("Parameter id or name is missing.");
        exit;
    }
} else {
    header('Content-Type: text/xml; charset=utf-8');
    echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>";
    xml_error("No access");
    exit;
}
开发者ID:rolwi,项目名称:koala,代码行数:31,代码来源:getDocument.php

示例10: xml_error

                         //echo "<error>No courses found.</error>";
                     }
                     echo "<debug><![CDATA[" . $debug_info . "]]></debug>" . "\n";
                     //TODO (maybe): remove or comment out this line before using in productive system
                     //echo "</details>";
                 } else {
                     xml_error("Error: Missing parameter.");
                     exit;
                 }
                 // /getMyCourseDetails.php *****************************************************************************************
                 echo "</course>" . "\n";
             }
         }
     }
 } else {
     xml_error("No semester found.");
     exit;
 }
 echo "</courses>" . "\n";
 // Cache for 7 Minutes
 $cache = get_cache_function($user_name, 420);
 $feeds = $cache->call("koala_user::get_news_feeds_static", 0, 0, FALSE, $user);
 //0, 10, FALSE, $user
 $no_feeds = count($feeds);
 echo "<abos>" . "\n";
 if ($no_feeds > 0) {
     foreach ($feeds as $feed) {
         //	      echo "feed: " .
         //		      $feed['title'] . ", " .
         //		      strftime( '%x', $feed['date'] ) . ", " .
         //		      $feed['obj']->get_id() . ", " .
开发者ID:rolwi,项目名称:koala,代码行数:31,代码来源:getMyDetailedProfile.php

示例11: check_get_args

require_once "../inc/util.inc";
require_once "../inc/boinc_db.inc";
require_once "../inc/xml.inc";
check_get_args(array("format", "authenticator"));
BoincDb::get(true);
$config = get_config();
if (!parse_bool($config, "show_results")) {
    error_page("This feature is turned off temporarily");
}
$format = get_str("format", true);
if ($format == "xml") {
    xml_header();
    $auth = BoincDb::escape_string(get_str('authenticator'));
    $user = BoincUser::lookup("authenticator='{$auth}'");
    if (!$user) {
        echo "<error>" . xml_error(ERR_DB_NOT_FOUND) . "</error>\n";
        exit;
    }
    $sum = 0;
    echo "<pending_credit>\n";
    $results = BoincResult::enum("userid={$user->id} AND (validate_state=0 OR validate_state=4) AND claimed_credit > 0");
    foreach ($results as $result) {
        echo "<result>\n";
        echo "    <resultid>" . $result->id . "</resultid>\n";
        echo "    <workunitid>" . $result->workunitid . "</workunitid>\n";
        echo "    <hostid>" . $result->hostid . "</hostid>\n";
        echo "    <claimed_credit>" . $result->claimed_credit . "</claimed_credit>\n";
        echo "    <received_time>" . $result->received_time . "</received_time>\n";
        echo "</result>\n";
        $sum += $result->claimed_credit;
    }
开发者ID:CalvinZhu,项目名称:boinc,代码行数:31,代码来源:pending.php

示例12: get_str

} else {
    // normal (non-LDAP) case
    $email_addr = get_str("email_addr");
    $passwd_hash = get_str("passwd_hash", true);
    $email_addr = BoincDb::escape_string($email_addr);
    $user = BoincUser::lookup("email_addr='{$email_addr}'");
    if (!$user) {
        xml_error(ERR_DB_NOT_FOUND);
    }
    if (!$passwd_hash) {
        echo "<account_out>\n";
        echo "   <success/>\n";
        echo "</account_out>\n";
        exit;
    }
    $auth_hash = md5($user->authenticator . $user->email_addr);
    // if no password set, set password to account key
    //
    if (!strlen($user->passwd_hash)) {
        $user->passwd_hash = $auth_hash;
        $user->update("passwd_hash='{$user->passwd_hash}'");
    }
    // if the given password hash matches (auth+email), accept it
    //
    if ($user->passwd_hash != $passwd_hash && $auth_hash != $passwd_hash) {
        xml_error(ERR_BAD_PASSWD);
    }
}
echo "<account_out>\n";
echo "<authenticator>{$user->authenticator}</authenticator>\n";
echo "</account_out>\n";
开发者ID:CalvinZhu,项目名称:boinc,代码行数:31,代码来源:lookup_account.php

示例13: get_int

// along with BOINC.  If not, see <http://www.gnu.org/licenses/>.
// RSS feed for per-user notifications
require_once "../inc/boinc_db.inc";
require_once "../inc/xml.inc";
require_once "../inc/pm.inc";
require_once "../inc/friend.inc";
require_once "../inc/notify.inc";
require_once "../project/project.inc";
$userid = get_int('userid');
$auth = get_str('auth');
$user = BoincUser::lookup_id($userid);
if (!$user) {
    xml_error();
}
if (notify_rss_auth($user) != $auth) {
    xml_error();
}
$notifies = BoincNotify::enum("userid = {$userid} order by create_time desc");
if (count($notifies)) {
    $last_mod_time = $notifies[0]->create_time;
} else {
    $last_mod_time = time();
}
$create_date = gmdate('D, d M Y H:i:s', $last_mod_time) . ' GMT';
header("Expires: " . gmdate('D, d M Y H:i:s', time()) . " GMT");
header("Last-Modified: " . $create_date);
header("Content-Type: application/xml");
$description = "Community notifications";
$channel_image = URL_BASE . "rss_image.gif";
$language = "en-us";
echo "<?xml version=\"1.0\" encoding=\"ISO-8859-1\" ?>\n    <rss version=\"2.0\" xmlns:atom=\"http://www.w3.org/2005/Atom\">\n    <channel>\n    <title>" . PROJECT . "</title>\n    <link>" . URL_BASE . "</link>\n    <atom:link href=\"" . URL_BASE . "notify_rss.php\" rel=\"self\" type=\"application/rss+xml\" />\n    <description>" . $description . "</description>\n    <copyright>" . COPYRIGHT_HOLDER . "</copyright>\n    <lastBuildDate>" . $create_date . "</lastBuildDate>\n    <language>" . $language . "</language>\n    <image>\n        <url>" . $channel_image . "</url>\n        <title>" . PROJECT . "</title>\n        <link>" . URL_BASE . "</link>\n    </image>\n";
开发者ID:maexlich,项目名称:boinc-igemathome,代码行数:31,代码来源:notify_rss.php

示例14: get_str

    }
}
$email_addr = get_str("email_addr");
$email_addr = strtolower($email_addr);
$passwd_hash = get_str("passwd_hash");
$user_name = get_str("user_name");
if (!is_valid_email_addr($email_addr)) {
    xml_error(-205);
}
if (strlen($passwd_hash) != 32) {
    xml_error(-1, "password hash length not 32");
}
$user = lookup_user_email_addr($email_addr);
if ($user) {
    if ($user->passwd_hash != $passwd_hash) {
        xml_error(-137);
    } else {
        $authenticator = $user->authenticator;
    }
} else {
    $user = make_user($email_addr, $user_name, $passwd_hash, 'International');
    if (!$user) {
        xml_error(-137);
    }
    if (defined('INVITE_CODES')) {
        error_log("Account for '{$email_addr}' created using invitation code '{$invite_code}'");
    }
}
echo " <account_out>\n";
echo "   <authenticator>{$user->authenticator}</authenticator>\n";
echo "</account_out>\n";
开发者ID:Turante,项目名称:boincweb,代码行数:31,代码来源:create_account.php

示例15: xml_error

if ($retval) {
    xml_error($retval);
}
$auth = get_str("account_key");
$user = BoincUser::lookup_auth($auth);
if (!$user) {
    xml_error(ERR_DB_NOT_FOUND);
}
$name = $_GET["name"];
if (strlen($name) == 0) {
    xml_error(-1, "must set team name");
}
$url = sanitize_tags(get_str("url"));
$type_name = sanitize_tags(get_str("type"));
// textual
$type = team_type_num($type_name);
$name_html = get_str("name_html");
$description = get_str("description");
$country = get_str("country");
if ($country == "") {
    $country = "International";
}
// the following DB-escapes its args
//
$new_team = make_team($user->id, $name, $url, $type, $name_html, $description, $country);
if ($new_team) {
    user_join_team($new_team, $user);
    echo "<create_team_reply>\n    <success/>\n    <team_id>{$new_team->id}</team_id>\n</create_team_reply>\n";
} else {
    xml_error(ERR_DB_NOT_UNIQUE, "could not create team");
}
开发者ID:CalvinZhu,项目名称:boinc,代码行数:31,代码来源:create_team.php


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