Esempio n. 1
0
 /**
  * Search tree test program.
  *
  * @param object ISearchTree $tree The tree to test.
  */
 public static function test(ISearchTree $tree)
 {
     printf("AbstractSearchTree test program.\n");
     printf("%s\n", str($tree));
     for ($i = 1; $i <= 8; ++$i) {
         $tree->insert(box($i));
     }
     printf("%s\n", str($tree));
     printf("Breadth-First traversal\n");
     $tree->breadthFirstTraversal(new PrintingVisitor(STDOUT));
     printf("Preorder traversal\n");
     $tree->depthFirstTraversal(new PreOrder(new PrintingVisitor(STDOUT)));
     printf("Inorder traversal\n");
     $tree->depthFirstTraversal(new InOrder(new PrintingVisitor(STDOUT)));
     printf("Postorder traversal\n");
     $tree->depthFirstTraversal(new PostOrder(new PrintingVisitor(STDOUT)));
     printf("Using foreach\n");
     foreach ($tree as $obj) {
         printf("%s\n", str($obj));
     }
     printf("Using reduce\n");
     $tree->reduce(create_function('$sum,$obj', 'printf("%s\\n", str($obj));'), '');
     printf("Using accept\n");
     $tree->accept(new ReducingVisitor(create_function('$sum,$obj', 'printf("%s\\n", str($obj));'), ''));
     printf("Withdrawing 4\n");
     $obj = $tree->find(box(4));
     try {
         $tree->withdraw($obj);
         printf("%s\n", str($tree));
     } catch (Exception $e) {
         printf("Caught %s\n", $e->getMessage());
     }
 }
 /**
  * PriorityQueue test method.
  *
  * @param object IPriorityQueue $pqueue The queue to test.
  */
 public static function test(IPriorityQueue $pqueue)
 {
     printf("AbstractPriorityQueue test program.\n");
     printf("%s\n", str($pqueue));
     $pqueue->enqueue(box(3));
     $pqueue->enqueue(box(1));
     $pqueue->enqueue(box(4));
     $pqueue->enqueue(box(1));
     $pqueue->enqueue(box(5));
     $pqueue->enqueue(box(9));
     $pqueue->enqueue(box(2));
     $pqueue->enqueue(box(6));
     $pqueue->enqueue(box(5));
     $pqueue->enqueue(box(4));
     printf("%s\n", str($pqueue));
     printf("Using reduce\n");
     $pqueue->reduce(create_function('$sum,$obj', 'printf("%s\\n", str($obj));'), '');
     printf("Using foreach\n");
     foreach ($pqueue as $obj) {
         printf("%s\n", str($obj));
     }
     printf("Dequeueing\n");
     while (!$pqueue->isEmpty()) {
         $obj = $pqueue->dequeueMin();
         printf("%s\n", str($obj));
     }
 }
Esempio n. 3
0
 /**
  * Stack test method.
  *
  * @param object IStack $stack The stack to test.
  */
 public static function test(IStack $stack)
 {
     printf("AbstractStack test program.\n");
     for ($i = 0; $i < 6; ++$i) {
         if ($stack->isFull()) {
             break;
         }
         $stack->push(box($i));
     }
     printf("%s\n", str($stack));
     printf("Using foreach\n");
     foreach ($stack as $obj) {
         printf("%s\n", str($obj));
     }
     printf("Using reduce\n");
     $stack->reduce(create_function('$sum,$obj', 'printf("%s\\n", str($obj));'), '');
     printf("Top is %s\n", str($stack->getTop()));
     printf("Popping\n");
     while (!$stack->isEmpty()) {
         $obj = $stack->pop();
         printf("%s\n", str($obj));
     }
     $stack->push(box(2));
     $stack->push(box(4));
     $stack->push(box(6));
     printf("%s\n", str($stack));
     printf("Purging\n");
     $stack->purge();
     printf("%s\n", str($stack));
 }
