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


PHP users::authenticateUser方法代码示例

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


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

示例1: authenticateGameEditor

 public static function authenticateGameEditor($pack)
 {
     if (!users::authenticateUser($pack)) {
         return false;
     }
     if (dbconnection::queryObject("SELECT * FROM user_games WHERE user_id = '{$pack->user_id}' AND game_id = '{$pack->game_id}'")) {
         return true;
     }
     util::errorLog("Failed Game Editor Authentication!");
     return false;
 }
开发者ID:kimblemj,项目名称:server,代码行数:11,代码来源:editors.php

示例2: getLogsForPlayer

 public static function getLogsForPlayer($pack)
 {
     $pack->auth->permission = "read_write";
     if (!users::authenticateUser($pack->auth)) {
         return new return_package(6, NULL, "Failed Authentication");
     }
     $logs = dbconnection::queryArray("SELECT * FROM user_log WHERE game_id = '{$pack->game_id}' AND user_id = '{$pack->user_id}' AND deleted = 0;");
     if ($pack->human) {
         $logs = log::humanizeLogs($logs);
     }
     return new return_package(0, $logs);
 }
开发者ID:kimblemj,项目名称:server,代码行数:12,代码来源:log.php

示例3: getQuestsForGame

 public static function getQuestsForGame($pack)
 {
     $pack->auth->permission = "read_write";
     if (!users::authenticateUser($pack->auth)) {
         return new return_package(6, NULL, "Failed Authentication");
     }
     $sql_quests = dbconnection::queryArray("SELECT * FROM quests WHERE game_id = '{$pack->game_id}' ORDER BY sort_index");
     $quests = array();
     for ($i = 0; $i < count($sql_quests); $i++) {
         if ($ob = quests::questObjectFromSQL($sql_quests[$i])) {
             $quests[] = $ob;
         }
     }
     return new return_package(0, $quests);
 }
开发者ID:kimblemj,项目名称:server,代码行数:15,代码来源:quests.php

示例4: updateMedia

 public static function updateMedia($pack)
 {
     $pack->auth->permission = "read_write";
     if (!users::authenticateUser($pack->auth)) {
         return new return_package(6, NULL, "Failed Authentication");
     }
     //boring, but this is the only immutable property of media
     dbconnection::query("UPDATE media SET " . (isset($pack->name) ? "name = '" . addslashes($pack->name) . "', " : "") . "last_active = CURRENT_TIMESTAMP " . "WHERE media_id = '{$pack->media_id}'");
     games::bumpGameVersion($pack);
     return media::getMedia($pack);
 }
开发者ID:kimblemj,项目名称:server,代码行数:11,代码来源:media.php

示例5: getFullGame

 public static function getFullGame($pack)
 {
     $pack->auth->permission = "read_write";
     if (!users::authenticateUser($pack->auth)) {
         return new return_package(6, NULL, "Failed Authentication");
     }
     $sql_game = dbconnection::queryObject("SELECT * FROM games WHERE game_id = '{$pack->game_id}' LIMIT 1");
     if (!$sql_game) {
         return new return_package(2, NULL, "The game you've requested does not exist");
     }
     $game = games::getGame($pack)->data;
     $game->authors = users::getUsersForGame($pack)->data;
     //pack already has auth and game_id
     //heres where we just hack the pack for use in other requests without overhead of creating new packs
     $pack->media_id = $game->media_id;
     $game->media = media::getMedia($pack)->data;
     $pack->media_id = $game->icon_media_id;
     $game->icon_media = media::getMedia($pack)->data;
     return new return_package(0, $game);
 }
开发者ID:kimblemj,项目名称:server,代码行数:20,代码来源:games.php

示例6: unlikeNote

 public static function unlikeNote($pack)
 {
     $pack->auth->permission = "read_write";
     if (!users::authenticateUser($pack->auth)) {
         return new return_package(6, NULL, "Failed Authentication");
     }
     dbconnection::query("DELETE FROM note_likes" . " WHERE game_id = '" . intval($pack->game_id) . "'" . " AND note_id = '" . intval($pack->note_id) . "'" . " AND user_id = '" . intval($pack->auth->user_id) . "'" . " LIMIT 1");
     return new return_package(0);
 }
开发者ID:kimblemj,项目名称:server,代码行数:9,代码来源:notes.php

