Commit 4d7b4dbb authored by jadsolucions's avatar jadsolucions

Add new files.

parent b86172c1
<?php
/*
Copyright (c) 2018, Óscar Marcos (funcli.net)
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of ISPConfig nor the names of its contributors
may be used to endorse or promote products derived from this software without
specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
//* Title of the form
$form["title"] = "Git repository";
//* Description of the form (optional)
$form["description"] = "";
//* Name of the form. The name shall not contain spaces or foreign characters
$form["name"] = "web_git";
//* The file that is used to call the form in the browser
$form["action"] = "web_git_edit.php";
//* The name of the database table that shall be used to store the data
$form["db_table"] = "web_git";
//* The name of the database table index field, this field must be a numeric auto increment column
$form["db_table_idx"] = "web_git_id";
//* Shall changes to this table be stored in the database history (sys_datalog) table.
//* This should be set to "yes" for all tables that store configuration information.
$form["db_history"] = "yes"; // yes / no
//* The name of the tab that is shown when the form is opened
$form["tab_default"] = "info";
//* The name of the default list file of this form
$form["list_default"] = "web_git_list.php";
//* Use the internal authentication system for this table. This should
//* be set to yes in most cases
$form["auth"] = 'yes'; // yes / no
//* Authentication presets. The defaults below does not need to be changed in most cases.
$form["auth_preset"]["userid"] = 0; // 0 = id of the user, > 0 id must match with id of current user
$form["auth_preset"]["groupid"] = 0; // 0 = default groupid of the user, > 0 id must match with groupid of current user
$form["auth_preset"]["perm_user"] = 'riud'; //r = read, i = insert, u = update, d = delete
$form["auth_preset"]["perm_group"] = 'riud'; //r = read, i = insert, u = update, d = delete
$form["auth_preset"]["perm_other"] = ''; //r = read, i = insert, u = update, d = delete
//* Maybe we're writing in a response to another message
$sm_default_recipient_id = '';
$sm_default_subject = '';
if(isset($_GET['reply']))
{
$sm_msg_id = preg_replace("/[^0-9]/", "", $_GET['reply']);
$res = $app->db->queryOneRecord("SELECT sender_id, subject FROM support_message WHERE support_message_id=?", $sm_msg_id);
if($res['sender_id'])
{
$sm_default_recipient_id = $res['sender_id'];
$sm_default_subject = (preg_match("/^Re:/", $res['subject'])?"":"Re: ") . $res['subject'];
}
}
$authsql = $app->tform->getAuthSQL('r', 'client');
//* Begin of the form definition of the first tab. The name of the tab is called "message". We refer
//* to this name in the $form["tab_default"] setting above.
$form["tabs"]['info'] = array (
'title' => "Website", // Title of the Tab
'width' => 100, // Tab width
'template' => "templates/web_git_edit.htm", // Template file name
'fields' => array (
//#################################
// Begin Datatable fields
//#################################
//Website
'parent_domain_id' => array (
'datatype' => 'INTEGER',
'formtype' => 'SELECT',
'default' => '',
'datasource' => array ( 'type' => 'SQL',
'querystring' => "SELECT web_domain.domain_id, CONCAT(web_domain.domain, ' :: ', server.server_name) AS parent_domain FROM web_domain, server WHERE web_domain.type = 'vhost' AND web_domain.server_id = server.server_id AND {AUTHSQL::web_domain} ORDER BY web_domain.domain",
'keyfield'=> 'domain_id',
'valuefield'=> 'parent_domain'
),
'value' => ''
),
'url' => array (
'datatype' => 'VARCHAR',
'formtype' => 'TEXT',
'validators' => array ( 0 => array ( 'type' => 'NOTEMPTY',
'errmsg'=> 'subject_is_empty'),
),
'filters' => array(
0 => array( 'event' => 'SAVE',
'type' => 'STRIPTAGS'),
1 => array( 'event' => 'SAVE',
'type' => 'STRIPNL')
),
'default' => $sm_default_subject,
'value' => '',
'width' => '30',
'maxlength' => '255'
),
'username' => array (
'datatype' => 'VARCHAR',
'formtype' => 'TEXT',
'default' => '',
'value' => '',
'separator' => '',
'width' => '30',
'maxlength' => '255',
'rows' => '',
'cols' => '',
'searchable' => 2
),
'password' => array (
'datatype' => 'VARCHAR',
'formtype' => 'TEXT',
'default' => '',
'value' => '',
'separator' => '',
'width' => '30',
'maxlength' => '255',
'rows' => '',
'cols' => '',
'searchable' => 0
),
/*'password' => array (
'datatype' => 'VARCHAR',
'formtype' => 'PASSWORD',
'encryption'=> 'CRYPT',
'default' => '',
'value' => '',
'separator' => '',
'width' => '30',
'maxlength' => '255',
'rows' => '',
'cols' => ''
),*/
'tstamp' => array (
'datatype' => 'INTEGER',
'formtype' => 'TEXT',
'default' => time(),
'value' => '',
'width' => '30',
'maxlength' => '30'
),
//#################################
// ENDE Datatable fields
//#################################
)
);
?>
\ No newline at end of file
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE>ISPConfig Help</TITLE>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=iso-iso-8859-1">
</HEAD>
<BODY BGCOLOR="#FFFFFF">
<div align="center">
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
</div>
</BODY>
</HTML>
\ No newline at end of file
<?php
/*
Nothing
*/
?>
\ No newline at end of file
<?php
$wb['parent_domain_id_txt'] = 'Website';
$wb['url_txt'] = 'Git URL';
$wb['message_txt'] = 'Message';
$wb['tstamp_txt'] = 'Timestamp';
$wb['reply_txt'] = 'Reply';
$wb['date_txt'] = 'Date';
$wb["parent_domain_id_txt"] = 'Website';
$wb["username_txt"] = 'Git username';
$wb["password_txt"] = 'Git password';
?>
\ No newline at end of file
<?php
$wb['list_head_txt'] = 'Git repositories';
$wb['add_new_record_txt'] = 'Create new repository';
$wb['date_txt'] = 'Date';
$wb['parent_domain_id_txt'] = 'Website';
$wb['url_txt'] = 'Git URL';
?>
\ No newline at end of file
<?php
/*
Copyright (c) 2018, Óscar Marcos (funcli.net)
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of ISPConfig nor the names of its contributors
may be used to endorse or promote products derived from this software without
specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
//**** Module Definition ****
// Name of the module. The module name must match the name of the module directory.
// The module name may not contain spaces.
$module['name'] = 'vcs';
// Title of the module which is dispalayed in the top navigation.
$module['title'] = 'Version control';
// The template file of the module. This is always 'module.tpl.htm' unless
// there are any special requirements such as a three column layout.
$module['template'] = 'module.tpl.htm';
// The page that is displayed when the module is loaded.
// The path must is relative to the web/ directory
$module['startpage'] = 'vcs/web_git_list.php';
// The width of the tab. Normally you should leave this empty and
// let the browser define the width automatically.
$module['tab_width'] = '';
//**** Menu Definition ****
// Make sure that the items array is empty
$items = array();
// Add a menu item with the label 'Send message'
$items[] = array( 'title' => 'View repositories',
'target' => 'content',
'link' => 'vcs/web_git_list.php'
);
// Add a menu item with the label 'View messages'
$items[] = array( 'title' => 'Add repository',
'target' => 'content',
'link' => 'vcs/web_git_edit.php'
);
// Append the menu $items defined above to a menu section labeled 'Support'
$module['nav'][] = array( 'title' => 'Git',
'open' => 1,
'items' => $items
);
?>
\ No newline at end of file
<?php
/*
Copyright (c) 2018, Óscar Marcos (funcli.net)
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of ISPConfig nor the names of its contributors
may be used to endorse or promote products derived from this software without
specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
//* Name of the list
$liste['name'] = 'web_git';
//* Database table
$liste['table'] = 'web_git';
//* Index index field of the database table
$liste['table_idx'] = 'web_git_id';
//* Search Field Prefix
$liste['search_prefix'] = 'search_';
//* Records per page
$liste['records_per_page'] = 15;
//* Script File of the list
$liste['file'] = 'web_git_list.php';
//* Script file of the edit form
$liste['edit_file'] = 'web_git_edit.php';
//* Script File of the delete script
$liste['delete_file'] = 'web_git_del.php';
//* Paging Template
$liste['paging_tpl'] = 'templates/paging.tpl.htm';
//* Enable auth
$liste['auth'] = 'yes';
/*****************************************************
* Search fields
*****************************************************/
$liste["item"][] = array( 'field' => "parent_domain_id",
'datatype' => "VARCHAR",
'filters' => array( 0 => array( 'event' => 'SHOW',
'type' => 'IDNTOUTF8')
),
'formtype' => "SELECT",
'op' => "=",
'prefix' => "",
'suffix' => "",
'datasource' => array ( 'type' => 'SQL',
'querystring' => "SELECT domain_id,domain FROM web_domain WHERE type = 'vhost' AND {AUTHSQL} ORDER BY domain",
'keyfield'=> 'domain_id',
'valuefield'=> 'domain'
),
'width' => "",
'value' => "");
$liste['item'][] = array( 'field' => 'url',
'datatype' => 'VARCHAR',
'formtype' => 'TEXT',
'op' => 'like',
'prefix' => '%',
'suffix' => '%',
'width' => '',
'value' => '');
$liste['item'][] = array( 'field' => 'tstamp',
'datatype' => 'DATETIMETSTAMP',
'formtype' => 'TEXT',
'op' => '=',
'prefix' => '',
'suffix' => '',
'width' => '',
'value' => '');
?>
\ No newline at end of file
<div class='page-header'>
<h1><tmpl_var name="list_head_txt"></h1>
</div>
<p><tmpl_var name="list_desc_txt"></p>
<legend>{tmpl_var name='parent_domain_id_txt'}</legend>
<div class="form-group">
<label for="parent_domain_id" class="col-sm-3 control-label">{tmpl_var name='parent_domain_id_txt'}</label>
<div class="col-sm-9"><select name="parent_domain_id" id="parent_domain_id" class="form-control">
{tmpl_var name='parent_domain_id'}
</select></div>
</div>
<div class="form-group">
<label for="url" class="col-sm-3 control-label">{tmpl_var name='url_txt'}</label>
<div class="col-sm-9"><input type="text" name="url" id="url" value="{tmpl_var name='url'}" class="form-control" /></div>
</div>
<div class="form-group">
<label for="username" class="col-sm-3 control-label">{tmpl_var name='username_txt'}*</label>
<div class="col-sm-9"><input type="text" name="username" id="username" value="{tmpl_var name='username'}" class="form-control" /></div>
</div>
<div class="form-group">
<label for="password" class="col-sm-3 control-label">{tmpl_var name='password_txt'}</label>
<div class="col-sm-9">
<div class="input-group">
<input type="password" name="password" id="password" value="{tmpl_var name='password'}" title="{tmpl_var name='password_click_to_set_txt'}" class="form-control" autocomplete="off" onkeyup="pass_check(this.value);checkPassMatch('password','repeat_password');" />
</div>
</div>
</div>
<input type="hidden" name="id" value="{tmpl_var name='id'}">
<input type="hidden" name="tstamp" value="{tmpl_var name='tstamp'}">
<div class="clear"><div class="right">
<button class="btn btn-default formbutton-success" type="button" value="{tmpl_var name='btn_save_txt'}" data-submit-form="pageForm" data-form-action="vcs/web_git_edit.php">{tmpl_var name='btn_save_txt'}</button>
<button class="btn btn-default formbutton-default" type="button" value="{tmpl_var name='btn_cancel_txt'}" data-load-content="vcs/web_git_list.php">{tmpl_var name='btn_cancel_txt'}</button>
</div></div>
<div class='page-header'>
<h1><tmpl_var name="list_head_txt"></h1>
</div>
<p><tmpl_var name="list_desc_txt"></p>
<p class="fieldset-legend">{tmpl_var name="toolsarea_head_txt"}</p>
<button class="btn btn-default formbutton-success" type="button" data-load-content="vcs/web_git_edit.php">{tmpl_var name="add_new_record_txt"}</button>
<p class="fieldset-legend"><tmpl_var name="list_head_txt"></p>
<div class="table-wrapper marginTop15">
<table class="table">
<thead class="dark form-group-sm">
<tr>
<th data-column="parent_domain_id"><tmpl_var name="parent_domain_id_txt"></th>
<th data-column="url"><tmpl_var name="url_txt"></th>
<th data-column="date"><tmpl_var name="date_txt"></th>
<th class="small-col text-right">{tmpl_var name='search_limit'}</th>
</tr>
<!--<tr>
<td><select class="form-control" name="search_sender_id">{tmpl_var name='search_sender_id'}</select></td>
<td><input class="form-control" type="text" name="search_subject" value="{tmpl_var name='search_subject'}" /></td>
<td>&nbsp;</td>
<td class="text-right">
<button type="button" class="btn btn-default formbutton-default formbutton-narrow" name="Filter" id="Filter" value="{tmpl_var name="filter_txt"}" data-submit-form="pageForm" data-form-action="vcs/web_git_list.php"><span class="icon icon-filter"></span></button>
</td>
</tr>-->
</thead>
<tbody>
<tmpl_loop name="records">
<tr>
<td><a href="#" data-load-content="vcs/web_git_edit.php?id={tmpl_var name='id'}">{tmpl_var name="parent_domain_id"}</a></td>
<td><a href="#" data-load-content="vcs/web_git_edit.php?id={tmpl_var name='id'}">{tmpl_var name="url"}</a></td>
<td><a href="#" data-load-content="vcs/web_git_edit.php?id={tmpl_var name='id'}">{tmpl_var name="tstamp"}</a></td>
<td class="text-right">
<a class="btn btn-default formbutton-success formbutton-narrow" href="javascript: ISPConfig.confirm_action('vcs/web_git_update.php?id={tmpl_var name='id'}&phpsessid={tmpl_var name='phpsessid'}','Perform \'git pull\'?')"><span class="icon icon-loginas"></span></a>
<a class="btn btn-default formbutton-danger formbutton-narrow" href="javascript: ISPConfig.confirm_action('vcs/web_git_del.php?id={tmpl_var name='id'}&phpsessid={tmpl_var name='phpsessid'}','{tmpl_var name='delete_confirmation'}');"><span class="icon icon-delete"></span></a>
</td>
</tr>
</tmpl_loop>
<tmpl_unless name="records">
<tr class="tbl_row_noresults tbl_row_<tmpl_if name='__EVEN__'}even<tmpl_else>uneven</tmpl_if>">
<tmpl_if name="is_admin"><td colspan="4"><tmpl_else><td colspan="3"></tmpl_if>{tmpl_var name='globalsearch_noresults_text_txt'}</td>
</tr>
</tmpl_unless>
</tbody>
<tfoot>
<tr>
<tmpl_if name="is_admin"><td colspan="4"><tmpl_else><td colspan="3"></tmpl_if><tmpl_var name="paging"></td>
</tr>
</tfoot>
</table>
</div>
{tmpl_var name='log'}
<input type="hidden" name="id" value="{tmpl_var name='id'}">
<input type="hidden" name="tstamp" value="{tmpl_var name='tstamp'}">
<?php
/*
Copyright (c) 2018, Óscar Marcos (funcli.net)
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of ISPConfig nor the names of its contributors
may be used to endorse or promote products derived from this software without
specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
//* From and List definition files
$list_def_file = 'list/web_git.list.php';
$tform_def_file = 'form/web_git.tform.php';
//* Include the base libraries
require_once '../../lib/config.inc.php';
require_once '../../lib/app.inc.php';
//* Check permissions for module
$app->auth->check_module_permissions('vcs');
//* Load the form
$app->uses('tform_actions');
$app->tform_actions->onDelete();
?>
\ No newline at end of file
<?php
// Set the path to the form definition file.
$tform_def_file = 'form/web_git.tform.php';
// include the core configuration and application classes
require_once('../../lib/config.inc.php');
require_once('../../lib/app.inc.php');
// Check the module permissions and redirect if not allowed.
if(!stristr($_SESSION['s']['user']['modules'],'vcs')) {
header('Location: ../index.php');
die;
}
// Load the templating and form classes
$app->uses('tpl,tform,tform_actions');
$app->load('tform_actions');
// Create a class page_action that extends the tform_actions base class
class page_action extends tform_actions {
//Customisations for the page actions will be defined here
function onAfterInsert()
{
global $app, $conf;
//
}
/* Get the log file */
function onLoad() {
global $app, $conf;
$this->id = $app->functions->intval($_REQUEST["id"]);
$filename = $this->id.".log";
$log = "No data logged for this repository";
$array_logs = $app->db->queryAllArray("SELECT data FROM monitor_data WHERE type = ?", "log_web_git_" . $this->id);
if(count($array_logs) > 0) {
$log = '';
foreach($array_logs as $datalog) {
$log .= unserialize($datalog).PHP_EOL;
}
}
$app->tpl->setVar("log", nl2br($log));
parent::onLoad();
}
}
// Create the new page object
$page = new page_action();
// Start the page rendering and action handling
$page->onLoad();
?>
<?php
/*
Copyright (c) 2018, Óscar Marcos (funcli.net)
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of ISPConfig nor the names of its contributors
may be used to endorse or promote products derived from this software without
specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED