コード例 #1
0
ファイル: tools.php プロジェクト: bibwho/MATPbootstrap
     if ($listdata['liste_format'] == FORMAT_MULTIPLE) {
         $code_html .= $lang['Format'] . " : <select name=\"format\">\n";
         $code_html .= "<option value=\"" . FORMAT_TEXTE . "\">TXT</option>\n";
         $code_html .= "<option value=\"" . FORMAT_HTML . "\">HTML</option>\n";
         $code_html .= "</select>\n";
     } else {
         $code_html .= "<input type=\"hidden\" name=\"format\" value=\"{$listdata['liste_format']}\" />\n";
     }
     $code_html .= "<input type=\"hidden\" name=\"liste\" value=\"{$listdata['liste_id']}\" />\n";
     $code_html .= "<br />\n";
     $code_html .= "<input type=\"radio\" name=\"action\" value=\"inscription\" checked=\"checked\" /> {$lang['Subscribe']} <br />\n";
     $code_html .= $listdata['liste_format'] == FORMAT_MULTIPLE ? "<input type=\"radio\" name=\"action\" value=\"setformat\" /> {$lang['Setformat']} <br />\n" : "";
     $code_html .= "<input type=\"radio\" name=\"action\" value=\"desinscription\" /> {$lang['Unsubscribe']} <br />\n";
     $code_html .= "<input type=\"submit\" name=\"wanewsletter\" value=\"" . $lang['Button']['valid'] . "\" />\n";
     $code_html .= "</form>";
     $path = wa_realpath(WA_ROOTDIR . '/newsletter.php');
     $code_php = '<' . "?php\n";
     $code_php .= "define('IN_WA_FORM', true);\n";
     $code_php .= "define('WA_ROOTDIR', '" . substr($path, 0, strrpos($path, '/')) . "');\n";
     $code_php .= "\n";
     $code_php .= "include WA_ROOTDIR . '/newsletter.php';\n";
     $code_php .= '?' . '>';
     $output->set_filenames(array('tool_body' => 'result_generator_body.tpl'));
     $output->assign_vars(array('L_TITLE_GENERATOR' => $lang['Title']['generator'], 'L_EXPLAIN_CODE_HTML' => nl2br($lang['Explain']['code_html']), 'L_EXPLAIN_CODE_PHP' => nl2br($lang['Explain']['code_php']), 'CODE_HTML' => nl2br(htmlspecialchars($code_html, ENT_NOQUOTES)), 'CODE_PHP' => nl2br(htmlspecialchars($code_php, ENT_NOQUOTES))));
 } else {
     $output->addHiddenField('sessid', $session->session_id);
     $output->set_filenames(array('tool_body' => 'generator_body.tpl'));
     $output->assign_vars(array('L_TITLE_GENERATOR' => $lang['Title']['generator'], 'L_EXPLAIN_GENERATOR' => nl2br($lang['Explain']['generator']), 'L_TARGET_FORM' => $lang['Target_form'], 'L_VALID_BUTTON' => $lang['Button']['valid'], 'S_HIDDEN_FIELDS' => $output->getHiddenFields()));
 }
 $output->assign_var_from_handle('TOOL_BODY', 'tool_body');
 break;
