示例#1
0
        }
        $values1 = array("objTitle" => $_POST["title"], "objFolder" => $folder, "objThumbWidth" => $thumbInfo[0], "objThumbHeight" => $thumbInfo[1], "objThumbURL" => $_POST["thumbURL"], "objLastEdit!" => "NOW()", "objMature" => $filters);
        $values2 = array("objImageWidth" => $fullInfo[0], "objImageHeight" => $fullInfo[1], "objImageSize" => $fullSize, "objImageURL" => $_POST["fullURL"], "objPreviewWidth" => $previewInfo[0], "objPreviewHeight" => $previewInfo[1], "objPreviewURL" => $_POST["previewURL"], "objComment" => $_POST["comment"], "objEditIp" => getHexIp($_SERVER["REMOTE_ADDR"]));
        if ($objid == 0) {
            $values1["objCreator"] = $objCreator;
            $values1["objSubmitDate!"] = "NOW()";
            sql_query("INSERT INTO `extras`" . dbValues($values1));
            $objid = mysql_insert_id();
            $values2["objEid"] = $objid;
            $values2["objSubmitIp"] = getHexIp($_SERVER["REMOTE_ADDR"]);
            sql_query("INSERT INTO `extExtData`" . dbValues($values2));
        } else {
            $values2["objNumEdits"] = $objData["objNumEdits"] + 1;
            $values2["objNoAbuse"] = 0;
            sql_query("UPDATE `extras`" . dbSet($values1) . dbWhere(array("objid" => $objid)));
            sql_query("UPDATE `extExtData`" . dbSet($values2) . dbWhere(array("objEid" => $objid)));
        }
        if ($isUpdated && $objCreator == $_auth["useid"]) {
            // Notify the watchers.
            addUpdateToWatchers(updTypeArtExtra, $objCreator, $objid);
        }
        redirect(url("view/e" . $objid));
    }
}
?>
<div class="caption"><?php 
echo _TITLE;
?>
:</div>
<div>
	<input class="notsowide largetext" id="submitTitle" name="title" type="text"
示例#2
0
function updateAvatar($useid)
{
    $filename = findNewestFileById("files/avatars/", $useid, "");
    if ($filename == "") {
        $width = 0;
        $height = 0;
        $date = 0;
        $ext = "---";
    } else {
        list($width, $height) = getimagesize($filename);
        $date = substr(strrchr($filename, "-"), 1);
        $date = substr($date, 0, strpos($date, "."));
        $ext = substr(strrchr($filename, "."), 1);
    }
    sql_query("UPDATE `users`" . dbSet(array("useAvatarWidth" => $width, "useAvatarHeight" => $height, "useAvatarDate" => $date, "useAvatarExt" => $ext)) . dbWhere(array("useid" => $useid)));
}
示例#3
0
    if (strlen($_auth["useInvitation"] < 10)) {
        while (true) {
            // Generate a new random code.
            $code = "";
            $l = 10;
            while ($l > 0) {
                $code .= mt_rand(0, 9);
                $l--;
            }
            // Make sure the code is unique.
            $result = sql_query("SELECT COUNT(*) FROM `useExtData`" . dbWhere(array("useInvitation" => $code)));
            if (mysql_result($result, 0) == 0) {
                break;
            }
        }
        sql_query("UPDATE `useExtData`" . dbSet(array("useInvitation" => $code)) . dbWhere(array("useEid" => $_auth["useid"])));
        $_auth["useInvitation"] = $code;
    }
    ?>
		<?php 
    iefixStart();
    ?>
		<div class="sep largetext"><?php 
    echo _INVITATIONS;
    ?>
</div>
		<div class="container2 notsowide">
			<table cellspacing="0" cellpadding="4" border="0" width="100%">
			<tr>
				<td valign="center" class="nowrap">
					<?php 
