Exemple #1
0
                echo '</a></li>';
            }
            echo '</ul>
			<p>', WT_I18N::translate('Places found'), '&nbsp;', count($places), '</p>';
        } else {
            echo '<p>', WT_I18N::translate('No results found.'), '</p>';
        }
        echo '</div>';
    }
    // Output Repositories
    if ($type == "repo") {
        echo '<div id="find-output">';
        if ($filter) {
            $repo_list = search_repos($filter_array, array(WT_GED_ID), 'AND', true);
        } else {
            $repo_list = get_repo_list(WT_GED_ID);
        }
        if ($repo_list) {
            usort($repo_list, array('WT_GedcomRecord', 'Compare'));
            echo '<ul>';
            foreach ($repo_list as $repo) {
                echo '<li><a href="', $repo->getHtmlUrl(), '" onclick="pasteid(\'', $repo->getXref(), '\');"><span class="list_item">', $repo->getFullName(), '</span></a></li>';
            }
            echo '</ul>
			<p>', WT_I18N::translate('Repositories found'), " ", count($repo_list), '</p>';
        } else {
            echo '<p>', WT_I18N::translate('No results found.'), '</p>';
        }
        echo '</div>';
    }
    // Output Shared Notes
Exemple #2
0
             }
             echo "</ul></td></tr>";
             echo "<tr><td class=\"list_label\">", $pgv_lang["total_places"], " ", $ctplace;
             echo "</td></tr>";
         } else {
             echo "<tr><td class=\"list_value_wrap {$TEXT_DIRECTION}\"><ul>";
             echo $pgv_lang["no_results"];
             echo "</td></tr>";
         }
     }
     echo "</table>";
 }
 // Output Repositories
 if ($type == "repo") {
     echo "<table class=\"tabs_table {$TEXT_DIRECTION} width90\"><tr>";
     $repo_list = get_repo_list(PGV_GED_ID);
     if ($repo_list) {
         echo "<td class=\"list_value_wrap\"><ul>";
         foreach ($repo_list as $repo) {
             echo "<li><a href=\"javascript:;\" onclick=\"pasteid('", $repo->getXref(), "');\"><span class=\"list_item\">", $repo->getListName(), "&nbsp;&nbsp;&nbsp;";
             echo PGV_LPARENS, $repo->getXref(), PGV_RPARENS;
             echo "</span></a></li>";
         }
         echo "</ul></td></tr>";
         echo "<tr><td class=\"list_label\">", $pgv_lang["repos_found"], " ", count($repo_list);
         echo "</td></tr>";
     } else {
         echo "<tr><td class=\"list_value_wrap\">";
         echo $pgv_lang["no_results"];
         echo "</td></tr>";
     }
Exemple #3
0
// Repositories List
//
// webtrees: Web based Family History software
// Copyright (C) 2014 webtrees development team.
//
// Derived from PhpGedView
// Copyright (C) 2002 to 2009 PGV Development Team.  All rights reserved.
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
define('WT_SCRIPT_NAME', 'repolist.php');
require './includes/session.php';
require_once WT_ROOT . 'includes/functions/functions_print_lists.php';
$controller = new WT_Controller_Page();
$controller->setPageTitle(WT_I18N::translate('Repositories'));
$controller->pageHeader();
echo '<div id="repolist-page">', '<h2>', WT_I18N::translate('Repositories'), '</h2>';
echo format_repo_table(get_repo_list(WT_GED_ID));
echo '</div>';
Exemple #4
0
$app->post('/create', function () use($app) {
    $repo_name = $app->request()->post('repo_name');
    if (substr($repo_name, -4) != '.git') {
        $repo_name .= '.git';
    }
    $repo_list = get_repo_list();
    if (in_array($repo_name, $repo_list)) {
        die(json_encode(array('status' => 'fail', 'msg' => 'The repository name already exists!')));
    }
    `./gitinit {$repo_name}`;
    // TODO:: check if the repo is successfully created.
    die(json_encode(array('status' => 'ok', 'msg' => 'Repository successfully created!')));
});
$app->post('/delete', function () use($app) {
    $repo_name = $app->request()->post('repo_name');
    $repo_list = get_repo_list();
    if (!in_array($repo_name, $repo_list)) {
        die(json_encode(array('status' => 'fail', 'msg' => 'No such repository!')));
    }
    `rm -rf ../{$repo_name}`;
    die(json_encode(array('status' => 'ok', 'msg' => 'Repository successfully deleted!')));
});
$app->run();
// get all repo
function get_repo_list()
{
    $func = function ($value) {
        return substr($value, 3);
    };
    return array_map($func, array_filter(glob('../*.git'), 'is_dir'));
}