Exemplo n.º 1
0
 /**
  * Manage updates sent from the AdminConfig@index form.
  */
 protected function update()
 {
     if (Auth::isAdmin()) {
         $this->module->setSetting('MAJ_SHOW_CERT', Filter::post('MAJ_SHOW_CERT'));
         $this->module->setSetting('MAJ_SHOW_NO_WATERMARK', Filter::post('MAJ_SHOW_NO_WATERMARK'));
         if ($MAJ_WM_DEFAULT = Filter::post('MAJ_WM_DEFAULT')) {
             $this->module->setSetting('MAJ_WM_DEFAULT', $MAJ_WM_DEFAULT);
         }
         if ($MAJ_WM_FONT_MAXSIZE = Filter::postInteger('MAJ_WM_FONT_MAXSIZE')) {
             $this->module->setSetting('MAJ_WM_FONT_MAXSIZE', $MAJ_WM_FONT_MAXSIZE);
         }
         // Only accept valid color for MAJ_WM_FONT_COLOR
         $MAJ_WM_FONT_COLOR = Filter::post('MAJ_WM_FONT_COLOR', '#([a-fA-F0-9]{3}){1,2}');
         if ($MAJ_WM_FONT_COLOR) {
             $this->module->setSetting('MAJ_WM_FONT_COLOR', $MAJ_WM_FONT_COLOR);
         }
         // Only accept valid folders for MAJ_CERT_ROOTDIR
         $MAJ_CERT_ROOTDIR = preg_replace('/[\\/\\\\]+/', '/', Filter::post('MAJ_CERT_ROOTDIR') . '/');
         if (substr($MAJ_CERT_ROOTDIR, 0, 1) === '/') {
             $MAJ_CERT_ROOTDIR = substr($MAJ_CERT_ROOTDIR, 1);
         }
         if ($MAJ_CERT_ROOTDIR) {
             if (is_dir(WT_DATA_DIR . $MAJ_CERT_ROOTDIR)) {
                 $this->module->setSetting('MAJ_CERT_ROOTDIR', $MAJ_CERT_ROOTDIR);
             } elseif (File::mkdir(WT_DATA_DIR . $MAJ_CERT_ROOTDIR)) {
                 $this->module->setSetting('MAJ_CERT_ROOTDIR', $MAJ_CERT_ROOTDIR);
                 FlashMessages::addMessage(I18N::translate('The folder %s has been created.', Html::filename(WT_DATA_DIR . $MAJ_CERT_ROOTDIR)), 'info');
             } else {
                 FlashMessages::addMessage(I18N::translate('The folder %s does not exist, and it could not be created.', Html::filename(WT_DATA_DIR . $MAJ_CERT_ROOTDIR)), 'danger');
             }
         }
         FlashMessages::addMessage(I18N::translate('The preferences for the module “%s” have been updated.', $this->module->getTitle()), 'success');
         return;
     }
 }
Exemplo n.º 2
0
 /**
  * Upgrade to to the next version
  */
 public function upgrade()
 {
     // - data update for 1.4.0 media changes
     $_cfgs = Database::prepare("SELECT gs1.gedcom_id AS gedcom_id, gs1.setting_value AS media_directory, gs2.setting_value AS use_media_firewall, gs3.setting_value AS media_firewall_thumbs, gs4.setting_value AS media_firewall_rootdir" . " FROM `##gedcom_setting` gs1" . " LEFT JOIN `##gedcom_setting` gs2 ON (gs1.gedcom_id = gs2.gedcom_id AND gs2.setting_name='USE_MEDIA_FIREWALL')" . " LEFT JOIN `##gedcom_setting` gs3 ON (gs1.gedcom_id = gs3.gedcom_id AND gs3.setting_name='MEDIA_FIREWALL_THUMBS')" . " LEFT JOIN `##gedcom_setting` gs4 ON (gs1.gedcom_id = gs4.gedcom_id AND gs4.setting_name='MEDIA_FIREWALL_ROOTDIR')" . " WHERE gs1.setting_name = 'MEDIA_DIRECTORY'")->fetchAll();
     // The constant WT_DATA_DIR is not defined yet (although it was when this script was originally written).
     $WT_DATA_DIR = realpath('data');
     // Check the config for each tree
     foreach ($_cfgs as $_cfg) {
         if ($_cfg->use_media_firewall) {
             // We’re using the media firewall.
             $_mf_dir = realpath($_cfg->media_firewall_rootdir) . DIRECTORY_SEPARATOR;
             if ($_mf_dir == $WT_DATA_DIR) {
                 // We’re already storing our media in the data folder - nothing to do.
             } else {
                 // We’ve chosen a custom location for our media folder - need to update our media-folder to point to it.
                 // We have, for example,
                 // $_mf_dir = /home/fisharebest/my_pictures/
                 // $WT_DATA_DIR = /home/fisharebest/public_html/webtrees/data/
                 // Therefore we need to calculate ../../../my_pictures/
                 $_media_dir = '';
                 $_tmp_dir = $WT_DATA_DIR;
                 while (strpos($_mf_dir, $_tmp_dir) !== 0) {
                     $_media_dir .= '../';
                     $_tmp_dir = preg_replace('~[^/\\\\]+[/\\\\]$~', '', $_tmp_dir);
                     if ($_tmp_dir == '') {
                         // Shouldn't get here - but this script is not allowed to fail...
                         continue 2;
                     }
                 }
                 $_media_dir .= $_cfg->media_directory;
                 Database::prepare("UPDATE `##gedcom_setting`" . " SET setting_value=?" . " WHERE gedcom_id=? AND setting_name='MEDIA_DIRECTORY'")->execute(array($_media_dir, $_cfg->gedcom_id));
             }
         } else {
             // Not using the media firewall - just move the public folder to the new location (if we can).
             if (file_exists(WT_ROOT . $_cfg->media_directory) && is_dir(WT_ROOT . $_cfg->media_directory) && !file_exists($WT_DATA_DIR . $_cfg->media_directory)) {
                 try {
                     rename(WT_ROOT . $_cfg->media_directory, $WT_DATA_DIR . $_cfg->media_directory);
                 } catch (\ErrorException $ex) {
                     // Cannot move the folder?
                 }
                 File::delete($WT_DATA_DIR . $_cfg->media_directory . '.htaccess');
                 File::delete($WT_DATA_DIR . $_cfg->media_directory . 'index.php');
                 File::delete($WT_DATA_DIR . $_cfg->media_directory . 'Mediainfo.txt');
                 File::delete($WT_DATA_DIR . $_cfg->media_directory . 'thumbs/Thumbsinfo.txt');
             }
         }
     }
     // Delete old settings
     Database::exec("DELETE FROM `##gedcom_setting` WHERE setting_name IN ('USE_MEDIA_FIREWALL', 'MEDIA_FIREWALL_THUMBS', 'MEDIA_FIREWALL_ROOTDIR')");
 }
