Example #1
0
 public static function newJSON($key, $json)
 {
     $inContext = (array) json_decode($json);
     $authContext = self::getContext($inContext);
     $inContext = $authContext['context'];
     if ($authContext['key'] != $key) {
         throw new Exception("JSON token given is invalid");
     }
     require_once l_r('lib/variant.php');
     $Variant = libVariant::loadFromVariantID($inContext['variantID']);
     libVariant::setGlobals($Variant);
     require_once l_r('objects/basic/set.php');
     $OI = $Variant->OrderInterface($inContext['gameID'], $inContext['variantID'], $inContext['userID'], $inContext['memberID'], $inContext['turn'], $inContext['phase'], $inContext['countryID'], new setMemberOrderStatus($inContext['orderStatus']), $inContext['tokenExpireTime'], $inContext['maxOrderID']);
     return $OI;
 }
Example #2
0
   the Free Software Foundation, either version 3 of the License, or
   (at your option) any later version.

   webDiplomacy is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.

   You should have received a copy of the GNU Affero General Public License
   along with webDiplomacy.  If not, see <http://www.gnu.org/licenses/>.
*/
require_once 'header.php';
if ((isset($_POST['watch']) || isset($_POST['unwatch'])) && isset($_POST['gameID'])) {
    require_once l_r('objects/game.php');
    require_once l_r('gamepanel/gameboard.php');
    $gameID = (int) $_POST['gameID'];
    // Get the game object, if this fails, then someone has entered some rubbish for the gameID
    $Variant = libVariant::loadFromGameID($gameID);
    libVariant::setGlobals($Variant);
    $Game = $Variant->panelGameBoard($gameID);
    if (isset($_POST['unwatch'])) {
        $Game->unwatch();
        print "Unwatched";
    } else {
        if (isset($_POST['watch'])) {
            $Game->watch();
            print "Watched";
        }
    }
}
header('Location: index.php');