Example #1
0
        }
        // Total filtered/unfiltered rows
        $recordsFiltered = WT_DB::prepare("SELECT FOUND_ROWS()")->fetchColumn();
        $recordsTotal = WT_DB::prepare($SELECT2 . $WHERE)->execute($args)->fetchColumn();
        header('Content-type: application/json');
        echo json_encode(array('sEcho' => WT_Filter::getInteger('sEcho'), 'recordsTotal' => $recordsTotal, 'recordsFiltered' => $recordsFiltered, 'data' => $data));
        exit;
}
$controller->pageHeader()->addExternalJavascript(WT_JQUERY_DATATABLES_URL)->addInlineJavascript('
		jQuery("#log_list").dataTable( {
			dom: \'<"H"pf<"dt-clear">irl>t<"F"pl>\',
			processing: true,
			serverSide: true,
			ajax: "' . WT_SERVER_NAME . WT_SCRIPT_PATH . WT_SCRIPT_NAME . '?action=load_json&from=' . $from . '&to=' . $to . '&type=' . $type . '&text=' . rawurlencode($text) . '&ip=' . rawurlencode($ip) . '&user='******'&gedc=' . rawurlencode($gedc) . '",
			' . WT_I18N::datatablesI18N(array(10, 20, 50, 100, 500, 1000, -1)) . ',
			jQueryUI: true,
			autoWidth: false,
			sorting: [[ 0, "desc" ]],
			pageLength: ' . Auth::user()->getSetting('admin_site_log_page_size', 20) . ',
			pagingType: "full_numbers"
		});
	');
$url = WT_SCRIPT_NAME . '?from=' . rawurlencode($from) . '&amp;to=' . rawurlencode($to) . '&amp;type=' . rawurlencode($type) . '&amp;text=' . rawurlencode($text) . '&amp;ip=' . rawurlencode($ip) . '&amp;user='******'&amp;gedc=' . rawurlencode($gedc);
$users_array = array();
foreach (User::all() as $tmp_user) {
    $users_array[$tmp_user->getUserName()] = $tmp_user->getUserName();
}
echo '<form name="logs" method="get" action="' . WT_SCRIPT_NAME . '">', '<input type="hidden" name="action", value="show">', '<table class="site_logs">', '<tr>', '<td colspan="6">', WT_I18N::translate('From %s to %s', '<input class="log-date" name="from" value="' . WT_Filter::escapeHtml($from) . '">', '<input class="log-date" name="to" value="' . WT_Filter::escapeHtml($to) . '">'), '</td>', '</tr><tr>', '<td>', WT_I18N::translate('Type'), '<br>', select_edit_control('type', array('' => '', 'auth' => 'auth', 'config' => 'config', 'debug' => 'debug', 'edit' => 'edit', 'error' => 'error', 'media' => 'media', 'search' => 'search'), null, $type, ''), '</td>', '<td>', WT_I18N::translate('Message'), '<br><input class="log-filter" name="text" value="', WT_Filter::escapeHtml($text), '"> ', '</td>', '<td>', WT_I18N::translate('IP address'), '<br><input class="log-filter" name="ip" value="', WT_Filter::escapeHtml($ip), '"> ', '</td>', '<td>', WT_I18N::translate('User'), '<br>', select_edit_control('user', $users_array, '', $user, ''), '</td>', '<td>', WT_I18N::translate('Family tree'), '<br>', select_edit_control('gedc', WT_Tree::getNameList(), '', $gedc, Auth::isAdmin() ? '' : 'disabled'), '</td>', '</tr><tr>', '<td colspan="6">', '<input type="submit" value="', WT_I18N::translate('Filter'), '">', '<input type="submit" value="', WT_I18N::translate('Export'), '" onclick="document.logs.action.value=\'export\';return true;" ', $action == 'show' ? '' : 'disabled="disabled"', '>', '<input type="submit" value="', WT_I18N::translate('Delete'), '" onclick="if (confirm(\'', WT_Filter::escapeHtml(WT_I18N::translate('Permanently delete these records?')), '\')) {document.logs.action.value=\'delete\';return true;} else {return false;}" ', $action == 'show' ? '' : 'disabled="disabled"', '>', '</td>', '</tr>', '</table>', '</form>';
if ($action) {
    echo '<br>', '<table id="log_list">', '<thead>', '<tr>', '<th>', WT_I18N::translate('Timestamp'), '</th>', '<th>', WT_I18N::translate('Type'), '</th>', '<th>', WT_I18N::translate('Message'), '</th>', '<th>', WT_I18N::translate('IP address'), '</th>', '<th>', WT_I18N::translate('User'), '</th>', '<th>', WT_I18N::translate('Family tree'), '</th>', '</tr>', '</thead>', '<tbody>', '</tbody>', '</table>';
}
Example #2
0
	</table>
	<p>
	<?php 
        if ($ucnt > 0) {
            ?>
<input type="submit" value="<?php 
            echo WT_I18N::translate('continue');
            ?>
">&nbsp;&nbsp;<?php 
        }
        ?>
	</p>
	</form><?php 
        break;
    case 'cleanup2':
        foreach (User::all() as $user) {
            if (WT_Filter::post('del_' . $user->getUserId()) == '1') {
                Log::addAuthenticationLog('Deleted user: '******'Deleted user: '******'<br>';
                $user->delete();
            }
        }
        break;
    case 'listusers':
    default:
        echo '<table id="list">', '<thead>', '<tr>', '<th style="margin:0 -2px 1px 1px; padding:6px 0 5px;"> </th>', '<th> user-id </th>', '<th>', WT_I18N::translate('Username'), '</th>', '<th>', WT_I18N::translate('Real name'), '</th>', '<th>', WT_I18N::translate('Email'), '</th>', '<th> </th>', '<th>', WT_I18N::translate('Language'), '</th>', '<th> date_registered </th>', '<th>', WT_I18N::translate('Date registered'), '</th>', '<th> last_login </th>', '<th>', WT_I18N::translate('Last logged in'), '</th>', '<th>', WT_I18N::translate('Verified'), '</th>', '<th>', WT_I18N::translate('Approved'), '</th>', '<th style="margin:0 -2px 1px 1px; padding:3px 0 4px;"> </th>', '</tr>', '</thead>', '<tbody>', '</tbody>', '</table>';
        $controller->addExternalJavascript(WT_JQUERY_DATATABLES_URL)->addExternalJavascript(WT_JQUERY_JEDITABLE_URL)->addInlineJavascript('
			var oTable = jQuery("#list").dataTable({
				dom: \'<"H"pf<"dt-clear">irl>t<"F"pl>\',
				' . WT_I18N::datatablesI18N() . ',
				processing: true,
Example #3
0
 public function getBlock($block_id, $template = true, $cfg = null)
 {
     global $ctype, $WEBTREES_EMAIL;
     $changes = WT_DB::prepare("SELECT 1" . " FROM `##change`" . " WHERE status='pending'" . " LIMIT 1")->fetchOne();
     $days = get_block_setting($block_id, 'days', 1);
     $sendmail = get_block_setting($block_id, 'sendmail', true);
     $block = get_block_setting($block_id, 'block', true);
     if ($cfg) {
         foreach (array('days', 'sendmail', 'block') as $name) {
             if (array_key_exists($name, $cfg)) {
                 ${$name} = $cfg[$name];
             }
         }
     }
     if ($changes && $sendmail == 'yes') {
         // There are pending changes - tell moderators/managers/administrators about them.
         if (WT_TIMESTAMP - WT_Site::getPreference('LAST_CHANGE_EMAIL') > 60 * 60 * 24 * $days) {
             // Which users have pending changes?
             foreach (User::all() as $user) {
                 if ($user->getSetting('contactmethod') !== 'none') {
                     foreach (WT_Tree::getAll() as $tree) {
                         if (exists_pending_change($user, $tree)) {
                             WT_I18N::init($user->getSetting('language'));
                             WT_Mail::systemMessage($tree, $user, WT_I18N::translate('Pending changes'), WT_I18N::translate('There are pending changes for you to moderate.') . WT_Mail::EOL . WT_MAIL::EOL . '<a href="' . WT_SERVER_NAME . WT_SCRIPT_PATH . 'index.php?ged=' . WT_GEDURL . '">' . WT_SERVER_NAME . WT_SCRIPT_PATH . 'index.php?ged=' . WT_GEDURL . '</a>');
                             WT_I18N::init(WT_LOCALE);
                         }
                     }
                 }
             }
             WT_Site::setPreference('LAST_CHANGE_EMAIL', WT_TIMESTAMP);
         }
         if (WT_USER_CAN_EDIT) {
             $id = $this->getName() . $block_id;
             $class = $this->getName() . '_block';
             if ($ctype == 'gedcom' && WT_USER_GEDCOM_ADMIN || $ctype == 'user' && WT_USER_ID) {
                 $title = '<i class="icon-admin" title="' . WT_I18N::translate('Configure') . '" onclick="modalDialog(\'block_edit.php?block_id=' . $block_id . '\', \'' . $this->getTitle() . '\');"></i>';
             } else {
                 $title = '';
             }
             $title .= $this->getTitle() . help_link('review_changes', $this->getName());
             $content = '';
             if (WT_USER_CAN_ACCEPT) {
                 $content .= "<a href=\"#\" onclick=\"window.open('edit_changes.php','_blank', chan_window_specs); return false;\">" . WT_I18N::translate('There are pending changes for you to moderate.') . "</a><br>";
             }
             if ($sendmail == "yes") {
                 $content .= WT_I18N::translate('Last email reminder was sent ') . format_timestamp(WT_Site::getPreference('LAST_CHANGE_EMAIL')) . "<br>";
                 $content .= WT_I18N::translate('Next email reminder will be sent after ') . format_timestamp(WT_Site::getPreference('LAST_CHANGE_EMAIL') + 60 * 60 * 24 * $days) . "<br><br>";
             }
             $changes = WT_DB::prepare("SELECT xref" . " FROM  `##change`" . " WHERE status='pending'" . " AND   gedcom_id=?" . " GROUP BY xref")->execute(array(WT_GED_ID))->fetchAll();
             foreach ($changes as $change) {
                 $record = WT_GedcomRecord::getInstance($change->xref);
                 if ($record->canShow()) {
                     $content .= '<b>' . $record->getFullName() . '</b>';
                     $content .= $block ? '<br>' : ' ';
                     $content .= '<a href="' . $record->getHtmlUrl() . '">' . WT_I18N::translate('View the changes') . '</a>';
                     $content .= '<br>';
                 }
             }
             if ($template) {
                 if ($block) {
                     require WT_THEME_DIR . 'templates/block_small_temp.php';
                 } else {
                     require WT_THEME_DIR . 'templates/block_main_temp.php';
                 }
             } else {
                 return $content;
             }
         }
     }
 }
Example #4
0
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
use WT\Auth;
use WT\User;
define('WT_SCRIPT_NAME', 'admin_pgv_to_wt.php');
require './includes/session.php';
//require WT_ROOT.'includes/functions/functions_edit.php';
// We can only import into an empty system, so deny access if we have already created a gedcom or added users.
if (WT_GED_ID || count(User::all()) > 1) {
    header('Location: ' . WT_SERVER_NAME . WT_SCRIPT_PATH);
    exit;
}
$controller = new WT_Controller_Page();
$controller->restrictAccess(Auth::isAdmin())->setPageTitle(WT_I18N::translate('PhpGedView to webtrees transfer wizard'));
$error = '';
$warning = '';
$PGV_PATH = WT_Filter::post('PGV_PATH');
if ($PGV_PATH) {
    if (!is_dir($PGV_PATH) || !is_readable($PGV_PATH . '/config.php')) {
        $error = WT_I18N::translate('The specified directory does not contain an installation of PhpGedView');
    } else {
        // Load the configuration settings
        $config_php = file_get_contents($PGV_PATH . '/config.php');
        // The easiest way to do this is to exec() the file - but not lines containing require or PHP tags
            $in_progress = WT_DB::prepare("SELECT 1 FROM `##gedcom_chunk` WHERE gedcom_id=? AND imported=1 LIMIT 1")->execute(array($tree->tree_id))->fetchOne();
            if (!$in_progress) {
                echo '<div id="import', $tree->tree_id, '"><div id="progressbar', $tree->tree_id, '"><div style="position:absolute;">', WT_I18N::translate('Deleting old genealogy data…'), '</div></div></div>';
                $controller->addInlineJavascript('jQuery("#progressbar' . $tree->tree_id . '").progressbar({value: 0});');
            } else {
                echo '<div id="import', $tree->tree_id, '"></div>';
            }
            $controller->addInlineJavascript('jQuery("#import' . $tree->tree_id . '").load("import.php?gedcom_id=' . $tree->tree_id . '&keep_media' . $tree->tree_id . '=' . WT_Filter::get('keep_media' . $tree->tree_id) . '");');
            echo '<table border="0" width="100%" id="actions', $tree->tree_id, '" style="display:none">';
        } else {
            echo '<table border="0" width="100%" id="actions', $tree->tree_id, '">';
        }
        echo '<tr align="center">', '<td><a href="admin_trees_export.php?ged=', $tree->tree_name_url, '" onclick="return modalDialog(\'admin_trees_export.php?ged=', $tree->tree_name_url, '\', \'', WT_I18N::translate('Export'), '\');">', WT_I18N::translate('Export'), '</a>', help_link('export_gedcom'), '</td>', '<td><a href="', WT_SCRIPT_NAME, '?action=importform&amp;gedcom_id=', $tree->tree_id, '">', WT_I18N::translate('Import'), '</a>', help_link('import_gedcom'), '</td>', '<td><a href="admin_trees_download.php?ged=', $tree->tree_name_url, '">', WT_I18N::translate('Download'), '</a>', help_link('download_gedcom'), '</td>', '<td><a href="', WT_SCRIPT_NAME, '?action=uploadform&amp;gedcom_id=', $tree->tree_id, '">', WT_I18N::translate('Upload'), '</a>', help_link('upload_gedcom'), '</td>', '<td>', '<a href="#" onclick="if (confirm(\'' . WT_Filter::escapeJs(WT_I18N::translate('Are you sure you want to delete “%s”?', $tree->tree_name)), '\')) document.delete_form', $tree->tree_id, '.submit(); return false;">', WT_I18N::translate('Delete'), '</a>', '<form name="delete_form', $tree->tree_id, '" method="post" action="', WT_SCRIPT_NAME, '">', '<input type="hidden" name="action" value="delete">', '<input type="hidden" name="gedcom_id" value="', $tree->tree_id, '">', WT_Filter::getCsrf(), '</form>', '</td></tr></table></td></tr></table><br>';
    }
}
// Options for creating new gedcoms and setting defaults
if (Auth::isAdmin()) {
    echo '<table class="gedcom_table2"><tr>';
    if (count(WT_Tree::GetAll()) > 1) {
        echo '<th>', WT_I18N::translate('Default family tree'), help_link('default_gedcom'), '</th>';
    }
    echo '<th>', WT_I18N::translate('Create a new family tree'), help_link('add_new_gedcom'), '</th></tr><tr>';
    if (count(WT_Tree::GetAll()) > 1) {
        echo '<td><form name="defaultform" method="post" action="', WT_SCRIPT_NAME, '">', '<input type="hidden" name="action" value="setdefault">', WT_Filter::getCsrf(), select_edit_control('default_ged', WT_Tree::getNameList(), '', WT_Site::preference('DEFAULT_GEDCOM'), 'onchange="document.defaultform.submit();"'), '</form></td>';
    }
    echo '<td class="button">', '<form name="createform" method="post" action="', WT_SCRIPT_NAME, '">', WT_Filter::getCsrf(), '<input type="hidden" name="action" value="new_tree">', '<input name="ged_name">', ' <input type="submit" value="', WT_I18N::translate('save'), '">', '</form>', '</td>', '</tr></table><br>';
    // display link to PGV-WT transfer wizard on first visit to this page, before any GEDCOM is loaded
    if (count(WT_Tree::GetAll()) == 0 && count(User::all()) == 1) {
        echo '<div class="center">', '<a style="color:green; font-weight:bold;" href="admin_pgv_to_wt.php">', WT_I18N::translate('Click here for PhpGedView to <b>webtrees</b> transfer wizard'), '</a>', help_link('PGV_WIZARD'), '</div>';
    }
}
Example #6
0
 public function getBlock($block_id, $template = true, $cfg = null)
 {
     global $ctype;
     require_once WT_ROOT . 'includes/functions/functions_print_facts.php';
     // Block actions
     $action = WT_Filter::get('action');
     $message_id = WT_Filter::getArray('message_id');
     if ($action == 'deletemessage') {
         foreach ($message_id as $msg_id) {
             deleteMessage($msg_id);
         }
     }
     $block = get_block_setting($block_id, 'block', true);
     if ($cfg) {
         foreach (array('block') as $name) {
             if (array_key_exists($name, $cfg)) {
                 ${$name} = $cfg[$name];
             }
         }
     }
     $messages = getUserMessages(WT_USER_ID);
     $id = $this->getName() . $block_id;
     $class = $this->getName() . '_block';
     $title = WT_I18N::plural('%s message', '%s messages', count($messages), WT_I18N::number(count($messages)));
     $content = '<form name="messageform" action="index.php?ctype=' . $ctype . '" method="get" onsubmit="return confirm(\'' . WT_I18N::translate('Are you sure you want to delete this message?  It cannot be retrieved later.') . '\');">';
     if (count(User::all()) > 1) {
         $content .= '<br>' . WT_I18N::translate('Send message') . " <select name=\"touser\">";
         $content .= '<option value="">' . WT_I18N::translate('&lt;select&gt;') . '</option>';
         foreach (User::all() as $user) {
             if ($user->getUserId() != WT_USER_ID && $user->getSetting('verified_by_admin') && $user->getSetting('contactmethod') != 'none') {
                 $content .= '<option value="' . WT_Filter::escapeHtml($user->getUserName()) . '">';
                 $content .= '<span dir="auto">' . WT_Filter::escapeHtml($user->getRealName()) . '</span> - <span dir="auto">' . WT_Filter::escapeHtml($user->getUserName()) . '</span>';
                 $content .= '</option>';
             }
         }
         $content .= '</select> <input type="button" value="' . WT_I18N::translate('Send') . '" onclick="message(document.messageform.touser.options[document.messageform.touser.selectedIndex].value, \'messaging2\', \'\'); return false;"><br><br>';
     }
     if (count($messages) == 0) {
         $content .= WT_I18N::translate('You have no pending messages.') . "<br>";
     } else {
         $content .= '<input type="hidden" name="action" value="deletemessage">';
         $content .= '<table class="list_table"><tr>';
         $content .= '<td class="list_label">' . WT_I18N::translate('Delete') . '<br><a href="#" onclick="jQuery(\'#' . $this->getName() . $block_id . ' :checkbox\').prop(\'checked\', true); return false;">' . WT_I18N::translate('All') . '</a></td>';
         $content .= '<td class="list_label">' . WT_I18N::translate('Subject:') . '</td>';
         $content .= '<td class="list_label">' . WT_I18N::translate('Date sent:') . '</td>';
         $content .= '<td class="list_label">' . WT_I18N::translate('Email address:') . '</td>';
         $content .= '</tr>';
         foreach ($messages as $message) {
             $content .= '<tr>';
             $content .= '<td class="list_value_wrap"><input type="checkbox" id="cb_message' . $message->message_id . '" name="message_id[]" value="' . $message->message_id . '"></td>';
             $content .= '<td class="list_value_wrap"><a href="#" onclick="return expand_layer(\'message' . $message->message_id . '\');"><i id="message' . $message->message_id . '_img" class="icon-plus"></i> <b dir="auto">' . WT_Filter::escapeHtml($message->subject) . '</b></a></td>';
             $content .= '<td class="list_value_wrap">' . format_timestamp($message->created) . '</td>';
             $content .= '<td class="list_value_wrap">';
             $user = User::findByIdentifier($message->sender);
             if ($user) {
                 $content .= '<span dir="auto">' . $user->getRealName() . '</span>';
                 $content .= '  - <span dir="auto">' . $user->getEmail() . '</span>';
             } else {
                 $content .= '<a href="mailto:' . WT_Filter::escapeHtml($message->sender) . '">' . WT_Filter::escapeHtml($message->sender) . '</a>';
             }
             $content .= '</td>';
             $content .= '</tr>';
             $content .= '<tr><td class="list_value_wrap" colspan="5"><div id="message' . $message->message_id . '" style="display:none;">';
             $content .= '<div dir="auto" style="white-space: pre-wrap;">' . WT_Filter::expandUrls($message->body) . '</div><br>';
             if (strpos($message->subject, WT_I18N::translate('RE: ')) !== 0) {
                 $message->subject = WT_I18N::translate('RE: ') . $message->subject;
             }
             if ($user) {
                 $content .= '<a href="#" onclick="reply(\'' . WT_Filter::escapeJs($message->sender) . '\', \'' . WT_Filter::escapeJs($message->subject) . '\'); return false;">' . WT_I18N::translate('Reply') . '</a> | ';
             }
             $content .= '<a href="index.php?action=deletemessage&amp;message_id[]=' . $message->message_id . '" onclick="return confirm(\'' . WT_I18N::translate('Are you sure you want to delete this message?  It cannot be retrieved later.') . '\');">' . WT_I18N::translate('Delete') . '</a></div></td></tr>';
         }
         $content .= '</table>';
         $content .= '<input type="submit" value="' . WT_I18N::translate('Delete selected messages') . '"><br>';
     }
     $content .= '</form>';
     if ($template) {
         if ($block) {
             require WT_THEME_DIR . 'templates/block_small_temp.php';
         } else {
             require WT_THEME_DIR . 'templates/block_main_temp.php';
         }
     } else {
         return $content;
     }
 }
Example #7
0
 static function totalNonAdmins()
 {
     return WT_I18N::number(count(User::all()) - count(User::allAdmins()));
 }