Esempio n. 4
0
 /**
  * OrderedList test method.
  *
  * @param object IOrderedList $list The list to test.
  */
 public static function test(IOrderedList $list)
 {
     printf("AbstractOrderedList test program.\n");
     $list->insert(box(1));
     $list->insert(box(2));
     $list->insert(box(3));
     $list->insert(box(4));
     printf("%s\n", str($list));
     $obj = $list->find(box(2));
     $list->withdraw($obj);
     printf("%s\n", str($list));
     $position = $list->findPosition(box(3));
     $position->insertAfter(box(5));
     printf("%s\n", str($list));
     $position->insertBefore(box(6));
     printf("%s\n", str($list));
     $position->withdraw();
     printf("%s\n", str($list));
     printf("Using foreach\n");
     foreach ($list as $obj) {
         printf("%s\n", str($obj));
     }
     printf("Using reduce\n");
     $list->reduce(create_function('$sum,$obj', 'printf("%s\\n", str($obj));'), '');
 }
function rhcontent()
{
    date_default_timezone_set("Europe/London");
    $stuff = "Submitted " . date('l dS \\of F Y h:i:s A') . "\n";
    ob_start();
    print_r($_POST);
    $stuff .= ob_get_contents();
    ob_end_clean();
    $ouremail = "*****@*****.**";
    mail($ouremail, "Swaledale booking", $stuff, "From: {$ouremail}");
    extract($_POST);
    $balance = $cost - 25;
    $message = <<<EOT
_Thanks for your booking request._

We can confirm your place on the Swaledale Squeeze once we have received your deposit of £25 payable to Swaledale Squeeze at: 

    Steven Bradley
    Annfield House
    Front Street
    Langley Park
    Durham
    DH7 9XE

If you wish you can pay the full amount of £{$cost} now or pay the deposit now and the balance of £{$balance} by 1st May 2016.

Once I receive your deposit I'll let you know.

Thanks from Steven
EOT;
    box(Markdown($message));
    mail($_POST['email'], "Swaledale Squeeze: thanks for booking", $message, "From: {$ouremail}");
    box("We've also sent these instructions to your email address. Thanks again.");
}
Esempio n. 6
0
 /**
  * Deque test method.
  *
  * @param object IDeque $deque The deque to test.
  */
 public static function test(IDeque $deque)
 {
     printf("AbstractDeque test program.\n");
     for ($i = 0; $i <= 5; ++$i) {
         if (!$deque->isFull()) {
             $deque->enqueueHead(box($i));
         }
         if (!$deque->isFull()) {
             $deque->enqueueTail(box($i));
         }
     }
     printf("%s\n", str($deque));
     printf("getHead = %s\n", str($deque->getHead()));
     printf("getTail = %s\n", str($deque->getTail()));
     printf("Using reduce\n");
     $deque->reduce(create_function('$sum,$obj', 'printf("%s\\n", str($obj));'), '');
     printf("Using foreach\n");
     foreach ($deque as $obj) {
         printf("%s\n", str($obj));
     }
     printf("Dequeueing\n");
     while (!$deque->isEmpty()) {
         printf("%s\n", str($deque->dequeueHead()));
         if ($deque->isEmpty()) {
             break;
         }
         printf("%s\n", str($deque->dequeueTail()));
     }
 }
