# Remove someone else's collection from your My Collections
    remove_collection($userref, $remove);
    # Get count of collections
    $c = get_user_collections($userref);
    # If the user has just removed the collection they were using, select a new collection
    if ($usercollection == $remove && count($c) > 0) {
        # Select the first collection in the dropdown box.
        $usercollection = $c[0]["ref"];
        set_user_collection($userref, $usercollection);
    }
    refresh_collection_frame();
}
$add = getvalescaped("add", "");
if ($add != "") {
    # Add someone else's collection to your My Collections
    add_collection($userref, $add);
    set_user_collection($userref, $add);
    refresh_collection_frame();
    # Log this
    daily_stat("Add public collection", $userref);
}
$reload = getvalescaped("reload", "");
if ($reload != "") {
    # Refresh the collection frame (just edited a collection)
    refresh_collection_frame();
}
$purge = getvalescaped("purge", "");
$deleteall = getvalescaped("deleteall", "");
if ($purge != "" || $deleteall != "") {
    if ($purge != "") {
        $deletecollection = $purge;
            break;
        case 'update-collection':
            // Update the collection information
            if (!isset($_REQUEST['cancel'])) {
                $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)) {
Пример #3
0
    } elseif ($type == "collection") {
        $result = update_collection_field($id, $field, $content);
        if ($result['output']) {
            print stripslashes($content);
        } else {
            print "error: " . $result['errors'];
        }
    } elseif ($type == "comment") {
        $result = update_comment_field($id, $field, $content);
        if ($result['output']) {
            print stripslashes($content);
        } else {
            print "error: " . $result['errors'];
        }
    }
}
if ($_POST['action'] == "add-collection") {
    $action_result = add_collection($_POST["name"], $_POST["description"]);
    if (empty($action_result['errors'])) {
        $output .= "<script type='text/javascript'>Element.show('add_item_link');Element.hide('add_item_form');Form.reset('add_form');</script>";
    }
}
if ($_POST['action'] == "list-collections") {
    $output .= plog_collection_manager($_POST["page"], $_SESSION['entries_per_page']);
}
if (!empty($action_result['errors'])) {
    $output .= '<p class="errors" id="rpc_message">' . $action_result['errors'] . '</p>';
} elseif (!empty($action_result['output'])) {
    $output .= '<p class="actions" id="rpc_message">' . $action_result['output'] . '</p>';
}
print $output;
Пример #4
0
				`created`
				)
				VALUES (
				$ref , '$username', '$password', '$fullname', '$email', '$usergroup', CURRENT_TIMESTAMP, '1', NULL, '$last_ip', '3', '$accepted_terms', NULL, '', '', '', '0', '0', CURRENT_TIMESTAMP, '$approved', '$lang' , CURRENT_TIMESTAMP )") or die(mysql_error());



				$newref=sql_insert_id();
				
				# Create a collection for this user
				global $lang;
				$new=create_collection($newref,"My Collection",0,1);
				# set this to be the user's current collection
				sql_query("update user set current_collection='$new', password_last_change=CURRENT_TIMESTAMP where ref='$newref'");
	
		add_collection($newref,$new);
				
			$all_userdata="SELECT * FROM user WHERE ref='$newref'";
			$this_user_data = mysql_query($all_userdata) or die(mysql_error());
			 if (mysql_num_rows($this_user_data) == 1){
			while ($userRow = mysql_fetch_array($this_user_data)) {
					$username=$userRow['username'];
					$userref=$userRow['ref'];
					$password_hash=$userRow['password'];
					$session_hash=$userRow['session'];
				}
				
			}
			else
			$valid=0;
				}