示例7: importGame

 public static function importGame($pack)
 {
     $pack->auth->permission = "read_write";
     if (!users::authenticateUser($pack->auth)) {
         return new return_package(6, NULL, "Failed Authentication");
     }
     $zipbasename = substr($pack->zip_name, 0, strrpos($pack->zip_name, ".zip"));
     $tmp_import_folder = Config::v2_gamedata_folder . "/" . $zipbasename . "_import_" . date("mdY_Gis");
     if (file_exists($tmp_import_folder)) {
         return "no";
     }
     if (isset($pack->raw_upload_id)) {
         $tmp_zip = Config::raw_uploads_folder . '/' . $pack->raw_upload_id;
     } else {
         if (isset($pack->zip_data)) {
             $tmp_zip = $tmp_import_folder . ".zip";
             //save data to zip
             $zipfile = fopen($tmp_zip, "w");
             fwrite($zipfile, base64_decode($pack->zip_data));
             fclose($zipfile);
         } else {
             return new return_package(1, NULL, "No ZIP data given to import a game from");
         }
     }
     //unzip to folder
     $zip = new ZipArchive();
     if ($zip->open($tmp_zip) === TRUE) {
         $zip->extractTo($tmp_import_folder);
         $zip->close();
     }
     unlink($tmp_zip);
     //get rid of zip
     unset($pack->zip_data);
     //for readability in debug
     //read text
     $jsonfile = fopen($tmp_import_folder . "/export.json", "r");
     $assoc_data = json_decode(fread($jsonfile, filesize($tmp_import_folder . "/export.json")), true);
     fclose($jsonfile);
     //convert to non-assoc for non-data tables
     $import = new stdClass();
     $import->game_id = $assoc_data["game_id"];
     $import->table_data = array();
     for ($i = 0; $i < count($assoc_data["table_data"]); $i++) {
         $import->table_data[$i] = new stdClass();
         $import->table_data[$i]->table = $assoc_data["table_data"][$i]["table"];
         $import->table_data[$i]->columns = array();
         for ($j = 0; $j < count($assoc_data["table_data"][$i]["columns"]); $j++) {
             $import->table_data[$i]->columns[$j] = new stdClass();
             $import->table_data[$i]->columns[$j]->name = $assoc_data["table_data"][$i]["columns"][$j]["name"];
             $import->table_data[$i]->columns[$j]->meta = $assoc_data["table_data"][$i]["columns"][$j]["meta"];
         }
         $import->table_data[$i]->data = $assoc_data["table_data"][$i]["data"];
     }
     $pack->import = $import;
     $ret = duplicate::importGameData($pack);
     util::rdel($tmp_import_folder);
     //get rid of zipto
     return $ret;
 }
开发者ID:kimblemj,项目名称:server,代码行数:59,代码来源:duplicate.php

示例8: logPlayerCreatedComment

 public static function logPlayerCreatedComment($pack)
 {
     $pack->auth->permission = "read_write";
     if (!users::authenticateUser($pack->auth)) {
         return new return_package(6, NULL, "Failed Authentication");
     }
     dbconnection::queryInsert("INSERT INTO user_log (user_id, game_id, event_type, content_id, created) VALUES ('{$pack->auth->user_id}', '{$pack->game_id}', 'GIVE_NOTE_COMMENT', '{$pack->note_comment_id}', CURRENT_TIMESTAMP);");
     return new return_package(0);
 }
开发者ID:kimblemj,项目名称:server,代码行数:9,代码来源:client.php

示例9: invalidateKeys

 public static function invalidateKeys($pack)
 {
     $pack->auth->permission = "read_write";
     if (!users::authenticateUser($pack->auth)) {
         return new return_package(6, NULL, "Failed Authentication");
     }
     $read = util::rand_string(64);
     $write = util::rand_string(64);
     $read_write = util::rand_string(64);
     dbconnection::query("UPDATE users SET " . "read_key = '{$read}', " . "write_key = '{$write}', " . "read_write_key = '{$read_write}' " . "WHERE user_id = '{$pack->auth->user_id}'");
     return new return_package(0);
 }
开发者ID:kimblemj,项目名称:server,代码行数:12,代码来源:users.php

示例10: deleteNoteComment

 public static function deleteNoteComment($pack)
 {
     $note_comment = dbconnection::queryObject("SELECT * FROM note_comments WHERE note_comment_id = '{$pack->note_comment_id}'");
     $note = dbconnection::queryObject("SELECT * FROM notes WHERE note_id = '{$note_comment->note_id}'");
     $pack->auth->game_id = $note_comment->game_id;
     $pack->auth->permission = "read_write";
     //tl;dr: must be game owner, note owner, or comment owner to delete comment
     if (!(users::authenticateUser($pack->auth) && ($pack->auth->user_id == $note_comment->user_id || $pack->auth->user_id == $note->user_id)) && !editors::authenticateGameEditor($pack->auth)) {
         return new return_package(6, NULL, "Failed Authentication");
     }
     dbconnection::query("DELETE FROM note_comments WHERE note_comment_id = '{$pack->note_comment_id}' LIMIT 1");
     games::bumpGameVersion($pack);
     return new return_package(0);
 }
开发者ID:kimblemj,项目名称:server,代码行数:14,代码来源:note_comments.php


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