Exemplo n.º 3
0
 /**
  * Check with the webtrees.net server for the latest version of webtrees.
  * Fetching the remote file can be slow, so check infrequently, and cache the result.
  * Pass the current versions of webtrees, PHP and MySQL, as the response
  * may be different for each.  The server logs are used to generate
  * installation statistics which can be found at http://svn.webtrees.net/statistics.html
  *
  * @return null|string
  */
 public static function fetchLatestVersion()
 {
     $last_update_timestamp = Site::getPreference('LATEST_WT_VERSION_TIMESTAMP');
     if ($last_update_timestamp < WT_TIMESTAMP - 24 * 60 * 60) {
         $row = Database::prepare("SHOW VARIABLES LIKE 'version'")->fetchOneRow();
         $params = '?w=' . WT_VERSION . '&p=' . PHP_VERSION . '&m=' . $row->value . '&o=' . (DIRECTORY_SEPARATOR === '/' ? 'u' : 'w');
         $latest_version_txt = File::fetchUrl('http://dev.webtrees.net/build/latest-version.txt' . $params);
         if ($latest_version_txt) {
             Site::setPreference('LATEST_WT_VERSION', $latest_version_txt);
             Site::setPreference('LATEST_WT_VERSION_TIMESTAMP', WT_TIMESTAMP);
             return $latest_version_txt;
         } else {
             // Cannot connect to server - use cached version (if we have one)
             return Site::getPreference('LATEST_WT_VERSION');
         }
     } else {
         return Site::getPreference('LATEST_WT_VERSION');
     }
 }
Exemplo n.º 4
0
 /**
  * Retrieve the number of visitors from Piwik, for a given period.
  * 
  * @param string $block_id
  * @param string $period
  * @param (null|int) Number of visits
  */
 private function getNumberOfVisitsPiwik($block_id, $period = 'year')
 {
     $piwik_url = $this->module->getBlockSetting($block_id, 'piwik_url');
     $piwik_siteid = $this->module->getBlockSetting($block_id, 'piwik_siteid');
     $piwik_token = $this->module->getBlockSetting($block_id, 'piwik_token');
     if ($piwik_url && strlen($piwik_url) > 0 && $piwik_siteid && strlen($piwik_siteid) > 0 && $piwik_token && strlen($piwik_token)) {
         // calling Piwik REST API
         $url = $piwik_url;
         $url .= '?module=API&method=VisitsSummary.getVisits';
         $url .= '&idSite=' . $piwik_siteid . '&period=' . $period . '&date=today';
         $url .= '&format=PHP';
         $url .= '&token_auth=' . $piwik_token;
         if ($fetched = File::fetchUrl($url)) {
             $content = @unserialize($fetched);
             if (is_numeric($content)) {
                 return $content;
             }
         }
     }
     return null;
 }
Exemplo n.º 5
0
    echo '<br>', I18N::translate('The file %s has been deleted.', Html::filename($lock_file)), $icon_success;
} else {
    echo '<br>', I18N::translate('The file %s could not be deleted.', Html::filename($lock_file)), $icon_failure;
}
echo '</li>';
////////////////////////////////////////////////////////////////////////////////
// Clean up
////////////////////////////////////////////////////////////////////////////////
echo '<li>', I18N::translate('Delete temporary files…');
reset_timeout();
if (File::delete($zip_dir)) {
    echo '<br>', I18N::translate('The folder %s has been deleted.', Html::filename($zip_dir)), $icon_success;
} else {
    echo '<br>', I18N::translate('The folder %s could not be deleted.', Html::filename($zip_dir)), $icon_failure;
}
if (File::delete($zip_file)) {
    echo '<br>', I18N::translate('The file %s has been deleted.', Html::filename($zip_file)), $icon_success;
} else {
    echo '<br>', I18N::translate('The file %s could not be deleted.', Html::filename($zip_file)), $icon_failure;
}
echo '</li>';
echo '</ul>';
echo '<p>', I18N::translate('The upgrade is complete.'), '</p>';
/**
 * Reset the time limit, as timeouts in this script could leave the upgrade incomplete.
 */
