function checkContainer($id, $path, $type)
{
    global $readClient, $writeClient;
    global $oldSite, $newSite;
    global $dryrun;
    global $verbose;
    global $checked;
    global $exit_on_error;
    global $newId;
    if (isset($checked["{$type}.{$path}"])) {
        return;
    } else {
        $checked["{$type}.{$path}"] = 1;
    }
    #
    # read source asset
    #
    if ($verbose > 2) {
        echo "Checking {$type} {$path}...\n";
    }
    if (isset($id)) {
        $ident->id = $id;
    }
    $ident->path = $path;
    $ident->siteName = $oldSite;
    $ident->type = strtolower($type);
    $readClient->read($ident);
    if (!$readClient->success) {
        echo "Failed reading: {$type} " . $path . "\n";
        echo print_r($ident);
        echo cleanup($readClient->response);
        if ($exit_on_error) {
            cleanexit();
        } else {
            return;
        }
    }
    $asset = $readClient->asset;
    #
    # save asset id to get around CSI-108
    #
    $ident->id = $asset->{$type}->id;
    #
    # see if asset already exists in new location
    # (even if we know its newID, we still need to check for children)
    #
    if ($verbose > 3) {
        echo "Checking new {$type} {$path} ...\n";
    }
    $newident->path = $path;
    $newident->siteName = $newSite;
    $newident->type = $ident->type;
    $writeClient->read($newident);
    if ($writeClient->success) {
        #
        # Note any children, since we don't need to create them
        #
        $newasset = $writeClient->asset;
        $newId[$asset->{$type}->id] = $newasset->{$type}->id;
        if (isset($newasset->{$type}->children) && isset($newasset->{$type}->children->child)) {
            $children = $newasset->{$type}->children->child;
            if (!is_array($children)) {
                $children = array($children);
            }
            while ($cur = array_pop($children)) {
                $ctype = $cur->type;
                $cpath = $cur->path->path;
                if ($ctype == 'assetfactory') {
                    $ctype = 'assetFactory';
                }
                if ($ctype == 'contenttype') {
                    $ctype = 'contentType';
                }
                if ($ctype == 'metadataset') {
                    $ctype = 'metadataSet';
                }
                if ($ctype == 'pageconfigurationset') {
                    $ctype = 'pageConfigurationSet';
                }
                if ($ctype == 'publishset') {
                    $ctype = 'publishSet';
                }
                if ($ctype == 'workflowdefinition') {
                    $ctype = 'workflowDefinition';
                }
                if ($ctype == 'datadefinition') {
                    $ctype = 'dataDefinition';
                }
                if (preg_match("/transport_.*/", $ctype)) {
                    $ctype = "transport";
                }
                if (!preg_match('/container$/', $ctype)) {
                    $checked["{$ctype}.{$cpath}"] = 1;
                }
                $newId["{$ctype}.{$cpath}"] = $cur->id;
                #if ($verbose > 2) echo "Ok: $ctype $cpath\n";
            }
        }
        return;
    }
    if (isset($asset->{$type}->parentContainerPath)) {
        checkContainer($asset->{$type}->parentContainerId, $asset->{$type}->parentContainerPath, $type);
    }
    setSite($asset, $type);
    removeIds($asset->{$type});
    unset($asset->{$type}->path);
    unset($asset->{$type}->children);
    if ($verbose) {
        echo "Creating: {$type} " . $path . "\n";
    }
    if (!$dryrun) {
        $writeClient->create($asset);
        if ($writeClient->success) {
            $newId[$ident->id] = $writeClient->createdAssetId;
            #echo "Created $type " . $newId[$ident->id] . "\n";
            remember($ident);
        } else {
            echo "\nFailed: {$type} " . $path . "\n";
            print_r($asset);
            echo cleanup($writeClient->response);
            if ($exit_on_error) {
                cleanexit();
            } else {
                return;
            }
        }
    }
}
Exemplo n.º 2
0
<?php

include "common.php";
session_start();
if (!isset($_SESSION['user']) && empty($_SESSION['user'])) {
    ?>
<!DOCTYPE html>
<html>
    
    <?php 
    head();
    ?>
	<body>
		<?php 
    remember();
    ?>
		<div id="main">
			<p>
				The best way to manage your tasks. <br />
				Never forget the cow (or anything else) again!
			</p>

			<p>
				Log in now to manage your to-do list. <br />
				If you do not have an account, one will be created for you.<br /><br />
				<strong>The user name must be 3-8 characters long, begin with a lowercase letter, and consist entirely of lowercase letters and numbers.</strong><br/>
				<strong>The password must be 6-12 characters long, begin with a number, and end with any character that is <em>not</em> a letter or number. </strong>
			</p>

			<form id="loginform" action="login.php" method="post">
				<div><input name="name" type="text" size="8" autofocus="autofocus" /> <strong>User Name</strong></div>
Exemplo n.º 3
0
<table border="0" width="500" cellspacing="0" cellpadding="2" class="tables" align="left">
<?php 
function remember($file, $pattern)
{
    if (file_exists($file)) {
        $fp = fopen($file, "r");
        $data = fgets($fp, 4096);
        $data = explode($pattern, $data);
        return $data;
        fclose($fp);
    }
}
if (isset($_SESSION["remember"])) {
    $remember = explode('§', $list1);
} elseif (file_exists('db/coupon/sessions.dat')) {
    $remember = remember('db/coupon/sessions.dat', '§');
}
if (file_exists($ItemFile)) {
    @($fp = fopen($ItemFile, 'r'));
    $i = 0;
    while (!feof($fp)) {
        $class = $i % 2;
        $ligne = fgets($fp, 4096);
        $contents = explode("|", $ligne);
        echo '<tr>';
        if (!empty($contents[0])) {
            echo '<td class="row' . $class . '">ID' . @$contents[0] . '</td>', "\n";
            echo '<td class="row' . $class . '">' . @$contents[2] . '</td>', "\n";
            echo '<td class="row' . $class . '"><input type="checkbox" name="item[]" value="' . @$contents[1] . '"';
            if (isset($remember) && in_array($contents[1], $remember)) {
                echo "checked";