Example #1
0
HTMLstuff::RefererRegister($_SERVER['REQUEST_URI']);
$TagID = Utils::SafeIntFromQS('tag_id');
$DeleteTag = array_key_exists('hidTagToDelete', $_POST) && $TagID && $_POST['hidTagToDelete'] == $TagID;
$Tags = Tag::GetTags();
$Tag = Tag::Filter($Tags, $TagID);
$Tag = $TagID && $Tag ? $Tag[0] : new Tag();
$Tagcount = 0;
$TagList = NULL;
$DisableControls = $DeleteTag || !$CurrentUser->hasPermission(RIGHT_TAG_EDIT) && !is_null($TagID) || !$CurrentUser->hasPermission(RIGHT_TAG_ADD) && is_null($TagID);
$DisableDefaultButton = !$CurrentUser->hasPermission(RIGHT_TAG_DELETE) && !is_null($TagID) && $DeleteTag || !$CurrentUser->hasPermission(RIGHT_TAG_EDIT) && !is_null($TagID) && !$DeleteTag || !$CurrentUser->hasPermission(RIGHT_TAG_ADD) && is_null($TagID);
if (array_key_exists('hidAction', $_POST) && $_POST['hidAction'] == 'TagView') {
    $Tag->setName(Utils::NullIfEmpty($_POST['txtName']));
    if ($Tag->getID()) {
        if ($DeleteTag) {
            if ($CurrentUser->hasPermission(RIGHT_TAG_DELETE) && Tag::Delete($Tag, $CurrentUser)) {
                $t2as = Tag2All::GetTag2Alls(new Tag2AllSearchParameters($Tag->getID()));
                Tag2All::DeleteMulti($t2as, $CurrentUser);
                header('location:' . $_SERVER['PHP_SELF']);
                exit;
            }
        } else {
            if ($CurrentUser->hasPermission(RIGHT_TAG_EDIT) && Tag::Update($Tag, $CurrentUser)) {
                header('location:' . $_SERVER['PHP_SELF']);
                exit;
            }
        }
    } else {
        if ($CurrentUser->hasPermission(RIGHT_TAG_ADD) && Tag::Insert($Tag, $CurrentUser)) {
            header('location:' . $_SERVER['PHP_SELF']);
            exit;
        }
Example #2
0
<?php

include 'cd.php';
ini_set('max_execution_time', '3600');
$CurrentUser = Authentication::Authenticate();
$ModelID = Utils::SafeIntFromQS('model_id');
$XmlFromFile = NULL;
$fileToProcess = 'setup_data.xml';
$Tag2AllsInDB = Tag2All::GetTag2Alls();
$TagsInDB = Tag::GetTags();
if (array_key_exists('file', $_GET) && isset($_GET['file'])) {
    $fileToProcess = $_GET['file'];
}
if (isset($argv) && $argc > 0) {
    if (file_exists(sprintf('%1$s/%2$s', dirname($_SERVER['PHP_SELF']), $fileToProcess))) {
        $XmlFromFile = new SimpleXMLElement(file_get_contents(sprintf('%1$s/%2$s', dirname($_SERVER['PHP_SELF']), $fileToProcess)));
    }
} else {
    if (file_exists($fileToProcess)) {
        $XmlFromFile = new SimpleXMLElement(file_get_contents($fileToProcess));
    }
}
if ($XmlFromFile) {
    $ModelsInDb = Model::GetModels();
    $SetsInDb = Set::GetSets();
    $DatesInDb = Date::GetDates();
    $VideosInDb = Video::GetVideos();
    if (isset($argv) && $argc > 0) {
        $bi = new BusyIndicator(count($XmlFromFile->Model), 0);
    }
    foreach ($XmlFromFile->Model as $Model) {
Example #3
0
<?php

include 'cd.php';
$CurrentUser = Authentication::Authenticate();
HTMLstuff::RefererRegister($_SERVER['REQUEST_URI']);
$ModelID = Utils::SafeIntFromQS('model_id');
$SetID = Utils::SafeIntFromQS('set_id');
$ImageID = Utils::SafeIntFromQS('image_id');
$TagsInDB = Tag::GetTags();
$TagsThisImage = Tag2All::GetTag2Alls(new Tag2AllSearchParameters(FALSE, FALSE, FALSE, is_null($ModelID) ? FALSE : $ModelID, FALSE, is_null($SetID) ? FALSE : $SetID, FALSE, is_null($ImageID) ? FALSE : $ImageID, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE));
if (!isset($ModelID)) {
    header('location:index.php');
    exit;
}
if (!isset($SetID)) {
    header('location:set.php?model_id=' . $ModelID);
    exit;
}
$DeleteImage = array_key_exists('cmd', $_GET) && $_GET['cmd'] && $_GET['cmd'] == COMMAND_DELETE;
$ReturnURL = sprintf('image.php?model_id=%1$d&set_id=%2$d', $ModelID, $SetID);
$DisableControls = $DeleteImage || !$CurrentUser->hasPermission(RIGHT_IMAGE_EDIT) && !is_null($ImageID) || !$CurrentUser->hasPermission(RIGHT_IMAGE_ADD) && is_null($ImageID);
$DisableDefaultButton = !$CurrentUser->hasPermission(RIGHT_IMAGE_DELETE) && !is_null($ImageID) && $DeleteImage || !$CurrentUser->hasPermission(RIGHT_IMAGE_EDIT) && !is_null($ImageID) && !$DeleteImage || !$CurrentUser->hasPermission(RIGHT_IMAGE_ADD) && is_null($ImageID);
$DisableCacheDeleteButton = $DeleteImage || is_null($ImageID) || !$CurrentUser->hasPermission(RIGHT_CACHE_DELETE);
/* @var $Image Image */
/* @var $Set Set */
/* @var $Model Model */
if ($ImageID != NULL) {
    $Images = Image::GetImages(new ImageSearchParameters($ImageID, FALSE, is_null($SetID) ? FALSE : $SetID, FALSE, is_null($ModelID) ? FALSE : $ModelID));
    if ($Images) {
        $Image = $Images[0];
    } else {
Example #4
0
<?php

include 'cd.php';
$CurrentUser = Authentication::Authenticate();
HTMLstuff::RefererRegister($_SERVER['REQUEST_URI']);
$ModelID = Utils::SafeIntFromQS('model_id');
$SetID = Utils::SafeIntFromQS('set_id');
$VideoID = Utils::SafeIntFromQS('video_id');
$TagsInDB = Tag::GetTags();
$TagsThisVideo = Tag2All::GetTag2Alls(new Tag2AllSearchParameters(FALSE, FALSE, FALSE, $ModelID, FALSE, $SetID, FALSE, FALSE, FALSE, $VideoID, FALSE, FALSE, FALSE, TRUE, FALSE));
if (!isset($ModelID)) {
    header('location:index.php');
    exit;
}
if (!isset($SetID)) {
    header('location:set.php?model_id=' . $ModelID);
    exit;
}
$DeleteVideo = array_key_exists('cmd', $_GET) && $_GET['cmd'] && $_GET['cmd'] == COMMAND_DELETE;
$ReturnURL = sprintf('video.php?model_id=%1$d&set_id=%2$d', $ModelID, $SetID);
$DisableControls = $DeleteVideo || !$CurrentUser->hasPermission(RIGHT_VIDEO_EDIT) && !is_null($VideoID) || !$CurrentUser->hasPermission(RIGHT_VIDEO_ADD) && is_null($VideoID);
$DisableDefaultButton = !$CurrentUser->hasPermission(RIGHT_VIDEO_DELETE) && !is_null($VideoID) && $DeleteVideo || !$CurrentUser->hasPermission(RIGHT_VIDEO_EDIT) && !is_null($VideoID) && !$DeleteVideo || !$CurrentUser->hasPermission(RIGHT_VIDEO_ADD) && is_null($VideoID);
$DisableCacheDeleteButton = $DeleteVideo || is_null($VideoID) || !$CurrentUser->hasPermission(RIGHT_CACHE_DELETE);
/* @var $Video Video */
/* @var $Set Set */
/* @var $Model Model */
if ($VideoID != NULL) {
    $Videos = Video::GetVideos(new VideoSearchParameters($VideoID, FALSE, $SetID, FALSE, $ModelID));
    if ($Videos) {
        $Video = $Videos[0];
    } else {
Example #5
0
    $max_results = Utils::SafeIntFromQS('x');
    $max_results <= 0 ? 30 : $max_results;
}
$from = $page * $max_results - $max_results;
$q = array_key_exists('q', $_GET) ? $_GET['q'] : (array_key_exists('q', $_SESSION) ? $_SESSION['q'] : '');
$_SESSION['q'] = $q;
$searchMode = array_key_exists('t', $_GET) ? $_GET['t'] : (array_key_exists('t', $_SESSION) ? $_SESSION['t'] : 'SET');
$_SESSION['t'] = $searchMode;
/* Core search-processing */
$filteredTags = Tag::FilterByCSV($Tags, $q);
$filteredTagIDs = array();
foreach ($filteredTags as $t) {
    $filteredTagIDs[] = $t->getID();
}
/* Fetch Tag2Alls if tags were entered, default to no results when $q is empty. */
$Tag2Alls = $filteredTagIDs ? Tag2All::GetTag2Alls(new Tag2AllSearchParameters(FALSE, $filteredTagIDs)) : array();
/* Model-filtering */
$AllModelIDs = array();
foreach ($Tag2Alls as $t2a) {
    $AllModelIDs[] = $t2a->getModelID();
}
$ModelIDsToShow = array();
foreach (array_unique($AllModelIDs) as $modelid) {
    foreach ($filteredTagIDs as $ftid) {
        if (count(Tag2All::Filter($Tag2Alls, $ftid, $modelid, FALSE, FALSE, FALSE)) == 0) {
            continue 2;
        }
    }
    if (!is_null($modelid)) {
        $ModelIDsToShow[] = $modelid;
    }
Example #6
0
ini_set('max_execution_time', '3600');
ob_start();
$CurrentUser = Authentication::Authenticate();
if (!$CurrentUser->hasPermission(RIGHT_EXPORT_XML)) {
    $e = new Error(RIGHTS_ERR_USERNOTALLOWED);
    Error::AddError($e);
    HTMLstuff::RefererRedirect();
}
$ModelID = Utils::SafeIntFromQS('model_id');
$IncludeImages = Utils::SafeBoolFromQS('includeimages');
$IncludeVideos = Utils::SafeBoolFromQS('includevideos');
$TaggedOnly = Utils::SafeBoolFromQS('taggedonly');
$Models = Model::GetModels(new ModelSearchParameters(is_null($ModelID) ? FALSE : $ModelID));
$Sets = Set::GetSets(new SetSearchParameters(FALSE, FALSE, is_null($ModelID) ? FALSE : $ModelID));
$Dates = Date::GetDates();
$Tag2Alls = Tag2All::GetTag2Alls();
$outfile = 'CandyDollDB.xml';
if ($ModelID && count($Models) > 0) {
    $Model = $Models[0];
    $outfile = sprintf('CandyDollDB %1$s%2$s%3$s.xml', $Model->GetFullName(), $IncludeImages && $IncludeVideos ? ' ' . $lang->g('LabelComplete') : ($IncludeImages ? ' ' . $lang->g('NavigationImages') : ($IncludeVideos ? ' ' . $lang->g('NavigationVideos') : NULL)), ($IncludeImages || $IncludeVideos) && $TaggedOnly ? ' ' . $lang->g('LabelTagged') : NULL);
}
header(sprintf('Content-Type: %1$s', Utils::GetMime('xml')));
header(sprintf('Content-Disposition: attachment; filename="%1$s"', $outfile));
$xmlw = new XMLWriter();
$xmlw->openUri('php://output');
$xmlw->setIndent(TRUE);
$xmlw->setIndentString("\t");
$xmlw->startDocument('1.0', 'UTF-8');
$xmlw->startElement('Models');
$xmlw->writeAttributeNs('xmlns', 'xsi', NULL, 'http://www.w3.org/2001/XMLSchema-instance');
$xmlw->writeAttributeNs('xsi', 'noNamespaceSchemaLocation', NULL, 'candydolldb.xsd');
Example #7
0
<?php

include 'cd.php';
$CurrentUser = Authentication::Authenticate();
HTMLstuff::RefererRegister($_SERVER['REQUEST_URI']);
$ModelID = Utils::SafeIntFromQS('model_id');
$DeleteModel = array_key_exists('cmd', $_GET) && $_GET['cmd'] == COMMAND_DELETE;
$DisableControls = $DeleteModel || !$CurrentUser->hasPermission(RIGHT_MODEL_EDIT) && !is_null($ModelID) || !$CurrentUser->hasPermission(RIGHT_MODEL_ADD) && is_null($ModelID);
$DisableDefaultButton = !$CurrentUser->hasPermission(RIGHT_MODEL_DELETE) && !is_null($ModelID) && $DeleteModel || !$CurrentUser->hasPermission(RIGHT_MODEL_EDIT) && !is_null($ModelID) && !$DeleteModel || !$CurrentUser->hasPermission(RIGHT_MODEL_ADD) && is_null($ModelID);
$DisableCacheDeleteButton = $DeleteModel || is_null($ModelID) || !$CurrentUser->hasPermission(RIGHT_CACHE_DELETE);
$TagsInDB = Tag::GetTags();
$TagsThisModel = Tag2All::GetTag2Alls(new Tag2AllSearchParameters(FALSE, FALSE, FALSE, $ModelID, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE));
if ($ModelID) {
    $Models = Model::GetModels(new ModelSearchParameters($ModelID));
    if ($Models) {
        $Model = $Models[0];
    } else {
        HTMLstuff::RefererRedirect();
    }
} else {
    $Model = new Model(NULL, $lang->g('NavigationNewModel'));
}
if (array_key_exists('hidAction', $_POST) && $_POST['hidAction'] == 'ModelView') {
    $Model->setFirstName(Utils::NullIfEmpty($_POST['txtFirstName']));
    $Model->setLastName(Utils::NullIfEmpty($_POST['txtLastName']));
    if ($_POST['txtBirthDate'] && $_POST['txtBirthDate'] != 'YYYY-MM-DD' && strtotime($_POST['txtBirthDate']) !== FALSE) {
        $Model->setBirthDate(strtotime($_POST['txtBirthDate']));
    } else {
        $Model->setBirthDate(-1);
    }
    $tags = Tag::GetTagArray($_POST['txtTags']);