示例#4
0
            removeCustomTheme($useData["useid"], false);
            addModeratorLog($useData["useid"], "[b]Removed custom theme[/b]");
        }
        //Only admin can change user class
        if (isAdmin()) {
            $changesExt["useIsRetired"] = isset($_POST["useIsRetired"]) ? 1 : 0;
            $changesExt["useIsHelpdesk"] = isset($_POST["useIsHelpdesk"]) ? 1 : 0;
            $changesExt["useIsModerator"] = isset($_POST["useIsModerator"]) ? 1 : 0;
            $changesExt["useIsSModerator"] = isset($_POST["useIsSModerator"]) ? 1 : 0;
            $changesExt["useIsDeveloper"] = isset($_POST["useIsDeveloper"]) ? 1 : 0;
        }
        if (count($changes) > 0) {
            sql_query("UPDATE `users`" . dbSet($changes) . dbWhere(array("useid" => $useData["useid"])));
        }
        if (count($changesExt) > 0) {
            sql_query("UPDATE `useExtData`" . dbSet($changesExt) . dbWhere(array("useEid" => $useData["useid"])));
        }
        redirect(url("."));
    }
    $suspendedUntil = strtotime($useData["useSuspendedUntil"]);
    ?>
		<div class="container2 mar_bottom notsowide">
			<?php 
    echo iefixStart();
    ?>
			<form action="<?php 
    echo url(".");
    ?>
" method="post">
				<a name="modlog"></a>
				<div class="sep a_center largetext">
示例#5
0
 }
 if ($_config["invitations"]) {
     $result = sql_query("SELECT `useEid` FROM `useExtData`" . dbWhere(array("useInvitation" => $invitation)));
     if ($data = mysql_fetch_row($result)) {
         $invitedBy = $data[0];
     } else {
         $validated = false;
         notice(_JOIN_INVITATION_INVALID);
     }
 }
 if (!$validated) {
     notice(_JOIN_ACCOUNT_NOT_CREATED);
 } else {
     if ($_config["invitations"] && $invitedBy > 0) {
         // Reset inviter's invitation code.
         sql_query("UPDATE `useExtData`" . dbSet(array("useInvitation" => "")) . dbWhere(array("useEid" => $invitedBy)));
     }
     // Add user to the database.
     sql_query("INSERT INTO `users`(`useUsername`,`usePassword`,`useRealName`,`useShowRealName`) " . "VALUES('{$username}','" . SHA1($password) . "','{$realname}','{$showrealname}')");
     $useid = mysql_insert_id();
     // Get newly created user id.
     // Generate activation key.
     // Generate a random activation key.
     $activationKey = sha1(mt_rand() * (microtime() * 0.001));
     // Add extra user data to the database.
     sql_query("INSERT INTO `useExtData`(`useEid`,`useEmail`,`useShowEmail`,`useBirthday`,`useShowBirthday`,`useIsActive`,`useActivationKey`,`useSignupDate`,`useLanguage`,`useObjFilters`,`useObjPreview`,`useInvitedBy`) " . "VALUES('{$useid}','{$email}','{$showemail}','{$birthdayyear}-{$birthdaymonth}-{$birthdayday}','{$showbirthday}','0','{$activationKey}',NOW(),'" . $_lang . "','" . $_config["defaultFilters"] . "','" . $_config["previewDefault"] . "','{$invitedBy}')");
     // Send the activation key via email.
     include_once INCLUDES . "mailing.php";
     $activationLink = url("activate/" . $activationKey);
     sendEmail($useid, sprintf(_USE_ACTIVATE_SUBJ, $_config["galName"]), sprintf(_USE_ACTIVATE_BODY, $activationLink));
     // New account has been successfully created, proceed to the front page
示例#6
0
    }
    // Profile options
    $_auth["useCustomTitle"] = $_POST["useCustomTitle"];
    $_auth["useRealName"] = $_POST["useRealName"];
    $_auth["useShowRealName"] = isset($_POST["useShowRealName"]) ? 1 : 0;
    $_auth["useProfile"] = $_POST["useProfile"];
    $_auth["useAIM"] = $_POST["useAIM"];
    $_auth["useICQ"] = $_POST["useICQ"];
    $_auth["useMSN"] = $_POST["useMSN"];
    $_auth["useYIM"] = $_POST["useYIM"];
    $_auth["useJabber"] = $_POST["useJabber"];
    // Update the database
    sql_query("UPDATE `users`" . dbSet(array("useRealName" => $_auth["useRealName"], "useShowRealName" => $_auth["useShowRealName"], "useIsHidden" => $_auth["useIsHidden"])) . dbWhere(array("useid" => $_auth["useid"])));
    sql_query("UPDATE `useExtData`" . dbSet(array("useAIM" => $_auth["useAIM"], "useICQ" => $_auth["useICQ"], "useMSN" => $_auth["useMSN"], "useYIM" => $_auth["useYIM"], "useJabber" => $_auth["useJabber"], "useCustomTitle" => $_auth["useCustomTitle"], "useFeaturedObj" => $_auth["useFeaturedObj"], "useProfile" => $_auth["useProfile"], "useShowEmail" => $_auth["useShowEmail"], "useStatsPublic" => $_auth["useStatsPublic"], "useGuestAccess" => $_auth["useGuestAccess"])) . dbWhere(array("useEid" => $_auth["useid"])));
    if ($oldGuestAccess != $_auth["useGuestAccess"]) {
        sql_query("UPDATE `objects`" . dbSet(array("objGuestAccess" => $_auth["useGuestAccess"])) . dbWhere(array("objCreator" => $_auth["useid"])));
    }
    notice(_SET_SAVED);
}
// ======================================================================================================
// ACCOUNT
// ======================================================================================================
?>
	<?php 