function rhcontent()
{
    box("<h1>For everybody</h1>\r\n<p>\r\nAll of the workshop sessions take place in the Youth Hostel. Coffee and tea are povided in break times. Three kegs of the local Black Sheep Ale are available for self-service with an honesty box and other alcoholic drinks are available to buy from the Youth Hostel. You are welcome to bring your own alcohol to the ceilidh but not to consume at Grinton Lodge.\r\n</p>");
    box("<h1>Youth Hostel bunks</h1>\r\n<p>Most people stay in the Youth Hostel itself, in comfortable bunk rooms with provided bedding. Meals (breakfast, lunch and dinner) are included for all those in bunks, with an optional Friday evening meal at 7.00.</p>\r\n");
    box("<h1>Camping</h1>\r\n<p>\r\nThere is a camping field next to the Youth Hostel which is suitable for tents, although access by car to the camping field is difficult. (Actually, getting in is quite easy, but getting out can be tricky, particularly if the grass is wet.) Camper vans can stay in the courtyard of the Youth Hostel with access to a toilet, but no electric hook-up. Campers are  welcome to use the self-catering kitchen in the hostel.\r\n</p>");
    box("<h1>Pods</h1>\r\n<p>\r\nThere are a some self-catering pods in the grounds of the hostel, which are a bit like wooden teepees. The largest of these pods can sleep up to five people at a push, the smaller ones can sleep up to three.\r\n</p>\r\n");
    box("<h1>Bed and breakfast</h1>\r\n<p>\r\nThere is a range of bed and breakfast accommodation in the area which you would need to book independently. If you have difficulty finding somewhere appropriate then please let us know and we may be able to help.\r\n</p>");
}
Esempio n. 8
0
 function describe($message, $closure, $timeout = null, $type = 'normal')
 {
     if (!Suite::current()) {
         $suite = box('kahlan')->get('suite.global');
         return $suite->describe($message, $closure, $timeout, $type);
     }
     return Suite::current()->describe($message, $closure, $timeout, $type);
 }
Esempio n. 9
0
 /**
  * Builds an N-ary tree that contains character keys in the given range.
  *
  * @param integer lo The lower bound of the range.
  * @param integer hi The upper bound of the range.
  * @return An N-ary tree.
  */
 public static function buildTree($lo, $hi)
 {
     $mid = intval(($lo + $hi) / 2);
     $result = new NaryTree(2, box(chr($mid)));
     if ($lo < $mid) {
         $result->attachSubtree(0, self::buildTree($lo, $mid - 1));
     }
     if ($hi > $mid) {
         $result->attachSubtree(1, self::buildTree($mid + 1, $hi));
     }
     return $result;
 }
Esempio n. 10
0
 /**
  * SortedList test method.
  *
  * @param object ISortedList $list The list to test.
  */
 public static function test(ISortedList $list)
 {
     printf("AbstractSortedList test program.\n");
     $list->insert(box(4));
     $list->insert(box(3));
     $list->insert(box(2));
     $list->insert(box(1));
     printf("%s\n", str($list));
     $obj = $list->find(box(2));
     $list->withdraw($obj);
     printf("%s\n", str($list));
     printf("Using foreach\n");
     foreach ($list as $obj) {
         printf("%s\n", str($obj));
     }
 }
Esempio n. 11
0
 /**
  * Main program.
  *
  * @param array $args Command-line arguments.
  * @return integer Zero on success; non-zero on failure.
  */
 public static function main($args)
 {
     printf("Box main program.\n");
     $status = 0;
     $box = box(false);
     printf("%s\n", str($box));
     $box = box(57);
     printf("%s\n", str($box));
     $box = box(1.5);
     printf("%s\n", str($box));
     $box = box('test');
     printf("%s\n", str($box));
     $box = box(array(1, 2, 3));
     printf("%s\n", str($box));
     return $status;
 }
