Example #1
0
<?php

/**
 * Main object.
 * @author Kikapp
 * @version 1.0
 */
$win = new SDPanel();
$win->setCaption("First Facebook Post!");
$actionBar = new ActionBar();
$actionBar->setClass("applicationBars");
$mainTable = new Table();
$input = new InputText();
//create input
$input->setLabelCaption("Write your thoughts");
$button = new Button();
$button->setCaption("Post on Facebook");
$button->onTap(facebook());
$button->setClass("button.blue");
$mainTable->addControl($input, 1, 1, 1, 1, "Center", "Middle");
$mainTable->addControl($button, 2, 1, 1, 1, "Center", "Middle");
$win->addControl($mainTable);
function facebook()
{
    Facebook::PostToWall("First post", "Caption", $input, "http://www.kikapptools.com", "");
}
Example #2
0
echo $bodyclass;
?>
" itemscope="itemscope" itemtype="http://schema.org/Blog">
<div class="hide">
    <meta content="<?php 
echo blog_title();
?>
" itemprop="name"/>
    <meta content="<?php 
echo blog_description();
?>
" itemprop="description"/>
</div>
<?php 
if (facebook()) {
    echo facebook();
}
if (login()) {
    toolbar();
}
?>
    <!-- ******HEADER****** --> 
    <header class="header">
        <div class="container">                       
            <div class="logo pull-left"><img class="logo-image" src="<?php 
echo site_url();
?>
themes/blog/images/logo.png"/></div>
            <div class="branding pull-left">
                <?php 