iefixStart();
?>
	<div class="sep largetext"><?php 
echo _ACCOUNT;
?>
</div>
	<div class="container2 notsowide">
示例#7
0
function updateFilterKeywords($objid)
{
    global $_config;
    $KW = array();
    $kwList = preg_split('/[\\s\\,\\;]/', $_config["filterKeywordAssoc"], 64, PREG_SPLIT_NO_EMPTY);
    foreach ($kwList as $kw1) {
        list($fltid, $keyid) = preg_split('/\\=/', $kw1, 2);
        $KW[$fltid] = $keyid;
    }
    // Update object's objMature field by enabling all required filters
    // according to the chosen keywords.
    $filters = getFiltersByObject($objid);
    /*
    $sql = "SELECT `objMature` FROM `objects`".dbWhere( array(
    	"objid" => $objid ));
    
    $objResult = sql_query( $sql );
    
    if( $objData = mysql_fetch_assoc( $objResult ))
    {
    	$filters2 = preg_split( '/\,/', $objData[ "objMature" ], 0, PREG_SPLIT_NO_EMPTY );
    
    	$filters = array_unique( array_merge( $filters, $filters2 ));
    }
    
    mysql_free_result( $objResult );
    */
    $sql = "UPDATE `objects`" . dbSet(array("objMature" => implode(",", $filters))) . dbWhere(array("objid" => $objid));
    sql_query($sql);
    // Remove old keywords under "Filters".
    $sql = "DELETE FROM `objKeywords` WHERE `objKkeyword` IN ('" . implode("','", $KW) . "') " . "AND `objKobject` = '" . intval($objid) . "'";
    sql_query($sql);
    // Add new keywords under "Filters" according to the filters enabled for
    // the object.
    if (count($filters) == 0) {
        $filters = array(0);
    }
    foreach ($filters as $filter) {
        if (isset($KW[$filter])) {
            $sql = "INSERT INTO `objKeywords`" . dbValues(array("objKobject" => $objid, "objKkeyword" => $KW[$filter]));
            sql_query($sql);
        }
    }
}
示例#8
0
        recountUpdates(updTypeArt, $_auth["useid"]);
        // Recalculate art updates
        recountUpdates(updTypeArtExtra, $_auth["useid"]);
    }
    // Other options
    $_auth["useTimezone"] = isset($_POST["timezone"]) ? intval($_POST["timezone"]) : 0;
    $_auth["useDateFormat"] = isset($dateFormatList[$_POST["dateFormat"]]) ? $dateFormatList[$_POST["dateFormat"]] : $dateFormatList[0];
    $_auth["useObjPreview"] = isset($_POST["useObjPreview"]) ? 1 : 0;
    $_auth["useFuzzyNumbers"] = isset($_POST["useFuzzyNumbers"]) ? 1 : 0;
    $_auth["useStatsHide"] = isset($_POST["useStatsHide"]) ? 1 : 0;
    $_auth["useTheme"] = isset($_COOKIE["style"]) ? $_COOKIE["style"] : "original";
    $_auth["useDisableCustom"] = isset($_POST["useDisableCustom"]) ? intval($_POST["useDisableCustom"]) : 0;
    $_auth["useEnableUI2"] = isset($_POST["useEnableUI2"]) ? isset($_POST["useEnableUI2a"]) ? 1 : 2 : 0;
    // Update the database
    sql_query("UPDATE `users`" . dbSet(array("useDateFormat" => $_auth["useDateFormat"])) . dbWhere(array("useid" => $_auth["useid"])));
    sql_query("UPDATE `useExtData`" . dbSet(array("useDisableCustom" => $_auth["useDisableCustom"], "useEnableUI2" => $_auth["useEnableUI2"], "useFuzzyNumbers" => $_auth["useFuzzyNumbers"], "useLanguage" => $_auth["useLanguage"], "useObjFilters" => $_auth["useObjFilters"], "useObjPreview" => $_auth["useObjPreview"], "useStatsHide" => $_auth["useStatsHide"], "useHideExtras" => $_auth["useHideExtras"], "useTheme" => $_auth["useTheme"], "useTimezone" => $_auth["useTimezone"])) . dbWhere(array("useEid" => $_auth["useid"])));
    redirect(url(".", array("saved" => "yes")));
}
// ======================================================================================================
// GENERAL SETTINGS
// ======================================================================================================
?>
	<?php 
