// 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 if (!defined('WT_WEBTREES')) { header('HTTP/1.0 403 Forbidden'); exit; } echo '</div>'; // <div id="content"> if ($view != 'simple') { echo '<div id="footer" class="', $TEXT_DIRECTION, '">'; echo '<br>'; echo contact_links(); echo '<br>'; echo '<p class="logo">'; echo '<a href="', WT_WEBTREES_URL, '" target="_blank" class="icon-webtrees" title="', WT_WEBTREES, ' ', WT_VERSION, '"></a>'; echo '</p>'; if (WT_DEBUG || get_gedcom_setting(WT_GED_ID, 'SHOW_STATS')) { echo execution_stats(); } if (exists_pending_change()) { echo '<a href="#" onclick="window.open(\'edit_changes.php\', \'_blank\', chan_window_specs); return false;">'; echo '<p class="error center">', WT_I18N::translate('There are pending changes for you to moderate.'), '</p>'; echo '</a>'; } echo '</div>'; // <div id="footer"> }
$menu_items = array(WT_MenuBar::getGedcomMenu(), WT_MenuBar::getMyPageMenu(), WT_MenuBar::getChartsMenu(), WT_MenuBar::getListsMenu(), WT_MenuBar::getCalendarMenu(), WT_MenuBar::getReportsMenu(), WT_MenuBar::getSearchMenu()); foreach (WT_MenuBar::getModuleMenus() as $menu) { $menu_items[] = $menu; } // Print the menu bar echo '<div id="topMenu">', '<ul id="main-menu">'; foreach ($menu_items as $menu) { if ($menu) { echo getMenuAsCustomList($menu); } } echo '</ul>'; echo '<div id="menu-right">', '<ul class="makeMenu">'; if (WT_USER_ID) { echo '<li><a href="edituser.php" class="link">', WT_Filter::escapeHtml(Auth::user()->getRealName()), '</a></li><li>', logout_link(), '</li>'; if (WT_USER_CAN_ACCEPT && exists_pending_change()) { echo ' <li><a href="#" onclick="window.open(\'edit_changes.php\',\'_blank\', chan_window_specs); return false;" style="color:red;">', WT_I18N::translate('Pending changes'), '</a></li>'; } } else { echo '<li>', login_link(), '</li>'; } $menu = WT_MenuBar::getFavoritesMenu(); if ($menu) { echo $menu->getMenuAsList(); } $menu = WT_MenuBar::getLanguageMenu(); if ($menu) { echo $menu->getMenuAsList(); } $menu = WT_MenuBar::getThemeMenu(); if ($menu) {
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; } } } }
/** * Print Review Changes Block * * Prints a block allowing the user review all changes pending approval */ function review_changes_block($block = true, $config = "", $side, $index) { global $pgv_lang, $ctype, $QUERY_STRING, $factarray, $PGV_IMAGE_DIR, $PGV_IMAGES; global $pgv_changes, $TEXT_DIRECTION, $SHOW_SOURCES, $PGV_BLOCKS; global $PHPGEDVIEW_EMAIL; if (empty($config)) { $config = $PGV_BLOCKS["review_changes_block"]["config"]; } if ($pgv_changes) { //-- if the time difference from the last email is greater than 24 hours then send out another email $LAST_CHANGE_EMAIL = get_site_setting('LAST_CHANGE_EMAIL'); if (time() - $LAST_CHANGE_EMAIL > 60 * 60 * 24 * $config["days"]) { $LAST_CHANGE_EMAIL = time(); set_site_setting('LAST_CHANGE_EMAIL', $LAST_CHANGE_EMAIL); write_changes(); if ($config["sendmail"] == "yes") { // Which users have pending changes? $users_with_changes = array(); foreach (get_all_users() as $user_id => $user_name) { foreach (get_all_gedcoms() as $ged_id => $ged_name) { if (exists_pending_change($user_id, $ged_id)) { $users_with_changes[$user_id] = $user_name; break; } } } foreach ($users_with_changes as $user_id => $user_name) { //-- send message $message = array(); $message["to"] = $user_name; $message["from"] = $PHPGEDVIEW_EMAIL; $message["subject"] = $pgv_lang["review_changes_subject"]; $message["body"] = $pgv_lang["review_changes_body"]; $message["method"] = get_user_setting($user_id, 'contactmethod'); $message["url"] = PGV_SCRIPT_NAME . "?" . html_entity_decode($QUERY_STRING); $message["no_from"] = true; addMessage($message); } } } if (PGV_USER_CAN_EDIT) { $id = "review_changes_block"; $title = print_help_link("review_changes_help", "qm", "", false, true); if ($PGV_BLOCKS["review_changes_block"]["canconfig"]) { if ($ctype == "gedcom" && PGV_USER_GEDCOM_ADMIN || $ctype == "user" && PGV_USER_ID) { if ($ctype == "gedcom") { $name = PGV_GEDCOM; } else { $name = PGV_USER_NAME; } $title .= "<a href=\"javascript: configure block\" onclick=\"window.open('" . encode_url("index_edit.php?name={$name}&ctype={$ctype}&action=configure&side={$side}&index={$index}") . "', '_blank', 'top=50,left=50,width=600,height=350,scrollbars=1,resizable=1'); return false;\">"; $title .= "<img class=\"adminicon\" src=\"{$PGV_IMAGE_DIR}/" . $PGV_IMAGES["admin"]["small"] . "\" width=\"15\" height=\"15\" border=\"0\" alt=\"" . $pgv_lang["config_block"] . "\" /></a>"; } } $title .= $pgv_lang["review_changes"]; $content = ""; if (PGV_USER_CAN_ACCEPT) { $content .= "<a href=\"javascript:;\" onclick=\"window.open('edit_changes.php','_blank','width=600,height=500,resizable=1,scrollbars=1'); return false;\">" . $pgv_lang["accept_changes"] . "</a><br />"; } if ($config["sendmail"] == "yes") { $content .= $pgv_lang["last_email_sent"] . format_timestamp($LAST_CHANGE_EMAIL) . "<br />"; $content .= $pgv_lang["next_email_sent"] . format_timestamp($LAST_CHANGE_EMAIL + 60 * 60 * 24 * $config["days"]) . "<br /><br />"; } foreach ($pgv_changes as $cid => $changes) { $change = $changes[count($changes) - 1]; if ($change["gedcom"] == PGV_GEDCOM) { $record = GedcomRecord::getInstance($change['gid']); if ($record->getType() != 'SOUR' || $SHOW_SOURCES >= PGV_USER_ACCESS_LEVEL) { $content .= '<b>' . PrintReady($record->getFullName()) . '</b> ' . getLRM() . '(' . $record->getXref() . ')' . getLRM(); switch ($record->getType()) { case 'INDI': case 'FAM': case 'SOUR': case 'OBJE': $content .= $block ? '<br />' : ' '; $content .= '<a href="' . encode_url($record->getLinkUrl() . '&show_changes=yes') . '">' . $pgv_lang['view_change_diff'] . '</a>'; break; } $content .= '<br />'; } } } global $THEME_DIR; if ($block) { require $THEME_DIR . 'templates/block_small_temp.php'; } else { require $THEME_DIR . 'templates/block_main_temp.php'; } } } }