if (is_index()) {
Example #3
0
    echo $p->authorUrl;
    ?>
"><?php 
    echo $p->author;
    ?>
</a></span>
                <?php 
    if (disqus_count()) {
        ?>
 - 
                    <span><a href="<?php 
        echo $p->url;
        ?>
#disqus_thread">Comments</a></span>
                <?php 
    } elseif (facebook()) {
        ?>
 -
                    <a href="<?php 
        echo $p->url;
        ?>
#comments"><span><fb:comments-count href=<?php 
        echo $p->url;
        ?>
></fb:comments-count> Comments</span></a>
                <?php 
    }
    ?>
            </div>
            <?php 
    if (!empty($p->image)) {
Example #4
0
            <a class="googleplus" target="_blank"
               href="https://plus.google.com/share?url=<?php 
echo $p->url;
?>
">Google+</a>
        </div>
    </div>
    <div class="related">
        <h4>Related posts</h4>
        <?php 
echo get_related($p->tag);
?>
    </div>
    <div id="comments" class="comments border">
        <?php 
if (facebook()) {
    ?>
            <div class="fb-comments" data-href="<?php 
    echo $p->url;
    ?>
" data-numposts="<?php 
    echo config('fb.num');
    ?>
" data-colorscheme="<?php 
    echo config('fb.color');
    ?>
"></div>
        <?php 
}
?>
        <?php 
Example #5
0
<?php

if (!path('root')) {
    die('Restrict');
}
$GLOBALS['SK']['FACEBOOK']['FACEBOOK'] = null;
switch (env()) {
    case 'development':
        $GLOBALS['SK']['FACEBOOK']['APP_ID'] = '';
        $GLOBALS['SK']['FACEBOOK']['APP_SECRET'] = '';
        break;
    case 'test':
        $GLOBALS['SK']['FACEBOOK']['APP_ID'] = '';
        $GLOBALS['SK']['FACEBOOK']['APP_SECRET'] = '';
        break;
    case 'production':
    default:
        $GLOBALS['SK']['FACEBOOK']['APP_ID'] = '';
        $GLOBALS['SK']['FACEBOOK']['APP_SECRET'] = '';
        break;
}
if (strlen(trim(facebook('APP_ID'))) > 0 and strlen(trim(facebook('APP_SECRET'))) > 0) {
    $GLOBALS['SK']['FACEBOOK']['FACEBOOK'] = new Facebook(array('appId' => facebook('APP_ID'), 'secret' => facebook('APP_SECRET'), 'cookie' => true, 'fileUpload' => true));
}
Example #6
0
$lbl_home = new Label();
$lbl_home->setClass("label.MenuOption");
$lbl_home->setCaption("Home");
$table_home->onTap(home());
$table_home->addControl($img_home, 1, 1, 1, 1, "Center", "Middle");
$table_home->addControl($lbl_home, 1, 2, 1, 1, "Left", "Middle");
$table_facebook = new Table();
$table_facebook->setClass("tableMenuOption");
$table_facebook->setColumnsStyle("20%;80%");
$img_facebook = new Image();
$img_facebook->setImage("img/Android/hdpi/ic_facebook.png");
$img_facebook->setClass("image.menu");
$lbl_facebook = new Label();
$lbl_facebook->setClass("label.MenuOption");
$lbl_facebook->setCaption("Facebook");
$table_facebook->onTap(facebook());
$table_facebook->addControl($img_facebook, 1, 1, 1, 1, "Center", "Middle");
$table_facebook->addControl($lbl_facebook, 1, 2, 1, 1, "Left", "Middle");
$table_twitter = new Table();
$table_twitter->setClass("table.MenuOption");
$table_twitter->setColumnsStyle("20%;80%");
$img_twitter = new Image();
$img_twitter->setImage("img/Android/hdpi/ic_twitter.png");
$img_twitter->setClass("image.menu");
$lbl_twitter = new Label();
$lbl_twitter->setClass("label.MenuOption");
$lbl_twitter->setCaption("Twitter");
$table_twitter->onTap(twitte());
$table_twitter->addControl($img_twitter, 1, 1, 1, 1, "Center", "Middle");
$table_twitter->addControl($lbl_twitter, 1, 2, 1, 1, "Left", "Middle");
$table_map = new Table();
Example #7
0
<?php

require_once '../bootstrap.php';
// This API requires a session this its not necessary using a framework
session_start();
// Check the bootstrap to see how this function works
$facebook_login_url = facebook()->getLoginUrl();
?>

<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title>Dnetix\Social\FacebookHandler</title>
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">

</head>
<body>
    <h1>Facebook Connection Plugin</h1>

    <div class="container">
        <div class="well">Note that this example will not work unless this script its executed in a public server that facebook can redirect to, and you provide true facebook application data.</div>

        <p>This will send the user to the facebook platform and then will be redirected to the entry_point defined by the login_callback_url</p>
        <a href="<?php 
echo $facebook_login_url;
?>
">Accede con Facebook</a>
    </div>

    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
Example #8
0
<?php

require_once '../bootstrap.php';
$fb = facebook();
$graphUser = $fb->getMe();
// Analize the attributes of the graphUser to obtain more information
if ($graphUser) {
    // First check if already created the user in the database with the external ID
    $externalId = $graphUser->getId();
    $name = $graphUser->getName();
    // If it hasnt been created or in the database, obtain the values from the graphUser
    $email = $graphUser->getEmail();
    // Obtain the accessToken that will last 2 months
    $accessToken = $fb->getLongLivedAccessToken();
    // The accessToken provided will expire in two months, take that in account
    $expiresOn = date('Y-m-j H:i:s', strtotime('+2 month'));
    $profileImageUrl = $graphUser->getPicture()->getUrl();
    print_r($name);
    print_r($email);
    print_r($accessToken);
    print_r($expiresOn);
    echo '<img src="' . $profileImageUrl . '" alt="' . $name . '" />';
} else {
    // A user has not been obtained so... handle that
}
// Now to use it later, check the API of the Facebook/Facebook class but initialize with the accessToken Provided
$win = new SDPanel();
//$win -> setCaption("Detail of product");
$id = new InputNumeric();
$productUrl = new InputText();
Data::getParm($id, $title, $desc, $price, $stock, $productUrl);
$table = new Table();
$table->setClass("tableGray");
//Action Bar and Action Group.
$apb1 = new ActionBar();
$acg1 = new ActionGroup();
$acg1->setCaption("");
$acg1->setImage("img/ic_share.png");
$btn_facebook = new ButtonBar();
$btn_facebook->setCaption("Facebook");
$btn_facebook->setImage("img/ic_facebook.png");
$btn_facebook->onTap(facebook());
$btn_tw = new ButtonBar();
$btn_tw->setCaption("Twitter");
$btn_tw->setImage("img/ic_tw.png");
$btn_tw->onTap(twitter());
$btn_sms = new ButtonBar();
$btn_sms->setCaption("SMS");
$btn_sms->setImage("img/ic_sms.png");
$btn_sms->onTap(sms());
$btn_email = new ButtonBar();
$btn_email->setCaption("EMail");
$btn_email->setImage("img/ic_email.png");
$btn_email->onTap(email());
$acg1->addControl($btn_facebook);
$acg1->addControl($btn_tw);
$acg1->addControl($btn_sms);
Example #10
0
function login($lang)
{
    $with_name = true;
    $with_captcha = true;
    $with_facebook = false;
    $with_newuser = true;
    $with_newpassword = true;
    if ($with_facebook) {
        require_once 'facebook.php';
        $facebook = facebook();
    }
    $login = $password = $code = $token = false;
    if (isset($_SESSION['login'])) {
        $login = $_SESSION['login'];
    }
    $action = 'init';
    if (isset($_POST['login_enter'])) {
        $action = 'enter';
    }
    switch ($action) {
        case 'init':
            if ($with_facebook) {
                $facebook_user = $facebook->getUser();
                if ($facebook_user) {
                    try {
                        $facebook_user_profile = $facebook->api('/me', 'GET');
                        if (!empty($facebook_user_profile['email'])) {
                            $login = $facebook_user_profile['email'];
                        }
                        $action = 'facebook';
                    } catch (FacebookApiException $e) {
                    }
                    $facebook->destroySession();
                }
            }
            break;
        case 'enter':
            if (isset($_POST['login_login'])) {
                $login = strtolower(strflat(readarg($_POST['login_login'])));
            }
            if (isset($_POST['login_password'])) {
                $password = readarg($_POST['login_password']);
            }
            if (isset($_POST['login_code'])) {
                $code = readarg($_POST['login_code']);
            }
            if (isset($_POST['login_token'])) {
                $token = readarg($_POST['login_token']);
            }
            break;
        default:
            break;
    }
    $missing_code = false;
    $bad_code = false;
    $bad_token = false;
    $missing_login = false;
    $bad_login = false;
    $missing_password = false;
    $access_denied = false;
    switch ($action) {
        case 'enter':
            if (!isset($_SESSION['login_token']) or $token != $_SESSION['login_token']) {
                $bad_token = true;
                break;
            }
            if ($with_captcha) {
                if (!$code) {
                    $missing_code = true;
                    break;
                }
                $captcha = isset($_SESSION['captcha']['login']) ? $_SESSION['captcha']['login'] : false;
                if (!$captcha or $captcha != strtoupper($code)) {
                    $bad_code = true;
                    break;
                }
            }
            if (!$password) {
                $missing_password = true;
            }
            /* fall thru */
        /* fall thru */
        case 'facebook':
            if (!$login) {
                $missing_login = true;
            } else {
                if (!(validate_user_name($login) or validate_mail($login))) {
                    $bad_login = true;
                }
            }
            break;
        default:
            break;
    }
    switch ($action) {
        case 'enter':
        case 'facebook':
            if ($bad_token or $missing_code or $bad_code or $missing_login or $bad_login or $missing_password) {
                break;
            }
            require_once 'models/user.inc';
            $user = user_login($login, $password);
            if (!$user) {
                $access_denied = true;
                require_once 'log.php';
                write_log('enter.err', substr($login, 0, 100));
                $_SESSION['login'] = $login;
                break;
            }
            $user['ip'] = client_ip_address();
            if (in_array('administrator', $user['role'])) {
                require_once 'serveripaddress.php';
                require_once 'emailme.php';
                global $sitename;
                $ip = server_ip_address();
                $timestamp = strftime('%Y-%m-%d %H:%M:%S', time());
                $subject = 'login' . '@' . $sitename;
                $msg = $ip . ' ' . $timestamp . ' ' . $user['id'] . ' ' . $lang . ' ' . $user['ip'];
                @emailme($subject, $msg);
                if ($action == 'facebook') {
                    $access_denied = true;
                    break;
                }
            }
            session_regenerate();
            $_SESSION['user'] = $user;
            unset($_SESSION['login']);
            unset($_SESSION['login_token']);
            return true;
        default:
            break;
    }
    $connectbar = false;
    if ($with_facebook) {
        $scope = 'email';
        $facebook_login_url = $facebook->getLoginUrl(compact('scope'));
        $connectbar = view('connect', $lang, compact('facebook_login_url'));
    }
    $password_page = $with_newpassword ? url('password', $lang) : false;
    $newuser_page = $with_newuser ? url('newuser', $lang) : false;
    $_SESSION['login_token'] = $token = token_id();
    $errors = compact('missing_code', 'bad_code', 'missing_login', 'bad_login', 'missing_password', 'access_denied');
    $output = view('login', $lang, compact('token', 'connectbar', 'with_captcha', 'with_name', 'password_page', 'newuser_page', 'login', 'errors'));
    return $output;
}
Example #11
0
                        ?>
					<div class='col-sm-12'>
						<div class='alert alert-danger' role='alert'><?php 
                        echo $m['social_error'];
                        ?>
</div>
					</div>
					<?php 
                    }
                } else {
                    header('Location: ' . $script_path . 'login.php');
                }
            }
            // Check if it is a callback from Facebook
            if ($_GET['return'] == "facebook" && getSetting("enable_facebook", "text") == "true") {
                $facebook = facebook();
                // Initialize Facebook
                $sid = mysqli_real_escape_string($con, $facebook->getUser());
                $logged_in = false;
                if ($sid) {
                    try {
                        $me = $facebook->api('/me');
                        if ($me) {
                            // Check if login is successful
                            $logged_in = true;
                        }
                    } catch (FacebookApiException $e) {
                        $logged_in = false;
                    }
                }
                if ($logged_in) {
function process_domain($d)
{
    global $stats;
    global $inputdir;
    global $triggers;
    global $domains;
    global $messages;
    global $nresources;
    // echo("$d\n");
    $stats['n_domains']++;
    $c = file_get_contents($inputdir . $d);
    $lines = explode("\n", $c);
    foreach ($lines as $i => $line) {
        if (substr($line, 0, 1) != '{') {
            $lines[$i] = '';
        }
    }
    $c = implode("\n", $lines);
    $c = "[" . $c . "]";
    $c = str_replace("\n", "", $c);
    $c = str_replace(",]", "]", $c);
    $c = str_replace("Syntax error: parse error", "", $c);
    $c = str_replace("\n", "", $c);
    $resources = array_unique(json_decode($c, 1), SORT_REGULAR);
    $n = count($resources);
    if ($n == 0) {
        echo "{$d} has errors\n";
        $stats['n_domains_with_errors']++;
        return;
    }
    @$nresources[$n / 10]++;
    if ($n > 500) {
        $messages[] = "{$d} has {$n} resources";
    }
    // and then update the statistics
    $has_js = false;
    $has_external_js = false;
    $has_flash = false;
    $has_external_flash = false;
    $has_external_content = false;
    $has_google = false;
    $has_facebook = false;
    $has_yahoo = false;
    $has_twitter = false;
    $has_ads = false;
    $triggered = [];
    foreach ($triggers as $trigger) {
        $triggered[$trigger] = false;
    }
    foreach ($resources as $res) {
        $url = $res['url'];
        $type = $res['content-type'];
        if (isflash($type, $url)) {
            $has_flash = true;
            $is_flash = true;
        } else {
            $is_flash = false;
        }
        if (isjs($type, $url)) {
            $has_js = true;
            $is_js = true;
        } else {
            $is_js = false;
        }
        if (!$has_ads) {
            if (ads($url)) {
                echo "{$d} contains ads from {$url}\n";
                $has_ads = true;
            }
        }
        foreach ($triggers as $trigger) {
            if (contains($url, $trigger)) {
                $triggered[$trigger] = $url;
            }
        }
        if (contains($url, 'jquery')) {
            $has_jquery = true;
        }
        if (facebook($url)) {
            $has_facebook = true;
        }
        if (google($url)) {
            $has_google = true;
        }
        if (yahoo($url)) {
            $has_yahoo = true;
        }
        if (twitter($url)) {
            $has_twitter = true;
        }
        if (!same_domain($d, $url)) {
            if ($is_js) {
                $has_external_js = true;
            }
            if ($is_flash) {
                $has_external_flash = true;
            }
            $has_external_content = true;
        }
    }
    foreach ($triggers as $trigger) {
        if ($triggered[$trigger]) {
            $stats["n_domains_with_{$trigger}"] += 1;
            $domains[$trigger][$d] = $triggered[$trigger];
        }
    }
    $stats['n_domains_with_js'] += $has_js ? 1 : 0;
    $stats['n_domains_with_external_js'] += $has_external_js ? 1 : 0;
    $stats['n_domains_with_external_content'] += $has_external_content ? 1 : 0;
    $stats['n_domains_clean'] += $has_external_content ? 0 : 1;
    $stats['n_domains_with_flash'] += $has_flash ? 1 : 0;
    $stats['n_domains_with_external_flash'] += $has_external_flash ? 1 : 0;
    $stats['n_domains_with_google'] += $has_google ? 1 : 0;
    $stats['n_domains_with_facebook'] += $has_facebook ? 1 : 0;
    $stats['n_domains_with_yahoo'] += $has_yahoo ? 1 : 0;
    $stats['n_domains_with_twitter'] += $has_twitter ? 1 : 0;
    $stats['n_domains_with_ads'] += $has_ads ? 1 : 0;
}
Example #13
0
  if($uid !== "error" && $uid !== "invalid") {
    $q = "SELECT identifier FROM userz WHERE uid='$uid'";
    $query = $db->query($q);
    $fetch = $query->fetch();
    echo ($fetch !== FALSE) ? current($fetch) : "error";
  } else {
    echo "invalid";
  }
}


// Main auth control logic
if($_GET['a'] == "login") {
  switch($_GET['m']) {
  case "facebook":
    facebook();
    break;

  case "twitter":
    twitter();
    break;

  case "google":
    google();
    break;

  case "windows":
    break;
  }
} else if($_GET['a'] == "logout") {
  logout();