iefixStart();
?>
	<div class="sep largetext"><?php 
echo _SET_GENERAL_SETTINGS;
?>
</div>
	<div class="container2 notsowide">
		<table cellspacing="0" cellpadding="4" border="0">
示例#9
0
function updateCustomTheme($useid, $isClub, $data, &$errors)
{
    $themePath = getCustomThemePath($useid, $isClub);
    forceFolders($themePath);
    $lastThemeFile = getLastCustomThemeFile($useid, $isClub);
    $err = !uploadSingleImage("logo", 0, 0, 51200, $fnLogo, $errors, $themePath);
    $err |= !uploadSingleImage("outer", 0, 0, 25600, $fnOuter, $errors, $themePath);
    $err |= !uploadSingleImage("container", 0, 0, 51200, $fnContainer, $errors, $themePath);
    $err |= !uploadSingleImage("container2", 0, 0, 25600, $fnContainer2, $errors, $themePath);
    if ($err) {
        return false;
    }
    $fileLogo = urlf() . findNewestFile($themePath . "logo-*.jpg");
    $fileOuter = urlf() . findNewestFile($themePath . "outer-*.jpg");
    $fileContainer = urlf() . findNewestFile($themePath . "container-*.jpg");
    $fileContainer2 = urlf() . findNewestFile($themePath . "container2-*.jpg");
    $pixLogo = PIX($fnLogo);
    $pixOuter = PIX($fnOuter);
    $pixContainer = PIX($fnContainer);
    $pixContainer2 = PIX($fnContainer2);
    $pix00Container = PIX($fnContainer, 0, 0);
    $avgLogo = AVG($fnLogo);
    $avgOuter = AVG($fnOuter);
    $avgContainer = AVG($fnContainer);
    $avgContainer2 = AVG($fnContainer2);
    $colors = array('{bBody}' => $pixLogo, '{bOuter}' => $pixOuter, '{bContainer}' => $pixContainer, '{bContainer2}' => $pixContainer2, '{bInput}' => BRIGHT($pixContainer2, 1.2), '{bInputHover}' => BRIGHT($pixContainer2, 1.5), '{bInputFocus}' => $pix00Container, '{bButton}' => BRIGHT($pixContainer2, 1.2), '{bButtonHover}' => BRIGHT($pixContainer2, 1.5), '{bTabActive}' => $pix00Container, '{bTabInactive}' => $pixOuter, '{bUI2Layout}' => $pixContainer2, '{cBody}' => BRIGHT(CONTRAST($avgLogo), 1.3), '{cOuter}' => BRIGHT(CONTRAST($avgOuter), 1.2), '{cContainer}' => BRIGHT(CONTRAST($avgContainer), 1.3), '{cContainer2}' => BRIGHT(CONTRAST($avgContainer2), 1.3), '{cOutline}' => BRIGHT(CONTRAST($avgContainer2), 1.3), '{cTabActive}' => CONTRAST($avgContainer), '{cTabInactive}' => CONTRAST($avgOuter), '{cInput}' => CONTRAST($avgContainer2), '{cLink}' => RICH(BRIGHT($pixContainer2, -2.5), 1.1), '{cLinkHover}' => RICH(BRIGHT($pixContainer2, -3), 1.1), '{cHeaderLink}' => RICH(BRIGHT($pixOuter, -2.5), 1.1), '{cHeaderLinkHover}' => RICH(BRIGHT($pixOuter, -3), 1.1), '{cMarkedText}' => BRIGHT(HARMONY($pixContainer2), 1.5), '{cTabOutline}' => BRIGHT(CONTRAST($avgContainer2), 1.3), '{cThumbBorder}' => BRIGHT(CONTRAST($avgContainer2), 1.3), '{cThumbBorderMature}' => RICH(BRIGHT($pixContainer2, -3), 1.1));
    if (tooClose($colors['{cLink}'], $colors['{cContainer2}'], 32)) {
        $colors['{cLink}'] = RICH(PIX($fnOuter), 2);
        $colors['{cLinkHover}'] = BRIGHT($colors['{cLink}'], 2.5);
    }
    if (tooClose($colors['{cContainer}'], $colors['{cMarkedText}'], 140)) {
        $colors['{cMarkedText}'] = BRIGHT(HARMONY(PIX($fnContainer2)), -1.3);
    }
    // Override auto-generated colors with POSTed colors.
    if (!isset($data["c"])) {
        $data["c"] = array();
    }
    $acceptedColors = array("cBody", "cOuter", "cContainer", "cContainer2", "cOutline", "cTabActive", "cTabInactive", "cInput", "cLink", "cLinkHover", "cHeaderLink", "cHeaderLinkHover", "cMarkedText", "cTabOutline", "cThumbBorder", "cThumbBorderMature", "sOutline", "sTitleMargin", "bButton", "bButtonHover", "bInput", "bInputFocus", "bUI2Layout");
    // Override some data from POST (if available)
    foreach ($acceptedColors as $c1) {
        if (isset($_POST[$c1]) && $_POST[$c1] != "") {
            $data["c"][$c1] = $_POST[$c1];
        }
    }
    foreach ($data["c"] as $key => $value) {
        if (preg_match('/^[0-9A-Fa-f]{3}$/', $value)) {
            $r = hexdec(substr($value, 0, 1)) * 17;
            $g = hexdec(substr($value, 1, 1)) * 17;
            $b = hexdec(substr($value, 2, 1)) * 17;
            $colors["{" . $key . "}"] = getColor($r, $g, $b);
        }
        if (preg_match('/^[0-9A-Fa-f]{6}$/', $value)) {
            $r = hexdec(substr($value, 0, 2));
            $g = hexdec(substr($value, 2, 2));
            $b = hexdec(substr($value, 4, 2));
            $colors["{" . $key . "}"] = getColor($r, $g, $b);
        }
    }
    $sOutline = 'border-width: 1px;';
    if (isset($data["c"]["sOutline"])) {
        switch ($data["c"]["sOutline"]) {
            case 2:
                $sOutline = 'border-width: 2px;';
                break;
            case 3:
                $sOutline = 'border-width: 2px; border-left: none; border-right: none;';
                break;
            case 4:
                $sOutline = 'border: none;';
                break;
        }
    }
    $sTitleMargin = 'padding-left: 0px;';
    if (isset($data["c"]["sTitleMargin"])) {
        $m = intval($data["c"]["sTitleMargin"]);
        $m = $m > 400 ? 400 : $m;
        $m = $m < 0 ? 0 : $m;
        $data["c"]["sTitleMargin"] = $m;
        $sTitleMargin = 'padding-left: ' . $m . 'px;';
    }
    $css = file_get_contents(INCLUDES . "p_themedesigner.css");
    $css = str_replace('{sOutline}', $sOutline, $css);
    $css = str_replace('{sTitleMargin}', $sTitleMargin, $css);
    $css = str_replace('{fileLogo}', $fileLogo, $css);
    $css = str_replace('{fileOuter}', $fileOuter, $css);
    $css = str_replace('{fileContainer}', $fileContainer, $css);
    $css = str_replace('{fileContainer2}', $fileContainer2, $css);
    foreach ($colors as $colorVar => $colorValue) {
        $css = str_replace($colorVar, getWebColor($colorValue), $css);
    }
    if (!isset($data["Tile"]) || isset($_POST["submitTheme"])) {
        $data["Tile"] = 0;
    }
    // Override some data from POST (if available)
    if (isset($_POST["BGLayoutTiledH"])) {
        $data["Tile"] |= 1;
    }
    if (isset($_POST["BGOuterTiledH"])) {
        $data["Tile"] |= 2;
    }
    if (isset($_POST["BGContainerTiledH"])) {
        $data["Tile"] |= 4;
    }
    if (isset($_POST["BGContainer2TiledH"])) {
        $data["Tile"] |= 8;
    }
    if (isset($_POST["BGLayoutTiledV"])) {
        $data["Tile"] |= 16;
    }
    if (isset($_POST["BGOuterTiledV"])) {
        $data["Tile"] |= 32;
    }
    if (isset($_POST["BGContainerTiledV"])) {
        $data["Tile"] |= 64;
    }
    if (isset($_POST["BGContainer2TiledV"])) {
        $data["Tile"] |= 128;
    }
    $css = str_replace('{layoutTiling}', getTiling($data["Tile"] & 1, $data["Tile"] & 16), $css);
    $css = str_replace('{outerTiling}', getTiling($data["Tile"] & 2, $data["Tile"] & 32), $css);
    $css = str_replace('{containerTiling}', getTiling($data["Tile"] & 4, $data["Tile"] & 64), $css);
    $css = str_replace('{container2Tiling}', getTiling($data["Tile"] & 8, $data["Tile"] & 128), $css);
    // Remove comments from the final CSS file.
    $css = preg_replace('/\\/\\*(.+?)\\*\\//', "", $css);
    if ($lastThemeFile != "") {
        $css_orig = file_get_contents($lastThemeFile);
    } else {
        $css_orig = "";
    }
    if ($css != $css_orig) {
        // Create new CSS file and delete the previous CSS file.
        $fp = fopen($themePath . "style-" . time() . ".css", "w");
        fwrite($fp, $css);
        fclose($fp);
        if ($lastThemeFile != "") {
            unlink($lastThemeFile);
        }
        // Store updated data to the database.
        $cusWhere = dbWhere(array("cusUser" => $useid, "cusIsClub" => $isClub));
        $result = sql_query("SELECT `cusid` FROM `customThemes`" . $cusWhere . "LIMIT 1");
        if (mysql_num_rows($result) == 0) {
            sql_query("INSERT INTO `customThemes`" . dbValues(array("cusUser" => $useid, "cusIsClub" => $isClub, "cusData" => serialize($data))));
        } else {
            sql_query("UPDATE `customThemes`" . dbSet(array("cusData" => serialize($data))) . $cusWhere . "LIMIT 1");
        }
        return true;
    } else {
        return false;
    }
}
示例#10
0
include INCLUDES . "mod_setmenu.php";
?>
</div>
<div class="container">
	<form action="<?php 