コード例 #2
0
ファイル: config.php プロジェクト: bibwho/MATPbootstrap
     $smtp = new Smtp();
     $result = $smtp->connect($new_config['smtp_host'], $new_config['smtp_port'], $new_config['smtp_user'], $new_config['smtp_pass'], $match[2]);
     if (!$result) {
         $error = true;
         $msg_error[] = sprintf(nl2br($lang['Message']['bad_smtp_param']), htmlspecialchars($smtp->msg_error));
     } else {
         $smtp->quit();
     }
 } else {
     $new_config['use_smtp'] = 0;
 }
 if (!$new_config['disable_stats'] && extension_loaded('gd')) {
     require WA_ROOTDIR . '/includes/functions.stats.php';
     if (!is_writable(WA_STATSDIR)) {
         $error = true;
         $msg_error[] = sprintf($lang['Message']['Dir_not_writable'], htmlspecialchars(wa_realpath(WA_STATSDIR)));
     }
 } else {
     $new_config['disable_stats'] = 1;
 }
 if (!$error) {
     if (!$db->build(SQL_UPDATE, CONFIG_TABLE, $new_config)) {
         trigger_error('Impossible de mettre à jour la configuration', ERROR);
     }
     //
     // Déplacement des fichiers joints dans le nouveau dossier de stockage s'il est changé
     //
     if ($move_files) {
         if ($browse = dir($source_upload)) {
             while (($entry = $browse->read()) !== false) {
                 $source_file = $source_upload . $entry;
コード例 #3
0
ファイル: show.php プロジェクト: bibwho/MATPbootstrap
if ($filename != '') {
    $sql_where = 'jf.file_real_name = \'' . $db->escape($filename) . '\'';
} else {
    $sql_where = 'jf.file_id = ' . $file_id;
}
$sql = "SELECT jf.file_real_name, jf.file_physical_name, jf.file_size, jf.file_mimetype\n\tFROM " . JOINED_FILES_TABLE . " AS jf\n\t\tINNER JOIN " . LOG_FILES_TABLE . " AS lf ON lf.file_id = jf.file_id\n\t\tINNER JOIN " . LOG_TABLE . " AS l ON l.log_id = lf.log_id\n\t\t\tAND l.liste_id = {$listdata['liste_id']}\n\tWHERE {$sql_where}";
if (!($result = $db->query($sql))) {
    plain_error('Impossible de récupérer les données sur le fichier : ' . $db->error);
}
if ($filedata = $result->fetch()) {
    if ($nl_config['use_ftp']) {
        require WA_ROOTDIR . '/includes/class.attach.php';
        $attach = new Attach();
        $tmp_filename = $attach->ftp_to_tmp($filedata);
    } else {
        $tmp_filename = wa_realpath(WA_ROOTDIR . '/' . $nl_config['upload_path'] . $filedata['file_physical_name']);
    }
    $data = '';
    $is_svg = strcasecmp($filedata['file_mimetype'], 'image/svg+xml') == 0;
    if ($mode != 'popup' || $is_svg == true) {
        if (!($fp = @fopen($tmp_filename, 'rb'))) {
            exit('Impossible de récupérer le contenu du fichier (fichier non accessible en lecture)');
        }
        $data = fread($fp, filesize($tmp_filename));
        fclose($fp);
    }
    if ($mode == 'popup') {
        if ($is_svg == true) {
            $width = '360';
            $height = '180';
            if (preg_match('/<(?:[^:]+:)?svg([^>]+)>/', $data, $match)) {
コード例 #4
0
ファイル: start.php プロジェクト: bibwho/MATPbootstrap
if (strncmp(SQL_DRIVER, 'mysql', 5) == 0 && version_compare($db->serverVersion, '4.1.0', '<')) {
    $SqlSubSelectSupport = false;
}
define('SQL_SUBSELECT_SUPPORTED', $SqlSubSelectSupport);
unset($SqlSubSelectSupport);
//
// On récupère la configuration du script
//
$sql = 'SELECT * FROM ' . CONFIG_TABLE;
if (!($result = $db->query($sql))) {
    trigger_error('Impossible d\'obtenir la configuration de la newsletter', CRITICAL_ERROR);
}
$nl_config = $result->fetch(SQL_FETCH_ASSOC);
//
// Purge 'automatique' des listes (comptes non activés au-delà du temps limite)
//
if (!(time() % 10) || !defined('IN_ADMIN')) {
    purge_liste();
}
//
// Nom du dossier des fichiers temporaires du script
// Le nom ne doit contenir / ni au début, ni à la fin
//
$tmp_name = 'tmp';
define('WA_TMPDIR', WA_ROOTDIR . '/' . $tmp_name);
define('WAMAILER_DIR', WA_ROOTDIR . '/includes/wamailer');
define('WA_LOCKFILE', WA_TMPDIR . '/liste-%d.lock');
if (!is_writable(WA_TMPDIR)) {
    load_settings();
    $output->message(sprintf($lang['Message']['Dir_not_writable'], htmlspecialchars(wa_realpath(WA_TMPDIR))));
}
コード例 #5
0
ファイル: functions.php プロジェクト: bibwho/MATPbootstrap
 /**
  * load_settings()
  * 
  * Initialisation des pr�f�rences et du moteur de templates
  * 
  * @param array $admindata    Donn�es utilisateur
  * 
  * @return void
  */
 function load_settings($admindata = array())
 {
     global $nl_config, $lang, $datetime;
     if (!defined('IN_COMMANDLINE')) {
         global $output;
         $template_path = WA_ROOTDIR . '/templates/' . (defined('IN_ADMIN') ? 'admin/' : '');
         $output = new output($template_path);
         $output->addScript(WA_ROOTDIR . '/templates/DOM-Compat/DOM-Compat.js');
         if (defined('IN_ADMIN')) {
             $output->addScript(WA_ROOTDIR . '/templates/admin/admin.js');
         }
     }
     if (!is_array($admindata)) {
         $admindata = array();
     }
     if (!empty($admindata['admin_lang'])) {
         $nl_config['language'] = $admindata['admin_lang'];
     }
     if (!empty($admindata['admin_dateformat'])) {
         $nl_config['date_format'] = $admindata['admin_dateformat'];
     }
     $language_path = wa_realpath(WA_ROOTDIR . '/language/lang_' . $nl_config['language'] . '.php');
     if (!file_exists($language_path)) {
         $nl_config['language'] = 'francais';
         $language_path = wa_realpath(WA_ROOTDIR . '/language/lang_' . $nl_config['language'] . '.php');
         if (!file_exists($language_path)) {
             trigger_error('<b>Les fichiers de localisation sont introuvables !</b>', CRITICAL_ERROR);
         }
     }
     require $language_path;
     $lang['CHARSET'] = strtoupper($lang['CHARSET']);
 }
コード例 #6
0
ファイル: class.attach.php プロジェクト: bibwho/MATPbootstrap
 /**
  * Fonction de suppression de fichiers joints
  * Retourne le nombre des fichiers supprimés, en cas de succés
  * 
  * @param boolean $massive_delete  Si true, suppression des fichiers joints du ou des logs concernés
  * @param mixed   $log_id_ary      id ou tableau des id des logs concernés
  * @param mixed   $file_id_ary     id ou tableau des id des fichiers joints concernés (si $massive_delete à false)
  * 
  * @return mixed
  * @access public
  */
 function delete_joined_files($massive_delete, $log_ids, $file_ids = array())
 {
     global $db;
     if (!is_array($log_ids)) {
         $log_ids = array($log_ids);
     }
     if (!is_array($file_ids)) {
         $file_ids = array($file_ids);
     }
     if (count($log_ids) > 0) {
         if ($massive_delete == true) {
             $sql = "SELECT file_id \n\t\t\t\t\tFROM " . LOG_FILES_TABLE . " \n\t\t\t\t\tWHERE log_id IN(" . implode(', ', $log_ids) . ") \n\t\t\t\t\tGROUP BY file_id";
             if (!($result = $db->query($sql))) {
                 trigger_error('Impossible d\'obtenir la liste des fichiers', ERROR);
             }
             $file_ids = array();
             while ($file_id = $result->column('file_id')) {
                 array_push($file_ids, $file_id);
             }
         }
         if (count($file_ids) > 0) {
             $filename_ary = array();
             $sql = "SELECT lf.file_id, jf.file_physical_name\n\t\t\t\t\tFROM " . LOG_FILES_TABLE . " AS lf\n\t\t\t\t\t\tINNER JOIN " . JOINED_FILES_TABLE . " AS jf ON jf.file_id = lf.file_id\n\t\t\t\t\tWHERE lf.file_id IN(" . implode(', ', $file_ids) . ")\n\t\t\t\t\tGROUP BY lf.file_id, jf.file_physical_name\n\t\t\t\t\tHAVING COUNT(lf.file_id) = 1";
             if (!($result = $db->query($sql))) {
                 trigger_error('Impossible d\'obtenir la liste des fichiers à supprimer', ERROR);
             }
             $ids = array();
             while ($row = $result->fetch()) {
                 array_push($ids, $row['file_id']);
                 array_push($filename_ary, $row['file_physical_name']);
             }
             if (count($ids) > 0) {
                 $sql = "DELETE FROM " . JOINED_FILES_TABLE . " \n\t\t\t\t\t\tWHERE file_id IN(" . implode(', ', $ids) . ")";
                 if (!$db->query($sql)) {
                     trigger_error('Impossible de supprimer les entrées inutiles de la table des fichiers joints', ERROR);
                 }
             }
             $sql = "DELETE FROM " . LOG_FILES_TABLE . " \n\t\t\t\t\tWHERE log_id IN(" . implode(', ', $log_ids) . ") \n\t\t\t\t\t\tAND file_id IN(" . implode(', ', $file_ids) . ")";
             if (!$db->query($sql)) {
                 trigger_error('Impossible de supprimer les entrées de la table log_files', ERROR);
             }
             //
             // Suppression physique des fichiers joints devenus inutiles
             //
             foreach ($filename_ary as $filename) {
                 if ($this->use_ftp) {
                     if (!@ftp_delete($this->connect_id, $filename)) {
                         trigger_error('Ftp_error_del', ERROR);
                     }
                 } else {
                     $this->remove_file(wa_realpath($this->upload_path . $filename));
                 }
             }
             return count($filename_ary);
         }
         // end count file_id_ary
     }
     // end count log_id_ary
     return false;
 }