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


PHP Character::IsValid方法代码示例

本文整理汇总了PHP中Character::IsValid方法的典型用法代码示例。如果您正苦于以下问题:PHP Character::IsValid方法的具体用法?PHP Character::IsValid怎么用?PHP Character::IsValid使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Character的用法示例。


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

示例1: print_autodetect_failed

    // Attempt to apply a specific format.
    // Obtain the import script for the format.
    $res = $rpgDB->query(sprintf("SELECT imp_file, title FROM %s WHERE id = %d", $TABLE_SERIALIZE, (int) $format));
    if (!$res) {
        __printFatalErr("Failed to query database.", __LINE__, __FILE__);
    }
    if ($rpgDB->num_rows() != 1) {
        __printFatalErr("Failed to obtain import script location.", __FILE__, __LINE__);
    }
    $row = $rpgDB->fetch_row($res);
}
// Include the proper script.
include_once "{$INCLUDE_PATH}/serialization/" . $row['imp_file'];
// Call the import routine.
$char = new Character($id);
if (!$char->IsValid()) {
    __printFatalErr("Failed to obtain current character data.");
}
if (import_character($contents, $char)) {
    if ($char->Save($sid)) {
        print_upload_success($sid);
    }
}
// By now, we've  failed if we got here.
print_upload_failed($sid, $row['title']);
////////////////////////////////////////////////////////////////////////
// Helper functions
// Show that the autodetect has failed.
function print_autodetect_failed($sid, $id)
{
    global $title, $formats;
开发者ID:ediosyncratic,项目名称:rpg-profile,代码行数:31,代码来源:upload.php

示例2: RespawnSession

include_once "{$INCLUDE_PATH}/engine/character.class.php";
include_once "{$INCLUDE_PATH}/engine/campaign.class.php";
include_once "{$INCLUDE_PATH}/engine/templates.php";
include_once "{$INCLUDE_PATH}/engine/serialization.php";
$sid = RespawnSession(__LINE__, __FILE__);
// Validate permission for the requested character.
$id = (int) $_POST['id'];
if (!$id) {
    $id = (int) $_GET['id'];
}
if (!$sid->HasAccessTo($id)) {
    __printFatalErr("Access denied.");
}
// Get character details.
$character = new Character($id);
if (!$character->IsValid()) {
    __printFatalErr("Failed to retrieve character data.", __LINE__, __FILE__);
}
// Perform any simple actions that are requested.
if (isset($_POST['public'])) {
    $public_updated = apply_public($sid, $character, $_POST['public'] == 'true') ? 'Updated!' : 'Update Failed!';
}
if (isset($_POST['inactive'])) {
    $inactive_updated = apply_inactive($sid, $character, $_POST['inactive'] == 'true') ? 'Updated!' : 'Update Failed!';
}
if (isset($_POST['add_profile'])) {
    $profiles_updated = apply_add_profile($character, $_POST['add_profile']) ? 'Updated!' : 'Update Failed!';
}
if (isset($_POST['tid'])) {
    $template_updated = apply_template($sid, $character, (int) $_POST['tid']) ? 'Updated!' : 'Update Failed!';
}
开发者ID:ediosyncratic,项目名称:rpg-profile,代码行数:31,代码来源:char.php


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