echo url(".");
?>
" method="post">
	<?php 
if (isset($_POST["submit"])) {
    // Options
    $_auth["useSidebarThumbs"] = isset($_POST["useSidebarThumbs"]) ? 1 : 0;
    // Sidebar
    $_auth["useSidebar"] = $_POST["useSidebar"];
    // Update the database
    sql_query("UPDATE `useExtData`" . dbSet(array("useSidebar" => $_auth["useSidebar"], "useSidebarThumbs" => $_auth["useSidebarThumbs"])) . dbWhere(array("useEid" => $_auth["useid"])));
    notice(_SET_SAVED);
}
// ======================================================================================================
// OPTIONS
// ======================================================================================================
?>
	<?php 
iefixStart();
?>
	<div class="sep largetext"><?php 
echo _OEKAKI_OPTIONS;
?>
</div>
	<div class="container2 notsowide">
		<table cellspacing="0" cellpadding="4" border="0">
示例#11
0
function updateSubmissionFavs($objid)
{
    $sql = "SELECT COUNT(*) FROM `favourites`" . dbWhere(array("favObj" => $objid));
    $result = sql_query($sql);
    $favCount = mysql_result($result, 0);
    $sql = "SELECT `objViewed` FROM `objExtData`" . dbWhere(array("objEid" => $objid));
    $result = sql_query($sql);
    $viewCount = mysql_result($result, 0);
    if ($viewCount == 0) {
        $popularity = 0;
    } else {
        $popularity = round($favCount * $favCount * 1000 / $viewCount);
    }
    sql_query("UPDATE `objects`" . dbSet(array("objPopularity" => $popularity)) . dbWhere(array("objid" => $objid)));
    sql_query("UPDATE `objExtData`" . dbSet(array("objFavs" => $favCount)) . dbWhere(array("objEid" => $objid)));
}
示例#12
0
 // for the current user.
 $folResult = sql_query("SELECT COUNT(*) FROM `folders`" . dbWhere(array("folid<>" => $folid, "folCreator" => $_auth["useid"], "folIdent" => $folIdent)));
 $conflicting = mysql_result($folResult, 0) > 0;
 mysql_free_result($folResult);
 if ($conflicting) {
     $defaultTitle = $folName;
     // Put it back in the form for edition
     notice(_SET_FOLDER_EXISTS);
     break;
 }
 $values = array("folCreator" => $_auth["useid"], "folName" => $folName, "folIdent" => $folIdent);
 if ($folid == 0) {
     sql_query("INSERT INTO `folders`" . dbValues($values));
     $folid = mysql_insert_id();
 } else {
     sql_query("UPDATE `folders`" . dbSet($values) . dbWhere(array("folid" => $folid)));
 }
 // Upload icon.
 include_once INCLUDES . "files.php";
 $iconError = checkUploadedFile("folIcon");
 if (!$iconError) {
     if (filesize($_FILES["folIcon"]["tmp_name"]) > $_config["maxIconSize"]) {
         $iconError = sprintf(_SET_ICON_SIZE_EXCEEDED, $_config["maxIconSize"]);
     } else {
         // Check avatar image size/type.
         $iconInfo = getimagesize($_FILES["folIcon"]["tmp_name"]);
         list($iconWidth, $iconHeight) = preg_split('/x/', $_config["iconResolution"]);
         if ($iconInfo[0] != $iconWidth || $iconInfo[1] != $iconHeight || $iconInfo[2] != 1 && $iconInfo[2] != 2 && $iconInfo[2] != 3) {
             $iconError = sprintf(_SET_ICON_TOO_LARGE, $_config["iconResolution"]);
         } else {
             // Upload folder icon to /files/foldericons/#/#####/
示例#13
0
// Confirm/Refuse a collaborative work.
$accept = isset($_GET["accept"]) ? $_GET["accept"] != "0" : false;
$sql = "SELECT `objid`, `objCreator` FROM `objects`, `objExtData`" . dbWhere(array("objid*" => "objEid", "objid" => intval($_cmd[1]), "objCollab" => $_auth["useid"], "objCollabConfirmed" => 0, "objPending" => 0, "objDeleted" => 0));
$objResult = sql_query($sql);
if (!($objData = mysql_fetch_assoc($objResult))) {
    include INCLUDES . "p_notfound.php";
    return;
}
mysql_free_result($objResult);
if ($accept) {
    $sql = "UPDATE `objExtData`" . dbSet(array("objCollabConfirmed" => 1)) . dbWhere(array("objEid" => $objData["objid"]));
    sql_query($sql);
    // Send to watchers.
    addArtUpdateToWatchers($_auth["useid"], $objData["objid"], 0, $objData["objCreator"]);
    removeDupeArtUpdates($objData["objid"]);
    // Move all associated comments from the last 10 days to Updates.
    $sql = "SELECT `comid`, `comCreator` FROM `comments`" . dbWhere(array("|1" => "`comSubmitDate` > DATE_SUB( CURDATE(), INTERVAL 10 DAY )", "comObj" => $objData["objid"], "comObjType" => "obj"));
    $comResult = sql_query($sql);
    while ($comData = mysql_fetch_assoc($comResult)) {
        if ($comData["comCreator"] == $_auth["useid"]) {
            continue;
        }
        addUpdate(updTypeComment, $_auth["useid"], $comData["comid"], $comData["comCreator"]);
    }
    mysql_free_result($comResult);
} else {
    $sql = "UPDATE `objects`" . dbSet(array("objCollab" => 0)) . dbWhere(array("objid" => $objData["objid"]));
    sql_query($sql);
}
redirect(url("view/" . $objData["objid"]));
示例#14
0
                 thumbifyImage($imageName, $newName, $thumbMaxWidth, $thumbMaxHeight, 86);
             }
         }
     }
 }
 // Update the database
 sql_query("UPDATE `clubs`" . dbSet(array("cluName" => $cluData["cluName"], "cluDesc" => $cluData["cluDesc"], "cluIsProject" => $cluData["cluIsProject"], "cluHide" => $cluData["cluHide"])) . dbWhere(array("cluid" => $cluData["cluid"])));
 //While the initial separation of these two queries was due to testing,
 //It has been decided to leave them separated until further notice to
 //prevent any possible issues that could arise from the ownership changes
 if (atLeastSModerator()) {
     // This is the query for supermods and higher, deals with club ownership
     sql_query("UPDATE `cluExtData`" . dbSet(array("cluRequireAccept" => $cluData["cluRequireAccept"], "cluFeaturedObj" => $cluData["cluFeaturedObj"], "cluFeaturedDesc" => $cluData["cluFeaturedDesc"], "cluProfile" => $cluData["cluProfile"], "cluNoMembers" => $cluData["cluNoMembers"], "cluCreator" => $cluData["cluCreator"])) . dbWhere(array("cluEid" => $cluData["cluid"])));
 } else {
     //This is the query for non-smoderators, does not affect club ownership
     sql_query("UPDATE `cluExtData`" . dbSet(array("cluRequireAccept" => $cluData["cluRequireAccept"], "cluFeaturedObj" => $cluData["cluFeaturedObj"], "cluFeaturedDesc" => $cluData["cluFeaturedDesc"], "cluProfile" => $cluData["cluProfile"], "cluNoMembers" => $cluData["cluNoMembers"])) . dbWhere(array("cluEid" => $cluData["cluid"])));
 }
 //Add and remove moderator functions
 if ($_POST["cluNewModerator"] != "") {
     //First we resolve that user's ID
     $clubNewMod = addslashes($_POST["cluNewModerator"]);
     if ($cluNewModId = getUseridByName($clubNewMod)) {
         //Checks if the user exists in the system
         //Now we can see if they're a member of this club, and if so, mod them
         $result = sql_query("SELECT `useCid` FROM `useClubs` WHERE `useCmember` = '" . $cluNewModId . "' AND `useCclub` = '{$cluid}' LIMIT 1");
         if ($newModData = mysql_fetch_assoc($result)) {
             // Are they actually a member? If so, then welcome aboard!
             sql_query("UPDATE `useClubs` SET `useCModerator`='1' WHERE `useCid` = '" . $newModData["useCid"] . "' LIMIT 1");
         } else {
             notice(sprintf(_CLUB_NOT_A_MEMBER, $clubNewMod));
         }