Esempio n. 12
0
function rhcontent()
{
    box("<h1>Concertina weekend 19-21 May 2017</h1>\n<p>Details of tutors are yet to be confirmed, but keep these dates in your diary if you'd like to come in 2017.</p>\n");
    /*
    box("<h1>Concertina weekend 20-22 May 2016</h1>
    <p>The guest tutors for the 2016 squeeze are Brian Peters (Anglo),
    Iris Bishop (Duet) and 
    Alex Wade (English), with additional workshops from Paul McCann (Duet)
    and Rob Say (English). Our regular tutors are Harry Scurfield (Anglo), Paul Walker (English/Anglo), Carolyn Wade (Band)  and Dave Ball (Band/English).</p>
    ");
    */
    /*
    Use the navigation links on the left hand side to find out 
    ore about the <a href='course.php'>tutors and course details</a>, <a href='accommodation.php'>accommodation</a> and <a href='booking.php'>booking</a>
    */
    box("<img src='images/friendly_concertina.jpg' alt='friendly concertina' height='313' align='center'/>   ");
}
 /**
  * DoubledEndedPriorityQueue test method.
  *
  * @param object IPriorityQueue $pqueue The queue to test.
  */
 public static function test(IPriorityQueue $pqueue)
 {
     printf("AbstractDoubledEndedPriorityQueue test program.\n");
     AbstractPriorityQueue::test($pqueue);
     printf("%s\n", str($pqueue));
     $pqueue->enqueue(box(3));
     $pqueue->enqueue(box(1));
     $pqueue->enqueue(box(4));
     $pqueue->enqueue(box(1));
     $pqueue->enqueue(box(5));
     $pqueue->enqueue(box(9));
     $pqueue->enqueue(box(2));
     $pqueue->enqueue(box(6));
     $pqueue->enqueue(box(5));
     $pqueue->enqueue(box(4));
     printf("%s\n", str($pqueue));
     while (!$pqueue->isEmpty()) {
         $obj = $pqueue->dequeueMax();
         printf("%s\n", str($obj));
     }
 }
Esempio n. 14
0
function rhcontent()
{
    box("<h1>Tutors</h1>\r\n<p>The guest tutors for the 2016 squeeze are Brian Peters (Anglo),\r\nIris Bishop (Duet) and \r\nAlex Wade (English), with additional workshops from Paul McCann (Duet)\r\nand Rob Say (English). Our regular tutors are Harry Scurfield (Anglo), Paul Walker (English/Anglo), Carolyn Wade (Band)  and Dave Ball (Band/English). Together they provide workshops covering a whole range of concertina playing for different abilities, systems and styles.\r\n</p>");
    box("<h1>Timetable</h1>\r\n<p>\r\nThe weekend starts on Friday 20th May. We have two informal sessions including the Dotty session, with written music provided for the tunes. Saturday includes teaching workshops in the morning and afternoon, an informal tea-time concert and a ceilidh in the evening at Reeth Memorial Hall, with the band for the ceilidh and the 'spots' provided by participants. There are more workshops on Sunday morning before the farewell concert on Sunday afternoon, again in Reeth Memorial Hall, featuring spots from the tutors and their workshop groups. You can download more details on the <a href='2016/SwaledaleProgramme2016.pdf'>exact timings</a> and <a href='2016/SwaledaleWorkshopDetails2016.pdf'>workshop details</a>.</p>");
    box("<h1>Other features</h1>\r\n<p>\r\nOn Friday afternoon there is a walk around Swaledale for those who wish to join it. We also have Dave Elliott's concertina clinic and Chris Algar's (Barleycorn Concertinas) emporium on Saturday. Families and friends are welcome too - they may enjoy the area's many craft shops, tearooms and outstanding walks and are welcome to bring other musical instruments for joining in sessions or the ceilidh band. \r\n</p>");
}
Esempio n. 15
0
<?php

namespace Chaos\Database\Spec\Suite;

