Пример #1
0
 </title>
	<link href="theme/default/bootstrap/css/bootstrap.min.css" rel="stylesheet">
	<script src="theme/default/js/jquery.js"></script>
	<script src="theme/default/js/javascript.js"></script>
	<script src="theme/default/bootstrap/js/bootstrap.min.js"></script>
</head>
<body>
	<?php 
if (Input::Get("app_id")) {
    $fb = new Facebook();
    $app_id = Input::Get("app_id");
    // check existance of appid gevin in the database
    // get app secret
    $app_secret = DB::GetInstance()->QueryGet("SELECT app_secret FROM fbapps WHERE appid = ? ", array($app_id));
    if ($app_secret->count() == 0) {
        echo "\r\n\t\t\t<div class='alerts alert alert-danger'>\r\n\t\t\t<p class='alerttext'>facebook App not found!</p>\r\n\t\t\t</div>";
    } else {
        try {
            $notic = $fb->FbAuth($app_id, $app_secret->first()->app_secret, options::Get("siteurl") . "FbAuth.php?app_id=" . $app_id, Input::Get("oldApi"));
            echo "<div class='alerts alert alert-success'>\r\n\t\t\t\t<p class='alerttext'>Successfully authorized <a href='#' onclick='window.opener.location.href = window.opener.location.href;window.close();'>Close this windiw</a>.</p>\r\n\t\t\t\t</div>";
        } catch (Exception $ex) {
            echo "\r\n\t\t\t\t<div class='alerts alert alert-danger'>\r\n\t\t\t\t<p class='alerttext'>Error : " . $ex->GetMessage() . "</a></p>\r\n\t\t\t\t</div>";
        }
    }
} else {
    echo "\r\n\t\t<div class='alerts alert alert-danger'>\r\n\t\t<p class='alerttext'>Required parameters app_id not supplied.</p>\r\n\t\t</div>";
}
$tempate->footer();
?>
</body>
</html>