Example #1
0
require_once 'include/init.inc.php';
$token = $superCage->get->getAlnum('oauth_token');
$authorized = $superCage->get->getAlnum('authorized');
if ($token == '') {
    throw new OAuthException('No "oauth_token" provided via HTTP GET.');
}
$server = new OAuthServer();
$server->setParam('oauth_token', $token, true);
$rs = $server->authorizeVerify();
if ($authorized == 'yes') {
    $server->authorizeFinish(true, USER_ID);
    api_message('Token "' . $rs['token'] . '" authorized.');
} else {
    if ($authorized == 'no') {
        $server->authorizeFinish(false, USER_ID);
        api_message('Token "' . $rs['token'] . '" deleted.');
    } else {
        $store = OAuthStore::instance();
        $consumer = $store->getConsumerInfo($rs['consumer_id']);
        if (!USER_ID) {
            print 'Please <a href="../login.php?referer=oauth/authorize.php?oauth_token=' . $token . '">login</a> to your user account.<br />';
            print 'Access this gallery anonymously with the application "' . $consumer[0]['application_title'] . '"?';
            print '<br /><br />';
        } else {
            print 'Would you like to allow "' . $consumer[0]['application_title'] . '" to access your photos from this site?';
            print '<br /><br />';
        }
        print '<form method="get" action="authorize.php">';
        print '<input type="hidden" name="oauth_token" id="oauth_token" value="' . $token . '" />';
        print '<input type="radio" name="authorized" id="yes" value="yes" /><label for="yes">Yes</label>';
        print '<input type="radio" name="authorized" id="no" value="no" checked="checked" /><label for="no">No</label>';
Example #2
0
        // Create thumbnail and internediate image and add the image into the DB
        $result = add_picture($album, $filepath, $picture_name, 0, $title, $caption, $keywords, $user1, $user2, $user3, $user4, $category, $raw_ip, $hdr_ip, $superCage->post->getInt('width'), $superCage->post->getInt('height'));
        if (!$result) {
            @unlink($uploaded_pic);
            cpg_die(CRITICAL_ERROR, sprintf($lang_db_input_php['err_insert_pic'], $uploaded_pic) . '<br /><br />' . $ERROR, __FILE__, __LINE__, true);
        } elseif ($PIC_NEED_APPROVAL) {
            pageheader($lang_common['information']);
            msg_box($lang_common['information'], $lang_db_input_php['upload_success'], $lang_common['continue'], 'index.php');
            // start: send admin approval mail
            if ($CONFIG['upl_notify_admin_email']) {
                include_once 'include/mailer.inc.php';
                cpg_mail('admin', sprintf($lang_db_input_php['notify_admin_email_subject'], $CONFIG['gallery_name']), sprintf($lang_db_input_php['notify_admin_email_body'], USER_NAME, $CONFIG['ecards_more_pic_target'] . (substr($CONFIG["ecards_more_pic_target"], -1) == '/' ? '' : '/') . 'editpics.php?mode=upload_approval'));
            }
            // end: send admin approval mail
            ob_end_flush();
        } else {
            //$header_location = (@preg_match('/Microsoft|WebSTAR|Xitami/', getenv('SERVER_SOFTWARE'))) ? 'Refresh: 0; URL=' : 'Location: ';
            // start daorange
            if (defined('API_CALL')) {
                api_message('Picture "' . $title . '" uploaded successfully via the Coppermine API');
            }
            // end daorange
            $redirect = "displayimage.php?pid=" . mysql_insert_id($CONFIG['LINK_ID']);
            cpgRedirectPage($redirect, $lang_common['information'], $lang_db_input_php['upl_success'], 1);
        }
        break;
        // Unknown event
    // Unknown event
    default:
        cpg_die(CRITICAL_ERROR, $lang_errors['param_missing'], __FILE__, __LINE__);
}