Example #1
0
                $query->bindValue(':creator', $ban['mod']);
                if ($ban['reason']) {
                    $query->bindValue(':reason', $ban['reason']);
                } else {
                    $query->bindValue(':reason', null, PDO::PARAM_NULL);
                }
                $query->bindValue(':seen', $ban['seen']);
                $query->execute() or error(db_error($query));
            }
            // Drop old bans table
            query("DROP TABLE ``bans``") or error(db_error());
            // Replace with new table
            query("RENAME TABLE ``bans_new_temp`` TO ``bans``") or error(db_error());
        case 'v0.9.6-dev-21':
        case 'v0.9.6-dev-21 + <a href="https://int.vichan.net/devel/">vichan-devel-4.4.90</a>':
            __query("CREATE TABLE IF NOT EXISTS ``ban_appeals`` (\n\t\t\t\t  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,\n\t\t\t\t  `ban_id` int(10) unsigned NOT NULL,\n\t\t\t\t  `time` int(10) unsigned NOT NULL,\n\t\t\t\t  `message` text NOT NULL,\n\t\t\t\t  `denied` tinyint(1) NOT NULL,\n\t\t\t\t  PRIMARY KEY (`id`),\n\t\t\t\t  KEY `ban_id` (`ban_id`)\n\t\t\t\t) ENGINE=MyISAM  DEFAULT CHARSET=utf8mb4 AUTO_INCREMENT=1 ;") or error(db_error());
        case 'v0.9.6-dev-22':
        case 'v0.9.6-dev-22 + <a href="https://int.vichan.net/devel/">vichan-devel-4.4.91</a>':
        case 'v0.9.6-dev-22 + <a href="https://int.vichan.net/devel/">vichan-devel-4.4.92</a>':
        case 'v0.9.6-dev-22 + <a href="https://int.vichan.net/devel/">vichan-devel-4.4.93</a>':
        case 'v0.9.6-dev-22 + <a href="https://int.vichan.net/devel/">vichan-devel-4.4.94</a>':
        case 'v0.9.6-dev-22 + <a href="https://int.vichan.net/devel/">vichan-devel-4.4.95</a>':
        case 'v0.9.6-dev-22 + <a href="https://int.vichan.net/devel/">vichan-devel-4.4.96</a>':
        case 'v0.9.6-dev-22 + <a href="https://int.vichan.net/devel/">vichan-devel-4.4.97</a>':
        case '4.4.97':
            if (!isset($_GET['confirm2'])) {
                $page['title'] = 'License Change';
                $page['body'] = '<p style="text-align:center">You are upgrading to a version which uses an amended license. The licenses included with vichan distributions prior to this version (4.4.98) are still valid for those versions, but no longer apply to this and newer versions.</p>' . '<textarea style="width:700px;height:370px;margin:auto;display:block;background:white;color:black" disabled>' . htmlentities(file_get_contents('LICENSE.md')) . '</textarea>
					<p style="text-align:center">
						<a href="?confirm2=1">I have read and understood the agreement. Proceed to upgrading.</a>
					</p>';
Example #2
0
function _user_permissions($username, $type)
{
    $user_query = "SELECT " . "exhibit_UserGroups.GroupID AS groupid " . "FROM website_users LEFT JOIN exhibit_UserGroups " . "ON (website_users.ID=exhibit_UserGroups.UserID) " . "WHERE website_users.Username='******'";
    "(exhibit_UserGroups.GroupID=exhibit_Groups.ID)";
    $user_results = __query($user_query, "", "");
    switch ($type) {
        case 'query':
            $user_groups = "Public=TRUE OR";
            while ($row = mysql_fetch_array($user_results)) {
                $user_groups .= " GroupID=" . $row['groupid'] . " OR";
            }
            if ($username == 'Anonymous') {
                $user_groups = "Public=TRUE ";
            }
            $user_groups = rtrim($user_groups, "OR");
            break;
        case 'array':
            $user_groups = array();
            while ($row = mysql_fetch_array($user_results)) {
                $user_groups[] = $row['groupid'];
            }
            break;
    }
    return $user_groups;
}
Example #3
0
            $keywords[] = $keyword2;
        }
        if ($keyword3 != "") {
            $keywords[] = $keyword3;
        }
        if (sizeof($keywords) >= 1) {
            _generate_search_images($source, $keywords[0], True);
            $search_text = "(All) " . $keywords[0];
            for ($x = 1; $x < sizeof($keywords); $x++) {
                __query("TRUNCATE TABLE exhibit_" . $target, "", "");
                _generate_search_comparison($source, $keywords[$x], $target);
                $temp_table = $target;
                $target = $source;
                $source = $temp_table;
                $search_text .= ", " . $keywords[$x];
            }
        }
        // source will always contain final results due to for loop.
        $search_query = "SELECT * FROM exhibit_" . $source . " WHERE " . _user_permissions($__user['Username'], 'query') . " GROUP BY ImageID, iPhotoLibraryID LIMIT 1000";
        _display_search($search_query, $search_text);
        __query("DROP TABLE exhibit_" . $source, "", "");
        __query("DROP TABLE exhibit_" . $target, "", "");
    }
} elseif ($roll and $library) {
    _display_images($roll, $library, $__user['Username']);
} else {
    _display_rolls($__user['Username']);
}
_page_section("search.png", "Search for photos");
_draw_search_key();
_page_footer();
function _display_permissions()
{
    global $__dbc;
    global $image_src;
    global $table_format;
    $roll_query = "SELECT exhibit_Rolls.*, exhibit_Permissions.GroupID AS GroupID, " . "exhibit_Permissions.Public AS Public FROM exhibit_Rolls LEFT JOIN " . "exhibit_Permissions ON " . "(exhibit_Rolls.iPhotoLibraryID=exhibit_Permissions.iPhotoLibraryID AND" . " exhibit_Rolls.RollID=exhibit_Permissions.RollID) " . "ORDER BY RollDate DESC";
    $roll_results = __query($roll_query, "", "");
    $group_query = "SELECT * FROM exhibit_Groups";
    $group_results = __query($group_query, "", "");
    $groups = array();
    while ($row = mysql_fetch_array($group_results)) {
        $groups[$row['ID']] = array('GroupName' => $row['GroupName'], 'GroupDescription' => $row['GroupDescription']);
    }
    echo $table_format . "<td>Cover </td><td>Roll Name</td><td>Roll Date</td>" . "<td># of Photos&nbsp;&nbsp;</td>" . "<td>Public?&nbsp;&nbsp;</td>" . "<td>Group&nbsp;&nbsp;</td><td>&nbsp;</td>";
    $table = array();
    while ($row = mysql_fetch_array($roll_results)) {
        $query = "select GUID, ThumbPath from exhibit_Images where " . "iPhotoLibraryID = " . $row['iPhotoLibraryID'] . " AND " . "ImageID = " . $row['KeyPhoto'];
        $image = mysql_fetch_array(__query($query, "", ""));
        $image_thumb = "<td width=\"40px\"><a href=\"http://www.example.com" . $_SERVER[PHP_SELF] . "?library=" . $row["iPhotoLibraryID"] . "&roll=" . $row['RollID'] . "\"><img border=\"0\" " . " class=\"exhibitpermissions\" " . "src=\"" . $image_src . $row['iPhotoLibraryID'] . $image['GUID'] . 'T.' . _find_file_extension($image['ThumbPath']) . "\" /></a></td>";
        $photo_count = "<td><span class=\"exhibitcontent\">" . $row["PhotoCount"];
        if ($row["PhotoCount"] == 1) {
            $photo_count .= " photo</span></td>";
        } else {
            $photo_count .= " photos</span></td>";
        }
        $roll_name = "<td><span class=\"exhibitcontent\">" . $row['RollName'] . "</span></td>";
        $roll_date = "<td><span class=\"exhibitcontent\">" . $row['RollDate'] . "</span></td>";
        $public = "<td><form action=\"" . $_SERVER[PHP_SELF] . "\" method=\"post\">" . "<input type=\"hidden\" name=\"library\" " . "value=\"" . $row['iPhotoLibraryID'] . "\">" . "<input type=\"hidden\" name=\"roll\" " . "value=\"" . $row['RollID'] . "\">" . "<select name=\"public\" size=\"1\">";
        if ($row['Public'] == 1) {
            $public .= "<option value=\"0\">False</option>" . "<option selected value=\"1\">True</option></select></td>";
        } else {
            $public .= "<option selected value=\"0\">False</option>" . "<option value=\"1\">True</option></select></td>";
        }
        $group_list = "<td><select name=\"group\" size=\"1\">";
        if (!array_key_exists($row['GroupID'], $groups)) {
            $group_list .= "<option selected value=\"0\">None.</option>";
        } else {
            $group_list .= "<option value=\"0\">None.</option>";
        }
        foreach ($groups as $key => $value) {
            if ($row['GroupID'] == $key) {
                $group_list .= "<option selected value=\"" . $key . "\">" . $value['GroupName'] . "</option>";
            } else {
                $group_list .= "<option value=\"" . $key . "\">" . $value['GroupName'] . "</option>";
            }
        }
        $group_list .= "</select></td>";
        $edit = "<td><input type=\"submit\" value=\" UPDATE \"></form></td>";
        $table[] = array($image_thumb, $roll_name, $roll_date, $photo_count, $public, $group_list, $edit);
    }
    _print_rows($table);
    echo "\n\t\t\t\t\t</table>\n";
}