Пример #5
0
         $collections = get_collections($_SESSION['user_id']);
         $collection_name = filter_input(INPUT_POST, 'collectionname', FILTER_SANITIZE_STRING);
         $description = filter_input(INPUT_POST, 'description', FILTER_SANITIZE_STRING);
         $public = filter_input(INPUT_POST, 'public', FILTER_VALIDATE_INT);
         if ($public == NULL || $public == false) {
             $public = 0;
         }
         $user_id = $_SESSION['user_id'];
         if ($collection_name == NULL || $collection_name == false) {
             $message = 'Collection name cannot be empty';
             include 'manageCollections.php';
         } else {
             if ($description == NULL || $description == false) {
                 $message = add_collection($user_id, $collection_name, $public);
             } else {
                 $message = add_collection($user_id, $collection_name, $public, $description);
             }
             if ($message == 'error') {
                 $message = 'A database error occurred';
             } elseif ($message == 'success') {
                 $message = 'Collection added';
             }
             $collections = get_collections($_SESSION['user_id']);
             include 'manageCollections.php';
         }
     } else {
         $message = 'Please sign in to manage collections';
         include 'home.php';
     }
     break;
 case 'editcollection':
Пример #6
0
     echo "\n\n\t\t" . '<p><input type="submit" class="submit" name="proceed" id="proceed" value="' . plog_tr('Install') . '" /></p>';
     echo "\n\n\t" . '</form>' . "\n";
     // Otherwise, do the install
 } 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>';
Пример #7
0
function HookAutoassign_mrequestsAllBypass_end_managed_collection_request($manage_individual_requests, $collection_id, $request_query, $message, $templatevars, $assigned_to_user, $admin_mail_template, $user_mail_template)
{
    global $applicationname, $baseurl, $email_from, $email_notify, $lang, $username, $useremail, $manage_request_admin, $notify_manage_request_admin, $resource_type_request_emails, $request_senduserupdates;
    // Collection requests have already sent e-mails so skip this step
    if (!$manage_individual_requests) {
        // Because we are bypassing the end of managed_collection_request function we need to return true
        return true;
    }
    sql_query($request_query);
    $request = sql_insert_id();
    $templatevars['request_id'] = $request;
    $templatevars['requesturl'] = $baseurl . '/?q=' . $request;
    $templatevars['requestreason'] = $message;
    # Automatically notify the admin who was assigned the request:
    if ($notify_manage_request_admin) {
        // Attach assigned admin to this collection
        add_collection($assigned_to_user['ref'], $collection_id);
        $assigned_user_mail_message = $lang['requestassignedtoyoumail'] . "\n\n" . $baseurl . '/?q=' . $request . "\n";
        send_mail($assigned_to_user['email'], $applicationname . ': ' . $lang['requestassignedtoyou'], $assigned_user_mail_message);
    }
    # Check if alternative request email notification address is set, only valid if collection contains resources of the same type
    $admin_notify_email = $email_notify;
    if (isset($resource_type_request_emails)) {
        $requestrestypes = array_unique(sql_array('SELECT r.resource_type AS value FROM collection_resource cr LEFT JOIN resource r ON cr.resource = r.ref WHERE cr.collection = "' . $collection_id . '"'));
        if (count($requestrestypes) == 1 && isset($resource_type_request_emails[$requestrestypes[0]])) {
            $admin_notify_email = $resource_type_request_emails[$requestrestypes[0]];
        }
    }
    # Send the e-mail
    $message = $lang['user_made_request'] . '<br/><br/>' . $lang['username'] . ': ' . $username . '<br/>' . $message . '<br/><br/>';
    $message .= $lang['clicktoviewresource'] . '<br/>' . $baseurl . '/?q=' . $request;
    send_mail($admin_notify_email, $applicationname . ': ' . $lang['requestcollection'] . ' - ' . $collection_id, $message, $useremail, $useremail, $admin_mail_template, $templatevars);
    if ($request_senduserupdates) {
        $user_confirm_message = $lang['requestsenttext'] . '<br/><br/>' . $message . '<br/><br/>' . $lang['clicktoviewresource'] . '<br/>' . $baseurl . '/?c=' . $collection_id;
        send_mail($useremail, $applicationname . ': ' . $lang['requestsent'] . ' - ' . $collection_id, $user_confirm_message, $email_from, $email_notify, $user_mail_template, $templatevars);
    }
    return true;
}
Пример #8
0
// serve the config file
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">