<?php require_once "../comm/utils.php"; function add_album() { //创建QQ空间相册的接口地址, 不要更改!! $url = "https://graph.qq.com/photo/add_album"; $data = "access_token=" . $_SESSION["access_token"] . "&oauth_consumer_key=" . $_SESSION["appid"] . "&openid=" . $_SESSION["openid"] . "&format=" . $_POST["format"] . "&albumname=" . urlencode($_POST["albumname"]) . "&albumdesc=" . urlencode($_POST["albumdesc"]) . "&priv=" . $_POST["priv"]; //echo $data; $ret = do_post($url, $data); return $ret; } //接口调用示例: $ret = add_album(); echo $ret;
$action_result = update_collection($_POST['pid'], $_POST['name'], $_POST['description'], $_POST['thumbnail_id']); } break; case 'update-comment': // Update the comment information if (!isset($_REQUEST['cancel'])) { $action_result = update_comment($_POST['pid'], $_POST['author'], $_POST['email'], $_POST['url'], $_POST['comment']); } break; case 'add-collection': // Add a new collection $action_result = add_collection($_POST['name'], $_POST['description']); break; case 'add-album': // Add a new album $action_result = add_album($_POST['name'], $_POST['description'], $_POST['parent_collection']); break; } if (!empty($action_result['errors'])) { // If there are any errors from the actions above, display the errors for the user $output .= "\n\t" . '<p class="errors">' . $action_result['errors'] . '</p>' . "\n"; } elseif (!empty($action_result['output'])) { // Else if no errors, display the successful output $output .= "\n\t" . '<p class="success">' . $action_result['output'] . '</p>' . "\n"; } } if (!isset($edit_page)) { // Display the gallery statistics on the main page if ($level == 'collections') { $output .= "\n\t" . '<p class="stats"><strong>' . plog_tr('Gallery Stats:') . '</strong> ' . plog_tr('You have') . ' <strong>' . count_collections() . '</strong> ' . plog_tr('collections, which contain') . ' <strong>' . count_albums() . '</strong> ' . plog_tr('albums and') . ' <strong>' . count_pictures() . '</strong> ' . plog_tr('images. Users have posted') . ' <strong>' . count_comments() . '</strong> ' . plog_tr('comments to your gallery.') . '</p>' . "\n"; }
function gr_add_album($parent, $name, $description) { // Parent is the name of the collection $query = "SELECT * FROM \"" . PLOGGER_TABLE_PREFIX . "collections\" WHERE name = '" . $PLOGGER_DBH->quote($parent) . "'"; $result = run_query($query); $row = $result->fetch(); if (empty($name)) { $name = 'no name'; } if (empty($description)) { $description = 'no description'; } $parent_id = $row['id']; $result = add_album($name, $description, $parent_id); global $response; if (0 == $result['id']) { $response->set_key('status', GR_STAT_CREATE_ALBUM_FAILED); $response->set_key('status_text', 'Could not create album'); } else { $response->set_key('status', GR_STAT_SUCCESS); $response->set_key('status_text', 'Album created'); } }
} else { if ($_FILES['userfile']['error'] == 1) { $output .= "\n\t" . '<p class="errors">' . plog_tr('File exceeded upload filesize limit') . '!</p>' . "\n"; } else { if ($_FILES['userfile']['size'] == 0) { $output .= "\n\t" . '<p class="errors">' . plog_tr('File does not exist') . '!</p>' . "\n"; } else { if (!isset($_REQUEST['destination_radio'])) { $output .= "\n\t" . '<p class="errors">' . plog_tr('No destination album specified') . '!</p>' . "\n"; } else { if ($_REQUEST['destination_radio'] == 'new' && $_REQUEST['new_album_name'] == '') { $output .= "\n\t" . '<p class="errors">' . plog_tr('New album name not specified') . '!</p>' . "\n"; } else { if ($_REQUEST['destination_radio'] == 'new') { // Create the new album $result = add_album($_REQUEST['new_album_name'], NULL, $_REQUEST['collections_menu']); if (!$result['errors']) { // No errors, add uploaded image to new album $album_id = $result['id']; } else { // Errors exist, let's find out what they are if (isset($result['output']) && $result['output'] == 'existing' && isset($result['id'])) { // Album already exists so try insert images into the existing album // and alert the user that their "new" album is already existing $album_id = $result['id']; // Get the collection name for display $sql = "SELECT \"name\" FROM " . PLOGGER_TABLE_PREFIX . "collections WHERE id = " . intval($_REQUEST['collections_menu']); $result = run_query($sql); $row = $result->fetch(); $output .= "\n\t" . '<p class="actions">' . sprintf(plog_tr('Album already exists. Uploading file to existing album %s in collection %s'), '<strong>' . $_REQUEST['new_album_name'] . '</strong>', '<strong>' . $row['name'] . '</strong>') . '</p>' . "\n"; } else {
} else { if ($_FILES['userfile']['error'] == 1) { $output .= "\n\t" . '<p class="errors">' . plog_tr('File exceeded upload filesize limit') . '!</p>' . "\n"; } else { if ($_FILES['userfile']['size'] == 0) { $output .= "\n\t" . '<p class="errors">' . plog_tr('File does not exist') . '!</p>' . "\n"; } else { if (!isset($_REQUEST['destination_radio'])) { $output .= "\n\t" . '<p class="errors">' . plog_tr('No destination album specified') . '!</p>' . "\n"; } else { if ($_REQUEST['destination_radio'] == 'new' && $_REQUEST['new_album_name'] == '') { $output .= "\n\t" . '<p class="errors">' . plog_tr('New album name not specified') . '!</p>' . "\n"; } else { if ($_REQUEST['destination_radio'] == 'new') { // Create the new album $result = add_album(mysql_real_escape_string($_REQUEST['new_album_name']), NULL, $_REQUEST['collections_menu']); if (!$result['errors']) { // No errors, add uploaded image to new album $album_id = $result['id']; } else { // Errors exist, let's find out what they are if (isset($result['output']) && $result['output'] == 'existing' && isset($result['id'])) { // Album already exists so try insert images into the existing album // and alert the user that their "new" album is already existing $album_id = $result['id']; // Get the collection name for display $sql = "SELECT `name` FROM " . PLOGGER_TABLE_PREFIX . "collections WHERE id = " . intval($_REQUEST['collections_menu']); $result = run_query($sql); $row = mysql_fetch_assoc($result); $output .= "\n\t" . '<p class="actions">' . sprintf(plog_tr('Album already exists. Uploading file to existing album %s in collection %s'), '<strong>' . $_REQUEST['new_album_name'] . '</strong>', '<strong>' . $row['name'] . '</strong>') . '</p>' . "\n"; } else {
<?php /** * PHP SDK for QQ登录 OpenAPI * * @version 1.3 * @author connect@qq.com * @copyright © 2011, Tencent Corporation. All rights reserved. */ require_once "../comm/utils.php"; /** * @brief 登录用户创建QQ空间相册.请求需经过URL编码,编码时请遵循 RFC 1738 * * @param $appid * @param $appkey * @param $access_token * @param $access_token_secret * @param $openid */ function add_album($appid, $appkey, $access_token, $access_token_secret, $openid) { //创建QQ空间相册的接口地址, 不要更改!! $url = "http://openapi.qzone.qq.com/photo/add_album"; echo do_post($url, $appid, $appkey, $access_token, $access_token_secret, $openid); } //接口调用示例: add_album($_SESSION["appid"], $_SESSION["appkey"], $_SESSION["token"], $_SESSION["secret"], $_SESSION["openid"]);
} else { if ($_FILES['userfile']['error'] == 1) { $output .= "\n\t" . '<p class="errors">' . plog_tr('File exceeded upload filesize limit') . '!</p>' . "\n"; } else { if ($_FILES['userfile']['size'] == 0) { $output .= "\n\t" . '<p class="errors">' . plog_tr('File does not exist') . '!</p>' . "\n"; } else { if (!isset($_REQUEST['destination_radio'])) { $output .= "\n\t" . '<p class="errors">' . plog_tr('No destination album specified') . '!</p>' . "\n"; } else { if ($_REQUEST['destination_radio'] == 'new' && $_REQUEST['new_album_name'] == '') { $output .= "\n\t" . '<p class="errors">' . plog_tr('New album name not specified') . '!</p>' . "\n"; } else { if ($_REQUEST['destination_radio'] == 'new') { // Create the new album $result = add_album(mysqli_real_escape_string($GLOBALS["PLOGGER_DBH"], $_REQUEST['new_album_name']), NULL, $_REQUEST['collections_menu']); if (!$result['errors']) { // No errors, add uploaded image to new album $album_id = $result['id']; } else { // Errors exist, let's find out what they are if (isset($result['output']) && $result['output'] == 'existing' && isset($result['id'])) { // Album already exists so try insert images into the existing album // and alert the user that their "new" album is already existing $album_id = $result['id']; // Get the collection name for display $sql = "SELECT `name` FROM " . PLOGGER_TABLE_PREFIX . "collections WHERE id = " . intval($_REQUEST['collections_menu']); $result = run_query($sql); $row = mysqli_fetch_assoc($result); $output .= "\n\t" . '<p class="actions">' . sprintf(plog_tr('Album already exists. Uploading file to existing album %s in collection %s'), '<strong>' . $_REQUEST['new_album_name'] . '</strong>', '<strong>' . $row['name'] . '</strong>') . '</p>' . "\n"; } else {
} else { $errors = array(); $mysql = check_mysql(PLOGGER_DB_HOST, PLOGGER_DB_USER, PLOGGER_DB_PW, PLOGGER_DB_NAME); if (empty($mysql)) { create_tables(); configure_plogger($_SESSION['install_values']); // undefined index install_values include_once PLOGGER_DIR . 'plog-load-config.php'; // If open permissions, have Plogger fix them if (isset($_SESSION['plogger_close_perms'])) { fix_open_perms($_SESSION['plogger_close_perms'], 'delete'); } $col = add_collection(plog_tr('Plogger Test Collection'), plog_tr('Feel free to delete it')); // Only attempt to create an album if the collection was created - sloppy fix for multiple installs if (!empty($col['id'])) { $alb = add_album(plog_tr('Plogger Test Album'), plog_tr('Feel free to delete it'), $col['id']); } } else { echo plog_tr('There was an error with the MySQL connection') . '!'; } // If no errors, tell the user their login and password and link them to the login if (empty($errors)) { echo "\n\t" . '<h1>' . plog_tr('Plogger Install Complete') . '</h1>'; echo "\n\n\t" . '<p class="info width-700">' . plog_tr('You have successfully installed Plogger!') . '<br /><br />'; echo "\n\t" . sprintf(plog_tr('Your username is %s and your password is %s'), '<strong>' . $_SESSION['install_values']['admin_username'] . '</strong>', '<strong>' . $_SESSION['install_values']['admin_password'] . '</strong>'); echo '</p>'; if (is_open_perms(PLOGGER_DIR . 'plog-content/')) { echo "\n\n\t" . '<p class="actions width-700">' . sprintf(plog_tr('You can now CHMOD the %s directory back to 0755'), '<strong>plog-content/</strong>') . '.</p>'; } echo "\n\n\t" . '<form action="index.php?r=plog-options.php" method="post">'; echo "\n\t\t" . '<p><input class="submit" type="submit" name="login" value="' . plog_tr('Log In') . '" /></p>';
function gr_add_album($parent, $name, $description) { // parent is the name of the collection $query = "SELECT * FROM `" . TABLE_PREFIX . "collections` WHERE name = '" . mysql_real_escape_string($parent) . "'"; $result = run_query($query); $row = mysql_fetch_assoc($result); if (empty($name)) { $name = "no name"; } if (empty($description)) { $description = "no description"; } $parent_id = $row["id"]; $result = add_album($name, $description, $parent_id); global $response; if (0 == $result["id"]) { $response->set_key("status", GR_STAT_CREATE_ALBUM_FAILED); $response->set_key("status_text", "Could not create album"); } else { $response->set_key("status", GR_STAT_SUCCESS); $response->set_key("status_text", "Album created"); } }
function gr_add_album($parent, $name, $description) { // Parent is the name of the collection $query = "SELECT * FROM `" . PLOGGER_TABLE_PREFIX . "collections` WHERE name = '" . mysqli_real_escape_string($GLOBALS["PLOGGER_DBH"], $parent) . "'"; $result = run_query($query); $row = mysqli_fetch_assoc($result); if (empty($name)) { $name = 'no name'; } if (empty($description)) { $description = 'no description'; } $parent_id = $row['id']; $result = add_album($name, $description, $parent_id); global $response; if (0 == $result['id']) { $response->set_key('status', GR_STAT_CREATE_ALBUM_FAILED); $response->set_key('status_text', 'Could not create album'); } else { $response->set_key('status', GR_STAT_SUCCESS); $response->set_key('status_text', 'Album created'); } }
} else { if (!is_allowed_extension($pi["extension"])) { $output .= '<p class="errors">' . plog_tr('Plogger cannot handle this type of file') . '</p>'; } else { if ($_FILES['userfile']['size'] == 0) { $output .= '<p class="errors">' . plog_tr('File does not exist!') . '</p>'; } else { if (!isset($_REQUEST["destination_radio"])) { $output .= '<p class="errors">' . plog_tr('No destination album specified!') . '</p>'; } else { if ($_REQUEST["destination_radio"] == "new" && $_REQUEST["new_album_name"] == "") { $output .= '<p class="errors">' . plog_tr('New album name not specified!') . '</p>'; } else { if ($_REQUEST["destination_radio"] == "new") { // Create the new album $result = add_album(mysql_escape_string($_REQUEST["new_album_name"]), NULL, $_REQUEST["collections_menu"]); $album_id = $result["id"]; } else { $album_id = $_REQUEST["albums_menu"]; } $result = add_picture($album_id, $_FILES["userfile"]["tmp_name"], $_FILES["userfile"]["name"], $_REQUEST["caption"], $_REQUEST["description"]); $output .= '<p class="actions">' . $result["output"] . '</p>'; } } } } } } } $output .= ' <h1>' . plog_tr('Upload Photos') . '</h1>
if (!empty($_POST['dlconfig']) && !empty($_SESSION['plogger_config'])) { header('Content-type: application/octet-stream'); header('Content-Disposition: attachment; filename="plog-config.php"'); print $_SESSION['plogger_config']; die; } // try to proceed to the admin interface. Only succeeds if the configuration is set if (!empty($_POST['proceed']) && defined('PLOGGER_DB_HOST')) { $mysql = check_mysql(PLOGGER_DB_HOST, PLOGGER_DB_USER, PLOGGER_DB_PW, PLOGGER_DB_NAME); if (empty($mysql)) { create_tables(); configure_plogger($_SESSION["install_values"]); require "plog-load_config.php"; connect_db(); $col = add_collection("Plogger test collection", "feel free to delete it"); $alb = add_album("Plogger test album", "feel free to delete it", $col["id"]); unset($_SESSION["plogger_config"]); unset($_SESSION["install_values"]); header("Location: admin/index.php"); exit; } } ?> <html> <head> <title>Install Plogger</title> <link rel="stylesheet" type="text/css" href="css/admin.css"> </head> <body> <img src="graphics/plogger.gif" alt="Plogger"> <?php
if (empty($title)) { $title_error = "Title cannot be blank"; $has_error = true; } if (empty($recordLabel)) { $recordLabel_error = "Record label cannot be blank"; $has_error = true; } if (empty($releaseDate)) { $releaseDate_error = "Release date cannot be blank"; $has_error = true; } if (!$has_error) { // Successful if ($albumId == -1) { $ret = add_album($title, $recordLabel, $releaseDate); } else { $ret = update_album($albumId, $title, $recordLabel, $releaseDate); } if (!$has_error) { // Get album id from return value(s) if ($albumId != -1) { header('Location: album.php?action=details&id=' . $albumId, true); } else { header('Location: artists.php', true); } die; } } } ?>
$action_result = update_picture($_POST['pid'], $_POST['caption'], $_POST['allow_comments'], $_POST['description']); } else { if ($_POST['action'] == 'update-album') { $action_result = update_album($_POST['pid'], $_POST['name'], $_POST['description'], $_POST['thumbnail_id']); } else { if ($_POST["action"] == "update-collection") { $action_result = update_collection($_POST["pid"], $_POST["name"], $_POST["description"], $_POST["thumbnail_id"]); } else { if ($_POST["action"] == "update-comment") { $action_result = update_comment($_POST["pid"], $_POST["author"], $_POST["email"], $_POST["url"], $_POST["comment"]); } else { if ($_POST["action"] == "add-collection") { $action_result = add_collection($_POST["name"], $_POST["description"]); } else { if ($_POST["action"] == "add-album") { $action_result = add_album($_POST["name"], $_POST["description"], $_POST["parent_collection"]); } } } } } } } } } } if (!empty($action_result['errors'])) { $output .= '<p class="errors">' . $action_result['errors'] . '</p>'; } elseif (!empty($action_result['output'])) { $output .= '<p class="actions">' . $action_result['output'] . '</p>'; }
function huge_it_catalog_albums_page() { require_once "admin/albums_func.php"; require_once "admin/albums_view.php"; // show_albums(); if (isset($_GET["del_review"])) { $del_review_id = $_GET["del_review"]; } if (isset($_GET["task"])) { $task = $_GET["task"]; } else { $task = ''; } if (isset($_GET["id"])) { $id = $_GET["id"]; } else { $id = 0; } global $wpdb; switch ($task) { case 'add_album': add_album(); break; if (isset($_GET["del_id"])) { if ($_GET["del_id"] != '') { $wpdb->query($wpdb->prepare("DELETE FROM " . $wpdb->prefix . "huge_it_catalog_rating WHERE id = '%d' ", $_GET["del_id"])); header("Location: admin.php?page=catalogs_huge_it_catalog&id=" . $_GET['id'] . "&task=ratings&prod_id=" . $_GET['prod_id'] . "&TB_iframe=1"); } } break; case 'edit_album': if ($id) { edit_album($id); } else { $id = $wpdb->get_var("SELECT MAX( id ) FROM " . $wpdb->prefix . "huge_it_catalogs"); edit_album($id); } break; case 'save': if ($id) { apply_cat($id); } case 'apply': if ($id) { apply_cat($id); edit_album($id); } break; case 'remove_cat': removecatalog($id); showcatalog(); break; case 'remove_album': remove_album($id); show_albums(); break; default: show_albums(); break; } wp_enqueue_style("admin_css", plugins_url("style/admin.style.css", __FILE__), FALSE); }
//print_r($_POST); if (isset($_POST["upload"])) { $destinations = $_POST["destinations"]; $captions = $_POST["captions"]; $descriptions = $_POST["descriptions"]; $files = $_POST["files"]; $selected = $_POST["Selected"]; $counter = $imported = 0; global $config; $files = get_files($config['basedir'] . 'uploads'); if ($_POST["destination_radio"] == "new" && $_POST["new_album_name"] == "") { $output .= '<p class="errors">' . plog_tr('New album name not specified!') . '</p>'; } else { if ($_POST["destination_radio"] == "new") { // Create the new album $result = add_album($_POST["new_album_name"], NULL, $_POST["collections_menu"]); $album_id = $result["id"]; } else { $album_id = $_POST["destination"]; } if ($album_id) { foreach ($files as $file) { $file_key = md5($file); if (in_array($file_key, $selected)) { $file_name = SmartStripSlashes($file); // fully qualified file name //$fqfn = $config["basedir"] . "uploads/".$file_name; $fqfn = $file; // attempt to chmod the pictures directory before moving them @chmod(dirname($fqfn), 0777); if (is_file($fqfn)) {