Example #1
0
function add_field(&$entity, $member, array $row, $fld)
{
    if (is_array($fld)) {
        $entity->{$member} = '';
        foreach ($fld as $f) {
            $entity->{$member} .= extract_field($row, $f);
        }
    } else {
        $entity->{$member} = extract_field($row, $fld);
    }
}
Example #2
0
 protected function _after_select(&$resultSet, $options)
 {
     if (isset($options['attach'])) {
         foreach ($options['attach'] as $attach) {
             $this_ids = extract_field($resultSet, $attach[1]);
             $target = T($attach[0]);
             $that_map = $target->with($target->pk, 'in', $this_ids)->select_as_map();
             // all the data needed in "that" table
             for ($i = 0; $i < count($resultSet); $i++) {
                 $resultSet[$i][$attach[0]] = $that_map[$resultSet[$i][$attach[1]]];
             }
         }
     }
     if (isset($options['fetch'])) {
         foreach ($options['fetch'] as $fetch) {
             for ($i = 0; $i < count($resultSet); $i++) {
                 $target = T($fetch[0]);
                 $resultSet[$i][$fetch[0]] = $target->with($fetch[1], $resultSet[$i][$this->pk])->select();
             }
         }
     }
     if (isset($options['bridge'])) {
         foreach ($options['bridge'] as $bridge) {
             // alias for all the fields in bridge
             $that_name = $bridge[0];
             $bridge_table_name = $bridge[1];
             $this_field = $bridge[2];
             $that_field = $bridge[3];
             for ($i = 0; $i < count($resultSet); $i++) {
                 $that_table = T($that_name);
                 $bridge_table = T($bridge_table_name);
                 $bridge_records = $bridge_table->with($this_field, $resultSet[$i][$this->pk])->select();
                 $bridge_results = array();
                 foreach ($bridge_records as $bridge_record) {
                     $that_result = $that_table->with($that_table->pk, $bridge_record[$that_field])->find();
                     $that_result['_bridge'] = $bridge_record;
                     array_push($bridge_results, $that_result);
                 }
                 $resultSet[$i][$that_name] = $bridge_results;
             }
         }
     }
     parent::_after_select($resultSet, $options);
 }
Example #3
0
Or you can just download the <a href="ccan.tar.bz2">tarball of everything including CCAN tools (<?php 
echo $tarballsize;
?>
K)</a>.
</p>

<table align="center" cellpadding="3" cellspacing="1">
<th align="left">Name</th>
<th align="left">Summary / Link to details</th>
<th align="right">Download</th>

<?php 
$modules = array_slice($argv, 4);
sort($modules);
foreach ($modules as $module) {
    $summary = extract_field('summary', $argv[1] . $module);
    $with_deps = "{$tar_dir}/with-deps/{$module}.tar.bz2";
    $no_deps = "{$tar_dir}/{$module}.tar.bz2";
    $with_dep_size = round((filesize($argv[3] . "/" . $with_deps) + 1023) / 1024);
    $no_dep_size = round((filesize($argv[3] . "/" . $no_deps) + 1023) / 1024);
    ?>
	<tr>
	  <td><?php 
    echo $module;
    ?>
</td>
	  <td><a href="info/<?php 
    echo $module;
    ?>
.html"><?php 
    echo $summary;
Example #4
0
session_start();
include 'logo.html';
include 'menulist.html';
include 'static-configuration';
$module_path = $argv[1];
$module = $argv[2];
$maintainer = extract_field('maintainer', $module_path);
$author = extract_field('author', $module_path);
$summary = extract_field('summary', $module_path);
$see_also = extract_field('see_also', $module_path);
$description = htmlize_field('description', $module_path);
$example = extract_field('example', $module_path);
$dependencies = htmlspecialchars(shell_exec('tools/ccan_depends --direct ' . $module_path));
$extdepends = htmlspecialchars(shell_exec('tools/ccan_depends --compile --non-ccan ' . $module_path));
$licence = extract_field('licence', $module_path);
$license = extract_field('license', $module_path);
$url_prefix = getenv("URLPREFIX");
?>
<table align="center" bgcolor="lightblue" width="70%" border="0" cellpadding="3" cellspacing="1">
<tr align="center" bgcolor="FFFFCC">
<td>
<a href="<?php 
echo $repo_base . $module;
?>
">Browse Source</a>
</td>
<td>
<a href="<?php 
echo $url_prefix;
echo $tar_dir;
?>