function reset_timeout()
{
    if (!ini_get('safe_mode') && strpos(ini_get('disable_functions'), 'set_time_limit') === false) {
        set_time_limit(ini_get('max_execution_time'));
    }
Exemplo n.º 6
0
 /**
  * Get the filename on the server - for those (very few!) functions which actually
  * need the filename, such as mediafirewall.php and the PDF reports.
  *
  * @param string $which
  *
  * @return string
  */
 public function getServerFilename($which = 'main')
 {
     $MEDIA_DIRECTORY = $this->tree->getPreference('MEDIA_DIRECTORY');
     $THUMBNAIL_WIDTH = $this->tree->getPreference('THUMBNAIL_WIDTH');
     if ($this->isExternal() || !$this->file) {
         // External image, or (in the case of corrupt GEDCOM data) no image at all
         return $this->file;
     } elseif ($which == 'main') {
         // Main image
         return WT_DATA_DIR . $MEDIA_DIRECTORY . $this->file;
     } else {
         // Thumbnail
         $file = WT_DATA_DIR . $MEDIA_DIRECTORY . 'thumbs/' . $this->file;
         // Does the thumbnail exist?
         if (file_exists($file)) {
             return $file;
         }
         // Does a user-generated thumbnail exist?
         $user_thumb = preg_replace('/\\.[a-z0-9]{3,5}$/i', '.png', $file);
         if (file_exists($user_thumb)) {
             return $user_thumb;
         }
         // Does the folder exist for this thumbnail?
         if (!is_dir(dirname($file)) && !File::mkdir(dirname($file))) {
             Log::addMediaLog('The folder ' . dirname($file) . ' could not be created for ' . $this->getXref());
             return $file;
         }
         // Is there a corresponding main image?
         $main_file = WT_DATA_DIR . $MEDIA_DIRECTORY . $this->file;
         if (!file_exists($main_file)) {
             Log::addMediaLog('The file ' . $main_file . ' does not exist for ' . $this->getXref());
             return $file;
         }
         // Try to create a thumbnail automatically
         try {
             $imgsize = getimagesize($main_file);
             // Image small enough to be its own thumbnail?
             if ($imgsize[0] > 0 && $imgsize[0] <= $THUMBNAIL_WIDTH) {
                 try {
                     copy($main_file, $file);
                     Log::addMediaLog('Thumbnail created for ' . $main_file . ' (copy of main image)');
                 } catch (\ErrorException $ex) {
                     Log::addMediaLog('Thumbnail could not be created for ' . $main_file . ' (copy of main image)');
                 }
             } else {
                 if (FunctionsMedia::hasMemoryForImage($main_file)) {
                     try {
                         switch ($imgsize['mime']) {
                             case 'image/png':
                                 $main_image = imagecreatefrompng($main_file);
                                 break;
                             case 'image/gif':
                                 $main_image = imagecreatefromgif($main_file);
                                 break;
                             case 'image/jpeg':
                                 $main_image = imagecreatefromjpeg($main_file);
                                 break;
                             default:
                                 return $file;
                                 // Nothing else we can do :-(
                         }
                         if ($main_image) {
                             // How big should the thumbnail be?
                             $width = $THUMBNAIL_WIDTH;
                             $height = round($imgsize[1] * ($width / $imgsize[0]));
                             $thumb_image = imagecreatetruecolor($width, $height);
                             // Create a transparent background, instead of the default black one
                             imagesavealpha($thumb_image, true);
                             imagefill($thumb_image, 0, 0, imagecolorallocatealpha($thumb_image, 0, 0, 0, 127));
                             // Shrink the image
                             imagecopyresampled($thumb_image, $main_image, 0, 0, 0, 0, $width, $height, $imgsize[0], $imgsize[1]);
                             switch ($imgsize['mime']) {
                                 case 'image/png':
                                     imagepng($thumb_image, $file);
                                     break;
                                 case 'image/gif':
                                     imagegif($thumb_image, $file);
                                     break;
                                 case 'image/jpeg':
                                     imagejpeg($thumb_image, $file);
                                     break;
                             }
                             imagedestroy($main_image);
                             imagedestroy($thumb_image);
                             Log::addMediaLog('Thumbnail created for ' . $main_file);
                         }
                     } catch (\ErrorException $ex) {
                         Log::addMediaLog('Failed to create thumbnail for ' . $main_file);
                     }
                 } else {
                     Log::addMediaLog('Not enough memory to create thumbnail for ' . $main_file);
                 }
             }
         } catch (\ErrorException $ex) {
             // Not an image, or not a valid image?
         }
         return $file;
     }
 }
Exemplo n.º 7
0
namespace Fisharebest\Webtrees;

use Fisharebest\Webtrees\Controller\PageController;
use Fisharebest\Webtrees\Functions\FunctionsEdit;
define('WT_SCRIPT_NAME', 'admin_site_config.php');
require './includes/session.php';
$controller = new PageController();
$controller->restrictAccess(Auth::isAdmin());
switch (Filter::post('action')) {
    case 'site':
        if (Filter::checkCsrf()) {
            $INDEX_DIRECTORY = Filter::post('INDEX_DIRECTORY');
            if (substr($INDEX_DIRECTORY, -1) !== '/') {
                $INDEX_DIRECTORY .= '/';
            }
            if (File::mkdir($INDEX_DIRECTORY)) {
                Site::setPreference('INDEX_DIRECTORY', $INDEX_DIRECTORY);
            } else {
                FlashMessages::addMessage(I18N::translate('The folder %s does not exist, and it could not be created.', Filter::escapeHtml($INDEX_DIRECTORY)), 'danger');
            }
            Site::setPreference('MEMORY_LIMIT', Filter::post('MEMORY_LIMIT'));
            Site::setPreference('MAX_EXECUTION_TIME', Filter::post('MAX_EXECUTION_TIME'));
            Site::setPreference('ALLOW_USER_THEMES', Filter::postBool('ALLOW_USER_THEMES'));
            Site::setPreference('THEME_DIR', Filter::post('THEME_DIR'));
            Site::setPreference('ALLOW_CHANGE_GEDCOM', Filter::postBool('ALLOW_CHANGE_GEDCOM'));
            Site::setPreference('SESSION_TIME', Filter::post('SESSION_TIME'));
            Site::setPreference('SERVER_URL', Filter::post('SERVER_URL'));
            Site::setPreference('TIMEZONE', Filter::post('TIMEZONE'));
            FlashMessages::addMessage(I18N::translate('The website preferences have been updated.'), 'success');
        }
        header('Location: ' . WT_BASE_URL . 'admin.php');
Exemplo n.º 8
0
 /**
  * Check if thumbnails from cache should be recreated
  * 
  * @param type $mediaobject
  * @return string filename
  */
 private function getThumbnail(Media $mediaobject)
 {
     $cache_dir = $this->cacheDir();
     if (!file_exists($cache_dir)) {
         File::mkdir($cache_dir);
     }
     if (file_exists($mediaobject->getServerFilename())) {
         $cache_filename = $this->cacheFileName($mediaobject);
         if (!is_file($cache_filename)) {
             $thumbnail = $this->fancyThumb($mediaobject);
             $mimetype = $mediaobject->mimeType();
             if ($mimetype === 'image/jpeg') {
                 imagejpeg($thumbnail, $cache_filename);
             } elseif ($mimetype === 'image/png') {
                 imagepng($thumbnail, $cache_filename);
             } else {
                 return;
             }
         }
         return $cache_filename;
     }
 }
Exemplo n.º 9
0
 if ($folderName && !is_dir(WT_DATA_DIR . $MEDIA_DIRECTORY . $folderName)) {
     if (Auth::isManager($WT_TREE)) {
         if (File::mkdir(WT_DATA_DIR . $MEDIA_DIRECTORY . $folderName)) {
             FlashMessages::addMessage(I18N::translate('The folder %s has been created.', Html::filename(WT_DATA_DIR . $MEDIA_DIRECTORY . $folderName)));
         } else {
             FlashMessages::addMessage(I18N::translate('The folder %s does not exist, and it could not be created.', Html::filename(WT_DATA_DIR . $MEDIA_DIRECTORY . $folderName)), 'danger');
             break;
         }
     } else {
         // Regular users should not have seen this option - so no need for an error message.
         break;
     }
 }
 // The media folder exists. Now create a thumbnail folder to match it.
 if (!is_dir(WT_DATA_DIR . $MEDIA_DIRECTORY . 'thumbs/' . $folderName)) {
     if (!File::mkdir(WT_DATA_DIR . $MEDIA_DIRECTORY . 'thumbs/' . $folderName)) {
         FlashMessages::addMessage(I18N::translate('The folder %s does not exist, and it could not be created.', Html::filename(WT_DATA_DIR . $MEDIA_DIRECTORY . 'thumbs/' . $folderName)), 'danger');
         break;
     }
 }
 // Validate the media path and filename
 if (preg_match('/^https?:\\/\\//i', $filename, $match)) {
     // External media needs no further validation
     $fileName = $filename;
     $folderName = '';
     unset($_FILES['mediafile'], $_FILES['thumbnail']);
 } elseif (preg_match('/([\\/\\\\<>])/', $filename, $match)) {
     // Local media files cannot contain certain special characters
     FlashMessages::addMessage(I18N::translate('Filenames are not allowed to contain the character “%s”.', $match[1]));
     break;
 } elseif (preg_match('/(\\.(php|pl|cgi|bash|sh|bat|exe|com|htm|html|shtml))$/i', $filename, $match)) {
Exemplo n.º 10
0
 $WT_TREE->setPreference('THEME_DIR', Filter::post('THEME_DIR'));
 $WT_TREE->setPreference('THUMBNAIL_WIDTH', Filter::post('THUMBNAIL_WIDTH'));
 $WT_TREE->setPreference('USE_SILHOUETTE', Filter::postBool('USE_SILHOUETTE'));
 $WT_TREE->setPreference('WATERMARK_THUMB', Filter::postBool('WATERMARK_THUMB'));
 $WT_TREE->setPreference('WEBMASTER_USER_ID', Filter::post('WEBMASTER_USER_ID'));
 $WT_TREE->setPreference('WEBTREES_EMAIL', Filter::post('WEBTREES_EMAIL'));
 $WT_TREE->setPreference('title', Filter::post('title'));
 // Only accept valid folders for MEDIA_DIRECTORY
 $MEDIA_DIRECTORY = preg_replace('/[\\/\\\\]+/', '/', Filter::post('MEDIA_DIRECTORY') . '/');
 if (substr($MEDIA_DIRECTORY, 0, 1) === '/') {
     $MEDIA_DIRECTORY = substr($MEDIA_DIRECTORY, 1);
 }
 if ($MEDIA_DIRECTORY) {
     if (is_dir(WT_DATA_DIR . $MEDIA_DIRECTORY)) {
         $WT_TREE->setPreference('MEDIA_DIRECTORY', $MEDIA_DIRECTORY);
     } elseif (File::mkdir(WT_DATA_DIR . $MEDIA_DIRECTORY)) {
         $WT_TREE->setPreference('MEDIA_DIRECTORY', $MEDIA_DIRECTORY);
         FlashMessages::addMessage(I18N::translate('The folder %s has been created.', Html::filename(WT_DATA_DIR . $MEDIA_DIRECTORY)), 'info');
     } else {
         FlashMessages::addMessage(I18N::translate('The folder %s does not exist, and it could not be created.', Html::filename(WT_DATA_DIR . $MEDIA_DIRECTORY)), 'danger');
     }
 }
 $gedcom = Filter::post('gedcom');
 if ($gedcom && $gedcom !== $WT_TREE->getName()) {
     try {
         Database::prepare("UPDATE `##gedcom` SET gedcom_name = ? WHERE gedcom_id = ?")->execute(array($gedcom, $WT_TREE->getTreeId()));
         Database::prepare("UPDATE `##site_setting` SET setting_value = ? WHERE setting_name='DEFAULT_GEDCOM' AND setting_value = ?")->execute(array($gedcom, $WT_TREE->getName()));
     } catch (\Exception $ex) {
         // Probably a duplicate name.
     }
 }
Exemplo n.º 11
0
 *
 * @global Tree $WT_TREE
 */
global $WT_TREE;
use Fisharebest\Webtrees\Controller\PageController;
use Fisharebest\Webtrees\Functions\Functions;
define('WT_SCRIPT_NAME', 'admin.php');
require './includes/session.php';
// This is a list of old files and directories, from earlier versions of webtrees, that can be deleted.
// It was generated with the help of a command like this:
// git diff 1.6.0..master --name-status | grep ^D
$old_files = array(WT_ROOT . 'language/en.mo', WT_ROOT . 'themechange.php', WT_ROOT . 'includes/extras', WT_ROOT . 'addremotelink.php', WT_ROOT . 'addsearchlink.php', WT_ROOT . 'client.php', WT_ROOT . 'dir_editor.php', WT_ROOT . 'editconfig_gedcom.php', WT_ROOT . 'editgedcoms.php', WT_ROOT . 'edit_merge.php', WT_ROOT . 'genservice.php', WT_ROOT . 'includes/classes', WT_ROOT . 'includes/controllers', WT_ROOT . 'includes/family_nav.php', WT_ROOT . 'logs.php', WT_ROOT . 'manageservers.php', WT_ROOT . 'media.php', WT_ROOT . 'module_admin.php', WT_ROOT . 'opensearch.php', WT_ROOT . 'PEAR.php', WT_ROOT . 'pgv_to_wt.php', WT_ROOT . 'places', WT_ROOT . 'serviceClientTest.php', WT_ROOT . 'siteconfig.php', WT_ROOT . 'SOAP', WT_ROOT . 'themes/clouds/mozilla.css', WT_ROOT . 'themes/clouds/netscape.css', WT_ROOT . 'themes/colors/mozilla.css', WT_ROOT . 'themes/colors/netscape.css', WT_ROOT . 'themes/fab/mozilla.css', WT_ROOT . 'themes/fab/netscape.css', WT_ROOT . 'themes/minimal/mozilla.css', WT_ROOT . 'themes/minimal/netscape.css', WT_ROOT . 'themes/webtrees/mozilla.css', WT_ROOT . 'themes/webtrees/netscape.css', WT_ROOT . 'themes/webtrees/style_rtl.css', WT_ROOT . 'themes/xenea/mozilla.css', WT_ROOT . 'themes/xenea/netscape.css', WT_ROOT . 'uploadmedia.php', WT_ROOT . 'useradmin.php', WT_ROOT . 'webservice', WT_ROOT . 'wtinfo.php', WT_ROOT . 'treenav.php', WT_ROOT . 'themes/clouds/jquery', WT_ROOT . 'themes/colors/jquery', WT_ROOT . 'themes/fab/jquery', WT_ROOT . 'themes/minimal/jquery', WT_ROOT . 'themes/webtrees/jquery', WT_ROOT . 'themes/xenea/jquery', WT_ROOT . 'themes/clouds/chrome.css', WT_ROOT . 'themes/clouds/opera.css', WT_ROOT . 'themes/clouds/print.css', WT_ROOT . 'themes/clouds/style_rtl.css', WT_ROOT . 'themes/colors/chrome.css', WT_ROOT . 'themes/colors/opera.css', WT_ROOT . 'themes/colors/print.css', WT_ROOT . 'themes/colors/style_rtl.css', WT_ROOT . 'themes/fab/chrome.css', WT_ROOT . 'themes/fab/opera.css', WT_ROOT . 'themes/minimal/chrome.css', WT_ROOT . 'themes/minimal/opera.css', WT_ROOT . 'themes/minimal/print.css', WT_ROOT . 'themes/minimal/style_rtl.css', WT_ROOT . 'themes/xenea/chrome.css', WT_ROOT . 'themes/xenea/opera.css', WT_ROOT . 'themes/xenea/print.css', WT_ROOT . 'themes/xenea/style_rtl.css', WT_ROOT . 'includes/cssparser.inc.php', WT_ROOT . 'modules_v3/gedcom_favorites/help_text.php', WT_ROOT . 'modules_v3/GEDFact_assistant/_MEDIA/media_3_find.php', WT_ROOT . 'modules_v3/GEDFact_assistant/_MEDIA/media_3_search_add.php', WT_ROOT . 'modules_v3/GEDFact_assistant/_MEDIA/media_5_input.js', WT_ROOT . 'modules_v3/GEDFact_assistant/_MEDIA/media_5_input.php', WT_ROOT . 'modules_v3/GEDFact_assistant/_MEDIA/media_7_parse_addLinksTbl.php', WT_ROOT . 'modules_v3/GEDFact_assistant/_MEDIA/media_query_1a.php', WT_ROOT . 'modules_v3/GEDFact_assistant/_MEDIA/media_query_2a.php', WT_ROOT . 'modules_v3/GEDFact_assistant/_MEDIA/media_query_3a.php', WT_ROOT . 'modules_v3/lightbox/css/album_page_RTL2.css', WT_ROOT . 'modules_v3/lightbox/css/album_page_RTL.css', WT_ROOT . 'modules_v3/lightbox/css/album_page_RTL_ff.css', WT_ROOT . 'modules_v3/lightbox/css/clearbox_music.css', WT_ROOT . 'modules_v3/lightbox/css/clearbox_music_RTL.css', WT_ROOT . 'modules_v3/user_favorites/db_schema', WT_ROOT . 'modules_v3/user_favorites/help_text.php', WT_ROOT . 'search_engine.php', WT_ROOT . 'themes/clouds/modules.css', WT_ROOT . 'themes/colors/modules.css', WT_ROOT . 'themes/fab/modules.css', WT_ROOT . 'themes/minimal/modules.css', WT_ROOT . 'themes/webtrees/modules.css', WT_ROOT . 'themes/xenea/modules.css', WT_ROOT . 'includes/media_reorder_count.php', WT_ROOT . 'includes/media_tab_head.php', WT_ROOT . 'modules_v3/clippings/index.php', WT_ROOT . 'modules_v3/googlemap/css/googlemap_style.css', WT_ROOT . 'modules_v3/googlemap/css/wt_v3_places_edit.css', WT_ROOT . 'modules_v3/googlemap/index.php', WT_ROOT . 'modules_v3/lightbox/index.php', WT_ROOT . 'modules_v3/recent_changes/help_text.php', WT_ROOT . 'modules_v3/todays_events/help_text.php', WT_ROOT . 'sidebar.php', WT_ROOT . 'modules_v3/sitemap/admin_index.php', WT_ROOT . 'modules_v3/sitemap/help_text.php', WT_ROOT . 'modules_v3/tree/css/styles', WT_ROOT . 'modules_v3/tree/css/treebottom.gif', WT_ROOT . 'modules_v3/tree/css/treebottomleft.gif', WT_ROOT . 'modules_v3/tree/css/treebottomright.gif', WT_ROOT . 'modules_v3/tree/css/tree.jpg', WT_ROOT . 'modules_v3/tree/css/treeleft.gif', WT_ROOT . 'modules_v3/tree/css/treeright.gif', WT_ROOT . 'modules_v3/tree/css/treetop.gif', WT_ROOT . 'modules_v3/tree/css/treetopleft.gif', WT_ROOT . 'modules_v3/tree/css/treetopright.gif', WT_ROOT . 'modules_v3/tree/css/treeview_print.css', WT_ROOT . 'modules_v3/tree/help_text.php', WT_ROOT . 'modules_v3/tree/images/print.png', WT_ROOT . 'login_register.php', WT_ROOT . 'modules_v3/top10_givnnames/help_text.php', WT_ROOT . 'modules_v3/top10_surnames/help_text.php', WT_ROOT . 'admin_site_ipaddress.php', WT_ROOT . 'downloadgedcom.php', WT_ROOT . 'export_gedcom.php', WT_ROOT . 'gedcheck.php', WT_ROOT . 'images', WT_ROOT . 'includes/dmsounds_UTF8.php', WT_ROOT . 'includes/grampsxml.rng', WT_ROOT . 'includes/session_spider.php', WT_ROOT . 'modules_v3/googlemap/admin_editconfig.php', WT_ROOT . 'modules_v3/googlemap/admin_placecheck.php', WT_ROOT . 'modules_v3/googlemap/flags.php', WT_ROOT . 'modules_v3/googlemap/images/pedigree_map.gif', WT_ROOT . 'modules_v3/googlemap/pedigree_map.php', WT_ROOT . 'modules_v3/lightbox/admin_config.php', WT_ROOT . 'modules_v3/lightbox/album.php', WT_ROOT . 'modules_v3/tree/css/vline.jpg', WT_ROOT . 'imageflush.php', WT_ROOT . 'modules_v3/googlemap/wt_v3_pedigree_map.js.php', WT_ROOT . 'modules_v3/lightbox/js/tip_balloon_RTL.js', WT_ROOT . 'includes/set_gedcom_defaults.php', WT_ROOT . 'modules_v3/address_report', WT_ROOT . 'modules_v3/lightbox/functions/lb_horiz_sort.php', WT_ROOT . 'modules_v3/random_media/help_text.php', WT_ROOT . 'imageview.php', WT_ROOT . 'media/MediaInfo.txt', WT_ROOT . 'media/thumbs/ThumbsInfo.txt', WT_ROOT . 'modules_v3/GEDFact_assistant/css/media_0_inverselink.css', WT_ROOT . 'modules_v3/lightbox/help_text.php', WT_ROOT . 'modules_v3/lightbox/images/blank.gif', WT_ROOT . 'modules_v3/lightbox/images/close_1.gif', WT_ROOT . 'modules_v3/lightbox/images/image_add.gif', WT_ROOT . 'modules_v3/lightbox/images/image_copy.gif', WT_ROOT . 'modules_v3/lightbox/images/image_delete.gif', WT_ROOT . 'modules_v3/lightbox/images/image_edit.gif', WT_ROOT . 'modules_v3/lightbox/images/image_link.gif', WT_ROOT . 'modules_v3/lightbox/images/images.gif', WT_ROOT . 'modules_v3/lightbox/images/image_view.gif', WT_ROOT . 'modules_v3/lightbox/images/loading.gif', WT_ROOT . 'modules_v3/lightbox/images/next.gif', WT_ROOT . 'modules_v3/lightbox/images/nextlabel.gif', WT_ROOT . 'modules_v3/lightbox/images/norm_2.gif', WT_ROOT . 'modules_v3/lightbox/images/overlay.png', WT_ROOT . 'modules_v3/lightbox/images/prev.gif', WT_ROOT . 'modules_v3/lightbox/images/prevlabel.gif', WT_ROOT . 'modules_v3/lightbox/images/private.gif', WT_ROOT . 'modules_v3/lightbox/images/slideshow.jpg', WT_ROOT . 'modules_v3/lightbox/images/transp80px.gif', WT_ROOT . 'modules_v3/lightbox/images/zoom_1.gif', WT_ROOT . 'modules_v3/lightbox/js', WT_ROOT . 'modules_v3/lightbox/music', WT_ROOT . 'modules_v3/lightbox/pic', WT_ROOT . 'themes/_administration/jquery', WT_ROOT . 'themes/webtrees/chrome.css', WT_ROOT . 'modules_v3/lightbox/images/image_edit.png', WT_ROOT . 'modules_v3/lightbox/images/image_view.png', WT_ROOT . 'modules_v3/lightbox/images/image_view.png', WT_ROOT . 'modules_v3/top10_pageviews/help_text.php', WT_ROOT . 'themes/_administration/jquery-ui-1.10.0', WT_ROOT . 'themes/clouds/jquery-ui-1.10.0', WT_ROOT . 'themes/colors/jquery-ui-1.10.0', WT_ROOT . 'themes/fab/jquery-ui-1.10.0', WT_ROOT . 'themes/minimal/jquery-ui-1.10.0', WT_ROOT . 'themes/webtrees/jquery-ui-1.10.0', WT_ROOT . 'themes/xenea/jquery-ui-1.10.0', WT_ROOT . 'includes/media_reorder.php', WT_ROOT . 'includes/old_messages.php', WT_ROOT . 'modules_v3/GEDFact_assistant/_CENS/census_note_decode.php', WT_ROOT . 'modules_v3/GEDFact_assistant/_CENS/census_asst_date.php', WT_ROOT . 'modules_v3/googlemap/wt_v3_googlemap.js.php', WT_ROOT . 'modules_v3/lightbox/functions/lightbox_print_media.php', WT_ROOT . 'modules_v3/upcoming_events/help_text.php', WT_ROOT . 'modules_v3/stories/help_text.php', WT_ROOT . 'modules_v3/user_messages/help_text.php', WT_ROOT . 'themes/_administration/favicon.png', WT_ROOT . 'themes/_administration/images', WT_ROOT . 'themes/_administration/msie.css', WT_ROOT . 'themes/_administration/style.css', WT_ROOT . 'themes/clouds/favicon.png', WT_ROOT . 'themes/clouds/images', WT_ROOT . 'themes/clouds/msie.css', WT_ROOT . 'themes/clouds/style.css', WT_ROOT . 'themes/colors/css', WT_ROOT . 'themes/colors/favicon.png', WT_ROOT . 'themes/colors/images', WT_ROOT . 'themes/colors/ipad.css', WT_ROOT . 'themes/colors/msie.css', WT_ROOT . 'themes/fab/favicon.png', WT_ROOT . 'themes/fab/images', WT_ROOT . 'themes/fab/msie.css', WT_ROOT . 'themes/fab/style.css', WT_ROOT . 'themes/minimal/favicon.png', WT_ROOT . 'themes/minimal/images', WT_ROOT . 'themes/minimal/msie.css', WT_ROOT . 'themes/minimal/style.css', WT_ROOT . 'themes/webtrees/favicon.png', WT_ROOT . 'themes/webtrees/images', WT_ROOT . 'themes/webtrees/msie.css', WT_ROOT . 'themes/webtrees/style.css', WT_ROOT . 'themes/xenea/favicon.png', WT_ROOT . 'themes/xenea/images', WT_ROOT . 'themes/xenea/msie.css', WT_ROOT . 'themes/xenea/style.css', WT_ROOT . 'themes/_administration/css-1.5.0', WT_ROOT . 'themes/clouds/css-1.5.0', WT_ROOT . 'themes/colors/css-1.5.0', WT_ROOT . 'themes/fab/css-1.5.0', WT_ROOT . 'themes/minimal/css-1.5.0', WT_ROOT . 'themes/webtrees/css-1.5.0', WT_ROOT . 'themes/xenea/css-1.5.0', WT_ROOT . 'themes/_administration/css-1.5.1', WT_ROOT . 'themes/clouds/css-1.5.1', WT_ROOT . 'themes/colors/css-1.5.1', WT_ROOT . 'themes/fab/css-1.5.1', WT_ROOT . 'themes/minimal/css-1.5.1', WT_ROOT . 'themes/webtrees/css-1.5.1', WT_ROOT . 'themes/xenea/css-1.5.1', WT_ROOT . 'modules_v3/GEDFact_assistant/_CENS/census_asst_help.php', WT_ROOT . 'modules_v3/googlemap/admin_places.php', WT_ROOT . 'modules_v3/googlemap/defaultconfig.php', WT_ROOT . 'modules_v3/googlemap/googlemap.php', WT_ROOT . 'modules_v3/googlemap/placehierarchy.php', WT_ROOT . 'modules_v3/googlemap/places_edit.php', WT_ROOT . 'modules_v3/googlemap/util.js', WT_ROOT . 'modules_v3/googlemap/wt_v3_places_edit.js.php', WT_ROOT . 'modules_v3/googlemap/wt_v3_places_edit_overlays.js.php', WT_ROOT . 'modules_v3/googlemap/wt_v3_street_view.php', WT_ROOT . 'readme.html', WT_ROOT . 'themes/_administration/css-1.5.2', WT_ROOT . 'themes/clouds/css-1.5.2', WT_ROOT . 'themes/colors/css-1.5.2', WT_ROOT . 'themes/fab/css-1.5.2', WT_ROOT . 'themes/minimal/css-1.5.2', WT_ROOT . 'themes/webtrees/css-1.5.2', WT_ROOT . 'themes/xenea/css-1.5.2', WT_ROOT . 'downloadbackup.php', WT_ROOT . 'modules_v3/ckeditor/ckeditor-4.3.2-custom', WT_ROOT . 'site-php-version.php', WT_ROOT . 'themes/_administration/css-1.5.3', WT_ROOT . 'themes/clouds/css-1.5.3', WT_ROOT . 'themes/colors/css-1.5.3', WT_ROOT . 'themes/fab/css-1.5.3', WT_ROOT . 'themes/minimal/css-1.5.3', WT_ROOT . 'themes/webtrees/css-1.5.3', WT_ROOT . 'themes/xenea/css-1.5.3', WT_ROOT . 'includes/authentication.php', WT_ROOT . 'themes/_administration/css-1.6.0', WT_ROOT . 'themes/_administration/jquery-ui-1.10.3', WT_ROOT . 'themes/clouds/css-1.6.0', WT_ROOT . 'themes/clouds/jquery-ui-1.10.3', WT_ROOT . 'themes/colors/css-1.6.0', WT_ROOT . 'themes/colors/jquery-ui-1.10.3', WT_ROOT . 'themes/fab/css-1.6.0', WT_ROOT . 'themes/fab/jquery-ui-1.10.3', WT_ROOT . 'themes/minimal/css-1.6.0', WT_ROOT . 'themes/minimal/jquery-ui-1.10.3', WT_ROOT . 'themes/webtrees/css-1.6.0', WT_ROOT . 'themes/webtrees/jquery-ui-1.10.3', WT_ROOT . 'themes/xenea/css-1.6.0', WT_ROOT . 'themes/xenea/jquery-ui-1.10.3', WT_ROOT . 'themes/_administration/css-1.6.0', WT_ROOT . 'themes/_administration/jquery-ui-1.10.3', WT_ROOT . 'admin_site_other.php', WT_ROOT . 'includes/config_data.php', WT_ROOT . 'includes/db_schema', WT_ROOT . 'includes/fonts', WT_ROOT . 'includes/functions', WT_ROOT . 'includes/hitcount.php', WT_ROOT . 'includes/reportheader.php', WT_ROOT . 'includes/specialchars.php', WT_ROOT . 'js', WT_ROOT . 'language/en_GB.mo', WT_ROOT . 'language/en_US.mo', WT_ROOT . 'language/pt_BR.mo', WT_ROOT . 'language/zh_CN.mo', WT_ROOT . 'language/extra', WT_ROOT . 'library', WT_ROOT . 'modules_v3/batch_update/admin_batch_update.php', WT_ROOT . 'modules_v3/batch_update/plugins', WT_ROOT . 'modules_v3/charts/help_text.php', WT_ROOT . 'modules_v3/ckeditor/ckeditor-4.4.1-custom', WT_ROOT . 'modules_v3/clippings/clippings_ctrl.php', WT_ROOT . 'modules_v3/clippings/help_text.php', WT_ROOT . 'modules_v3/faq/help_text.php', WT_ROOT . 'modules_v3/gedcom_favorites/db_schema', WT_ROOT . 'modules_v3/gedcom_news/db_schema', WT_ROOT . 'modules_v3/googlemap/db_schema', WT_ROOT . 'modules_v3/googlemap/help_text.php', WT_ROOT . 'modules_v3/html/help_text.php', WT_ROOT . 'modules_v3/logged_in/help_text.php', WT_ROOT . 'modules_v3/review_changes/help_text.php', WT_ROOT . 'modules_v3/todo/help_text.php', WT_ROOT . 'modules_v3/tree/class_treeview.php', WT_ROOT . 'modules_v3/user_blog/db_schema', WT_ROOT . 'modules_v3/yahrzeit/help_text.php', WT_ROOT . 'save.php', WT_ROOT . 'themes/_administration/css-1.6.2', WT_ROOT . 'themes/_administration/templates', WT_ROOT . 'themes/_administration/header.php', WT_ROOT . 'themes/_administration/footer.php', WT_ROOT . 'themes/clouds/css-1.6.2', WT_ROOT . 'themes/clouds/templates', WT_ROOT . 'themes/clouds/header.php', WT_ROOT . 'themes/clouds/footer.php', WT_ROOT . 'themes/colors/css-1.6.2', WT_ROOT . 'themes/colors/templates', WT_ROOT . 'themes/colors/header.php', WT_ROOT . 'themes/colors/footer.php', WT_ROOT . 'themes/fab/css-1.6.2', WT_ROOT . 'themes/fab/templates', WT_ROOT . 'themes/fab/header.php', WT_ROOT . 'themes/fab/footer.php', WT_ROOT . 'themes/minimal/css-1.6.2', WT_ROOT . 'themes/minimal/templates', WT_ROOT . 'themes/minimal/header.php', WT_ROOT . 'themes/minimal/footer.php', WT_ROOT . 'themes/webtrees/css-1.6.2', WT_ROOT . 'themes/webtrees/templates', WT_ROOT . 'themes/webtrees/header.php', WT_ROOT . 'themes/webtrees/footer.php', WT_ROOT . 'themes/xenea/css-1.6.2', WT_ROOT . 'themes/xenea/templates', WT_ROOT . 'themes/xenea/header.php', WT_ROOT . 'themes/xenea/footer.php', WT_ROOT . 'assets/js-1.7.0', WT_ROOT . 'packages/bootstrap-3.3.4', WT_ROOT . 'packages/bootstrap-datetimepicker-4.0.0', WT_ROOT . 'packages/ckeditor-4.4.7-custom', WT_ROOT . 'packages/font-awesome-4.3.0', WT_ROOT . 'packages/jquery-1.11.2', WT_ROOT . 'packages/jquery-2.1.3', WT_ROOT . 'packages/moment-2.10.3', WT_ROOT . 'includes/php_53_compatibility.php', WT_ROOT . 'modules_v3/GEDFact_assistant/census/date.js', WT_ROOT . 'modules_v3/GEDFact_assistant/census/dynamicoptionlist.js', WT_ROOT . 'packages/jquery-cookie-1.4.1/jquery.cookie.js');
// Delete old files (if we can).
$files_to_delete = array();
foreach ($old_files as $file) {
    if (file_exists($file) && !File::delete($file)) {
        $files_to_delete[] = $file;
    }
}
$controller = new PageController();
$controller->restrictAccess(Auth::isManager($WT_TREE))->setPageTitle(I18N::translate('Control panel') . ' — ' . I18N::translate('Dashboard'))->pageHeader();
// Check for updates
$latest_version_txt = Functions::fetchLatestVersion();
if (preg_match('/^[0-9.]+\\|[0-9.]+\\|/', $latest_version_txt)) {
    list($latest_version) = explode('|', $latest_version_txt);
} else {
    // Cannot determine the latest version
    $latest_version = '';
}
$update_available = Auth::isAdmin() && $latest_version && version_compare(WT_VERSION, $latest_version) < 0;
// Total number of users
Exemplo n.º 12
0
reset_timeout();
if (File::delete($zip_dir)) {
    echo '<br>', I18N::translate('The folder %s has been deleted.', Html::filename($zip_dir)), $icon_success;
} else {
    echo '<br>', I18N::translate('The folder %s could not be deleted.', Html::filename($zip_dir)), $icon_failure;
}
if (File::delete($zip_file)) {
    echo '<br>', I18N::translate('The file %s has been deleted.', Html::filename($zip_file)), $icon_success;
} else {
    echo '<br>', I18N::translate('The file %s could not be deleted.', Html::filename($zip_file)), $icon_failure;
}
echo '</li>';
echo '</ul>';
// We have updated the language files.
foreach (glob(WT_DATA_DIR . 'cache/language-*') as $file) {
    File::delete($file);
}
echo '<p>', I18N::translate('The upgrade is complete.'), '</p>';
/**
 * Reset the time limit, as timeouts in this script could leave the upgrade incomplete.
 */
function reset_timeout()
{
    if (!ini_get('safe_mode') && strpos(ini_get('disable_functions'), 'set_time_limit') === false) {
        try {
            set_time_limit(ini_get('max_execution_time'));
        } catch (Exception $ex) {
            // "set_time_limt(): Cannot set max execution time limit due to system policy"
        }
    }
}
Exemplo n.º 13
0
 public function pageData()
 {
     $path = WT_DATA_DIR . '/ftv_cache/';
     if (!file_exists($path)) {
         File::mkdir($path);
     }
     $filename = $path . 'fancy-treeview-tmp.txt';
     $content = Filter::post('pdfContent');
     // make our datafile if it does not exist.
     if (!file_exists($filename)) {
         $handle = fopen($filename, 'w');
         fclose($handle);
         chmod($filename, 0644);
     }
     // Let's make sure the file exists and is writable first.
     if (is_writable($filename)) {
         if (!($handle = @fopen($filename, 'w'))) {
             exit;
         }
         // Write the pdfContent to our data.txt file.
         if (fwrite($handle, $content) === FALSE) {
             exit;
         }
         fclose($handle);
     }
 }
Exemplo n.º 14
0
 /**
  * Check if thumbnails from cache should be recreated
  *
  * @param type $mediaobject
  * @return string filename
  */
 private function getThumbnail(Media $mediaobject)
 {
     $cache_dir = $this->cacheDir();
     if (!file_exists($cache_dir)) {
         File::mkdir($cache_dir);
     }
     if (file_exists($mediaobject->getServerFilename())) {
         $cache_filename = $this->cacheFileName($mediaobject);
         if (!is_file($cache_filename)) {
             if ($this->options('resize_thumbs')) {
                 $thumbnail = $this->fancyThumb($mediaobject);
                 $mimetype = $mediaobject->mimeType();
                 if ($mimetype === 'image/jpeg') {
                     imagejpeg($thumbnail, $cache_filename);
                 } elseif ($mimetype === 'image/png') {
                     imagepng($thumbnail, $cache_filename);
                 } else {
                     return;
                 }
             } else {
                 // if we are using the original webtrees thumbnails, copy them to the ftv_cache folder
                 // so we can cache them either and output them in the same way we would output the fancy thumbnail.
                 try {
                     copy($mediaobject->getServerFilename('thumb'), $cache_filename);
                 } catch (Exception $ex) {
                     // something went wrong while copying the default webtrees image to the ftv cache folder
                     // there is a fallback in the function printThumbnail(): output $mediaobject->displayImage();
                 }
             }
         }
         return $cache_filename;
     }
 }
Exemplo n.º 15
0
    }
}
// send headers for the image
header('Content-Type: ' . $mimetype);
header('Content-Disposition: filename="' . addslashes(basename($media->getFilename())) . '"');
if ($generatewatermark) {
    // generate the watermarked image
    $imCreateFunc = 'imagecreatefrom' . $type;
    $imSendFunc = 'image' . $type;
    if (function_exists($imCreateFunc) && function_exists($imSendFunc)) {
        $im = $imCreateFunc($serverFilename);
        $im = applyWatermark($im, $WT_TREE);
        // save the image, if preferences allow
        if ($which === 'thumb' && $WT_TREE->getPreference('SAVE_WATERMARK_THUMB') || $which === 'main' && $WT_TREE->getPreference('SAVE_WATERMARK_IMAGE')) {
            // make sure the folder exists
            File::mkdir(dirname($watermarkfile));
            // save the image
            $imSendFunc($im, $watermarkfile);
        }
        // send the image
        $imSendFunc($im);
        imagedestroy($im);
        return;
    } else {
        // this image is defective. log it
        Log::addMediaLog('Media Firewall error: >' . I18N::translate('This media file is broken and cannot be watermarked.') . '< in file >' . $serverFilename . '< memory used: ' . memory_get_usage());
        // set usewatermark to false so image will simply be passed through below
        $usewatermark = false;
    }
}
// pass the image through without manipulating it
Exemplo n.º 16
0
 * 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 <http://www.gnu.org/licenses/>.
 */
namespace Fisharebest\Webtrees;

use Fisharebest\Webtrees\Controller\PageController;
use Rhumsaa\Uuid\Uuid;
define('WT_SCRIPT_NAME', 'admin_site_clean.php');
require './includes/session.php';
$to_delete = Filter::postArray('to_delete');
if ($to_delete && Filter::checkCsrf()) {
    foreach ($to_delete as $path) {
        $is_dir = is_dir(WT_DATA_DIR . $path);
        if (File::delete(WT_DATA_DIR . $path)) {
            if ($is_dir) {
                FlashMessages::addMessage(I18N::translate('The folder %s has been deleted.', Filter::escapeHtml($path)), 'success');
            } else {
                FlashMessages::addMessage(I18N::translate('The file %s has been deleted.', Filter::escapeHtml($path)), 'success');
            }
        } else {
            if ($is_dir) {
                FlashMessages::addMessage(I18N::translate('The folder %s could not be deleted.', Filter::escapeHtml($path)), 'danger');
            } else {
                FlashMessages::addMessage(I18N::translate('The file %s could not be deleted.', Filter::escapeHtml($path)), 'danger');
            }
        }
    }
    header('Location: ' . WT_BASE_URL . WT_SCRIPT_NAME);
    return;
Exemplo n.º 17
0
 /** {@inheritdoc} */
 public function modAction($mod_action)
 {
     switch ($mod_action) {
         case 'admin_config':
             if (Filter::postBool('save') && Filter::checkCsrf()) {
                 $this->setSetting('FTV_PDF_ACCESS_LEVEL', Filter::postInteger('NEW_FTV_PDF_ACCESS_LEVEL'));
                 Log::addConfigurationLog($this->getTitle() . ' config updated');
             }
             $template = new AdminTemplate();
             return $template->pageContent();
         case 'full_pdf':
             echo $this->module()->printPage(0);
             break;
         case 'write_pdf':
             $tmp_dir = WT_DATA_DIR . 'ftv_pdf_tmp/';
             if (file_exists($tmp_dir)) {
                 File::delete($tmp_dir);
             }
             File::mkdir($tmp_dir);
             $template = new PdfTemplate();
             return $template->pageBody();
         case 'output_pdf':
             $file = WT_DATA_DIR . 'ftv_pdf_tmp/' . Filter::get('title') . '.pdf';
             if (file_exists($file)) {
                 ob_start();
                 header('Content-Description: File Transfer');
                 header('Content-Type: application/pdf');
                 header('Content-Disposition: attachment; filename="' . basename($file) . '"');
                 header('Content-Transfer-Encoding: binary');
                 header('Expires: 0');
                 header('Cache-Control: must-revalidate');
                 header('Pragma: public');
                 ob_clean();
                 ob_end_flush();
                 readfile($file);
                 File::delete(dirname($file));
             } else {
                 FlashMessages::addMessage(I18N::translate('The file %s could not be created.', basename($file)), 'danger');
                 Header('Location:' . WT_BASE_URL . 'module.php?mod=fancy_treeview&mod_action=page&rootid=' . Filter::get('rootid') . '&ged=' . Filter::get('ged'));
             }
             break;
         default:
             http_response_code(404);
             break;
     }
 }
Exemplo n.º 18
0
        // Create the unzipped GEDCOM on disk, so we can ZIP it.
        $stream = fopen($temp_dir . $download_filename, "w");
        FunctionsExport::exportGedcom($WT_TREE, $stream, $exportOptions);
        fclose($stream);
        // Create a ZIP file containing the GEDCOM file.
        $comment = "Created by " . WT_WEBTREES . " " . WT_VERSION . " on " . date("r") . ".";
        $archive = new PclZip($temp_dir . $zip_file);
        $v_list = $archive->add($temp_dir . $download_filename, \PCLZIP_OPT_COMMENT, $comment, \PCLZIP_OPT_REMOVE_PATH, $temp_dir);
        if ($v_list == 0) {
            echo "Error : " . $archive->errorInfo(true);
        } else {
            header('Content-Type: application/zip');
            header('Content-Disposition: attachment; filename="' . $zip_file . '"');
            header('Content-length: ' . filesize($temp_dir . $zip_file));
            readfile($temp_dir . $zip_file);
            File::delete($temp_dir);
        }
    } else {
        header('Content-Type: text/plain; charset=UTF-8');
        header('Content-Disposition: attachment; filename="' . $download_filename . '"');
        // Stream the GEDCOM file straight to the browser.
        // We could open "php://compress.zlib" to create a .gz file or "php://compress.bzip2" to create a .bz2 file
        $stream = fopen('php://output', 'w');
        FunctionsExport::exportGedcom($WT_TREE, $stream, $exportOptions);
        fclose($stream);
    }
    return;
}
$controller->pageHeader();
?>
<ol class="breadcrumb small">
Exemplo n.º 19
0
 /**
  * Initialise the translation adapter with a locale setting.
  *
  * @param string|null $code Use this locale/language code, or choose one automatically
  *
  * @return string $string
  */
 public static function init($code = null)
 {
     global $WT_TREE;
     mb_internal_encoding('UTF-8');
     if ($code !== null) {
         // Create the specified locale
         self::$locale = Locale::create($code);
     } else {
         // Negotiate a locale, but if we can't then use a failsafe
         self::$locale = new LocaleEnUs();
         if (Session::has('locale')) {
             // Previously used
             self::$locale = Locale::create(Session::get('locale'));
         } else {
             // Browser negotiation
             $default_locale = new LocaleEnUs();
             try {
                 if ($WT_TREE) {
                     $default_locale = Locale::create($WT_TREE->getPreference('LANGUAGE'));
                 }
             } catch (\Exception $ex) {
             }
             self::$locale = Locale::httpAcceptLanguage($_SERVER, self::installedLocales(), $default_locale);
         }
     }
     $cache_dir_exists = File::mkdir(WT_DATA_DIR . 'cache');
     $cache_file = WT_DATA_DIR . 'cache/language-' . self::$locale->languageTag() . '-cache.php';
     if (file_exists($cache_file)) {
         $filemtime = filemtime($cache_file);
     } else {
         $filemtime = 0;
     }
     // Load the translation file(s)
     // Note that glob() returns false instead of an empty array when open_basedir_restriction
     // is in force and no files are found.  See PHP bug #47358.
     if (defined('GLOB_BRACE')) {
         $translation_files = array_merge(array(WT_ROOT . 'language/' . self::$locale->languageTag() . '.mo'), glob(WT_MODULES_DIR . '*/language/' . self::$locale->languageTag() . '.{csv,php,mo}', GLOB_BRACE) ?: array(), glob(WT_DATA_DIR . 'language/' . self::$locale->languageTag() . '.{csv,php,mo}', GLOB_BRACE) ?: array());
     } else {
         // Some servers do not have GLOB_BRACE - see http://php.net/manual/en/function.glob.php
         $translation_files = array_merge(array(WT_ROOT . 'language/' . self::$locale->languageTag() . '.mo'), glob(WT_MODULES_DIR . '*/language/' . self::$locale->languageTag() . '.csv') ?: array(), glob(WT_MODULES_DIR . '*/language/' . self::$locale->languageTag() . '.php') ?: array(), glob(WT_MODULES_DIR . '*/language/' . self::$locale->languageTag() . '.mo') ?: array(), glob(WT_DATA_DIR . 'language/' . self::$locale->languageTag() . '.csv') ?: array(), glob(WT_DATA_DIR . 'language/' . self::$locale->languageTag() . '.php') ?: array(), glob(WT_DATA_DIR . 'language/' . self::$locale->languageTag() . '.mo') ?: array());
     }
     // Rebuild files after one hour
     $rebuild_cache = time() > $filemtime + 3600;
     // Rebuild files if any translation file has been updated
     foreach ($translation_files as $translation_file) {
         if (filemtime($translation_file) > $filemtime) {
             $rebuild_cache = true;
             break;
         }
     }
     if ($rebuild_cache) {
         $translations = array();
         foreach ($translation_files as $translation_file) {
             $translation = new Translation($translation_file);
             $translations = array_merge($translations, $translation->asArray());
         }
         if ($cache_dir_exists) {
             // During setup, we may not have been able to create it.
             file_put_contents($cache_file, '<' . '?php return ' . var_export($translations, true) . ';');
         }
     } else {
         $translations = (include $cache_file);
     }
     // Create a translator
     self::$translator = new Translator($translations, self::$locale->pluralRule());
     // Alphabetic sorting sequence (upper-case letters), used by webtrees to sort strings
     list(, self::$alphabet_upper) = explode('=', self::$translator->translate('ALPHABET_upper=ABCDEFGHIJKLMNOPQRSTUVWXYZ'));
     // Alphabetic sorting sequence (lower-case letters), used by webtrees to sort strings
     list(, self::$alphabet_lower) = explode('=', self::$translator->translate('ALPHABET_lower=abcdefghijklmnopqrstuvwxyz'));
     self::$list_separator = self::translate(', ');
     return self::$locale->languageTag();
 }