use Lead\Set\Set;
use Chaos\ChaosException;
use Chaos\Database\DatabaseException;
use Chaos\Model;
use Chaos\Finders;
use Chaos\Database\Query;
use Chaos\Database\Schema;
use Chaos\Database\Spec\Fixture\Fixtures;
$box = box('chaos.spec');
$connections = ["MySQL" => $box->has('source.database.mysql') ? $box->get('source.database.mysql') : null, "PgSql" => $box->has('source.database.postgresql') ? $box->get('source.database.postgresql') : null];
foreach ($connections as $db => $connection) {
    describe("Query[{$db}]", function () use($connection) {
        beforeAll(function () use($connection) {
            skipIf(!$connection);
        });
        beforeEach(function () use($connection) {
            $this->connection = $connection;
            $this->fixtures = new Fixtures(['connection' => $connection, 'fixtures' => ['gallery' => 'Chaos\\Database\\Spec\\Fixture\\Schema\\Gallery', 'gallery_detail' => 'Chaos\\Database\\Spec\\Fixture\\Schema\\GalleryDetail', 'image' => 'Chaos\\Database\\Spec\\Fixture\\Schema\\Image', 'image_tag' => 'Chaos\\Database\\Spec\\Fixture\\Schema\\ImageTag', 'tag' => 'Chaos\\Database\\Spec\\Fixture\\Schema\\Tag']]);
            $this->fixtures->populate('gallery', ['create']);
            $this->fixtures->populate('gallery_detail', ['create']);
            $this->fixtures->populate('image', ['create']);
            $this->fixtures->populate('image_tag', ['create']);
            $this->fixtures->populate('tag', ['create']);
            $this->gallery = $this->fixtures->get('gallery')->model();
            $this->galleryDetail = $this->fixtures->get('gallery_detail')->model();
            $this->image = $this->fixtures->get('image')->model();
            $this->image_tag = $this->fixtures->get('image_tag')->model();
Esempio n. 16
0
 /**
  * Constructs a Simulation_Event with the given type and time.
  *
  * @param integer $type The type of the event.
  * @param integer $time The time of the event.
  */
 public function __construct($type, $time)
 {
     parent::__construct(box($time), box($type));
 }
Esempio n. 17
0
    });
    it("removes a box", function () {
        $box = new Box();
        box('box.spec', $box);
        box('box.spec', false);
        $closure = function () {
            box('box.spec');
        };
        expect($closure)->toThrow(new BoxException("Unexisting box `'box.spec'`."));
    });
    it("removes all boxes", function () {
        $box = new Box();
        box('box.spec1', $box);
        box('box.spec2', $box);
        box(false);
        $closure = function () {
            box('box.spec1');
        };
        expect($closure)->toThrow(new BoxException("Unexisting box `'box.spec1'`."));
        $closure = function () {
            box('box.spec2');
        };
        expect($closure)->toThrow(new BoxException("Unexisting box `'box.spec2'`."));
    });
    it("throws an exception when trying to get an unexisting box", function () {
        $closure = function () {
            box('box.spec');
        };
        expect($closure)->toThrow(new BoxException("Unexisting box `'box.spec'`."));
    });
});
Esempio n. 18
0
if (isGET('login')) {
    if (checkBot() && check('password') && login(cleanMagic($_POST['password']))) {
        session_regenerate_id(true);
        home();
    } else {
        $out['title'] = $lang['login'];
        $out['content'] .= '<form action="./auth.php?login" method="post">
    <p>' . password('password') . '</p>
    <p>' . submitSafe($lang['confirm']) . '</p>
    </form>';
    }
} else {
    if (isGET('logout') && isAdmin()) {
        $_SESSION['role'] = '';
        home();
    } else {
        if (isGET('test') && isAdmin()) {
            $out['title'] = $lang['login'];
            $out['content'] .= '<form action="./auth.php?test" method="post">
  <p>' . password('password') . '</p>
  <p>' . submitAdmin($lang['confirm']) . '</p>
  </form>';
            if (check('password')) {
                $out['content'] .= box(hide(cleanMagic($_POST['password'])));
            }
        } else {
            home();
        }
    }
}
require './templates/page.php';
Esempio n. 19
0
<?php

/********************************************
 * @Created on March, 2011 * @Package: Ndotdeals unlimited v2.2 
 * @Author: NDOT
 * @URL : http://www.ndot.in
 ********************************************/
$s = ob_get_clean();
box('box', $gPage, $s, '', 'margin-bottom: 10px;');
?>
                     </div>
		          
		          <div class="content_bottom"><div class="bot_left"></div><div class="bot_center"></div><div class="bot_rgt"></div></div>
		          
	 </div>           

	</td>
</tr>
</table>



</div>

</div>
<div class="login_footer ">
      <p> Copyright &copy; <?php 
echo date("Y");
?>
 Ndot.in. All Rights Reserved.</p>
</div>
Esempio n. 20
0
 /**
  * Main program.
  *
  * @param array $args Command-line arguments.
  * @return integer Zero on success; non-zero on failure.
  */
 public static function main($args)
 {
     printf("Application program number 11.\n");
     $status = 0;
     $g = new GraphAsMatrix(32);
     Application11::weightedGraphTest($g);
     $g = new GraphAsLists(32);
     Application11::weightedGraphTest($g);
     $g = new DigraphAsMatrix(32);
     Application11::weightedDigraphTest($g);
     $g = new DigraphAsLists(32);
     Application11::weightedDigraphTest($g);
     printf("Critical path analysis.\n");
     $g = new DigraphAsMatrix(10);
     for ($v = 0; $v < 10; ++$v) {
         $g->addVertex($v);
     }
     $g->addEdge(0, 1, box(3));
     $g->addEdge(1, 2, box(1));
     $g->addEdge(1, 3, box(4));
     $g->addEdge(2, 4, box(0));
     $g->addEdge(3, 4, box(0));
     $g->addEdge(4, 5, box(1));
     $g->addEdge(5, 6, box(9));
     $g->addEdge(5, 7, box(5));
     $g->addEdge(6, 8, box(0));
     $g->addEdge(7, 8, box(0));
     $g->addEdge(8, 9, box(2));
     printf("%s\n", str($g));
     $g2 = Algorithms::criticalPathAnalysis($g);
     printf("%s\n", str($g2));
     return $status;
 }
Esempio n. 21
0
    echo $key;
    ?>
" class="switch assetSwitch" data-on-text="ON" data-off-text="OFF" data-on-color="primary" <?php 
    echo $checked;
    ?>
></div><br>
                    <div class="micropadding"></div>
                    <div class="micropadding"></div>
                <?php 
}
?>
                <br>
                <?php 
$disbleWritingCombined = "";
if ($showNotWritableMessage) {
    box("You can't overwrite the file <b>core/assets/css/combined.css</b>. <br> Please make sure the file is writable.", "info", "inherit", "boxid", "dismiss");
    $disbleWritingCombined = "disabled";
}
?>
                <a href="index.php?writeCombined=true" class="btn btn-block btn-primary <?php 
echo $disbleWritingCombined;
?>
"> Write Combined Assets</a>
            </div>
        </div>


        </div> <!-- /container -->

        <?php 
// JAVASCRIPT
Esempio n. 22
0
				</tr>
				
				<tr>
					<th>Write</th>
					
					<td>'.box('010 000 000').'</td>
					<td>'.box('000 010 000').'</td>
					<td>'.box('000 000 010').'</td>
				</tr>
				
				<tr>
					<th>Execute</th>
					
					<td>'.box('001 000 000').'</td>
					<td>'.box('000 001 000').'</td>
					<td>'.box('000 000 001').'</td>
				</tr>
			</table>
			
			<br>or enter the CHMOD value:  <input type="text" name="mod" value="'.$mod.'">
			
			<input type="hidden" name="mod_old" value="'.$mod.'">
			<br><br><input type="checkbox" name="recurse" value="true" id="recurse"><label for="recurse"> Recursive (will affect all subdirectories and all files in subdirectories)</label>
			<br><input type=submit value="chmod!">
			</form>');
			$_SESSION['chmod_files']=$_POST['files'];
		}else if(!empty($_SESSION['chmod_files']) && !empty($_POST['mod']))
		{
			$nomain=false;
			
			$_POST['files']=$_SESSION['chmod_files'];
Esempio n. 23
0
    global $font;
    $t = new SWFText();
    $t->setFont($font);
    $t->setColor(255, 255, 255);
    $t->setHeight(20);
    $t->addString($string);
    return $t;
}
$t = $m->add(text("Balkendiagramm mit PHP und Ming"));
$t->moveTo(30, 40);
$i = 0;
reset($values);
while (list($key, $value) = each($values)) {
    $text[$i] = $m->add(text($key));
    $text[$i]->moveTo(50 + $i * 60, 50);
    $box[$i] = $m->add(box(50, 1));
    $box[$i]->moveTo(30 + $i * 60, $height - 20);
    $box[$i]->setName("box" . $i);
    $i++;
}
for ($f = 0; $f <= $max; $f += 5) {
    $i = 0;
    reset($values);
    while (list($key, $value) = each($values)) {
        $h = $value;
        if ($h > $f) {
            $box[$i]->scaleTo(1, $f);
            $text[$i]->moveTo(50 + $i * 60, $height - $f - 25);
        }
        $i++;
    }
Esempio n. 24
0
function stopBox($title = null)
{
    $content = ob_get_contents();
    ob_end_clean();
    if ($content == null) {
        $content = '&nbsp;';
    }
    box($content, $title);
}
Esempio n. 25
0
echo $r->getTotal();
?>
</span></a></li>
                    <li class="divider"></li>
                    <li class=""><a href="settings.php"><i class="icon-wrench"></i> Settings</a></li>
                    <li class=""><a href="new.php"><i class="icon-plus-sign"></i> Add new</a></li>
                </ul>
            </div>
            <div class="span9" style="text-align: center;">
                <?php 
if ($id >= 0) {
    if ($confirmed) {
        if ($d->delete($id)) {
            box('Success', 'Domain has been successfully deleted', 'info');
        } else {
            box('Oh boy', 'Something went terribly wrong', 'warning');
        }
    } else {
        $dom = $d->get($id);
        echo '<h3>You are about to delete</h3><br><h2>' . $dom['dom_name'] . '</h2>';
        echo '
                        <form class="form-horizontal" action="delete.php?id=' . $id . '" method="post">
                            <input type="hidden" name="action" value="delete">
                            <div style="text-align:center;"><button type="submit" class="btn btn-warning"><i class="icon-edit"></i> Delete</button></div>
                        </form>';
    }
}
?>
            </div>
        </div>
    </div>
Esempio n. 26
0
        echo $v;
        ?>
</option>
	<?php 
    }
    echo "</select></td>";
    echo '</tr>';
    echo '<tr>';
    echo "<td colspan=\"2\" align=\"center\">";
    //echo '<input type="hidden" name="action" value="download" />';
    echo "<input type=\"submit\" value=\"{$gXpLang['add']}\"/> <input type=\"reset\" value=\"{$gXpLang['reset']}\" /></td>";
    echo '</tr>';
    echo '</table>';
    echo '</form>';
    $s = ob_get_clean();
    box('box', $gXpLang['add_phrase'], $s);
} else {
    print_box(1, 'Incorrect value.');
}
if ($_GET['view'] == 'search' || $_GET['view'] == 'phrase') {
    ?>
	<script type="text/javascript">
	// <![CDATA[
	var editing = false;

	var current = '';
	var currentContent = '';
	var group = $("#phrase_group").clone();

	$("span.editable_category").click(function()
	{
Esempio n. 27
0
echo "</td>";
echo "<td width=58>&nbsp;</td>\n\t\t\t\t</tr>\n\t\t\t\t</table>";
echo '
			</td>
			<td align=center>
				<table cellspacing=0 cellpadding=0 border=0>
				<tr>
					<td align=right valign=bottom><img src="img/design/border-1x1.gif" width=10 height=10 border=0 hspace=0 vspace=0></td>
					<td style="background:url(img/design/border-h.gif) repeat-x bottom left"></td>
					<td align=left valign=bottom><img src="img/design/border-3x1.gif" width=10 height=10 border=0 hspace=0 vspace=0></td>
				</tr>
				<tr>
					<td style="background:url(img/design/border-v.gif) repeat-y top right"></td>
					<td style="padding: 0px;">
						<DIV  align="left" style="position:relative;" >';
box($xx . "x" . $yy);
echo '
						<img src="img/mount/loc/' . $xx . $yy . '.jpg" border="0">
						</div>
					</td>
					<td style="background:url(img/design/border-v.gif) repeat-y top left"></td>
				</tr>
				<tr>
					<td align=right valign=top><img src="img/design/border-1x3.gif" width=10 height=10 border=0 hspace=0 vspace=0></td>
					<td style="background:url(img/design/border-h.gif) repeat-x top left"></td>
					<td align=left valign=top><img src="img/design/border-3x3.gif" width=10 height=10 border=0 hspace=0 vspace=0></td>
				</tr>
				</table>
			</td>
		</tr>
		</table>
<?php

use Lead\Box\Box;
use Chaos\Database\Adapter\MySql;
use Chaos\Database\Adapter\PostgreSql;
use Chaos\Database\Adapter\Sqlite;
date_default_timezone_set('UTC');
$commandLine = $this->commandLine();
$commandLine->option('coverage', 'default', 3);
$box = box('chaos.spec', new Box());
$drivers = PDO::getAvailableDrivers();
if (in_array('mysql', $drivers)) {
    $box->factory('source.database.mysql', function () {
        return new MySql(['database' => 'chaos_test', 'username' => 'root', 'password' => '', 'encoding' => 'utf8']);
    });
}
if (in_array('pgsql', $drivers)) {
    $box->factory('source.database.postgresql', function () {
        return new PostgreSql(['database' => 'chaos_test', 'username' => 'postgres', 'password' => '', 'encoding' => 'utf8']);
    });
}
if (in_array('sqlite', $drivers)) {
    $box->factory('source.database.sqlite', function () {
        return new Sqlite();
    });
}
Esempio n. 29
0
 /**
  * Weighted graph test method.
  *
  * @param object IGraph $g The weighted graph to test.
  */
 public static function testWeighted(IGraph $g)
 {
     printf("Weighted graph test program.\n");
     $g->addVertex(0, box(123));
     $g->addVertex(1, box(234));
     $g->addVertex(2, box(345));
     $g->addEdge(0, 1, box(3));
     $g->addEdge(0, 2, box(1));
     $g->addEdge(1, 2, box(4));
     printf("%s\n", str($g));
     printf("Using vertex iterator\n");
     foreach ($g->getVertices() as $v) {
         printf("%s\n", str($v));
     }
     printf("Using edge iterator\n");
     foreach ($g->getEdges() as $e) {
         printf("%s\n", str($e));
     }
 }
Esempio n. 30
0
        $postEntry['tags'] = $addedTags;
        saveEntry('posts', $post, $postEntry);
        foreach ($addedTags as $tag) {
            $tagEntry = readEntry('tags', $tag);
            $tagEntry['posts'][$post] = $post;
            saveEntry('tags', $tag, $tagEntry);
        }
        deleteEntry('drafts', $draft);
        redirect('view.php?post=' . $post);
    } else {
        $draftEntry = readEntry('drafts', $draft);
        $tagOptions = array();
        foreach (listEntry('tags') as $tag) {
            $tagEntry = readEntry('tags', $tag);
            $tagOptions[$tag] = $tagEntry['name'];
        }
        $out['title'] = $lang['publishPost'] . ': ' . $draftEntry['title'];
        $out['content'] .= '<form action="./publish.php?draft=' . $draft . '" method="post">
    <p>' . text('title', $draftEntry['title']) . '</p>
    <p>' . text('id', substr($draft, 20)) . '</p>
    <p>' . textarea('content', clean($draftEntry['content'])) . '</p>
    <p>' . select('locked', array('yes' => $lang['yes'], 'no' => $lang['no']), $postEntry['locked'] ? 'yes' : 'no') . '</p>
    <p>' . multiselect('tags', $tagOptions, $postEntry['tags']) . '</p>
    <p>' . submitAdmin($lang['confirm']) . '</p>
    </form>';
        $out['content'] .= isPOST('content') ? box(cleanMagic($_POST['content'])) : '';
    }
} else {
    home();
}
require 'templates/page.php';